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
0909.4893
2
0909
2010-01-12T19:40:45
Range Non-Overlapping Indexing
[ "cs.DS" ]
We study the non-overlapping indexing problem: Given a text T, preprocess it so that you can answer queries of the form: given a pattern P, report the maximal set of non-overlapping occurrences of P in T. A generalization of this problem is the range non-overlapping indexing where in addition we are given two indexes i,j to report the maximal set of non-overlapping occurrences between these two indexes. We suggest new solutions for these problems. For the non-overlapping problem our solution uses O(n) space with query time of O(m + occ_{NO}). For the range non-overlapping problem we propose a solution with O(n\log^\epsilon n) space for some 0<\epsilon<1 and O(m + \log\log n + occ_{ij,NO}) query time.
cs.DS
cs
Range Non-Overlapping Indexing Hagai Cohen and Ely Porat⋆ Department of Computer Science, Bar-Ilan University, 52900 Ramat-Gan, Israel {cohenh5,porately}@cs.biu.ac.il Abstract. We study the non-overlapping indexing problem: Given a text T , preprocess it in order to answer queries of the form: given a pattern P , report the maximal set of non-overlapping occurrences of P in T . A generalization of this problem is the range non-overlapping indexing where in addition we are given two indexes i, j to report the maximal set of non-overlapping occurrences between these two indexes. We suggest new solutions for these problems. For the non-overlapping problem our solution uses O(n) space with query time of O(m+occN O). For the range non-overlapping problem we propose a solution with O(n logǫ n) space for some 0 < ǫ < 1 and O(m + log log n + occij,N O ) query time. 1 Introduction and Related Work Given a text T of length n over an alphabet Σ, the text indexing problem is to build an index on T which can answer pattern matching queries efficiently: Given a pattern P of length m, we want to report all its occurrences in T . There are some known solutions for this problem. For instance, the suffix tree, proposed by Weiner [1], which is a compacted trie storing all suffixes of the text. A suffix tree for text T of length n requires O(n) space and can be built in O(n) preprocessing time. It has query time of O(m + occ) where occ is the number of occurrences of P in T . Range text indexing, also known as position restricted substring searching, is the problem of finding a pattern P in a substring of the text T between two given positions i, j. A solution for this problem was presented by Makinen and Navarro [2]. It uses O(n logǫ n) space and has query time of O(m + log log n + occ). Their solution is based on another problem - the range searching problem. The range searching problem is to preprocess a set of points in a d-dimensional space for answering queries about the set of points which are contained within a specific range. Alstrup et al [3] proposed a solution for the orthogonal two dimensional range searching problem when all the points are from n × n grid, which costs O(n logǫ n) space and has O(log log n + k) query time, where k is the number of points inside the range. Grossi and Iwona in [4] have shown how to use Alstrup's data structure to get all the points inside a particular range in a specific order using some kind of rank function. ⋆ This work was supported by BSF and ISF In text indexing we are sometimes interested in reporting only the non- overlapping occurrences of P in T . There is such interest in fields such as pat- tern recognition, computational linguistics, speech recognition, data compres- sion, etc. For instance, we might want to compress a text by replacing each non-overlapping occurrence of a substring of it with a pointer to a single copy of the substring. Another problem is the string statistics problem [5, 6] which consists of pre- processing a text T such that when given a query pattern P , the maximum number of non-overlapping occurrences of P in T can be reported efficiently. However, in the string statistics problem we only return the number of non- overlapping occurrences not the actual occurrences. In this paper, we present the first non-trivial solution for the non-overlapping indexing problem where we want to report the maximal sequence of non-overlapping occurrences of P in T . Keller et al [7] proposed a solution for a generalization of this problem called the range non-overlapping indexing where we want to report the non- overlapping occurrences in a substring of T . Their solution has query time of O(m+occij,N O log log n) and uses O(n log n) space, where occij,N O is the number of the maximal non-overlapping occurrences in the substring T [i : j]. Crochemore et al [8] suggested another solution for the range non-overlapping indexing problem. Their solution has optimal query time of O(m + occij,N O) but requires O(n1+ǫ) space. In this paper, we present new solutions for the non-overlapping indexing problem, which use the periodicity of the text and pattern in order to minimize the query time. Our solution for non-overlapping indexing problem uses O(n) space with optimal query time of O(m + occN O). For the range non-overlapping indexing problem we present a solution of O(n logǫ n) space for some 0 < ǫ < 1 with O(m + log log n + occij,N O) query time. 2 Preliminaries Let n be the length of the text T . And let m be the length of the pattern P . For two integers i, j (i ≤ j), T [i : j] is the substring of T from i to j. We will use the Suffix Tree as our main data structure. Each leaf in the Suffix Tree represents a suffix in the text. In each leaf we save two values: y - the start location of its suffix in the text and x - the location of the leaf in a left to right order of all the leaves of the Suffix Tree (lexicographic order, for example). We have two orders on the leaves and therefore on the suffixes as well: x-order and y-order. The y-order is the text order and the x-order is the suffix tree leaves order. When we search for a pattern P in a Suffix Tree ST of T , we finish searching at some node v. The subtree rooted by v has all the occurrences of P in T in its leaves. We denote by l and r the x-value of the leftmost leaf and the x-value of the rightmost leaf of that subtree respectively. Therefore, the occurrences of P in T are all the leaves with x-value between l and r. We denote the number of occurrences of P in T by occ. The number of non- overlapping occurrences will be denoted as occN O. The number of occurrences of P in T [i : j] and the non-overlapping occurrences of P in T [i : j] will be denoted by occij and occij,N O respectively. 3 A Solution for Non-Overlapping Indexing We use a new approach for solving this problem. Our solution uses the periodicity of the text and the pattern. We divide patterns for two types: periodic and aperiodic. A different strategy will be used for each type. Definition 1. A pattern that can appear more than twice overlapping is called a periodic pattern. A pattern that can appear at most twice overlapping is called an aperiodic pattern. 3.1 Aperiodic Pattern In the aperiodic case we use the periodicity of the pattern to answer a query. We use the familiar Suffix Tree to get all the leaves that correspond to the given pattern. After we have all the leaves, we need to remove the overlapping occurrences. This can be done by sorting the leaves in y-order, going over the sorted list and filtering the overlapping occurrences. However, sorting occ items costs O(occ log occ) which is greater than the optimal O(occ). In order to solve this sorting part we use the following theorem. Theorem 1. All occurrences of a pattern can be reported and sorted in text order in O(m + occ) time using O(n) space. Proof. We use a Suffix Tree to get all the occurrences in O(m + occ) time. For sorting all the occurrences we will use a renaming method on the Suffix Tree. Each leaf has its location, i.e., its y-value index, in the whole tree. Saving this location for a leaf costs log n bits because the whole tree has n leaves. Hence, the domain for the location is n. Nevertheless, we are interested in the order of the leaves in a subtree of the occurrences and not in the whole tree. Thus, we would like to save the location of a leaf for a subtree with less leaves. If we save for each leaf its location in a subtree with less leaves, for example √n leaves, it will cost us only log √n. Therefore, for each leaf, aside from keeping its location in the whole suffix tree, we save its location in a subtree of size √n, its location i√n for i ≥ 1 until we in a subtree of size 4√n, and so on for all subtrees of size 2 reach a constant size. We use Radix Sort which can sort n numbers in a domain of n2 in O(n) time for sorting the leaves by their locations. Given a subtree whose leaves we wish to sort in y-order, we can sort them by the locations of the subtree of size at most O(occ2), this will cost us only O(occ) by using Radix Sort because we sort occ items in a domain of at most occ2. In each leaf we save: log n bits for its location in the ST. log √n bits for its location in the subtree of size √n. log 4√n bits for its location in the subtree of size 4√n. etc. This sums as following: log n + log √n + log 4√n + log 8√n... = log n + 1 4 log n + 1 1 2 log n + 8 log n + ... ≤ 2 log n. to n · 2 log n = O(n log n) bits which is O(n) space. Therefore, we save only 2 log n bits per leaf. We have n leaves summing up ⊓⊔ Theorem 1 provides us a sorted list of all occurrences in O(m + occ) query time and O(n) space. By filtering the overlapping occurrences which costs O(occ) time, we are through. Because in an aperiodic pattern, O(occ) = O(occN O), the query time equals to O(m + occN O). 3.2 Periodic Pattern The periodic case is more complex. In this case we use the periodicity of the text in order to answer a query. Definition 2. A node in the Suffix Tree which represents a suffix which is a periodic pattern is called period node. Definition 3. Let s be a string. We define a period of s to be a string p, such that s = pt ´p, for t ≥ 1 where ´p is prefix of p. Lemma 1. A period node has only one son which can also be a period node. Proof. Let a be a period node. Therefore, the string represented by a has a period p. For a son of a to be a period node too it must continue the period p. If a ends with a character c than the node which has the next character in p that is after that c is the period node. There can be only one child of a which can start with this character. Thus, a period node can have only one son which ⊓⊔ is also period node. Note that by the period definition a string can have more than one period, by taking pnew = pp for example. Nevertheless, each period must overlap with a shorter period of the same string. Thus, there can't be more than one such character c. Definition 4. The path that starts from the a period node and goes through all nodes which continue that period in the Suffix Tree is called a period path. We denote the number of nodes in a period path to be the period path length. Lemma 2. Let p2 be a period path on a path P T to the root in the Suffix Tree. Than p2 must be at least twice as long as the previous period path p1 on P T . Proof. On P T , between p1 and p2 there must be at least one node which is not a period node. For p2 to be a period path is must represent a period suffix which must be started with the period of p1. Moreover, p2 period suffix should be continued by the character of the next node after p1 which is not a period node. After it there must be the period of p1 again. Therefore, p2 length is at ⊓⊔ least twice longer than p1. Lemma 3. The largest number of different period paths contained in the path from the root to a period node is log n. Proof. Let P T be the path from the root to some period node in the Suffix Tree. According to Lemma 2 each period path on P T must be at least twice as long as the previous period path on P T . Therefore, if we have more than log n period paths on P T , than the length of the last period path must be greater than n which is the text length. Hence, the number of period paths on the same path ⊓⊔ can't be more than log n. Definition 5. A period sequence is the maximum substring in the text of some period which is repeated more than twice. We will mark it as [s, e], where s and e are the start index and the end index of the period sequence accordingly. The period sequences of a period pattern are all the period sequences which start with that periodic pattern. The period length of a period sequence is the length of the period inside repeated the sequence. Example 1. Lets T be the text "abababcabababcabababc". The period sequences are: For the period "ab", the period sequences are [1,6], [8,13], [15,20] which have period length 2. For the period "abababc", the period sequence is [1,21] which has period length 7. Lemma 4. Given a list L of all the period sequences of some periodic pattern in the text. All the non-overlapping occurrences of that periodic pattern can be retrieved from this list in O(occN O) time. step which can be easily calculated. Proof. For a period sequence [s, e] with period length pl, the non-overlapping occurrences of a periodic pattern P with length m are the group: s+i∗stepstep = ⌈ m pl⌉ ∗ pl, 0 ≤ i ≤ e−s−1 We report all the occurrences in each period sequence in L. The number of all occurrences we report is O(occN O), so the total time for reporting all the ⊓⊔ non-overlapping occurrences from L is O(occN O). For answering the non-overlapping indexing we use the following data struc- ture. We build a data structure for each period path on the Suffix Tree, saving a list of all period sequences sorted by their length for each period path. Each period node in the Suffix Tree is on a period path. We save a pointer from each period node on the Suffix Tree to the period sequence list of its period path. This pointer will point to the period node appropriate length on the period sequences list. Theorem 2. Using the data structure described above, all period sequences of a period pattern can be retrieved in O(m + occN O) time using O(n log n) space. Proof. On a query we go to that data structure, get all the period sequences and by Lemma 4 we calculate all the non-overlapping occurrences. This will take O(occN O) time, because the number of the period sequences that we will get is less than the number of the non-overlapping occurrences of the pattern. If we come up with a long pattern we won't get shorter period sequences which don't fit the pattern so we won't get unnecessary period sequences. The space for this data structure is O(n log n). This is because there are n nodes where each one can be at most in log n period paths. For each node, we ⊓⊔ save all its period paths so it needs O(n log n). Now, we will show how to reduce the space needed for this data structure. Definition 6. Let's define a degree of a period sequence to be the maximum degree of a period sequence included in it plus one. A period sequence without any period sequences in it will has the degree 0. Lemma 5. The maximum degree of a period sequence can be at most log n. Proof. Let ps be the period sequence with the maximum degree in the text. In ps there is a period sequence with a degree decreased by one. In that period sequence there is another period sequence with a degree decreased by one. And so on until we receive a period sequence ps0 with the degree 0. The length of each period sequence from ps0 to ps is at least twice the length of the period sequence in it. The maximum length of ps can be at most n, therefore, its degree ⊓⊔ can be at most log n. Lemma 6. There are at most O(n) period sequences. Proof. We will count the number of period sequences in each degree: The number of period sequences of degree 0 can be at most n. The number of period sequences of degree 1 can be at most n 2 . The number of period sequences of degree 2 can be at most n 4 . . . . The number of period sequences of degree log n can be at most 1. Summery: n + n ⊓⊔ Theorem 3. The data structure in Theorem 2 can be saved using only O(n) space. 2 + .. + 1 ≤ 2n = O(n) Proof. We save all the period paths in a data structure. Each one with its own period sequences. Each period sequence appears in only one period path. From Lemma 6 we have O(n) period sequences. Therefore we save at most O(n) space for all the period sequences. Thus, we need only O(n) space for this data struc- ⊓⊔ ture. Corollary 1. Using these two different strategies for each type of pattern we can solve the non-overlapping indexing problem in O(n) space with O(m + occN O) query time. 4 A solution for Range Non-Overlapping Indexing We propose a better solution for this problem. Our solution costs O(n logǫ n) space for some 0 < ǫ < 1 and has query time of O(m + log log n + occij,N O). 4.1 Rank Sensitive Range Searching We use a data structure for answering the two-dimensional orthogonal range searching problem. Alstrup et al [3] proposed a data structure for this problem which requires O(n logǫ n) space with query time of O(log log n + k) where k is the number of points in the range. Nevertheless, this range query data structure reports all the points in the range with no specific order. We want to get those points in a specific order. Therefore, in addition to this data structure we will use a method suggested by Grossi et al [4] for a rank sensitive data structure. This gives us a data structure which uses O(n logǫ n) space with query time of O(log log n) and O(1) per point, where the points will be reported in rank order. For simplicity we will call this data structure RSDS from now on. 4.2 Aperiodic Pattern We use a Rank Sensitive Data Structure to answer aperiodic queries. In the RSDS we store all the occurrences as points by their x value and y value, where the rank function of a point will be its y value. Given a pattern P and range i, j we can get l, r from the Suffix Tree, the leftmost leaf and the rightmost leaf which are occurrences of P . Then we will do a range query for points within [i, j]x[l, r] to get all the correct occurrences. Because the rank in the RSDS is by y value, we will get the points and therefore the occurrences, sorted in the text order. The only remaining action is filtering the overlapping occurrences. The RSDS costs O(n logǫ n) space. RSDS query time is O(log log n+k) where k is the size of the output which is equal to O(occij ). In our case k equals O(occij,N O) because for an aperiodic pattern O(occij ) = O(occij,N O). Therefore, aperiodic pattern has query time of O(m) for searching the Suffix Tree plus O(log log n + occij,N O) for the RSDS query. Concluded in O(m + log log n + occij,N O). 4.3 Periodic Pattern The periodic case is more complex. We save all period sequences in the text as points in two RSDS. For a periodic sequence [s, e] with period length pl, we save two points (x1, y1), (x2, y2) with the following values: x1 = Index of the suffix of s in the left to right order of all the ST leaves y1 = s x2 = Index of the suffix of s in the left to right order of all the ST leaves y2 = e − pl + 1 Point (x1, y1) will be saved in the first RSDS with a rank function of x value in descending order. Point (x2, y2) will be saved in the second RSDS with a rank function of x value in ascending order. Sometimes there will be multiple period sequences with the same start index or end index, each with a different degree. When this happens we save only the one with the highest degree. We can easily convert a period sequence [s, e] to these two points and vice versa. Following Lemma 6 the number of points in the two RSDS is O(n). Hence, each RSDS costs O(n logǫ n) space. Given a pattern P of length m and range i, j we answer using Algorithm 1. 1 2 3 4 5 6 7 8 9 10 11 12 13 Get the range l, r from the Suffix Tree ; S ←− Query first RSDS for all points within [i, j]x[l, r] ; S ←− S ∪ Query second RSDS for all points within [i, j]x[l, r] ; S ←− S ∪ Query first RSDS for the first point within [1, i]x[l, r] ; P S ←− convertAllP ointsT oP eriodSequences(S) ; P S2 ←− ∅ ; for ps ∈ P S do x ←− ps ; while x period length is greater than m do x ←− the first period sequence inside x ; end P S2 ←− P S2 ∪ {x} end Algorithm 1: Periodic Pattern Range Query Getting the first period sequence inside a period sequence can be done by using another data structure saving for each period sequence its period length, and a pointer to the first period sequence in it. Thus, given a period sequence it costs O(1) to find the first period sequence inside it with a degree decreased by one. Lemma 7. The number of period sequences we have to go down in order to find our appropriate period sequence is lower than the number of occurrences that will be extracted from the period sequences inside the first period sequence we received. Proof. Each degree we get down means that there is another occurrence in the next period sequence. Each step down, adds at least another occurrence. There- fore, until we get to the appropriate period sequence we work at most O(k) where k is the number of occurrences we will get from the period sequences inside the ⊓⊔ first period sequence we encounter. By Lemma 7 it does not cost us more time when we get a period sequence whose period length is longer than the pattern length. Theorem 4. All the non-overlapping occurrences can be calculated from the period sequences got by these three queries. Proof. First of all we will see that each period sequence we get from these queries has at least one occurrence of P . Let (x, y) be the point we get. It corresponds to a period sequence [s, e]. We get only points which have x values between l and r. The x value of a point is the index of the suffix of s in the left to right order of all the ST leaves. So if we get a point (x, y) with x between l and r it means that the corresponding period sequence [s, e] has an occurrence of P . This happens because all the leaves in the ST between l and r are occurrences of P . Now, we need to prove two more things. The first is that all the period sequences we get from the RSDS are suitable for us and that we haven't got unnecessary period sequences, which don't fit to P in the range i, j. The second thing is that we didn't miss any period sequence which can have some suitable occurrences. We start by proving that we get all the occurrences of P in the range [i, j] from the period sequences we get in the three queries. Period sequences of P in T can be in some cases. Let [s, e] be our period sequence. The first case is that [s, e] is out of the range [i, j], s < e ≤ i < j or i < j ≤ s < e. In this case we wouldn't like to get this period sequences at all. The first two queries will not resolve these period sequences because we do a query on [i, j]x[l, r] but s is out of range and the points corresponding to this period sequence have y value equals s. Nevertheless, we can get this period sequence in the third query. However, it will be at most one period sequence which can be checked in O(1) time. The second case, which is the simplest, is that [s, e] is fully inside the range [i, j], i ≤ s < e ≤ j. In this case we get all the suitable period sequences from the first query. Nevertheless, we can get the same period sequence twice, first from the first query and again from the second query. Therefore, we will have to check any period sequence that we get in order to prevent duplicate occurrence reporting. The third case is when only e or s is out of range but not both, s < i < e ≤ j or i ≤ s < j < e. This time if i ≤ s < j < e we will get the period sequence from the first query. Otherwise, if s < i < e ≤ j we will get the period sequence from the second query. The fourth case is when the range [i, j] is fully inside the period sequence [s, e], s < i < j < e. In order to solve this case we have the third query which will resolve the last start of a period sequence which is before index i. This period ⊓⊔ sequence can be checked in O(1) time. Corollary 2. Using these two different strategies for each type of pattern, the range non-overlapping text indexing problem can be solved in O(n logǫ n) space for some 0 < ǫ < 1 and query time of O(m + log log n + occij,N O). 5 Conclusion We have studied the problem of non-overlapping indexing. In this paper, we provide the first non-trivial solution for this problem. In addition we proposed a better solution for a generalization of this problem, the range non-overlapping problem. References 1. Weiner, P.: Linear pattern matching algorithms. In: FOCS, IEEE (1973) 1 -- 11 2. Makinen, V., Navarro, G.: Position-restricted substring searching. In Correa, J.R., Hevia, A., Kiwi, M.A., eds.: LATIN. Volume 3887 of Lecture Notes in Computer Science., Springer (2006) 703 -- 714 3. Alstrup, S., Brodal, G.S., Rauhe, T.: New data structures for orthogonal range searching. In: In 41st Symposium on Foundations of Computer Science (FOCS00. (2000) 198 -- 207 4. Bialynicka-Birula, I., Grossi, R.: Rank-sensitive data structures. In Consens, M.P., Navarro, G., eds.: SPIRE. Volume 3772 of Lecture Notes in Computer Science., Springer (2005) 79 -- 90 5. Apostolico, A., Preparata, F.P.: Data structures and algorithms for the string statis- tics problem. Algorithmica 15(5) (1996) 481 -- 494 6. Brodal, G.S., Lyngsø, R.B., Ostlin, A., Pedersen, C.N.S.: Solving the string statistics problem in time o(n log n). In: ICALP '02: Proceedings of the 29th International Colloquium on Automata, Languages and Programming, London, UK, Springer- Verlag (2002) 728 -- 739 7. Keller, O., Kopelowitz, T., Lewenstein, M.: Range non-overlapping indexing and In Dehne, F.K.H.A., Sack, J.R., Zeh, N., eds.: WADS. successive list indexing. Volume 4619 of Lecture Notes in Computer Science., Springer (2007) 625 -- 636 8. Crochemore, M., Iliopoulos, C.S., Kubica, M., Rahman, M.S., Walen, T.: Improved algorithms for the range next value problem and applications. In Albers, S., Weil, P., eds.: STACS. Volume 08001 of Dagstuhl Seminar Proceedings., Internationales Begegnungs- und Forschungszentrum fuer Informatik (IBFI), Schloss Dagstuhl, Ger- many (2008) 205 -- 216
1802.03587
2
1802
2018-02-14T11:39:54
Network Flow-Based Refinement for Multilevel Hypergraph Partitioning
[ "cs.DS" ]
We present a refinement framework for multilevel hypergraph partitioning that uses max-flow computations on pairs of blocks to improve the solution quality of a $k$-way partition. The framework generalizes the flow-based improvement algorithm of KaFFPa from graphs to hypergraphs and is integrated into the hypergraph partitioner KaHyPar. By reducing the size of hypergraph flow networks, improving the flow model used in KaFFPa, and developing techniques to improve the running time of our algorithm, we obtain a partitioner that computes the best solutions for a wide range of benchmark hypergraphs from different application areas while still having a running time comparable to that of hMetis.
cs.DS
cs
Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Tobias Heuer1, Peter Sanders2, and Sebastian Schlag3 1 Karlsruhe Institute of Technology, Karlsruhe, Germany 2 Karlsruhe Institute of Technology, Karlsruhe, Germany [email protected] [email protected] 3 Karlsruhe Institute of Technology, Karlsruhe, Germany [email protected] 8 1 0 2 b e F 4 1 ] S D . s c [ 2 v 7 8 5 3 0 . 2 0 8 1 : v i X r a Abstract We present a refinement framework for multilevel hypergraph partitioning that uses max-flow computations on pairs of blocks to improve the solution quality of a k-way partition. The frame- work generalizes the flow-based improvement algorithm of KaFFPa from graphs to hypergraphs and is integrated into the hypergraph partitioner KaHyPar. By reducing the size of hypergraph flow networks, improving the flow model used in KaFFPa, and developing techniques to improve the running time of our algorithm, we obtain a partitioner that computes the best solutions for a wide range of benchmark hypergraphs from different application areas while still having a running time comparable to that of hMetis. 1998 ACM Subject Classification G.2.2 Graph Theory, G.2.3 Applications Keywords and phrases multilevel hypergraph partitioning, network flows, refinement Digital Object Identifier 10.4230/LIPIcs... 1 Introduction Given an undirected hypergraph H = (V, E), the k-way hypergraph partitioning problem is to partition the vertex set into k disjoint blocks of bounded size (at most 1 + ε times the average block size) such that an objective function involving the cut hyperedges is minimized. Hypergraph partitioning (HGP) has many important applications in practice such as scientific computing [12] or VLSI design [43]. Particularly VLSI design is a field where small improvements can lead to significant savings [56]. It is well known that HGP is NP-hard [38], which is why practical applications mostly use heuristic multilevel algorithms [11, 13, 25, 26]. These algorithms successively contract the hypergraph to obtain a hierarchy of smaller, structurally similar hypergraphs. After applying an initial partitioning algorithm to the smallest hypergraph, contraction is undone and, at each level, a local search method is used to improve the partitioning induced by the coarser level. All state-of-the-art HGP algorithms [2, 4, 7, 16, 28, 31, 32, 33, 48, 51, 52, 54] either use variations of the Kernighan-Lin (KL) [34, 49] or the Fiduccia-Mattheyses (FM) heuristic [19, 46], or simpler greedy algorithms [32, 33] for local search. These heuristics move vertices between blocks in descending order of improvements in the optimization objective (gain) and are known to be prone to get stuck in local optima when used directly on the input hypergraph [33]. The multilevel paradigm helps to some extent, since it allows a more global view on the problem on the coarse levels and a very fine-grained view on the fine levels of the multilevel hierarchy. However, the performance of move-based approaches degrades © Tobias Heuer, Peter Sanders and Sebastian Schlag; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning for hypergraphs with large hyperedges. In these cases, it is difficult to find meaningful vertex moves that improve the solution quality because large hyperedges are likely to have many vertices in multiple blocks [53]. Thus the gain of moving a single vertex to another block is likely to be zero [41]. While finding balanced minimum cuts in hypergraphs is NP-hard, a minimum cut separ- ating two vertices can be found in polynomial time using network flow algorithms and the well-known max-flow min-cut theorem [21]. Flow algorithms find an optimal min-cut and do not suffer the drawbacks of move-based approaches. However, they were long overlooked as heuristics for balanced partitioning due to their high complexity [40, 57]. In the context of graph partitioning, Sanders and Schulz [47] recently presented a max-flow-based improvement algorithm which is integrated into the multilevel partitioner KaFFPa and computes high quality solutions. Outline and Contribution. Motivated by the results of Sanders and Schulz [47], we gener- alize the max-flow min-cut refinement framework of KaFFPa from graphs to hypergraphs. After introducing basic notation and giving a brief overview of related work and the tech- niques used in KaFFPa in Section 2, we explain how hypergraphs are transformed into flow networks and present a technique to reduce the size of the resulting hypergraph flow network in Section 3.1. In Section 3.2 we then show how this network can be used to construct a flow problem such that the min-cut induced by a max-flow computation between a pair of blocks improves the solution quality of a k-way partition. We furthermore identify shortcomings of the KaFFPa approach that restrict the search space of feasible solutions significantly and introduce an advanced model that overcomes these limitations by exploiting the structure of hypergraph flow networks. We implemented our algorithm in the open source HGP framework KaHyPar and therefore briefly discuss implementation details and techniques to improve the running time in Section 3.3. Extensive experiments presented in Section 4 demonstrate that our flow model yields better solutions than the KaFFPa approach for both hypergraphs and graphs. We furthermore show that using pairwise flow-based refinement significantly improves partitioning quality. The resulting hypergraph partitioner, KaHyPar-MF, performs better than all competing algorithms on all instance classes and still has a running time comparable to that of hMetis. On a large benchmark set consisting of 3222 instances from various application domains, KaHyPar-MF computes the best partitions in 2427 cases. Preliminaries 2 2.1 Notation and Definitions An undirected hypergraph H = (V, E, c, ω) is defined as a set of n vertices V and a set of m hyperedges/nets E with vertex weights c : V → R>0 and net weights ω : E → R>0, where each net is a subset of the vertex set V (i.e., e ⊆ V ). The vertices of a net are called pins. e∈F ω(e). A vertex v is incident to a net e if v ∈ e. I(v) denotes the set of all incident nets of v. The degree of a vertex v is d(v) := I(v). The size e of a net e is the number of its pins. Given a subset V 0 ⊂ V , the subhypergraph HV 0 is defined as HV 0 := (V 0,{e ∩ V 0 e ∈ E : e ∩ V 0 6= ∅}). We extend c and ω to sets, i.e., c(U) :=P v∈U c(v) and ω(F) :=P Π = {V1, . . . , Vk} such that Sk A k-way partition of a hypergraph H is a partition of its vertex set into k blocks i=1 Vi = V , Vi 6= ∅ for 1 ≤ i ≤ k, and Vi ∩ Vj = ∅ for i 6= j. We call a k-way partition Π ε-balanced if each block Vi ∈ Π satisfies the balance k e for some parameter ε. For each net e, Λ(e) := constraint: c(Vi) ≤ Lmax := (1 + ε)d c(V ) {Vi Vi∩ e 6= ∅} denotes the connectivity set of e. The connectivity of a net e is λ(e) := Λ(e). T. Heuer, P. Sanders and S. Schlag XX:3 cost functions are the cut-net metric cut(Π) := P (λ − 1)(Π) := P A net is called cut net if λ(e) > 1. Given a k-way partition Π of H, the quotient graph Q := (Π,{(Vi, Vj) ∃e ∈ E : {Vi, Vj} ⊆ Λ(e)}) contains an edge between each pair of adjacent blocks. The k-way hypergraph partitioning problem is to find an ε-balanced k-way partition Π of a hypergraph H that minimizes an objective function over the cut nets for some ε. Several objective functions exist in the literature [5, 38]. The most commonly used e∈E0 ω(e) and the connectivity metric e∈E0(λ(e) − 1) ω(e) [1], where E0 is the set of all cut nets [17]. In this paper, we use the (λ − 1)-metric. Optimizing both objective functions is known to be NP-hard [38]. Hypergraphs can be represented as bipartite graphs [29]. In the following, we use nodes and edges when referring to graphs and vertices and nets when referring to hypergraphs. In the bipartite graph G∗(V ∪E, F) the vertices and nets of H form the node set and for each net e ∈ I(v), we add an edge (e, v) to G∗. The edge set F is thus defined as F := {(e, v) e ∈ E, v ∈ e}. Each net in E therefore corresponds to a star in G∗. Let G = (V, E, c, ω) be a weighted directed graph. We use the same notation as for hypergraphs to refer to node weights c, edge weights ω, and node degrees d(v). Furthermore Γ(u) := {v : (u, v) ∈ E} denotes the neighbors of node u. A path P = hv1, . . . , vki is a sequence of nodes, such that each pair of consecutive nodes is connected by an edge. A strongly connected component C ⊆ V is a set of nodes such that for each u, v ∈ C there exists a path from u to v. A topological ordering is a linear ordering ≺ of V such that every directed edge (u, v) ∈ E implies u ≺ v in the ordering. A set of nodes B ⊆ V is called a closed set iff there are no outgoing edges leaving B, i.e., if the conditions u ∈ B and (u, v) ∈ E imply v ∈ B. A subset S ⊂ V is called a node separator if its removal divides G into two disconnected components. A flow network N = (V,E, c) is a directed graph with two distinguished nodes s and t in which each edge e ∈ E has a capacity c(e) ≥ 0. An (s, t)-flow (or flow) is a function f : V × V → R that satisfies the capacity constraint ∀u, v ∈ V : f(u, v) ≤ c(u, v), the skew symmetry constraint ∀v ∈ V × V : f(u, v) = −f(v, u), and the flow conservation constraint v∈V f(s, v) is defined as the total amount of flow transferred from s to t. The residual capacity is defined as rf(u, v) = c(u, v) − f(u, v). Given a flow f, Nf = (V,Ef , rf) with Ef = {(u, v) ∈ V × V rf(u, v) > 0} is the residual network. An (s, t)-cut (or cut) is a bipartition (S,V \ S) of a flow network N e∈E0 c(e), where E0 = {(u, v) ∈ E : u ∈ S, v ∈ V \ S}. The max-flow min-cut theorem states that the value f of a maximum flow is equal to the capacity of a minimum cut separating s and t [21]. ∀u ∈ V \ {s, t} :P with s ∈ S ⊂ V and t ∈ V \ S. The capacity of an (s, t)-cut is defined asP v∈V f(u, v) = 0. The value of a flow f :=P 2.2 Related Work Hypergraph Partitioning. Driven by applications in VLSI design and scientific computing, HGP has evolved into a broad research area since the 1990s. We refer to [5, 8, 43, 50] for an extensive overview. Well-known multilevel HGP software packages with certain distinguishing characteristics include PaToH [12] (originating from scientific computing), hMetis [32, 33] (originating from VLSI design), KaHyPar [2, 28, 48] (general purpose, n-level), Mondriaan [54] (sparse matrix partitioning), MLPart [4] (circuit partitioning), Zoltan [16], Parkway [51] and SHP [31] (distributed), UMPa [52] (directed hypergraph model, multi-objective), and kPaToH (multiple constraints, fixed vertices) [7]. All of these tools either use variations of the Kernighan-Lin (KL) [34, 49] or the Fiduccia-Mattheyses (FM) heuristic [19, 46], or algorithms that greedily move vertices [33] or nets [32] to improve solution quality in the refinement phase. XX:4 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Flows on Hypergraphs. While flow-based approaches have not yet been considered as refinement algorithms for multilevel HGP, several works deal with flow-based hypergraph min-cut computation. The problem of finding minimum (s, t)-cuts in hypergraphs was first considered by Lawler [36], who showed that it can be reduced to computing maximum flows in directed graphs. Hu and Moerder [29] present an augmenting path algorithm to compute a minimum-weight vertex separator on the star-expansion of the hypergraph. Their vertex-capacitated network can also be transformed into an edge-capacitated network using a transformation due to Lawler [37]. Yang and Wong [57] use repeated, incremental max-flow min-cut computations on the Lawler network [36] to find ε-balanced hypergraph bipartitions. Solution quality and running time of this algorithm are improved by Lillis and Cheng [39] by introducing advanced heuristics to select source and sink nodes. Furthermore, they present a preflow-based [22] min-cut algorithm that implicitly operates on the star-expanded hypergraph. Pistorius and Minoux [45] generalize the algorithm of Edmonds and Karp [18] to hypergraphs by labeling both vertices and nets. Liu and Wong [40] simplify Lawler's hypergraph flow network [36] by explicitly distinguishing between graph edges and hyperedges with three or more pins. This approach significantly reduces the size of flow networks derived from VLSI hypergraphs, since most of the nets in a circuit are graph edges. Note that the above-mentioned approaches to model hypergraphs as flow networks for max-flow min-cut computations do not contradict the negative results of Ihler et al. [30], who show that, in general, there does not exist an edge-weighted graph G = (V, E) that correctly represents the min-cut properties of the corresponding hypergraph H = (V, E). Flow-Based Graph Partitioning. Flow-based refinement algorithms for graph partitioning include Improve [6] and MQI [35], which improve expansion or conductance of bipartitions. MQI also yields as small improvement when used as a post processing technique on hypergraph bipartitions initially computed by hMetis [35]. FlowCutter [24] uses an approach similar to Yang and Wong [57] to compute graph bisections that are Pareto-optimal in regard to cut size and balance. Sanders and Schulz [47] present a flow-based refinement framework for their direct k-way graph partitioner KaFFPa. The algorithm works on pairs of adjacent blocks and constructs flow problems such that each min-cut in the flow network is a feasible solution in regard to the original partitioning problem. KaHyPar. Since our algorithm is integrated into the KaHyPar framework, we briefly review its core components. While traditional multilevel HGP algorithms contract matchings or clusterings and therefore work with a coarsening hierarchy of O(log n) levels, KaHyPar instantiates the multilevel paradigm in the extreme n-level version, removing only a single vertex between two levels. After coarsening, a portfolio of simple algorithms is used to create an initial partition of the coarsest hypergraph. During uncoarsening, strong localized local search heuristics based on the FM algorithm [19, 46] are used to refine the solution. Our work builds on KaHyPar-CA [28], which is a direct k-way partitioning algorithm for optimizing the (λ − 1)-metric. It uses an improved coarsening scheme that incorporates global information about the community structure of the hypergraph into the coarsening process. 2.3 The Flow-Based Improvement Framework of KaFFPa We discuss the framework of Sanders and Schulz [47] in greater detail, since our work makes use of the techniques proposed by the authors. For simplicity, we assume k = 2. The techniques can be applied on a k-way partition by repeatedly executing the algorithm on pairs of adjacent blocks. To schedule these refinements, the authors propose an active block T. Heuer, P. Sanders and S. Schlag XX:5 scheduling algorithm, which schedules blocks as long as their participation in a pairwise refinement step results in some changes in the k-way partition. An ε-balanced bipartition of a graph G = (V, E, c, ω) is improved with flow computations as follows. The basic idea is to construct a flow network N based on the induced subgraph G[B], where B ⊆ V is a set of nodes around the cut of G. The size of B is controlled by an imbalance factor ε0 := αε, where α is a scaling parameter that is chosen adaptively depending on the result of the min-cut computation. If the heuristic found an ε-balanced partition using ε0, the cut is accepted and α is increased to min(2α, α0) where α0 is a predefined upper bound. Otherwise it is decreased to max( α 2 , 1). This scheme continues until a maximal number of rounds is reached or a feasible partition that did not improve the cut is found. In each round, the corridor B := B1 ∪ B2 is constructed by performing two breadth-first searches (BFS). The first BFS is done in the induced subgraph G[V1]. It is initialized with the 2 e− c(V2). The second BFS boundary nodes of V1 and stops if c(B1) would exceed (1+ 0)d c(V ) constructs B2 in an analogous fashion using G[V2]. Let δB := {u ∈ B ∃(u, v) ∈ E : v /∈ B} be the border of B. Then N is constructed by connecting all border nodes δB ∩ V1 of G[B] to the source s and all border nodes δB ∩ V2 to the sink t using directed edges with an edge weight of ∞. By connecting s and t to the respective border nodes, it is ensured that edges incident to border nodes, but not contained in G[B], cannot become cut edges. For α = 1, the size of B thus ensures that the flow network N has the cut property, i.e., each (s, t)-min-cut in N yields an ε-balanced partition of G with a possibly smaller cut. For larger values of α, this does not have to be the case. After computing a max-flow in N , the algorithm tries to find a min-cut with better balance. This is done by exploiting the fact that one (s, t)-max-flow contains information about all (s, t)-min-cuts [44]. More precisely, the algorithm uses the 1–1 correspondence between (s, t)-min-cuts and closed sets containing s in the Picard-Queyranne-DAG Ds,t of the residual graph Nf [44]. First, Ds,t is constructed by contracting each strongly connected component of the residual graph. Then the following heuristic (called most balanced minimum cuts) is repeated several times using different random seeds. Closed node sets containing s are computed by sweeping through the nodes of DAGs,t in reverse topological order (e.g. computed using a randomized DFS). Each closed set induces a differently balanced min-cut and the one with the best balance (with respect to the original balance constraint) is used as resulting bipartition. 3 Hypergraph Max-Flow Min-Cut Refinement In the following, we generalize the flow-based refinement algorithm of KaFFPa to hypergraph partitioning. In Section 3.1 we first show how hypergraph flow networks N are constructed in general and introduce a technique to reduce their size by removing low-degree hypernodes. Given a k-way partition Πk = {V1, . . . , Vk} of a hypergraph H = (V, E), a pair of blocks (Vi, Vj) adjacent in the quotient graph Q, and a corridor B, Section 3.2 then explains how N is used to build a flow problem F based on a B-induced subhypergraph HB = (VB, EB). The flow problem F is constructed such that an (s, t)-max-flow computation optimizes the cut metric of the bipartition Π2 = (Vi, Vj) of HB and thus improves the (λ − 1)-metric in H. Section 3.3 then discusses the integration into KaHyPar and introduces several techniques to speed up flow-based refinement. Algorithm 1 gives a pseudocode description of the entire flow-based refinement framework. XX:6 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Algorithm 1: Flow-Based Refinement Input: Hypergraph H, k-way partition Πk = {V1, . . . , Vk}, imbalance parameter ε. Algorithm MaxFlowMinCutRefinement(H, Πk) Q := QuotientGraph(H, Πk) while ∃ active blocks ∈ Q do foreach {(Vi, Vj) ∈ Q Vi ∨ Vj is active} do Πold = Πbest := {Vi, Vj} ⊆ Πk εold = εbest := imbalance(Πk) α := α0 do // in the beginning all blocks are active // choose a pair of blocks // extract bipartition to be improved // imbalance of current k-way partition // use large B-corridor for first iteration // adaptive flow iterations B := computeB-Corridor(H, Πbest, αε) // as described in Section 2.3 HB := SubHypergraph(H, B) // create B-induced subhypergraph NB := FlowNetwork(HB) // as described in Section 3.1 F := FlowProblem(NB) // as described in Section 3.2 // compute maximum flow on F f := maxFlow(F) Πf := mostBalancedMinCut(f,F) // as in Section 2.3 & 3.1 εf := imbalance(Πf ∪ Πk \ Πold) // imbalance of new k-way partition if (cut(Πf) < cut(Πbest) ∧ εf ≤ ε) ∨ εf < εbest then // found improvement // update α, Πbest,εbest // decrease size of B-corridor in next iteration α := min(2α, α0), Πbest := Πf , εbest := εf else α := α 2 while α ≥ 1 if Πbest 6= Πold then Πk := Πbest ∪ Πk \ Πold activateForNextRound(Vi, Vj) // improvement found // replace Πold with Πbest // reactivate blocks for next round return Πk Output: improved ε-balanced k-way partition Πk = {V1, . . . , Vk} 3.1 Hypergraph Flow Networks The Liu-Wong Network [40]. Given a hypergraph H = (V, E, c, ω) and two distinct nodes s and t, an (s, t)-min-cut can be computed by finding a minimum-capacity cut in the following flow network N = (V,E): V contains all vertices in V . For each multi-pin net e ∈ E with e ≥ 3, add two bridging nodes e0 and e00 to V and a bridging edge (e0, e00) with capacity c(e0, e00) = ω(e) to E. For each pin p ∈ e, add two edges (p, e0) and (e00, p) with capacity ∞ to E. For each two-pin net e = (u, v) ∈ E, add two bridging edges (u, v) and (v, u) with capacity ω(e) to E. The flow network of Lawler [36] does not distinguish between two-pin and multi-pin nets. This increases the size of the network by two vertices and three edges per two-pin net. Figure 1 shows an example of the Lawler and Liu-Wong hypergraph flow networks as well as of our network described in the following paragraph. Removing Low Degree Hypernodes. We further decrease the size of the network by using the observation that the problem of finding an (s, t)-min-cut of H can be reduced to finding a minimum-weight (s, t)-vertex-separator in the star-expansion, where the capacity of each star-node is the weight of the corresponding net and all other nodes (corresponding to T. Heuer, P. Sanders and S. Schlag XX:7 Figure 1 Illustration of hypergraph flow networks. Our approach further sparsifies the flow network of Liu and Wong [40]. Thin edges have infinite capacity. vertices in H) have infinite capacity [29]. Since the separator has to be a subset of the star-nodes, it is possible to replace any infinite-capacity node by adding a clique between all adjacent star-nodes without affecting the separator. The key observation now is that an infinite-capacity node v with degree d(v) induces 2d(v) infinite-capacity edges in the Lawler network [36], while a clique between star-nodes induces d(v)(d(v) − 1) edges. For hypernodes with d(v) ≤ 3, it therefore holds that d(v)(d(v) − 1) ≤ 2d(v). Thus we can reduce the number of nodes and edges of the Liu-Wong network as follows. Before applying the transformation on the star-expansion of H, we remove all infinite-capacity nodes v corresponding to hypernodes with d(v) ≤ 3 that are not incident to any two-pin nets and add a clique between all star-nodes adjacent to v. In case v was a source or sink node, we create a multi-source multi-sink problem by adding all adjacent star-nodes to the set of sources resp. sinks [20]. Reconstructing Min-Cuts. After computing an (s, t)-max-flow in the Lawler or Liu-Wong network, an (s, t)-min-cut of H can be computed by a BFS in the residual graph starting from s. Let S be the set of nodes corresponding to vertices of H reached by the BFS. Then (S, V \ S) is an (s, t)-min-cut. Since our network does not contain low degree hypernodes, we use the following lemma to compute an (s, t)-min-cut of H: (cid:73) Lemma 1. Let f be a maximum (s, t)-flow in the Lawler network N = (V,E) of a hypergraph H = (V, E) and (S,V \ S) be the corresponding (s, t)-min-cut in N . Then for each node v ∈ S ∩ V , the residual graph Nf = (Vf ,Ef) contains at least one path hs, . . . , e00i to a bridging node e00 of a net e ∈ I(v). Proof. Since v ∈ S, there has to be some path s (cid:32) v in Nf. By definition of the flow network, this path can either be of the form P1 = hs, . . . , e00, vi or P2 = hs, . . . , e0, vi for some bridging nodes e0, e00 corresponding to nets e ∈ I(v). In the former case we are done, since e00 ∈ P1. In the latter case the existence of edge (e0, v) ∈ Ef implies that there is a positive flow f(v, e0) > 0 over edge (v, e0) ∈ E. Due to flow conservation, there exists at least one edge (e00, v) ∈ E with f(e00, v) > 0, which implies that (v, e00) ∈ Ef. Thus we can extend the path P2 to hs, . . . , e0, v, e00i. (cid:74) Thus (A, V \ A) is an (s, t)-min-cut of H, where A := {v ∈ e ∃e ∈ E : hs, . . . , e00i in Nf}. Furthermore this allows us to search for more balanced min-cuts using the Picard-Queyranne- DAG of Nf as described in Section 2.3. By the definition of closed sets it follows that if a bridging node e00 is contained in a closed set C, then all nodes v ∈ Γ(e00) (which correspond to vertices of H) are also contained in C. Thus we can use the respective bridging nodes e00 as representatives of removed low degree hypernodes. Lawler[36]LiuandWong[40]OurNetworkHypergraphstststst XX:8 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning B )∩ I(←− EB to denote the set of border nets. 3.2 Constructing the Hypergraph Flow Problem Let HB = (VB, EB) be the subhypergraph of H = (V, E) that is induced by a corridor B computed in the bipartition Π2 = (Vi, Vj). In the following, we distinguish between the set of internal border nodes −→ B := {v ∈ VB ∃e ∈ E : {u, v} ⊆ e ∧ u /∈ VB} and the set of external border nodes ←− B := {u /∈ VB ∃e ∈ E : {u, v} ⊆ e ∧ v ∈ VB}. Similarly, we distinguish between external nets (e ∩ VB = ∅) with no pins inside HB, internal nets (e ∩ VB = e) with all pins inside HB, and border nets e ∈ I(−→ B ) with some pins inside HB and some pins outside of HB. We use ←→ A hypergraph flow problem consists of a flow network NB = (VB,EB) derived from HB and two additional nodes s and t that are connected to some nodes v ∈ VB. Our approach works with all flow networks presented in Section 3.1. A flow problem has the cut property if the resulting min-cut bipartition Πf of HB does not increase the (λ − 1)-metric in H. Thus it has to hold that cut(Πf) ≤ cut(Π2). While external nets are not affected by a max-flow computation, the max-flow min-cut theorem [21] ensures the cut property for all internal nets. Border nets however require special attention. Since a border net e is only partially contained in HB, it will remain connected to the blocks of its external border nodes in H. In case external border nodes connect e to both Vi and Vj, it will remain a cut net in H even if it is removed from the cut-set in Πf. It is therefore necessary to "encode" information about external border nodes into the flow problem. The KaFFPa Model and its Limitations. In KaFFPa, this is done by directly connecting internal border nodes −→ B to s and t. This approach can also be used for hypergraphs. In the hypergraph flow problem FG, the source s is connected to all nodes S = −→ B ∩ Vi and all nodes T = −→ B ∩ Vj are connected to t using directed edges with infinite capacity. While this ensures that FG has the cut property, applying the graph-based model to hypergraphs unnecessarily restricts the search space. Since all internal border nodes −→ B are connected to either s or t, every min-cut (S, VB \ S) will have S ⊆ S and T ⊆ VB \ S. The KaFFPa model therefore prevents all min-cuts in which any non-cut border net (i.e., e ∈ ←→ EB with λ(e) = 1) becomes part of the cut-set. This restricts the space of possible solutions, since corridor B was computed such that even a min-cut along either side of the border would result in a feasible cut in HB. Thus, ideally, all vertices v ∈ B should be able to change their block as result of an (s, t)-max-flow computation on FG – not only vertices v ∈ B \ −→ B . This limitation becomes increasingly relevant for hypergraphs with large nets as well as for partitioning problems with small imbalance ε, since large nets are likely to be only partially contained in HB and tight balance constraints enforce small B-corridors. While the former is a problem only for HGP, the latter also applies to GP. A more flexible Model. We propose a more general model that allows an (s, t)-max-flow computation to also cut through border nets by exploiting the structure of hypergraph flow networks. Instead of directly connecting s and t to internal border nodes −→ B and thus preventing all min-cuts in which these nodes switch blocks, we conceptually extend HB to contain all external border nodes ←− EB. The resulting hypergraph is ←− HB = (VB ∪←− B ,{e ∈ E e∩ VB 6= ∅}). The key insight now is that by using the flow network HB and connecting s resp. t to the external border nodes ←− of ←− B ∩ Vj, we get a flow problem that does not lock any node v ∈ VB in its block, since none of these nodes is directly connected to either s or t. Due to the max-flow min-cut theorem [21], this flow problem furthermore has the cut property, since all border nets of HB are now internal nets B and all border nets ←→ B ∩ Vi resp. ←− T. Heuer, P. Sanders and S. Schlag XX:9 Figure 2 Comparison of the KaFFPa flow problem FG and our flow problem FH. For clarity the zoomed in view is based on the Lawler network. HB instead of HB to achieve this result. For all vertices v ∈ ←− and all external border nodes ←− B are locked inside their block. However, it is not necessary to use ←− B the flow network of ←− HB contains paths hs, v, e0i and he00, v, ti that only involve infinite-capacity edges. Therefore we can remove all nodes v ∈ ←− B by directly connecting s and t to the corresponding bridging nodes e0, e00 via infinite-capacity edges without affecting the maximal flow [20]. More precisely, in the hypergraph flow problem FH, we connect s to all bridging nodes e0 corresponding to border nets e ∈ ←→ B ∩ Vi and all bridging nodes e00 corresponding to border nets e ∈ ←→ Single-Pin Border Nets. Furthermore, we model border nets with e ∩ −→ B = 1 more efficiently. For such a net e, the flow problem contains paths of the form hs, e0, e00, vi or hv, e0, e00, ti which can be replaced by paths of the form hs, e0, vi or hv, e00, ti with c(e0, v) = ω(e) resp. c(v, e00) = ω(e). In both cases we can thus remove one bridging node and two infinite- capacity edges. A comparison of FG and FH is shown in Figure 2. B ∩ Vj to t using directed, infinite-capacity edges. EB : e ⊂ ←− EB : e ⊂ ←− 3.3 Implementation Details Since KaHyPar is an n-level partitioner, its FM-based local search algorithms are executed each time a vertex is uncontracted. To prevent expensive recalculations, it therefore uses a cache to maintain the gain values of FM moves throughout the n-level hierarchy [2]. In order to combine our flow-based refinement with FM local search, we not only perform the moves induced by the max-flow min-cut computation but also update the FM gain cache accordingly. Since it is not feasible to execute our algorithm on every level of the n-level hierarchy, we use an exponentially spaced approach that performs flow-based refinements after uncontracting i = 2j vertices for j ∈ N+. This way, the algorithm is executed more often on smaller flow problems than on larger ones. To further improve the running time, we introduce the following speedup techniques: S1: We modify active block scheduling such that after the first round the algorithm is only executed on a pair of blocks if at least one execution using these blocks improved connectivity or imbalance of the partition on previous levels. ViVjCutB1B2stFlowProblemFGofSandersandSchulz[38]CutViVjB1B2←−B←−BtsConceptual:Actual:∞∞∞∞ω(e)∞∞∞∞∞ω(e)∞∞OurFlowProblemFH∞∞∞∞ω(e)∞∞e(cid:48)e(cid:48)(cid:48)e(cid:48)e(cid:48)(cid:48)e(cid:48)e(cid:48)(cid:48)−→B−→B−→BFlowNetworkNB:−→BActual:ω(e)∞e(cid:48)(cid:48)∞∞∞ω(e)e(cid:48)e(cid:48)(cid:48)HB←−HB XX:10 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Table 1 Overview about different benchmark sets. Set B and set C are subsets of set A. Source [28] [28] new [42] Set A Set B Set C Set D # DAC ISPD98 Primal Dual 92 477 30 165 25 5 - 15 18 10 5 - 10 5 - - Literal 92 30 5 - SPM Graphs - 184 - 60 5 - 15 - 92 30 5 - S2: For all levels except the finest level: Skip flow-based refinement if the cut between two adjacent blocks is less than ten. S3: Stop resizing the corridor B if the current (s, t)-cut did not improve the previously best solution. 4 Experimental Evaluation We implemented the max-flow min-cut refinement algorithm in the n-level hypergraph partitioning framework KaHyPar (Karlsruhe Hypergraph Partitioning). The code is written in C++ and compiled using g++-5.2 with flags -O3 -march=native. The latest version of the framework is called KaHyPar-CA [28]. We refer to our new algorithm as KaHyPar-MF. Both versions use the default configuration for community-aware direct k-way partitioning.1 Instances. All experiments use hypergraphs from the benchmark set of Heuer and Sch- lag [28]2, which contains 488 hypergraphs derived from four benchmark sets: the ISPD98 VLSI Circuit Benchmark Suite [3], the DAC 2012 Routability-Driven Placement Contest [55], the University of Florida Sparse Matrix Collection [15], and the international SAT Competi- tion 2014 [9]. Sparse matrices are translated into hypergraphs using the row-net model [12], i.e., each row is treated as a net and each column as a vertex. SAT instances are converted to three different representations: For literal hypergraphs, each boolean literal is mapped to one vertex and each clause constitutes a net [43], while in the primal model each variable is represented by a vertex and each clause is represented by a net. In the dual model the opposite is the case [41]. All hypergraphs have unit vertex and net weights. Table 1 gives an overview about the different benchmark sets used in the experiments. The full benchmark set is referred to as set A. We furthermore use the representative subset of 165 hypergraphs proposed in [28] (set B) and a smaller subset consisting of 25 hypergraphs (set C), which is used to devise the final configuration of KaHyPar-MF. Basic properties of set C can be found in Table 10 in Appendix C. Unless mentioned otherwise, all hypergraphs are partitioned into k ∈ {2, 4, 8, 16, 32, 64, 128} blocks with ε = 0.03. For each value of k, a k-way partition is considered to be one test instance, resulting in a total of 175 instances for set C, 1155 instances for set B and 3416 instances for set A. Furthermore we use 15 graphs from [42] to compare our flow model FH to the KaFFPa [47] model FG. Table 11 in Appendix C summarizes the basic properties of these graphs, which constitute set D. 1 https://github.com/SebastianSchlag/kahypar/blob/master/config/km1_direct_kway_sea17.ini 2 The complete benchmark set along with detailed statistics for each hypergraph is publicly available from http://algo2.iti.kit.edu/schlag/sea2017/. T. Heuer, P. Sanders and S. Schlag XX:11 Table 2 Statistics of benchmark set B. We use x to denote mean andex to denote the median. Type DAC ISPD Primal Literal Dual SPM # d(v) gd(v) 5 10 30 30 30 60 3.32 4.20 16.29 8.21 2.63 24.78 3.28 4.24 9.97 4.99 2.38 14.15 e 3.37 3.89 2.63 2.63 16.29 26.58 ee 3.35 3.90 2.39 2.39 9.97 15.01 System and Methodology. All experiments are performed on a single core of a machine consisting of two Intel Xeon E5-2670 Octa-Core processors (Sandy Bridge) clocked at 2.6 GHz. The machine has 64 GB main memory, 20 MB L3- and 8x256 KB L2-Cache and is running RHEL 7.2. We compare KaHyPar-MF to KaHyPar-CA, as well as to the k- way (hMetis-K) and the recursive bisection variant (hMetis-R) of hMetis 2.0 (p1) [32, 33], and to PaToH 3.2 [12]. These HGP libraries were chosen because they provide the best solution quality [2, 28]. The partitioning results of these tools are already available from http://algo2.iti.kit.edu/schlag/sea2017/. For each partitioner except PaToH the results summarize ten repetitions with different seeds for each test instance and report the arithmetic mean of the computed cut and running time as well as the best cut found. Since PaToH ignores the random seed if configured to use the quality preset, the results contain both the result of single run of the quality preset (PaToH-Q) and the average over ten repetitions using the default configuration (PaToH-D). Each partitioner had a time limit of eight hours per test instance. We use the same number of repetitions and the same time limit for our experiments with KaHyPar-MF. In the following, we use the geometric mean when averaging over different instances in order to give every instance a comparable influence on the final result. In order to compare the algorithms in terms of solution quality, we perform a more detailed analysis using improvement plots. For each algorithm, these plots relate the minimum connectivity of KaHyPar-MF to the minimum connectivity produced by the corresponding algorithm on a per-instance basis. For each algorithm, these ratios are sorted in decreasing order. The plots use a cube root scale for the y-axis to reduce right skewness [14] and show the improvement of KaHyPar-MF in percent (i.e., 1−(KaHyPar-MF/algorithm)) on the y-axis. A value below zero indicates that the partition of KaHyPar-MF was worse than the partition produced by the corresponding algorithm, while a value above zero indicates that KaHypar-MF performed better than the algorithm in question. A value of zero implies that the partitions of both algorithms had the same solution quality. Values above one correspond to infeasible solutions that violated the balance constraint. In order to include instances with a cut of zero into the results, we set the corresponding cut values to one for ratio computations. 4.1 Evaluating Flow Networks, Models, and Algorithms Flow Networks and Algorithms. To analyze the effects of the different hypergraph flow networks we compute five bipartitions for each hypergraph of set B with KaHyPar-CA using different seeds. Statistics of the hypergraphs are shown in Table 2. The bipartitions are then used to generate hypergraph flow networks for a corridor of size B = 25 000 hypernodes around the cut. Figure 3 (top) summarizes the sizes of the respective flow networks in terms of number of nodes V and number of edges E for each instance class. The flow networks of XX:12 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Figure 3 Top: Size of the flow networks when using the Lawler network NL, the Liu-Wong network NW and our network NOur. Network N 1 Our additionally models single-pin border nets more efficiently. The dashed line indicates 25 000 nodes. Bottom: Speedup of BK [10] and IBFS [23] max-flow algorithms over the execution on NL. primal and literal SAT instances are the largest in terms of both numbers of nodes and edges. High average vertex degree combined with low average net sizes leads to subhypergraphs HB containing many small nets, which then induce many nodes and (infinite-capacity) edges in NL. Dual instances with low average degree and large average net size on the other hand lead to smaller flow networks. For VLSI instances (DAC, ISPD) both average degree and average net sizes are low, while for SPM hypergraphs the opposite is the case. This explains why SPM flow networks have significantly more edges, despite the number of nodes being comparable in both classes. As expected, the Lawler-Network NL induces the biggest flow problems. Looking at the Liu-Wong network NW , we can see that distinguishing between graph edges and nets with e ≥ 3 pins has an effect for all hypergraphs with many small nets (i.e., DAC, ISPD, Primal, Literal). While this technique alone does not improve dual SAT instances, we see that the combination of the Liu-Wong approach and our removal of low degree hypernodes in NOur reduces the size of the networks for all instance classes except SPM. Both techniques only have a limited effect on these instances, since both hypernode degrees and net sizes are large on average. Since our flow problems are based on B-corridor induced subhypergraphs, N 1 Our additionally models single-pin border nets more efficiently as described in Section 3.2. This further reduces the network sizes significantly. As expected, the reduction in numbers of nodes and edges is most pronounced for hypergraphs with low average net sizes because these instances are likely to contain many single-pin border nets. To further see how these reductions in network size translate to improved running times 214215216217218219220221222V216217218219220221222223E12345SpeedupoverNL12345SpeedupoverNLBoykov-KolmogorovIBFSNetworkNLNWNOurN1OurNetworkNLNWNOurN1OurNetworkNWNOurN1OurNetworkNWNOurN1OurDACISPDDualPrimalLiteralSPMDACISPDDualPrimalLiteralSPMDACISPDDualPrimalLiteralSPMInstanceClassDACISPDDualPrimalLiteralSPMInstanceClass214215216217218219220221222V216217218219220221222223E12345SpeedupoverNL12345SpeedupoverNLBoykov-KolmogorovIBFSNetworkNLNWNOurN1OurNetworkNLNWNOurN1OurNetworkNWNOurN1OurNetworkNWNOurN1OurDACISPDDualPrimalLiteralSPMDACISPDDualPrimalLiteralSPMDACISPDDualPrimalLiteralSPMInstanceClassDACISPDDualPrimalLiteralSPMInstanceClass T. Heuer, P. Sanders and S. Schlag XX:13 Table 3 Comparing the KaFFPa flow model FG with our model FH as described in Section 3.2. The table shows the average improvement of FH over FG (in [%]) for different imbalance parameters ε on hypergraphs as well as on graphs. All experiments use configuration (+F,-M,-FM). Hypergraphs Graphs ε = 1% ε = 3% ε = 5% ε = 1% ε = 3% ε = 5% 10.5 7.8 5.4 3.9 3.5 11.3 9.1 7.3 5.3 4.1 7.7 7.9 6.9 5.1 3.4 8.1 6.6 3.9 2.3 1.3 7.6 4.8 2.7 1.5 1.2 11.7 11.0 9.9 8.6 7.0 α0 1 2 4 8 16 of max-flow algorithms, we use these networks to create flow problems using our flow model FH and compute min-cuts using two highly tuned max-flow algorithms, namely the BK- algorithm3 [10] and the incremental breadth-first search (IBFS) algorithm4 [23]. These algorithms were chosen because they performed best in preliminary experiments [27]. We then compare the speedups of these algorithms when executed on NW , NOur, and N 1 Our to the execution on the Lawler network NL. As can be seen in Figure 3 (bottom) both algorithms benefit from improved network models and the speedups directly correlate with the reductions in network size. While NW significantly reduces the running times for Primal and Literal instances, NOur additionally leads to a speedup for Dual instances. By additionally considering single-pin border nets, N 1 Our results in an average speedup between 1.52 and 2.21 (except for SPM instances). Since IBFS outperformed the BK algorithm in [27], we use N 1 Our and IBFS in all following experiments. Flow Models. We now compare the flow model FG of KaFFPa to our advanced model FH described in Section 3.2. The experiments summarized in Table 3 were performed using sets C and D. To focus on the impact of the models on solution quality, we deactivated KaHyPar's FM local search algorithms and only use flow-based refinement without the most balanced minimum cut heuristic. The results confirm our hypothesis that FG restricts the space of possible solutions. For all flow problem sizes and all imbalances tested, FH yields better solution quality. As expected, the effects are most pronounced for small flow problems and small imbalances where many vertices are likely to be border nodes. Since these nodes are locked inside their respective block in FG, they prevent all non-cut border nets from becoming part of the cut-set. Our model, on the other hand, allows all min-cuts that yield a feasible solution for the original partitioning problem. The fact that this effect also occurs for the graphs of set D indicates that our model can also be effective for traditional graph partitioning. All following experiments are performed using FH. 4.2 Configuring the Algorithm We now evaluate different configurations of the max-flow min-cut based refinement framework on set C. In the following, KaHyPar-CA [28] is used as a reference. Since it neither uses (F)lows nor the (M)ost balanced minimum cut heuristic and only relies on the (FM) algorithm 3 Available from: https://github.com/gerddie/maxflow 4 Available from: http://www.cs.tau.ac.il/~sagihed/ibfs/code.html XX:14 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning for local search, it is referred to as (-F,-M,+FM). This basic configuration is then successively extended with specific components. The results of our experiments are summarized in Table 4 for increasing scaling parameter α0. The table furthermore includes a configuration Constant128. In this configuration all components are enabled (+F,+M,+FM) and we perform flow-based refinements every 128 uncontractions. While this configuration is slow, it is used as a reference point for the quality achievable using flow-based refinement. Table 4 Different configurations of our flow-based refinement framework for increasing α0. Column Avg[%] reports the quality improvement relative to the reference configuration (-F,-M,+FM). (+F,-M,-FM) α0 Avg[%] t[s] −6.09 12.91 1 −3.19 15.75 2 −1.82 20.37 4 −0.85 28.49 8 −0.19 16 43.32 (-F,-M,+FM) Ref. (+F,+M,-FM) t[s] Avg[%] −5.60 13.40 −2.07 16.74 −0.19 21.88 30.67 0.98 46.66 1.75 6373.88 13.73 (+F,-M,+FM) t[s] Avg[%] 15.03 0.25 0.59 16.98 20.43 0.90 26.51 1.24 1.60 37.51 (+F,+M,+FM) Avg[%] 0.23 0.73 1.21 1.71 2.21 t[s] 15.16 17.51 21.53 28.68 41.31 Constant128 t[s] Avg[%] 67.90 0.54 1.11 140.24 269.63 1.66 512.12 2.20 2.76 973.91 The results indicate that only using flows (+F,-M,-FM) as refinement technique is inferior to localized FM local search in regard to both running time and solution quality. Although the quality improves with increasing flow problem size (i.e., increasing α0), the average connectivity is still worse than the reference configuration. Enabling the most balanced minimum cut heuristic improves partitioning quality. Configuration (+F,+M,-FM) performs better than the basic configuration for α0 ≥ 8. By combining flows with the FM algorithm (+F,-M,+FM) we get a configuration that improves upon the baseline configuration even for small flow problems. However, comparing this variant with (+F,+M,-FM) for α0 = 16, we see that using large flow problems together with the most balanced minimum cut heuristic yields solutions of comparable quality. Enabling all components (+F,+M,+FM) and using large flow problems performs best. Furthermore we see that enabling FM local search slightly improves the running time for α0 ≥ 8. This can be explained by the fact that the FM algorithm already produces good cuts between the blocks such that fewer rounds of pairwise flow refinements are necessary to further improve the solution. Comparing configuration (+F,+M,+FM) with Constant128 shows that performing flows more often further improves solution quality at the cost of slowing down the algorithm by more than an order of magnitude. In all further experiments, we therefore use configuration (+F,+M,+FM) with α0 = 16 for KaHyPar-MF. This configuration also performed best in the effectiveness tests presented in Appendix A. While this configuration performs better than KaHyPar-CA, its running time is still more than a factor of 3 higher. We therefore perform additional experiments on set B and successively enable the speedup heuristics described in Section 3.3. The results are summarized in Table 5. Only executing pairwise flow refinements on blocks that lead to an improvement on previous levels (S1) reduces the running time of flow-based refinement by a factor of 1.27, while skipping flows in case of small cuts (S2) results in a further speedup of 1.19. By additionally stopping the resizing of the flow problem as early as possible (S3), we decrease the running time of flow-based improvement by a factor of 2 in total, while still computing solutions of comparable quality. Thus in the comparisons with other systems, all heuristics are enabled. T. Heuer, P. Sanders and S. Schlag XX:15 Table 5 Comparison of quality improvement and running times using speedup heuristics. Column tflow[s] refers to the running time of flow-based refinement, column t[s] to the total partitioning time. Configuration KaHyPar-CA KaHyPar-MF KaHyPar-MF(S1) KaHyPar-MF(S1,S2) KaHyPar-MF(S1,S2,S3) Avg [%] Min [%] 6820.17 7077.20 2.12 2.47 2.41 2.06 2.05 2.40 2.41 2.06 tflow[s] - 43.04 33.89 28.52 21.23 t[s] 29.26 72.30 63.15 57.78 50.49 4.3 Comparison with other Systems Finally, we compare KaHyPar-MF to different state-of-the-art hypergraph partitioners on the full benchmark set. We exclude the same 194 out of 3416 instances as in [28] because either PaToH-Q could not allocate enough memory or other partitioners did not finish in time. The excluded instances are shown in Table 12 in Appendix D. Note that KaHyPar-MF did not lead to any further exclusions. The following comparison is therefore based on the remaining 3222 instances. As can be seen in Figure 4, KaHyPar-MF outperforms all other algorithms on all benchmark sets. Comparing the best solutions of KaHyPar-MF to each partitioner individually across all instances (top left), KaHyPar-MF produced better partitions than PaToH-Q, PaToH-D, hMetis-K, KaHyPar-CA, hMetis-R for 92.1%, 91.7%, 85.1%, 83.7%, and 75.6% of the instances, respectively. Comparing the best solutions of all systems simultaneously, KaHyPar-MF produced the best partitions for 2427 of the 3222 instances. It is followed by hMetis-R (678), KaHyPar-CA (388), hMetis-K (352), PaToH-D (154), and PaToH-Q (146). Note that for some instances multiple partitioners computed the same best solution and that we disqualified infeasible solutions that violated the balance constraint. Figure 5 shows that KaHyPar-MF also performs best for different values of k and that pairwise flow refinements are an effective strategy to improve k-way partitions. As can be seen in Table 6, the improvement over KaHyPar-CA is most pronounced for hypergraphs derived from matrices of web graphs and social networks5 and dual SAT instances. While the former are difficult to partition due to skewed degree and net size distributions, the latter are difficult because they contain many large nets. Finally, Table 9 compares the running times of all partitioners. By using simplified flow networks, highly tuned flow algorithms and several techniques to speed up the flow-based refinement framework, KaHyPar-MF is less than a factor of two slower than KaHyPar-CA and still achieves a running time comparable to that of hMetis. 5 Based on the following matrices: webbase-1M, ca-CondMat, soc-sign-epinions, wb-edu, IMDB, as-22july06, as-caida, astro-ph, HEP-th, Oregon-1, Reuters911, PGPgiantcompo, NotreDame_www, NotreDame_actors, p2p-Gnutella25, Stanford, cnr-2000. XX:16 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Figure 4 Min-Cut improvement plots comparing KaHyPar-MF with KaHyPar-CA and other partitioners for different instance classes. infeasiblesolutions-80-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%(λ−1)Improvement[%]AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DAll(3222Instances)infeasiblesolutions-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DDac(70Instances)infeasiblesolutions-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%(λ−1)Improvement[%]AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DIspd98(126Instances)infeasiblesolutions-80-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DPrimal(559Instances)infeasiblesolutions-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%(λ−1)Improvement[%]AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DDual(590Instances)infeasiblesolutions-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DLiteral(620Instances)infeasiblesolutions-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%#Instances(λ−1)Improvement[%]AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DSpm(1257Instances)infeasiblesolutions-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%#InstancesAlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-DWebSocial(115Instances) T. Heuer, P. Sanders and S. Schlag XX:17 Figure 5 Min-Cut improvement plots comparing KaHyPar-MF with KaHyPar-CA and other partitioners for different values of k. infeasiblesolutions-80-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%(λ−1)Improvement[%]k=2(467Instances)infeasiblesolutions-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%k=4(466Instances)infeasiblesolutions-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%(λ−1)Improvement[%]k=8(468Instances)infeasiblesolutions-60-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%k=16(461Instances)infeasiblesolutions-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%(λ−1)Improvement[%]k=32(457Instances)infeasiblesolutions-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%#Instancesk=64(455Instances)infeasiblesolutions-40-20-10-5-1015102040601000%10%20%30%40%50%60%70%80%90%100%#Instances(λ−1)Improvement[%]k=128(448Instances)AlgorithmKaHyPar-CAhMetis-RhMetis-KPaToH-QPaToH-D XX:18 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Table 6 Comparing the best solutions of KaHyPar-MF with the best results of KaHyPar-CA and other partitioners for different benchmark sets (top) and different values of k (bottom). All values correspond to the quality improvement of KaHyPar-MF relative to the respective partitioner (in %). Algorithm All 2.22 14.40 12.92 11.48 12.06 k = 2 hMetis-R hMetis-K PaToH-Q PaToH-D DAC KaHyPar-MF 7542.8816 828.15 KaHyPar-CA 2.80 4.75 7.77 15.24 15.57 k = 4 KaHyPar-MF 1005.76 2985.22 KaHyPar-CA 2.16 17.62 13.66 12.60 10.41 hMetis-R hMetis-K PaToH-Q PaToH-D 1.71 22.25 21.82 14.92 8.54 Min. (λ − 1) Literal SPM WebSoc 7478.06 3.91 41.92 40.45 18.45 23.04 2.46 4.17 6.91 14.98 15.17 k = 32 ISPD98 Primal Dual 5511.40 15 236.13 15 197.60 2927.42 3.33 31.20 21.51 11.44 13.64 k = 64 6010.05 1.74 1.85 16.37 3.88 16.23 4.78 8.36 14.36 9.45 12.47 k = 128 k = 16 9097.31 14 352.34 21 537.33 31 312.48 2.05 8.01 7.81 8.63 11.89 1.92 2.76 2.17 9.53 10.90 k = 8 5805.19 2.51 15.63 12.76 11.81 13.64 2.51 14.29 13.49 11.66 14.50 2.45 11.94 10.62 10.66 12.70 2.16 9.80 9.18 9.77 12.66 Table 7 Comparing the average running times of KaHyPar-MF with KaHyPar-CA and other hypergraph partitioners for different benchmark sets (top) and different values of k (bottom). Algorithm KaHyPar-MF KaHyPar-CA hMetis-R hMetis-K PaToH-Q PaToH-D KaHyPar-MF KaHyPar-CA hMetis-R hMetis-K PaToH-Q PaToH-D All 55.67 31.05 79.23 57.86 5.89 1.22 k = 2 19.75 12.68 27.87 25.47 1.93 0.43 DAC 504.27 368.97 446.36 240.92 28.34 6.45 k = 4 32.89 17.16 51.59 32.27 3.61 0.77 Running Time t[s] ISPD98 Primal 61.78 32.91 66.25 44.23 6.90 1.12 k = 16 60.38 31.01 91.09 53.41 7.01 1.42 20.83 12.35 29.03 23.18 1.89 0.35 k = 8 47.52 23.88 74.74 42.50 5.44 1.12 Literal 119.51 64.65 142.12 94.89 9.24 1.58 k = 32 78.51 41.69 109.13 74.00 8.40 1.71 Dual 97.22 68.27 200.36 125.55 10.57 2.87 k = 64 100.34 57.35 128.66 109.12 10.06 2.02 SPM WebSoc 27.40 110.15 67.14 13.91 89.69 41.79 111.95 35.95 3.42 4.71 0.77 0.88 k = 128 119.15 76.61 149.34 152.92 11.44 2.29 T. Heuer, P. Sanders and S. Schlag XX:19 Conclusion 5 We generalize the flow-based refinement framework of KaFFPa [47] from graph to hypergraph partitioning. We reduce the size of Liu and Wong's hypergraph flow network [40] by removing low degree hypernodes and exploiting the fact that our flow problems are built on subhypergraphs of the input hypergraph. Furthermore we identify shortcomings of the KaFFPa [47] approach that restrict the search space of feasible solutions significantly and introduce an advanced model that overcomes these limitations by exploiting the structure of hypergraph flow networks. Lastly, we present techniques to improve the running time of the flow-based refinement framework by a factor of 2 without affecting solution quality. The resulting hypergraph partitioner KaHyPar-MF performs better than all competing algorithms on all instance classes of a large benchmark set and still has a running time comparable to that of hMetis. Since our flow problem formulation yields significantly better solutions for both hyper- graphs and graphs than the KaFFPa [47] approach, future work includes the integration of our flow model into KaFFPa and the evaluation in the context of a high quality graph partitioner. Furthermore an approach similar to Yang and Wong [57] could be used as an alternative to the most balanced minimum cut heuristic and adaptive B-corridor resizing. We also plan to extend our framework to optimize other objective functions such as cut or sum of external degrees. XX:20 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning 1 References P. Agrawal, B. Narendran, and N. Shivakumar. Multi-way partitioning of VLSI circuits. In Proceedings of 9th International Conference on VLSI Design, pages 393–399, Jan 1996. 2 Y. Akhremtsev, T. Heuer, P. Sanders, and S. Schlag. Engineering a direct k-way hypergraph In 19th Workshop on Algorithm Engineering and Experiments, partitioning algorithm. (ALENEX), pages 28–42, 2017. 3 C. J. Alpert. The ISPD98 Circuit Benchmark Suite. In Proceedings of the 1998 Interna- tional Symposium on Physical Design, pages 80–85. ACM, 1998. 4 C. J. Alpert, J.-H. Huang, and A. B. Kahng. Multilevel Circuit Partitioning. IEEE Trans- actions on Computer-Aided Design of Integrated Circuits and Systems, 17(8):655–667, 1998. 5 C. J. Alpert and A. B. Kahng. Recent Directions in Netlist Partitioning: a Survey. Integ- ration, the VLSI Journal, 19(1–2):1 – 81, 1995. 6 Reid Andersen and Kevin J Lang. An Algorithm for Improving Graph Partitions. In Proceedings of the 19th annual ACM-SIAM Symposium on Discrete Algorithms, pages 651– 660. Society for Industrial and Applied Mathematics, 2008. 7 C. Aykanat, B. B. Cambazoglu, and B. Uçar. Multi-level Direct K-way Hypergraph Parti- tioning with Multiple Constraints and Fixed Vertices. Journal of Parallel and Distributed Computing, 68(5):609–625, 2008. 8 D. A. Bader, H. Meyerhenke, P. Sanders, and D. Wagner, editors. Proc. Graph Partitioning and Graph Clustering - 10th DIMACS Implementation Challenge Workshop, volume 588 of Contemporary Mathematics. AMS, 2013. 9 A. Belov, D. Diepold, M. Heule, and M. Järvisalo. The SAT Competition 2014. http: //www.satcompetition.org/2014/, 2014. 10 Yuri Boykov and Vladimir Kolmogorov. An Experimental Comparison of Min-Cut/Max- Flow Algorithms for Energy Minimization in Vision. IEEE Transactions on Pattern Ana- lysis and Machine Intelligence, 26(9):1124–1137, 2004. 11 T. N. Bui and C. Jones. A Heuristic for Reducing Fill-In in Sparse Matrix Factorization. In SIAM Conference on Parallel Processing for Scientific Computing, pages 445–452, 1993. 12 Ü. V. Catalyürek and C. Aykanat. Hypergraph-Partitioning-Based Decomposition for Par- allel Sparse-Matrix Vector Multiplication. IEEE Transactions on Parallel and Distributed Systems, 10(7):673–693, Jul 1999. J. Cong and M. Smith. A Parallel Bottom-up Clustering Algorithm with Applications to Circuit Partitioning in VLSI Design. In 30th Conference on Design Automation, pages 755–760, June 1993. 14 N. J. Cox. Stata tip 96: Cube roots. Stata Journal, 11(1):149–154(6), 2011. URL: http: 13 //www.stata-journal.com/article.html?article=st0223. 15 T. A. Davis and Y. Hu. The University of Florida Sparse Matrix Collection. ACM Trans- actions on Mathematical Software, 38(1):1:1–1:25, 2011. 18 16 K. D. Devine, E. G. Boman, R. T. Heaphy, R. H. Bisseling, and Ü. V. Catalyürek. Parallel In 20th International Conference on Hypergraph Partitioning for Scientific Computing. Parallel and Distributed Processing, IPDPS, pages 124–124. IEEE, 2006. 17 W.E. Donath. Logic partitioning. Physical Design Automation of VLSI Systems, pages 65–86, 1988. J. Edmonds and R. M. Karp. Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems. Journal of the ACM, 19(2):248–264, 1972. 19 C. Fiduccia and R. Mattheyses. A Linear Time Heuristic for Improving Network Partitions. In 19th ACM/IEEE Design Automation Conf., pages 175–181, 1982. 20 D. R. Ford and D. R. Fulkerson. Flows in Networks. Princeton University Press, 1962. 21 Lester R Ford and Delbert R Fulkerson. Maximal Flow through a Network. Canadian Journal of Mathematics, 8(3):399–404, 1956. T. Heuer, P. Sanders and S. Schlag XX:21 22 A. V. Goldberg and R. E. Tarjan. A new approach to the maximum-flow problem. Journal of the ACM, 35(4):921–940, 1988. 23 Andrew Goldberg, Sagi Hed, Haim Kaplan, Robert Tarjan, and Renato Werneck. Maximum Flows by Incremental Breadth-First Search. Proceedings of 2011 European Symposium on Algorithms, pages 457–468, 2011. 24 M. Hamann and B. Strasser. Graph Bisection with Pareto-Optimization. In Proceedings of the Eighteenth Workshop on Algorithm Engineering and Experiments, ALENEX 2016, Arlington, Virginia, USA, January 10, 2016, pages 90–102, 2016. S. Hauck and G. Borriello. An Evaluation of Bipartitioning Techniques. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 16(8):849–866, Aug 1997. 26 B. Hendrickson and R. Leland. A Multi-Level Algorithm For Partitioning Graphs. SC 25 Conference, 0:28, 1995. 27 T. Heuer. High Quality Hypergraph Partitioning via Max-Flow-Min-Cut Computations. Master's thesis, KIT, 2018. 28 T. Heuer and S. Schlag. Improving Coarsening Schemes for Hypergraph Partitioning by Exploiting Community Structure. In 16th International Symposium on Experimental Al- gorithms, (SEA), page 21:1–21:19, 2017. 30 29 T. C. Hu and K. Moerder. Multiterminal Flows in a Hypergraph. In T.C. Hu and E.S. Kuh, editors, VLSI Circuit Layout: Theory and Design, chapter 3, pages 87–93. IEEE Press, 1985. E. Ihler, D. Wagner, and F. Wagner. Modeling Hypergraphs by Graphs with the Same Mincut Properties. Inf. Process. Lett., 45(4):171–175, 1993. I. Kabiljo, B. Karrer, M. Pundir, S. Pupyrev, A. Shalita, Y. Akhremtsev, and Presta. A. Social Hash Partitioner: A Scalable Distributed Hypergraph Partitioner. PVLDB, 10(11):1418–1429, 2017. 31 32 G. Karypis, R. Aggarwal, V. Kumar, and S. Shekhar. Multilevel Hypergraph Partitioning: Applications in VLSI Domain. IEEE Transactions on Very Large Scale Integration VLSI Systems, 7(1):69–79, 1999. 33 G. Karypis and V. Kumar. Multilevel K-way Hypergraph Partitioning. In Proceedings of the 36th ACM/IEEE Design Automation Conference, pages 343–348. ACM, 1999. 34 B. W. Kernighan and S. Lin. An Efficient Heuristic Procedure for Partitioning Graphs. The Bell System Technical Journal, 49(2):291–307, Feb 1970. 35 K. Lang and S. Rao. A Flow-Based Method for Improving the Expansion or Conductance of Graph Cuts. In Proceedings of 10th International IPCO Conference, volume 4, pages 325–337. Springer, 2004. E. Lawler. Cutsets and Partitions of Hypergraphs. Networks, 3(3):275–285, 1973. E. Lawler. Combinatorial Optimization : Networks and Matroids. Holt, Rinehart, and Whinston, 1976. 36 37 38 T. Lengauer. Combinatorial Algorithms for Integrated Circuit Layout. John Wiley & Sons, Inc., 1990. J. Li, J. Lillis, and C. K. Cheng. Linear decomposition algorithm for VLSI design ap- plications. In Proceedings of IEEE International Conference on Computer Aided Design (ICCAD), pages 223–228, Nov 1995. 39 40 H. Liu and D. F. Wong. Network-Flow-Based Multiway Partitioning with Area and Pin IEEE Transactions on Computer-Aided Design of Integrated Circuits and Constraints. Systems, 17(1):50–59, Jan 1998. Z. Mann and P. Papp. Formula partitioning revisited. In Daniel Le Berre, editor, POS-14. Fifth Pragmatics of SAT workshop, volume 27 of EPiC Series in Computing, pages 41–56. EasyChair, 2014. 41 XX:22 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning 42 H. Meyerhenke, P. Sanders, and C. Schulz. Partitioning Complex Networks via Size- In 13th International Symposium on Experimental Algorithms, Constrained Clustering. (SEA), pages 351–363, 2014. 46 44 45 43 D. A. Papa and I. L. Markov. Hypergraph Partitioning and Clustering. In T. F. Gonza- lez, editor, Handbook of Approximation Algorithms and Metaheuristics. Chapman and Hall/CRC, 2007. Jean-Claude Picard and Maurice Queyranne. On the Structure of all Minimum Cuts in a Network and Applications. Combinatorial Optimization II, pages 8–16, 1980. Joachim Pistorius and Michel Minoux. An Improved Direct Labeling Method for the Max–Flow Min–Cut Computation in Large Hypergraphs and Applications. International Transactions in Operational Research, 10(1):1–11, 2003. L. A. Sanchis. Multiple-way Network Partitioning. IEEE Trans. on Computers, 38(1):62– 81, 1989. doi:10.1109/12.8730. P. Sanders and C. Schulz. Engineering Multilevel Graph Partitioning Algorithms. In 19th European Symposium on Algorithms, volume 6942 of LNCS, pages 469–480. Springer, 2011. S. Schlag, V. Henne, T. Heuer, H. Meyerhenke, P. Sanders, and C. Schulz. k-way Hy- pergraph Partitioning via n-Level Recursive Bisection. In 18th Workshop on Algorithm Engineering and Experiments (ALENEX), pages 53–67, 2016. 49 D. G. Schweikert and B. W. Kernighan. A Proper Model for the Partitioning of Electrical Circuits. In Proceedings of the 9th Design Automation Workshop, DAC, pages 57–62. ACM, 1972. 50 A. Trifunovic. Parallel Algorithms for Hypergraph Partitioning. PhD thesis, University of 47 48 London, 2006. 51 A. Trifunović and W. J. Knottenbelt. Parallel Multilevel Algorithms for Hypergraph Par- titioning. Journal of Parallel and Distributed Computing, 68(5):563 – 581, 2008. 52 Ü. V. Çatalyürek and M. Deveci and K. Kaya and B. Uçar. UMPa: A multi-objective, multi-level partitioner for communication minimization. In Bader et al. [8], pages 53–66. 53 B. Uçar and C. Aykanat. Encapsulating Multiple Communication-Cost Metrics in Parti- tioning Sparse Rectangular Matrices for Parallel Matrix-Vector Multiplies. SIAM Journal on Scientific Computing, 25(6):1837–1859, 2004. 54 B. Vastenhouw and R. H. Bisseling. A Two-Dimensional Data Distribution Method for Parallel Sparse Matrix-Vector Multiplication. SIAM Review, 47(1):67–95, 2005. 56 55 N. Viswanathan, C. Alpert, C. Sze, Z. Li, and Y. Wei. The dac 2012 routability-driven placement contest and benchmark suite. In Proceedings of the 49th Annual Design Auto- mation Conference, DAC '12, pages 774–782. ACM, 2012. S. Wichlund. On multilevel circuit partitioning. Computer-aided Design, ICCAD, pages 505–511. ACM, 1998. In 1998 International Conference on 57 H. H. Yang and D. F. Wong. Efficient Network Flow Based Min-Cut Balanced Partition- ing. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 15(12):1533–1540, 1996. T. Heuer, P. Sanders and S. Schlag XX:23 Effectiveness Tests A To evaluate the effectiveness of our configurations presented in Section 4.2 we give each configuration the same time to compute a partition. For each instance (hypergraph, k), we execute each configuration once and note the largest running time tH,k. Then each configuration gets time 3tH,k to compute a partition (i.e., we take the best partition out of several repeated runs). Whenever a new run of a partition would exceed the largest running time, we perform the next run with a certain probability such that the expected running time is 3tH,k. The results of this procedure, which was initially proposed in [47], are presented in Table 8. We see that the combinations of flow-based refinement and FM local search perform better than repeated executions of the baseline configuration (-F,-M,+FM). The most effective configuration is (+F,+M,-FM) with α0 = 16, which was chosen as the default configuration for KaHyPar-MF. Table 8 Results of the effectiveness test for different configurations of our flow-based refinement framework for increasing α0. The quality in column Avg[%] is relative to the baseline configuration (-F,-M,+FM). Config α0 1 2 4 8 16 Ref. (+F,-M,-FM) (+F,+M,-FM) (+F,-M,+FM) (+F,+M,+FM) Avg[%] −6.06 −3.15 −1.89 −0.87 −0.29 (-F,-M,+FM) Avg[%] −5.52 −2.06 −0.19 0.96 1.66 6377.15 Avg[%] 0.23 0.55 0.86 1.20 1.52 Avg[%] 0.24 0.73 1.20 1.69 2.17 XX:24 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning B Average Connectivity Improvement Table 9 Comparing the average solution quality of KaHyPar-MF with the average results of KaHyPar-CA and other partitioners for different benchmark sets (top) and different values of k (bottom). All values correspond to the quality improvement of KaHyPar-MF relative to the respective partitioner (in %). Algorithm All 2.44 13.61 13.23 8.67 14.35 k = 2 hMetis-R hMetis-K PaToH-Q PaToH-D DAC KaHyPar-MF 7782.5117 476.91 3.04 KaHyPar-CA 3.53 7.82 11.97 19.21 k = 4 KaHyPar-MF 1057.93 3130.20 2.57 KaHyPar-CA 15.92 15.15 8.36 14.24 hMetis-R hMetis-K PaToH-Q PaToH-D 2.27 21.38 21.63 10.51 13.26 Avg. (λ − 1) Literal SPM WebSoc 7783.87 3.84 41.32 40.14 15.12 24.18 2.66 2.72 8.49 11.78 17.72 k = 32 ISPD98 Primal Dual 5643.99 15 863.75 15 770.06 3038.55 3.39 30.28 22.26 8.08 15.47 k = 64 6143.73 2.07 2.03 16.42 2.03 16.33 3.89 6.33 10.83 11.43 15.45 k = 128 k = 16 9362.55 14 693.96 21 893.59 31 706.57 2.05 7.80 7.83 7.48 12.66 2.16 1.60 1.37 7.35 13.11 k = 8 6032.58 2.80 14.47 13.61 8.35 16.07 2.68 13.63 13.49 9.09 16.59 2.48 11.35 10.52 8.54 13.87 2.24 9.63 9.30 8.27 13.61 T. Heuer, P. Sanders and S. Schlag XX:25 C Properties of Benchmark Sets Table 10 Basic properties of our parameter tuning benchmark set. The number of pins is denoted with p. Class ISPD Dual Literal Primal SPM Hypergraph ibm06 ibm07 ibm08 ibm09 ibm10 6s9 6s133 6s153 dated-10-11-u dated-10-17-u 6s133 6s153 aaai10-planning-ipc5 dated-10-11-u atco_enc2_opt1_05_21 6s153 aaai10-planning-ipc5 hwmcc10-timeframe dated-10-11-u atco_enc2_opt1_05_21 mult_dcop_01 vibrobox RFdevice mixtank_new laminar_duct3D n 32 498 45 926 51 309 53 395 69 429 100 384 140 968 245 440 629 461 1 070 757 96 430 171 292 107 838 283 720 112 732 85 646 53 919 163 622 141 860 56 533 25 187 12 328 74 104 29 957 67 173 m 34 826 48 117 50 513 60 902 75 196 34 317 48 215 85 646 141 860 229 544 140 968 245 440 308 235 629 461 526 872 245 440 308 235 488 120 629 461 526 872 25 187 12 328 74 104 29 957 67 173 p 128 182 175 639 204 890 222 088 297 567 234 228 328 924 572 692 1 429 872 2 471 122 328 924 572 692 690 466 1 429 872 2 097 393 572 692 690 466 1 138 944 1 429 872 2 097 393 193 276 342 828 365 580 1 995 041 3 833 077 XX:26 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning Table 11 Basic properties of the graph instances. Graph p2p-Gnutella04 wordassociation-2011 PGPgiantcompo email-EuAll as-22july06 soc-Slashdot0902 loc-brightkite enron loc-gowalla coAuthorsCiteseer wiki-Talk citationCiteseer coAuthorsDBLP cnr-2000 web-Google m n 29 215 6 405 63 788 10 617 24 316 10 680 60 260 16 805 48 436 22 963 379 445 28 550 212 945 56 739 254 449 69 244 950 327 196 591 227 320 814 134 232 314 ≈1.5M 268 495 ≈1.2M 299 067 977 676 325 557 ≈2.7M 356 648 ≈2.1M T. Heuer, P. Sanders and S. Schlag XX:27 D Excluded Instances Table 12 Instances excluded from the full benchmark set evaluation. Note that using flow-based refinements did not lead to any further exclusions. Hypergraph Primal 10pipe-q0-k 11pipe-k 11pipe-q0-k 9dlx-vliw-at-b-iq3 9vliw-m-9stages-iq3-C1-bug7 9vliw-m-9stages-iq3-C1-bug8 blocks-blocks-37-1.130- NOTKNOWN openstacks-p30-3.085-SAT openstacks-sequencedstrips-nonadl- nonnegated-os-sequencedstrips- p30-3.025-NOTKNOWN openstacks-sequencedstrips-nonadl- nonnegated-os-sequencedstrips- p30-3.085-SAT transport-transport-city- sequential-25nodes-1000size- 3degree-100mindistance-3trucks- 10packages-2008seed.050- NOTKNOWN velev-vliw-uns-2.0-uq5 velev-vliw-uns-4.0-9 Literal 11pipe-k 9vliw-m-9stages-iq3-C1-bug7 9vliw-m-9stages-iq3-C1-bug8 blocks-blocks-37-1.130 Dual 10pipe-q0-k 11pipe-k 11pipe-q0-k 9dlx-vliw-at-b-iq3 9vliw-m-9stages-iq3-C1-bug7 9vliw-m-9stages-iq3-C1-bug8 blocks-blocks-37-1.130- NOTKNOWN E02F20 E02F22 q-query-3-L100-coli.sat q-query-3-L150-coli.sat q-query-3-L200-coli.sat q-query-3-L80-coli.sat transport-transport-city- sequential-25nodes-1000size- 3degree-100mindistance-3trucks- 10packages-2008seed.030- NOTKNOWN velev-vliw-uns-2.0-uq5 velev-vliw-uns-4.0-9 2 4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) 4 4 4 4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) 4 4 4 4 (cid:3) 8 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) 16 (cid:3) (cid:3) (cid:3) (cid:3) 4 4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) 32 (cid:3) (cid:3) (cid:3) (cid:3) H4 H4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) 64 (cid:3) (cid:3) (cid:3) (cid:3) H4 H4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) 128 (cid:3) H(cid:3) (cid:3) (cid:3) H4 H4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) H H H GH4 GH4 GH4 GH(cid:3)4 GH(cid:3)4 GH4 GH4 GH4 GH(cid:3)4 GH(cid:3)4 (cid:3) (cid:3) (cid:3) (cid:3) (cid:3) H H4 4 H4 4 H4 4 H4 H4 4 GH4 GH4 GH4 GH4 GH4 4 GH4 GH4 GH4 GH4 GH4 4 H4 4 H GH GH GH GH H 4 4 4 4 4 4 4 4 4 H4 H4 H4 4 GH4 GH4 GH4 H H 4 4 4 4 4 4 4 XX:28 Network Flow-Based Refinement for Multilevel Hypergraph Partitioning SPM 192bit appu ESOC human-gene2 IMDB kron-g500-logn16 Rucci1 sls Trec14 (cid:3) (cid:3) (cid:3) 4 (cid:3) (cid:3) 4 (cid:3) (cid:3) 4 4 H(cid:3) (cid:3) H4 4 4 (cid:3) H(cid:3) H H(cid:3) H4 4 H4 H(cid:3) H (cid:3) H4 4 H4 H(cid:3) H 4 : KaHyPar-CA exceeded time limit G : H : (cid:3) : hMetis-R exceeded time limit hMetis-K exceeded time limit PaToH-Q memory allocation error
1704.07291
1
1704
2017-04-21T04:26:23
Minimal Controllability of Conjunctive Boolean Networks is NP-Complete
[ "cs.DS", "cs.CC", "eess.SY", "math.OC", "q-bio.MN" ]
Given a conjunctive Boolean network (CBN) with $n$ state-variables, we consider the problem of finding a minimal set of state-variables to directly affect with an input so that the resulting conjunctive Boolean control network (CBCN) is controllable. We give a necessary and sufficient condition for controllability of a CBCN; an $O(n^2)$-time algorithm for testing controllability; and prove that nonetheless the minimal controllability problem for CBNs is NP-hard.
cs.DS
cs
Minimal Controllability of Conjunctive Boolean Networks is NP-Complete Eyal Weiss, Michael Margaliot and Guy Even 1 7 1 0 2 r p A 1 2 ] S D . s c [ 1 v 1 9 2 7 0 . 4 0 7 1 : v i X r a Abstract Given a conjunctive Boolean network (CBN) with n state-variables, we consider the problem of finding a minimal set of state-variables to directly affect with an input so that the resulting conjunctive Boolean control network (CBCN) is controllable. We give a necessary and sufficient condition for controllability of a CBCN; an O(n2)-time algorithm for testing controllability; and prove that nonetheless the minimal controllability problem for CBNs is NP-hard. Logical systems, controllability, Boolean control networks, computational complexity, minimum dominating set, systems biology. Index Terms I. INTRODUCTION Many modern networked systems include a large number of nodes (or state-variables). Examples range from the electric grid to complex biological processes. If the system includes control inputs then a natural question is whether the system is controllable, that is, whether the control authority is powerful enough to steer the system from any initial condition to any desired final condition. Controllability is an important property of control systems, and it plays a crucial role in many control problems, such as stabilization of unstable systems by feedback, and optimal control [1]. If the system is not controllable (and in particular if there are no control inputs) then an important problem is what is the minimal number of control inputs that should be added to the network so that it becomes controllable. This calls for finding the key locations within the system such that controlling them allows driving the entire system to any desired state. This problem is interesting both theoretically and for applications, as in many real-world systems it is indeed possible to add control actuators, but naturally this may be timely and costly, so minimizing the number of added controls is desirable. Several recent papers studied minimal controllability in networks with a linear and time-invariant (LTI) dynamics (see, e.g. [2], [3] and the references therein). In particular, Olshevsky [2] considered the following problem. Given the n-dimensional LTI system xi(t) = Pn j=1 aijxj(t), i = 1, . . . , n, determine a minimal set of indices I ⊆ {1, . . . , n}, such that the modified system: xi(t) = xi(t) = n X j=1 n X j=1 aijxj(t) + ui(t), aijxj(t), i ∈ I, i 6∈ I, is controllable. Olshevsky [2] showed, using a reduction to the minimum hitting set problem, that this problem is NP-hard (in the number of state-variables n). For a general survey on the computational complexity of various problems in systems and control theory, see [4]. Research supported in part by a research grant from the Israel Science Foundation (ISF grant 410/15). The authors are with the School of Electrical Engineering-Systems, Tel Aviv University, Israel 69978. Corresponding author: Prof. Michael Margaliot, School of Electrical Engineering-Systems and the Sagol School of Neuroscience, Tel Aviv University, Israel 69978. Homepage: www.eng.tau.ac.il/michaelm Email: [email protected] Boolean control networks (BCNs) are discrete-time dynamical systems with Boolean state-variables and Boolean control inputs. A BCN without inputs is called a Boolean network (BN). BCNs date back to the early days of digital switching networks and neural network models with on-off type neurons. They have also been used to model many other important phenomena such as social networks (see, e.g. [5], [6]), the spread of epidemics [7], etc. 2 More recently, BCNs have been extensively used to model biological processes and networks where the possible set of states is assumed to be finite (see, e.g. [8], [9], [10]). For example, in gene regulation networks one may assume that each gene may be either "on" or "off" (i.e. expressed or not expressed). Then the state of each gene can be modeled as a state-variable in a BN and the interactions between the genes (e.g., via the proteins that they encode) determine the Boolean update function for each state- variable. A BCN with state-vector X(k) = (cid:2)X1(k) is said to be controllable if for any pair of states a, b ∈ {0, 1}n there exists an integer N ≥ 0 and a control sequence u(0), . . . , u(N − 1) steering the state from X(0) = a to X(N) = b. . . . Xn(k)(cid:3)′ A natural representation of a BCN is via its graph of states G = (V, E), where the vertices V = {1, . . . , 2n} represent all the possible 2n states, and a directed edge e = (vi → vj) ∈ E means that there is a control such that X(k) = vi and X(k + 1) = vj. Then clearly a BCN is controllable if and only if G is strongly connected [11]. Since testing strong connectivity of a digraph takes linear time in the number of its vertices and directed edges (see, e.g. [12]), one may expect that verifying controllability of a general BCN is intractable. Akutsu et al. [13] showed, using a reduction to the 3SAT problem, that determining if there exists a control sequence steering a BCN between two given states is NP-hard, and that this holds even for BCNs with restricted network structures. This implies in particular that verifying controllability is NP-hard. Of course, it is still possible that the problems of verifying controllability and finding the minimal number of controls needed to make a BN controllable are tractable in some special classes of Boolean networks. An important special class of BNs are those comprised of nested canalyzing functions (NCFs) [14]. A Boolean function is called canalyzing if there exists a certain value, called the canalyzing value, such that any input with this value uniquely determines the output of the function regardless of the other variables. For example, 0 is a canalyzing value for the function AND, as AND(0, x1, . . . , xk) = 0 for any xi ∈ {0, 1}. BNs with nested canalyzing functions are often used to model genetic networks [15], [16], [17]. Here, we consider the subclass consisting of those NCFs that are constructed only with the AND operator, the conjunctive functions. A BN is called a conjunctive Boolean network (CBN) if every update function includes only AND operations, i.e., the state-variables satisfy an equation of the form: Xi(k + 1) = n Y j=1 (Xj(k))ǫji, i = 1, . . . , n, (1) where ǫji ∈ {0, 1} for all i, j. Recall that a BN is called a disjunctive Boolean network (DBN) if every update function includes only OR operations. By applying De Morgan Law's, one can reduce DBNs to CBNs, so all the results in this note hold also for DBNs. A CBN with n state-variables can be represented by its dependency graph (or wiring diagram) that has n vertices corresponding to the Boolean state-variables. There is a directed edge (i → j) if Xi(k) appears in the update function of Xj(k + 1). That is, the dependency graph encodes the variable dependencies in the update functions. We will assume from here on that none of the update functions is constant, so every vertex in the dependency graph has a positive in-degree. In this case, there is a one-to-one correspondence between the CBN and its dependency graph, and this allows a graph-theoretic analysis of the CBN. For example, the problem of characterizing all the periodic orbits of a CBN with a strongly connected dependency graph has been solved in [18], and the robustness of these orbits has been studied in [19]. 3 In the context of modeling gene regulation, CBNs encode synergistic regulation of a gene by several transcription factors [18], and there is increasing evidence that this type of mechanism is common in regulatory networks [20], [21], [22]. Here, we consider the following problem. Problem 1. Given a CBN with n state-variables, suppose that for any i ∈ {1, . . . , n} we can replace the update function of Xi(k + 1) by an independent Boolean control Ui(k). Determine a minimal1 set of indices I ⊆ {1, . . . , n}, such that the modified system: Xi(k + 1) = Ui(k), n Xi(k + 1) = Y (Xj(k))ǫji, j=1 i ∈ I, i 6∈ I, (2) is controllable. We refer to a BCN in the form (2) as a conjunctive Boolean control network (CBCN). Problem 1 is important because it calls for finding a minimal set of key variables in the CBN such that controlling them makes the system controllable. Of course, an efficient algorithm for solving this problem must encapsulate an efficient algorithm for testing controllability of a CBCN. Example 1. Consider Problem 1 for the CBN Suppose that we replace the update function for X2(k) by a control U2(k) so that the network becomes: X1(k + 1) = X2(k), X2(k + 1) = X1(k)X2(k). X1(k + 1) = X2(k), X2(k + 1) = U2(k). This CBCN is clearly controllable. Indeed, given a desired final state s = (cid:2)s1 s2(cid:3)′ ∈ {0, 1}2, the control sequence U2(0) = s1, U2(1) = s2, steers the CBCN from an arbitrary initial condition X1(0), X2(0) to (cid:2)X1(2) X2(2)(cid:3)′ = s. Thus, in this case a solution to Problem 1 is to replace the update function of X2 by a control. The main contributions of this note are: 1) a necessary and sufficient condition for the controllability of a CBCN; 2) a polynomial-time algorithm for determining whether a CBCN is controllable (more specifically the time complexity of this algorithm is O(n2), where n is the number of state-variables in the BCN); 3) a proof that Problem 1 is NP-hard. Together, these results imply that checking the controllability of a given CBCN is "easy", yet there does not exist a polynomial-time algorithm for solving Problem 1 (unless P=NP). The next section reviews definitions and notations from graph theory that will be used later on. Section III describes our main results. Section IV concludes and presents several directions for further research. II. PRELIMINARIES Let G = (V, E) be an undirected graph, where V is the set of vertices, and E is the set of edges. If two vertices vi, vj are connected by an edge then we denote this edge by eij or by (vi, vj), and say that vi and vj are neighbors. The set of neighbors of vi is denoted by N (vi), and the degree of vi is N (vi). 1In computer science, this is usually called a minimum cardinality set rather than a minimal set. We follow the terminology used in control theory. 4 A dominating set for G is a subset D of V such that every vertex in V \D has at least one neighbor in D. Problem 2 (Dominating set problem). Given a graph G = (V, E) and a positive integer k ≤ V , does there exist a dominating set D of V with D ≤ k? This is known to be an NP-complete decision problem (see, e.g. [23]). Let G = (V, E) be a directed graph (digraph), with V the set of vertices, and E the set of directed edges (arcs). Let ei→j (or (vi → vj)) denote the arc from vi to vj. When such an arc exists, we say that vi is an in-neighbor of vj, and vj as an out-neighbor of vi. The set of in-neighbors and out-neighbors of a vertex vi is denoted by Nin(vi) and Nout(vi), respectively. The in-degree and out-degree of vi are Nin(vi) and Nout(vi), respectively. Let vi and vj be two vertices in V . A walk from vi to vj, denoted by wij, is a sequence: vi0vi1 . . . viq , with vi0 = vi, viq = vj, and eik→ik+1 ∈ E for all k ∈ {0, 1, . . . q − 1}. A simple path is a walk with pairwise distinct vertices. We say that vi is reachable from vj if there exists a simple path from vj to vi. A closed walk is a walk that starts and finishes at the same vertex. A closed walk is called a cycle if all the vertices in the walk are distinct, except for the start-vertex and the end-vertex. A strongly connected digraph is a digraph for which every vertex in the graph is reachable from any other vertex in the graph. Recall that given the CBN (1), the associated dependency graph is a digraph G = (V, E) with n vertices, such that ei→j ∈ E if and only if ǫij = 1. A CBN is uniquely determined by its dependency graph, and for this reason we interchangeably refer to the ith state-variable in the CBN and the ith vertex in its dependency graph. We extend the definition of a dependency graph to a CBCN in a natural way: upon replacing the update equation for Xi(k + 1) to Xi(k + 1) = Ui(k) we remove all the arcs pointing to vi, introduce a new vertex vUi for the new control input, and add an arc eUi→i. An m-layer graph is a digraph G = (V, E) for which each layer Lk, k = 1, . . . , m, is a subset of V , every vertex in V belongs to a single layer, and any arc ei→j ∈ E is such that vi ∈ Lk and vj ∈ Lk+1, for some k ∈ {1, 2, . . . , m − 1}. A. Complexity Analysis III. MAIN RESULTS We begin by analyzing the computational complexity of Problem 1. We will prove a hardness result for a CBCN whose dependency graph is a 3-layer graph. Our first result uses the special structure of this CBCN to provide a simple necessary and sufficient condition for controllability. We will later use this condition to relate controllability analysis for this CBCN to the dominating set problem. Lemma 1. Consider a CBCN with a dependency graph that is a 3-layer graph satisfying: every vertex in layer-1 is a control input to a vertex in layer-2, and every vertex in layer-2 has its own control input (in layer-1). This CBCN is controllable if and only if every vertex in layer-3 has an in-neighbor (in layer-2) with out-degree equal to one. Proof ofLemma1. Assume that the CBCN is controllable. Seeking a contradiction, suppose that there exists a vertex vi in layer 3 that has no in-neighbor with out-degree one. Let Xi denote the corresponding state-variable. If vi has zero in-neighbors then Xi(k) is constant, contradicting the assumption of control- lability. Hence vi must have at least one in-neighbor and each of them with out-degree greater than one. From the controllability of the CBCN, it follows that for any initial state X(0), there exists a time T ≥ 0 and a control sequence {u(0), . . . , u(T − 1)} steering the CBCN to the final state: Xi(T ) = 0, Xj(T ) = 1 for all j 6= i. (3) In other words, the state-variables corresponding to all the nodes in layers 2 and 3, except for Xi, are one at time T . But for (3) to hold at least one of the in-neighbors of vi must be zero at time T − 1. Since 5 zero is the canalyzing value and every in-neighbor of vi has out-degree greater than one, there exists a state variable Xq, q 6= i, such that Xq(T ) = 0. A contradiction. To prove the converse implication, suppose that every vertex in layer 3 of the CBCN has an in-neighbor (in layer 2) with out-degree equal to one. We need to prove that the CBCN is controllable. Denote the nodes in layer 3 by w1, . . . , wq. For any i ∈ {1, . . . , q} the node wi in layer 3 has an in-neighbor vi in layer 2 such that vi has out degree one. Let p ≥ q denote the number of nodes in layer 2, so that the nodes in layer 2 are v1, . . . , vq, vq+1, . . . , vp, and their corresponding controls in layer 1 are u1, . . . , up. Fix arbitrary a ∈ {0, 1}p and b ∈ {0, 1}q. We will show that for any initial condition there exists a control sequence that steers the network to the state v(4) = a and w(4) = b, where v = [v1 . . . vp]′, w = [w1 . . . wq]′, thus proving controllability. In time steps 0 and 1, set all the inputs to one. Then vi(2) = wj(2) = 1 for all i, j. Now let ui(2) = bi for all i ∈ {1, . . . , q}, and ui(2) = 1 for all i > q. Then vi(3) = bi for all i ∈ {1, . . . , q}, and vi(3) = 1 for all i > q. Finally, let ui(3) = ai for all i ∈ {1, . . . , p}. Then wi(4) = vi(3) = bi for all i ∈ {1, . . . , q} (because AND(1, z) = z for all z ∈ {0, 1}) and vi(4) = ai for all i ∈ {1, . . . , p}. This completes the proof of Lemma 1. We are now ready to present our main complexity result. Theorem 2. The decision version of Problem 1 is NP-hard. Proofof Thm.2. Given an undirected graph G = (V, E), and a positive integer k, consider Problem 2. We will show that we can solve this instance of the dominating set problem by solving a minimal controllability problem for a 3-layer CBCN with dependency graph G = ( V , E) constructed as follows. Define L2 := E, L3 := V , and let V := L2 S L3. In other words, G has E + V nodes. The nodes in L3 are denoted v1, . . . , vs, where s := V and those in L2 are denoted by euv. The set E includes two sets of directed edges. First, every euv ∈ L2 induces an arc (euv → euv) (i.e., a self loop). Second, every edge e ∈ E induces two directed edges in E: (euv → v) and (euv → u). Thus, E = 3E (Example 2 below demonstrates this construction). Note that this construction is polynomial in V , E. Consider the CBN induced by G as a dependency graph, and the minimal controllability problem for this CBN. A solution for this problem includes adding controls to some of the state-variables. Since every node in L2 has a self-loop in G, a control input must be added to each node e ∈ L2. Denoting by L1 the set of nodes corresponding to the control inputs added to the CBN, it is evident that we obtained a 3-layer graph. The solution to the controllability problem may also add control inputs to nodes in L3. Let Y ⊆ L3 denote the set of these nodes. Note that Y is also a set of nodes in the original graph G. We require the following result. Lemma 3. The set Y is a minimum dominating set of G. Proof of Lemma 3. Let ¯G denote the dependency graph of the controllable CBCN obtained by solving the minimal controllability problem described above. Define a new dependency graph ¯G′ by removing the nodes in Y , their adjacent directed edges, and the nodes of the control inputs added to them in ¯G. Then ¯G′ is a 3-layer controllable CBCN: the first layer consists of the controls that were added to the nodes in L2 (namely the nodes of L1), the second layer is composed of the nodes in L2, and the third is composed of the nodes in V \ Y . It follows from Lemma 1 that for every vertex v ∈ (V \ Y ) there exists a vertex e ∈ L2 such that e is an in-neighbor of v and e is not an in-neighbor of any other vertex in V \ Y . Thus, e must be an in-neighbor of a node in Y . We conclude that Y is a dominating set of G. Since the construction solves the minimal controllability problem, it is clear that Y is a minimum dominating set of G. We now consider two cases. If Y ≤ k then we found a dominating set with cardinality ≤ k and thus the answer to Problem 2 for the given instance is yes. If Y > k then the argument above implies that there does not exist a dominating set with cardinality ≤ k and thus the answer to Problem 2 for the given instance is no. Since Problem 2 is NP-hard, this completes the proof of Theorem 2. . v2 e23 v1 e13 e34 v3 v4 6 u1 u2 u3 u4 e13 e23 e34 e13 e23 e34 v1 v2 v3 v4 v1 v2 v3 v4 Fig. 1. An example demonstrating the construction in the proof of Thm. 2. Left: a graph G. The unique solution to the minimal dominating set problem for G is D = {v3}. Middle: the digraph G described in the proof of Thm. 2. Right: the digraph ¯G describing the unique solution to the minimal controllability problem for G obtained by adding a control to each node eij and to the node v3 in G. Example 2. Consider the graph G = (V, E) shown on the left of Fig. 1, with V = {v1, v2, v3, v4} and E = {e13, e23, e34}. The unique solution to the minimal dominating set for G is D = {v3}. The construction in the proof above yields the directed graph G = ( V , E) depicted in the middle of Fig. 1. Note that this has two layers of nodes: L2 and L3 that include the edges and vertices in G, respectively. The solution of the minimal controllability problem for G is depicted on the right of Fig. 1. Here Y = {v3}. Our next goal is to present a polynomial-time algorithm for determining if (2) is controllable. To do this, we first derive graph-theoretic necessary and sufficient conditions for the controllability of a CBCN. B. Necessary and Sufficient Conditions for Controllability of a CBCN We begin by introducing several definitions that will be used later on. In a digraph, a source is a node that has in-degree zero, and a sink is a node that has out-degree zero. A digraph that does not contain cycles is called a directed acyclic graph (DAG). We now introduce several definitions referring to the dependency graph of a CBCN. A node that represents a state-variable (SV) is called a simple node. A node that represents a control input is called a generator. Note that a generator is always a source, and that its set of out-neighbors always contains a single simple node (see (2)). A node that represents an SV that has an added control input is called a directly controlled node. Note that a directly controlled node is also a simple node. A simple node with out-degree one, and without a self-loop, is called a channel. Note that the only out-neighbor of a channel is another simple node (since a generator is always a source). We are now ready to derive necessary conditions for the controllability of a CBCN. We will assume throughout that no SV in the network has a constant updating function. Indeed, in this case it is clear that the updating function of such an SV must be replaced by a control input. Under this assumption, a simple node cannot be a source. Proposition 4. The dependency graph of a controllable CBCN is acyclic. Proof of Prop. 4. Consider a CBCN with a cycle in its dependency graph. Every vertex in the cycle corresponds to an SV (i.e., it is a simple node), as a generator is a source, so it cannot be part of a cycle. Moreover, any simple node in the cycle is not a directly controlled node, since the only in-neighbor of a directly controlled node is a generator. This implies that if at time 0 the SVs in the cycle are all zero then they can never be steered to the a state where they are all one. Hence, the CBCN is not controllable. It is natural to expect that in a controllable CBCN every SV has the following property. There exists a path from a control input to the SV that allows to set the SV to zero (the canalyzing value), without affecting the other SVs. To make this precise, we say that a CBCN has Property P if every simple node in its dependency graph contains in its set of in-neighbors either a generator or a channel. The next result provides another necessary condition for controllability of a CBCN. Proposition 5. A controllable CBCN has Property P. 7 Proof of Prop. 5. Seeking a contradiction, assume that the CBCN is controllable and that there exists a simple node v in its dependency graph that does not contain a generator nor a channel in its set of in-neighbors. This means that there does not exist a node w in the graph such that v is the only simple node in the out-neighbors of w. Hence, the SV that corresponds to v cannot change its value to zero (the canalyzing value) without at least one other SV changing its value to zero as well. Consider two states: a corresponding to all SVs being zero, and b corresponding to all SVs being one except for v that is zero. Since the CBCN is controllable it is possible to steer it from a to b. This implies that v has a self-loop, as it holds the value zero while the other SVs change their values. Prop. 4 implies that the CBCN is not controllable. Props. 4 and 5 provide two necessary conditions for the controllability of a CBCN. The next result shows that together they are also sufficient. Theorem 6. A CBCN is controllable if and only if its dependency graph is a DAG and satisfies Property P. To prove this, we introduce another definition and some auxiliary results. A controlled path is an ordered non-empty set of nodes in the dependency graph such that: the first element in the ordered set is a generator, and if the set contains more than one element, then for any i > 1 the ith node is a simple node, and is the only element in the set of out-neighbors of node i − 1. Controlled paths with non-overlapping nodes are called disjoint controlled paths. Proposition 7. Consider a CBCN with a dependency graph G that is a DAG and satisfies Property P. Then G can be decomposed into disjoint controlled paths, such that every vertex in the graph belongs to a single controlled path (i.e., the union of the disjoint controlled paths forms a vertex cover of G). Proof of Prop. 7. The proof is based on Algorithm 1 detailed below that accepts such a graph G and terminates after each vertex in the graph belongs to exactly one controlled path. Algorithm 1 Decompose the nodes in G into disjoint controlled paths 1: while there exists a simple node v ∈ G that is not included in any ordered set do 2: cnode ← v and cset ← {v} if Nin(cnode) contains a channel then 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: pick a channel u ∈ Nin(cnode) if u does not belong to any ordered set then insert u to the ordered set cset just before cnode cnode ← u goto 3 else let H denote the ordered set that contains u merge cset into H keeping the order between any two adjacent elements goto 1 else pick a generator u ∈ Nin(cnode) if u does not belong to any ordered set then insert it to cset just before cnode goto 1 else goto 10 Note that the assumption that G has Property P is used in line 14 of the algorithm. The proof that Algorithm 1 terminates in a finite number of steps and divides all the nodes in the graph to a set of disjoint controlled paths is straightforward and thus omitted. The basic idea is that Property P and the 8 U1 U2 X1 X2 X3 Fig. 2. Dependency graph of the CBCN (4) . fact that the graph is a DAG implies that we can "go back" from any simple node through a chain of channels ending with a generator, thus creating a controlled path. This completes the proof of Prop. 7. Example 3. Consider the CBCN: X1(k + 1) = U1(k), X2(k + 1) = U2(k), X3(k + 1) = X1(k)X2(k). (4) It is straightforward to verify that (4) is controllable. Fig. 2 depicts the dependency graph G of this CBCN. Note that G is a DAG and that it satisfies Property P. A decomposition into two disjoint controlled paths is C 1 = {U1 → X1 → X3}, C 2 = {U2 → X2}. We can now prove Thm. 6. Proof of Thm. 6. Consider a CBCN satisfying the conditions stated in the Theorem. By Prop. 7, there exists a decomposition of its dependency graph into a set of m ≥ 1 disjoint controlled paths C 1, . . . , C m, such that every vertex in the graph belongs to a single controlled path. We assume from here on that m = 2 (the proof in the general case is a straightforward generalization). Pick two states a, b ∈ {0, 1}n. We prove that the CBCN is controllable by providing a control sequence that steers the CBCN from X(0) = a to X(T ) = b, in time T ≥ 0. Since the paths provide a vertex cover, the desired state b can be decomposed into b1 and b2 such that when the state is b the simple nodes in C 1 [C 2] have state b1 [b2]. First, feed a control sequence with all ones to both generators until all the SVs reach the value one at some time τ ≥ 0. Such a τ exists, because by the properties of the paths there are no arcs between simple nodes in C1 and C2, except perhaps an arc from the final node in one path, say C1, to the other path C2 (and since the graph is a DAG there is no arc from a node in C2 to a node in C1). By adding a chain of dummy control inputs at the beginning of the shorter path, if needed, we may assume that C 1 = C 2. Now we may view each path as a shift register (with all SVs initiated to one) and it is straightforward to feed each path with a suitable sequence of controls to obtain the desired states b1 and b2 at some time T ≥ 0. Thus, the CBCN is controllable. Note that this proof also provides the sequence of controls needed to steer the CBCN from a to b, i.e. it solves the control synthesis problem (given the decomposition into a set of disjoint controlled paths). Combining this with Prop. 7 implies the following. Corollary 8. A CBCN is controllable if and only if its dependency graph can be decomposed into a set of disjoint controlled paths. Using the necessary and sufficient condition for controllability it is possible to derive an efficient algorithm for determining if a CBCN is controllable. C. An efficient algorithm for determining controllability Algorithm 2 below tests if a CBCN is controllable. It is based on the condition in Thm. 6. Algorithm 2 Testing controllability of a CBCN in the form (2) with n SVs and q ≤ n control inputs 9 1: generate the dependency graph G = (V, E) 2: if G is not a DAG then return ("not controllable") 3: create a list L of n bits 4: set all bits in L to 0 5: for all nodes v ∈ V do 6: if Nout(v) 6= 1 then return ("not controllable") else 7: 8: 9: j ← the element in Nout(v) L(j) ← 1 endfor 10: if all bits in L are 1 then return ("controllable") 11: 12: else 13: return ("not controllable") The input to Algorithm 2 is a CBCN with n SVs and q ≤ n control inputs. The first step is to build the dependency graph G = (V, E). The complexity of this step is O(n2), as this requires going through n updating functions, and each function has at most n arguments. The resulting graph satisfies V = n+q ≤ 2n, and E ≤ n2. Checking if G is a DAG in line 2 can be done using a topological sort algorithm. The complexity is linear in V , E (see, e.g. [24]), i.e. it is O(n2). Lines 3-13 use the list L to check Property P, that is, to verify that the set of in-neighbors of every SV contains either a generator or a channel. This part has complexity O(n + q) = O(n). The total time-complexity of the algorithm is thus O(n2). More precisely, the complexity of the algorithm is linear in the length of the description of the CBCN, and the latter is O(n2). IV. CONCLUSIONS Minimal controllability problems for dynamical systems are important both theoretically and for real- world applications where actuators can be added to control the SVs. Here, we considered a minimal controllability problem for an important subclass of BNs, namely, CBNs. Using a graph-theoretic approach we derived: a necessary and sufficient condition for the CBCN (2) to be controllable, and a polynomial-time algorithm for testing controllability. We also showed that the minimal controllability problem is NP-hard. Our approach is based on the new concept of a controlled path and the decomposition of the dependency graph of the CBCN into disjoint controlled paths. Roughly speaking, this corresponds to decomposing the CBCN into a set of shift registers that are almost decoupled. Recall that given a digraph G = (V, E) a path cover is a set of directed paths such that every v ∈ V belongs to at least one path. A vertex-disjoint path cover is a set of paths such that every v ∈ V belongs to exactly one path. The minimum path cover problem (MPCP) consists of finding a vertex-disjoint path cover having the minimal number of paths. This problem has applications in software validation [25]. The MPCP may seem closely related to the problem studied here, but this is not necessarily so. First, the MPCP for a DAG can be solved in polynomial time (see, e.g. [26]). Second, the solution of the MPCP does not provide enough information on the controllability of a CBCN. For this, we need the more specific properties of controlled paths. We believe that the notions introduced here will find more applications in other control-theoretic problems for CBNs. An interesting direction for further research is to derive an efficient algorithm that 10 is guaranteed to approximately solve the minimal controllability problem for CBCNs, with a guaranteed approximation error in the number of needed control inputs. REFERENCES [1] E. D. Sontag, Mathematical Control Theory: Deterministic Finite Dimensional Systems, 2nd ed. New York: Springer, 1998. [2] A. Olshevsky, "Minimal controllability problems," IEEE Trans. Control of Network Systems, vol. 1, no. 3, pp. 249 -- 258, 2014. [3] Y.-Y. Liu, J.-J. Slotine, and A.-L. Barabasi, "Controllability of complex networks," Nature, vol. 473, pp. 167 -- 173, 2011. [4] V. D. Blondel and J. N. Tsitsiklis, "A survey of computational complexity results in systems and control," Automatica, vol. 36, pp. 1249 -- 1274, 2000. [5] D. G. Green, T. G. Leishman, and S. Sadedin, "The emergence of social consensus in Boolean networks," in Proc. 2007 IEEE Symposium on Artificial Life (IEEE-ALife'07), Honolulu, Hawaii, 2007, pp. 402 -- 408. [6] S. Kochemazov and A. Semenov, "Using synchronous Boolean networks to model several phenomena of collective behavior," PLoS ONE, vol. 9, no. 12, p. e115156, 2014. [7] A. Kasyanov, L. Kirkland, and M. T. Mihaela, "A spatial SIRS Boolean network model for the spread of H5N1 avian influenza virus among poultry farms," in Proc. 5th Int. Workshop Computational Systems Biology (WCSB), 2008, pp. 73 -- 76. [8] S. Bornholdt, "Boolean network models of cellular regulation: prospects and limitations," J. R. Soc. Interface, vol. 5, pp. S85 -- S94, 2008. [9] T. Helikar, N. Kochi, J. Konvalina, and J. Rogers, "Boolean modeling of biochemical networks," The Open Bioinformatics Journal, vol. 5, pp. 16 -- 25, 2011. [10] A. Faure, A. Naldi, C. Chaouiya, and D. Thieffry, "Dynamical analysis of a generic Boolean model for the control of the mammalian cell cycle," Bioinformatics, vol. 22, pp. e124 -- e131, 2006. [11] D. Laschov and M. Margaliot, "Controllability of Boolean control networks via the Perron-Frobenius theory," Automatica, vol. 48, pp. 1218 -- 1223, 2012. [12] R. Tarjan, "Depth first search and linear graph algorithms," SIAM J. Computing, vol. 1, no. 2, pp. 146 -- 160, 1972. [13] T. Akutsu, M. Hayashida, W.-K. Ching, and M. K. Ng, "Control of Boolean networks: Hardness results and algorithms for tree structured networks," J. Theoretical Biology, vol. 244, pp. 670 -- 679, 2007. [14] S. A. Kauffman, The Origins of order: Self Organization and Selection in Evolution. Oxford University Press, 1993. [15] S. E. Harris, B. K. Sawhill, A. Wuensche, and S. Kauffman, "A model of transcriptional regulatory networks based on biases in the observed regulation rules," Complexity, vol. 7, no. 4, pp. 23 -- 40, 2002. [16] S. Kauffman, C. Peterson, B. Samuelsson, and C. Troein, "Random Boolean network models and the yeast transcriptional network," Proceedings of the National Academy of Sciences, vol. 100, no. 25, pp. 14 796 -- 14 799, 2003. [17] S. Kauffman, C. Peterson, B. Samuelssonand, and C. Troein, "Genetic networks with canalyzing Boolean rules are always stable," Proceedings of the National Academy of Sciences, vol. 101, no. 49, pp. 17 102 -- 17 107, 2004. [18] A. S. Jarrah, R. Laubenbacher, and A. Veliz-Cuba, "The dynamics of conjunctive and disjunctive Boolean network models," Bull. Math. Biology, vol. 72, no. 6, pp. 1425 -- 1447, 2010. [19] Z. Gao, X. Chen, and T. Basar, "Stability structures of conjunctive Boolean networks," 2016. [Online]. Available: https://arxiv.org/abs/1603.04415# [20] M. Merika and S. H. Orkin, "Functional synergy and physical interactions of the erythroid transcription factor gata-1 with the Kruppel family proteins Sp1 and EKLF," Mol. Cell. Bio., vol. 15, no. 5, pp. 2437 -- 2347, 1995. [21] B. M. Gummow, J. O. Scheys, V. R. Cancelli, and G. D. Hammer, "Reciprocal regulation of a glucocorticoid receptor-steroidogenic factor-1 transcription complex on the Dax-1 promoter by glucocorticoids and adrenocorticotropic hormone in the adrenal cortex," Mol. Endocrinol., vol. 20, no. 11, pp. 2711 -- 2723, 2006. [22] D. H. Nguyen and P. D'haeseleer, "Deciphering principles of transcription regulation in eukaryotic genomes," Molecular Systems Biology, vol. 2, no. 1, 2006. [23] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness. San Francisco, CA: W. H. Freeman, 1979. [24] A. B. Kahn, "Topological sorting of large networks," Communications of the ACM, vol. 5, no. 11, pp. 558 -- 562, 1962. [25] S. C. Ntafos and S. L. Hakimi, "On path cover problems in digraphs and applications to program testing," IEEE Trans. Software Engineering, vol. SE-5, no. 5, pp. 520 -- 529, 1979. [26] S. Even, Graph Algorithms, 2nd ed., G. Even, Ed. New York, NY: Cambridge University Press, 2011.
1503.05638
2
1503
2015-09-21T04:31:50
Entropy-scaling search of massive biological data
[ "cs.DS", "q-bio.GN" ]
Many datasets exhibit a well-defined structure that can be exploited to design faster search tools, but it is not always clear when such acceleration is possible. Here, we introduce a framework for similarity search based on characterizing a dataset's entropy and fractal dimension. We prove that searching scales in time with metric entropy (number of covering hyperspheres), if the fractal dimension of the dataset is low, and scales in space with the sum of metric entropy and information-theoretic entropy (randomness of the data). Using these ideas, we present accelerated versions of standard tools, with no loss in specificity and little loss in sensitivity, for use in three domains---high-throughput drug screening (Ammolite, 150x speedup), metagenomics (MICA, 3.5x speedup of DIAMOND [3,700x BLASTX]), and protein structure search (esFragBag, 10x speedup of FragBag). Our framework can be used to achieve "compressive omics," and the general theory can be readily applied to data science problems outside of biology.
cs.DS
cs
Entropy-scaling search of massive biological data Y. William Yua,b,∗, Noah M. Danielsa,b,∗, David Christian Dankob, Bonnie Bergera,b,∗∗ aDepartment of Mathematics, Massachusetts Institute of Technology, Cambridge, bComputer Science and AI Lab, Massachusetts Institute of Technology, Cambridge, Massachusetts 02139 Massachusetts 02139 Highlights • We describe entropy-scaling search for finding approximate matches in a database • Search complexity is bounded in time and space by the entropy of the database • We make tools that enable search of three largely intractable real-world databases • The tools dramatically accelerate metagenomic, chemical, and protein structure search eTOC Blurb We describe a general framework for efficiently searching massive datasets having certain properties common in biology. Summary Many datasets exhibit a well-defined structure that can be ex- ploited to design faster search tools, but it is not always clear when such acceleration is possible. Here, we introduce a framework for similarity search based on characterizing a dataset's entropy and ∗These authors contributed equally to this work. ∗∗Corresponding author Email address: [email protected] (Bonnie Berger) Cell Systems Volume 1, Issue 2, pages 130-140 arXiv:1503.05638v2 [cs.DS] 21 Sep 2015 fractal dimension. We prove that searching scales in time with metric entropy (number of covering hyperspheres), if the fractal dimension of the dataset is low, and scales in space with the sum of metric entropy and information-theoretic entropy (randomness of the data). Using these ideas, we present accelerated versions of standard tools, with no loss in specificity and little loss in sensi- tivity, for use in three domains -- high-throughput drug screening (Ammolite, 150× speedup), metagenomics (MICA, 3.5× speedup of DIAMOND [3,700× BLASTX]), and protein structure search (esFragBag, 10× speedup of FragBag). Our framework can be used to achieve "compressive omics," and the general theory can be readily applied to data science problems outside of biology. Source code: http://gems.csail.mit.edu Introduction Throughout all areas of data science, researchers are confronted with in- creasingly large volumes of data. In many fields, this increase is exponential in nature, outpacing Moore's and Kryder's laws on the respective doublings of transistors on a chip and long-term data storage density (Kahn, 2011). As such, the challenges posed by the massive influx of data cannot be solved by waiting for faster and larger capacity computers but, instead, require instead the development of data structures and representations that exploit the complex structure of the dataset. Here, we focus on similarity search, where the task at hand is to find all entries in some database that are "similar," or approximate matches, to a query item. Similarity search is a fundamental operation in data science and lies at the heart of many other problems, much like how sorting is a primi- tive operation in computer science. Traditionally, approximate matching has been studied primarily in the context of strings under edit distance metrics (Box 1) (e.g., for a spell-checker to suggest the most similar words to a mis- spelled word) (Ukkonen, 1985). Several approaches, such as the compressed suffix array and the FM-index (Grossi & Vitter, 2005; Ferragina & Manzini, 2000), have been developed to accelerate approximate matching of strings. However, it has been demonstrated that similarity search is also important in problem domains where biological data are not necessarily represented as strings, including computational screening of chemical graphs (Schaeffer, 2007) and searching protein structures (Budowski-Tal et al., 2010). There- fore, approaches that apply to more general conditions are needed. 2 As available data grow exponentially (Berger et al., 2013; Yu et al., 2015) (e.g., genomic data in Figure S1), algorithms that scale linearly (Box 1) with the amount of data no longer suffice. The primary ways in which the literature addresses this problem -- locality sensitive hashing (Indyk & Motwani, 1998), vector approximation (Ferhatosmanoglu et al., 2000), and space partitioning (Weber et al., 1998) -- involve the construction of data structures that support more efficient search operations. However, we note that, as biological data increase, not only does the redundancy present in the data also increase (Loh et al., 2012), but also internal structure (such as the fact that not all conceivable configurations, e.g. all possible protein sequences, actually exist) also becomes apparent. Existing general-purpose methods do not explicitly exploit the particular properties of biological data to accelerate search (see the Theory section in the Supplemental Methods). Previously, our group demonstrated how redundancy in genomic data could be used to accelerate local sequence alignment. Using an approach that we called "compresive genomics," we accelerated BLAST and BLAT (Kent, 2002) by taking advantage of high redundancy between related genomes us- ing link pointers and edit scripts to a database of unique sequences (Loh et al., 2012). We have used similar strategies to obtain equally encouraging results for local alignment in proteomics (Daniels et al., 2013). Empirically, this compressive acceleration appears to scale almost linearly in the entropy of the database, often resulting in orders of magnitude better performance; however, these previous studies neither proved complexity bounds nor es- tablished a theory to explain these empirical speedups. Here, we generalize and formalize this approach by introducing a frame- work for similarity search of omics data. We prove that search performance primarily depends on a measure of the novelty of new data, also known as entropy. This framework, which we call entropy-scaling search, supports the creation of a data structure that provably scales linearly in both time and space with the entropy of the database, and thus sublinearly with the entire database. We introduce two key concepts for characterizing a dataset: metric en- tropy and fractal dimension. Intuitively, metric entropy measures how dis- similar the dataset is from itself, and fractal dimension measures how the number of spheres needed to cover all points in a database scales with the radii of those spheres. Both are rigorously defined later, but note that metric entropy is not to be confused with the notion of a distance metric (Box 1). Using these two concepts, we show that, if similarity is defined by a metric-like distance function (e.g., edit or Hamming distance) and the database exhibits both low metric entropy and fractal dimension, the 3 entropy-scaling search performs much better than nave and even optimized methods. Through three applications to large databases in chemogenomics, metagenomics, and protein structure search, we show that this framework allows for minimal (or even zero) loss in recall, coupled with zero loss in specificity. The key benefit of formulating entropy-scaling search in terms of metric entropy and fractal dimension is that this allows us to provide mathematically rigorous guidance as to how to determine the efficacy of the approach for any dataset. • Edit distance: the number of edits (character insertions, deletions, or substi- tutions) needed to turn one string into another. • Scale, in time and space: the amount of time or space a task takes as a function of the amount of data on which it must operate. A task requiring time directly proportional to the size of the data is said to scale linearly; for example, searching a database takes twice as long if the database grows by a factor of two. • Distance metric: a measure of distance that obeys several mathematical prop- erties, including the triangle inequality. • Covering spheres: a set of spheres around existing points so that every point is contained in at least one sphere and no sphere is empty. • Metric entropy: a measure of how dissimilar a dataset is from itself. Defined as the number of covering spheres. • Fractal dimension: a measure of how the number of points contained within a sphere scales with the radius of that sphere. • Information-theoretic entropy: often used in data compression as shorthand for the number of bits needed to encode a database or a measure of the randomness of that database. • Pattern matching: refers to searching for matches that might differ in specific ways from a query, such as wildcards or gaps, as opposed to searching for all database entries within a sphere of a specified radius as defined by an arbitrary distance function. Box 1: Definitions 4 Figure 1: Entropy-scaling framework for similarity search. (A-D) As shown, (A) The naıve approach tests each query against each database entry to find entries within distance r of the query (inside the small green disc). (B) By selecting appropriate cluster centers with maximum radius rc to par- tition the database, we can (C) first do a coarse search to find all cluster centers within distance r + rc of a query (larger green disc), and then the (D) triangle inequality guarantees that a fine search over all corresponding cluster entries (blue polygonal regions) will suffice. Results Entropy-scaling similarity search The basic framework for the entropy-scaling search of a database involves four steps. (1) Analyze the database to define a high-dimensional space and determine how to map database entries onto points in this space (this mapping may be one-to-one). (2) Use this space and a measure of similarity between points to group entries in the database into clusters. (3) To search for a particular query item, perform a coarse-grained search to identify the clusters that could possibly contain the query. (4) Do a fine-grained search of the points contained within these clusters to find the closest matches to the query (Figure 1). Here, we provide conceptual motivation for this process. In the following text, we consider entropy to be nearly synonymous with distance between points in a high-dimensional space; thus, with low entropy, newly added points do not tend to be far from all existing points. For genomic sequences, the distance function can be edit distance; for chemical graphs, it can be Tanimoto distance; and for general vectors, it can be Euclidean or cosine distance. We are interested in the similarity search problem of finding all points in a set that are close to (i.e., similar to) the query point. Let us first consider what it means for a large biological dataset, consid- ered as points in a high-dimensional space, to be highly redundant. Perhaps many of the points are exact duplicates; this easy scenario is trivially ex- ploited by de-duplication and is already standard practice with datasets such as the NCBI's non-redundant (NR) protein database (Pruitt et al., 2005). Maybe the points mostly live on a low-dimensional subspace; statistical tools such as Principal Component Analysis (PCA) exploit this property in data analysis. Furthermore, if the dimension of the subspace is sufficiently low, it can be divided into cells, allowing quick similarity searches by looking only at nearby cells (Weber et al., 1998). However, when the dimensionality of the subspace increases, cell search time grows exponentially; additionally, in sparse datasets, most of the cells will be empty, which wastes search time. More importantly, biological datasets generally do not live in low-dimensional subspaces. Consider the instructive case of genomes along an evolutionary "tree of life" (Figure 2). Such a tree has many branches (although admixture merges branches back together), and looks nearly one-dimensional locally, but it is globally of higher dimension. Additionally, because of differences due to mutation, each of the branches is also "thick" (high dimensional) when looked at closely. Viewing this example as a low-dimensional sub- space, as in PCA, is incorrect. 6 Figure 2: Cartoon depiction of points in a high-dimensional space. This cartoon depics points in an arbitrary high-dimensional space that live close to a one-dimensional tree-like structure, as might arise from genomes gener- ated by mutation and selection along an evolutionary tree of life. Although high-dimensional at a fine scale, at the coarser scale of covering spheres, the data cloud looks nearly one-dimensional, which enables entropy-scaling of similarity search. The cluster center generation was performed using the same method we used for protein structure search. The blue circles around the green query point illustrate low fractal dimension: the larger-radius cir- cle contains only linearly more points than the smaller one, rather than exponentially more. In contrast, the red circles around the orange query point illustrate higher local fractal dimension. However, the local low-dimensionality can be exploited by looking on the right scales: a coarse scale in which the tree looks one-dimensional locally and a fine scale where the branch width matters. We cover the tree with spheres (Box 1) of radius rc, where rc is on the order of the branch width; these spheres determine our clusters, and the number of them is the metric entropy of the tree (Tao, 2008). Because all the points within a sphere are close to each other, they are highly redundant and can be encoded in terms of one another, saving space. By the triangle inequality, in order to search for all points within distance r of a query, we need only to look in nearby spheres with centers (i.e., representatives) within a distance r + rc of the query (Figure 1D). However, because each sphere has a radius comparable to branch width, the tree is locally one-dimensional on the coarse scale; that is, spheres largely tend to extend along the branches of the tree rather than in all directions. We will call this property of local scaling the fractal dimension d of the tree at the scale rc (Falconer, 1990), where rc is essentially our ruler size and d = 1. Thus, increasing the search radius for coarse search only linearly increases the number of points that need to be searched in a fine search. A similar analysis holds in the more general case where d 6= 1. The entropy-scaling frameworks we introduce can be expected to provide a boost to approximate search when fractal dimension d of a dataset D is low (i.e., close to 1) and metric entropy k is low. Specifically, the ratio D provides k an estimate of the acceleration factor for just the coarse search component compared to a full linear search of a database D. Local fractal dimension around a data point can be computed by determining the number of other data points within two radii r1 and r2 of that point; given those point counts log(n2/n1) log(r2/r1) Sampling this property over a dataset can provide a global average fractal dimension. When we search a larger radius around a query, the number of points we encounter grows exponentially with the fractal dimension; low fractal dimension implies that this growth will not obviate the gains provided by an entropy-scaling data structure. (n1 and n2, respectively), fractal dimension d is simply d = . More formally, given a database with fractal dimension d and metric entropy k at the scale rc, we show in the Supplemental Methods that the time-complexity of similarity search on database D for query q with radius 8 r is O + metric entropy k{z} output size r (cid:19)d BD(q, r)(cid:18) r + 2rc z } {z } scaling factor !. { Thus, for small fractal dimension and output size, similarity search is asymp- totically linear in metric entropy. Additionally, because the search has to look at only a small subset of the clusters, the clusters can be stored in compressed form, and only decompressed as needed, giving space savings that also scale with entropy. The space-complexity scales with the sum of metric and information-theoretic entropy, rather than just metric entropy (Supplemental Methods: Theory). Practical application of entropy-scaling search We have presented the simplest such data to analyze for clarity of ex- position. However, real data is generally messier. Sometimes the distance function is not a metric, so we lose the triangle inequality guarantee of 100% sensitivity; sometimes different distance functions can be used for the clus- tering versus search; and sometimes even what counts as a distinct data point is not entirely clear without domain knowledge (for example, long genomic sequences might be better broken into shorter subsequences). To show that entropy-scaling frameworks are robust to the variations presented by real data, we explored a diversity of applications from three major biological "big challenges of big data" -- pharamaceuticals, metage- nomics, and protein structure (Marx, 2013). We demonstrate that the gen- eral scheme results in order-of-magnitude improvements in running time in these different contexts, promising to enable new workflows for practition- ers (e.g., fast first-pass computational drug screens and local analyses of se- quencing data in remote field sites for real-time epidemic monitoring). These applications are enabled by augmenting the framework with domain-specific distance functions in different stages of the process, as well as preprocessing to take advantage of domain-specific knowledge. We expect that as long as the dataset exhibits both low entropy and low fractal dimension -- and this is empirically true in biological systems -- our entropy-scaling framework has the potential to achieve massive speedup over more naıve methods and sig- nificant speedup even over other highly optimized methods. Source code for the applications discussed here is available at http: //gems.csail.mit.edu and in the Supplemental Information. 9 Application to high-throughput drug screening Chemogenomics is the study of drug and target discovery by using chem- ical compounds to probe and characterize proteomic functions (Bredel & Jacoby, 2004). Particularly in the field of drug discovery and drug repur- posing, prediction of biologically active compounds is a critical task. Com- putational high-throughput screening can eliminate many compounds from wet-lab consideration, but even this screening can be time-consuming. Pub- Chem (Bolton et al., 2008), a widely-used repository of molecular compound structures, has grown greatly since 2008. In July 2007, PubChem contained 10.3 million compounds. In October 2013, PubChem contained roughly 47 million compounds, while in December 2014 it contained 61.3 million com- pounds. We designed this compression and search framework around one of the standard techniques for high-throughput screening of potential drug com- pounds, the use of maximum common subgraph (MCS) to identify simi- lar motifs among molecules (Cao et al., 2008; Rahman et al., 2009). We introduce Ammolite, a method for clustering molecular databases such as PubChem, and for quickly searching for similar molecular structures in com- pressed space. Ammolite demonstrates that entropy-scaling methods can be extended to data types that are not inherently sequence based. Ammolite is a practical tool that provides approximately a factor of 150 speed-up with greater than 92% accuracy compared to the popular small molecular subgraph detector (SMSD) (Rahman et al., 2009). An MCS-based search of molecule databases typically matches pairs of molecules by Tanimoto distance (Rahman et al., 2009). Tanimoto distance obeys the triangle inequality and is more useful in the domain of molecular graphs than other distance metrics such as graph distance (Bunke & Shearer, 1998). To compress a molecule database, we project the space of small molecules onto a subspace by removing nodes and edges that do not participate in sim- ple cycles (Figure S2); note that a molecule without cycles will collapse to a single node. Clusters are exactly pre-images of this projection operator (i.e., all molecules that are isomorphic after simplification form a cluster). Coarse search is performed by finding the MCS on this much smaller pro- jection subspace. This step increases speed by reducing both the required number of MCS operations and the time required for each MCS operation, which scales with the size of the molecule. Further reduction in search time is accomplished by grouping clusters according to size of the molecules within; because Tanimoto distance relies on molecule size, clusters contain- 10 ing molecules significantly larger or smaller then the query need not be searched at all. The time required to cluster a large database such as PubChem is, nonetheless, significant; clustering the 306-GB PubChem required approxi- mately 400 hours on a 12-core Xeon X5690 running at 3.47GHz, and required 128 GB RAM. However, this database can easily be appended to as new molecules become available, and the clustering time can be amortized over future queries. It is worth noting that the preprocessing of molecular graphs can cause the triangle inequality to be violated; while the distance function is a metric, the clustering does not respect that metric. Ammolite can be readily incorporated into existing analysis pipelines for high-throughput drug screening. Our entropy-scaling framework can be applied to PubChem because it has both low fractal dimension and low metric entropy. In particular, we determined the mean local fractal dimension of PubChem to be approx- imately 0.2 in the neighborhood between 0.2 and 0.4 Tanimoto distance, and approximately 1.9 in the neighborhood between 0.4 and 0.5. The ex- pected speedup is measured by the ratio of database size to metric entropy, which, for PubChem is approximately 11:1. This is not taking into account the clustering according to molecule size, which further reduces the search space. Because SMSD is not computationally tractable on the entire PubChem database, we benchmarked Ammolite against SMSD on a subset of 1 mil- lion molecules from PubChem. Since SMSD's running time should scale linearly with the size of the database, we extrapolated the running time of SMSD to the entire PubChem database. Benchmarking Ammolite and SMSD required 60GB RAM and used 12 threads, although Ammolite's search, used normally, requires < 20 GB RAM. For these benchmarks, we used five randomly-chosen query molecules with at least two rings (Pub- Chem IDs 1504670, 19170294, 28250541, 4559889, and 55484477), as well as five medically-interesting molecules chosen by hand (adenosine triphos- phate [atp], clindamycin, erythromycin, teixobactin, and thalidomide). We also used SMSD as a gold standard against which we measured Ammolite's recall. Ammolite achieves an average of 92.5% recall with respect to SMSD (Table 1a). This recall is brought down by one poorly-performing compound, PubChem ID 1504670, with only 62.5% recall, but is otherwise over 80%. Furthermore, Ammolite's speed gains with respect to SMSD grow as the database grows (Table 1b). 11 Table 1: Benchmarks of Ammolite vs. SMSD on databases of (a) 1 million molecules and (b) 47 million molecules (all of PubChem) (a) Ammolite benchmark on database of 1 million molecules PubChem ID 5957 (atp) 446598 (clindamycin) 12560 (erythromycin) 86341926 (teixobactin) 5426 (thalidomide) 1504670 19170294 28250541 4559889 55484477 SMSD (hours) Ammolite (hours) Speedup Recall (%) 4.4 18.7 849.6 618.5 48.9 8.1 31.3 43.3 108.8 23.3 0.14 1.5 3.0 2.3 0.81 0.8 0.8 4.8 2.7 2.5 31 11.7 279.2 265.5 60.4 10.3 39.7 9.0 41.0 9.1 81% 90% 91% 100% 100% 62.5% 100% 100% 100% 100% (b) Ammolite benchmark on entire PubChem database as of October 2013. See also Figure S2. PubChem ID 5957 (atp) 446598 (clindamycin) 12560 (erythromycin) 86341926 (teixobactin) 5426 (thalidomide) 1504670 19170294 28250541 4559889 55484477 Ammolite (hours) Speedup 4.1 28.4 79.1 96.5 29.2 4.6 6.0 38.9 57.3 35.5 51.3 14.5 512.9 305.9 80.0 84.4 247.4 53.2 90.7 31.4 Application to metagenomics Metagenomics is the study of genomic data sequenced directly from envi- ronmental samples. It has led to improved understanding of how ecosystems recover from environmental damage (Tyson et al., 2004) and how the hu- man gut responds to diet and infection (David et al., 2014). Metagenomics has even provided some surprising insights into disorders such as Autism Spectrum Disorder (MacFabe, 2012). BLASTX (Altschul et al., 1990) is widely used in metagenomics to map reads to protein databases such as KEGG (Kanehisa & Goto, 2000) and NCBI's NR (Sayers et al., 2011). This mapping is additionally used as a primitive in pipelines such as MetaPhlAn (Segata et al., 2012), PI- CRUSt (Langille et al., 2013), and MEGAN (Huson et al., 2011) to de- termine the microbial composition of a sequenced sample. Unfortunately, BLASTX's runtime requirements scale linearly with the product of the size of the full read dataset and the targeted protein database, and thus each year require exponentially more runtime to process the exponentially grow- ing read data. These computational challenges are at present a barrier to widespread use of metagenomic data throughout biotechnology, which constrains genomic medicine and environmental genomics (Frank & Pace, 2008). For example, Mackelprang et al. (2011) reported that using BLASTX to map 246 million reads against KEGG required 800,000 CPU hours at a supercomputing center. Although this is already a problem for major research centers, it is es- pecially limiting for on-site analyses in more remote locations. In surveying the 2014 Ebola outbreak, scientists physically shipped samples on dry ice to Harvard for sequencing and analysis (Gire et al., 2014). Even as sequencers become more mobile and can thus be brought on site, lack of fast Internet connections in remote areas can make it impossible to centralize and ex- pedite processing (viz., the cloud); local processing on resource-constrained machines remains essential. Thus, a better-scaling and accurate version of BLASTX raises the possibility of not only faster computing for large re- search centers, but also of performing entirely on-site sequencing and desktop metagenomic analyses. Recently, approaches such as RapSearch2 (Zhao et al., 2012) and Dia- mond (Buchfink et al., 2015) have provided faster alternatives to BLASTX. We have applied our entropy-scaling framework to the problem of metage- nomic search and demonstrate MICA, a method whose software implementa- tion provides an acceleration of DIAMOND by a factor of 3.5, and BLASTX by a factor of up to 3700. This application illustrates the potential of entropy-scaling frameworks, while providing a useful tool for metagenomic 13 research. It can be readily incorporated into existing analysis pipelines (e.g., for microbial composition analysis using MEGAN). MICA clustering of the September 17, 2014 NCBI NR database (containing 49.3 million sequences) required 39 hr on a 12-core Xeon X5690 running at 3.47GHz; it used ap- proximately 84 GB of resident memory. Our entropy-scaling framework can be applied to the NCBI's NR database because it, like PubChem, exhibits low fractal dimension and metric entropy. We determined the mean local fractal dimension of the NCBI's NR database, using sequence identity of alignment as a distance function, to be approx- imately 1.6 in the neighborhood between 70% and 80% protein sequence identity. The ratio of database size to metric entropy, which gives an indi- cator of expected speedup, is approximately 30:1. Indeed, the notion that protein sequence space exhibits structure, and lends itself to clustering, has precedent (Linial et al., 1997). To evaluate the runtime performance of MICA, we tested it against BLASTX, RapSearch2 (Zhao et al., 2012) and Diamond (Buchfink et al., 2015). On five read sets (ERR335622, ERR335625, ERR335631, ERR335635, ERR335636) totalling 207,623 151-nucleotide (nt) reads from the American Gut Microbiome project, we found that MICA provides measurable runtime improvements over DIAMOND with no further loss in accuracy (Table 2a), and substantial runtime improvements over BLASTX. Notably, the mean running time for BLASTX was 58,215 minutes, while MICA took an av- erage of 15.6 minutes, a speedup of 3,724x. MICA uses DIAMOND for its coarse search, and can use either DIAMOND or BLASTX for its fine search. We also evaluated MICA using BLASTX for both the coarse and the fine search; this approach performed slightly slower than DIAMOND, requiring an average of 89 min, though it was somewhat more accurate, at 95.9% recall compared to DIAMOND's 90.4% recall. MICA using BLASTX for both coarse and fine searches relied on a query-side clustering (discussed in Supplemental Methods); we note that the time spent performing query- side clustering is included here; without query-side clustering, this variant of MICA takes 2,278 min, a speedup of 25x over BLASTX. MICA accelerates DIAMOND with no further loss in accuracy: 90.4% compared to unaccelerated BLASTX Table 2b. Experiments validating ac- curacy treated BLASTX as a gold standard. Since MICA accelerates DI- AMOND using entropy-scaling techniques, false positives with respect to DIAMOND are not possible, but false negatives are. We report as accuracy the fraction of BLASTX hits that are also returned by MICA. DIAMOND's clever indexing and alphabet reduction provide excellent runtime performance already, though its running time still scales linearly 14 Table 2: (a) Running time and (b) accuracy of BLASTX, RapSearch2, DIAMOND, and MICA. Data set is the American gut microbiome project read sets ERR335622, ERR335625, ERR335631, ERR335635, ERR335636 (a) Running time in minutes (standard deviation) BLASTX 58215 (1561.8) 206 (5.4) RapSearch2 DIAMOND MICA-DIAMOND MICA-BLASTX 54 (1.1) 15.6 (0.5) 21.9 (1.7) (b) Accuracy against BLASTX (standard deviation) RapSearch2 DIAMOND MICA-DIAMOND MICA-BLASTX 79.5% (1.63) 90.4% (3.10) 90.4% (3.10) 90.4% (3.10) with database size. In contrast, as an entropy-scaling search, MICA will demonstrate greater acceleration as database sizes grow (Daniels et al., 2013). Moreover, MICA can use standard BLASTX for its fine search, which allows the user to pass arbitrary parameters to the underlying BLASTX call but which also comes at a small runtime penalty (40% in our testing). This option allows for additional BLAST arguments that DIAMOND does not support, such as XML output, which may be useful in some pipelines. Thus, MICA with BLASTX may be suitable for a wider variety of existing analysis pipelines. Application to protein structure search The relationship between protein structure and function has been a sub- ject of intense study for decades, and this strong link has been used for the prediction of function from structure (Hegyi & Gerstein, 1999). Specifically, given a protein of solved (or predicted) structure but unknown function, the efficient identification of structurally similar proteins in the Protein Data Bank (PDB) is critical to function prediction. Finding structural neigh- bors can also give insight into the evolutionary origins of proteins of interest (Yona et al., 1999; Nepomnyachiy et al., 2014). One approach to finding structural neighbors is to attempt to align the query protein to all the entries in the PDB using a structural aligner, such as STRUCTAL (Subbiah et al., 1993), ICE (Shindyalov & Bourne, 1998), or Matt (Menke et al., 2008). However, performing a full alignment against ev- ery entry in the PDB is prohibitively expensive, especially as the database grows. To mitigate this, (Budowski-Tal et al., 2010) introduced the tool FragBag, which avoids performing full alignments but rather describes each protein as a "bag of fragments," where each fragment is a small structural motif. FragBag has been reported as comparable to structural aligners such 15 as STRUCTAL or ICE, and its bag-of-fragments approach allows it to per- form comparisons much faster than standard aligners. Importantly for us, the bag of fragments is just a frequency vector, making FragBag amenable to acceleration through entropy-scaling. By first verifying that the local fractal dimension of PDB FragBag fre- quency vectors is low in most regimes (d ≈ 2 − 3), Figure S3), we are given reason to think that this problem is amenable to entropy-scaling search. As an estimate of potential speedup, the ratio of PDB database size to metric entropy at for the chosen cluster radii is on average, ∼10:1. We directly ap- plied our entropy-scaling framework without any additional augmentation: esFragBag (entropy-scaling FragBag) is able to achieve an average factor of 10 speedup of the highly-optimized FragBag with less than 0.2% loss in sensitivity and no loss in specificity. For this last example, we intentionally approach the application of entropy- scaling frameworks to FragBag in a blind manner, without using any domain- specific knowledge. Instead, we use the very same representation (bag of fragments) and distance functions (Euclidean and cosine distances) as Frag- Bag, coupled with a greedy k-centers algorithm to generate the clustered representation. Note that this is in contrast to MICA and Ammolite, which both exploit domain knowledge to further improve performance. Thus, es- FragBag only involves extending an existing codebase with new database generation and similarity search functions. We investigate the increases in speed resulting from directly applying the entropy-scaling framework for both Euclidean and cosine distances and found the acceleration is highly dependent on both the search radius and cluster radius (Figure 3). For cosine distance, we generated databases with maximum cluster radii of 0.1, 0.2, 0.3, 0.4, and 0.5. Then, for each query protein from the set {4rhv, 1ake, 1bmf, 1rbp} (identified by PDB IDs), we ran both naıve and accelerated similarity searches with radii of 0.02i,∀i ∈ {0, . . . , 49}. This test was repeated 5 times for each measurement, and the ratio of average accelerated vs naıve times is shown in Figure 3a. For Euclidean distance, we generated databases with maximum cluster radii of 10, 20, 25, 50, and 100. Again, for each query protein drawn from the same set, we compared the average over five runs of the ratio of average accelerated versus naıve times (Figure 3b). The cluster generation required anywhere from 65 to 23,714 seconds, depending on the choice of radii (See table 3) and no more than a small constant (< 3) times as much memory as it takes to simply load the PDB database (no more than 2 GB RAM). Clustering used 20 threads on a 12-core Xeon X5690, while search used only one thread. 16 Table 3: Cluster generation time for esFragBag (a) Cosine distance: radius time (s) 0.1 0.2 21,037 11,088 0.3 7,409 0.4 5,288 0.5 3,921 (b) Euclidean distance: radius time (s) 10 20 23,714 3,062 30 483 40 144 50 65 Not only is the acceleration highly dependent on both the search radius r and the maximum cluster radius rc, but the choice of query protein also affects the results. We suspect that this effect is due to the geometry of pro- tein fragment frequency space being very "spiky" and "star-like". Proteins that are near the core (and thus similar to many other proteins) show very little acceleration when our framework is used because the majority of the database is nearby, whereas proteins in the periphery have fewer neighbors and are thus found much more quickly. Changing the maximum cluster ra- dius effectively makes more proteins peripheral proteins, but at the cost of overall acceleration. Naturally, as the search radius expands, it quickly becomes necessary to compare against nearly the entire database, destroying any acceleration. For the cosine space in particular, note that the maximum distance between any two points is 1, so once the coarse search radius of r + rc ≥ 1.0, there cannot ever be any acceleration as the fine search encompasses the entire database. Similarly, once the coarse search encompasses all (or nearly all) the clusters in Euclidean space, the acceleration diminishes to a factor 1, and the overhead costs make the entropy-scaling framework perform worse than a naıve search. However, as we are most interested in proteins that are very similar to the query, the low-radius behavior is of primary interest. In the low-radius regime, esFragBag demonstrates varying though substan- tial acceleration (2-30x, averaging >10x for both distance functions for the proteins chosen) over FragBag. It is instructive to note that because of the very different geometries of Euclidean vs cosine space, acceleration varies tremendously for some pro- teins, such as 4rhv and 1bmf, which display nearly opposite behaviors. Whereas there is nearly 30x acceleration for 4rhv in cosine space for low radius, and the same for 1bmf in Euclidean space, neither achieves better than ∼ 2.5x acceleration in the other space. 17 (a) Cosine distance (b) Euclidean distance Figure 3: Scaling behavior of esFragBag. EsFragBag benchmarking data with parameters varied until the acceleration advantage of esFragBag dis- appears. As search radius increases, the fraction of the database returned by the coarse search increases, ultimately returning the whole database. Unsurprisingly, when returning the whole database in the coarse search re- sults, there are no benefits to using entropy-scaling frameworks. (a) Cosine distance gives on the whole better acceleration, but results in > 99.8% sen- sitivity, whereas (b) Euclidean distance as a metric is guaranteed by the Triangle Inequality to get 100% sensitivity. Table 4: Average sensitivity of esFragBag compared to FragBag when using cosine distance for the trials described in Figure 3a. This table averages the sensitivities for each choice of search radii {0, 0.01, . . . , 0.49}. (NB: no analogous table is given for Euclidean distance as the Triangle Inequality ensures perfect recall). Cluster radii Query protein 4rhv 1ake 1bmf 1rbp 0.10 0.20 0.30 0.40 0.50 1 1 1 1 1 0.999840 0.999918 0.999926 0.999974 0.999984 0.998490 0.999001 0.999649 0.999796 0.999934 0.999950 0.999978 1 1 1 Finally, while Euclidean distance is a metric -- for which the triangle inequality guarantees 100% sensitivity -- cosine distance is not. Empirically, however, for all of the queries we performed, we achieve > 99.8% sensitivity (Table 4). Application to other domains We anticipate that our entropy-scaling approach will be useful to other kinds of biological data sets; applying it to new data sets will require sev- eral steps. Here we provide a "cookbook" for applying our entropy-scaling framework to a new data set. Given a new data set, we first define what the high-dimensional space is. For metagenomic sequence data, it is the set of enumerable protein sequences up to some maximum length, while for small-molecule data, it is the set of connected chemical graphs up to some maximum size, and for protein structure data (using the FragBag model) it is the set of "bag-of-words" frequency vectors of length 400. Given the high dimensional space, we determine how database entries map onto points (for example, in the case of MICA, they are greedily broken into subsequences with a minimum length). Next, clustering can be imple- mented; a simple greedy clustering may suffice (as for esFragBag) but clus- tering of sequence data may be dramatically accelerated by using BLAST- style seed-and-extend matching (as used in MICA). Finally, coarse and fine search can be implemented; in many cases, existing tools may be used "out of the box," as with esFragBag and MICA. With MICA, we note that coarse search by default uses DIAMOND, while fine search provides a choice of 19 DIAMOND or BLASTX. With Ammolite, we used the SMSD library, but incorporated it into our own search tool. Discussion We have introduced an entropy-scaling framework for accelerating ap- proximate search, allowing search on large omics datasets to scale, even as those datasets grow exponentially. The primary advance of this framework is that it bounds both time and space as functions of the dataset entropy (albeit using two different notions of entropy: metric entropy bounds time, while information-theoretic entropy bounds space). We proved that run- time scales linearly with the entropy of the database, but we also show (Supplemental Methods: Theory) that under certain additional constraints, this entropy-scaling framework permits a compressed representation on disk. This compression is particularly applicable in the case of metagenomic anal- ysis, where the collection of read data presents a major problem for storage and transfer. Although we did not optimize for on-disk compression in any of our applications, choosing instead to focus on search speed, implementing this compression is feasible using existing software tools and libraries such as Blocked GZip (BZGF); each cluster would be compressed separately on disk. Furthermore, we have justified and demonstrated the effectiveness of this framework in three distinct areas of computational molecular biology, providing the following open-source software: Ammolite for small-molecule structure search, MICA for metagenomic analysis, and esFragBag for protein structure search. All of our software is available under the GNU General Public License, and not only can the tools we are releasing be readily plugged into existing pipelines, but the code and underlying methods can also be easily incorporated into the original software that we are accelerating. The reason for the speedup is the combination of low fractal dimension and low metric entropy. Low fractal dimension ensures that runtime is dominated by metric entropy. The size of the coarse database provides an estimate of metric entropy. Furthermore, we can directly measure the local fractal dimension of the database by sampling points from the database and looking at the scaling behavior of the number of points contained in spheres of increasing radii centered on those sampled points. We have shown that for three domains within biological data science, metric entropy, and fractal dimension are both low. As discussed in the theoretical results, although the data live locally on a low dimension subspace, the data are truly high-dimensional globally. At 20 small scales, biological data often lives on a low-dimensional polytope (Hart et al., 2015). However, omics data are, by nature, comprehensive and include not just one but many such polytopes. Although each polytope can be individually projected onto a subspace using techniques such as PCA, the same projection cannot be used for all the polytopes at once because they live on different low-dimensional subspaces. Furthermore, as is the case with genomes, the low-dimensional polytopes are also often connected (e.g., through evolutionary history). Thus, collections of local projections become unwieldy. By using our clustering approach, we are able to take advantage of the existence of these low-dimensional polytopes for accelerated search without having to explicitly characterize each one. A hierarchical clustering approach, rather than our flat clustering, has the potential to produce further gains (Loh et al., 2012). We have taken the first steps in exploring this idea here; the molecule size clustering in Am- molite can be thought of as an initial version of a multi-level or hierarchical clustering. Entropy-scaling search is related to succinct, compressed, and oppor- tunistic data structures, such as the compressed suffix array, the FM-index, and the sarray (Grossi & Vitter, 2005; Ferragina & Manzini, 2000; Conway & Bromage, 2011). However, these solve the problem of theoretically fast and scalable pattern matching (Box 1), whereas we solve, theoretically and practically, the much more general similarity search problem. An entropy- scaling search tree is also related to a metric ball tree (Uhlmann, 1991), although with different time complexity. Querying a metric ball tree re- quires O(log n) time, assuming the relatively uniform distribution of data points in a metric space. This distribution differs from the non-uniform dis- tribution under which entropy-scaling search behaves well. In future work, we will investigate further acceleration of coarse search by applying a metric ball tree to the cluster representatives themselves; this approach may reduce the coarse search time to O(log k). This step, too, can be thought of as an additional level of clustering. Other metric search trees can also be found in the database literature (Zezula et al., 2006), although, to our knowledge, they have not been ex- plicitly applied to biological data science. The closest analogue to entropy- scaling search trees is the M-tree (Ciaccia et al., 1997, 1998), which resembles a multi-level variation of our entropy-scaling search trees. However, the M- tree time-complexity analysis (Ciaccia et al., 1998) does not have a nice closed form and is more explicitly dependent on the exact distribution of points in the database. By using and combining the concepts of metric en- tropy and fractal dimension for our analysis, we are able to give an easier to 21 understand and more intuitive, if somewhat looser, bound on entropy-scaling search tree complexity. Entropy-scaling frameworks have the advantage of becoming proportion- ately faster and space efficient with the size of the available data. Although the component pieces (e.g., the clustering method chosen) of the framework can be either standard (as in esFragBag) or novel (as in Ammolite), the key point is that these pieces are used in a larger framework to exploit the underlying complex structure of biological systems, enabling massive acceleration by scaling with entropy. We have demonstrated this scaling behavior for common problems drawn from metagenomics, cheminformat- ics, and protein structure search, but the general strategy can be applied directly or with simple domain knowledge to a vast array of other problems faced in data science. We anticipate that entropy-scaling frameworks should be applicable beyond the life sciences, wherever physical or empirical laws have constrained data to a subspace of low entropy and fractal dimension. Methods Ammolite small molecule search Ammolite's clustering approach relies on structural similarity. We aug- mented the entropy-scaling data structure by using a clustering scheme based on molecular structural motifs instead of a distance function. Each molecule is "simplified" by removing nodes and edges that do not participate in simple cycles. Clusters are formed of molecules that are isomorphic after this simplification step. Each cluster can then be represented by a single molecular structure, along with pointers to "difference sets" between that structure and each of the full molecules in the cluster it represents. For both coarse and fine search, we use the Tanimoto distance metric, defined as d(G1, G2) = 1 − mcs(G1, G2) G1 + G2 − mcs(G1, G2) , where mcs refers to the maximum common subgraph of two chemical graphs. The coarse search is performed in compressed space, by searching the coarse database with the goal of identifying possible hits. The query molecule is simplified in exactly the same manner as the molecular database during clustering, and this transformed query graph is matched against the coarse database. To preserve sensitivity, this coarse search is performed with a permissive similarity score. Any possible hits -- molecular graphs from the coarse database whose MCS to the transformed query molecule was within 22 the similarity score threshold -- are then reconstructed by following point- ers to the removed atom and bond information and recreating the original molecules. Since the Tanimoto distance is used, we can bound the size of candidate molecules based on the size of the query molecule and the desired Tanimoto cutoff. Thus, a second level of clustering, at query time, based on molecule size, allows further gains in runtime performance. Finally, the fine search is performed against these decompressed possible hits that are within the appropriate size range based on the Tanimoto distance cutoff. MICA metagenomic search CaBLASTX's clustering approach relies on sequence similarity. We aug- mented the entropy-scaling data structure by using different distance func- tions for clustering and search. For clustering, we rely on sequence identity, while for search, we use the E-value measure that is standard for BLAST. All benchmarks were performed with an E-value of 10−7. For coarse search, MICA uses the DIAMOND argument --top 60 in order to return all queries with a score within 60% of the top hit. When MICA was tested using BLASTX for coarse search, it used an E-value of 1000. This seemingly sur- prisingly large coarse E-value is used because E-values are poorly behaved for short sequences; in sensitivity analysis, coarse E-values of 1 and 10 ex- hibited recall below 10%, and an E-value of 100 exhibited recall below 60%. Furthermore, during clustering (compression), we apply a preprocessing step that identifies subsequences to be treated as distinct points in the database. We apply a reversible alphabet reduction to the protein sequences, which projects them into a subspace (Supplemental Methods). When applied to high-coverage next-generation sequencing queries, ca- BLASTX can also perform clustering on the reads (Supplemental Methods). In this instance, coarse search is performed by matching each representa- tive query with a set of representative database entries. Fine search then matches the original queries within each cluster with the candidate database entries resulting from the coarse search. esFragBag protein structure search In FragBag, the bag of fragments is essentially a term frequency vector representing the number of occurrences of each structural motif within the protein. FragBag turns out to be amenable to acceleration using an entropy- scaling data structure because much of the computation is spent in doing a similarity search on that frequency vector. For the cluster generation, we trivially used a naıve randomized greedy 2-pass approach. First, all proteins in the Protein Data Bank were randomly 23 ordered. Then in the first pass, proteins were selected as cluster centers if and only if they were not within a user-specified Euclidean distance rc from an existing center (i.e., the first protein is always selected, and the second if further away than rc from the first, etc.). Recall that this generation of cluster centers is the same as the one used to generate covering spheres in Figure 2; the covering spheres were overlapping, but we assign every protein uniquely to a single cluster by assigning to the nearest cluster center in the second pass. Similarity search here was performed exactly as described in the sec- tion "Entropy-Scaling Similarity Search", with no modification. For a given search query q and search radius r, a coarse search was used to find all clus- ter centers within distance r + rc of q. Then, all corresponding clusters were unioned into a set F . Finally, a fine search was performed over the set F to find all proteins within distance r of q. Author Contributions Y.W.Y., N.M.D., and B.B. conceived the project. Y.W.Y., N.M.D., and B.B. developed the theoretical analyses. N.M.D. and D.C.D. imple- mented and benchmarked MICA. D.C.D. implemented and benchmarked Ammolite, with help from N.M.D. and Y.W.Y. Y.W.Y. implemented and benchmarked esFragBag, with help from N.M.D. B.B. guided all research and provided critical advice on the study. Y.W.Y., N.M.D. and B.B. wrote the manuscript. Acknowledgments Y.W.Y. is supported by a Hertz Foundation fellowship. N.M.D. and B.B. are supported by NIH GM108348. We thank Andrew Gallant for his implementation of Fragbag. We thank Joseph V. Barrile for graphic design. We thank Jian Peng for suggesting high-throughput drug screening as an application. References Altschul, S. F., Gish, W., Miller, W., Myers, E. W., & Lipman, D. J. (1990). Basic local alignment search tool. Journal of molecular biology, 215, 403 -- 410. 24 Berger, B., Peng, J., & Singh, M. (2013). Computational solutions for omics data. Nature Reviews Genetics, 14, 333 -- 346. Bolton, E. E., Wang, Y., Thiessen, P. A., & Bryant, S. H. (2008). Pubchem: integrated platform of small molecules and biological activities. Annual reports in computational chemistry, 4, 217 -- 241. Bredel, M., & Jacoby, E. (2004). Chemogenomics: an emerging strategy for rapid target and drug discovery. Nature Reviews Genetics, 5, 262 -- 275. Buchfink, B., Xie, C., & Huson, D. H. (2015). Fast and sensitive protein alignment using DIAMOND. Nature methods, 12, 59 -- 60. Budowski-Tal, I., Nov, Y., & Kolodny, R. (2010). FragBag, an accurate representation of protein structure, retrieves structural neighbors from the entire PDB quickly and accurately. Proceedings of the National Academy of Sciences, 107, 3481 -- 3486. Bunke, H., & Shearer, K. (1998). A graph distance metric based on the maximal common subgraph. Pattern recognition letters, 19, 255 -- 259. Cao, Y., Jiang, T., & Girke, T. (2008). A maximum common substructure- based algorithm for searching and predicting drug-like compounds. Bioin- formatics, 24, i366 -- i374. Ciaccia, P., Patella, M., & Zezula, P. (1997). Deis-csite-cnr. In Proceedings of the... International Conference on Very Large Data Bases (p. 426). Morgan Kaufmann Pub volume 23. Ciaccia, P., Patella, M., & Zezula, P. (1998). A cost model for similarity queries in metric spaces. In Proceedings of the seventeenth ACM SIGACT- SIGMOD-SIGART symposium on Principles of database systems (pp. 59 -- 68). ACM. Conway, T. C., & Bromage, A. J. (2011). Succinct data structures for assembling large genomes. Bioinformatics, 27, 479 -- 486. Daniels, N. M., Gallant, A., Peng, J., Cowen, L. J., Baym, M., & Berger, B. (2013). Compressive genomics for protein databases. Bioinformatics, 29, i283 -- i290. David, L. A., Materna, A. C., Friedman, J., Campos-Baptista, M. I., Black- burn, M. C., Perrotta, A., Erdman, S. E., & Alm, E. J. (2014). Host lifestyle affects human microbiota on daily timescales. Genome Biol, 15, R8. 25 Falconer, K. (1990). Fractal geometry: mathematical foundations and appli- cations. John Wiley & Sons. Ferhatosmanoglu, H., Tuncel, E., Agrawal, D., & El Abbadi, A. (2000). Vec- tor approximation based indexing for non-uniform high dimensional data sets. In Proceedings of the ninth international conference on Information and knowledge management (pp. 202 -- 209). ACM. Ferragina, P., & Manzini, G. (2000). Opportunistic data structures with In Foundations of Computer Science, 2000. Proceedings. applications. 41st Annual Symposium on (pp. 390 -- 398). IEEE. Frank, D. N., & Pace, N. R. (2008). Gastrointestinal microbiology enters the metagenomics era. Current opinion in gastroenterology, 24, 4 -- 10. Gire, S. K., Goba, A., Andersen, K. G., Sealfon, R. S., Park, D. J., Kanneh, L., Jalloh, S., Momoh, M., Fullah, M., Dudas, G. et al. (2014). Genomic surveillance elucidates ebola virus origin and transmission during the 2014 outbreak. Science, 345, 1369 -- 1372. Grossi, R., & Vitter, J. S. (2005). Compressed suffix arrays and suffix trees with applications to text indexing and string matching. SIAM Journal on Computing, 35, 378 -- 407. Hart, Y., Sheftel, H., Hausser, J., Szekely, P., Ben-Moshe, N. B., Korem, Y., Tendler, A., Mayo, A. E., & Alon, U. (2015). Inferring biological tasks using pareto analysis of high-dimensional data. Nature methods, 12, 233 -- 235. Hegyi, H., & Gerstein, M. (1999). The relationship between protein struc- ture and function: a comprehensive survey with application to the yeast genome. Journal of molecular biology, 288, 147 -- 164. Huson, D. H., Mitra, S., Ruscheweyh, H.-J., Weber, N., & Schuster, S. C. Integrative analysis of environmental sequences using megan4. (2011). Genome research, 21, 1552 -- 1560. Indyk, P., & Motwani, R. (1998). Approximate nearest neighbors: towards removing the curse of dimensionality. In Proceedings of the thirtieth annual ACM symposium on Theory of computing (pp. 604 -- 613). ACM. Kahn, S. D. (2011). On the future of genomic data. Science(Washington), 331, 728 -- 729. 26 Kanehisa, M., & Goto, S. (2000). KEGG: kyoto encyclopedia of genes and genomes. Nucleic acids research, 28, 27 -- 30. Kent, W. J. (2002). BLAT-the BLAST-like alignment tool. Genome re- search, 12, 656 -- 664. Langille, M. G., Zaneveld, J., Caporaso, J. G., McDonald, D., Knights, D., Reyes, J. A., Clemente, J. C., Burkepile, D. E., Thurber, R. L. V., Knight, R., & Huttenhower, C. (2013). Predictive functional profiling of microbial communities using 16S rRNA marker gene sequences. Nature biotechnology, 31, 814 -- 821. Linial, M., Linial, N., Tishby, N., & Yona, G. (1997). Global self- organization of all known protein sequences reveals inherent biological signatures. Journal of molecular biology, 268, 539 -- 556. Loh, P.-R., Baym, M., & Berger, B. (2012). Compressive genomics. Nature biotechnology, 30, 627 -- 630. MacFabe, D. F. (2012). Short-chain fatty acid fermentation products of the implications in autism spectrum disorders. Microbial gut microbiome: ecology in health and disease, 23. Mackelprang, R., Waldrop, M. P., DeAngelis, K. M., David, M. M., Chavar- ria, K. L., Blazewicz, S. J., Rubin, E. M., & Jansson, J. K. (2011). Metage- nomic analysis of a permafrost microbial community reveals a rapid re- sponse to thaw. Nature, 480, 368 -- 371. Marx, V. (2013). Biology: The big challenges of big data. Nature, 498, 255 -- 260. Menke, M., Berger, B., & Cowen, L. (2008). Matt: local flexibility aids protein multiple structure alignment. PLoS computational biology, 4, e10. Nepomnyachiy, S., Ben-Tal, N., & Kolodny, R. (2014). Global view of the protein universe. Proceedings of the National Academy of Sciences, 111, 11691 -- 11696. Pruitt, K. D., Tatusova, T., & Maglott, D. R. (2005). NCBI reference se- quence (RefSeq): a curated non-redundant sequence database of genomes, transcripts and proteins. Nucleic acids research, 33, D501 -- D504. 27 Rahman, S. A., Bashton, M., Holliday, G. L., Schrader, R., & Thornton, J. M. (2009). Small molecule subgraph detector (SMSD) toolkit. Journal of Cheminformatics, 1, 1 -- 13. Sayers, E. W., Barrett, T., Benson, D. A., Bolton, E., Bryant, S. H., Canese, K., Chetvernin, V., Church, D. M., DiCuccio, M., Federhen, S. et al. (2011). Database resources of the national center for biotechnology infor- mation. Nucleic acids research, 39, D38 -- D51. Schaeffer, S. E. (2007). Graph clustering. Computer Science Review, 1, 27 -- 64. Segata, N., Waldron, L., Ballarini, A., Narasimhan, V., Jousson, O., & Hut- tenhower, C. (2012). Metagenomic microbial community profiling using unique clade-specific marker genes. Nature methods, 9, 811 -- 814. Shindyalov, I. N., & Bourne, P. E. (1998). Protein structure alignment by incremental combinatorial extension (CE) of the optimal path. Protein engineering, 11, 739 -- 747. Subbiah, S., Laurents, D., & Levitt, M. (1993). Structural similarity of DNA-binding domains of bacteriophage repressors and the globin core. Current Biology, 3, 141 -- 148. Tao, T. (2008). Product set estimates for non-commutative groups. Com- binatorica, 28, 547 -- 594. Tyson, G. W., Chapman, J., Hugenholtz, P., Allen, E. E., Ram, R. J., Richardson, P. M., Solovyev, V. V., Rubin, E. M., Rokhsar, D. S., & Banfield, J. F. (2004). Community structure and metabolism through reconstruction of microbial genomes from the environment. Nature, 428, 37 -- 43. Uhlmann, J. K. (1991). Satisfying general proximity/similarity queries with metric trees. Information processing letters, 40, 175 -- 179. Ukkonen, E. (1985). Algorithms for approximate string matching. Informa- tion and control, 64, 100 -- 118. Weber, R., Schek, H.-J., & Blott, S. (1998). A quantitative analysis and per- formance study for similarity-search methods in high-dimensional spaces. In VLDB (pp. 194 -- 205). volume 98. 28 Yona, G., Linial, N., & Linial, M. (1999). Protomap: automatic classification of protein sequences, a hierarchy of protein families, and local maps of the protein space. Proteins: Structure, Function, and Bioinformatics, 37, 360 -- 378. Yu, Y. W., Yorukoglu, D., Peng, J., & Berger, B. (2015). Quality score compression improves genotyping accuracy. Nature Biotechnology, 33, 240 -- 243. Zezula, P., Amato, G., Dohnal, V., & Batko, M. (2006). Similarity search: the metric space approach volume 32. Springer Science & Business Media. Zhao, Y., Tang, H., & Ye, Y. (2012). RAPSearch2: a fast and memory- efficient protein similarity search tool for next-generation sequencing data. Bioinformatics, 28, 125 -- 126. 29 Supplemental Methods Theory Time-complexity We introduced the definition of the entropy-scaling similarity search data structure in Figure 1. For ease of analysis, we will work in a high-dimensional metric space and consider the database as a set D of n unique points in that metric space. Define BS(q, r) = {p ∈ S : q − p < r}. The similarity search problem is thus to compute BD(q, r) for a query q and radius r. Note however that the metricity requirement is needed only for a 100% sensitivity guarantee; other distance functions can be used, but result in some loss in sensitivity. However, regardless of the distance function chosen, there cannot be a loss of specificity; false positives will never be introduced because the fine search is just the original search function on a smaller subset of the database. A set C of k cluster centers are chosen such that no cluster has radius greater than a user-specified parameter rc and no two cluster centers are within distance rc of one another. The data structure then clusters the points in the set by assigning them to their nearest cluster center. Overloading notation a bit, we will identify each cluster with its center, so C is also the set of clusters. For a given similarity search query for all items within distance r of a query q, this data structure breaks the query into coarse and fine search stages. The coarse search is over the list of cluster centers, returning BC(q, r + rc). Let F = [c∈BC (q,r+rc) c, the union of all the returned clusters. By the Triangle Inequality, BD(q, r) ⊆ F , which combined with F ⊆ D implies that BF (q, r) = BD(q, r). Thus, a fine search over the set F will return all items within radius r of q. Note that we require the metricity requirement only for the Triangle Inequality. It turns out that many interesting distance functions are not metrics, but still almost satisfy the Triangle Inequality, which is nearly suf- ficient. More precisely, if a fraction α of the triples in S do not satisfy the Triangle Inequality, then in expectation, we will have sensitivity 1 − α. As shown in the results, empirically, this loss in sensitivity appears to be low and can likely be ameliorated by increasing the coarse search radius. Provided the fractal dimension of the database is low, and given a few technical assumptions on the distribution of points, this data structure al- S1 arXiv:1503.05638v2 [cs.DS] 21 Sep 2015 lows for similarity search queries in time roughly linear in the metric en- tropy of the database. Additionally, without increasing the asymptotic time-complexity, this data structure can also be stored in an information theoretic entropy-compressed form. Note that entropy-scaling data structures are distinct from both succinct data structures and compressed data structures. Succinct data structures are ones that use space close to the information-theoretic limit in the worst case while permitting efficient queries; i.e. succinct data structures do not depend on the actual entropy of the underlying data set, but have size- dependence on the potential worst-case entropy of the data set (Jacobson, 1988). Compressed (and opportunistic) data structures, on the other hand, bound the amount of the space used by the entropy of the data set while per- mitting efficient queries (Grossi & Vitter, 2005; Ferragina & Manzini, 2000). Entropy-scaling data structures are compressed data structures, but are dis- tinct, as unlike entropy-scaling data structures, compressed data structures do not measure time-complexity in terms of metric entropy. Additionally, existing compressed data structures such as the compressed suffix array and the FM-index are designed for the problem of pattern matching (Grossi & Vitter, 2005; Ferragina & Manzini, 2000). While related to similarity search, pattern matching does not admit as general of a notion of distance as the similarity search problem. While compressed sensing has also been applied to the problem of finding a representative set of genes for a collection of expression samples (Prat et al., 2011), compressed sensing is distinct from entropy-scaling data structures. The primary advance of entropy-scaling data structures is that they bound both space and time as functions of the data set en- tropy (albeit using two different notions of entropy). Unifying different notions of fractal dimension In this paper, we make use of two different notions of fractal dimension, including the more intuitive formulation in the main paper and a more classical definition in this following section. In order to both unify these different notions of fractal dimension and to allow us to prove our complexity bounds, we make a technical assumption about the self-similarity of the data set. Roughly speaking, we require that the density of points be similar throughout the data set. More precisely, for a given radius, consider the number of neighbors about any point for that radius, which we will call the density around a point. We assume that for any given radius, the densities around all points are bounded within a constant multiplicative factor γ of one another. This S2 particular technical assumption is likely stronger than we need, but makes the following arguments much more convenient; we conjecture but do not prove here that so long as the distribution of densities has low variance, all our statements below also hold with high probability. We give special thanks to one of our commenters for having brought this subtlety to our attention. Complexity bounds We first define the concept of metric entropy and entropy dimension in the classical manner: Definition 1 ((Tao, 2008) Definition 6.1). Let X be a metric space, let D be a subset of X, and let ρ > 0 be a radius. • The metric entropy Nρ(D) is the fewest number of points x1, . . . , xn ∈ D such that the balls B(x1, ρ), . . . B(xn, ρ) cover D. Definition 2 ((Falconer, 1990)). The Hausdorff dimension of a set D is given by dimHausdorff(D) := lim ρ→0 log Nρ(D) log 1/ρ Unfortunately, as D is a finite, discrete, set, the given definision always gives dimHausdorff(D) = 0. However, we are only interested in scaling behav- iors around large radii, so instead we use: Definition 3. Define fractal dimension d of a set D at a scale [ρ1, ρ2] by log Nρ(D) Nρ1 (D) log ρ1 ρ  Intuitively, this means that when we double the radii, the metric entropy, or number of covering spheres needed, decreases by a multiplicative factor of 2d. This definition of fractal dimension is classical, but the reader will note also different in formulation from the intuitive one given in the main text. However, the two notions are related given the bounded density assumption we made, from which immediately follows a bound on the number of points within each cluster. On average, when we double the radius of a sphere around a point, the number of points in the larger sphere is roughly the number of points in the smaller sphere multiplied by 2d, because otherwise the spheres could not cover the space. This latter behavior is what we measure when we talk about local fractal dimension around a point in the d = max ρ∈[ρ1,ρ2] S3 main paper. However, because the number of points within each cluster must remain within a multiplicative constant of each other by the bounded density assumption, not only is this true on average, but the increase in number of points within a cluster has to be roughly uniform across all clusters. Thus, this scaling behavior of points in a doubled sphere must be true everywhere in the data set, and thus we can connect the global average local fractal dimension alluded to in the main paper and measured for our data sets of interest to this more classical notion of fractal dimension based on covering spheres. Recall that k entries are selected as cluster centers for partitioning the database to result in clusters with maximum radius rc. From the definition above, when setting ρ = rc, it is trivial to verify k ≤ Nrc(D). This upper bound is guaranteed by our requirement that the cluster centers not be within distance rc. Given any query q, the coarse search over the cluster centers always requires k comparisons. Additionally, the fine search is over the set F , defined to be the union of clusters with centers within distance r + rc from q. As the time-complexity of similarity search is just the total of the coarse and fine searches, this implies that the total search time is O(k + F). By the triangle inequality, F ⊂ BD(q, r + 2rc), so we can bound F ≤ BD(q, r + 2rc). Let the fractal dimension D at the scale between rc and 2rc + r be d. Recall that the local fractal dimension determines how many more points we hit when we scale the radius of a sphere. Also, we use the density bound to give us that BD(p, ρ) ≤ Eq BD(q, ρ) ≤ γ BD(p, ρ) 1 γ for any choice of point p and radius ρ. Then Eq [BD(q, r + 2rc)] ≤ γ BD(p, r + 2rc) ≤ γ BD(p, r)(cid:18) r + 2rc r (cid:19)d ≤ γ2Eq [BD(q, r)](cid:18) r + 2rc r (cid:19)d , (1) (2) (3) because we are measuring the relative number of points found in spheres of radius r vs radius r + 2rc respectively for some particular point p. But γ is a constant, and disappears in asymptotic notation. Thus, total search time S4 is in expectation over points q O k + BD(q, r)(cid:18) r + 2rc r (cid:19)d! . However, note that k is linear in metric entropy and BD(q, r) is the output size, so similarity search can be performed in time linear to metric entropy and a polynomial factor of output size. Provided that the fractal dimension d is small and k is large, the search time will be dominated by the metric entropy component, which turns out to be the regime of greatest interest for us. We have thus proven bounds for the time-complexity of similarity search, given a self-similarity condition on the density of the dataset. Space-complexity Here we relate the space-complexity of our entropy-scaling similarity search data structure to information-theoretic entropy. Traditionally, information- theoretic entropy is a measure of the uncertainty of a distribution or random variable and is not well-defined for a finite database. However, the notion of information-theoretic entropy is often used in data compression as a short- hand for the number of bits needed to encode the database, or a measure of the randomness of that database. We use entropy in the former sense; precisely, we define the entropy of a database as the number of bits needed to encode that database, a standard practice in the field. Thus, we consider entropy-compressed forms of the original database, such as that obtained by Prediction by Partial Matching (PPM), Lempel-Ziv compression (e.g. Gzip), or a Burrows-Wheeler Transform (as in Bzip2), and use their size as an estimate of the entropy Sorig of the database. For all commonly used compression techniques, decompression time is linear in the size of the uncompressed data. Obviously, even with linear decompression, decompressing the entire database for each similarity search would squander the entropy-scaling benefits of our approach. However, note that the fine search detailed above only needs access to a subset of clusters and furthermore needs full access to that set of clusters. It is therefore always asymptotically 'free' to decompress an entire cluster at once, if any member of that cluster needs to accessed. Thus, one ready solution is to simply store entropy-compressed forms of each cluster separately. Compressing each cluster separately preserves runtime bounds, but makes it difficult to compare the compressed clustered database size to the original compressed database size. This results from the possibility that redundancy across clusters that would originally have been exploited by the compressor S5 can no longer be exploited once the database is partitioned. Intuitively, for any fixed-window or block compressor, grouping together similar items into clusters should increase the performance of the compressor, but it is unclear a priori if that balances out the loss of redundancy across clusters. A somewhat more sophisticated solution is to reorder the entries of the database by cluster, compress the entire database, and then store indexes into the starting offset of each cluster. For popular tools such as Gzip or Bzip2, this is possible with constant overhead κ per index. Because the entire database is still being compressed, redundancy across clusters can be exploited to reduce compressed size, while still taking advantage of similar items being grouped together. Thus, in expectation over uniformly- randomly chosen orderings of the database entries (obviously, there is some optimal ordering, but computing that is computationally infeasible), the compressed clustered database size Sclust ≤ Sorig. Then, total expected space-complexity of our data structure is O(κk + Sorig); recall here that k is the number of clusters and is bounded by the metric entropy of the database. Thus, space complexity is linear in metric entropy plus information-theoretic entropy. Additionally, given that our distance function measures marginal information- theoretic entropies, we can also give a bound on the total information- theoretic entropy of the database by using metric entropy and the cluster radius. Let l be the maximum distance of two points in the space. The naıve upper bound on total entropy is then O(nl), where n is the total number of points in the database, because distance and entropy are re- lated. Recall that we chose k points as cluster centers, where k is bounded by metric entropy, for a maximum cluster radius rc. Encoding each non- center point p as a function of the nearest cluster center requires O(nrc) bits. Specifying the privileged points again requires O(kl) bits, so together the total information-theoretic entropy is O(kl + nrc). In other words, not only is space complexity linear in metric entropy plus information-theoretic entropy, but information-theoretic entropy itself is also bounded by the low- dimensional coarse structure of the database. Clustering time complexity Although clustering the database is a one-time cost that can further be amortized over future queries, we still require that cluster generation be tractable. Here we present a trivial O(kn) algorithm for cluster generation with clusters of maximum radius rc that appears to work sufficiently well in practice (and is the algorithm used in esFragBag): S6 • Initialize an empty set of cluster centers C. Let δ(x, C) be the distance from a point x to C, defined to be ∞ if C = ∅. • Randomly order the n entries of the database D = {d1, . . . , dn} • For i = 1, . . . n, -- If δ(di, C) > rc, append di to C. • For i = 1, . . . n, -- Assign di to the cluster represented by the nearest item in C. Because we need to compare each of n items against up to k items in C in each of the for loops, this trivial algorithm takes O(kn) time. Additionally, insertions can be performed in O(k) time. For a new entry dn+1, if δ(dn+1, C) ≤ rc, assign dn+1 to the cluster represented by the nearest item in C. Otherwise, append dn+1 to C as a new cluster center. This clearly requires exactly k comparisons to do. Note that with insertions of this kind, items are no longer guaranteed to be assigned to the nearest cluster center; however, they are still guaranteed to be assigned to some cluster center within distance rc, which is all that is needed for entropy-scaling to work. Deletions are slightly more complicated. If the entry to be deleted is not a cluster center, then removing it takes constant time. However, if it is a cluster center, we effectively have to remove the entire cluster and reinsert all the non-center elements, which will take O(k · [size of cluster]). Thus, in expectation over a uniform random choice of item to be deleted, deletions can also be performed in O(k) time. Ammolite Simplification and compression Given a molecular graph, any vertex or edge that is not part of a simple cycle or a tree is removed, and any edge that is part of a tree is removed. This preserves the node count, but not the topology, of tree-like structures, and preserves simple cycles, which represent rings in chemical compounds. For example, as shown in Figure S2, both caffeine and adenine would be reduced to a purine-like graph. After this transformation is applied to each molecule in a database to be compressed, we identify all clusters of fully-isomorphic transformed molec- ular graphs. Isomorphism detection is performed using the VF2 (Cordella et al., 2001) algorithm; a simple hash computed from the number of ver- tices and edges in each transformed molecular graph is first used to filter S7 molecular graphs that cannot possibly be isomorphic. A representative from each such cluster is stored in SDF format; collectively, these representatives form a "coarse" database. Along with each representative, we preserve the information necessary to reconstruct each original molecule, as a pointer to a set of vertices and edges that have been removed or unlabeled. Ammolite is implemented in Java, and its source code is available on Github. MICA Alphabet Reduction Alphabet reduction -- reducing the 20-letter standard amino acid alpha- bet to a smaller set, in order to accelerate search or improve homology detection -- has been proposed and implemented several times (Bacardit et al., 2007; Peterson et al., 2009). In particular, Murphy et al. (2000) considered reducing the amino-acid alphabet to 17, 10, or even 4 letters. More recently, Zhao et al. (2012) and Huson & Xie (2013) applied a reduction to a 4-letter alphabet, termed a "pseudoDNA" alphabet, in sequence alignment. When using BLASTX for coarse search (which we call caBLASTX), we extend the compression approach of Daniels et al. (2013) using a reversible alphabet reduction. We use the alphabet reduction of Murphy et al. (2000) to map the standard amino acid alphabet (along with the four common ambiguous letters ) onto a 4-letter alphabet. Specifically, we map F, W, and Y into one cluster; C, I, L, M, V, and J into a second cluster, A, G, P, S, and T into a third cluster, and D, E, N, Q, K, R, H, B, and Z into a fourth cluster. By storing the offset of the original letter within each cluster, the original sequence can be reconstructed, making this a reversible reduction. This alphabet reduction is not used when using DIAMOND for coarse search, as DIAMOND already relies on its own alphabet reduction. Database Compression Given a protein sequence database to be compressed, we proceed as follows: 1. First, initialize a table of all possible k-mer seeds of our (possibly 4- letter reduced) alphabet, as well as a coarse database of sequences, initially containing the (possibly reduced-alphabet) first sequence in the input database. 2. For each k-mer of the first sequence, store its position in the corre- sponding entry in the seed table. S8 4. 3. For each subsequent sequence s in the input, reduce its alphabet and slide a window of length k along the sequence, skipping single-letter repeats of length greater than 10. (a) Look up these k residues in the seed table. For every entry match- ing to that k-mer in the seed table, follow it to a corresponding subsequence in the coarse database and attempt extension (de- fined below). If no subsequences from this window can be ex- tended, move the window by m positions, where m defaults to 20. (b) If a match was found via extension, move the k-mer window to the first k-mer in s after the match, and repeat the extension process. Given a k-mer in common between sequence s and a subsequence s0 pointed to by the seed table, first attempt ungapped extension: 1. Within each window of length m beginning with a k-mer match, if there are at least 60% matches between s and s0, then there is an ungapped match. 2. Continue ungapped matching using m-mer windows until no more m- mers of at least 60% sequence identity are found. 3. The result of ungapped extension is that there is an alignment between s and s0 where the only differences are substitutions, at least 60% of the positions contain exact matches. When ungapped extension terminates, attempt gapped extension. From the end of the aligned regions thus far, align 25-mer windows of both s and s0 using the Needleman-Wunsch (Needleman & Wunsch, 1970) algorithm using an identity matrix. Note that the original caBLASTP (Daniels et al., 2013) used BLOSUM62 as it was operating in amino acid space; as we are now operating in a reduced-alphabet space, an identity matrix is appropriate, just as it is for nucleotide space. After gapped extension on a window length of 25, attempt ungapped extension again. If neither gapped nor ungapped extension can continue, end the exten- sion phase. If the resulting alignment has less than 70% sequence identity (in the reduced-alphabet space), or is shorter than 40 residues, discard it, and attempt extension on the next entry in the seed table for the original k-mer, continuing on to the next k-mer if there are no more entries. If the resulting alignment does have at least 70% sequence identity in the reduced-alphabet space, and is at least 40 residues long, then create a link from the entry for s0 in the coarse database to the subsequence of s S9 corresponding to the alignment. If there are unaligned ends of s shorter than 30 residues, append them to the match. Longer unaligned ends that did not match any subsequences reachable from the seed table are added into the coarse database themselves, following the same k-mer indexing procedure as the first sequence. Finally, in order to be able to recover the original sequence with its original amino acid identities, a difference script is associated with each link. This difference script is a representation of the insertions, deletions, and substitutions resulting from the Needleman-Wunsch alignment, along with (if alphabet reduction is used) the offset in each reduced-alphabet cluster needed to recover the original alphabet. Thus, for example, a valine (V) is in the cluster containing C, I, L, M, V, and J. Since it is the 4th entry in that 5-entry cluster, we can represent it with the offset 4. Since the largest cluster contains 9 elements, only four bits are needed to store one entry in the difference script. More balanced clusters would have allowed 3-bit storage, but at the expense of clusters that less faithfully represented the BLOSUM62 matrix and the physicochemical properties of the constituent amino acids. Because of the seed table, compression is memory-intensive and CPU- intensive. Compressing the September, 2014 NCBI NR database required approximately 39 hours on a 12-core Xeon with 128GB RAM. Query Clustering Metagenomic reads are themselves nucleotide sequences, so no alphabet reduction is performed on them directly. When BLASTX is used for coarse search (caBLASTX), MICA relies on query-side clustering. Metagenomic reads are compressed using the same approach as the protein database, without the alphabet reduction step and with a number of different parame- ters. The difference scripts for metagenomic reads do not rely on the cluster offsets, but simply store the substituted nucleotides. Furthermore, unlike protein databases, where most typical sequences range in length from 100 to over 1000 amino acids, next-generation sequenc- ing reads are typically short and usually of fixed length, which is known in advance. Thus, the minimum alignment length required for a match, and the maximum length unaligned fragment to append to a match, require different values based on the read length. An additional complication is that insertions and deletions from one read to another will change the reading frame, potentially resulting in different amino acid sequences. For this reason, query clustering requires long, un- gapped windows of high sequence identity. Specifically, for 202-nucleotide S10 reads, for two sequences to cluster together, we require a 150-nucleotide ungapped region of at least 80% sequence identity. We note that unlike the compression of the database, which can be amor- tized over future queries, the time spent clustering and compressing the queries cannot be amortized. Thus, we would not refer to the query clus- tering as entropy-scaling, but it still provides a constant speed-up. For this reason, we include the time spent clustering and compressing queries in the search time for MICA. When using DIAMOND for coarse search, MICA does not perform query-side clustering, and instead relies on DIAMOND's indexing of the queries. Search Given a compressed protein database and a compressed query read set, search comprises two phases. The first, coarse search, considers only the coarse sequences -- the representatives -- resulting from compression of the protein database and the query set. When BLASTX is used for the coarse search (caBLASTX), each coarse nucleotide read is transformed into each of the six possible amino acid sequences that could result from it (three reading frames for both the sequence and its reverse complement). Then, each of these amino acid sequences is then reduced back to a four-letter alphabet using the same mapping as for protein database compression. For conve- nience, the four-letter alphabet is represented using the standard nucleotide bases, though this has no particular biological significance. This is done so that the coarse search can rely on BLASTN (nucleotide BLAST) to search these sequences against the compressed protein database. For each coarse query representative (identified using a a coarse E- value of 1000, along with the BLASTN arguments -task blastn-short -penalty -1; these arguments are recommended by the NCBI BLAST+ manual when queries are short), the set of coarse hits is used to reconstruct all corresponding sequences from the original database by following links to original sequence matches and applying their difference scripts. The re- sulting candidates are thus original sequences from the protein database, in their original amino acid alphabet. The query representative is also used to reconstruct all corresponding sequences from the original read set. Thus, for each coarse query representative, there is now a subset of the metagenomic read set (the reads represented by that coarse query) and also a subset of the protein database (the candidates). When DIAMOND is used for coarse search, instead of an E-value thresh- old, the argument --top 60 is used; this causes DIAMOND to return all coarse hits whose score is within 60% of the top-scoring hit. Without this S11 argument, DIAMOND defaults to returning at most 25 hits for each query sequence, which would result in significant loss of recall. The second phase, fine search, uses standard DIAMOND or BLASTX to translate each of these reads associated with a coarse query representative and search for hits only in the subset of the database comprising the candi- dates. This fine search phase relies on a user-specified E-value threshold (or other user-specified parameters to DIAMOND or BLASTX) to filter hits. To ensure that E-value calculation is correct, the call to BLASTX uses a cor- rected database size which is the size of the original, uncompressed protein database. Benchmarking Although our primary result is the direct acceleration of DIAMOND us- ing our entropy-scaling data structures, we also compared MICA to RapSearch2 (Zhao et al., 2012) version 2.22 and the November 29, 2014 version of DIAMOND (Buchfink et al., 2015). All tests were performed on a 12-core Intel Xeon X5690 running at 3.47GHz with 88GB RAM and hyperthreading; 24 threads were allowed for all programs. Diamond was run with the --sensitive option. In all cases, an E-value threshold of 1e-7 was used. For the raw-read dataset, we filtered out reads starting or ending with 10 or more no-calls ('N'). MICA is implemented in Go, and its source code is available on Github. esFragBag We took the existing FragBag method as a black box and by design did not do anything clever in esFragBag except apply the entropy-scaling similarity search data structure. We used a Go language implementation of FragBag, written by Andrew Gallant. Additionally, we removed the sorting-by-distance feature of Andrew Gallant's FragBag search implemen- tation, which does not improve the all-matching results we were interested in here -- it lowers k-nearest neighbor search memory requirements while dom- inating the running time of ρ-nearest neighbor, the problem at hand. This was done for both the FragBag and the esFragBag benchmarks, to ensure comparability. All code was written in Go, and is available on Github. The entire 2014 Oct 31 version of the Protein Data Bank was down- loaded and the database was composed of fragment frequency vectors gen- erated from all of the relevant PDB files using the 400-11.json fragment list (Budowski-Tal et al., 2010). For this paper, we implemented the benchmark- ing in Go, and have provided the source code for the benchmarking routine on Github. This allowed us to benchmark just the search time, excluding S12 the time to load the database from disk. Note that the prototype imple- mentation of esFragBag available only supports the all ρ-nearest neighbor search query found in FragBag. Supplemental References Bacardit, J., Stout, M., Hirst, J. D., Sastry, K., Llor`a, X., & Krasnogor, N. (2007). Automated alphabet reduction method with evolutionary algo- rithms for protein structure prediction. In Proceedings of the 9th annual conference on Genetic and evolutionary computation (pp. 346 -- 353). ACM. Buchfink, B., Xie, C., & Huson, D. H. (2015). Fast and sensitive protein alignment using DIAMOND. Nature methods, 12, 59 -- 60. Budowski-Tal, I., Nov, Y., & Kolodny, R. (2010). FragBag, an accurate representation of protein structure, retrieves structural neighbors from the entire PDB quickly and accurately. Proceedings of the National Academy of Sciences, 107, 3481 -- 3486. Cordella, L. P., Foggia, P., Sansone, C., & Vento, M. (2001). An improved In 3rd IAPR-TC15 workshop on algorithm for matching large graphs. graph-based representations in pattern recognition (pp. 149 -- 159). Daniels, N. M., Gallant, A., Peng, J., Cowen, L. J., Baym, M., & Berger, B. (2013). Compressive genomics for protein databases. Bioinformatics, 29, i283 -- i290. Falconer, K. (1990). Fractal geometry: mathematical foundations and appli- cations. John Wiley & Sons. Ferragina, P., & Manzini, G. (2000). Opportunistic data structures with In Foundations of Computer Science, 2000. Proceedings. applications. 41st Annual Symposium on (pp. 390 -- 398). IEEE. Grossi, R., & Vitter, J. S. (2005). Compressed suffix arrays and suffix trees with applications to text indexing and string matching. SIAM Journal on Computing, 35, 378 -- 407. Huson, D. H., & Xie, C. (2013). A poor man's BLASTX-high-throughput metagenomic protein database search using PAUDA. Bioinformatics, (p. btt254). S13 Jacobson, G. J. (1988). Succinct static data structures. Ph.D. thesis Carnegie Mellon University. Murphy, L. R., Wallqvist, A., & Levy, R. M. (2000). Simplified amino acid alphabets for protein fold recognition and implications for folding. Protein Engineering, 13, 149 -- 152. Needleman, S. B., & Wunsch, C. D. (1970). A general method applicable to the search for similarities in the amino acid sequence of two proteins. Journal of molecular biology, 48, 443 -- 453. Peterson, E. L., Kondev, J., Theriot, J. A., & Phillips, R. (2009). Reduced amino acid alphabets exhibit an improved sensitivity and selectivity in fold assignment. Bioinformatics, 25, 1356 -- 1362. Prat, Y., Fromer, M., Linial, N., & Linial, M. (2011). Recovering key bi- ological constituents through sparse representation of gene expression. Bioinformatics, 27, 655 -- 661. Tao, T. (2008). Product set estimates for non-commutative groups. Com- binatorica, 28, 547 -- 594. Zhao, Y., Tang, H., & Ye, Y. (2012). RAPSearch2: a fast and memory- efficient protein similarity search tool for next-generation sequencing data. Bioinformatics, 28, 125 -- 126. S14 Supplemental Figures S1 Genomic data available has grown at a faster exponential rate than computer processing power and disk storage. These plots represent, on a log scale, the daily growth in sequence data from GenBank along with (a) the combined computing power (in TeraFLOPs) of the Top 500 Supercomputer list, and (b) the largest commercially-available hard disk drives. S2 S3 (Related to Table 1b) Ammolite's preprocessing during the clustering phase. Ammolite removes nodes and edges that do not participate in simple cycles, and treats all edges as simple, unlabeled edges. In this example, both caffeine and adenine become a purine-like graph structure. Note that the resulting graph has no implicit hydrogens. (Related to Figure 3) Local fractal dimension at different scales for the space of PDB FragBag frequency vectors. Each data point is defined by dimension d = log(n2/n1) log(r2/r1) , where n1, n2 are the number of similarity search hits within radius respec- tively r1, r2, and r2−r1 is the increment size of 0.01 for cosine distance and 1 for euclidean distance. In most regimes, local fractal dimension is consistently low, except for a large spike when radius expands to include the central cluster of proteins. esFragBag achieves the most acceleration when both output size is small and we remain in a low fractal dimension regime. 15 (a) (b) Figure S1: Genomic data available has grown at a faster exponential rate than computer processing power and disk storage. These plots represent, on a log scale, the daily growth in sequence data from GenBank along with (a) the combined computing power (in TeraFLOPs) of the Top 500 Super- computer list, and (b) the largest commercially-available hard disk drives. S16 Figure S2: (Related to Table 1b) Ammolite's preprocessing during the clustering phase. Ammolite removes nodes and edges that do not participate in simple cycles, and treats all edges as simple, unlabeled edges. In this example, both caffeine and adenine become a purine-like graph structure. Note that the resulting graph has no implicit hydrogens. S17 N N C C C C N N C (a) Cosine distance (b) Euclidean distance Figure S3: (Related to Figure 3) Local fractal dimension at different scales for the space of PDB FragBag frequency vectors. Each data point is defined by dimension d = log(n2/n1) log(r2/r1) , where n1, n2 are the number of similar- ity search hits within radius respectively r1, r2, and r2 − r1 is the increment size of 0.01 for cosine distance and 1 for euclidean distance. In most regimes, local fractal dimension is consistently low, except for a large spike when ra- dius expands to include the central cluster of proteins. esFragBag achieves the most acceleration when both output size is small and we remain in a low fractal dimension regime.
1804.06601
1
1804
2018-04-18T08:30:59
Independent Distributions on a Multi-Branching AND-OR Tree of Height 2
[ "cs.DS" ]
We investigate an AND-OR tree T and a probability distribution d on the truth assignments to the leaves. Tarsi (1983) showed that if d is an independent and identical distribution (IID) such that probability of a leaf having value 0 is neither 0 nor 1 then, under a certain assumptions, there exists an optimal algorithm that is depth-first. We investigate the case where d is an independent distribution (ID) and probability depends on each leaf. It is known that in this general case, if height is greater than or equal to 3, Tarsi-type result does not hold. It is also known that for a complete binary tree of height 2, Tarsi-type result certainly holds. In this paper, we ask whether Tarsi-type result holds for an AND-OR tree of height 2. Here, a child node of the root is either an OR-gate or a leaf: The number of child nodes of an internal node is arbitrary, and depends on an internal node. We give an affirmative answer. Our strategy of the proof is to reduce the problem to the case of directional algorithms. We perform induction on the number of leaves, and modify Tarsi's method to suite height 2 trees. We discuss why our proof does not apply to height 3 trees.
cs.DS
cs
Independent Distributions on a Multi-Branching AND-OR Tree of Height 2 Mika Shigemizu1, Toshio Suzuki2 ∗and Koki Usami3 Department of Mathematical Sciences, Tokyo Metropolitan University, Minami-Ohsawa, Hachioji, Tokyo 192-0397, Japan 1: mksgmn [email protected] 2: [email protected] 3: [email protected] August 6, 2018 Abstract We investigate an AND-OR tree T and a probability distribution d on the truth assignments to the leaves. Tarsi (1983) showed that if d is an independent and identical distribution (IID) such that probability of a leaf having value 0 is neither 0 nor 1 then, under a certain assumptions, there exists an optimal algorithm that is depth-first. We investigate the case where d is an independent distribution (ID) and probability depends on each leaf. It is known that in this general case, if height is greater than or equal to 3, Tarsi-type result does not hold. It is also known that for a complete binary tree of height 2, Tarsi-type result certainly holds. In this paper, we ask whether Tarsi-type result holds for an AND-OR tree of height 2. Here, a child node of the root is either an OR-gate or a leaf: The number of child nodes of an internal node is arbitrary, and depends on an internal node. We give an affirmative answer. Our strategy of the proof is to reduce the problem to the case of directional algorithms. We perform induction on the number of leaves, and modify Tarsi's method to suite height 2 trees. We discuss why our proof does not apply to height 3 trees. Keywords: Depth-first algorithm; Independent distribution; Multi- branching tree; Computational complexity; Analysis of algorithms MSC[2010] 68T20; 68W40 1 Introduction Depth-first algorithm is a well-known type of tree search algorithm. Algorithm A on a tree T is depth-first if the following holds for each internal node x of T : ∗Corresponding author. This work was partially supported by Japan Society for the Pro- motion of Science (JSPS) KAKENHI (C) 16K05255. 1 Once A probes a leaf that is a descendant of x, A does not probe leaves that are not descendant of x until A finds value of x. With respect to analysis of algorithm, the concept of depth-first algorithm has an advantage that it is well-suited for induction on subtrees. An example of such type of induction may be found in our former paper [12]. Thus, given a problem on a tree, it is theoretically interesting question to ask whether there exists an optimal algorithm that is depth-first. Here, cost denotes (expected value of) the number of leaves probed during computation, and an algorithm is optimal if it achieves the minimum cost among algorithms considered in the question. If an associated evaluation function of a mini-max tree is bi-valued and the label of the root is MIN (MAX, respectively), the tree is equivalent to an AND- OR tree (an OR-AND tree). In other words, the root is labeled by AND (OR), and AND layers and OR layers alternate. Each leaf has a truth value 0 or 1, where we identify 0 with false, and 1 with true. A fundamental result on optimal algorithms on an AND-OR trees is given by Tarsi. A tree is balanced (in the sense of Tarsi) if (1) any two internal nodes of the same depth (distance from the root) have the same number of child nodes, and (2) all of the leaves have the same depth. A probability distribution d on the truth assignments to the leaves is an independent distribution (ID) if the probability of each leaf having value 0 depends on the leaf, and values of leaves are determined independently. If, in addition, all the probabilities of the leaves are the same (say, p), d is an independent and identical distribution (IID). Algorithm A is directional [3] if there is a fixed linear order of the leaves and for any truth assignment, the order of probing by A is consistent with the order. The result of Tarsi is as follows. Suppose that AND-OR tree T is balanced and d is an IID such that p 6= 0, 1. Then there exists an optimal algorithm that is depth-first and directional [13]. This was shown by an elegant induction. For an integer n such that 0 ≤ n ≤ h = (the height of the tree), an algorithm A is called n-straight if for each node x whose distance from the leaf is at most n, once A probes a leaf that is a descendant of x, A does not probe leaves that are not descendant of x until A finds value of x. The proof by Tarsi is induction on n. Under an induction hypothesis, we take an optimal algorithm A that is (n − 1)-straight but not n-straight. Then we modify A and get two new algorithms. By the assumption, the expected cost by A is not greater than the costs by the modified algorithms, thus we get inequalities. By means of the inequalities, we can eliminate a non- n-straight move from A without increasing cost. In the above mentioned proof by Tarsi, derivation of the inequalities heavily depends on the hypothesis that the distribution is an IID. In the same paper, Tarsi gave an example of an ID on an AND-OR tree of the following properties: The tree is of height 4, not balanced, and no optimal algorithm is depth-first. Later, we gave another example of such an ID where a tree is balanced, binary and height 3 [10]. On the other hand, as is observed in [10], in the case of a balanced binary AND-OR tree of height 2, Tarsi-type result holds for IDs in place of IIDs. 2 height 2, binary height 2, general height ≥ 3 ID Yes. S. [10] IID No. S. [10] (see also Tarsi [13]) Yes. Tarsi [13] Table 1: Existence of an optimal algorithm that is depth-first Table 1 summarizes whether Tarsi-type result holds or not. In the table, we assume that an AND-OR tree is balanced, and that the probability of each leaf having value 0 is neither 0 nor 1. In this paper, we ask whether Tarsi-type result holds for the case where a tree is height 2 and the number of child nodes is arbitrary. We give an affirmative answer. We show a slightly stronger result. We are going to investigate a tree of the following properties. The root is an AND-gate, and a child node of the root is either an OR-gate or a leaf. The number of child nodes of an internal node is arbitrary, and depends on an internal node. Figure 1 is an example of such a tree. Now, suppose that an ID on the tree is given and that at each leaf, the probability of having value 0 is neither 0 nor 1. Under these mild assumptions, we show that there exists an optimal algorithm that is depth-first and directional. xÕ x 0 x1 x2 x3 x 4 x20 x21 x30 x31 x32 x40 x41 x42 Figure 1: Example of a height 2 AND-OR tree that is not balanced Our strategy of the proof is to reduce the problem to the case of directional algorithms. We perform induction on the number of leaves, and modify Tarsi's method to go along with properties particular to hight 2 trees. The first author and the third author showed, in their talk [8], a restricted version of the present 3 result in which only directional (possibly non-depth-first) algorithms are taken into consideration. In the talk, the core of the strategy is suggested by the first author. The second author reduced the general case, in which non-directional algorithms are taken into consideration, to the case of directional algorithms. The paper [9] gives an exposition of the background. It is a short survey on the work of Liu and Tanaka [2] and its subsequent developments [11, 12, 6]. The paper [5] is also in this line. Some classical important results by 1980's may be found in the papers [1, 3, 4, 13] and [7]. We introduce notation in section 2. We show our result in section 3. In section 4, we discuss why our proof does not apply to the case of height 3, and discuss future directions. 2 Preliminaries If T is a balanced tree (in the sense of Tarsi, see Introduction) and there exists a positive integer n such that all of the internal nodes have exactly n child nodes, we say T is a complete n-ary tree. For algorithm A and distribution d, we denote (expected value of) the cost by cost(A, d). We are interested in a multi-branching AND-OR tree of height 2, where a child node of the root is either a leaf or an OR-gate, and the number of leaves depend on each OR-gate. For simplicity of notation, we investigate a slightly larger class of trees. Hereafter, by "a multi-branching AND-OR tree of height at most 2", we denote an AND-OR tree T of the following properties. • The root is an AND-gate. • We allow an internal node to have only one child, provided that the tree has at least two leaves. • All of the child nodes of the root are OR-gates. The concept of "multi-branching AND-OR tree of height at most 2" include the multi-branching AND-OR trees of height 2 in the original sense (because an OR-gate of one leaf is equivalent to a leaf), the AND-trees of height 1 (this case is achieved when all of the OR-gates have one leaf) and the OR-trees of height 1 (this case is achieved when the root has one child). The simplest case is a tree of just two leaves, and this case is achieved exactly in either of the following two. (1) The tree is equivalent to a binary AND-tree of height 1: (2) The tree is equivalent to a binary OR-tree of height 1. Suppose that T is a multi-branching AND-OR tree of height at most 2. • We let xλ denote the root. • By r we denote the number of child nodes of the root. x0, . . . , xr−1 are the child nodes of the root. 4 • For each i (0 ≤ i < r), we let a(i) denote the number of child leaves of xi. xi,0, . . . , xi,a(i)−1 are the child leaves of xi. Figure 2 is an example of such a tree, where r = 5, a(0) = 1 and a(4) = 3. The tree is equivalent to the tree in Figure 1. xÕ x 4 x40 x41 x42 x 0 x00 Figure 2: Example of an AND-OR tree of height at most 2 Suppose that d is an ID on T . For each i (0 ≤ i < r) and j (0 ≤ j < a(i)), we use the following symbols. • p(i, j) is the probability of xi,j having value 0. • p(i) is the probability of xi having value 0. • Since d is an ID, its restriction to the child nodes of xi is an ID on the subtree whose root is xi. Here, we denote it by the same symbol d. Then we define c(i) as follows. c(i) = min A cost(A, d), where A runs over algorithms finding value of xi, and cost(A, d) is expected cost. Thus, p(i) is the product p(i, 0) · · · p(i, a(i) − 1). If a(i) = 1 then c(i) = 1. If a(i) ≥ 2 and we have p(i, 0) ≤ · · · ≤ p(i, a(i) − 1), then c(i) = 1 + p(i, 0) + p(i, 0)p(i, 1) + · · · + p(i, 0) · · · p(i, a(i) − 1). Tarsi [13] investigated a depth-first algorithm that probes the leaves from left to right, skipping a leaf whenever there is sufficient information to evaluate one of its ancestors, and he called it SOLVE. We investigate a similar algorithm depending on a given independent distribution. 5 Definition 1. Suppose that T is a multi-branching AND-OR tree of height at most 2. 1. Suppose that d is an ID on T and for each i (0 ≤ i < r) and j (0 ≤ j < a(i)), we have p(i, j) 6= 0, 1. By SOLVEd, we denote the unique depth-first directional algorithm such that the following hold for all i, s, j, k (0 ≤ i < r, 0 ≤ s < r, 0 ≤ j < a(i), 0 ≤ k < a(i)). (a) If c(i)/p(i) < c(s)/p(s) then priority of (probing the leaves under) xi is higher than that of xs. (b) If c(i)/p(i) = c(s)/p(s) and i < s then priority of xi is higher than that of xs. (c) If p(i, j) < p(i, k) then priority of (probing) xi,j is higher than xi,k. (d) If p(i, j) = p(i, k) and j < k then priority of xi,j is higher than xi,k. 2. Suppose that we remove some nodes (except for the root of T ) from T , and if a removed node has descendants, we remove them too. Let T ′ be the resulting tree. Suppose that δ is an ID on T ′ and for each i (0 ≤ i < r) and j (0 ≤ j < a(i)) such that x(i, j) is a leaf of T ′, we have p(i, j) 6= 0, 1. By SOLVET δ , we denote the unique depth-first directional algorithm of the following properties. For all i, s, j, k (0 ≤ i < r, 0 ≤ s < r, 0 ≤ j < a(i), 0 ≤ k < a(i)), if xi and xs are nodes of T ′, the above-mentioned assertions (a) and (b) hold; and if xi,j and xi,k are leaves of T ′, the above-mentioned assertions (c) and (d) hold. Lemma 1. Suppose that T is a multi-branching AND-OR tree of height at most 2. Suppose that d is an ID on T and for each i (0 ≤ i < r) and j (0 ≤ j < a(i)), we have p(i, j) 6= 0, 1. Then SOLVEd achieves the minimum cost among depth- first directional algorithms. To be more precise, if A is a depth-first directional algorithm then cost(SOLVEd, d) ≤ cost(A, d). Proof. It is straightforward. 3 Result Theorem 2. Suppose that T is a multi-branching AND-OR tree of height at most 2. Suppose that d is an ID on T and for each i (0 ≤ i < r) and j (0 ≤ j < a(i)), we have p(i, j) 6= 0, 1. Then SOLVEd achieves the minimum cost among all of the algorithms (depth-first or non-depth-first, directional or non-directional). Therefore, there exists a depth-first directional algorithm that is optimal among all of the algorithms. Proof. We perform induction on the number of leaves. The base cases are the binary AND-trees of height 1 and the binary OR-trees of height 1. In general, if T is equivalent to a tree of height 1, the assertion of the theorem clearly holds. 6 To investigate induction step, we assume that T has at least three leaves. Our induction hypothesis is that for any multi-branching AND-OR tree T ′ of height at most 2, if the number of leaves of T ′ is less than that of T then the assertion of theorem holds for T ′. We fix an algorithm A that minimizes cost(A, d) among all of the algorithms (depth-first or non-depth-first, directional or non-directional). Case 1: At the first move of A, A makes a query to a leaf xi,0 such that a(i) = 1. In this case, if A finds that xi,0 has value 0 then A returns 0 and finish. Otherwise, A calls a certain algorithm (say, A′) on T − xi, that is, the tree given by removing xi and xi,0 from T . The probability distribution given by restricting d to T − xi is an ID, and a probability of any leaf is neither 0 nor 1. Therefore, by induction hypothesis, without loss of generality, we may as- sume that A′ is a depth-first directional algorithm on T − xi. Therefore, A is a depth-first directional algorithm. Hence, by Lemma 1, the same cost as A is achieved by SOLVEd. Case 2: Otherwise. At the first move of A, A makes a query to a leaf xi,j such that a(i) ≥ 2. Let T0 := T − xi,j, the tree given by removing xi,j from T . In addition, let T1 := T − xi, the tree given by removing xi and all of the leaves under xi from T . Here, T0 and T1 inherit all of the indices (for example, "3, 1" of x3,1) from T . If T1 is empty then T is equivalent to a tree of height 1, and this case reduces to our observation in the base case. Thus, throughout rest of Case 2, we assume that T1 is non-empty. If A finds that xi,j has value 0 then A calls a certain algorithm (say, A0) on T0. T1. If A finds that xi,j has value 1 then A calls a certain algorithm (say, A1) on Case 1, without loss of generality, we may assume that As is SOLVET For each s = 0, 1, let d[s] be the restriction of d to Ts. In the same way as d[s] on Ts. Hence, there is a permutation X = hxi,s(0), . . . , xi,s(a(i)−2)i of the leaves under xi except xi,j , and there are possibly empty sequences of leaves, Y = hy0, . . . , yk−1i and Z = hz0, . . . , zm−1i, with the following properties. • The three sets {xi}, Y ∗ = {y : y is a parent of a leaf in Y }, and Z ∗ = {z : z is a parent of a leaf in Z} are mutually disjoint, and their union equals {x0, . . . , xr−1}, the set of all child nodes of xλ. • The search priority of A0 is in accordance with Y XZ (thus, y0 is the first). • The search priority of A1 is in accordance with Y Z. Case 2.1: Z is non-empty. We are going to show that Y is empty. Assume not. Let B be the depth-first directional algorithm on T whose search priority is Y xi,j XZ. 7 Let AY (AX , AZ, respectively) denote the depth-first directional algorithm on the subtree above by Y (X, Z), where search priority is in accordance with Y (X, Z). Thus, we may write A0 as "AY ; AX ; AZ ", A1 as "AY ; AZ", and B as "AY ; Probe xi,j ; AX ; AZ". We look at the following events. Recall that Y ∗ is the set of all parent nodes of leaves in Y . EY : "At least one element of Y ∗ has value 0." EX : "All of the elements of X have value 0." Since the tree is height 2 and Z is non-empty, in each of A0, A1 and B, the following holds: "AY finds value of xλ if and only if EY happens." In the same way, in A0 and in B, under assumption that AX is called, AX finds value of the root if and only if EX happens. Thus, flowcharts of A and B as Boolean decision trees are as described in Figure 3 and Figure 4, respectively. 0 x ij 1 AY EY end AY EY end AZ AX EX end AZ A0 A1 Figure 3: Flowchart of A (Case 2.1, in the presence of Y ) AY EY end 0 x ij 1 AZ AX EX end AZ Figure 4: Flowchart of B (in the presence of Y ) Therefore, letting pY = prob[¬EY ] (that is, probability of the negation) and pX = prob[¬EX ], the cost of A and B are as follows. In the following formulas, CY denotes cost(AY , dY ), where dY denotes the probability distribution given by restricting d to Y . CX and CZ are similarly defined. 8 cost(A, d) = 1 + p(i, j){CY + pY (CX + pXCZ )} + (1 − p(i, j))(CY + pY CZ) = 1 + CY + p(i, j)pY (CX + pX CZ ) + (1 − p(i, j))pY CZ (1) cost(B, d) = CY + pY [1 + {p(i, j)(CX + pX CZ) + (1 − p(i, j))CZ }] = CY + pY + pY p(i, j)(CX + pX CZ ) + pY (1 − p(i, j))CZ (2) Therefore, cost(A, d) − cost(B, d) = 1 − pY . However, by our assumption on d that probability of each leaf (having value 0) is neither 0 nor 1, EY has positive probability, thus pY < 1. Thus cost(A, d) − cost(B, d) is positive, and this contradicts to the assumption that A achieves the minimum cost. Hence, we have shown that Y is empty. Therefore, A is the following algo- rithm (Figure 5): "Probe xi,j . If xi,j = 0 then perform depth-first directional search on T0 = T − xi,j , where search priority is in accordance with XZ. Oth- erwise (that is, xi,j = 1), perform depth-first directional search on T1 = T − xi, where search priority is in accordance with Z." 0 x ij 1 AX EX end AZ AZ A0 A1 Figure 5: Flowchart of A (in the absence of Y ) Thus, A is a depth-first directional algorithm. Hence, by Lemma 1, the same cost as A is achieved by SOLVEd. Case 2.2: Otherwise. In this case, Z is empty. The proof is similar to Case 2.1. 4 Concluding remarks 4.1 Difference between height 2 case and heihgt 3 case As is mentioned in Introduction, the counterpart to Theorem 2 does not hold for the case of height 3. We are going to discuss why the proof of Theorem 2 9 does not work for the case of height 3. Figure 6 is a complete binary OR-AND tree of height 3. x0 x 000 x 001 X xÕ x1 x10 x 100 x 101 Y Figure 6: A binary OR-AND tree of height 3 Suppose that algorithm A is as follows. Let Y = hx100, x101i, X = hx001i, and Z = hx010, x011, x110, x111i. At the first move, A probes x000. If x000 = 0 then A probes in accordance with order Y XZ. If x000 = 1 then A probes in accordance with order Y Z. Let A′ than x101. Y be the algorithm on Y such that x100 has higher priority of probing Suppose that an ID d on the tree is given, and that, at each leaf, probability of having value 0 is neither 0 nor 1. We investigate the following event. Y : "x10 has value 0." E ′ On the one hand, by our assumption on ID d, E ′ On the other hand, whether E ′ In other words, probability of "A′ equivalent to the assertion "A′ observation in Case 2.1 of Theorem 2 does not work for the present setting. Y has positive probability. Y happens or not, AY does not find value of xλ. Y is not Y finds value of xλ". Hence, counterpart to our Y finds value of xλ" is 0. Therefore, E ′ 4.2 Summary and future directions Given a tree T , let IID+ T , respectively) denote the set of all IIDs on T (IDs on T ) such that, at each leaf, probability having value 0 is neither 0 nor 1. Now we know the following. T (ID+ 1. (Tarsi [13]) Suppose that T is a balanced AND-OR tree of any height, and T . Then there exists an optimal algorithm that is depth-first that d ∈ IID+ and directional. 2. (S. [10]) Suppose that T is a complete binary OR-AND tree of height 3. T such that no optimal algorithm is depth-first. Then there exists d ∈ ID+ 10 3. (Theorem 2) Suppose that T is an AND-OR tree of height 2, and that T . Then there exists an optimal algorithm that is depth-first and d ∈ ID+ directional. Suppose that T is a complete binary AND-OR tree of height h ≥ 3. There is yet some hope to find a subset D of ID+ T of the following properties. • IID+ T ( D ( ID+ T • For each d ∈ D, there exists an optimal algorithm that is depth-first and directional. References [1] Donald E. Knuth and Ronald W. Moore. An analysis of alpha-beta pruning. Artif. Intell., 6 (1975) 293 -- 326. [2] ChenGuang Liu and Kazuyuki Tanaka. Eigen-distribution on random as- signments for game trees. Inform. Process. Lett., 104 (2007) 73 -- 77. [3] Judea Pearl. Asymptotic properties of minimax trees and game-searching procedures. Artif. Intell., 14 (1980) 113 -- 138. [4] Judea Pearl. The solution for the branching factor of the alpha-beta pruning algorithm and its optimality. Communications of the ACM, 25 (1982) 559 -- 564. [5] Weiguang Peng, NingNing Peng, KengMeng Ng, Kazuyuki Tanaka and Yue Yang. Optimal depth-first algorithms and equilibria of independent distributions on multi-branching trees. Inform. Process. Lett., 125 (2017) 41 -- 45. [6] Weiguang Peng, Shohei Okisaka, Wenjuan Li and Kazuyuki Tanaka. The Uniqueness of eigen-distribution under non-directional algorithms. IAENG International Journal of Computer Science, 43 (2016) 318 -- 325. http://www.iaeng.org/IJCS/issues_v43/issue_3/IJCS_43_3_07.pdf [7] Michael Saks and Avi Wigderson. Probabilistic Boolean decision trees and the complexity of evaluating game trees. In: Proc. 27th IEEE FOCS, 1986, 29 -- 38. [8] Mika Shigemizu and Koki Usami. Search algorithms on a multi-branching AND-OR tree of height 2. (in Japanese) In: S¯urikaisekikenky¯usho K¯oky¯uroku, Research Institute for Mathematical Sciences, Kyoto Univer- sity, to appear. [9] Toshio Suzuki. Kazuyuki Tanaka's work on AND-OR trees and subsequent developments. Annals of the Japan Association for Philosophy of Science, 25 (2017) 79 -- 88. 11 [10] Toshio Suzuki. Non-Depth-First Search against Independent Distributions on an AND-OR Tree. preprint, arXiv:1709.07358v1[cs.DS] (2017). [11] Toshio Suzuki and Ryota Nakamura. The eigen distribution of an AND-OR tree under directional algorithms. IAENG Int. J. Appl. Math., 42 (2012) 122 -- 128. http://www.iaeng.org/IJAM/issues_v42/issue_2/IJAM_42_2_07.pdf [12] Toshio Suzuki and Yoshinao Niida. Equilibrium points of an AND-OR tree: under constraints on probability. Ann. Pure Appl. Logic , 166 (2015) 1150 -- 1164. [13] Michael Tarsi. Optimal search on some game trees. J. ACM, 30 (1983) 389 -- 396. 12
1910.06185
1
1910
2019-10-14T14:51:57
An Improved FPT Algorithm for the Flip Distance Problem
[ "cs.DS" ]
Given a set $\cal P$ of points in the Euclidean plane and two triangulations of $\cal P$, the flip distance between these two triangulations is the minimum number of flips required to transform one triangulation into the other. Parameterized Flip Distance problem is to decide if the flip distance between two given triangulations is equal to a given integer $k$. The previous best FPT algorithm runs in time $O^{*}(k\cdot c^{k})$ ($c\leq 2\times 14^{11}$), where each step has fourteen possible choices, and the length of the action sequence is bounded by $11k$. By applying the backtracking strategy and analyzing the underlying property of the flip sequence, each step of our algorithm has only five possible choices. Based on an auxiliary graph $G$, we prove that the length of the action sequence for our algorithm is bounded by $2|G|$. As a result, we present an FPT algorithm running in time $O^{*}(k\cdot 32^{k})$.
cs.DS
cs
An Improved FPT Algorithm for the Flip Distance Problem∗† Qilong Feng‡ Shaohua Li§ Xiangzhong Meng¶ Jianxin Wang(cid:107) 9 1 0 2 t c O 4 1 ] S D . s c [ 1 v 5 8 1 6 0 . 0 1 9 1 : v i X r a Abstract Given a set P of points in the Euclidean plane and two triangulations of P, the flip distance between these two triangulations is the minimum number of flips required to transform one triangulation into the other. Parameterized Flip Distance problem is to decide if the flip distance between two given triangulations is equal to a given integer k. The previous best FPT algorithm runs in time O∗(k · ck) (c ≤ 2 × 1411), where each step has fourteen possible choices, and the length of the action sequence is bounded by 11k. By applying the backtracking strategy and analyzing the underlying property of the flip sequence, each step of our algorithm has only five possible choices. Based on an auxiliary graph G, we prove that the length of the action sequence for our algorithm is bounded by 2G. As a result, we present an FPT algorithm running in time O∗(k · 32k). Introduction 1 Given a set P of n points in the Euclidean plane, a triangulation of P is a maximal planar subdivision whose vertex set is P [6]. A flip operation to one diagonal e of a convex quadrilateral in a triangulation is to remove e and insert the other diagonal into this quadrilateral. Note that if the quadrilateral associated with e is not convex, the flip operation is not allowed. The flip distance between two triangulations is the minimum number of flips required to transform one triangulation into the other. Triangulations play an important role in computational geometry, which are applied in areas such as computer-aided geometric design and numerical analysis [7, 8, 16]. Given a point set P in the Euclidean plane, we can construct a graph GT (P) in which every triangulation of P is represented by a vertex, and two vertices are adjacent if their corresponding triangulations can be transformed into each other through one flip operation. GT (P) is called the triangulations graph of P. [1] showed that the Properties of the triangulations graph are studied in the literature. Aichholzer et al. lower bound of the number of vertices of GT (P) is Ω(2.33n). Lawson and Charles [12] showed that the diameter of GT (P) is O(n2). Hurtado et al. [9] proved that the bound is tight. Since GT (P) is connected [12], any two triangulations of P can be transformed into each other through a certain number of flips. Flip Distance problem consists in computing the flip distance between two triangulations of P, which was proved to be NP-complete by Lubiw and Pathak [13]. Pilz showed that the Flip Distance is APX-hard [2] proved that Parameterized Flip Distance is NP-complete on triangulations [15]. Aichholzer et al. of simple polygons. However, the complexity of Flip Distance on triangulations of convex polygons has been open for many years, which is equivalent to the problem of computing the rotation distance between two rooted binary trees [17]. dations of Computer Science, MFCS 2017. ∗A preliminary version of this paper appeared in the proceedings of 42nd International Symposium on Mathematical Foun- †This work is supported by the National Natural Science Foundation of China under Grants (61672536, 61420106009, 61872450, 61828205,), Hunan Provincial Science and Technology Program (2018WK4001) and the European Research Council (ERC) under the European Unions Horizon 2020 research and the innovation programme (grant Nr: 714704). ‡School of Computer Science and Engineering, Central South University, Changsha, Hunan, P.R.China. §Institute of Informatics, University of Warsaw, Poland. ¶School of Computer Science and Engineering, Central South University, Changsha, Hunan, P.R.China. (cid:107)School of Computer Science and Engineering, Central South University, Changsha, Hunan, P.R.China, [email protected] 1 Parameterized Flip Distance problem is: given two triangulations of a set of points in the plane and an integer k, deciding if the flip distance between these two triangulations is equal to k. For Parameterized Flip Distance on triangulations of a convex polygon, Lucas [14] gave a kernel of size 2k and an O∗(kk)-time algorithm. Kanj and Xia [11] studied Parameterized Flip Distance on triangulations of a set of points in the plane, and presented an O∗(k · ck)-time algorithm (c ≤ 2 · 1411), which applies to triangulations of general polygonal regions (even with holes or points inside it). In this paper, we exploit Parameterized Flip Distance further. At first, we give a nondeterministic construction process to illustrate our idea. The nondeterministic construction process contains only two types of actions, which are the moving action as well as the flipping and backing action. Given two triangulations and a parameter k, we prove that either there exists a sequence of actions of length at most 2k, following which we can transform one triangulation into the other, or we can conclude that no valid sequence of length k exists. Thus we get an improved O∗(k · 32k)-time FPT algorithm, which also applies to triangulations of general polygonal regions (even with holes or points inside it). 2 Preliminaries In a triangulation T , a flip operation f to an edge e that is the diagonal of a convex quadrilateral Q is to delete e and insert the other diagonal e(cid:48) into Q. We define e as the underlying edge of f , denoted by ε(f ), and e(cid:48) as the resulting edge of f , denoted by ϕ(f ). (For consistency and clarity, we continue to use some symbols and definitions from [11]). Note that if e is not a diagonal of any convex quadrilateral in the triangulation, flipping e is not allowed. Suppose that we perform a flip operation f on a triangulation T1 and get a new triangulation T2. We say f transforms T1 into T2. T1 is called an underlying triangulation of f , and T2 is called a resulting triangulation of f . Given a set P of n points in the Euclidean plane, let Tstart and Tend be two triangulations of P, in which Tstart is the initial triangulation and Tend is the objective triangulation. Let F = (cid:104)f1, f2, ..., fr(cid:105) be a sequence of flips, and (cid:104)T0, T1, ..., Tr(cid:105) be a sequence of triangulations of P in which T0 = Tstart and Tr = Tend. If Ti−1 is an underlying triangulation of fi, and Ti is a resulting triangulation of fi for each i = 1, 2, ..., r, we say F transforms Tstart into Tend, or F is a valid F−→ Tend. The flip distance between Tstart and Tend is the length of a shortest sequence, denoted by Tstart valid flip sequence. Now we give the formal definition of Parameterized Flip Distance problem. Parameterized Flip Distance Input: Two triangulations Tstart and Tend of P and an integer k. Question: Decide if the flip distance between Tstart and Tend is equal to k. The triangulation on which we are performing a flip operation is called the current triangulation. An edge e which belongs to the current triangulation but does not belong to Tend is called a necessary edge in the current triangulation. It is easy to see that for any necessary edge e, there must exist a flip operation f in a valid sequence such that e = ε(f ). Otherwise, we cannot get the objective triangulation Tend. For a directed graph D, a maximal connected component of its underlying graph is called a weakly connected component of D. We define the size of an undirected tree as the number of its vertices. A node in D is called a source node if the indegree of this node is 0. A parameterized problem is a decision problem for which every instance is of the form (x, k), where x is the input instance and k ∈ N is the parameter. A parameterized problem is fixed-parameter tractable (FPT ) if it can be solved by an algorithm (FPT algorithm) in O(f (k)xO(1)) time, where f (k) is a computable function of k. For a further introduction to parameterized algorithms, readers could refer to [3, 5]. 3 The Improved Algorithm for Parameterized Flip Distance Given Tstart and Tend, let F = (cid:104)f1, f2, ..., fr(cid:105) be a valid sequence, that is, Tstart the adjacency of two flips in F . F−→ Tend. Definition 1 defines 2 Definition 1. [11] Let fi and fj be two flips in F (1 ≤ i < j ≤ r). We define that flip fj is adjacent to flip fi, denoted by fi → fj, if the following two conditions are satisfied: (1) either ϕ(fi) = ε(fj), or ϕ(fi) and ε(fj) share a triangle in triangulation Tj−1; (2) ϕ(fi) is not flipped between fi and fj, that is, there does not exist a flip fp in F , where i < p < j, such that ϕ(fi) = ε(fp). By Definition 1, we can construct a directed acyclic graph (DAG), denoted by DF . Every node in DF represents a flip operation of F , and there is an arc from fi to fj if fj is adjacent to fi. For convenience, we label the nodes in DF using labels of the corresponding flip operations. In other words, we can see a node in DF as a flip operation and vice versa. The intuition of Definition 1 is that if there is an arc from fi to fj, then fj cannot be flipped before fi because the quadrilateral corresponding to the flip fj is formed after fi or the underlying edge of fj, namely ε(fj) is the resulting edge of fi, namely ϕ(fi). The following lemma gives a stronger statement: any topological sorting of DF is a valid sequence. Lemma 1. [11] Let T0 and Tr be two triangulations and F = (cid:104)f1, f2, ..., fr(cid:105) be a sequence of flips such that F−→ Tr. Let π(F ) be a permutation of the flips in F such that π(F ) is a topological sorting of DF . Then T0 π(F ) is a valid sequence of flips such that T0 π(F )−−−→ Tr. Lemma 1 ensures that if we repeatedly remove a source node from DF and flip the underlying edge of this node until DF becomes empty, we can get a valid sequence and the objective triangulation Tend. On the basis of Lemma 1, the essential task of our algorithm is to find an edge which is the underlying edge of a source node. Thus we introduce the definition of a walk, which describes the "track" to find such an edge. Definition 2. [10] A walk in a triangulation T (starting from an edge e ∈ T ) is a sequence of edges of T beginning with e in which any two consecutive edges share a triangle in T . According to Lemma 1, if there is a valid sequence F for the input instance, any topological sorting of DF is also a valid sequence for the given instance. The difficulty is that F is unknown. In order to find the topological sorting of DF , the algorithm of Kanj and Xia [11] takes a nondeterministic walk to find an edge e which is the underlying edge of a source node, flips this edge (removing the corresponding node from DF ), nondeterministically walks to an edge which shares a triangle with e and recursively searches for an edge corresponding to a source node. Their algorithm deals with weakly connected components of DF one after another (refer to Corollary 4 in [11]), that is, the algorithm tries to find a solution F in which all flips belonging to the same weakly connected component of DF appear consecutively. In order to keep this procedure within the current weakly connected component, the algorithm uses a stack to preserve the nodes (defined as connecting point in [11]) whose removal separates the current weakly connected component into small weakly connected components. When removing all nodes of a small component, their algorithm jumps to the connecting point at the top of the stack in order to find another small component. We observe that it is not necessary to remove all nodes of a weakly connected component before dealing with other weakly connected components, that is, our algorithm may find a solution F in which the nodes belonging to the same weakly connected components appear dispersedly. Thus our algorithm leaves out the stack which is used to preserve connecting points. We show that it suffices to use two types of actions (Section 3.2) instead of the five types in [11]. Moreover, every time our algorithm finds a source node, it removes the node, flips the underlying edge and backtracks to the previous edge in the walk instead of searching for the next node, thus reducing the number of choices for the actions. In a word, our algorithm traverses DF in a reverse way. However, two adjacent edges in a walk may not correspond to two adjacent vertices in DF . In order to emphasize this fact and make it more convenient for the proof, we construct an auxiliary graph G and prove that G is a forest. Actually G can be seen as the track of the reverse traversal of DF . However, G is not the underlying graph of DF (Fig. 3). Since there is a bijection between nondeterministic actions and nodes as well as edges of G, we prove that there exists a sequence of actions of length at most 2DF, which is smaller than 11DF in [11]. In addition, we make some optimization on the strategy of finding the objective sequence. As a result, we improve the running time of the algorithm from O∗(k · ck) where c ≤ 2 · 1411 [11] to O∗(k · 32k). 3 Tstart f1 f6 f2 f7 f3 f8 f5 f4 f9 Tend Figure 1: An example of Flip Distance. F = (cid:104)f1, ..., f9(cid:105) is a shortest valid sequence for Tstart and Tend. The red edge is the current edge to be flipped. 3.1 Nondeterministic construction process Now we give a description of our nondeterministic construction process NDTRV (see Fig. 2). The construc- tion is nondeterministic, that is, we suppose it always guesses the optimal choice correctly when running. The actual deterministic algorithm enumerates all possible choices to simulate the nondeterministic actions (see Fig. 4). Readers could refer to [4] as an example of nondeterministic algorithm. We present this construction process in order to depict the idea behind our deterministic algorithm clearly and vividly. Let Tstart be the initial triangulation, and Tend be the objective triangulation. Suppose that F is a shortest valid sequence, that is, F has the shortest length among all valid sequences. Let DF be the DAG constructed after F according to Definition 1. NDTRV traverses DF reversely, removes the vertices of DF in a topologically-sorted order and transforms Tstart into Tend. Although DF is unknown, for further analysis, we assume that NDTRV can remove and copy nodes in DF so that it can construct an auxiliary undirected graph G and a list L during the traversal. In later analysis we show that G is a forest. Moreover, there is a bijection between flipping actions of NDTRV and nodes of G while there is a bijection between moving actions of NDTRV and edges of G. Obviously G and L are unknown as well. We just show that if a shortest valid sequence F exists, then DF exists. So do G and L. We can see DF and G as conceptual or dummy graphs. We construct G instead of analysing a subgraph of DF because one moving action (see Section 3.2) of NDTRV may correspond to one or more edges in DF (see Fig. 3), while there is a one-to-one correspondence between moving actions and edges in G . At the beginning of an iteration, NDTRV picks a necessary edge e = ε(fh) arbitrarily and nondeter- ministically guesses a walk W to find the underlying edge of a source node fs. Lemma 2 shows that there exists such a walk W whose length is bounded by the length of a directed path B from fs to fh, and every edge e(cid:48) in W is the underlying edge of some flip f(cid:48) on B. NDTRV uses L to preserve a sequence of nodes Γ = (cid:104)fs = v1, ..., fh = v(cid:96)(cid:105) on B, whose underlying edges are in W . Simultaneously NDTRV constructs a path S by copying all nodes in Γ as well as adding an undirected edge between the copy of vi and vi+1 for i = 1, ..., (cid:96). S is defined as a searching path. The node fh is called a starting node. If a starting node is precisely a source node in DF , the searching path consists only of the copy of this starting node. When finding ε(fs), NDTRV removes fs from DF , flips ε(fs) and moves back(backtracks) to the previous edge ε(v2) of ε(fs) in W . If v2 becomes a source node of DF , NDTRV removes v2 from DF , flips ε(v2) and moves back to the previous edge ε(v3). NDTRV repeats the above operations until finding a node vi in Γ which is not a source node in DF . Then NDTRV uses vi as a new starting node, and recursively guesses a walk nondeterministically from ε(vi) to find another edge which is the underlying edge of a source node as above. NDTRV performs these operations until the initial starting node fh becomes a source node in DF . Finally NDTRV removes fh and flips ε(fh), terminating this iteration. If Tcurrent is not equal to Tend, 4 NDTRV picks a new necessary edge and starts a new iteration as above until Tstart is transformed into Tend. We give the formal presentation of NDTRV in Fig. 2 and an example in Fig. 1 and Fig. 3. 3.2 Actions of the construction Our construction process contains two types of actions operating on triangulations. The edge which the algorithm is operating on is called the current edge. The current triangulation is denoted by Tcurrent. (i) Move to one edge that shares a triangle with the current edge in Tcurrent. We formalize it as (move, e1 (cid:55)→ e2), where e1 is the current edge and e2 shares a triangle with e1. (ii) Flip the current edge and move back to the previous edge of the current edge in W . We formalize it as (f, e4 (cid:55)→ e3), where f is the flip performed on the current edge, e4 equals ϕ(f ) and e3 is the previous edge of ε(f ) in the current walk W . Since there are four edges that share a triangle with the current edge, there are at most four directions for an action of type (i). However, there is only one choice for an action of type (ii). 3.3 The sequence of actions The following theorem is the main theorem for the deterministic algorithm FLIPDT, which bounds the length of the sequence of actions by 2V (DF ). Theorem 1. There exists a sequence of actions of length at most 2V (DF ) following which we can perform a sequence of flips F (cid:48) of length V (DF ), starting from a necessary edge in Tstart, such that F (cid:48) is a topological sorting of DF . In order to prove theorem 1, we need to introduce some lemmas. We will give the proof for Theorem 1 at the end of Section 3.3. Lemma 2 is one of the main structural results of Kanj and Xia [10]. It is also the structural basis of our algorithm. Lemma 2. [10] Suppose that a sequence of flips F − is performed such that every time we flip an edge, we delete the corresponding source node in the DAG resulting from preceding deleting operations. Let fh be a node in the remaining DAG such that ε(fh) is an edge in the triangulation T resulting from performing the sequence of flips F −. There is a source node fs in the remaining DAG satisfying: (1) There is a walk W in T from ε(fh) to ε(fs). (2) There is a directed path B from fs to fh in the remaining DAG that we refer to as the backbone of the DAG. (3) The length of W is at most that of B. (4) Any edge in W is the underlying edge of a flip in B, that is, W = (cid:104)ε(v1), ..., ε(v(cid:96))(cid:105), where v1 = fs, ..., v(cid:96) = fh are nodes in B and there is a directed path Bi from vi to vi+1 for i = 1, ..., (cid:96) − 1 such that Bi ⊂ B. Lemma 3. NDTRV transforms Tstart into Tend with the minimum number of flips and stops in polynomial time if it correctly guesses every moving and flipping action. Proof. Suppose that F is a shortest valid sequence. According to Lemma 2, every edge flipped in NDTRV is the underlying edge of a source node in the remaining graph of DF , and every node removed from the remaining graph of DF in NDTRV is a source node. If Tcurrent is equal to Tend but DF is not empty, then there exists a valid sequence F (cid:48) which is shorter than F , contradicting that F is a shortest valid sequence. Thus NDTRV traverses DF , removes all nodes of DF in a topologically-sorted order and transforms Tstart into Tend with the minimum number of flips by Lemma 1. Since the diameter of a transformations graph GT (P) is O(n2) [12], NDTRV stops in polynomial time. 5 NDTRV(Tstart, Tend; DF ) Input: the initial triangulation Tstart and objective triangulation Tend. /*Assume that F is a shortest sequence, DF is the corresponding DAG by Definition 1*/ /*G is an auxiliary undirected graph */ /*L is a list keeping track of searching paths for backtracking */ /*Q is a list preserving the sequence of nondeterministic actions */ /* Tcurrent is the current triangulation*/ a. Let V (G) and E(G) be empty sets, L and Q be empty lists; b. Tcurrent = Tstart; c. While Tcurrent (cid:54)= Tend do c.1. Pick a necessary edge e = ε(fh) in Tcurrent arbitrarily; c.2. Add a copy of fh to G; c.3. Append fh to L; c.4. TrackTree(Tcurrent, e, DF , G, L, Q); TrackTree(Tcurrent, ε(fh), DF , G, L, Q) 1. Nondeterministically guess a walk in Tcurrent from ε(fh) to find ε(fs) according to Lemma 2, let Γ = (cid:104)fs = v1, ..., fh = v(cid:96)(cid:105), where fs is a source node in DF , be a sequence of nodes on the backbone B whose underlying edges are in the walk W such that ε(vi) and ε(vi+1) are consecutive in W for i = 1, ..., (cid:96) − 1; /*record actions*/ 2. Add a copy of v1,...,v(cid:96)−1 to G respectively; 3. Connect the copies of v1,...,v(cid:96) in G into a path; 4. Append v(cid:96)−1,...,v1 to L; 5. Append (move, ε(v(cid:96)) (cid:55)→ ε(v(cid:96)−1)),...,(move, ε(v2) (cid:55)→ ε(v1)) to Q; 6. Remove fs = v1 from L; 7. Remove fs = v1 from DF ; 8. Flip ε(fs) in Tcurrent and move back to ε(v2); 9. Append (fs, ϕ(v1) (cid:55)→ ε(v2)) to Q; 10. For i = 2 to (cid:96) do 10.1 Nondeterministically guess if vi is a source node in DF ; 10.2 10.2.1 Remove vi from L; 10.2.2 Remove vi from DF ; 10.2.3 10.2.4 Append (vi, ϕ(vi) (cid:55)→ ε(vi+1)) to Q; 10.3 Else 10.3.1 TrackTree(Tcurrent, ε(vi), DF , G, L, Q); If vi is a source node of DF then /*flip and move back*/ Flip ε(vi) in Tcurrent and move back to ε(vi+1); /*record actions*/ Figure 2: Nondeterministic construction NDTRV 6 v1 v2 v9 v7 v8 v4 v3 v5 v6 v1 v2 v4 v5 v3 v7 v8 v6 v9 Figure 3: Constructing G according to the example in Fig. 1. The graph on the left is DF after F in Fig. 1. The graph on the right is the auxiliary graph G constructed by NDTRV. ε(v6) is the necessary edge chosen at the beginning of the first iteration and ε(v9) is the one chosen at the beginning of the second iteration. Lemma 4. The auxiliary graph G constructed during NDTRV is a forest and V (G) = V (DF ). Morover, G consists of a set of vertex-disjoint trees called track trees. Each track tree is created during an iteration of NDTRV. Proof. Since NDTRV makes a topological sorting during execution and the copy of a vertex of DF is added to G only when it is removed from DF , it follows that V (G) = V (DF ). Suppose that there is a cycle in G. According to lemma 2 and NDTRV, we can find a directed cycle in DF , contradicting that DF is a directed acyclic graph. Thus G is a forest. From the execution of NDTRV, we get that it creates a connected subgraph in G during every iteration and the subgraphs created during each iteration are vertex-disjoint. Thus the subgraph created during each iteration is a tree. This concludes the proof. We give the proof of Theorem 1 below. Proof. (Theorem 1) During the procedure of NDTRV(Fig. 2), it constructs a list Q consisting of actions of type (i) and (ii). We claim that Q is exactly the sequence satisfying the requirement of this theorem. NDTRV appends an action of type (ii) to Q if and only if it adds a vertex to G. Meanwhile, NDTRV appends an action of type (i) to Q if and only if it adds an an edge to G. It follows that there is a one-to-one correspondence between actions of type (i) in Q and E(G) and there is a one-to-one correspondence between actions of type (ii) in Q and V (G). According to Lemma 4, G is a forest. As a result, E(G) ≤ V (G), and the length of Q is bounded by E(G) + V (G) ≤ 2V (G) = 2V (DF ). 3.4 The deterministic algorithm Now we are ready to give the deterministic algorithm FLIPDT for Parameterized Flip Distance. The specific algorithm is presented in Fig. 4. As mentioned above, we assume that NDTRV is always able to guess the optimal choice correctly. In fact, FLIPDT achieves this by trying all possible sequences of actions and partitions of k. At the top level, FLIPDT branches into all partitions of k, namely (k1, ..., kt) satisfying k1 + ... + kt = k and k1, ..., kt ≥ 1, in which ki (i = 1, ..., t) equals the size of the track tree Ai constructed during the i-th iteration. Suppose that FLIPDT is under some partition (k1, ..., kt). Let T 0 iteration = Tstart. FLIPDT permutates all necessary edges in Tstart in the lexicographical order, and the ordering is denoted by Olex. Here we number the given points of P in the Euclidean plane from 1 to n arbitrarily and label one edge by a tuple consisting of two numbers of its endpoints. Thus we can order the edges lexicographically. FLIPDT performs t iterations. At the beginning of the i-th iteration, i = 1, ..., t, we denote the current triangulation 7 iteration. For i = 1, ..., t, T i by T i−1 iteration is also the triangulation resulting from the execution of the first i iterations. At the beginning of the i-th iteration (i = 1, ..., t), FLIPDT repeatedly picks the next edge in Olex until finding a necessary edge e belonging to T i−1 iteration. Note that one edge in Olex may not be a necessary edge anymore with respect to T i−1 iteration. Moreover, if FLIPDT reaches the end of Olex but does not find a necessary edge belonging to T i−1 iteration, it needs to update Olex by clearing Olex and permutating all necessary edges in T i−1 iteration lexicographically, and choose the first edge in the updated ordering Olex. Then FLIPDT branches into every possible sequence of actions seqi of length 2ki − 1. Under each enumeration of seqi, FLIPDT branches into every possible sequence of actions seqi+1 of length 2ki+1 − 1. FLIPDT proceeds as above. When FLIPDT finishes the last iteration, it judges if the resulting triangulation T t iteration is equal to Tend. If they are equal, the input instance is a yes-instance. Otherwise, FLIPDT rejects this branch and proceeds. Now we analyse how to enumerate all possible sequences of length 2ki − 1. According to Lemma 4 and Theorem 1, in every iteration NDTRV constructs a track tree in which a node corresponds to an action of type (ii) while an edge corresponds to an action of type (i). It follows that the number of actions of type (ii) is ki, and the number of actions of type (i) is ki − 1. According to NDTRV, the last action γ in seqi must be of type (ii), and in any prefix of seqi − γ the number of actions of type (i) must not be less than that of type (ii). Thus FLIPDT only needs to enumerate all sequences of length 2ki − 1 satisfying the above constraints. FLIPDT(Tstart, Tend, k) Input: two triangulations Tstart and Tend of a point set P in the Euclidean plane and an integer k. Output: return YES if there exists a sequence of flips of length k that transforms Tstart into Tend; otherwise return NO. 1. For each partition (k1, ..., kt) of k satisfying k1 + k2 + ... + kt = k and k1, ..., kt ≥ 1 do 1.1 1.2 2. Return NO; Order all necessary edges in Tstart lexicographically and denote this ordering by Olex; FDSearch(Tstart,1,(k1, ..., kt)); /*iteration 1 distributed with k1*/ FDSearch(T ,i,(k1, ..., kt)) /*the concrete branching procedure*/ Input: a triangulation T , an integer i denoting that the algorithm is at the i-th iteration and a partition (k1, ..., kt) of k. Output: return YES if the instance is accepted. 1. Repeatedly pick the next edge in Olex until finding a necessary edge e with respect to T and Tend; iteration in lexicographical order, and pick the first edge e in Olex; T (cid:48) = Transform(T ,seqi,e); If i < t then /*continue to the next iteration distributed with ki+1*/ 2. If it reaches the end of Olex but finds no necessary edge in T then 2.1 Update Olex by permutating all necessary edges in T i−1 3. For each possible sequence of actions seqi of length 2ki − 1 do 3.1 3.2 3.2.1 3.3 Else if i = t and T (cid:48) = Tend then 3.3.1 /*compare T (cid:48) with Tend*/ FDSearch(T (cid:48),i + 1,(k1, ..., kt)); Return YES; Transform(T ,s,e) /*subprocess for transforming triangulations*/ Input: a triangulation T , a sequence of actions s and a starting edges e. Output: a new triangulation T (cid:48). 1. Perform a sequence of actions s starting from e in T , getting a new triangulation T (cid:48); 2. Return T (cid:48); Figure 4: The deterministic algorithm for Parameterized Flip Distance 8 The following theorem proves the correctness of the algorithm FLIPDT. Theorem 2. Let (Tstart, Tend, k) be an input instance. FLIPDT is correct and runs in time O∗(k · 32k). Proof. Suppose that (Tstart, Tend, k) is a yes-instance. There must exist a sequence of flips F of length k such F−→ Tend. Thus DF exists according to Definition 1. By NDTRV and Lemma 4, there exists an that Tstart undirected graph G consisting of a set of vertex-disjoint track trees A1, ..., At. Moreover, Theorem 1 shows that there exists a sequence of actions Q following which we can perform all flips of DF in a topologically- sorted order. Due to NDTRV, Q consists of several subsequences seq1, ..., seqt, in which seqi is constructed in the i-th iteration and corresponds to the track tree Ai for i = 1, ..., t. Supposing the size of Ai is λi for i = 1, ..., t satisfying λ1 + ... + λt = k, seqi contains λi actions of type (ii) corresponding to the nodes of Ai as well as λi − 1 actions of type (i) corresponding to the edges of Ai. FLIPDT guesses the size of every track tree by enumerating all possible partitions of k into (k1, ..., kt) such that k1 + ... + kt = k and k1, ..., kt ≥ 1. We say that ki is distributed to the i-th iteration or the distribution for the i-th iteration is ki for i = 1, ..., t. We claim that FLIPDT is able to perform a sequence Σ of actions which correctly guesses every subse- quence seq1, ..., seqt of the objective sequence Q, that is, Σ is a concatenation of seq1, ..., seqt. Suppose that FLIPDT has completed i iterations. We prove this claim by induction on i. At the first iteration, FLIPDT starts by picking the first necessary edge e1 in list Olex. In the first iteration of constructing Q, NDTRV starts by picking an arbitrary necessary edge. Without loss of generality, it chooses e1 and construct seq1 starting from e1. The length of seq1 is 2λ1 − 1. Since FLIPDT tries every distribution in {1, ..., k} for the first iteration and 1 ≤ λ1 ≤ k, there is a correct guess of the distribution equal to λ1 for this iteration. Under this correct guess, FLIPDT tries all possible sequences of actions of length 2λ1 − 1 starting from e1. It follows that FLIPDT is able to perform a sequence that is equals to seq1 in the first iteration resulting in a triangulation T1. Suppose that the claim is true for any first i iterations (1 ≤ i < t). That is, under some guess for the partition of k, λ1, ..., λi are distributed to the first i iterations respectively. Moreover, FLIPDT has completed i iterations and performed a sequence of actions seqconcat,i, which is equal to the concatenation of seq1, ..., seqi, resulting in a triangulation Ti. Based on Ti and seqconcat,i, FLIPDT is ready to perform the (i + 1)-th iteration. Suppose that FLIPDT picks ei+1 from Olex. Let us see the construction of Q in NDTRV. Suppose NDTRV has constructed the first i track trees A1, ..., Ai, and it is ready to begin a new iteration by arbitrarily picking a necessary edge in the current triangulation. Since FLIPDT correctly guessed and performed the first i subsequences of Q, Ti is exactly equal to the current triangulation in NDTRV. Thus ei+1 is a candidate edge belonging to the set of all selectable necessary edges for NDTRV in this iteration. Without loss of generality, it chooses ei+1 and constructs seqi+1 of length 2λi+1− 1 starting from ei+1. Since the sizes of A1, ..., Ai are λ1, ..., λi respectively, we get that 1 ≤ λi+1 ≤ k−(λ1 +...+λi). We argue that FLIPDT is able to perform a sequence that is equal to the concatenation of seq1, ..., seqi+1. Since the edges in Olex are ordered lexicographically and FLIPDT chooses necessary edges in a fixed manner, FLIPDT is sure to choose ei+1 to begin the (i + 1)-th iteration for every guessed sequence in which the first i subsequences are equal to seq1,...,seqi respectively. Thus FLIPDT actually tries every distribution in {1, ..., k − (λ1 + ... + λi}) for the (i + 1)-th iteration starting from ei+1 based on Ti and seqconcat,i. It follows that there is a correct guess of distribution for the (i + 1)-th iteration which is equal to λi+1. Under this correct guess of distribution, FLIPDT tries all possible sequences of length 2λi+1 − 1 starting from ei+1 on Ti based on seqconcat,i, ensuring that one of them is equal to seqi+1. It follows that the claim is true for the first i + 1 iterations. This completes the inductive proof for the claim. If (Tstart, Tend, k) is a yes-instance, the action sequence Q of length at most 2k exists and the deterministic algorithm can find such a sequence. Otherwise, there is no valid sequence F of length k. Thus there is no such action sequence Q. As a result, FLIPDT returns NO. It is proved that FLIPDT decides the given instance (Tstart, Tend, k) correctly. Finding and ordering all necessary edges in Tstart takes O(n+k log k) time, and FLIPDT may update the ordering Olex at the beginning of each iteration. The number of partitions of k is known as the composition number of k, which is 2k−1. Under each partition (k1, ..., kt) of k and for each ki, i = 1, ..., t, we enumerate all possible subsequences of actions in which there are ki actions of type (ii) and ki − 1 actions of type (i). 9 there are four choices for action (i) and one choice for action (ii). Here we use Stirling's approximation 2πn(n/e)n and get that (cid:0)2(ki−1) It follows that the number of all possible subsequences is bounded by (cid:0)2(ki−1) n! ≈ √ O∗(16kt) = O∗(16k) cases under each partition. Since for each case we can perform the sequence of actions in O(k) time, and the resulting triangulation can be compared to Tend in O(k) time, the running time of the whole algorithm is bounded by O∗(k · 2k−1 · (n + k log k) + k · 2k−1 · 16k) = O∗(k · 32k). (cid:1) × 4ki−1 = O∗(16ki) since (cid:1) = O∗(4ki). It follows that there are O∗(16k1) × O∗(16k2) × ... × on each instance (Tstart, Tend, k(cid:48)) for k(cid:48) = 0, ..., k. The running time is bounded by (cid:80)k According to the definition of Parameterized Flip Distance, we need to check if we can find a shorter valid sequence for the given triangulations Tstart and Tend. This is achieved by calling FLIPDT ) = O∗(k · 32k). k(cid:48)=0 O∗(k(cid:48) · 32k(cid:48) ki−1 ki−1 4 Conclusion In this paper we presented an FPT algorithm running in time O∗(k · 32k) for Parameterized Flip Dis- tance, improving the previous O∗(k · ck)-time (c ≤ 2 × 1411) FPT algorithm by Kanj and Xia [11]. An important related problem is computing the flip distance between triangulations of a convex polygon, whose traditional complexity is still unknown. Although our algorithm can be applied to the case of convex polygon, it seems that an O(ck) algorithm with smaller c for this case probably exists due to its more restrictive geo- metric property. In addition, whether there exists a polynomial kernel for Parameterized Flip Distance is also an interesting problem. References [1] Oswin Aichholzer, Ferran Hurtado, and Marc Noy. A lower bound on the number of triangulations of planar point sets. Computational Geometry, 29(2):135 -- 145, 2004. doi:10.1016/j.comgeo.2004.02. 003. [2] Oswin Aichholzer, Wolfgang Mulzer, and Alexander Pilz. Flip distance between triangulations of a simple polygon is NP-complete. Discrete & Computational Geometry, 54(2):368 -- 389, 2015. doi:10. 1007/s00454-015-9709-7. [3] Jianer Chen. Parameterized computation and complexity: A new approach dealing with np-hardness. J. Comput. Sci. Technol., 20(1):18 -- 37, 2005. doi:10.1007/s11390-005-0003-7. [4] Jianer Chen, Donald K. Friesen, Weijia Jia, and Iyad A. Kanj. Using nondeterminism to design efficient deterministic algorithms. Algorithmica, 40(2):83 -- 97, 2004. doi:10.1007/s00453-004-1096-z. [5] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, D´aniel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. doi:10.1007/ 978-3-319-21275-3. [6] Mark de Berg, Otfried Cheong, Marc J. van Kreveld, and Mark H. Overmars. Computational geometry: algorithms and applications, 3rd Edition. Springer, 2008. [7] Gerald E. Farin. Curves and surfaces for computer-aided geometric design - a practical guide (4. ed.). Computer science and scientific computing. Academic Press, 1997. [8] Bernd Hamann. Modeling contours of trivariatc data. Mathematical Modeling and Numerical Analysis, 26:51 -- 75, 1992. [9] Ferran Hurtado, Marc Noy, and Jorge Urrutia. Flipping edges in triangulations. Discrete & Computa- tional Geometry, 22(3):333 -- 346, 1999. doi:10.1007/PL00009464. 10 [10] Iyad A. Kanj, Eric Sedgwick, and Ge Xia. Computing the flip distance between triangulations. Discrete & Computational Geometry, 58(2):313 -- 344, 2017. doi:10.1007/s00454-017-9867-x. [11] Iyad A. Kanj and Ge Xia. Flip Distance is in FPT time O(n + k · ck). In proceedings of the 32nd International Symposium on Theoretical Aspects of Computer Science, STACS, Garching, Germany, pages 500 -- 512, 2015. doi:10.4230/LIPIcs.STACS.2015.500. [12] Charles L. Lawson. Transforming triangulations. Discrete Mathematics, 3(4):365 -- 372, 1972. doi: 10.1016/0012-365X(72)90093-3. [13] Anna Lubiw and Vinayak Pathak. Flip distance between two triangulations of a point set is NP- complete. Computational Geometry, 49:17 -- 23, 2015. doi:10.1016/j.comgeo.2014.11.001. [14] Joan M. Lucas. An improved kernel size for rotation distance in binary trees. Information Processing Letters, 110(12-13):481 -- 484, 2010. doi:10.1016/j.ipl.2010.04.022. [15] Alexander Pilz. Flip distance between triangulations of a planar point set is APX-hard. Computational Geometry, 47(5):589 -- 604, 2014. doi:10.1016/j.comgeo.2014.01.001. [16] Larry L. Schumaker. Triangulations in CAGD. IEEE Computer Graphics and Applications, 13(1):47 -- 52, 1993. doi:10.1109/38.180117. [17] Daniel D. Sleator, Robert E. Tarjan, and William P. Thurston. Rotation distance, triangulations, and hyperbolic geometry. In Proceedings of the 18th Annual ACM Symposium on Theory of Computing, STOC, Berkeley, USA, pages 122 -- 135, 1986. doi:10.1145/12130.12143. 11
1310.5786
1
1310
2013-10-22T03:01:41
Contracting Graphs to Split Graphs and Threshold Graphs
[ "cs.DS" ]
We study the parameterized complexity of Split Contraction and Threshold Contraction. In these problems we are given a graph G and an integer k and asked whether G can be modified into a split graph or a threshold graph, respectively, by contracting at most k edges. We present an FPT algorithm for Split Contraction, and prove that Threshold Contraction on split graphs, i.e., contracting an input split graph to a threshold graph, is FPT when parameterized by the number of contractions. To give a complete picture, we show that these two problems admit no polynomial kernels unless NP\subseteq coNP/poly.
cs.DS
cs
Contracting Graphs to Split Graphs and Threshold Graphs Leizhen Cai and Chengwei Guo Department of Computer Science and Engineering, The Chinese University of Hong Kong, Hong Kong S.A.R., China {lcai,cwguo}@cse.cuhk.edu.hk Abstract. We study the parameterized complexity of Split Contraction and Thresh- old Contraction. In these problems we are given a graph G and an integer k and asked whether G can be modified into a split graph or a threshold graph, respectively, by contracting at most k edges. We present an FPT algorithm for Split Contrac- tion, and prove that Threshold Contraction on split graphs, i.e., contracting an input split graph to a threshold graph, is FPT when parameterized by the number of contractions. To give a complete picture, we show that these two problems admit no polynomial kernels unless N P ⊆ coN P/poly. 1 Introduction Graph modification problems constitute a fundamental and well-studied family of problems in algorithmic graph theory, many famous graph problems can be formulated as graph modification problems such as Clique, Feedback Vertex Set, and Minimum Fill- in. A graph modification problem takes as input a graph G and an integer k, and the question is whether G can be modified to belong to a specified graph class, using at most k operations of a certain specified type such as vertex deletion or edge deletion. The number k of operations measures how close a graph is to such a specified class of graphs. Recently the study of modifying a graph by using operations of edge contraction has been initiated from the parameterized point of view, yielding several results for the Π-Contraction problem. Π-Contraction Instance: Question: Parameter: Graph G = (V, E), positive integer k. Can we obtain a Π-graph (i.e. a graph belonging to class Π) from G by contracting at most k edges? k. A problem (with a particular parameter k) is fixed-parameter tractable (FPT) if it can be solved in time f (k)nO(1) where f (k) is a computable function depending only on k. Considering parameterization by the number of edge contractions used to modify graphs, the Π-Contraction problem has been proved to be FPT when Π is the class of bipartite graphs (Heggernes et al. [14]), the class of trees or paths (Heggernes et al. [13]), the class of planar graphs (Golovach et al. [11]), the class of cliques (Cai et al. [5] and Lokshtanov et al. [16]). On the negative side, very recently two groups of authors (Cai et al. [5] and 1 Lokshtanov et al. [16]) showed that Chordal Contraction is fixed-parameter intractable. It is then natural to ask whether the Π-contraction problems are FPT for two well-known subclasses Π of chordal graphs: split graphs and threshold graphs. In this paper, we study the parameterized complexity of Π-Contraction when Π is the class of split graphs and when Π is the class of threshold graphs. Their edge deletion versions known as Split Deletion and Threshold Deletion, asking whether an input graph can be modified into a split graph or a threshold graph, respectively, by deleting at most k edges, are FPT and have polynomial kernels [4, 9, 12]. The combination of split graphs, threshold graphs, and edge contractions has been studied in a closely related set- ting. Belmonte et al. [1] showed that given a split graph G and a threshold graph H, the problem of determining whether G is contractible to H is NP-complete, and it can be solved in polynomial time for fixed V (H). Inspired by this, we consider the case that H is an arbitrary threshold graph that is not a part of the input, and take as parameter the number of edge contractions instead of the size of the target graph H. Our Contribution: We show that Split Contraction can be solved in 2O(k2)nO(1) time. This result complements the FPT results of two other graph modification problems related to split graphs: Split Deletion and Split Vertex Deletion. Our algorithm starts by finding a large split subgraph and further is partitioned into two parts in terms of the clique size of this split subgraph. If the clique is large, we use a branch-and-search algorithm to enumerate edge contractions and reduce to the Clique Contraction problem that is known to be FPT. Otherwise, there will be a large independent set in the input graph. We partition all vertices into bounded number of independent sets such that vertices in each set have the same neighbors, and then use reduction rules to reduce to a smaller graph. The ideas of reduction rules are applicable to obtain kernelization algorithms for other contraction problems such as Clique Contraction and Biclique Contraction. We also obtain an 2O(k2)nO(1) time algorithm for Threshold Contraction when the input is a split graph. One motivation to study this problem is for considering an aspect of modification problems: contracting few edges to make all vertices in a graph obey some ordering (in this problem the ordering by neighborhood inclusion). We feel that it is of more interest to study the Threshold Contraction problem for split graphs than for general graphs, since in the latter case the part of contracting input graphs to split graphs and the part of ordering vertices by edge contractions have lack of connection. Furthermore, we prove that the above problems admit no polynomial kernels unless N P ⊆ coN P/poly by polynomial-time reductions from Red-Blue Dominating Set and One-Sided Dominating Set, respectively, with polynomial bounds on the new parameter values. The incompressibility of Red-Blue Dominating Set is provided by Dom et al. [7]. We introduce One-Sided Dominating Set and One-Sided Domatic Number that were defined by Feige et al. [8], and show that these problems are incompressible. Such results might have application in obtaining kernelization lower bounds for further problems. 2 Preliminaries Graphs: We consider simple and undirected graphs G = (V, E), where V is the vertex set and E is the edge set. Two vertices u, v ∈ V are adjacent iff uv ∈ E. A vertex v is incident with an edge e iff v ∈ e, i.e., v is an endpoint of e. The neighbor set NG(v) of a vertex v ∈ V in graph G is the set of vertices that are adjacent to v in G. We use NG[v] to denote the closed neighbor set of v in G where NG[v] = NG(v) ∪ {v}. For a set X of vertices or edges in G, we use G \ S or G − X to denote the graph obtained by deleting X from G. For a set 2 of vertices V ′ ⊆ V , we denote by E[V ′] the set of edges whose both endpoints are in V ′. An l-path (or Pl) is a path on l vertices. We study two hereditary graph classes. A graph G is a split graph if its vertex set can be partitioned into a clique K and an independent set I, where (K; I) is called a split partition of G. The class of split graphs is characterized by a set of forbidden induced subgraphs: {2K2, C4, C5}. A graph G is a threshold graph if there exist non-negative reals r(v) for each v ∈ V (G) and "threshold" t such that for every vertex set X ⊆ V (G), X is an independent set iff Σv∈X r(v) ≤ t. The class of threshold graphs is characterized by a set of forbidden induced subgraphs: {2K2, C4, P4}. Edge Contraction: The contraction of edge e = uv in G removes u and v from G, and replaces them by a new vertex adjacent to precisely those vertices which were adjacent to at least one of u or v. The resulting graph is denoted by G/e or G · e. For a set of edges F ⊆ E(G), we write G/F to denote the graph obtained from G by sequentially contracting all edges from F . For a graph H, if H can be obtained from G by a sequence of edge contractions, then G is contractible to H, or called H-contractible. Let V (H) = {h1, · · · , hl}. G is H-contractible if G has a so-called H-witness structure: a partition of V (G) into l sets W (h1), · · · , W (hl), called witness sets, such that each W (hi) induces a connected subgraph of G and for any two hi, hj ∈ V (H), there is an edge between W (hi) and W (hj) in G iff hihj ∈ E(H). We obtain H from G by contracting vertices in each W (hi) into a single vertex. Parameterized Complexity: A paramerized problem Q is a subset of Σ∗ × N for some finite alphabet Σ. The second component is called the parameter. The problem Q is fixed- parameter tractable if it admits an algorithm deciding whether (I, k) ∈ Q in time f (k)IO(1), where f is a computable function depending only on k. A kernelization of Q is a polynomial-time computable function that maps instance (I, k) to another instance (I ′, k′) such that: • (I, k) ∈ Q ⇔ (I ′, k′) ∈ Q; • I ′, k′ ≤ g(k) for some computable function g. If g is a polynomial function then we say that Q admits a polynomial kernel. A problem Q is incompressible if it admits no polynomial kernel unless N P ⊆ coN P/poly. 3 Contracting graphs to split graphs In this section, we consider the Split Contraction problem: Given a graph G and an integer k, can we obtain a split graph from G by contracting at most k edges? We point out that this problem is NP-complete by reducing from another NP-complete edge contraction problem Clique Contraction [5]: Given a graph G and an integer k, can we modify G into a clique by contracting at most k edges? We construct a graph G′ from G by adding an independent set of k + 2 new vertices and making new vertices adjacent to all vertices in G. Observe that at least two of the new vertices are not involved in any edge contraction, then at least one of them belongs to the independent set of the resulting split graph, which implies that all the old vertices belong to the clique of the resulting graph. Thus G′ can be modified into a split graph using k edge contractions iff there exists a set of k edges in G whose contraction makes G into a clique. Theorem 3.1. Split Contraction is NP-complete. 3 We now present an FPT algorithm for Split Contraction based on an kO(k) + O(m) time algorithm for Clique Contraction [5]. Note that an n-vertex graph G must contain an induced split subgraph of (n − 2k) vertices if (G, k) is yes-instance of Split Contraction, because k edge contractions can affect at most 2k vertices. We start by finding an (n − 2k)-vertex induced split subgraph H in 22knO(1) time using a known algorithm for Split Vertex Deletion (Ghosh et al. [9]). Let Vk = V (G) − V (H), and let (KH ; IH ) be a split partition of H where KH is a maximal clique and IH is an independent set. Here we first assume that KH > 2k implying that at least one vertex in KH is not involved in any edge contraction, and will discuss the case for KH ≤ 2k in the last part of the algorithm. We branch out by contracting every possible set E′ ⊆ E[Vk] of at most k edges and obtain the resulting instance (G′, k′) where G′ = G/E′ and k′ = k − E′. For each resulting instance (G′, k′), suppose that vertices Vk are contracted to vertices V ′ k in G′. Proposition 3.2. (G, k) has a solution S iff there exists a resulting instance (G′, k′) such that (G′, k′) has a solution F = S − E′ satisfying F ∩ E[V ′ k] = ∅. Suppose that (G′, k′) is a yes-instance and has a solution F . Thus the graph G′/F is a split graph and has a split partition (KF ; IF ). We further branch on at most 3V ′ k ways to find a partition V ′ k = R ∪ Kp ∪ Ip such that R consists of exactly those vertices in V ′ k that are incident with some edges in F , Kp ⊆ KF induces a clique, and Ip ⊆ IF induces an independent set. See Fig. 1 for an illustration. It is easy to see that R ≤ k′. IH KH H Ip Kp R G′[V ′ k] Figure 1: An illustration of the structure of G′ It is clear that those vertices in IH that are adjacent to some vertices in Ip must be in the clique KF of the target split graph, and other vertices in IH could be in the independent set IF after contractions. The following proposition states that almost all vertices in KF are finally in the clique of some target graph. Proposition 3.3. If (G′, k′) is a yes-instance, then it has a solution F such that there is at most one vertex in KH that is finally in the independent set IF . Proof. For an arbitrary solution F of (G′, k′), if there are at least two vertices a, b ∈ KH that are finally in the independent set IF , they must be contained in a same witness set WF because they are adjacent originally. Thus the number of such vertices is bounded by k + 1, implying that there is a vertex u ∈ KH that is finally in the clique KF since KH > 2k. By the definition of witness set we see that the induced subgraph G′[WF ] has a spanning tree whose edges are entirely in F . Thus we can remove one edge from F to separate the vertex b from the witness set WF , and add an edge ub into F which implies that b is adjacent to all vertices in KF after contracting F . It is easy to see that the resulting set obtained from F is also a solution of (G′, k′) and b is no longer in the independent set. 4 Our algorithm further considers the following two cases. It outputs "YES" if either case outputs "YES". Case 1. There is no vertex in KH that is finally in IF . Let T1 be a subset of IH containing exactly those vertices that are adjacent to some vertices in Ip. It is clear that all vertices in T1 are finally in KF after contractions. Therefore every vertex in T1 must be involved in at least one edge contraction, and we have T1 ≤ k′. Remember that R consists of exactly those vertices in V ′ k that are incident with some edges in F , which implies that vertices in R are merged into KH ∪ IH after contracting some edges in F . It is easy to see that in order to contract G′ into a split graph, it is better to merge vertices R into KH ∪ T1 than into IH − T1. Thus we may assume that all vertices in R are finally in KF after contractions. Our goal becomes to check whether T1 ∪ KH ∪ R ∪ Kp induces a clique after contracting at most k′ edges in G′. Since KH > 2k, there exists a vertex u ∈ KH that is not involved in any edge contrac- tion. Obviously u is adjacent to all vertices in KF . We can obtain an edge set F1 from F by removing every edge of F whose endpoints are both outside KH , and replacing every edge ab ∈ F that a ∈ IH − T1, b ∈ KH by an edge ub. Since contracting such edge ab only affects the vertex b which can be merged into the clique KF by contracting ub, it is clear that F1 is also a solution set of G′ consisting of edges whose one endpoint is in KH and another endpoint is in T1 ∪ KH ∪ R ∪ Kp. Proposition 3.4. (G′, k′) has a solution set that is entirely contained in G′[T1∪KH ∪R∪Kp] if it is a yes-instance for Case 1. By the above result, we first find the set T1 in polynomial time, and then apply the FPT algorithm for Clique Contraction [5] to determine whether G′[T1 ∪ KH ∪ R ∪ Kp] can be made into a clique by at most k′ edge contractions. If it outputs "YES", then (G′, k′) is a yes-instance. The running time is bounded by k′O(k′) + O(m). Case 2. There is exactly one vertex in KH that is finally in IF . We check whether (G′, k′) is a yes-instance with the assumption KH ∩ IF = {w} for every w ∈ KH that is not adjacent to any vertex in Ip. Let T2 be a subset of IH containing exactly those vertices that are adjacent to some vertices in Ip ∪ {w}. Since each vertex in T2 is finally in KF and thus is involved in some edge contraction, we have T2 ≤ k′. Our goal is to check whether T2 ∪ (KH − {w}) ∪ R ∪ Kp induces a clique after contracting at most k′ edges in G′. Similar to Case 1, we have the following proposition. Proposition 3.5. (G′, k′) has a solution set that is entirely contained in G′[T2 ∪ (KH − {w}) ∪ R ∪ Kp] if it is a yes-instance for Case 2. We also apply the k′O(k′) + O(m) time algorithm for Clique Contraction [5] to determine whether G′[T2 ∪ (KH − {w}) ∪ R ∪ Kp] can be made into a clique by contracting at most k′ edges. If it outputs "YES", then (G′, k′) is a yes-instance. Combing Case 1 and Case 2, we can decide whether a resulting instance (G′, k′) is a yes-instance in kO(k) + O(m) time when KH > 2k. Furthermore, we deal with the remaining case: KH ≤ 2k. We partition the vertex set V (G) into disjoint sets X1, · · · , Xd such that each Xi induces a maximal independent set satisfying that the vertices in Xi have the same sets of neighbors in G. This procedure is equivalent to partitioning the complement graph G into critical cliques, which can be done 5 in linear time [6, 15]. A critical clique K in a graph is a clique such that all vertices in K have the same closed neighbor sets, and K is maximal under this property. It has been proved that all vertices in a graph can be uniquely partitioned into groups such that each group induces a critical clique [6, 15]. We now use the following reduction rules to obtain a smaller instance: Rule 1. If d > 24k + 4k, then output "NO". Rule 2. 2k + 5 vertices among them and remove others in Xi from G. If there are more than 2k + 5 vertices in Xi for some i, then arbitrarily retain It is clear that applying these reduction rules requires linear time. We now show the correctness of Rule 1 and Rule 2. Lemma 3.6. Rule 1 and Rule 2 are correct. Proof. Since KH ≤ 2k, we have Vk ∪ KH ≤ 4k and IH ≥ n − 4k. Note that vertices in IH have at most 24k different connection configurations to vertices Vk ∪ KH . Thus IH can be partitioned into at most 24k maximal independent sets such that vertices in each set have the same neighbors in G. Including vertices of Vk ∪ KH , the number d is bounded by 24k + 4k if (G, k) is a yes-instance. Thus Rule 1 is correct. Moreover, we prove that the input graph G has a k-solution iff the graph G∗ obtained after one application of Rule 2 has a k-solution. Let Yi be the set of remaining vertices in Xi for i = 1, · · · , d. Suppose that G has a solution S ⊆ E(G). For every vertex a that is incident with edges in S and is removed after applying Rule 2, there exists 1 ≤ j ≤ d such that a ∈ Xj − Yj. Note that Yj = 2k + 5 > 2k, there is another vertex b ∈ Yj that is not incident with any edge in S. We replace all edges {ac ∈ S : c ∈ V (G)} by {bc : ac ∈ S} in S for every such a, and obtain a set S′ ⊆ E(G∗). It is clear that G∗/S′ is an induced subgraph of G/S′ because S′ ⊆ E(G∗). Since NG(a) = NG(b) for every such a, it is easy to see that G/S′ is isomorphic to G/S that is a split graph. Therefore G∗/S′ is a split graph. Conversely, suppose that G∗ has a solution S∗, i.e., G∗/S∗ is a split graph. We claim that G/S∗ is also a split graph. Towards a contradiction, we assume that G/S∗ contains an induced subgraph D isomorphic to one graph of {2K2, C4, C5}. For every vertex a that is contained in V (D) and is removed after applying Rule 2, a is in Xj − Yj for some j. Since S∗ ⊆ E(G∗), a is not incident with any edge in S∗. Note that Yj = 2k + 5 ≥ 2k + V (D), there is a vertex b ∈ Yj that is not contained in V (D) and is not incident with any edge in S∗. We replace a by b in V (D) for every such a, and obtain an induced subgraph D′ whose vertices are all included in V (G∗/S∗). Since NG(a) = NG(b) for every such a, it is easy to see that D′ is isomorphic to D, contradicting to the fact that G∗/S∗ is a split graph that is D-free. Thus G/S∗ is {2K2, C4, C5}-free, and S∗ is a solution of G. After applying Rule 1 and Rule 2, we reduce G into a graph of O(24kk) vertices, implying that the problem can be solved in 2O(k2) + O(m) time using exhaustive search if K1 ≤ 2k. Our FPT algorithm for Split Contraction is summarized in the following table: 6 Algorithm Split Contraction (G, k) • Find an induced split subgraph H = (KH ; IH ) of size (n − 2k) in G. If it does not exist, output "NO". Let Vk = V (G) − V (H). • If KH > 2k, then -- Branch into instances (G′, k′) by contracting edges E ′ ⊆ E[Vk]. Enumerate all partitions V ′ k = (R, Kp, Ip). -- Case 1: Find T1 = {v ∈ IH ∃x ∈ Ip, vx ∈ E(G′)}. Determine whether (G′[T1 ∪ KH ∪ R ∪ Kp], k′) is a yes-instance of Clique Contraction. If yes, output "YES". -- Case 2: For every w ∈ KH , find T2 = {v ∈ IH ∃x ∈ Ip ∪ {w}, vx ∈ E(G′)}. Determine whether (G′[T2 ∪ (KH − {w}) ∪ R ∪ Kp], k′) is a yes-instance of Clique Contraction. If yes, output "YES". -- If for every (G′, k′) neither Case 1 nor Case 2 output "YES", then output "NO". • Else -- Partition V (G) into disjoint sets X1, · · · , Xd such that each Xi induces a maximal independent set satisfying that vertices in Xi have the same neighbors. -- Reduction Rule 1: If d > 24k + 4k, then output "NO". -- Reduction Rule 2: If there are more than 2k + 5 vertices in Xi for some i, then arbitrarily retain 2k + 5 vertices among them and remove others in Xi from G. -- Use exhaustive search to find a solution in the reduced graph G∗. Theorem 3.7. Split Contraction can be solved in 2O(k2)nO(1) time. Proof. In the above algorithm, we use an 22knO(1) time algorithm to find an (n − 2k)-vertex induced split subgraph H. If KH > 2k, we branch into at most E[Vk]k = kO(k) instances and enumerate at most 3V ′ k = 3O(k) partitions, and for each resulting instance it costs kO(k) + O(m) time to determine whether it is a yes-instance. Thus the running time of this step is bounded by kO(k)nO(1). If KH ≤ 2k, the running time of the algorithm is 2O(k2) + O(m). Therefore the total running time is 2O(k2)nO(1). 4 Contracting split graphs to threshold graphs After obtaining an FPT algorithm for contracting general graphs to split graphs, we consider the problem of contracting split graphs to threshold graphs, which is formally defined as Threshold Contraction on split graphs: Given a split graph G and an integer k, can we obtain a threshold graph from G by contracting at most k edges? Threshold graphs constitute a subclass of both split graphs and interval graphs in graph theory. A graph G is a threshold graph if it is a split graph and for any split partition (K; I) of G, there is an ordering (u1, u2, · · · , up) of the vertices in K such that N [u1] ⊆ N [u2] ⊆ · · · ⊆ N [up] and there is an ordering (v1, v2, · · · , vq) of the vertices in I such that N (v1) ⊇ N (v2) ⊇ · · · ⊇ N (vq), i.e., a split graph containing no induced P4. Note that the class of split graphs is closed under edge contractions, and contracting edges in a split graph never generates a new induced P4 because split graphs contain no induced Pl for l > 4. Thus contracting a split graph to a threshold graph is essentially removing all induced P4 from the split graph by edge contractions. Based on this observation, we obtain the following FPT algorithm. 7 Given an input split graph G with n vertices and an integer k, we find a split partition (K; I) for G where K is a maximal clique and I is an independent set. We construct a bounded search tree whose root is labelled by (G, k, T ), where T represents a set of vertices in K that are incident with edges in a solution set and is initially an empty set ∅. Observation 4.1. For any v ∈ I and any x, y ∈ K such that vx, vy ∈ E(G), these two graphs, G/vx and G/vy, are isomorphic. For any induced 4-path v1v2v3v4 in G where v1, v4 ∈ I and v2, v3 ∈ K, there are five ways to destroy this path by edge contractions: contracting v1x ∈ E(G) for any x ∈ K, contracting v4y ∈ E(G) for any y ∈ K, contracting v2v3, making v2 adjacent to v4, or making v3 adjacent to v1. The first two cases are based on Observation 4.1. The last two cases imply that v2 or v3 is involved in at least one edge contraction. So we branch into 5 instances: (G/v1v2, k − 1, T ), (G/v3v4, k − 1, T ), (G/v2v3, k − 1, T ), (G, k, T ∪ {v2}), and (G, k, T ∪ {v3}). For the fourth case, we mark every induced P4 containing both v2 and v4 in the current graph. For the fifth case, we mark every induced P4 containing both v3 and v1 in the current graph. We continue branching whenever k > 0, T < 2k, and the graph contains an induced P4 that is not marked. Clearly the search tree has height at most 2k, and its size is bounded by O(52k). Proposition 4.2. (G, k) is a yes-instance iff there exists at least one leaf (G′, k′, T ′) in the search tree such that (G′, k′) is a yes-instance, T ′ ≤ 2k′, and every induced P4 in G′ is marked. Next, we determine whether a leaf (G′, k′, T ′) is a yes-instance in FPT time. Let (K ′; I ′) be the split partition of G′ corresponding to (K; I). Since every induced P4 in G′ is marked and thus intersects T ′, then G′ − T ′ contains no induced P4. Therefore (K ′ − T ′; I ′) con- stitutes a threshold graph and there exists a vertex u ∈ K ′ − T ′ such that N [u] ⊇ N [w] for every w ∈ K ′ − T ′. For each w ∈ K ′ − T ′, let P (w) be a set of exactly those vertices v ∈ T ′ such that there exists an induced P4 containing the edge wv in G′. We group the vertices {w ∈ K ′ − T ′ : P (w) > 0} into different sets R1, · · · , Rd by P (w) (i.e., any w1 and w2 are grouped into a same set iff P (w1) = P (w2) 6= ∅), and guarantee that Ri ≤ 2k′ + 1 for each i. If there are more than 2k′ + 1 vertices w that have the same P (w) values, then choose 2k + 1 of them with largest degrees to form Ri. Obviously d < 2T ′ ≤ 22k′ . Suppose that (G′, k′) is a yes-instance and has a minimal solution set S. If there is a vertex w ∈ I ′ that is incident with some edge wv in S, then removing wv from S also yields a solution set because every induced P4 in G′ is marked, contradicting to the fact that S is minimal. Thus we have S ⊆ E[K ′]. We now use S to obtain a solution set that is entirely contained in a set whose size is bounded by a function of k′. We first replace every xw ∈ S that x ∈ K ′, w ∈ K ′ − T ′, and w is not contained in any induced P4 (i.e., P (w) = ∅) by an edge xu, and then obtain a set S1. Note that contracting xw only affects such induced 4-path a1xa2a3 that a2 ∈ K ′ and a1, a3 ∈ I ′. To destroy this path, w must be adjacent to a3 in G′. Thus u is adjacent to a3 because N [w] ⊆ N [u], implying that contracting xu instead of xw also destroys the path a1xa2a3 (see Fig. 2(a)). Lemma 4.3. S1 is a solution set of (G′, k′) if S is. 8 a3 a2 K ′ a1 x u w (a) b4 b1 b3 b5 w w′ (b) K ′ b2 Figure 2: (a) a1xa2a3 can be destroyed by contracting xu instead of xw; (b) b1wb2b3 can be destroyed by contracting S1 − {wy} Furthermore for any w ∈ K ′ − T ′ such that P (w) 6= ∅ and w is not contained in any Ri, there exits a vertex w′ ∈ Rj for some j such that P (w′) = P (w) and w′ is not involved in any edge contraction since Rj = 2k′ + 1 > 2k′. We replace the edges {wy ∈ S1 : y ∈ K ′} incident with w by {w′y : wy ∈ S1} for every such w and then obtain a set S2. We show that S2 is also a solution set. Lemma 4.4. S2 is a solution set of (G′, k′) if S1 is. Proof. Note that contraction of each wy ∈ S1 only destroys the induced 4-paths containing either w or y, then other induced 4-paths in G′ are destroyed by contracting S1 − {wy}. Since w′ ∈ Rj, w /∈ Rj, and P (w′) = P (w), we have N [w] ⊆ N [w′] by the construction rule of Rj. Similar to the above proof for S1, contracting w′y instead of wy will destroy the paths that contain y but not w. Moreover for any induced path b1wb2b3 containing w, there exists another induced path b4w′b2b5 containing w′ and b2 in G′ because b2 ∈ P (w) = P (w′). Clearly {b1, w′, b2, b5} constitute an induced P4 in G′ since b1 and b2 are not adjacent and w′ and b5 are not adjacent either. Note that b1w′b2b5 is destroyed by contracting S1 − {wy} and w′ is not involved in any edge contraction. Therefore b2 must be adjacent to b1 after contractions, implying that b1wb2b3 can be destroyed by contracting S1 − {wy} (see Fig. 2(b)). Thus contracting (S1 − {wy}) ∪ {w′y} also removes all induced 4-paths in G′, implying that S2 is a solution. Let R = R1 ∪ · · · ∪ Rd, we have the following result. Corollary 4.5. (G′, k′) has a solution set that is entirely contained in E[T ′ ∪ R ∪ {u}] if it is a yes-instance. Thus to determine whether (G′, k′) is a yes-instance, we use exhaustive search to check k′ whether there is a k′-size solution set in E[T ′ ∪ R ∪ {u}], which costs O((cid:0)T ′+R+1 (cid:1) 2O(k′2) time since R ≤ (2k′ + 1)22k′ Contraction on split graphs. ) = . We have obtained an FPT algorithm for Threshold 2 Theorem 4.6. Threshold Contraction can be solved in 2O(k2)nO(1) time for split graphs. 5 Incompressibility In this section, we show that Split Contraction and Threshold Contraction on split graphs are very unlikely to have polynomial kernels. To this end, we give polynomial 9 parameter transformations from two domination problems: Red-Blue Dominating Set and One-Sided Dominating Set. A polynomial parameter transformation from a problem Q to another problem Q′ is a polynomial-time computable function that maps (I, k) to (I ′, k′) such that: (a) (I, k) ∈ Q ⇔ (I ′, k′) ∈ Q′; (b) k′ ≤ h(k) for some computable function h. Bodlaender et al. [3] proved that if Q is incompressible and there is a polynomial parameter transformation from Q to Q′, then Q′ is incompressible as well. Red-Blue Dominating Set and One-Sided Dominating Set are defined as follows: Red-Blue Dominating Set Instance: Question: Parameter: Bipartite graph G = (X, Y ; E) and an integer t. Does Y have a subset of at most t vertices that dominates X? X, t. One-Sided Dominating Set Instance: Question: Parameter: Bipartite graph G = (X, Y ; E) and an integer t. Does X have a subset of at most t vertices that dominates Y ? X. These two problems of similar definitions have different meanings. If we consider the set X of the input bipartite graph as the "small side" since the cardinality of X is the parameter of the problem, and the set Y as the "large side" since the cardinality of Y could be very large, the Red-Blue Dominating Set problem is to find a set in "large side" to dominate "small side" while the One-Sided Dominating Set problem is to find a set in "small side" to dominate "large side". Dom et al. [7] proved that Red-Blue Dominating Set is incompressible using the Colors and IDs technique. This result is applicable to several other incompressible problems such as Steiner Tree, Connected Vertex Cover [7], and Tree Contraction [13]. Theorem 5.1 (Dom et al. [7]). Red-Blue Dominating Set admits no polynomial kernel unless N P ⊆ coN P/poly. We point out that One-Sided Dominating Set can be solved in O(2XIO(1)) time by enumerating all subsets of X, and is incompressible. The proof will appear in full version of the paper [5] by the same authors. Theorem 5.2. One-Sided Dominating Set admits no polynomial kernel unless N P ⊆ coN P/poly. We now give a polynomial parameter transformation from Red-Blue Dominating Set to Split Contraction. Without loss of generality, we may assume that every vertex in X has at least one neighbor in Y and then t ≤ X. Our result is inspired by the reduction for Tree Contraction by Heggernes et al. [13]. Theorem 5.3. Split Contraction admits no polynomial kernel unless N P ⊆ coN P/poly. Proof. Given a bipartite graph G = (X, Y ; E) and a positive integers t, we construct a graph G′ from G by creating a clique C of size X + t + 3 where a designated vertex u ∈ C is made adjacent to all vertices of Y , and for every v ∈ X adding X + t + 1 new leaves appending to v. We claim that Y has a subset of at most t vertices that dominates X iff G′ can be made into a split graph by contracting at most B + t edges. Suppose that Y ′ is a t-subset of Y that dominates X. Since vertices of {u} ∪ Y ′ ∪ X induce a connected graph, we can make these X + t + 1 vertices into a single vertex by 10 using X + t edge contractions. The subgraph of G′ induced by {u} ∪ Y ∪ X is contracted to a star, and G′ is modified into a split graph after contractions. Conversely, suppose that G′ contains at most X + t edges F whose contraction results in a split graph. Note that at least two vertices a and b other than u in C survive after contracting F , and for each vertex x ∈ X there exists a leaf x′ appending to x that is not involved in any edge contraction. If any x ∈ X and u are in the different witness set, then {x, x′, a, b} form an induced 2K2, contradicting to the fact that G′/F is a split graph. Therefore all vertices in X ∪{u} are in the same witness set. Observe that each path starting from one vertex in X to u must go through some vertices in Y , which implies that X is dominated by a subset I of Y containing exactly those vertices that are in the same witness set with u. Thus we obtain a solution of G with I ≤ F − X ≤ t vertices. In order to show the incompressibility of Threshold Contraction in a clear sketch, we first give a polynomial parameter transformation from One-Sided Dominating Set to the following One-Sided Domatic Number problem, and next give another transformation from One-Sided Domatic Number to Threshold Contraction on split graphs. One-Sided Domatic Number Instance: Question: Bipartite graph G = (X, Y ; E) and integer t. Can we partition X into t disjoint sets such that vertices in each set dominate Y ? X. Parameter: One-Sided Domatic Number can be solved in O(2XlogXIO(1)) time by enumerat- ing all partitions for X, and is incompressible. Theorem 5.4. One-Sided Domatic Number admits no polynomial kernel unless N P ⊆ coN P/poly. Proof. Given a bipartite graph G = (X, Y ; E) and an integer t, we construct a graph G′ by creating a new vertex w that is made adjacent to every vertex of X, and a set Z of X − t vertices that are made adjacent to every vertex of Y . X Y Z w Figure 3: An example of construction of G′ with X = 4, t = 2. We claim that X has a subset of at most t vertices that dominates Y iff X ∪ Z can be partitioned into X − t + 1 disjoint sets such that vertices in each set dominate Y ∪ {w}. Suppose that X has a subset S of t vertices that dominates Y . Obviously S dominates Y ∪ {w}. Note that every vertex in X \ S is adjacent to w and every vertex in Z dominates Y . Thus vertices in (X \ S) ∪ Z can be partitioned into X − t pairs such that each pair of 11 vertices dominates Y ∪ {w}. Included the set S, we obtain X − t + 1 disjoint dominating sets for Y ∪ {w} in X ∪ Z. Conversely, suppose that X ∪Z has a disjoint partition (S1, · · · , SX−t+1) such that each Si dominates Y ∪ {w}. Note that each Si that contains some vertex of Z must contain at least one vertex in X because w is only adjacent to vertices in X. Let r be the number of sets Si that intersect Z where r ≤ Z = X − t. It is easy to see that there are at most X − r vertices in X that constitute X − t + 1 − r disjoint dominating sets for Y ∪ {w}, X−t+1−r ≤ t and thus there exists one dominating set containing at most vertices which is clearly a dominating set for Y . X−t+1−r = 1 + X−r t−1 Since X ∪ Z = 2X − t, the reduction is parameter preserving. Theorem 5.5. Threshold Contraction on split graphs admits no polynomial kernel unless N P ⊆ coN P/poly. Proof. Given a bipartite graph G = (X, Y ; E) where X = {x1, · · · , xk} and Y = {y1, · · · , yn}, and a positive integer t, we construct a graph G′ as following: • Create a clique K of X vertices {u1, · · · , uk}, and a clique A of size 2X + 1. Make K ∪ A into a large clique. • Create an independent set B of X + 1 vertices that are made adjacent to every vertex 1 , · · · , v(l) of K, and create X + 1 disjoint independent sets of size Y : Il = {v(l) n } (l = 1, · · · , X + 1). All vertices in I1 ∪ · · · ∪ IX+1 are made adjacent to every vertex of A. • For each 1 ≤ l ≤ X + 1, make ui adjacent to v(l) j iff xiyj ∈ E. • G′ = (K ∪ A; B ∪ I1 ∪ · · · ∪ IX+1) is a split graph. X Y K A B · · · I1 Ik+1 Figure 4: An example of the reduction from Red-Blue Domatic Number to Threshold Contraction. We claim that X can be partitioned into t disjoint dominating sets for Y iff G′ can be modified into a threshold graph by contracting at most X − t edges. Suppose that the set B has a disjoint partition X = X1 ∪· · · ∪Xt such that each Xi dom- inates Y . We partition the set {u1, · · · , uk} into t disjoint sets {R1, · · · , Rt} corresponding to {X1, · · · , Xt}, and contract vertices in each Ri to a single vertex ri. The total number of edge contractions we use is Σi(Ri − 1) = (ΣiRi) − t = X − t, and ri is adjacent to 12 every vertex of I1 ∪ · · · ∪ IX+1 for each 1 ≤ i ≤ t because Xi dominates Y in G. The closed neighbor sets of vertices in K ∪A satisfy that N [r1] = · · · = N [rt] ⊇ N [A] after contractions, thus G′ is made into a threshold graph. Conversely, suppose that G′ contains at most X − t edges F whose contraction results in a threshold graph. K is partitioned into r witness sets W1, · · · , Wr, and vertices in each Wj are contracted to a single vertex wj . Note that Σj(Wj − 1) ≤ F , we have r ≥ ΣjWj − F ≥ t. Since F ≤ X, there exists some 1 ≤ p ≤ X + 1 such that none vertex in Ip is incident with any edge in F . Moreover, there exist vertices a ∈ A and b ∈ B that are not incident with any edge in F . By the construction, each vertex in K is adjacent to b which is non-adjacent to a, and a is adjacent to all vertices in Ip. Thus to modify G′ into a threshold graph, each vertex in {w1, · · · , wr} must be adjacent to all vertices in Ip = {vp,1, · · · , vp,n} after contractions, implying that Wj dominates {yi, · · · , yn} in G for each 1 ≤ j ≤ r. Therefore (G, t) is a yes-instance of One-Sided Domatic Number. The above reduction implies the NP-hardness of Threshold Contraction. Theorem 5.6. Threshold Contraction is NP-complete even for split graphs. 6 Concluding Remarks In this paper we have proved that the following two edge contraction problems are FPT but admit no polynomial kernels unless N P ⊆ coN P/poly: Split Contraction, and Threshold Contraction on split graphs. We note that Threshold Contraction on split graphs is essentially the same as Cograph Contraction on split graphs. The Cograph Contraction problem is claimed to be FPT for general graphs by a recent paper (Lokshtanov et al. [16]) using the notion of rankwidth. We have provided a conceptually simpler and faster algorithm for the problem when the input is a split graph. Our result in Theorem 5.5 also implies that Cograph Contraction admits no polynomial kernel unless N P ⊆ coN P/poly. Although we have proved that contracting general graphs to split graphs and contracting split graphs to threshold graphs are both F P T , our results do not imply the fixed-parameter tractability for Threshold Contraction on general graphs since our algorithm for Split Contraction does not find all split graphs obtained by contractions. It remains open whether Threshold Contraction is FPT for general graphs. References [1] Belmonte, R., Heggernes, P., van't Hof, P.: Edge contractions in subclasses of chordal graphs. Discrete Applied Mathematics 160, 999 -- 1010 (2012) [2] Bodlaender, H.L., Thomass´e, S., Yeo, A.: Kernel bounds for disjoint cycles and disjoint paths. In: ESA 2009. LNCS, vol. 5757, pp. 635 -- 646. Springer, Heidelberg (2009) [3] Bodlaender, H.L., Downey, R.G., Fellows, M.R., Hermelin, D.: On problems without polynomial kernels (extended abstract). In: ICALP 2008, Part I. LNCS, vol. 5125, pp. 563 -- 574. Springer, Heidelberg (2008) [4] Cai, L.: Fixed-parameter tractability of graph modification problems for hereditary properties. Information Processing Letters 58, 171 -- 176 (1996) 13 [5] Cai, L., Guo, C.: Contracting few edges to remove forbidden induced subgraphs. Manuscript. (extended abstract) In: IPEC 2013. To appear. [6] Chen, J., Meng, J.: A 2k kernel for the cluster editing problem. In: COCOON 2010. LNCS, vol. 6196, pp. 459 -- 468. Springer, Heidelberg (2010) [7] Dom, M., Lokshtanov, D., Saurabh, S.: Incompressibility through colors and IDs. In: ICALP 2009. LNCS, vol. 5555, pp. 378 -- 389. Springer, Heidelberg (2009) [8] Feige, U., Halldorsson, M.M., Kortsarz, G., Srinivasan, A.: Approximating the Domatic Number. SIAM Journal on computing 32(1), 172 -- 195 (2002) [9] Ghosh, E., Kolay, S., Kumar, M., Misra, P., Panolan, F., Rai, A., Ramanujan, M.: Faster parameterized algorithms for deletion to split graphs. In: SWAT 2012. LNCS, vol. 7357, pp. 107 -- 118. Springer, Heidelberg (2012) [10] Golovach, P.A., Kami´nski, M., Paulusma, D., Thilikos, D.M.: Increasing the minimum degree of a graph by contractions. Theoretical Computer Science 481, 74 -- 84 (2013) [11] Golovach, P.A., van't Hof, P., Paulusma, D.: Obtaining planarity by contracting few edges. Theoretical Computer Science 476, 38 -- 46 (2013) [12] Guo, J.: Problem kernels for NP-complete edge deletion problems: split and related graphs. In: ISAAC 2007. LNCS, vol. 4835, pp. 915 -- 926. Springer, Heidelberg (2007) [13] Heggernes, P., van't Hof, P., L´eveque, B., Lokshtanov, D., Paul, C.: Contracting graphs to paths and trees. In: IPEC 2011. LNCS, vol. 7112, pp. 55 -- 66. Springer, Heidelberg (2011) [14] Heggernes, P., van't Hof, P., Lokshtanov, D., Paul, C.: Obtaining a bipartite graph In: FSTTCS 2011. LIPIcs, vol. 13, pp. 217 -- 228. Schloss by contracting few edges. Dagstuhl, Leibniz-Zentrum fur Informatik (2011) [15] Lin, G.-H., Kearney, P.E., Jiang, T.: Phylogenetic k-root and Steiner k-root. In: ISAAC 2000. LNCS, vol. 1969, pp. 539 -- 551. Springer, Heidelberg (2000) [16] Lokshtanov, D., Misra, N., Saurabh, S.: On the hardness of eliminating small induced subgraphs by contracting edges. In: IPEC 2013. To appear. 14
1511.07412
1
1511
2015-11-23T20:48:29
Approximation Algorithms for Route Planning with Nonlinear Objectives
[ "cs.DS" ]
We consider optimal route planning when the objective function is a general nonlinear and non-monotonic function. Such an objective models user behavior more accurately, for example, when a user is risk-averse, or the utility function needs to capture a penalty for early arrival. It is known that as nonlinearity arises, the problem becomes NP-hard and little is known about computing optimal solutions when in addition there is no monotonicity guarantee. We show that an approximately optimal non-simple path can be efficiently computed under some natural constraints. In particular, we provide a fully polynomial approximation scheme under hop constraints. Our approximation algorithm can extend to run in pseudo-polynomial time under a more general linear constraint that sometimes is useful. As a by-product, we show that our algorithm can be applied to the problem of finding a path that is most likely to be on time for a given deadline.
cs.DS
cs
Approximation Algorithms for Route Planning with Nonlinear Objectives Ger Yang Electrical and Computer Engineering University of Texas at Austin [email protected] Evdokia Nikolova Electrical and Computer Engineering University of Texas at Austin [email protected] 5 1 0 2 v o N 3 2 ] S D . s c [ 1 v 2 1 4 7 0 . 1 1 5 1 : v i X r a Abstract We consider optimal route planning when the objective func- tion is a general nonlinear and non-monotonic function. Such an objective models user behavior more accurately, for exam- ple, when a user is risk-averse, or the utility function needs to capture a penalty for early arrival. It is known that as nonlinearity arises, the problem becomes NP-hard and little is known about computing optimal solutions when in addi- tion there is no monotonicity guarantee. We show that an ap- proximately optimal non-simple path can be efficiently com- puted under some natural constraints. In particular, we pro- vide a fully polynomial approximation scheme under hop constraints. Our approximation algorithm can extend to run in pseudo-polynomial time under a more general linear con- straint that sometimes is useful. As a by-product, we show that our algorithm can be applied to the problem of finding a path that is most likely to be on time for a given deadline. Introduction In this paper, we present approximation algorithms for route planning with a nonlinear objective function. Tradition- ally, route planning problems are modeled as linear shortest path problems and there are numerous algorithms, such as Bellman-Ford or Dijkstra's algorithm, that are able to find the optimal paths efficiently. However, nonlinearity arises when we would like to make more complicated decision- making rules. For example, in road networks, the objective might be a nonlinear function that represents the trade-off between traveling time and cost. Unfortunately, dynamic programming techniques used in linear shortest path algo- rithms no longer apply as when nonlinearity appears, sub- paths of optimal paths may no longer be optimal. Applications include risk-averse routing or routing with a nonlinear objective when we are uncertain about the traffic conditions (Nikolova, Brand, and Karger 2006; Nikolova et al. 2006). A risk-averse user tends to choose a route based on both the speediness and reliability. Such risk- averse attitude can often be captured by a nonlinear ob- jective, e.g. a mean-risk objective (Nikolova 2010). On the other hand, the user might seek a path that maximizes the probability for him to be on time given a deadline. This ob- jective was considered by Nikolova (2010) to capture the risk-averse behavior. For Gaussian travel times, the latter paper only considered the case where at least one path has if literature mean travel time less than the deadline, and consequently the objective function can be modeled as a monotonic function. The problem of finding a path that minimizes a monotonic increasing objective has been studied in (Goyal and Ravi 2013; Nikolova 2010; the Tsaggouris and Zaroliagis 2009). What there is no monotonicity guarantee? For example, consider the dead- line problem when we know that all paths have mean travel time longer than the deadline, or consider the well-known cost-to-time ratio objective (Megiddo 1979; Gu´erin and Orda 1999) in various combinatorial optimiza- tion problems. Without the monotonicity assumption, the problem usually becomes very hard. It has been shown (Nikolova, Brand, and Karger 2006) a general objective function, finding the optimal simple path is NP-hard. This is because such a problem often involves finding the longest path for general graphs, which is known to be a strongly NP-hard problem (Karger, Motwani, and Ramkumar 1997), namely finding a constant-factor approximation is also NP-hard. This sug- gests that for a very general class of functions, including the cost-to-time ratio objective (Ahuja, Batra, and Gupta 1983), not only is the problem itself NP-hard but so is also its approximation counterpart. that for Therefore, in this paper, we focus on the problem that ac- cepts non-simple paths, in which it is allowed to visit nodes more than once. To make this problem well-defined, we con- sider the problem under either a hop constraint or an addi- tional linear constraint, where we say a path is of γ hops if it contains γ edges. We design a fully polynomial approxima- tion scheme under hop constraints, and show that the algo- rithm can extend to run in pseudo-polynomial time under an additional linear constraint. Further, we show how our algo- rithm can be applied to the cost-to-time ratio objective and the deadline problem. Related Work The route planning problem with nonlinear objective we consider here is related to multi-criteria optimization (e.g., Papadimitriou and Yannakakis 2000). The solutions to these problems typically look for approximate Pareto sets, namely a short list of feasible solutions that provide a good approx- imation to any non-dominated or optimal solution. A fully polynomial approximation scheme (FPTAS) for route plan- ning with general monotonic and smoothed objective func- tions was presented by Tsaggouris and Zaroliagis (2009), based on finding an approximate Pareto set for the feasi- ble paths. Later, Mittal and Schulz (2013) provided a general approach for monotonic and smoothed combinatorial opti- mization problems and showed how to reduce these prob- lems to multi-criteria optimization. A special class of nonlinear optimization is quasi- concave minimization. This class of problems has the property that the optimal solution is an extreme point of the feasible set (Horst, Pardalos, and Van Thoai 2000). For quasi-concave combinatorial minimization problems, Kelner and Nikolova (2007) proved (log n)-hardness of ap- proximation and they also gave an additive approximation algorithm for low-rank quasi-concave functions based on smoothed analysis. Later, Nikolova (2010) presented an FP- TAS for risk-averse quasi-concave objective functions. In re- cent work, Goyal and Ravi (2013) gave an FPTAS for gen- eral monotone and smooth quasi-concave functions. Without assuming monotonicity, the problem was studied by Nikolova, Brand, and Karger (2006), who proved hard- ness results and gave a pseudo-polynomial approximation algorithm with integer edge weights for some specific ob- jective functions. Problem Statement and Preliminaries Consider a directed graph G = (V, E). Denote the number of vertices as V = n, and the number of edges as E = m. Suppose we are given a source node s and a destination node t. In the nonlinear objective shortest path problem, we seek an s − t path p, possibly containing loops, that minimizes some nonlinear objective function f (p). More precisely, denote the feasible set of all s − t paths by Pt, and let P = Sv∈V Pv be the set of paths that start from s. Here we have not yet imposed assumptions that P contains only simple paths. Let f : P → R+ be a given objective function. Then we can write the problem as finding the path p∗ that minimizes this objective function: p∗ = arg min p∈Pt f (p) (1) We assume that f is a low-rank nonlinear function with some smoothness condition. Specifically, we say that f is of rank d if there exists a function g : Rd + → R+ and an m × d weight matrix W = (we,k)m×d, with pos- itive entries, such that for any path p ∈ P, f (p) = g(Pe∈p we,1,Pe∈p we,2, . . . ,Pe∈p we,d). We interpret this as having d criteria, such as for example length in miles, cost, travel time, etc. so that each edge is associated with d additive weights, where the k-th weight for edge e is denoted by we,k. Then, the k-th weights of all edges can be represented by the column vector wk = (w1,k, w2,k, . . . , wm,k)T . For simplicity, we denote the sum of the k-th weights of the edges along path p as lk(p) = Pe∈p we,k, and we call it the k-th criterion of path p. Hence, the objective function f can be rewritten as a function of all criteria: f (p) = g(l1(p), l2(p), . . . , ld(p)) (2) Figure 1: Illustration of a path polytope on a doubly weighted graph with a hop constraint. Each blue cross and red dot correspond to an s − t path projected onto W. We can use polynomially many red dots to approximate the path polytope and consequently to approximate the optimal path. Consider the linear space spanned by the d criteria W = span(w1, w2, . . . , wd). Then, each feasible s − t path p ∈ Pt has an associated point in this d-dimensional space W given by l(p) = (l1(p), l2(p), . . . , ld(p)), providing the val- ues of the d criteria for that path. We shall call the con- vex hull of such points the path polytope.1 We assume that the weights matrix W contains only positive entries, and thus the path polytope is bounded from below: for any path p ∈ Pt and criterion k ∈ {1, . . . , d}, we have lk(p) ≥ minp′∈Pt lk(p′). This lower-bound corresponds to the short- est path with respect to the k-th criterion. For upper bounds of the polytope, we defer the discussion to the later sections. The size of the path polytope is in worst case exponential in the problem size. The main idea of this paper is to ap- proximate the path polytope with polynomially many paths, as illustrated in Figure 1. As we will show in this paper, the optimal path can be approximated if there are some smooth- ness conditions on the objective function. The smoothness assumption we adapt here is as follows: g is assumed to be β- Lipschitz on the log-log scale with respect to the L1-norm: that is, for any y, y′ in the path polytope, log g(y) − log g(y′) ≤ βk log y − log y′k1 (3) where log y is defined as a column vector: (log y1, log y2, . . . , log yd)T . log y = In this paper, we design approximation algorithms for this problem, formally defined as follows: Definition 1. An α-approximation algorithm for a mini- mization problem with optimal solution value OP T and α > 1 is a polynomial-time algorithm that returns a solu- tion of value at most αOP T . 1Strictly speaking, it is the projection of the feasible path poly- tope in Rm onto this d-dimensional subspace but for simplicity we will just call it the path polytope in this paper. The best possible approximation algorithms provide solu- tions that are arbitrarily close to the optimal solution: Definition 2. A fully-polynomial approximation scheme (FPTAS) is an algorithm for an optimization problem that, given desired accuracy ǫ > 0, finds in time polynomial in 1 ǫ and the input size, a solution of value OP T ′ that satisfies OP T − OP T ′ ≤ ǫOP T , for any input, where OP T is the optimal solution value. Hardness Results We can categorize the problem on general directed graphs into two types: one is the problem that accepts only sim- ple paths, by which we mean each vertex can only be vis- ited once in any feasible path; the other is the problem that accepts non-simple paths. Unfortunately, both types of problems turn out to be hard. In fact, the problem that only accepts simple paths in general involves finding the longest simple path, which is strongly NP-hard, namely it is NP-hard to approximate to within any constant factor (Karger, Motwani, and Ramkumar 1997). First, we present a natural objective function that has been considered in the literature, that is hard to approximate. Minimum Cost-to-Time Ratio Path Problem The cost-to-time ratio objective function is a rank 2 function, defined as follows: f (p) = g(cid:18)Xe∈p we,1,Xe∈p we,2(cid:19) = Pe∈p we,1 Pe∈p we,2 strictly has function different previously optimization simplicity, we entries. This assume W has objective for problems For pos- itive been considered combina- torial (Megiddo 1979; Correa, Fernandes, and Wakabayashi 2010). However, find- ing the minimum cost-to-time ratio simple path is known to be an NP-hard problem (Ahuja, Batra, and Gupta 1983). Here, we show its hardness of approximation: Theorem 1. There is no polynomial-time α-approximation algorithm for the minimum cost-to-time ratio simple path problem for any constant factor α, unless P = N P . Proof. To facilitate the presentation of our hardness of approximation proof, we first show that this prob- lem is NP-hard. We reduce a longest path problem instance to a minimum cost-to-time ratio simple path problem instance. The longest path problem is known to be NP-hard to approximate to within any constant factor (Karger, Motwani, and Ramkumar 1997). First, we choose some λ > 0. For an instance of the longest path problem, which is some graph G with unweighted edges and a designated source node s and sink node t, we create an in- stance of the minimum cost-to-time ratio path problem with the same graph G, source s and sink t and the following (cost,time) edge weights: 1. For each edge e incident to s, set we = (λn + 1, 1). 2. For the remaining edges e, set we = (1, 1). We can see that a path is optimal under the ratio objective if and only if it is the longest path with respect to the un- weighted edges (or, equivalently, with respect to the sec- ond weight). This shows that the minimum cost-to-time ratio simple path problem is NP-hard. To show the hardness of approximation, similarly, we use the fact that the longest path problem cannot be ap- proximated to within any constant factor unless P = N P (Karger, Motwani, and Ramkumar 1997). Suppose the con- trary, namely that we can find a (1 + ǫ)-approximation algo- rithm for the minimum cost-to-time ratio simple path prob- lem, for some ǫ ∈ (0, λ). To be precise, since we can choose λ while ǫ comes from the assumed approximation algorithm, we can set λ > ǫ. For a given instance of longest path, con- sider the corresponding instance of minimum cost-to-time ratio path problem above. Let p∗ be the optimal min cost-to- time ratio path. Then, the (1 + ǫ)-approximation algorithm will return a simple path p such that λn + l2(p) l2(p) ≤ (1 + ǫ) λn + l2(p∗) l2(p∗) Rearranging this, we get the inequality: (λn − ǫl2(p))l2(p∗) ≤ λ(1 + ǫ)nl2(p) Since l2(p) ≤ n and ǫ < λ, we get the following: l2(p∗) ≤ λ(1 + ǫ) λ − ǫ l2(p) This shows that we can approximate the longest path prob- lem to within a constant factor of λ(1+ǫ) λ−ǫ , a contradiction. Therefore, the minimum cost-to-time ratio simple path prob- lem cannot be approximated to within any constant factor unless P = N P . General Objective Function For general objective functions, the following hardness re- sults were proven by Nikolova, Brand, and Karger (2006): Fact 1. Suppose function g attains a global minimum at y > 0. Then problem (1) of finding an optimal s − t simple path is NP-hard. Fact 2. Consider problem (1) of finding an optimal s − t simple path with f being a rank-1 function. Let p∗ be the optimal path, and l∗ = l(p∗). If g is any strictly decreasing and positive function with slope of absolute value at least λ > 0 on [0, l∗], then there does not exist a polynomial- time constant factor approximation algorithm for finding an optimal simple path, unless P = N P . Although these facts are proven for rank-1 functions, they show that for a large class of objective functions, the prob- lem of finding the optimal simple path is not only NP-hard, but also NP-hard to approximate within any constant factor. As a result, we turn our attention to the problem that accepts non-simple paths. While this problem is also NP- hard (Nikolova, Brand, and Karger 2006), we are able to de- sign a polynomial-time algorithm to approximate the opti- mal solution arbitrarily well. Approximation Algorithms Consider problem (1) that accepts non-simple paths. For some cases, it is possible that there does not exist an opti- mal path of finite length. Consider an example of a rank 1 monotonic decreasing function g(x) = 1/x. Suppose there is a positive weight loop in any of the s − t paths. Then, we can always find a better solution by visiting such a loop arbitrarily many times: the optimal path here is ill-defined. Naturally, for the problem that accepts non-simple paths, the path polytope is infinite. Even when the optimal path is finite, for a large class of problems, including the minimum cost-to-time ratio path problem, finding a finite subset of the path polytope that contains the optimal path is difficult, as shown in our Hardness section above. In this section, we will show that, under some additional constraints, this prob- lem becomes well-defined and well-approximable. In what follows, we identify the additional constraints and present the algorithms to solve the corresponding problems. Hop Constraint Suppose the path contains at most γ hops, then the set of feasible paths Pt becomes finite and the problem is well- defined. Denote hop(p) to be the number of hops in path p, or equivalently, the number of edges in p. Note that an edge can be counted multiple times if path p contains loops. k k k k /cmin , γcmax , γcmax k=1[cmin ], for each criterion k ∈ {1, . . . , d}. To approximate the optimal path, we approximate the path polytope with polynomially many paths, and then search for the best one among them. To approximate the path poly- tope, we first identify a region of weights space W that con- tains all paths starting from s, which are within γ edges. We can upper- and lower-bound this region as follows: For each criterion k = 1, . . . , d, define cmin k = mine∈E we,k k = maxe∈E we,k. Then for any path p that starts and cmax from the source s and contains at most γ edges, we have lk(p) ∈ [cmin Next, we partition the region Qd ] of the weights space W into polynomially many hypercubes. Specifically, for each criterion k ∈ {1, 2, . . . , d}, let ǫ > 0 be a given desired approximation factor, and Ck = . Define Γk = {0, 1, . . . ,⌊log(1+ǫ)(γCk)⌋} as the cmax k set of points that evenly partitions the segment [cmin , γcmax ] on the log scale. Then, we generate a d-dimensional lattice Γ = Γ1×Γ2×···×Γd according to these sets. After that, we define a hash function h = (h1, h2, . . . , hd) : P → Γ that maps a path to a point on the lattice Γ. Each hk : P → Γk is defined as hk(p) = ⌊log(1+ǫ) The main part of the algorithm iterates over i ∈ {1, 2, . . . , γ}, sequentially constructing s− v sub-paths con- taining at most i edges, for each vertex v ∈ V . For each iteration i and each vertex v ∈ V , we maintain at most Γ configurations as a d-dimensional table Πi v, indexed by v(y) can be either an s − v y ∈ Γ. Each configuration Πi path p of at most i edges and h(p) = y, given there is one, or null otherwise. The table can be implemented in various ways. 2 Here we assume that given index y ∈ Γ, both check- 2In practice, we can either allocate the memory of the entire table in the beginning, or use another data structure that only stores lk(p) cmin k ⌋. k k k v(y), and inserting/updating a path in Πi v(y) is null, retrieving the v(y) can ing whether the configuration Πi path in Πi be done in TΠ = TΠ(n,Γ) time. At iteration i, for each vertex u, we will construct a set of s − u sub-paths containing i edges based on (i − 1)-edge sub-paths we previously constructed. We loop over each ver- tex v ∈ V and each edge e = (v, u) incident to v, and we append the edge to the end of each (i− 1)-edge s− v path in . However, not all generated sub-paths will be stored. Πi−1 Consider any s − u path p generated with this procedure, it will be stored in table Πi u(h(p)) is empty. With this technique, we can ensure that the number of sub-paths we record in each iteration is at most polynomial, because it is bounded by the size of the lattice Γ times the number of vertices. This procedure is outlined in Algorithm 1. u only if Πi v Set Πi v(y) = null s = {s}. Algorithm 1 Nonlinear Objective Shortest Path with Hop- constraint 1: for each y ∈ Γ, v ∈ V , and i = 1, 2, . . . , γ do 2: 3: Set Π0 4: for i = 1 to γ do v = Πi−1 5: 6: 7: 8: 9: Set Πi for each vertex v ∈ V do for each path p ∈ Πi−1 for each edge e = (v, u) ∈ E do v with i − 1 edges do for each vertex v ∈ V . v Set p′ be the path that appends edge e to the tail of p. Compute hash y = h(p′). if Πi Πi u(y) = null then u(y) = p′. 10: 11: 12: 13: return maxp∈Πγ t f (p) To prove the correctness of this algorithm, we show the following lemmas: Lemma 1. Let pu and p′u be two s − u paths such that for each criterion k ∈ {1, 2, . . . , d}, log lk(pu) − log lk(p′u) ≤ log(1 + ǫ). (4) Suppose there is a vertex v and an edge e such that e = (u, v) ∈ E. Let pv and p′v be the s − v paths that append (u, v) to the tails of pu and p′u, respectively. Then, for each criterion k ∈ {1, 2, . . . , d}, log lk(pv) − log lk(p′v) ≤ log(1 + ǫ) Proof. By (4), it directly follows that lk(pv) = lk(pu) + lk(e) ≤ (1 + ǫ)lk(p′u) + lk(e) ≤ (1 + ǫ)(lk(p′u) + lk(e)) = (1 + ǫ)lk(p′v) lk(p′v) = lk(p′u) + lk(e) ≤ (1 + ǫ)lk(pu) + lk(e) ≤ (1 + ǫ)(lk(pu) + lk(e)) = (1 + ǫ)lk(pv) Combining the above two inequalities yields the proof. the used entries of the table. According to our experimental results, only a small portion of the table Πi v will be used. Lemma 2. For any v ∈ V , and for any path s − v that is of at most i edges, there exists an s − v path p′ ∈ Πi v such that for each criterion k ∈ {1, 2, . . . , d}, log lk(p) − log lk(p′) ≤ i log(1 + ǫ) Proof. We prove this lemma by induction on the number of edges in a path. The base case is a direct result from the def- inition of the hash function h. For the induction step, con- sider vertex v ∈ V , and we would like to prove the statement is correct for any s − v sub-paths of at most i∗ edges, given the statement is true for any i < i∗ and any vertices. Let pv be any s − v path no more than i∗ edges. If pv is of i′ < i∗ edges, then by the induction hypothesis, there exists an s− v path p′v in Πi′ v such that log(lk(pv)/lk(p′v)) ≤ i′ log(1+ǫ). The lemma is proved for this case since p′v is in Πi∗ v as well. Next consider pv to be an s− v path with i∗ edges, and sup- pose pv is formed by appending the edge (u, v) to an s − u path pu. By the induction hypothesis, we can see that there is an s − u path p′u ∈ Πi∗−1 such that for each criterion k ∈ {1, 2, . . . , d}, u log lk(pu) − log lk(p′u) ≤ (i∗ − 1) log(1 + ǫ) Then, with Lemma 1, as we form s − v sub-paths pv and p′v by appending (u, v) to the end of pu and p′u respectively, we have the following relationship for each criterion k ∈ {1, 2, . . . , d}: log lk(pv) − log lk(p′v) ≤ (i∗ − 1) log(1 + ǫ) (5) Consider any s − v path p′′v such that h(p′′v ) = h(p′v). We must have log lk(p′v) − log lk(p′′v ) ≤ log(1 + ǫ) for each criterion k ∈ {1, . . . , d}, according to the definition of the hash function h. Combining this with (5), we can see that even for the case that path p′v is not stored in the table Πi∗ v , the path p′′v = Πi∗ v (h(p′v)) must satisfy log lk(pv) − log lk(p′′v ) ≤ i∗ log(1 + ǫ) for each criterion k ∈ {1, . . . , d}. This indicates that for any s − v path pv within i∗ edges, there exists a path p′′v in Πi∗ such that their ratio is bounded by (1 + ǫ)i∗. Q.E.D. v Now, we are ready to state and prove the main result: Theorem 2. Suppose g defined in (2) is β-Lipschitz on the log-log scale. Then Algorithm 1 is a (1 + ǫ)βdγ- approximation algorithm for the γ-hop-constrained nonlin- ear objective shortest path problem. Besides, Algorithm 1 has time complexity O(γm( log(γC) log(1+ǫ) )dTΠ), where C = maxk∈{1,2,...,d} Ck. Proof. By Lemma 2, we can see that for any s − t path p of at most γ edges, there exists an s − t path p′ ∈ Πγ t such that log lk(p) − log lk(p′) ≤ γ log(1 + ǫ), ∀k = 1, 2, . . . , d It then follows from (3) that our algorithm finds a path p′ such that log f (p′) − log f (p∗) ≤ βdγ log(1 + ǫ). Then, we have f (p′) ≤ (1 + ǫ)βdγf (p∗) This shows that p′ is an (1 + ǫ)βdγ-approximation to p∗. Next, we show the time complexity. It is easy to see that at each iteration, the algorithm generates at most mΓ sub- paths. Each sub-path requires at most O(TΠ) time to oper- ate. Since Γ = ( log(γC) log(1+ǫ) )d, we can conclude that Algo- rithm 1 runs in time O(γm( log(γC) log(1+ǫ) )dTΠ). Note that we can obtain a (1+δ)-approximation algorithm by setting δ = (1 + ǫ)βdγ − 1. With this setting, then Algo- rithm 1 has time complexity O(γm( βdγ log(γC) )dTΠ). If we assume γ = O(n), then Algorithm 1 is indeed an FPTAS. δ Rm Linear Constraint The hop constraint we considered can be relaxed: we now consider the more general problem that any returned path p must satisfy an additional linear constraint Pe∈p we,d+1 ≤ b, for some budget b > 0 and some weight vector wd+1 ∈ ++ with strictly positive entries. We define the (d + 1)-th criterion ld+1(p) = Pe∈p we,d+1, which can be interpreted as having a budget b for a path. To solve this problem, we can find an upper bound of the number of edges for any feasible s − t path. A simple upper bound can be given by + hopmin(cid:25) γ = (cid:24) b −Pe∈p∗d+1 we,d+1 (6) mine∈E we,d+1 where p∗d+1 = arg minp∈P Pe∈p we,d+1 is the shortest path with respect to the weight wd+1, and hopmin is the mini- mum number of edges for any s − t path. Note that either hopmin and p∗d+1 can be solved by Dijkstra's or Bellman- Ford's shortest path algorithms efficiently. Then, we can adapt the techniques discussed for the hop- constrained problem but with some modifications. Instead of assigning the least hop path to a configuration, we now as- sign the path with the least (d+ 1)-th criterion. Formally, the modification is to change line 11 and line 12 of Algorithm 1 u(y) if p′ satisfies both of the following: to : Assign p′ to Πi • ld+1(p′) < b • Πi u(y) is null or ld+1(p′) < ld+1(Πi As a corollary of Theorem 2, we have the following result: Corollary 1. Algorithm 1 with the modifications stated above is a (1 + ǫ)βdγ-approximation algorithm for the linear-constrained nonlinear objective shortest path prob- lem, where γ is defined as in Eq. (6). u(y)) Application: Deadline Problem With the techniques mentioned in the above section, we are able to solve various problems, including the minimum cost- to-time ratio path problem with either a hop or a linear bud- get constraint. In this section, we discuss a related problem, which is the deadline problem in a stochastic setting. The deadline problem is to find a path that is the most likely to be on time, which is defined as follows: Suppose each edge is associated with an independent random vari- able Xe, which we call the travel time of edge e. Given a deadline D > 0, we are going to find an s − t path such that the probability of being on time is maximized: Table 1: Deadline Problem with Hop Constraint Network Hops 5 × 5 Grid 10 × 10 Grid Anaheim 12 12 15 15 15 Worst-case Theoretical Accuracy (α) (Exhaustive) 2.2923 2.2926 2.2891 3.0436 Memory Usage (106 paths) 1.63 0.67 4.30 Run time (s) 3.441 2.057 20.276 18.05 83.430 9.60 37.671 maxp∈Pt Pr(Pe∈p Xe < D). We assume that the random variables {Xe} are Gaussian. Based on this, we denote the mean travel time for edge e as µe and variance as σ2 e . For simplicity, we assume for each edge e ∈ E, its mean µe e are bounded by µe ∈ [µmin, µmax], and and variance σ2 max]. The problem can hence be written as: min, σ2 σ2 e ∈ [σ2 max p∈Pt Φ(cid:18) D −Pe∈p µe qPe∈p σ2 e (cid:19) (7) where Φ(·) is the cumulative distribution function for the standard normal distribution. The objective function in (7) is a rank 2 function. This problem is studied in (Nikolova et al. 2006) for a risk-averse shortest path prob- lem, where they considered the case that the optimal path has mean travel time less than the deadline: for this case (7) is a monotonic decreasing function. In this paper, we con- sider the case that all feasible s − t paths have mean travel time strictly greater than the deadline. This means that we assume each path has poor performance. Then, the objec- tive function in (7) becomes monotonic decreasing with re- spect to the mean but monotonic increasing with respect to the variance, for which known algorithms no longer apply. However, we are able to use techniques presented in this pa- per to solve this problem under either a hop or an additional linear constraint. Theorem 3. Suppose each s − t path p ∈ Pt satisfies Pe∈p µe > D and Pe∈p σ2 e > S. For the deadline prob- lem with a hop constraint γ, if Algorithm 1 returns some path p′ such that f (p′) > Φ(−3) ≈ 0.0013, then p′ is an α-approximation for the deadline problem, where α = min{384.62, (1 + ǫ)6.568(3+ D )γ)}. Similarly, if p′ is such that f (p′) > Φ(−2) ≈ 0.023, then α = min{21.93, (1 + ǫ)4.745(2+ D √S √S Note that this theorem does not guarantee Algorithm 1 admits FPTAS for the deadline problem, since given α, the running time is polynomial in the factor D/√S. )γ}. Experimental Evaluations We tested our algorithm on a grid graph and a real trans- portation network. The algorithm is implemented in C++. Experiments are run on an Intel Core i7 1.7 GHz (I7-4650U) processor. Due to memory constraints, the table {Πi vv ∈ V } is implemented as a binary search tree, where query, in- sertion, and update operations can be done in time TΠ = Figure 2: Memory usage for running our algorithm on a 5×5 grid graph to the number of iterations. vv ∈ V }. O(log(nΓ)). Memory turns out to be the limiting factor for the problem size and accuracy available to our experiments. In this section, memory usage refers to the total number of sub-paths maintained in the table {Πi We tested the deadline problem with a hop constraint on a 5 × 5 grid graph, 10 × 10 grid graph, and the Anaheim network (416 vertices, 914 edges) from the real world data set (Bar-Gera 2002). The grid graphs are bi-directional, and the mean and the variance for each edge are randomly gener- ated from [0.1, 5]. We routed from node (0, 0) to node (4, 4) on the 5 × 5 grid, and from (1, 1) to (8, 8) on the 10 × 10 grid. The Anaheim dataset provides the mean travel time. The variance for each edge is randomly generated from 0 to the mean. The source and destination are randomly chosen. Table 1 summarizes the results on the datasets, which are the average of 20 experiments. Even though theoretically the algorithm can be designed for arbitrary desired accuracy, it is limited by the memory of the environment.3 However, com- paring with exhaustive search, we found that the practical accuracy is 100% on 5 × 5 grid graphs.4 This means that our algorithm is far more accurate than its theoretical worst case bound. We explain this phenomenon through Figure 2, which shows the number of sub-paths generated up to each iteration. We see that the number of sub-paths generated in the initial iterations grows exponentially, just as in exhaus- tive search, but levels off eventually. Recall Lemma 2, which tells us that an error is induced when a sub-path is eliminated due to similarity to a saved sub-path, and Figure 2 suggests that this rarely happens in the initial iterations. Conclusion We investigated the shortest path problem with a general nonlinear and non-monotonic objective function. We proved 3It takes about 3GB physical memory usage for the 18M paths in the 10 × 10 grid network. 4Exhaustive search becomes prohibitive for paths with more than 12 hops on 5 × 5 grid graphs. that this problem is hard to approximate for simple paths and consequently, we designed and analyzed a fully polynomial approximation scheme for finding the approximately opti- mal non-simple path under either a hop constraint or an ad- ditional linear constraint. We showed that this algorithm can be applied to the cost-to-time ratio problem and the dead- line problem. Our experiments show that our algorithm is capable of finding good approximations efficiently. Acknowledgement This work was supported in part by NSF grant numbers CCF-1216103, CCF-1350823, CCF-1331863, and a Google Faculty Research Award. References [Ahuja, Batra, and Gupta 1983] Ahuja, R.; Batra, J.; and Gupta, S. 1983. Combinatorial optimization with rational objective functions: A communication. Mathematics of Op- erations Research 8(2):314 -- 314. [Bar-Gera 2002] Bar-Gera, H. 2002. Transportation network test problems. [Correa, Fernandes, and Wakabayashi 2010] Correa, J.; Fer- nandes, C. G.; and Wakabayashi, Y. 2010. Approximat- ing a class of combinatorial problems with rational objective function. Mathematical programming 124(1-2):255 -- 269. [Goyal and Ravi 2013] Goyal, V., and Ravi, R. 2013. An fptas for minimizing a class of low-rank quasi-concave functions over a convex set. Operations Research Letters 41(2):191 -- 196. [Gu´erin and Orda 1999] Gu´erin, R. A., and Orda, A. 1999. Qos routing in networks with inaccurate information: the- ory and algorithms. IEEE/ACM Transactions on Networking (TON) 7(3):350 -- 364. [Horst, Pardalos, and Van Thoai 2000] Horst, R.; Pardalos, P. M.; and Van Thoai, N. 2000. Introduction to global opti- mization. Springer Science & Business Media. [Karger, Motwani, and Ramkumar 1997] Karger, D.; Mot- wani, R.; and Ramkumar, G. 1997. On approximating the longest path in a graph. Algorithmica 18(1):82 -- 98. [Kelner and Nikolova 2007] Kelner, J. A., and Nikolova, E. 2007. On the hardness and smoothed complexity of quasi- concave minimization. In Foundations of Computer Science, 2007. FOCS'07. 48th Annual IEEE Symposium on, 472 -- 482. IEEE. [Megiddo 1979] Megiddo, N. 1979. Combinatorial opti- mization with rational objective functions. Mathematics of Operations Research 4(4):414 -- 424. [Mittal and Schulz 2013] Mittal, S., and Schulz, A. S. 2013. An fptas for optimizing a class of low-rank functions over a polytope. Mathematical Programming 141(1-2):103 -- 120. [Nikolova et al. 2006] Nikolova, E.; Kelner, J. A.; Brand, M.; and Mitzenmacher, M. 2006. Stochastic shortest paths via quasi-convex maximization. In Algorithms -- ESA 2006, 552 -- 563. Springer. [Nikolova, Brand, and Karger 2006] Nikolova, E.; Brand, M.; and Karger, D. R. 2006. Optimal route planning un- der uncertainty. In ICAPS, volume 6, 131 -- 141. [Nikolova 2010] Nikolova, E. 2010. Approximation algo- rithms for offline risk-averse combinatorial optimization. [Papadimitriou and Yannakakis 2000] Papadimitriou, C. H., and Yannakakis, M. 2000. On the approximability of trade- offs and optimal access of web sources. In Foundations of Computer Science, 2000. Proceedings. 41st Annual Sympo- sium on, 86 -- 92. IEEE. [Tsaggouris and Zaroliagis 2009] Tsaggouris, G., and Zaro- liagis, C. 2009. Multiobjective optimization: Improved fp- tas for shortest paths and non-linear objectives with applica- tions. Theory of Computing Systems 45(1):162 -- 186. Appendix: Missing Proofs Proof of Corollary 1 We need the following modified version of Lemma 2 to prove Corollary 1: Lemma 3. For any v ∈ V , and for any path s − v that is of at most i edges, there exists an s − v path p′ ∈ Πi v such that 1 (1 + ǫ)i ≤ lk(p) lk(p′) ≤ (1 + ǫ)i, ∀k = 1, 2, . . . , d and ld+1(p′) ≤ ld+1(p) Proof. We prove this lemma by induction on the number of edges in a path as what we have done in Lemma 2. The base case is a direct result from the definition of the hash function h. For the induction step, consider vertex v ∈ V , and we would like to prove the statement is correct for any s − v sub-paths of at most i∗ edges, given the statement is true for any i < i∗ and any vertices. Let pv be any s − v path of no more than i∗ edges. First consider the case that the path pv is of i′ < i∗ edges, then by induction hypothesis, there exists an s − v path p′v in Πi′ such that lk(pv)/lk(p′v) ≤ (1+ǫ)i′. Then consider the s−v path p′′v ∈ Πi∗ v such that h(p′′v ) = h(p′v). By the definition of the hash function h, it must hold that v 1 1 + ǫ ≤ Then we have lk(p′v) lk(p′′v ) ≤ 1 + ǫ, ∀k = 1, 2, . . . , d 1 1 lk(pv) lk(p′′v ) ≤ (1 + ǫ)i′+1, (1 + ǫ)i′+1 ≤ ∀k = 1, 2, . . . , d By the induction hypothesis and the replacement rule in the algorithm, we have ld+1(p′′v ) ≤ ld+1(p′v) ≤ ld+1(pv). Therefore the lemma is proved for this case. Next consider the case that pv is s− v path with i∗ edges, and suppose pv is formed by appending the edge (u, v) to an s − u path pu. By the induction hypothesis, we can see that there is an s − u path p′u ∈ Πi∗−1 (1 + ǫ)i∗−1 ≤ lk(pu) lk(p′u) ≤ (1 + ǫ)i∗−1, ∀k = 1, 2, . . . , d such that u and ld+1(p′u) ≤ ld+1(pu). Then, with Lemma 1, as we form the s− v sub-paths pv and p′v by appending (u, v) to the end of pu and p′u respectively, we have the following relation- ship: 1 lk(pv) lk(p′v) ≤ (1 + ǫ)i∗−1, (1 + ǫ)i∗−1 ≤ ∀k = 1, 2, . . . , d (8) Consider any s − v path p′′v such that h(p′′v ) = h(p′v). The following is always satisfied according to the definition of the hash function h: 1 1 + ǫ ≤ lk(p′v) lk(p′′v ) ≤ 1 + ǫ, ∀k = 1, 2, . . . , d Combining this with (8), we can see that the path p′′v = Πi∗ v (h(p′v)) must satisfy lk(pv) lk(p′′v ) ≤ (1 + ǫ)i∗ , (1 + ǫ)i∗ ≤ 1 ∀k = 1, 2, . . . , d and ld+1(p′′v ) ≤ ld+1(pv). This indicates that for any s − v path pv which is within i∗ edges, there exists a path p′′v in Πi∗ such that their ratio is bounded by (1 + ǫ)i∗, and p′′v always has the smaller (d + 1)-th weight than pv. Q.E.D. v With this lemma, we are able to prove Corollary 1: Proof of Corollary 1. By Lemma 3, we can see that for any s − t path p that is within γ edges, there exists an s − t path p′ ∈ Πγ ≤ γ log(1 + ǫ) ∀k = 1, 2, . . . , d and ld+1(p′) ≤ ld+1(p). It then follows from (3) that our algorithm finds a path p′ such that t such that lk(p) log (cid:12)(cid:12)(cid:12)(cid:12) lk(p′)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) log Then, we have f (p′) f (p∗)(cid:12)(cid:12)(cid:12)(cid:12) ≤ βdγ log(1 + ǫ) f (p′) ≤ (1 + ǫ)βdγf (p∗) Clearly p′ satisfies the constraint ld+1(p′) ≤ b since ld+1(p′) ≤ ld+1(p∗) ≤ b. This shows that p′ is an (1+ǫ)βdγ- approximation to p∗. Proof of Theorem 3 Before we prove Theorem 3, we need the following lemma: Lemma 4. The function Φ( D−x√y ) is 3.284(3 + D√S )- Lipschitz on log-log scale with respect to L1 norm on the region C = {(x, y)x > D, y > S, x − D ≤ 3√y}. Proof. We want to show that for any (u1, v1), (u2, v2) ∈ C′ = {(u, v)eu > D, ev > S, eu − D ≤ 3√ev}, √ev1 (cid:19) − log Φ(cid:18) D − eu2 √ev2 (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) log Φ(cid:18) D − eu1 ≤ 3.284(cid:18)3 + √S(cid:19)(u1 − u2 + v1 − v2) (cid:12)(cid:12)(cid:12)(cid:12) (9) D We take the derivatives from the function log Φ( D−eu √ev ): (cid:12)(cid:12)(cid:12)(cid:12) √ev(cid:19) (10) D (11) (12) (cid:12)(cid:12)(cid:12)(cid:12) (13) √ev (cid:19) Φ′(cid:18) D−eu Φ(cid:18) D−eu √ev (cid:19) ∂ ∂u (cid:12)(cid:12)(cid:12)(cid:12) log Φ(cid:18) D − eu √ev (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) ∂ ∂v (cid:12)(cid:12)(cid:12)(cid:12) log Φ(cid:18) D − eu √ev (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) + eu √ev · Φ′(cid:18) D−eu √ev (cid:19) = (cid:12)(cid:12)(cid:12)(cid:12) Φ(cid:18) D−eu √ev (cid:19) ≤ 3.284(cid:18)eu − D √ev ≤ 3.284(cid:18)3 + √ev(cid:19) D √S(cid:19) ≤ 3.284(cid:18)3 + = (cid:12)(cid:12)(cid:12)(cid:12) D − eu 3 · 2√ev ev · D ≤ 3 2 × 3.284 comes Inequality (10) where that Φ′(x)/Φ(x) ≤ 3.284 for x ∈ [−3, 0), Inequality (11) that eu − D < 3√ev. Since comes from the fact log Φ( D−eu √ev ) is differentiable in C′, we obtain (9). from the fact Proof of Theorem 3. Let l1(p) denote the mean traveling time for path p, and l2(p) denote the variance for path p. Further denote l(p) = (l1(p), l2(p)). By Lemma 2, we can see that for the optimal s − t path p∗, there exists an s − t path p′′ ∈ Πγ t such that log (cid:12)(cid:12)(cid:12)(cid:12) lk(p∗) lk(p′′)(cid:12)(cid:12)(cid:12)(cid:12) ≤ γ log(1 + ǫ) Denote the region C = {(x, y)x > D, y > S, x − D ≤ 3√y}. We can see that (x, y) ∈ C if and only if Φ( D−x√y ) ∈ [Φ(−3), 0.5) and y > S. The optimal path must satisfy l(p∗) ∈ C since f (p∗) ≥ f (p′) > Φ(−3). First consider the case that l(p′′) is in the region C. Then we can adapt the same technique as in the proof of Theo- rem 2 and the smoothness condition we showed in Lemma 4 to claim that the path p′ returned by the algorithm satisfies f (p∗) ≤ (1 + ǫ)2×3.284×(3+ D ≤ (1 + ǫ)2×3.284×(3+ D √S √S )γf (p′′) )γf (p′) x0 log Now consider the case that l(p′′) is not in the region C, then there must exist a point (x0, y0) ∈ C on the line L = {x − D = 3√y} such that l1(p∗)(cid:12)(cid:12)(cid:12)(cid:12) l2(p∗)(cid:12)(cid:12)(cid:12)(cid:12) ≤ 2 × 3.284 ×(cid:18)3 + √S(cid:19)γ log(1 + ǫ) It then follows from Lemma 4 that ≤ γ log(1 + ǫ) ≤ γ log(1 + ǫ) Φ( D−x0√y0 f (p∗) log log y0 D ) (cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) Since the algorithm returns some other path p′ such that f (p′) > Φ(−3) = Φ( D−x0√y0 ), we must have f (p∗) ≤ (1 + ǫ)6.568(3+ D < (1 + ǫ)6.568(3+ D √S √S )γΦ(−3) )γf (p′) However, the approximation ratio is upper-bounded by 0.5/Φ(−3) ≈ 384.62, so this shows that p′ is an min{384.62, (1 + ǫ)6.568(3+ D )γ}-approximation to p∗. We can apply the same technique for the case that f (p′) > Φ(−2) or any other values. √S
1109.5931
1
1109
2011-09-27T15:19:08
Online Primal-Dual For Non-linear Optimization with Applications to Speed Scaling
[ "cs.DS" ]
We reinterpret some online greedy algorithms for a class of nonlinear "load-balancing" problems as solving a mathematical program online. For example, we consider the problem of assigning jobs to (unrelated) machines to minimize the sum of the alpha^{th}-powers of the loads plus assignment costs (the online Generalized Assignment Problem); or choosing paths to connect terminal pairs to minimize the alpha^{th}-powers of the edge loads (online routing with speed-scalable routers). We give analyses of these online algorithms using the dual of the primal program as a lower bound for the optimal algorithm, much in the spirit of online primal-dual results for linear problems. We then observe that a wide class of uni-processor speed scaling problems (with essentially arbitrary scheduling objectives) can be viewed as such load balancing problems with linear assignment costs. This connection gives new algorithms for problems that had resisted solutions using the dominant potential function approaches used in the speed scaling literature, as well as alternate, cleaner proofs for other known results.
cs.DS
cs
Online Primal-Dual For Non-linear Optimization with Applications to Speed Scaling Anupam Gupta∗ Ravishankar Krishnaswamy∗ Kirk Pruhs† Abstract We reinterpret some online greedy algorithms for a class of nonlinear "load-balancing" problems as solving a mathematical program online. For example, we consider the problem of assigning jobs to (unrelated) machines to minimize the sum of the αth-powers of the loads plus assignment costs (the online Generalized Assignment Problem); or choosing paths to connect terminal pairs to minimize the αth-powers of the edge loads (i.e., online routing with speed-scalable routers). We give analyses of these online algorithms using the dual of the primal program as a lower bound for the optimal algorithm, much in the spirit of online primal-dual results for linear problems. We then observe that a wide class of uni-processor speed scaling problems (with essentially arbi- trary scheduling objectives) can be viewed as such load balancing problems with linear assignment costs. This connection gives new algorithms for problems that had resisted solutions using the dom- inant potential function approaches used in the speed scaling literature, as well as alternate, cleaner proofs for other known results. 1 1 0 2 p e S 7 2 ] S D . s c [ 1 v 1 3 9 5 . 9 0 1 1 : v i X r a ∗Computer Science Department, Carnegie Mellon University, Pittsburgh, PA 15213, USA. Supported in part by NSF awards CCF-0964474 and CCF-1016799. R.K. supported in part by an IBM Graduate Fellowship. †Computer Science Department, University of Pittsburgh, Pittsburgh, PA 15260, USA. [email protected]. Supported in part by NSF grant CCF-0830558 and an IBM Faculty Award. 1 Introduction In this paper, we consider two online problems related to load balancing. We call the first problem Online Generalized Assignment Problem (OnGAP): Definition of OnGAP: Jobs arrive one by one in an online manner, and the algorithm must fractionally assign these jobs to one of m machines. When a job j arrives, the online algorithm learns ℓje, the amount by which the load of machine e would increase for each unit of work of job j that is assigned to machine e, and cje, the assignment cost incurred for each unit of work of job j that is assigned to machine e. The goal is to minimize the sum of the αth powers of the machine loads, plus the total assignment cost. The version of OnGAP without assignment costs was studied by [AAF+97, AAG+95]. Our original motivation for studying OnGAP is that it models a well-studied class of speed scaling problems with sum cost scheduling objectives. In these problems, jobs arrive over time and must be scheduled on a speed scalable processor -- i.e., a processor that can run at any non-negative speed, and uses power sα when run at speed s. The objective is the sum of the energy used by the processor plus a fractional scheduling objective that is the sum over jobs of the "scheduling cost" of the individual jobs. These speed scaling problems are a special case of OnGAP where the machines model the times that jobs can be scheduled, the assignment cost cje models the scheduling cost for scheduling a unit of job j at time e. For example, one such scheduling objective is the sum of the fractional flow/response times squared. For this objective, cje is (e − rj)2 for all times e that are at least the release time rj of job j, and infinite otherwise. Another example is the problem of minimizing energy usage subject to deadline constraints, introduced by [YDS95] and considered in followup papers [BKP07, BBCP11, BCPK09]. This problem can be viewed as a special case of OnGAP, where each job j has an associated deadline dj, and cje is zero if e ∈ [rj, dj] and infinite otherwise. The second problem that we consider is a variation/generalization of OnGAP involving online routing with speed scalable routers to minimize energy, which was previously considered in [AAF+97, AAZ11]. Definition of Online Routing with Speed Scalable Routers Problem: A sequence of requests arrive one by one over time. Each request j has an associated source-sink pair (sj, tj) in a network of speed scalable routers, and the online algorithm must route flow between the source-sink pair, with an objective of minimizing the total energy used by the network, where the energy incurred by an edge e is the αth power of the load flowing through it. For load balancing and online routing, it was known that natural online greedy algorithms, which assign jobs to the machine(s) that minimize the increase in cost, can be shown to be Oα(1)-competitive via an exchange argument, and directly bounding the cost compared to the optimal cost [AAF+97, AAG+95]. (In fact, basically the same argument shows that the online greedy algorithm is Oα(1)-competitive for integer assignments.) Once we observe that speed scaling problems with sum scheduling objectives can be reduced to OnGAP, it is not too difficult to see that the analysis technique in [AAG+95] can be used to show that natural greedy speed scaling algorithms are Op(1)-competitive. Our Contribution. In this paper, we first interpret these online problems as solving a mathematical program online, where the constraints arrive one-by-one, and in response to the arrival of a new con- straint, the online algorithm has to raise some of the primal variables so that the new constraint will be satisfied. The online algorithms that we consider raise the primal variables greedily. Our competitive analysis will use the dual function of the primal program as a lower bound for optimal. For analysis purposes, we assign a value to the dual variable corresponding to a constraint after the online algorithm has satisfied that constraint. Our goal is to set the dual variables so that the resulting dual solution is closely related to the online solution. (In our analyses, the settings of the dual variables naturally correspond to (some approximation for) the increase in the objective function.) We first show how to obtain fractional solutions to these problems, and subsequently show how similar ideas can be used for integer assignments. 1 Our analyses are very much in the spirit of the online primal dual technique for linear programs [BN07]. The main difference is that in the nonlinear setting, the dual is more complicated than in the linear setting (where the dual is just another linear program). Indeed, in the nonlinear setting, one can not disentangle the objective and the constraints, since the dual itself contains a version of the primal objective, and hence copies of the primal variables, within it. Consequently, the arguments for the dual function in the nonlinear setting have a somewhat different feel to them than in the linear setting. In particular, we need to set the dual variables λ, and then find minimizing settings for the copies of the primal variables to get a good lower bound. For the load-balancing and speed scaling problems, this proceeds relatively naturally. But for the routing problem the dual minimization problem is itself non-trivial: in this case we first show how to write a "relaxed/decoupled" dual, which is potentially weaker than the original dual, but easier to argue about, and then set the variables of this relaxed dual to achieve a good lower bound. We hope this analytical technique will be useful for other problems. We then show how a wide class of uni-processor speed-scaling problems (with essentially arbitrary scheduling objectives) can be viewed as load balancing problems with linear assignment costs. This connection gives new algorithms for speed-scaling problems that had resisted solutions using the dom- inant potential function approaches used in the speed scaling literature, as well as alternate, cleaner analyses for some known results. For speed scaling problems, our analysis using duality is often cleaner (compare for example, the analysis of OA in [BKP07] to the analysis given here) and more widely applicable (for example, to nonlinear scheduling objectives) than the potential function-based analy- ses. Furthermore, we believe that much like the online primal-dual approach for linear problems, the techniques presented here have potential for wide applicability in the design and analysis of online algorithms for other non-linear optimization problems. In Section 1.1 we discuss related work. In Section 2 we consider OnGAP. In Section 3, we Roadmap: make some comments about the application of these results to speed scaling problems. In Section 4 we consider the online routing problem. In Section 5 we show how to alter the water-filling algorithm to obtain integer assignments with a similar competitive ratio, as well a simple randomized rounding with a slightly worse performance. 1.1 Related Work An O(α)-competitive online greedy algorithm for the unrelated machines load-balancing problem in the Lα-norm was given by [AAF+97, AAG+95]; Caragiannis [Car08] gave better analyses and im- provements using randomization. An offline O(1)-approximation for this problem was given by [AE05] and [AKMPS09], via solving the convex program and then rounding the solution in a correlated fashion. For the routing problem, the O(α)α-algorithm can be inferred from the ideas of [AAF+97, AAG+95]. Followup work in a setting of a network consisting of routers with static and dynamic power components can be found in [AAZ10, AAZ11]. There are two main lines of speed scaling research that fit within the framework that we consider here. This first is the problem of minimizing energy used with deadline feasibility constraints. [YDS95] pro- posed two online algorithms OA and AVR, and showed that AVR is Oα(1)-competitive by reasoning directly about the optimal schedule. [BKP07] introduced the use of potential functions for analyzing online scheduling problems, and showed that OA and another algorithm BKP are Oα(1)-competitive. [BBCP11] gave a potential function analysis to show that AVR is Oα(1)-competitive. [BCPK09] intro- duced the algorithm qOA, and gave a potential function analysis to show that it has a better competitive ratio than OA or AVR for smallish α. The second main line of speed scaling research is when the scheduling objective is total flow, or more [PUW08, AF07] gave offline algorithms for unit-weight unit-work jobs. generally total weighted flow. All of the work on online algorithms consider some variation of the "natural" algorithm, which uses the "right" job selection algorithm from the literature on scheduling fixed speed processors, and sets 2 the power of the processor equal to the weight of the outstanding jobs. This speed scaling policy is "natural" in that it balances the energy and scheduling costs. By reasoning directly about the energy optimal schedule, [AF07] showed that a batched version of the natural algorithm is Oα(1)-competitive for unit-work unit-weight jobs. Using a potential function analysis, [BPS09] showed that a variation of the natural algorithm is Oα(1)-competitive for arbitrary-weight arbitrary-work jobs. For the objective of total flow plus energy, the bound on the competitive ratio was improved in [LLTW08] by use of potential function tailored to integer flow instead of fractional flow. Using a potential function analysis, [BCP09] showed a variation on the natural algorithm is O(1)-competitive for total flow plus energy for an arbitrary power function, and a variation on the natural algorithm is scalable, for fractional weighted flow plus energy for an arbitrary power function. [ALW10] improved the bound on the competitive ratio for total flow plus energy. Nonclairvoyant algorithms are analyzed in [CEL+09, CLL10]. A relatively recent survey of the algorithmic power management literature in general, and the speed scaling literature in particular, can be found in [Alb10]. An extensive survey/tutorial on the online primal dual technique for linear problems, as well the history of the development of this technique, can be found in [BN07]. 2 The Online Generalized Assignment Problem In this section we consider the problem of Online Generalized Assignment Problem (OnGAP). If xje denotes the extent to which job j is assigned on machine e, then this problem can be expressed by the following mathematical program: min Xe (cid:18)Xj ℓjexje(cid:19)α +Xe Xj cjexje xje ≥ 1 j = 1, . . . , n The dual function of the primal relaxation is then subject to Xe x(cid:23)0(cid:18)Xj λj +Xe (cid:18)Xj g(λ) = min ℓjexje(cid:19)α +Xj,e cjexje −Xj,e λj xje(cid:19) (2.1) One can think of the dual problem as having the same instance as the primal, but where jobs are allowed to be assigned to extent zero. In the objective, in addition to the same load costPe(cid:0)Pj ℓjexje(cid:1)α as in the primal, a fixed cost of λj is paid for each job j, and a payment of λj − cje is obtained for each unit of job j assigned. It is well known that each feasible value of the dual function is a lower bound to the optimal primal solution; this is weak duality [BV04]. αα−1 . To Online Greedy Algorithm Description: Let δ be a constant that we will later set to schedule job j, the load is increased on the machines for which the increase the cost will be the least, assuming that energy costs are discounted by a factor of δ, until a unit of job j is scheduled. More formally, the value of all the primal variables xje for all the machines e that minimize 1 δ · α · ℓje(cid:18)Xi≤j ℓiexie(cid:19)α−1 + cje (2.2) are increased until all the work from job j is scheduled, i.e.,Pe xje = 1. Notice that α · ℓje(cid:0)Pi≤j ℓiexie(cid:1)α−1 is the rate at which the load cost is increasing for machine e, and cje is the rate that assignment costs are increasing for machine e. In other words, our algorithm fractionally assigns the job to the machines on which the overall objective function increases at the least rate. Furthermore, observe that if the 3 algorithm begins assigning the job to some machine e, it does not stop raising the primal variable xje until the job is fully assigned1. By this monotonicity property, it is clear that all machines e for which xje > 0 have the same value of the above derivative when j is fully assigned. Now, for the purpose of analysis, we set the valuebλj to be the rate of increase of the objective value when we assigned the last infinitesimal portion of job j. More formally, if e is any machine on which job j is run, i.e., if xje > 0, then + cje (2.3) bλj := δ · α · ℓje(cid:18)Xi≤j ℓiexie(cid:19)α−1 variables for the online algorithm. assignment of job j (we assign a total of 1 unit of job j, and λj is set to be the rate at which objective value increases). Intuitively, bλj is a surrogate for the total increase in objective function value due to our fractional We now move on to the analysis of our algorithm. To this end, let ex denote the final value of the xje (by weak duality) to show that g(bλ) is at least end, let bx be the value of the minimizing x variables in g(bλ), namely x(cid:23)0(cid:18)Xj bλj +Xe (cid:18)Xj Algorithm Analysis. To establish that the online algorithm is αα-competitive, note that it is sufficient 1 αα times the cost of the online solution. Towards this −Xj,e (cid:18)bλj − cje(cid:19) xje(cid:19) ℓjexje(cid:19)α bx = arg min Then by the usual argument of either increasing or decreasing these variables along the line that keeps choice for the job ϕ(e) is the latest arriving job for which the online algorithm scheduled some bit of work on machine e; Let us denote this latest job by ψ(e). Observe that the values bx could be very different from the values ex, and indeed the next few Lemmas try to characterize these values. Lemma 2.1 notes that bx only has one job ϕ(e) on each machine e, and Lemma 2.2 shows how to determine ϕ(e) andbxϕ(e)e. Then, in Lemma 2.3, we show that a feasible Lemma 2.1 There is a minimizing solution bx such that if bxje > 0, then bxie = 0 for all i 6= j. Proof. Suppose for some machine e, there exist distinct jobs i and k such that bxie > 0 and bxke > 0. their sum constant, we can keep the convex term (Pj ℓjebxje)α term fixed and not increase the linear termPj(bλj − cje)bxje. This allows us to either setbxie orbxke to zero without increasing the objective. αℓϕ(e)e (cid:19)1/(α−1) and bxje = 0 for j 6= ϕ(e). Moreover, the contribution of machine e towards g(bλ) is exactly (1−α)(cid:18) bλϕ(e)−cϕ(e)e αℓϕ(e)e (cid:19)α/(α−1) Proof. By Lemma 2.1 we know that in bx there is at most one job (say j, if any) run on machine e. Then the contribution of this machine to the value of g(bλ) is (ℓjebxje)α − (bλj − cje)bxje Sincebx is a minimizer for g(bλ), we know that the partial derivative of the above term evaluates to zero. This gives αℓje · (ℓjebxje)α−1 −(cid:16)bλj − cje(cid:17) = 0, or equivalently, bxje = 1 . Then bxϕ(e)e = 1 je′ at different rates so as to balance the derivatives where e and e′ are both machines ℓϕ(e)e(cid:18) bλϕ(e)−cϕ(e)e Lemma 2.2 Define ϕ(e) = arg maxj ℓje(cid:16) bλj −cje αℓje (cid:17)1/(α−1) 1It may however increase xje and x . Substituting (bλj −cje) ℓje . (2.4) which minimize equation 2.2 4 into this value of bxje into equation (2.4), the contribution of machine e towards the dual g(bλ) is αℓje !α/(α−1) = (1 − α) bλj − cje bλj − cje αℓje !α/(α−1) bλj − cje αℓje !1/(α−1) (bλj − cje) ℓje − Hence, for each machine e, we want to choose that the job j that minimizes this expression, which is also the job j that maximizes the expression (bλj − cje)/ℓje since α > 1. This is precisely the job ϕ(e) and the proof is hence complete. Lemma 2.3 For all machines e, job ψ(e) is feasible choice for ϕ(e). Proof. The line of reasoning is the following: ϕ(e) = arg max j (cid:0)bλj − cje(cid:1) ℓje = arg max j (cid:18)δ · α ·(cid:18)Xi≤j ℓjexie(cid:19)α−1(cid:19) = arg max j (cid:18)(cid:18)Xi≤j ℓiexie(cid:19)α−1(cid:19) = ψ(e) . The first equality is the definition of ϕ(e). For the second equality, observe that for any job k, bλk ≤ δ · α · ℓek(Xi≤k ℓiexie)α−1 + cke =⇒ bλk − cke ℓke ≤ δ α (Xi≤k ℓiexie)α−1 . The expression on the right is monotone increasing in Pi≤k ℓiexie, the load due to jobs up to (and including k). Moreover, it is maximized by the last job to assign fractionally to e (since the inequality is strict for all other jobs). Since this last job is ψ(e), the last equality follows. Theorem 2.4 The online greedy algorithm is αα-competitive. Proof. By weak duality it is sufficient to show that g(bλ) ≥ ON/αα. Applying Lemma 2.2 to the expression for g(bλ) (equation (2.1)) and substituting the contribution of each machine towards the dual, we get that (1 − α)(cid:18)bλψ(e) − cψ(e)e αℓψ(e)e (cid:19)α/(α−1)(cid:19) g(bλ) =(cid:18)Xj bλj +Xe Xj λj =Xj,e bλjexje =Xe exje(cid:18)Xj = (δ · α)Xe Xj ≥ δXe (cid:18)Xj Now we consider only the first termPjbλj and evaluate it. δ · α · ℓje(cid:18)Xi≤j ℓjeexje(cid:18)Xi≤j ℓjeexje(cid:19)α ℓieexie(cid:19)α−1 ℓieexie(cid:19)α−1 +Xj,e exjecje + cje(cid:19) +Xj,e exjecje (2.5) (2.6) (2.7) (2.8) (2.9) Now consider the second term of equation (2.5). Note that if we substitute the value ofbλψ(e), it evaluates to (1 − α)δα/(α−1)Pe(cid:0)Pj ℓjeexje(cid:1)α Putting the above two estimates together, we get +Xj,e exjecje + (1 − α)δα/(α−1)Xe (cid:18)Xj ℓjeexje(cid:19)α g(bλ) ≥ δXe (cid:18)Xj ℓjeexje(cid:19)α (2.10) 5 =(cid:18)δ + (1 − α)δα/(α−1)(cid:19)Xe (cid:18)Xj exjeℓje(cid:19)α ≥ ON/αα +Xj,e exjecje (2.11) (2.12) The final inequality is due to the choice of δ = 1/αα−1 which maximizes(cid:0)δ + (1 − α)δα/(α−1)(cid:1). As observed, e.g., in [AAG+95], this O(α)α result is the best possible, even for the (fractional) OnGAP In Section 5, we show how to obtain an O(α)α-competitive problem without any assignment costs. algorithm for integer assignments by a very similar greedy algorithm, and dual-fitting, albeit with a more careful analysis. 3 Application to Speed Scaling We now discuss the application of our results for OnGAP to some well-studied speed scaling problems. In these problems a collection of jobs arrive over time. The jth job arrives at time rj, and has size/work pj. These jobs must be scheduled on a speed scalable processor that can run at any non-negative speed. There is a convex function P (s) = sα specifying the dynamic power used by the processor as a function of speed s. The value of α is typically around 3 for CMOS based processors. Commonly, one considers objectives G of the form S + βE, where S is a scheduling objective, and E is the energy used by the system. Moreover, the scheduling objective S is a fractional sum objective of the form Cjt, where Cjt is the cost of completing job a unit of work of job j at time t, and xjt is PjPt the amount of work completed at time t, or the corresponding integer sum objective PjPt yjt Cjt, where yjt indicates whether or not job j was completed at time t. Fractional scheduling objectives are interesting in their own right (for example, in situations where the client gains some benefit from the early partial completion of a job), and are often used in an intermediate step in the analysis of algorithms for integer scheduling objectives. xjt pj Normally one thinks of the online scheduling algorithm as having two components: a job selection policy to determine the job to run, and a speed scaling policy to determine the processor speed. However, one gets a different view when one thinks of the online scheduler as solving online the following mathematical programming formulation of the problem (which is an instance of the OnGAP problem): min Xt (cid:18)Xj xjt(cid:19)α +Xj Xt Cjt xjt xjt ≥ 1 j = 1, . . . , n subject to Xt Here the variables xjt specify how much work from job j is run at time t. Because we are initially concerned with fractional scheduling objectives, we can assume without loss of generality that all jobs have unit length. The arrival of a job j corresponds to the arrival of a constraint specifying that job j must be completed. Greedily raising the primal variables corresponds to committing to complete the work of job j in the cheapest possible way, given the previous commitments. Two Special Cases. A well-studied speed-scaling problem in this class is when the scheduling ob- jective is energy minimization subject to deadline feasibility [YDS95, BKP07, BBCP11, BCPK09]: for each job j there is a deadline dj, and cjt = 0 for t ∈ [rj, dj] and is infinite otherwise. Our algorithm for OnGAP is essentially equivalent to the algorithm Optimal Available (OA), introduced in [YDS95] and shown to be αα-competitive in [BKP07] -- specifically, the speeds set by both OA and our algorithm are the same at all times, but the jobs that are run may be different, since OA uses Earliest Deadline First for scheduling. Our analysis of the online greedy algorithm for OnGAP is an alternate, and simpler, analysis of OA than the potential function analysis in [BKP07]. In this instance, our duality based analysis is tight, as OA is no better than αα-competitive [YDS95, BKP07]. 6 Another well-studied special case is when the objective is total flow [AF07, BPS09, BCP09, LLTW08, ALW10, CEL+09, CLL10]. That is, cjt equals (t − rj) for t ≥ rj and infinite otherwise. All prior algorithms for this objective assume some variation of the balancing speed scaling algorithm that sets the power equal to the (fractional) number/weight of unfinished jobs. Unlike the earlier example above, OnGAP behaves differently than these balancing algorithms for the following reason. When a job arrives, OnGAP only focuses on choosing assignments which minimize the rate of increase of the objective, and this rule determines both the scheduling policy (in fact, the entire schedule of job j is decided upon arrival) and the power usage over time. However, in the balancing algorithms the speed profile (and hence power usage) is entirely determined by the scheduling policy, and the scheduling policies used are typically the ones optimal for fractional flow like SJF. Hence it is likely that our algorithms will actually have a different work profile from balancing algorithms. A Note about our Approximation Guarantees. A closer examination of our analysis (especially equation (2.11)) shows that our algorithm has a Lagrangian multiplier preserving property: we get that our convex cost + αα times the linear term is at most αα times the dual. This separation between the linear and non-linear terms in the objective happens because the constraints are linear, and when we compute the dual, the dual variables are involved in the linear terms whereas the convex terms in the minimizer are identical to their expressions in the primal. In order to argue about the dual minimizer, this somehow forces us to be exact on the linear terms. This can perhaps explain why our analysis is tight for the deadline feasibility and load balancing problems [BKP07, AAF+97, AAG+95] (where there are no linear terms), but is an O(αα)-factor worse than the algorithm of [BCP09] for fractional flow+energy (which has non-trivial linear terms). In most potential function-based analyses of speed scaling Comparison to Previous Techniques. problems in the literature, the potential function is defined to be the future cost for the online algorithm to finish the jobs if the remaining sizes of the jobs were the lags of the jobs, which is how far the online algorithm is behind on the job [IMP11]. A seemingly necessarily condition to apply this potential function technique is that there must be is a relatively simple algebraic expression for the future cost for the online scheduling algorithm starting from an arbitrary state. As it is not clear how to obtain such an algebraic expression for the most obvious candidate algorithms for nonlinear scheduling objectives, 2 this to date has limited the application of this potential function method to speed scaling problems with linear scheduling objectives. However, our dual-based analysis for OnGAP yields an online greedy speed scaling algorithm that is Oα(1)-competitive for any sum scheduling objective. Our algorithm for OnGAP has the advantage that, at the release time of a job, it can commit to the client exactly the times that each portion of the job will be run. One can certainly imagine situations when this information would be useful to the client. Also the OnGAP analysis applies to a wider class of machine environments than does the previous potential function based analyses in the literature. For example, our analysis of the OnGAP algorithm can handle the case that the processor is unavailable at certain times, without any modification to the analysis. Although this generality has the disadvantage that it gives sub-optimal bounds for some problems, such as when the scheduling objective is total flow. By speeding up the processor by a (1+ǫ) factor, one can obtain an online speed scaling algorithm that one can show, using known techniques [BLMSP06, BPS09], has competitive ratios at most min(αα(1+ǫ)α, 1 ǫ ) for the corresponding integer scheduling objective. 2 For Lα norms of flow on a single fixed speed processor, no potential function is required to prove scalability of natural online algorithms [BP10]. For more complicated non-work conserving machine environments, there are analyses that use a potential function that is a rough approximation of future costs [GIK+10, IM10]. But despite some effort, it has not been clear how to extend these potential functions to apply to Lα norms of flow in the speed scaling setting. 7 4 Routing with Speed Scalable Routers In this section we consider the following online routing problem. Routing requests in a graph/network arriving over time. The jth request consists of a source sj, a sink tj, and a flow requirement fj. In the unsplittable flow version of the problem the online algorithm must route fj units of flow along a single (sj, tj)-path. In the splittable flow version of this problem, the online algorithm may partition the fj units of flow among a collection of (sj, tj)-paths. In either case, we assume speed scalable network elements (routers, or links, or both) that use power ℓα when they have load ℓ, where the load is the sum of the flows through the element. We consider the objective of minimizing the aggregate power. We show that an intuitive online greedy algorithm is αα-competitive using the dual function of a mathematical programming formulation as a lower bound to optimal. High Level Idea: The proof will follow the same general approach as for OnGAP: we define dual just job assignments) is not so straight-forward: the different edges on a path p might want to set f (p) to different values. So we do something seemingly bad: we relax the dual to decouple the variables, and allow each (edge, path) pair to choose its own "flow" value f (p, e). And which of these should we use as variablesbλj for the demand pairs, but now the minimization problem (which is over flow paths, and not our surrogate for f (p)? We use a convex combination Pe∈p he f (p, e) -- where the multipliers h(e) are chosen based on the primal loads(!), hence capturing which edges are important and which are not. 4.1 The Algorithm and Analysis We first consider the splittable flow version of the problem. Therefore, we can assume without loss of generality that all flow requirements are unit, and all sources and sinks are distinct (so we can associate a unique request j(p) with each path p). This will also allow us to order paths by the order in which flow was sent along the paths. We now model the problem by the following primal optimization formulation: min Xe (cid:18)Xj Xp∋e:p∈Pj f (p)(cid:19)α f (p) ≥ 1 j = 1, . . . , n subject to Xp∈Pj where Pj is the set of all (sj, tj) paths, and f (p) is a non-negative real variable denoting the amount of flow routed on the path p. In this case, the dual function is: g(λ) = min f (p)(cid:18)Xj λj +Xe (cid:18)Xj Xp∋e:p∈Pj f (p)(cid:19)α − Xj,p∈Pj λjf (p)(cid:19) One can think of the dual function as a routing problem with the same instance, but without the constraints that at least a unit of flow must be routed for each request. In the objective, in addition to energy costs, a fixed cost of λj is payed for each request j, and a payment of λj is received for each unit of flow routed from sj to tj. Description of the Online Greedy Algorithm: To route flow for request j, flow is continuously routed along the paths that will increase costs the least until enough flow is routed to satisfy the request. That is, flow is routed along all (sj, tj) paths p that minimizePe∈p α ·(cid:16)Pq≤p:q∋e f (q)(cid:17)α−1 purposes, after the flow for request j is routed, we define . For analysis where p is any path along which flow for request j was routed, and δ is a constant (later set to 1 αα−1 ). bλj = αδ(cid:18)Xe∈p Xq≤p:q∋e f (q)(cid:19)α−1 8 The Analysis: Unfortunately, unlike the previous section for load balancing, it is not so clear how to there (per machine). In order to circumvent this difficulty, we consider the following relaxed function compute the dual function g(bλ) or its minimizer since the variables cannot be nicely decoupled as we did bg(bλ, h), which does not enforce the constraint that flow must be routed along paths. This enables us to decouple variables and then argue about the objective value. Indeed, let ef (p) be the final flow on path p for the routing produced by the online algorithm. Let h(e) = αPp∋e ef (p)α−1 be the incremental cost of routing additional flow along edge e, and h(p) =Pe∈p h(e) be the incremental cost of routing additional flow along path p. We then define: f (p,e)(cid:18)Xj bλj +Xe (cid:18)Xj Xp∋e:p∈Pj bg(bλ, h) = min f (p, e)(cid:19)α −Xj bλj Xp∈PjXe∈p h(e) h(p) f (p, e)(cid:19) in terms of the final online primal solution. has the option of increasing the load on individual edges e ∈ p ∈ Pj, but the income from edge e will be a factor of h(e) Conceptually, f (p, e) can be viewed as the load placed on edge e by request j(p). Inbg(bλ, h), the scheduler h(p) less than the income achieved in g(bλ). In Lemma 4.1 we prove thatbg(bλ, h) is a lower bound for g(bλ). We then proceed as in the analysis of OnGAP. Lemma 4.2 shows how the minimizer and value ofbg(bλ, h) can be computed, and Lemma 4.3 shows how to bound some of the dual variables Lemma 4.1 For the above setting of h(·), bg(bλ, h) ≤ g(bλ). Proof. We show that there is a feasible value ofbg(bλ, h) that is less than g(bλ). Let the value of f (p, e) inbg(bλ, h) be the same as the value of f (p) in g(bλ). Plugging these values for f (p, e) into the expression forbg(bλ, h), and simplifying, we get: The first equality holds by the definitions of h(e) and h(p), and the second equality holds by the optimality of f (p). . that p(e) = arg maxp∋e α·h(p(e)) (cid:19)1/(α−1) follows the same reasoning as in the proof of Lemma 2.1. Once we know only one request sends flow on any edge we can use calculus to identify the minimizer and the value which achieves it. Indeed, we get Lemma 4.2 There is a minimizer bf ofbg(bλ, h) in which for each edge e, there is a single path p(e) such that bf (p, e) is positive, and bf (p(e), e) =(cid:18) bλj(p(e))h(e) Proof. The argument that bg(bλ, h) has a minimizer where each edge only has flow from one request . and the value of bf (p(e), e) is set so that the incremental energy cost would just offset the incremental income from routing the flow, that is αbf (p(e), e)α−1 =bλj(p(e)) Solving for bf (p(e), e), the result follows. Lemma 4.3 bλj(p(e)) ≤ δ · h(p(e)) Proof. bλj(p(e)) is δ times the rate at which the energy cost was increasing for the online algorithm when it routed the last bit of flow for request j(p(e)). h(p(e)) is the rate at which the energy cost would h(e) h(p(e)) . bλj(p)h(e) h(p) 9 bg(bλ, h) ≤Xj bλj +Xe (cid:18)Xj Xp∋e:p∈Pj =Xj bλj +Xe (cid:18)Xj Xp∋e:p∈Pj = g(bλ) f (p)(cid:19)α f (p)(cid:19)α −Xj bλj Xp∈Pj −Xj bλj Xp∈Pj f (p)Xe∈p h(e) h(p) f (p) increase for the online algorithm if additional flow was pushed along p(e) after the last request was satisfied. If p(e) was a path on which the online algorithm routed flow, then the result follows from the fact the online algorithm never decreases the flow on any edge. If p(e) was not a path on which the online algorithm routed flow, then the result follows from the fact that at the time that the online algorithm was routing flow for request j(p(e)), p(e) was more costly than the selected paths, and the cost can't decrease subsequently due to monotonicity of the flows in the online solution. Theorem 4.4 The online greedy algorithm is αα competitive. Proof. We will show thatbg(bλ, h) is at least the online cost ON divided by αα, which is sufficient since bg(bλ, h) is a lower bound to g(bλ) by Lemma 4.1, and since g(bλ) is a lower bound to optimal. f (p, e)(cid:19) h(e) h(p) (4.13) −Xj bλj Xp∈PjXe∈p bg(bλ, h) = min f (p, e)(cid:19)α f (p,e)(cid:18)Xj bλj +Xe (cid:18)Xj Xp∋e:p∈Pj =Xj bλj − (α − 1)Xe (cid:18)bλj(p(e))h(e) α · h(p(e))(cid:19)α/(α−1) ≥Xj bλj − (α − 1)Xe (cid:18) δ · h(e) α (cid:19)α/(α−1) =Xj bλj − (α − 1)δα/(α−1)Xe (cid:18)Xp∋e ef (p)(cid:19)α =Xj bλj Xp∈Pj ef (p) − (α − 1)δα/(α−1)Xe (cid:18)Xp∋e ef (p)(cid:19)α = δαXj Xp∈Pj ef (p)(cid:18)Xe∈p Xq≤p:q∋eef (q)(cid:19)α−1 − (α − 1)δα/(α−1)Xe (cid:18)Xp∋e ef (p)(cid:19)α ≥ δXe (cid:18)Xp∋e ef (p)(cid:19)α ααXe (cid:18)Xp∋e ef (p)(cid:19)α = ≥ ON/αα 1 − (α − 1)δα/(α−1)Xe (cid:18)Xp∋e ef (p)(cid:19)α (4.14) (4.15) (4.16) (4.17) (4.18) (4.19) (4.20) (4.21) 4.2. The inequality in line (4.15) follows from Lemma 4.3. The equality in line (4.16) follows from the The equality in line (4.13) is the definition ofbg(bλ, h). The equality in line (4.14) follows from Lemma definition of h(e). The equality in line (4.17) follows from the feasibility of ef . The equality in line (4.18) follows from the definition ofbλ. The equality in line (4.19) follows from the definition of δ. While the above algorithm only gives a splittable routing, i.e., a fractional routing, we note that the ideas of the next section, Section 5, can be used to obtain an Oα(1)-competitive algorithm for integer flow as well by using a slightly modified primal program (we have to handle non-uniform demands, and also strengthen the basic convex program to prevent some trivial integrality gaps. The next section described how we can handle these issues for the load balancing problem. 5 Online Load Balancing: Integral Assignments For simplicity, let us consider online integer load balancing without assignment costs; it is easy to see the extension to the other problems that we consider. In this problem each job has the values ℓje, and the goal is to integrally assign it to a single machine so as to minimize the sumPe(Pj Xjeℓje)α where 10 Xje is the indicator variable for whether job j is assigned to machine e. The most natural reduction to our general model OnGAP is to set all cje's to 0. However, the convex relaxation for this setting has a large integrality gap with respect to integral solutions. For example, consider the case of just a single job which splits into m equal parts (where m is the number of machines) -- the integer primal optimal pays a factor of mα−1 times the fractional primal optimal. To handle this case, we add a fixed assignment cost of cje = ℓα je for assigning job j to machine e. It is easy to see that the cost of an optimal integral solution at most doubles in this relaxation. This is the convex program that we use for the rest of this section. 5.1 Approach I: Integer Assignment In this section, we show that an algorithm which gives an O(α)α-competitive ratio. Consider the following greedy algorithm: when job j arrives, it picks the machine e that minimizes δ · α · ℓje(Xi<j ℓiexie)α−1 + ℓα je, settings of the primal variables. and set xje = 1. Moreover, set bλj for job j to be precisely the quantity above. Let exie be the final For the analysis, we again need to set thebxj's. For machine e, again consider ϕ(e) and ψ(e) as defined in the previous proofs. We can no longer claim that ψ(e) is a feasible setting for ϕ(e). However, we can claim that the load on machine e that is seen by ϕ(e) (and indeed, by any job k) is at most the load seen by ψ(e) when it arrived, plus the length ℓψ(e)e. Hence bλϕ(e) ≤ δ α ℓϕ(e)e( Xi<ψ(e) But since ψ(e) is the last job on machine e, this last expression is exactly δ (Pi ℓieexie)α−1. Now recall the dual from (2.5). Observing that that α > 1, we can use the calculations we just did to get ℓieexie + ℓψ(e)e)α−1 + ℓα ϕ(e)e =⇒ bλϕ(e) − ℓα αℓϕ(e)e ℓieexie)α−1. ≤ δ ( Xi≤ψ(e) (5.22) ϕ(e)e g(bλ) ≥Xj bλj + (1 − α)δα/(α−1) Xe (cid:18)Xi ℓieexie(cid:19)α ℓjeexje(cid:18)Xi:i<j ℓieexie(cid:19)α−1 jeexje + (1 − α)δα/(α−1)(cid:18)Xj,e =αδXe,j +Xj,e αδ Xj∈Se je + (1 − α)δα/(α−1)(cid:18)Xj∈Se ℓie(cid:19)α−1 ℓje(cid:18) Xi∈Se:i<j =Xe +Xj∈Se ℓje(cid:19)α e(e(α + 1))α ×Xe (cid:18)Xj∈Se ℓα ℓα ≥ 1 ℓjeexje(cid:19)α ℓje(cid:19)α where the last inequality is obtained by applying Lemma 5.1 to the expression for each machine e. This implies the O(α)α competitive ratio for the integral assignment algorithm. Lemma 5.1 Given non-negative numbers a0, a1, a2, . . . , aT and δ = (e(α + 1))α−1, we get αδ Xj∈[T ] aj(cid:18)Xi<j ai(cid:19)α−1 + Xj∈[T ] aα j + (1 − α)δα/(α−1)(cid:18) Xj∈[T ] aj(cid:19)α ≥ 1 e(e(α + 1))α ×(cid:18) Xj∈[T ] aj(cid:19)α . (5.23) 11 Proof. First, consider the case when α ≥ 2: in this case, we bound the LHS of (5.23) when the sequence of numbers is non-decreasing, and then we show the non-decreasing sequence makes this LHS the smallest. We then consider the (easier) case of α ∈ [1, 2]. (lower) bound the following term Suppose a0 ≤ a1 ≤ · · · ≤ aT , then PT ai(cid:19)α−1 aj(cid:18)Xi:i≤j T −1Xj=0 αδ j=0 aj(Pi<j ai)α−1 ≥ PT −1 j=0 aj(Pi≤j ai)α−1, and it suffices to + TXj=1 aα j − (α − 1)δα/(α−1)(cid:18) TXj=1 aj(cid:19)α (5.24) There are two cases, depending on the last term: whether aT ≤ 1 j=0 aj, or not. j=0 aj. Now, consider the first term in (5.24): • If aT ≤ 1 j=0 aj, we getPT αPT −1 ai(cid:19)α−1 aj(cid:18)Xi:i≤j T −1Xj=0 j=0 aj ≤ (1 + 1/α)PT −1 ≥ δ(cid:18) T −1Xj=0 aj(cid:19)α αδ ≥ αPT −1 (1 + 1/α)α(cid:18) TXj=0 δ aj(cid:19)α ≥ δ e(cid:18) TXj=0 aj(cid:19)α . (The last inequality used the fact that (1 + 1/α)α approaches e from below.) Finally, plugging this back into (5.24), ignoring the second sum, and using δ = (e(α + 1))1−α, we can lower bound the expression of (5.24) by (PT − (α − 1)δα/(α−1) = δ e j=0 aj)α times 1 e(e(α + 1))α−1 − α − 1 (e(α + 1))α = (α + 1) − (α − 1) (eα)α(1 + 1/α)α ≥ 2 e(eα)α • In case aT ≥ 1 term aα j=0 aj, we get Pj aj =Pj<T aj + aT ≤ (1 + α)aT . Now using just the single αPT −1 T from the first two summations in (5.24), we can lower bound it by aα T − (α − 1)δα/(α−1)(1 + α)αaα T = aα T(cid:18)1 − (α − 1)(1 + α)α (e(α + 1))α (cid:19) = aα T(cid:18)1 − α − 1 eα (cid:19) . This is at least aα T /2 ≥ 1 2(1+α)α (Pj aj)α ≥ 1 2eαα . So in either case the inequality of the statement of Lemma 5.1 is satisfied. Now to show that the non-decreasing sequence makes the LHS smallest for α ≥ 2. Only the first summation depends on the order, so focus on Pj∈[T ] aj(Pi<j ai)α−1. Suppose ak > ak+1, then let ak = l, ak+1 = s; moreover, we can scale the numbers so thatPi<k ai = 1. Now swapping ak and ak+1 causes a decrease of (ak − ak+1) · 1α−1 + ak+1(1 + ak)α−1 − ak(1 + ak+1)α−1 = (l − s) + s(1 + l)α−1 − l(1 + s)α−1. And for α ≥ 2 this quantity is non-negative. Finally, for the case α ∈ [1, 2). Note that αδ ≤ 1 for our choice of δ, so the LHS of (5.23) is at least αδ Xj∈[T ] ≥ αδ Xj∈[T ] aj(cid:18)Xi<j ai(cid:19)α−1 ai(cid:19)α−1 aj(cid:18)Xi≤j + aα−1 j  + (1 − α)δα/(α−1)(cid:18) Xj∈[T ] + (1 − α)δα/(α−1)(cid:18) Xj∈[T ] aj(cid:19)α aj(cid:19)α The second inequality used the fact that aβ + bβ ≥ (a + b)β for β ∈ (0, 1). Now the proof proceeds as usual and gives us the desired O(eα)α bound. 12 5.2 Approach II: Randomized Rounding We now explain a different way of obtaining integer solutions: by rounding (in an online fashion) the fractional solutions obtained for the problems that we consider into integral solutions. While this has a weaker result, it is a simple strategy that may be useful in some contexts. Suppose we have a fractional solution w.r.t the above parameters (after including the assignment cost). While it is known that the convex programming formulation we use has an integrality gap of 2 [AE05, AKMPS09], these proofs use correlated rounding procedures which we currently are not able to implement online. Instead we analyze the simple online rounding procedure that independently and randomly rounds the fractional assignment. Indeed, suppose we independently assign each job j to a machine e with probability exje. Denote the integer assignment induced by this random experiment by Yje. Let Le = Pj ℓjeYje denote the random load on machine e after the independent random- ized rounding. Note that Le is a sum of non-negative and independent random variables. We can now use the following inequality (for bounding higher moments of sums of random variables) due to Rosenthal [Ros70, JSZ85] to get that E [Lα e ]1/α ≤ Kα max(cid:18)Xj E [ℓjeYje] ,(cid:18)Xj jeY α je(cid:3)(cid:19)1/α(cid:19), E(cid:2)ℓα where Kα = O(α/ log α). However we know that Pj Pj E[ℓα jeexje(cid:19)1/α(cid:19)(cid:19)α E [ℓjeYje] =Pj ℓjeexje, and that Pj E[ℓα jeexje. Substituting this back in and using (a + b)α ≤ 2α−1(aα + bα), we get cjexje(cid:19). jeYje] =Pj ℓα e ] ≤(cid:18)Kα max(cid:18)Xj ℓjeexje(cid:1)α +Xj α(cid:18)(cid:0)Xj E[Lα ℓjeexje,(cid:18)Xj Summing over all e, we infer that E[Pe Lα ℓα e ] is at most (2Kα)α times the value of the online frac- tional solution objective, and hence at most (2αKα)α = O(α2/ log α)α times the integer optimum by [AAG+95, Car08] give Theorem 2.4. O(α)α-competitive online algorithms for the integer case.) (Note that the results of the previous section, and those of ≤ 2α−1K α jeY α je] = 6 Conclusion The online primal-dual dual technique (surveyed in [BN07]) has proven to be a widely-systematically- applicable method to analyze online algorithms for problems expressible by linear programs. This paper develops an analogous technique to analyze online algorithms for problems expressible by nonlinear programs. The main difference is that in the nonlinear setting one can not disentangle the objective and the constraints in the dual, and hence the arguments for the dual have a somewhat different feel to them than in the linear setting. We apply this technique to several natural nonlinear covering problems, most notably obtaining competitive analysis for greedy algorithms for uniprocessor speed scaling problems with essentially arbitrary scheduling objectives that researchers were not previously able to analyze using the prevailing potential function based analysis techniques. Independently and concurrently with this work, Anand, Garg and Kumar [AGK12] obtained results that are in the same spirit as the results obtained here. Mostly notably, they showed how to use nonlinear- duality to analyze a greedy algorithm for a multiprocessor speed-scaling problem involving minimizing flow plus energy on unrelated machines. More generally, [AGK12] showed how duality based analyses could be given for several scheduling algorithms that were analyzed in the literature using potential functions. 13 References [AAF+97] James Aspnes, Yossi Azar, Amos Fiat, Serge Plotkin, and Orli Waarts. On-line routing of virtual circuits with applications to load balancing and machine scheduling. J. ACM, 44(3):486 -- 504, 1997. [AAG+95] Baruch Awerbuch, Yossi Azar, Edward F. Grove, Ming-Yang Kao, P. Krishnan, and Jeffrey Scott Vitter. Load balancing in the lp norm. In FOCS, pages 383 -- 391, 1995. [AAZ10] [AAZ11] [AE05] [AF07] [AGK12] Matthew Andrews, Spyridon Antonakopoulos, and Lisa Zhang. Minimum-cost network design with (dis)economies of scale. In FOCS, pages 585 -- 592, 2010. Matthew Andrews, Spyridon Antonakopoulos, and Lisa Zhang. Energy-aware scheduling algorithms for network stability. In INFOCOM, pages 1359 -- 1367, 2011. Yossi Azar and Amir Epstein. Convex programming for scheduling unrelated parallel machines. In STOC'05: Proceedings of the 37th Annual ACM Symposium on Theory of Computing, pages 331 -- 337. ACM, New York, 2005. Susanne Albers and Hiroshi Fujiwara. Energy-efficient algorithms for flow time minimization. ACM Transactions on Algorithms, 3(4):49, 2007. S. Anand, Naveen Garg, and Amit Kumar. Resource augmentation for weighted flow-time explained by dual fitting. In SODA, 2012. [AKMPS09] V. S. Anil Kumar, Madhav V. Marathe, Srinivasan Parthasarathy, and Aravind Srinivasan. A unified approach to scheduling on unrelated parallel machines. J. ACM, 56(5):Art. 28, 31, 2009. [Alb10] Susanne Albers. Energy-efficient algorithms. Commun. ACM, 53(5):86 -- 96, 2010. [ALW10] Lachlan L. H. Andrew, Minghong Lin, and Adam Wierman. Optimality, fairness, and robustness in speed scaling designs. In SIGMETRICS, pages 37 -- 48, 2010. [BBCP11] Nikhil Bansal, David P. Bunde, Ho-Leung Chan, and Kirk Pruhs. Average rate speed scaling. Algorithmica, 60(4):877 -- 889, 2011. [BCP09] Nikhil Bansal, Ho-Leung Chan, and Kirk Pruhs. Speed scaling with an arbitrary power function. In SODA, pages 693 -- 701, 2009. [BCPK09] Nikhil Bansal, Ho-Leung Chan, Kirk Pruhs, and Dmitriy Katz. Improved bounds for speed scaling in devices obeying the cube-root rule. In ICALP (1), pages 144 -- 155, 2009. [BKP07] N. Bansal, T. Kimbrel, and K. Pruhs. Speed scaling to manage energy and temperature. JACM, 54(1), 2007. [BLMSP06] Luca Becchetti, Stefano Leonardi, Alberto Marchetti-Spaccamela, and Kirk Pruhs. Online weighted flow time and deadline scheduling. Journal of Discrete Algorithms, 4(3):339 -- 352, 2006. [BN07] [BP10] [BPS09] [BV04] [Car08] [CEL+09] [CLL10] Niv Buchbinder and Joseph Naor. The design of competitive online algorithms via a primal-dual approach. Found. Trends Theor. Comput. Sci., 3(2-3):front matter, 93 -- 263 (2009), 2007. Nikhil Bansal and Kirk Pruhs. Server scheduling to balance priorities, fairness, and average quality of service. SIAM J. Comput., 39(7):3311 -- 3335, 2010. Nikhil Bansal, Kirk Pruhs, and Clifford Stein. Speed scaling for weighted flow time. SIAM J. Comput., 39(4):1294 -- 1308, 2009. Stephen Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University Press, New York, NY, USA, 2004. Ioannis Caragiannis. Better bounds for online load balancing on unrelated machines. In Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 972 -- 981, New York, 2008. ACM. Ho-Leung Chan, Jeff Edmonds, Tak Wah Lam, Lap-Kei Lee, Alberto Marchetti-Spaccamela, and Kirk Pruhs. Nonclairvoyant speed scaling for flow and energy. In STACS, pages 255 -- 264, 2009. Sze-Hang Chan, Tak Wah Lam, and Lap-Kei Lee. Non-clairvoyant speed scaling for weighted flow time. In ESA (1), pages 23 -- 35, 2010. 14 [GIK+10] Anupam Gupta, Sungjin Im, Ravishankar Krishnaswamy, Benjamin Moseley, and Kirk Pruhs. Scheduling jobs with varying parallelizability to reduce variance. In SPAA, pages 11 -- 20, 2010. [IM10] [IMP11] [JSZ85] Sungjin Im and Benjamin Moseley. An online scalable algorithm for average flow time in broadcast scheduling. In SODA, pages 1322 -- 1333, 2010. Sungjin Im, Benjamin Moseley, and Kirk Pruhs. A tutorial on amortized local competitiveness in online scheduling. SIGACT News, 42(2):83 -- 97, 2011. W. B. Johnson, G. Schechtman, and J. Zinn. Best constants in moment inequalities for linear combinations of independent and exchangeable random variables. Ann. Probab., 13(1):234 -- 253, 1985. [LLTW08] T.W. Lam, L.K. Lee, Isaac To, and P. Wong. Speed scaling functions based for flow time scheduling based on active job count. In European Symposium on Algorithms, pages 647 -- 659, 2008. [PUW08] Kirk Pruhs, Patchrawat Uthaisombut, and Gerhard J. Woeginger. Getting the best response for your erg. ACM Transactions on Algorithms, 4(3), 2008. [Ros70] [YDS95] Haskell P. Rosenthal. On the subspaces of Lp (p > 2) spanned by sequences of independent random variables. Israel J. Math., 8:273 -- 303, 1970. F. Yao, A. Demers, and S. Shenker. A scheduling model for reduced CPU energy. In Proc. IEEE Symp. Foundations of Computer Science, pages 374 -- 382, 1995. 15
1906.11327
1
1906
2019-06-26T20:15:54
The Adversarial Robustness of Sampling
[ "cs.DS", "cs.CG", "cs.CR", "cs.DB", "cs.DC" ]
Random sampling is a fundamental primitive in modern algorithms, statistics, and machine learning, used as a generic method to obtain a small yet "representative" subset of the data. In this work, we investigate the robustness of sampling against adaptive adversarial attacks in a streaming setting: An adversary sends a stream of elements from a universe $U$ to a sampling algorithm (e.g., Bernoulli sampling or reservoir sampling), with the goal of making the sample "very unrepresentative" of the underlying data stream. The adversary is fully adaptive in the sense that it knows the exact content of the sample at any given point along the stream, and can choose which element to send next accordingly, in an online manner. Well-known results in the static setting indicate that if the full stream is chosen in advance (non-adaptively), then a random sample of size $\Omega(d / \varepsilon^2)$ is an $\varepsilon$-approximation of the full data with good probability, where $d$ is the VC-dimension of the underlying set system $(U,R)$. Does this sample size suffice for robustness against an adaptive adversary? The simplistic answer is \emph{negative}: We demonstrate a set system where a constant sample size (corresponding to VC-dimension $1$) suffices in the static setting, yet an adaptive adversary can make the sample very unrepresentative, as long as the sample size is (strongly) sublinear in the stream length, using a simple and easy-to-implement attack. However, this attack is "theoretical only", requiring the set system size to (essentially) be exponential in the stream length. This is not a coincidence: We show that to make Bernoulli or reservoir sampling robust against adaptive adversaries, the modification required is solely to replace the VC-dimension term $d$ in the sample size with the cardinality term $\log |R|$. This nearly matches the bound imposed by the attack.
cs.DS
cs
The Adversarial Robustness of Sampling Omri Ben-Eliezer∗ Eylon Yogev† Abstract Random sampling is a fundamental primitive in modern algorithms, statistics, and ma- chine learning, used as a generic method to obtain a small yet "representative" subset of the data. In this work, we investigate the robustness of sampling against adaptive adversarial attacks in a streaming setting: An adversary sends a stream of elements from a universe U to a sampling algorithm (e.g., Bernoulli sampling or reservoir sampling), with the goal of mak- ing the sample "very unrepresentative" of the underlying data stream. The adversary is fully adaptive in the sense that it knows the exact content of the sample at any given point along the stream, and can choose which element to send next accordingly, in an online manner. Well-known results in the static setting indicate that if the full stream is chosen in advance (non-adaptively), then a random sample of size Ω(d/ε2) is an ε-approximation of the full data with good probability, where d is the VC-dimension of the underlying set system (U, R). Does this sample size suffice for robustness against an adaptive adversary? The simplistic answer is negative: We demonstrate a set system where a constant sample size (corresponding to a VC-dimension of 1) suffices in the static setting, yet an adaptive adversary can make the sample very unrepresentative, as long as the sample size is (strongly) sublinear in the stream length, using a simple and easy-to-implement attack. However, this attack is "theoretical only", requiring the set system size to (essentially) be exponential in the stream length. This is not a coincidence: We show that in order to make the sampling algorithm robust against adaptive adversaries, the modification required is solely to replace the VC-dimension term d in the sample size with the cardinality term log R. That is, the Bernoulli and reservoir sampling algorithms with sample size Ω(log R/ε2) output a representative sample of the stream with good probability, even in the presence of an adaptive adversary. This nearly matches the bound imposed by the attack. 9 1 0 2 n u J 6 2 ] S D . s c [ 1 v 7 2 3 1 1 . 6 0 9 1 : v i X r a ∗Blavatnik School of Computer Science, Tel Aviv University, Tel Aviv 69978, Israel. †Department of Computer Science, Technion, Haifa, Israel. Supported by the European Union's Horizon 2020 research and innovation program under grant agreement no. 742754, and by a grant from the Israel Science Foundation (no. 950/16). 1 Introduction Random sampling is a simple, generic, and universal method to deal with massive amounts of data across all scientific disciplines. It has wide-ranging applications in statistics, databases, networking, data mining, approximation algorithms, randomized algorithms, machine learning, and other fields (see e.g., [CJSS03, JMR05, JPA04, CDK+11, CG05, CMY11] and [Cha01, Chapter 4]). Perhaps the central reason for its wide applicability is the fact that it (provably, and with high probability) suffices to take only a small number of random samples from a large dataset in order to "represent" the dataset truthfully (the precise geometric meaning is explained later). Thus, instead of performing costly and sometimes infeasible computations on the full dataset, one can sample a small yet "representative" subset of a data, perform the required analysis on this small subset, and extrapolate (approximate) conclusions from the small subset to the entire dataset. The analysis of sampling algorithms has mostly been studied in the non-adaptive (or static) setting, where the data is fixed in advance, and then the sampling procedure runs on the fixed data. However, it is not always realistic to assume that the data does not change during the sampling procedure, as described in [MNS11, GHR+12, GHS+12, HW13, NY15]. In this work, we study the robustness of sampling in an adaptive adversarial environment. In high-level, the model is a two-player game between a ran- The adversarial environment. domized streaming algorithm, called Sampler, and an adaptive player, Adversary. In each round, 1. Adversary first submits an element to Sampler. The choice of the element can depend, pos- sibly in a probabilistic manner, on all elements submitted by Adversary up to this point, as well as all information that Adversary observed from Sampler up to this point. 2. Next, Sampler probabilistically updates its internal state, i.e., the sample that it currently maintains. An update step usually involves an insertion of the newly received element to the sample with some probability, and sometimes deletion of old elements from the sample. 3. Finally, Adversary is allowed to observe the current (updated) state of Sampler, before pro- ceeding to the next round. Adversary's goal is to make the sample as unrepresentative as possible, causing Sampler to come with false conclusions about the data stream. The game is formally described in Section 2. Adversarial scenarios are common and arise in different settings. An adversary uses adver- sarial examples to fool a trained machine learning model [SZS+14, MHS19]; In the field of online learning [Haz16], adversaries are typically adaptive [SS17, LMPL18]. An online store suggests recommended items based on a sample of previous purchases, which in turn influences future sales [Sha12, GHR+12]. A network device routes traffic according to statistics pulled from a sam- pled substream of packets [DLT05], and an adversary that observes the network's traffic learns the device's routing choices might cause a denial-of-service attack by generating a small amount of adversarial traffic [NY15]. A high-frequency stock trading algorithm monitors a stream of stock orders places buy/sell requires based on statistics drawn from samples; A competitor might fool the sampling algorithm by observing its requests and modifying future stock orders accordingly. An autonomous vehicle receives physical signals from its immediate environment (which might be adversarial [SBM+18]) and has to decide on a suitable course of action. 1 Even when there is no apparent adversary, the adaptive perspective is sometimes natural and required. For instance, adaptive data analysis [DFH+15, WFRS18] aims to understand the challenges arising when data arrives online, such as data reuse, the implicit bias "collected" over time in scientific discovery, and the evolution of statistical hypotheses over time. In graph algorithms, [CGP+18] observed that an adversarial analysis of dynamic spanners would yield a simpler (and quantitively better) alternative to their work. In view of the importance of robustness against adaptive adversaries, and the fact that random sampling is very widely used in practice (including in streaming settings), we ask the following. Are sampling algorithms robust against adaptive adversaries? Bernoulli and reservoir sampling. We mainly focus on two of the most basic and well-known sampling algorithms: Bernoulli sampling and reservoir sampling. The Bernoulli sampling al- gorithm with parameter p ∈ [0, 1] runs as follows: whenever it receives a stream element xi, the algorithm stores the element with probability p. For a stream of length n the sample size is expected to be np; and furthermore, it is well-concentrated around this value. We denote this algorithm by BernoulliSample. The classical reservoir sampling algorithm [Vit85] (see also [Knu97, Section 3.4.2] and a formal description in Section 2) with parameter k ∈ [n] maintains a uniform sample of fixed size k, acting as follows. The first k elements it receives, x1, . . . , xk, are simply added to the memory with probability one. When the algorithm receives its ith element xi, where i > k, it stores it with probability k/i, by overriding a uniformly random element from the memory (so the memory size is kept fixed to k). We henceforth denote this algorithm by ReservoirSample. Attacking sampling algorithms. To answer the question above of whether sampling algorithms are robust against adversarially chosen streams, we must first define a notion of a representative sample, as several notions might be appropriate. However, we begin the discussion with an example showing how to attack the Bernoulli (and reservoir) sampling algorithm with respect to merely any definition of "representative". Consider a setting where the stream consists of n points x1, . . . , xn in the one-dimensional range of real numbers [0, 1]. BernoulliSample receives these points and samples each one indepen- dently with probability p < 1. One can observe that, in the static setting and for sufficiently large p, the sampled set will be a good representation of the entire n points for various definitions of the term "representation". For example, the median of the stream will be ε-close1 to the median of the sampled elements with high probability, as long as p = c ε2n for some constant c > 0 (this also holds for any other quantile). Consider the following adaptive adversary which will demonstrate the difference of the adap- tive setting. Adversary keeps a "working range" at any point during the game, starting with the full range [0, 1]. In the first round, Adversary chooses the number x1 = 0.5 as the first element in the stream. If x1 is sampled, then Adversary moves to the range [0.5, 1], and otherwise, to the range [0, 0.5]. Next, Adversary submits x2 as the middle of the current range. This continues for n steps; Formally, Adversary's strategy is as follows. Set a1 = 0 and b1 = 1. In round i, where i runs 1The term "close" here means that the median of the sampled set will be an element whose order among the elements of the full stream, when the elements are sorted by value from smallest to largest, is within the range (1 ± ǫ)n/2, with high probability where the parameter ǫ depends on the probability p. 2 from 1 to n, Adversary submits xi = ai+bi 2 ai+1 = xi, bi+1 = bi, and otherwise, it sets ai+1 = ai, bi+1 = xi. The final stream is x1, . . . , xn. to BernoulliSample; If xi is sampled then Adversary sets Note that at any point throughout the process, Adversary always submits an element that is larger than all elements in the current sampled set, and also smaller than all the non-sampled ele- ments of the stream. Therefore, the end result is that after this process is over, with probability 1, the k sampled elements are precisely the smallest k elements in the stream. Of course, the median of the sampled set is far from the median of the stream as such a subset is very unrepresentative of the data. Actually, one might consider it as the "most unrepresentative" subset of the data. The exact same attack on BernoulliSample works almost as effectively against ReservoirSample. In this case, the attack will cause all of the k sampled elements at the end of the process to lie among the first O(k ln n) elements with high probability. For more details, see Section 5. The good news. This attack joins a line of attacks in the adversarial model. Lipton and Naughton [LN93] showed that an adversary that can measure the time of operations in a dic- tionary can use this information to increase the probability of a collision and as a result, signif- icantly decrease the performance of the hashtable. Hardt and Woodruff [HW13] showed that linear sketches are inherently non-robust and cannot be used to compute the Euclidean norm of its input (where in the static setting they are used mainly for this reason). Naor and Yogev [NY15] showed that Bloom filters are susceptible to attacks by an adaptive stream of queries if the adversary is computationally unbounded and they also constructed a robust Bloom filter against computationally bounded adversaries. In our case, we note that the given attack might categorize it as "theoretical" only. In practice, it is unrealistic to assume that the universe from which Adversary can pick elements is an infinite set; how would the attack look, then, if the universe is the discrete set [N] = {1, . . . , N}? Adversary splits the range [0, 1] to half for n times, meaning that the precision of the elements required is exponential; The analogous attack in the discrete setting requires N to be exponentially large with respect to the stream size n. Such a universe size is large and "unrealistic": for Sampler to memorize even a single element requires memory size that is linear in n, whilst sampling and streaming algorithms usually aim to use an amount sublinear in n of memory. Thus, the question remains whether there exist attacks that can be performed on elements us- ing substantially less precision, that is, on a significantly smaller size of discrete universe. In this work, we bring good news to both the Bernoulli and reservoir sampling algorithms by answer- ing this question negatively. We show that both sampling algorithms, with the right parameters, will output a representative sample with good probability regardless of Adversary's strategy, thus exhibiting robustness for these algorithms in adversarial settings. We note that any deterministic algorithm that works in the static setting is inherently robust in the adversarial adaptive setting as well. However, in many cases, deterministic algorithms with small memory simply do not exist, or they are complicated and tailored for a specific task. Here, we enjoy the simplicity of a generic randomized sampling algorithm combined with the robust guarantees of our framework. What is a representative sample? Perhaps the most standard and well-known notion of being representative is that of an ε-approximation, first suggested by Vapnik and Chervonenkis [VC71] (see also [MV17]), which originated as a natural notion of discrepancy [Cha01] in the geometric literature. It is closely related to the celebrated notion of VC-dimension [VC71, Sau72, She72], and 3 captures many quantitative properties that are desired in a random subset. Let X = (x1, . . . , xn) be a sequence of elements from the universe U (repetitions are allowed) and let R ⊆ U. The density of R in X is the fraction of elements in X that are also in R (i.e., dR(X) = Pri∈[n][xi ∈ R]). A set system is simply a pair (U, R) where R ⊆ 2U is a collection of subsets. A non-empty subsequence S of X is an ε-approximation of X with respect to the set system (U, R) if it preserves densities (up to an ε factor) for all subsets R ∈ R. Definition 1.1 (ε-approximation). We say that a (non-empty) sample S is an ε-approximation of X with respect to R if for any subset R ∈ R it holds that dR(X) − dR(S) ≤ ε. If the universe U is well-ordered, it is natural to take R as the collection of all consecutive intervals in U, that is, R = {[a, b] : a ≤ b ∈ U} (including all singletons [a, a]). With this set system in hand, ε-approximation is a natural form of "good representation" in the streaming setting, pointed out by its deep connection to multiple classical problems in the streaming litera- ture, like approximate median, and more generally, quantile estimation [MRL99, GK01, WLYC13, GK16, KLL16] and range searching [BCEG07]. In particular, if S is an ε-approximation of X w.r.t. (U, R), then any q-quantile of S is ε-close to the q-quantile of X; this holds simultaneously for all quantiles (see Section 1.2). 1.1 Our Results Fix a set system (U, R) over the universe U. A sampling algorithm is called (ε, δ)-robust if for any (even computationally unbounded) strategy of Adversary, the output sample S is an ε- approximation of the whole stream X with respect to (U, R), with probability at least 1 − δ. Our main result is an upper bound ("good news") on the (ε, δ)-robustness of Bernoulli and reservoir sampling, later to be complemented them with near-matching lower bounds. Theorem 1.2. For any 0 < ε, δ < 1, set system (U, R), and stream length n, the following holds. • BernoulliSample with parameter p ≥ 10 · ln R+ln(4/δ) ε2n is (ε, δ)-robust. • ReservoirSample with parameter k ≥ 2 · ln R+ln(2/δ) ε2 is (ε, δ)-robust. The proof appears in Section 4. As the total number of elements sampled by BernoulliSample is well-concentrated around np, the above theorem implies that a sample of total size (at least) Θ( ln R+ln 1 approximation with probability 1 − δ. ), obtained by any of the algorithms, BernoulliSample or ReservoirSample, is an ε- ε2 δ This should be compared with the static setting, where the same result is known as long as p ≥ c · d+ln 1 ε2n dimension of (U, R) and c > 0 is a constant [VC71, Tal94, LLS01] (see also [MV17]). for BernoulliSample, and k ≥ c · d+ln 1 ε2 for ReservoirSample, where d is the VC- δ δ As you can see, to make the static sampling algorithm robust in the adaptive setting one solely needs to modify the sample size by replacing the VC-dimension term d with the cardinality dimension ln R (and update the multiplicative constant). Below, in our lower bounds, we show that this increase in the sample size is inherent, and not a byproduct of our analysis. 4 Lower Bounds. We next show that being adaptively robust comes at a price. That is, the de- pendence on the cardinality dimension, as opposed to the VC dimension, is necessary. By an improved version of the attack described in the introduction, we show the following: Theorem 1.3. There exists a constant c > 0 and a set system (U, R) with VC-dimension 1, where such that for any 0 < ε, δ < 1/2: 1. The BernoulliSample algorithm with parameter p < c · ln R n ln n is not (ε, δ)-robust. 2. The ReservoirSample algorithm with parameter k < c · ln R ln n is not (ε, δ)-robust. Moreover, for any n6 ln n ≤ N ≤ 2n/2, there exists (U, R) as above where R = U = N. The proof can be found in Section 5. Continuous robustness. The condition of (ε, δ)-robustness requires that the sample will be ε-representative of the stream in the end of the process. What if we wish the sample to be repre- sentative of the stream at any point throughout the stream? Formally, we say that a sampling algorithm is (ε, δ)-continuously robust if, with probability at least 1 − δ, at any point i ∈ [n] the sampled set Si is an ε-approximation of the first i elements of the stream, i.e., of Xi = (x1, . . . , xi). The next theorem shows that continuous robustness of ReservoirSample can be obtained with just a small overhead compared to "standard" robustness. (For BernoulliSample one cannot hope for such a result to be true, at least for the above definition of continuous robustness.) Theorem 1.4. There exists c > 0, such that for any 0 < ε, δ < 1/2, set system (U, R), and stream length n, ReservoirSample with parameter k ≥ c · ln R+ln 1/δ+ln 1/ε+ln ln n is (ε, δ)-continuously robust. ε2 Moreover, if only continuous robustness against a static adversary is desired, then the ln R term can be replaced with the VC-dimension of (U, R). We are not aware of a previous analysis of continuous robustness, even in the static setting. The proof, appearing in Section 6, follows by applying Theorem 1.2 (or its static analogue) in carefully picked "checkpoints" k = i1 ≤ i2 ≤ . . . ≤ it = n along the stream, where t = O(ε−1 ln n). It shows that if the sample Si is representative of the stream Xi in any of the points i = i1, . . . , it−1, then with high probability, the sample is also representative in any other point along the stream. (We remark that a similar statement with weaker dependence on n can be obtained from Theorem 1.2 by a straightforward union bound.) The proof can be found in Section 6. Comparison to deterministic sampling algorithms. Our results show that sampling algorithms provide an ε-approximation in the adversarial model. One advantage of using the notion of ε- approximation is its wide array of applications, where for each such task we get a streaming algorithm in the adversarial model as described in the following subsection. We stress that for any specific task a deterministic algorithm that works in the static setting will also automatically be robust in the adversarial setting. However, deterministic algorithms tend to be more compli- cated, and in some cases they require larger memory. Here, we focus on showing that the most simple and generic sampling algorithms "as is" are robust in our adaptive model and yield a representative sample of the data that can be used for many different applications. The best known deterministic algorithm for computing an ε-approximating sample in the streaming model is that of Bagchi et al. [BCEG07]. The sample size they obtain is O(ε−2 ln 1/ε); 5 the working space of their algorithm and the processing time per element are of the form ε−2d−O(1)(ln n)O(d), where d is the scaffold dimension2 of the set system. The exact bounds are rather intricate, see Corollary 4.2 in [BCEG07]. While the space requirement of their approach does not have a dependence on ln R, its dependence on ε and ln n is generally worse than ours, making their bounds somewhat incomparable to ours. Finally, we note that there exist more efficient methods to generate an ε-approximation in some special cases, e.g., when the set system constitutes of rectangles or halfspaces [STZ04]. 1.2 Applications of Our Results We next describe several representative applications and usages of ε-approximations (see also [BCEG07] for more applications in the area of robust statistics). For some of these applications, there exist deterministic algorithms known to require less memory than the simple random sam- pling models discuss in this paper. However, one area where our generic random sampling approach shines compared to deterministic approaches is the query complexity or running time (under a suitable computational model). Indeed, while deterministic algorithms must inherently query all elements in the stream in order to run correctly, our random sampling methods query just a small sublinear portion of the elements in the stream. Consequently, to the best of our knowledge, Bernoulli and reservoir sampling are the first two methods known to compute an ε-approximation (and as a byproduct, solve the tasks described in this subsection) in adversarial situations where it is unrealistic or too costly to query all elements in the stream. The last part of this subsection exhibits an example of one such situation. Quantile approximation. As was previously mentioned, ε-approximations have a deep connec- tion to approximate median (and more generally, quantile estimation). Assume the universe U is well-ordered. We say that a streaming algorithm is an (ε, δ)-robust quantile sketch if, in our adversarial model, it provides a sample that allows to approximate the rank3 of any element in the stream up to additive error εn with probability at least 1 − δ. Observe that this is achieved with an ε-approximation with respect to the set system (U, R) where R = {[1, b] : b ∈ U}. For example, set b to be the median of the stream. Since the density of the range [1, b] is preserved in the sample, we know that the median of the sample will be ε-close to the median of the stream. This works for any other quantile simultaneously. The sample size is Θ( ln U+ln(1/δ) ). ε2 Corollary 1.5. For any 0 < ε, δ < 1, well-ordered universe U, and stream length n, BernoulliSample with parameter p ≥ 10 · ln U+ln(4/δ) is an (ε, δ)-robust quantile sketch. The same holds for the ReservoirSample algorithm with parameter k ≥ 2 · ln U+ln(2/δ) ε2n . ε2 A corollary in the same spirit regarding continuously robust quantile sketches can be derived from Theorem 1.4. Range queries. Suppose that the universe is of the form U = [m]d for some parameters m and d. One basic problem is that of range queries: one is given a set of ranges R and each query consists of a range R ∈ R where the desired answer is the number of points in the stream that 2The scaffold dimension is a variant of the VC-dimension equal to ⌈ln R/ ln U⌉. 3The rank of an element xi in a stream x1, . . . , xn is the total amount of elements xj in the stream so that xj ≤ xi. 6 are in this range. Popular choices of such ranges are axis-aligned or rotated boxes, spherical ranges and simplicial ranges. An ε-approximation allows us to answer such range queries up to an additive error of εn. Suppose the sampled set is S, then an answer is given by computing dR(S) · n/S. For example, when R consists of all axis-parallel boxes, ln R = O(d ln m) and thus the sample size required to answer range queries that are robust against adversarial streams [BCEG07] for more details on the connection between ε-approximations and range queries. (cid:17); for rotated boxes, one should replace d with d2 in this expression. See is S = O(cid:16) d ln m+ln(1/δ) ε2 Center points. Our result is also useful for computing β-center points. A point c in the stream is a β-center point if every closed halfspace containing c in fact contains at least βn points of the stream. In [CEM+96, Lemma 6.1] it has been shown that an ε-approximation (with respect to half-spaces) can be used to get a β-center point for suitable choices of the parameters. For example, setting ε = β/5 we get that a 6β/5-center of the sample S is a β-center of the stream X. Thus, we can compute a β-center of a stream in the adversarial model. See also [BCEG07]. Heavy hitters. Finding those elements that appear many times in a stream is a fundamental problem in data mining, with a myriad of practical applications. In the heavy hitters problem, there is a threshold α and an error parameter ε. The goal is to output a list of elements such that if an element x appears more than αn times in the stream (i.e., dx(X) ≥ α) it must be included in the list, and if an element appears less than (α − ε)n times in the stream (i.e., dx(X) ≤ α − ε it cannot be included in the list. Our results yield a simple and efficient heavy hitters streaming algorithm in the adversarial model. For any universe U let R = {{a} : a ∈ U} be the set of all singletons. Now, pick ε′ = ε/3 and use either Bernoulli or reservoir sampling to compute an ε′-approximation S of the stream X, outputting all elements x ∈ S with d{x}(S) ≥ α − ε′. Indeed, if da(X) ≥ α then dx(S) ≥ α − ε′. On the other hand, if dx(X) ≤ α − ε then dx(S) ≤ α − ε + ε′ < α − ε′. Corollary 1.6. There exists c > 0 such that for any 0 < ε, δ < 1/2, universe U, and stream length n, BernoulliSample with parameter p ≥ c · ln U+ln(1/δ) solves the heavy hitters problem with error ε in the adversarial model. The same holds for ReservoirSample with parameter k ≥ c · ln U+ln(1/δ) ε2n . ε2 Clustering. The task of partitioning data elements into separate groups, where the elements in each group are "similar" and elements in different groups are "dissimilar" is fundamental and useful for numerous applications across computer science. There has been lots of interest on clustering in a streaming setting, see e.g. [GLA16] for a survey on recent results. Our results suggest a generic framework to accelerate clustering algorithms in the adversarial model: Instead of running clustering on the full data, one can simply sample the data to obtain (with high probability, even against an adversary) an ε-approximation of it, run the clustering algorithm on the sample, and then extrapolate the results to the full dataset. It is very common to use random sampling Sampling in modern data-processing systems. (sometimes "in disguise") in modern data-intensive systems that operate on streaming data, ar- riving in an online manner. As an illustrative example, consider the following distributed database [OV11] setting. Suppose that a database system must receive and process a huge amount of 7 It is unrealistic for a single server to handle all the queries, and hence, queries per second. for load balancing purposes, each incoming query is randomly assigned to one of K query- processing servers. Seeing that the set of queries that each such server receives is essentially a Bernoulli random sample (with parameter p = 1/K) of the full stream, one hopes that the por- tion of the stream sampled by each of these servers would truthfully represent the whole data stream (e.g., for query optimization purposes), even if the stream changes with time (either unin- tentionally or by a malicious adversary). Such "representation guarantees" are also desirable in distributed machine learning systems [GDG+17, SKYL17], where each processing unit learns a model according to the portion of the data it received, and the models are then aggregated, with the hope that each of the units processed "similar" data. In general, modern data-intensive systems like those described above become more and more complicated with time, consisting of a large number of different components. Making these systems robust against environmental changes in the data, let alone adversarial changes, is one of the greatest challenges in modern computer science. From our perspective, the following question naturally emerges: Is random sampling a risk in modern data processing systems? Fortunately, our results indicate that the answer to this question is largely negative. Our up- per bounds, Theorems 1.2 and 1.4, show that a sufficiently large sample suffices to circumvent adversarial changes of the environment. 1.3 Related Work Online learning. One related field to our work is online learning, which was introduced for settings where the data is given in a sequential online manner or where it is necessary for the learning algorithm to adapt to changes in the data. Examples include stock price predictions, ad click prediction, and more (see [Sha12] for an overview and more examples). Similar to our model, online learning is viewed as a repeated game between a learning algo- rithm (or a predictor) and the environment (i.e., the adversary). It considers n rounds where in each round the environment submits an instance xi, the learning algorithm then makes a predic- tion for xi, the environment, in turn, chooses a loss for this prediction and sends it as feedback to the algorithm. The goal in this model is usually to minimize regret (the sum of losses) com- pared to the best fixed prediction in hindsight. This is the typical setting (e.g., [HAK07, SST10]), however, many different variants exist (e.g., [DGS15, ZLZ18]). In the PAC-learning framework [Val84], the learner algorithm receives samples PAC learning. generated from an unknown distribution and must choose a hypothesis function from a family of hypotheses that best predicts the data with respect to the given distribution. It is known that the number of samples required for a class to be learnable in this model depends on the VC-dimension of the class. A recent work of Cullina et al. [CBM18] investigates the effect of evasion adversaries on the PAC-learning framework, coining the term of adversarial VC-dimension for the parameter govern- ing the sample complexity. Despite the name similarity, their context is seemingly unrelated to ours (in particular, it is not a streaming setting), and correspondingly, their notion of adversarial VC-dimension does not seem to relate to our work. 8 Adversarial examples in deep learning. A very popular line of research in modern deep learn- ing proposes methods to attack neural networks, and countermeasures to these attacks. In such a setting, an adversary performs adaptive queries to the learned model in order to fool the model via a malicious input. The learning algorithms usually have an underlying assumption that the training and test data are generated from the same statistical distribution. However, in practice, the presence of an adaptive adversary violates this assumption. There are many devastating ex- amples of attacks on learning models [SZS+14, BCM+13, PMG+17, BR18, MHS19] and we stress that currently, the understanding of techniques to defend against such adversaries is rather lim- ited [GMP18, MW18, MM19, MHS19]. Maintaining random samples. Reservoir sampling is a simple and elegant algorithm for main- taining a random sample of a stream [Vit85], and since its proposal, many flavors have been introduced. Chung, Tirthapura, Woodruff [CTW16] generalized reservoir sampling to the setting of multiple distributed streams, which need to coordinate in order to continuously respond to queries over the union of all streams observed so far (see also Cormode et al. [CMYZ12]). An- other variant is weighted reservoir sampling where the probability of sampling an element is proportional to a weight associated with the element in the stream [ES06, BOV15]. A distributed version as above was recently considered for the weighted case as well [JSTW19]. 1.4 Paper Organization Section 2 contains an overview of our adversarial model and a more precise and detailed def- inition than the one given in the introduction. In Section 3 we mention several concentration In Section 4 we present and prove our main technical inequalities required for our analysis. Lemma, from which we derive Theorem 1.2. This includes analysis of both BernoulliSample and ReservoirSample. In Section 5 we present our "attack", i.e., our lower bound showing the tightness of our result. Finally, in Section 6, we prove our upper bounds in the continuous setting. 2 The Adversarial Model for Sampling In this section, we formally define the online adversarial model discussed in this paper. Roughly speaking, we say that Sampler is an (ε, δ)-robust sampling algorithm for a set system (U, R) if for any adversary choosing an adaptive stream of elements X = (x1, . . . , xn), the final state of the sampling algorithm σn is an ε-approximation of the stream with probability 1 − δ. This is formulated using a game, AdaptiveGame, between two players, Sampler and Adversary. Rules of the game: 1. Sampler is a streaming algorithm, which gets a sequence of n elements one by one x1, . . . , xn in an online manner (the sampling algorithms we discuss in this paper do not need to know n in advance). Upon receiving an element xi, Sampler can perform an arbitrary computation (the running time can be unbounded) and update a local state σ. We denote the local state after i steps by σi, and write σi ← Sampler(σi−1, xi). 2. The stream is chosen adaptively by Adversary: a probabilistic (unbounded) player that, given all previously sent elements x1, . . . , xi−1 and the current state σi−1, chooses the next element 9 xi to submit. The strategy that Adversary employs along the way, that is, the probability distribution over the choice of xi given any possible set of values x1, . . . , xi−1 and σi−1, is fixed in advance. The underlying (finite or infinite) set from which Adversary is allowed to choose elements during the game is called the universe, and denoted by U. We assume that U does not change along the game. 3. Once all n rounds of the game have ended, Sampler outputs σn. For the sampling algorithms discussed in this paper, S := σn is a subsequence of the stream X = (x1, . . . , xn). S is usually called the sample obtained by Sampler in the game. For an illustration on the rules of the game see Figure 1. The game AdaptiveGame Parameters: n, ε, (U, R). 1. Set σ0 = ⊥. 2. For i = 1 . . . n do: (a) Adversary(σi−1, x1, . . . , xi−1) submits the query xi. (b) Set σi ← Sampler(σi−1, xi). 3. Let S = σn, and output 1 if S is an ε-representative sample of X = x1, . . . , xn with respect to (U, R), and 0 otherwise. Figure 1: The definition of the game AdaptiveGameε between a streaming algorithm Sampler and Adversary. Here the adversary chooses the next element to the stream while given the state (memory) of the streaming algorithm thus-far. In the beginning of the game, Adversary receives the parameters n, ε, (U, R) and knows exactly which sampling algorithm is employed by Sampler. Using the game defined above, we now describe what it means for a sampling algorithm to be (adversarially) robust. Definition 2.1 (Robust sampling algorithm). We say that a sampling algorithm Sampler is (ε, δ)- robust with respect to the set system (U, R) and the stream length n if for and any (even unbounded) strategy of Adversary, it holds that Pr[AdaptiveGame(Sampler, Adversary) = 1] ≥ 1 − δ The memory size used by Sampler is defined to be the maximal size of σ throughout the process of AdaptiveGame. A stronger requirement that one can impose on the sampling algorithm is to hold an ε- approximation of the stream at any step during the game. To handle this, we define a continuous variant of AdaptiveGame which we denote ContinuousAdaptiveGame, presented in Figure 2. For the sampling algorithms that we consider, the state at any time σi is essentially equal to the sample Si. In any case, the definition of the framework given in Figure 2 generally allows σi 10 The game ContinuousAdaptiveGame Parameters: n, ε, (U, R). 1. Set σ0 = ⊥. 2. For i = 1 . . . n do: (a) Adversary((σi−1, Si−1), x1, . . . , xi−1) submits the query xi. (b) Set (σi, Si) ← Sampler(σi−1, xi). (c) If Si is not an ε-approximation of Xi = x1, . . . , xi with respect to (U, R) then output 0 and halt. 3. Output 1. Figure 2: The game corresponding to the continuous variant, ContinuousAdaptiveGame be- tween a streaming algorithm Sampler and an Adversary. Here, Sampler is required to hold an ε-approximating sampled set Si after each step. to contain additional information, if needed. A sampling algorithm is called (ε, δ)-continuously robust if the following holds with probability at least 1 − δ: for any strategy of Adversary, and all i ∈ [n], the sample Si is an ε-approximation of the stream at time i. Definition 2.2 (Continuously robust sampling algorithm). We say that a sampling algorithm Sampler is (ε, δ)-continuously robust with respect to the set system (U, R) and the stream length n if for and any (even unbounded) strategy of Adversary, it holds that Pr[ContinuousAdaptiveGame(Sampler, Adversary) = 1] ≥ 1 − δ The memory size used by Sampler is defined to be the maximal size of σ throughout the process of ContinuousAdaptiveGame. Reservoir sampling. For completeness, we provide the pseudocode of the reservoir sampling algorithm [Vit85, Knu97]. Here, k denotes the (fixed) memory size of the algorithm, i denotes the current round number, and xi is the currently received element. ReservoirSample(k, i, σi−1, xi): 1. If i < k then parse σi−1 = x1, . . . , xi−1 and output σi = x1, . . . , xi. 2. Otherwise, parse σi−1 = s1, . . . , sk. 3. With probability k/i do: choose j ∈ [k] uniformly at random and output σi = s1, . . . , sj−1, xi, sj+1, . . . , sk. 4. Otherwise, output σi = σi−1. 11 3 Technical Preliminaries The logarithms in this paper are usually of base e, and denoted by ln. The exponential function exp (x) is ex. For an integer n ∈ N we denote by [n] the set {1, . . . , n}. We state some con- centration inequalities, useful for our analysis in later sections. We start with the well-known Chernoff's inequality for sums of independent random variables. Theorem 3.1 (Chernoff Bound [Che52]; see Theorem 3.2 in [CL06]). Let X1, . . . , Xm be independent random variables that take the value 1 with probability pi and 0 otherwise, X = ∑m i=1 Xi, and µ = E[X]. Then for any 0 < δ < 1, and δ2µ Pr[X ≤ (1 − δ)µ] ≤ exp(cid:18)− Pr[X ≥ (1 + δ)µ] ≤ exp(cid:18)− 2 (cid:19) 2 + 2δ/3(cid:19) . δ2µ Our analysis of adversarial strategies crucially makes use of martingale inequalities. We thus provide the definition of a martingale. Definition 3.2. A martingale is a sequence X = (X0, . . . , Xm) of random variables with finite means, so that for 0 ≤ i < m, it holds that E[Xi+1 X0, . . . , Xi] = Xi. The most basic and well-known martingale inequality, Azuma's (or Hoeffding's) inequality, asserts that martingales with bounded differences Xi+1 − Xi are well-concentrated around their mean. For our purposes, this inequality does not suffice, and we need a generalized variant of it, due to McDiarmid [McD98, Theorem 3.15]; see also Theorem 4.1 in [Fre75]. The formulation that we shall use is given as Theorem 6.1 in the survey of Chung and Lu [CL06]. Lemma 3.3 (See [CL06], Theorem 6.1). Let X = (X0, X1, . . . , Xn) be a martingale. Suppose further that for any 1 ≤ i ≤ n, the variance satisfies Var(XiX0, . . . , Xi−1) ≤ σ2 for some values σ1, . . . , σn ≥ 0, i and there exists some M ≥ 0 so that Xi − Xi−1 ≤ M always holds. Then, for any λ ≥ 0, we have Pr(X − X0 ≥ λ) ≤ exp(cid:18)− λ2 i=1(σ2 i ) + Mλ/3(cid:19) . 2 ∑n In particular, Pr(X − X0 ≥ λ) ≤ 2 exp(cid:18)− λ2 i=1(σ2 i ) + Mλ/3(cid:19) . 2 ∑n Unlike Azuma's inequality, Lemma 3.3 is well-suited to deal with martingales where the max- imum value M of Xi+1 − Xi is large, but the maximum is rarely attained (making the variance much smaller than M2). The martingales we investigate in this paper depict this behavior. 4 Adaptive Robustness of Sampling: Main Technical Result In this section, we prove the main technical lemma underlying our upper bounds for Bernoulli sampling and reservoir sampling. The lemma asserts that for both sampling methods, and any given subset R of the universe U, the fraction of elements from R within the sample typically does not differ by much from the corresponding fraction among the whole stream. 12 Lemma 4.1. Fix ε, δ > 0, a universe U and a subset R ⊆ U, and let X = (x1, x2, . . . , xn) be the sequence chosen by Adversary in AdaptiveGameε against either BernoulliSample or ReservoirSample. 1. For BernoulliSample with parameter p ≥ 10 · ln(4/δ) ε2n , we have Pr(dR(X) − dR(S) ≥ ε) ≤ δ. 2. For ReservoirSample with memory size k ≥ 2 · ln(2/δ) ε2 , it holds that Pr(dR(X) − dR(S) ≥ ε) ≤ δ. Both of these bounds are tight up to an absolute multiplicative constant, even for a static adversary (that has to submit all elements in advance); see Section 6 for more details. The proof of Theorem 1.2 follows immediately from Lemma 4.1, and is given below. The proof of Theorem 1.4 requires slightly more effort, and is given in Section 6. Proof of Theorem 1.2. Let (U, R), ε, δ, n be as in the statement of the theorem, and let X and S denote the stream and sample, respectively. We start with the Bernoulli sampling case, and assume that p ≥ 10 · ln(4/δ)+ln R . For each R ∈ R, we apply the first part of Lemma 4.1 with parameters ε and δ/R, concluding that = 10 · ln(4R/δ) ε2n ε2n Pr(dR(X) − dR(S) ≥ ε) ≤ δ/R. In the event that dR(X) − dR(S) ≤ ε for any R, by definition S is an ε-approximation of X. Taking a union bound over all RR, we conclude that the probability of this event not to hold is bounded by R · (δ/R) = δ, meaning that BernoulliSample with p as above is (ε, δ)-robust. The proof for ReservoirSample is identical, except that we replace the condition on p with the condition that k ≥ 2 · ln(2/δ)+ln R ε2 , and apply the second part of Lemma 4.1. It is important to note that the typical proofs given for statements of this type in the static setting (i.e., when Adversary submits all elements in advance, and cannot act adaptively) do not apply for our adaptive setting. Indeed, the usual proof of the static analogue of the above lemma goes along the following lines: Adversary chooses which elements to submit in advance, and in particular, determines the number of elements from A sent, call it nA. Then, the number of sampled elements from A is distributed according to the binomial distribution Bin(nA, p) for Bernoulli sampling, and Bin(nA, k/n) for reservoir sampling. One can then employ Chernoff bound to conclude the proof. This kind of analysis crucially relies on the adversary being static. Here, we need to deal with an adaptive adversary. Recall that Adversary at any given point is modeled as a probabilistic process, that given the sequence Xi−1 = (x1, . . . , xi−1) of elements sent until now, and the current state σi−1 of Sampler, probabilistically decides which element xi to submit next. Importantly, this makes for a well-defined probability space, and allows us to analyze Adversary's behavior with probabilistic tools, specifically with concentration inequalities. Chernoff bound cannot be used here, as it requires the choices made by the adversary along the process to be independent of each other, which is clearly not the case. In contrast, martingale inequalities are suitable for this setting. We shall thus employ these, specifically Lemma 3.3, to prove both parts of our main result in this section. 4.1 The Bernoulli Sampling Case We start by proving the Bernoulli sampling case (first statement of Lemma 4.1). Recall that here each element is sampled, independently, with probability p. At any given point 0 ≤ i ≤ n along 13 the process, let Xi = (x1, . . . , xi) denote the sequence of elements submitted by the adversary until round i, and let Si ⊆ Xi denote the subsequence of sampled elements from Xi. Note that Xn = X and Sn = S, and hence, to prove the lemma, we need to show that dR(Xn) − dR(Sn) ≤ ε. As a first attempt, it might make sense to try applying a martingale concentration inequal- ity on the sequence of random variables (Y0, Y1, . . . , Yn), where we define Yi = dR(Xi) − dR(Si). Indeed, our end-goal is to bound the probability that Yn significantly deviates from zero. How- ever, a straightforward calculation shows that this is not a martingale, since the condition that E[YiY0, . . . , Yi−1] = 0 does not hold in general. To overcome this, we show that a slightly different formulation of the random variables at hand does yield a martingale. Given the above R ⊆ U, for any 0 ≤ i ≤ n we define the random variables AR i = i n · dR(Xi) = R ∩ Xi n ; BR i = R ∩ Si np ; i = BR ZR i − AR i , (1) where, as before, the intersection between a set R and a sequence Xi is the subsequence of Xi consisting of all elements that also belong to R. Importantly, as is described in the next claim, the sequence of random variables ZR = 0 , . . . , ZR n ) defined above forms a martingale. The claim also demonstrates several useful prop- (ZR erties of these random variables, to be used later in combination with Lemma 3.3. Claim 4.2. The sequence (ZR on ZR 0 , . . . , ZR 0 , ZR 1 , . . . , ZR n ) is a martingale. Furthermore, the variance of ZR i conditioned i−1 is bounded by 1/n2 p, and it always holds that ZR i − ZR i−1 ≤ 1/np. We shall prove Claim 4.2 later on; first we use it to complete the proof of the main result. Proof of Lemma 4.1, Bernoulli sampling case. It suffices to prove the following two inequalities for any p satisfying the conditions of the lemma for the Bernoulli sampling case: Pr(AR n − BR n ≥ ε/2) ≤ δ/2 ; Pr(BR n − dR(Sn) ≥ ε/2) ≤ δ/2. (2) Indeed, taking a union bound over these two inequalities, applying the triangle inequality, and observing that AR n = dR(Xn), we conclude that Pr(dR(Xn) − dR(Sn) ≥ ε) ≤ δ, as desired. The first inequality follows from Claim 4.2 and Lemma 3.3. Indeed, in view of Claim 4.2, we i = 1/n2 p, and M = 1/np. As n ) with parameters λ = ε/2, σ2 0 , . . . , ZR can apply Lemma 3.3 on (ZR ZR 0 = 0, we have AR n − BR n = ZR n − ZR 0 , and so Pr(AR n − BR n ≥ ε/2) ≤ 2 exp − (ε/2)2 n2 p + ε 6np! < 2 exp(cid:18)− 2n · 1 ε2np 9 (cid:19) . The right hand side is bounded by δ/2 when np ≥ 9 We next prove the second inequality of (2). Observe that BR ε2 ln(δ/4), settling the first inequality of (2). np . Since each element is added to the sample with probability p, independently of other elements, the size of Sn is distributed according to the binomial distribution Bin(n, p), regardless of the adversary's strategy. Applying Chernoff inequality with δ = ε/2, we get that n = dR(Sn) · Sn Pr((cid:12)(cid:12)Sn − np(cid:12)(cid:12) ≥ εnp/2) ≤ 2 exp − 14 (ε/2)2 np 2 + ε/3 ! < 2 exp(cid:18)− ε2np 10 (cid:19) . This probability is bounded by δ/2 provided that np ≥ 10 ln(4/δ) occurring, we have that ε2 . Conditioning on this event not n(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)dR(Sn) − BR 1 − Sn np (cid:12)(cid:12)(cid:12)(cid:12) · dR(Sn) ≤ (cid:12)(cid:12)(cid:12)(cid:12) 1 − Sn np (cid:12)(cid:12)(cid:12)(cid:12) ≤ ε 2 , where the first inequality follows from the fact that densities (in this case, dR(Sn)) are always bounded from above by one, and the second inequality follows from our conditioning. This completes the proof of the second inequality in (2). The proof of Claim 4.2 is given next. Proof of Claim 4.2. We first show that (ZR that the first i − 1 rounds of AdaptiveGameε have just ended (so the values of ZR 0 , . . . , ZR already fixed), and that Adversary now picks an element xi to submit in round i of the game. n ) is a martingale. Fix 1 ≤ i ≤ n, and suppose i−1 are 1 , . . . , ZR 0 , ZR If xi /∈ R then AR i = AR i−1 and BR i = BR i−1 and so ZR i = ZR i−1, which trivially means that E(cid:2)ZR ZR 0 , . . . , ZR i When xi ∈ R, we have i−1 ; xi /∈ R(cid:3) = ZR i−1 as desired. AR i = AR i−1 + 1 n ; BR i = ( i = (cid:26) i−1 BR i−1 + 1 BR np if xi is not sampled. if xi is sampled. ZR i−1 − 1/n if xi is not sampled. ZR i−1 + 1/np − 1/n if xi is sampled. ⇒ ZR Recall that Sampler uses Bernoulli sampling with probability p, that is, xi is sampled with proba- bility p (regardless of the outcome of the previous rounds). Therefore, we have that EhZR i ZR 0 , . . . , ZR i−1 ; xi ∈ Ri = ZR i−1 + p · ( 1 np − 1 n ) + (1 − p) · (− 1 n ) = ZR i−1. The analysis of both cases xi /∈ R and xi ∈ R implies that E[ZR i−1, as desired. We now turn to prove the other two statements of Claim 4.2. The maximum of the expression i − ZR 0 , . . . , ZR ZR i−1 is zero given the additional assumption that xi /∈ R; assuming that xi ∈ R, the variance satisfies np , obtained when xi ∈ R. The variance of ZR i−1 is max{ 1 i given ZR i−1] = ZR 0 , . . . , ZR n , 1 np − 1 n } ≤ 1 i ZR Var(ZR i ZR 0 , . . . , ZR n(cid:19)2 i−1 ; xi ∈ R) = (1 − p) ·(cid:18) 1 + p ·(cid:18) 1 = 1 n2 (cid:18) 1 p − 1(cid:19) ≤ 1 n2 p . ZR 0 , . . . , ZR n2 p , completing the proof. 1 n(cid:19)2 − np i−1) ≤ 1 Combining both cases, we conclude that Var(ZR i 4.2 The Reservoir Sampling Case We continue to the proof of the second statement of Lemma 4.1, which considers reservoir sam- pling. In high level, the proof goes along the same lines, except that we work with a different martingale. Specifically, for k < i ≤ n we define AR i = i · dR(Xi) = R ∩ Xi, BR i = i · dR(Si) = i = BR ZR i − AR i , i k · R ∩ Si, 15 whereas for i ≤ k we simply define AR i = BR definition for i > k; specifically, in view of the definition of BR k elements appear in the stream, the reservoir simply keeps all of the stream's elements.) The following claim is the analogue of Claim 4.2 for the setting of reservoir sampling. i = R ∩ Xi. (This is a natural extension of the i , note that as long as no more than Claim 4.3. The sequence (ZR on ZR 0 , . . . , ZR i−1 is bounded by i/k, and it always holds that ZR i − ZR i−1 ≤ i/k. 0 , ZR 1 , . . . , ZR n ) is a martingale. Furthermore, the variance of ZR i conditioned Proof. We follow the same kind of analysis as in Claim 4.2. Fix i > k (for i ≤ k the claim holds trivially), and suppose that the first i − 1 rounds have ended, so ZR i−1 are already fixed. Denote the next element that the adversary submits by xi. First, it is easy to verify that 0 , . . . , ZR AR i = (cid:26) AR AR i−1 xi /∈ R i−1 + 1 xi ∈ R is determined by three factors: i requires a more subtle case analysis. Given BR The calculation of BR i−1 and xi, the value of BR (i) is xi ∈ R or not? (ii) is xi sampled or not? and i (iii) conditioning on xi being sampled, does it replace an element from R in the sample, or an element not in R? We separate the analysis into several cases; in cases where xi is sampled, we denote the element removed from the sample to make room for xi by ri. 0 , . . . , BR Case 1: xi /∈ R. from R are neither added nor removed from the sample. That is, R ∩ Si = R ∩ Si−1. Hence, In the cases where xi is either not sampled, or sampled but with ri /∈ R, elements BR i = i k · R ∩ Si = i − 1 k · R ∩ Si−1 + 1 k · R ∩ Si−1 = BR i−1 + dR(Si−1), where the first equality is by definition, and the third equality follows again by definition and since Si−1 = k for i > k. It remains to consider the event where xi is sampled and ri ∈ R. The probability that xi is sampled equals k/i, and conditioning on this occurring, the probability that ri belongs to R is dR(Si−1), so the above event holds with probability (k/i) · dR(Si−1). In this case, one element from R is removed from the sample, that is, R ∩ Si = R ∩ Si−1 − 1, and therefore BR i = i k · R ∩ Si = i k · R ∩ Si−1 − i k = BR i−1 + dR(Si−1) − i k . Thus, conditioned on xi /∈ R, the expectation of BR i is (cid:18)1 − k i · dR(Si−1)(cid:19) ·(cid:16)BR i−1 + dR(Si−1)(cid:17) + k i · dR(Si−1) ·(cid:18)BR i−1 + dR(Si−1) − i k(cid:19) = BR i−1. Since AR i = AR i−1 when xi /∈ R, we deduce that E[ZR i ZR 0 , . . . , ZR i−1 ; xi /∈ R] = ZR i−1. 16 Case 2: xi ∈ R. Similarly, whenever Si = Si−1 we have that BR i−1 + dR(Si−1). The only case where this does not hold is when xi is sampled and ri /∈ R, which has probability (k/i) · (1 − dR(Si−1)). In this case, R ∩ Si = R ∩ Si−1 + 1, implying that i = BR BR i = i k · R ∩ Si = i k · R ∩ Si−1 + i k = BR i−1 + dR(Si−1) + i k . Combining these two we get, conditioned on xi ∈ R, that the expectation of BR i is BR i−1 + dR(Si−1) +(cid:18) k i · (1 − dR(Si−1))(cid:19) · i k = BR i−1 + 1. Finally, since AR i = AR i−1 + 1 when xi ∈ R, we have that E[ZR i ZR 0 , . . . , ZR i−1 ; xi ∈ R] = ZR i−1. The analysis of these two cases implies that (ZR 0 , . . . , ZR n ) is indeed a martingale. It remains to obtain the bounds on the difference ZR i given ZR 0 , . . . , ZR i−1. This follows rather easily as a byproduct of the above analysis (and the fact that the density dR is always bounded between zero and one). When xi /∈ R, we know from the analysis that AR i−1 + 1 and i−1 ≤ BR BR i−1 + 1, whereas if xi ∈ R, we have AR i−1 ≤ i/k. i−1 + 1 + i/k. In both cases, we conclude that ZR i−1 and the variance of ZR i−1 − i/k ≤ BR i−1 and BR i = AR i = AR i ≤ BR i ≤ BR i − ZR i − ZR We next bound the variance of ZR i conditioned on the values of ZR i−1 (the analysis also implicitly conditions on the value dR(Si−1); the bound we shall eventually derive holds regardless of this value). We start with the case that xi /∈ R, and revisit Case 1 above: with probability (k/i) · dR(Si−1), the value of ZR is smaller than its expectation by i/k − dR(Si−1); and i otherwise (with probability 1 − (k/i) · dR(Si−1)), the value of ZR is larger than its expectation by i dR(Si−1). Thus, we have that 0 , . . . , ZR Var(ZR i = = k i i k ZR 0 , . . . , ZR i−1, xi /∈ R, dR(Si−1)) · dR(Si−1) ·(cid:18) i k − dR(Si−1)(cid:19)2 · dR(Si−1) − (dR(Si−1))2 ≤ i k +(cid:18)1 − k i · dR(Si−1)(cid:19) · (dR(Si−1))2 . We next address the case where xi ∈ R, which correspond to Case 2 above. Here, with probability (k/i) · (1 − dR (Si−1)), the value of ZR is larger than its conditional expectation by i/k + dR (Si−1) − i 1; otherwise, ZR i is smaller than the expectation by 1 − dR(Si−1). Thus, Var(ZR i = = k i i k ZR 0 , . . . , ZR i−1, xi ∈ R, dR(Si−1)) · (1 − dR(Si−1)) ·(cid:18) i k + dR(Si−1) − 1(cid:19)2 · (1 − dR(Si−1)) − (1 − dR(Si−1))2 ≤ i k +(cid:18)1 − k i · (1 − dR(Si−1))(cid:19) · (1 − dR(Si−1))2 . As the conditional variance is always bounded by i/k, the bound remains intact if we remove the conditioning on the value of dR(Si−1) and the predicate assessing whether xi ∈ R or not. In other words, Var(ZR i−1) ≤ i/k, completing the proof. 0 , . . . , ZR i ZR 17 The proof of the second part of Lemma 4.1 now follows from the last claim. Proof of Lemma 4.1, reservoir sampling case. Observe that Pr(dR(X) − dR(S) ≥ ε) = Pr(BR = Pr(ZR n − AR n − ZR n ≥ εn) 0 ≥ εn). In view of Claim 4.3, we apply Lemma 3.3 on the martingale ZR = (ZR i = i/k for any i ≥ k (for i ≤ k, we can set σ2 σ2 i = 0), and M = n/k. We get that 0 , . . . , ZR n ) with λ = εn, Pr(ZR n − ZR 0 ≥ λ) ≤ 2 exp(cid:18)− = 2 exp(cid:18)− = 2 exp(cid:18)− ≤ 2 exp(cid:18)− λ2 i=1 σ2 i + Mλ/3(cid:19) 2 ∑n ε2n2 2 ∑n ε2kn2 i=1(i/k) + (n/k) · εn/3(cid:19) n(n + 1) + εn2/3(cid:19) 2n2 (cid:19) = 2 exp(cid:18)− 2 (cid:19) , ε2kn2 ε2k where the second inequality holds for n ≥ 2. Therefore, it suffices to require k ≥ 2 the bound Pr(dR(X) − dR(S) ≥ ε) ≤ δ. ε2 ln(cid:0) 2 δ(cid:1) to get 5 An Adaptive Attack on Sampling In this section, we present our lower bounds. Specifically, we show that the sample size cannot depend solely on the VC-dimension, but rather that the dependency on the cardinality is neces- sary. This is done by describing a set system (U, R) with large U and VC-dimension of one, together with a strategy for the adversary that will make the sampled set unrepresentative with respect to (U, R). That is, the sampled set will not be an ε-approximation of (U, R) with high probability. This is in contrast to the static setting where the same sample size suffices to an ε-approximation with high probability. Moreover, in the case of the BernoulliSample algorithm, the sampled set under attack is extremely unrepresentative, consisting precisely of the k smallest elements in the stream (where k is the total sample size at the end of the stream). Proof of Theorem 1.3. Set the universe to be the well-ordered set U = {1, 2, . . . , N} for an arbitrary n6 ln n ≤ N ≤ 2n/2 and let R = {[1, b] : b ∈ U}. Clearly, (U, R) has VC-dimension 1. Adversary's strategy (for both sampling algorithms BernoulliSample and ReservoirSample) is described in Fig- ure 3. Let S denote the subsequence of elements sampled by the algorithm BernoulliSample along the stream. The expected size of S is np ≤ np′, and it follows from the well-known Markov inequality (see e.g. [AS16], Appendix A) that Pr(S ≥ 2np′) < 1/2 (in fact the probability is much smaller, by Chernoff inequality, but we will not need the stronger bound). From here on, we condition on the complementary event: we assume that S < 2np′. The next claim asserts that for S of this size, Adversary's strategy does not fail, in the sense that it never runs out of elements (i.e., ai < bi for all i ∈ [n]). 18 The adversarial strategy 1. Set a1 = 1 and b1 = N. 2. Let p′ = max{p, ln n/n}. 3. For i = 1 . . . n do: (a) Set xi = ⌊ai + (1 − p′)(bi − ai)⌋. (b) If xi is sampled then set ai+1 = xi and bi+1 = bi. (c) Otherwise set ai+1 = ai and bi+1 = xi. 4. The final stream is X = x1, . . . , xn. Figure 3: The description of Adversary's strategy for making the sample unrepresentative. Claim 5.1. If S < 2np′ then bi − ai ≥ n for any i ∈ [n]. Proof. For any i ∈ [n], set ℓi = bi − ai. We prove by induction that ℓi ≥ n. If xi is sampled, then we have that ℓi+1 ≥ p′ℓi and otherwise we have that ℓi+1 = (1 − p′)ℓi − 2 ≥ (1 − 2p′)ℓi, where the inequality follows from the induction assumption. Since S < 2np′, we get that ℓi ≥ p′S(1 − 2p′)n−S · N ≥ p′S(1 − 2p′)n · N −(S ln 1 p′ +n ln( 1 1−2p′ )) · N −(S ln 1 p′ +3np′) · N = e > e −(2np′ ln 1 p′ +3np′) · N > e ≥ eln n−ln N · N = n , where the third inequality holds since 3p ≥ ln( inequality follows since p′ ≤ ln N 6n ln n and p′ ≥ ln n/n, which means that ln N ≥ 6np′ ln n ≥ 2np′ ln(1/p′) + 3np′ + ln n. 1 1−2p ) for small enough p > 0, and the last This proves the induction step, and completes the proof of the claim. The last claim means that if S < 2np′, then the attack in Figure 3 successfully generates a stream of n elements. We now show that the sampled set is not an ε-approximation. We begin by analyzing the BernoulliSample algorithm. Claim 5.2. Consider Adversary's attack on BernoulliSample described in Figure 3. At round i of the game, • All elements that were previously submitted by Adversary and sampled are no bigger than ai. • All elements that were previously submitted but not sampled are no smaller than bi. 19 • The element submitted during round i is between ai and bi. Proof. By induction, where the base case i = 1 is trivial. Suppose that the claim holds for the first i − 1 rounds; we now prove it for round i. By definition of the attack, and from Claim 5.1 it holds that ai−1 ≤ ai < bi ≤ bi−1 and so any of the elements xj for j < i − 1 satisfies the desired condition, by the induction assumption. It remains to address the case where j = i − 1. If xi−1 was sampled, then the attack sets ai = xi−1, that is, xi−1 is a sampled element and satisfies xi−1 ≤ ai. Otherwise, the attack sets bi = xi−1 and so xi−1 is a non-sampled element and satisfies xi−1 ≥ bi. Finally, ai < xi < bi always holds. Thus, the three desired conditions are retained. As the last claim depicts, all sampled elements are smaller than all non-sampled ones at any point along the stream. This, of course, suffices for the sampled set to not be an ε-approximation of (U, R). Denote the sampled set by S, and let s be the maximal element in S (if S is empty, we are done). Consider now the range [1, s] ∈ R: its density in the sampled set is 1, namely, d[1,s](S) = 1, while its density in the stream is d[1,s](X) = S/n. To summarize, d[1,s](S) − d[1,s](X) ≥ 1 − S/n ≥ 1 − 2p′ > 1/2 ≥ ε . Altogether, the attack does not fail provided that S < 2np′, which holds with probability at least 1/2. Thus, BernoulliSample with parameter p as in the theorem's statement is not (ε, δ)-robust. The analysis of the ReservoirSample algorithm is very similar. Recall that k denotes the sample size, and let k′ be the total number of elements that were sampled during the reservoir sampling process. That is, k′ counts sampled elements that were evicted at a future iteration. We bound k′ as follows. E[k′] = k + ∑n i=1 k/n ≤ 2k ln n. Again, Markov inequality shows that with probability at least 1/2, we will have k′ ≤ 4k ln n. Using the previous analysis, we know that all k′ elements are the smallest elements in the stream. The sample set S consists of some k elements among these k′ elements (in other words, the sample set is not necessarily the set of k smallest element, but it is still a subset of the k′ smallest elements). Thus, taking the interval [1, s] where s is the maximal element among the k′ elements, we have that the density of [1, s] in the sample is d[1,s](S) = k k = 1. On the other hand, the density of [1, s] is the stream is Together, we entail that d[1,s](X) = k′ n ≤ 4k ln n n ≤ ln N n ≤ 1/2. d[1,s](S) − d[1,s](X) > 1 − 1/2 ≥ ε , meaning that ReservoirSample with k as in the statement of the theorem is not (ε, δ)-robust. 6 Continuous Robustness In this section, we prove that the ReservoirSample algorithm is (ε, δ)-continuous robust against static and adaptive adversaries. Recall that a sampling algorithm is (ε, δ)-continuously robust if the following holds with probability at least 1 − δ: at any point throughout the stream, the current sample held by Sampler is an ε-approximation of the current stream (i.e., of the set of all elements submitted by Adversary until now). 20 With this definition in hand, BernoulliSample cannot possibly be continuously robust in gen- eral (even in the static setting)4. We thus restrict our discussion to ReservoirSample from here on, and turn to the proof of Theorem 1.4. The proof examines O(ε−1 ln n) carefully picked points along the stream, applying Theorem 1.2 on each of the points. It then shows that if the sam- ple is a good approximation of the stream at all of these points, then continuous robustness is guaranteed with high probability. Proof of Theorem 1.4. We provide the proof for the setting of an adaptive adversary. The proof for the static setting is essentially identical, with the only difference being that, instead of making black-box applications of Theorem 1.2, we apply the static analogue of it; Recall that the bound in the static analogue is of the form Θ(cid:16) d+ln 1/δ in the statement of Theorem 1.2. ε2 (cid:17), compared to the Θ(cid:16) ln R+ln 1/δ ε2 (cid:17) bound appearing Let (U, R), n, ε, δ be as in the statement of the theorem. As a warmup, let us analyze a simple yet non-optimal proof based on a naıve union bound. Denote the stream and sample after i rounds by Xi and Si, respectively. Consider for a moment the first i rounds of the game as a "standalone" game where the stream length is i. Applying the second part of Theorem 1.2 with parameters (U, R), ε, δ′, i, where δ′ = δ/n, we get that if the memory size k of ReservoirSample satisfies ln R + ln(2n/δ) ln R + ln(2/δ) + ln n ε2 then regardless of Adversary's strategy, k ≥ 2 · = 2 · ε2 , (3) Pr(Si is not an ε-approximation of Xi) ≤ δ/n. Taking a union bound, the probability that Si is an ε-approximation of Xi for all i ∈ [n] is at least 1 − n · (δ/n) = 1 − δ. Thus, it follows that ReservoirSample whose parameter k satisfies the condition of (3) is (ε, δ)-continuously robust. We now continue to the proof of the improved bound, appearing in the statement of the theorem. The proof is also based, at its core, on a union bound argument, albeit a more efficient one. The key idea is to take a sparse set of "checkpoints" i1, . . . , it along the stream, where ij+1 = (1 + Θ(ε))ij, apply Theorem 1.2 at any of the times i1, . . . , it to make sure the sample is an (ε/2)- approximation of the stream in any of these times. Finally, we show that with high probability, for any j ∈ [t − 1], the approximation is preserved (the approximation factor might become slightly worse, but no worse than ε) in the "gaps" between any couple of such neighboring points. For this, we first need the following simple claims. Claim 6.1. Let T, T′ be two sequences of length k over U, which differ in up to v values. Then dR(T) − dR(T′) ≤ v/k for any R ⊆ U. In particular, if T is an α-approximation of some sequence X ⊇ T, T′, then T′ is an (α + v/k)-approximation of X. Proof. For any subset R ⊆ U we have −v ≤ R ∩ T − R ∩ T′ ≤ v. Dividing by k = T = T′, and recalling that dR(T) = R ∩ T/T and dR(T′) = R ∩ T′/T′, we conclude that −v/k ≤ 4To see this, consider any set system (U, R) where R contains a singleton {u} for some u ∈ U, which is the first element of the stream. With probability 1 − p this element is not sampled and the density of {u} in the sample at the current point is 0, while its density in the stream is 1. This violates the ε-approximation requirement (unless p ≥ 1 − δ). 21 dR(T) − dR(T′) ≤ v/k, that is, dR(T) − dR(T′) ≤ v/k. To prove the second part, note that dR(T′) − dR(X) ≤ dR(T′) − dR(T) + dR(T) − dR(X) ≤ v/k + α for any R ⊆ U. Claim 6.2. Suppose that T ⊆ X ⊆ X′ are three sequences over U, where T is an α-approximation of X, and X′ ≤ (1 + β)X. Then T is an (α + β)-approximation of X′. Proof. For any subset R ⊆ U, we have that R ∩ X ≤ R ∩ X′ ≤ R ∩ X + βX. We also know that dR(T) − dR(X) ≤ α, since T is an α-approximation of X. On the one hand, it follows that On the other hand, dR(T) ≥ dR(X) − α = R ∩ X X − α ≥ R ∩ X′ − βX X − α ≥ R ∩ X′ X′ − β − α = dR(X′) − (α + β). dR(T) ≤ dR(X) + α = R ∩ X X + α ≤ R ∩ X′ X′/(1 + β) + α = (1 + β)dR(X′) + α ≤ dR(X′) + (α + β). As these inequalities hold for any R ⊆ U, the claim follows. As a consequence of the above two claims, we get the following useful claim. (Recall that for any i ∈ [n], the sample and stream after i rounds are denoted by Si and Xi, respectively.) Claim 6.3. Consider ReservoirSample with memory size k, and suppose that exactly v elements were sampled in rounds l + 1, l + 2, . . . , m of the game, where k ≤ l < m ≤ (1 + β)l. If Sl is an α- approximation of Xl, then Sm is an (α + β + v/k)-approximation of Xm. Proof. By Claim 6.2, Sl is an (α + β)-approximation of Xm. As Sm differs from Sl by at most v elements, we conclude from Claim 6.1 that Sm is an (α + β + v/k)-approximation of Xm. The last claim equips us with an approach to ensure continuous robustness, which is more efficient compared to the simple union bound approach. Suppose that there exists a set of integers k = i1 < i2 < . . . < it = n satisfying the following for any j ∈ [t − 1]. 1. Sij is an α-approximation of Xij, where α = ε/4. 2. ij+1 ≤ (1 + β)ij, where β = ε/4. 3. The number of elements sampled in rounds ij + 1, ij + 2, . . . , ij+1 is bounded by v = εk/2. We claim that the above three conditions suffice to ensure that Si is an ε-approximation of Xi for any i ∈ [n]. Indeed, for i ≤ k, Si = Xi is trivially an ε-approximation. When i > k, consider the maximum j < t for which ij ≤ i, and apply Claim 6.3 with l = ij, m = i, and α, β, v as dictated above. Since α + β + v/k = ε, the claim implies that Si is an ε-approximation of Xi, as desired. Specifically, given k satisfying the assumption of Theorem 1.4, we pick i1, i2, . . . , it recursively as follows: we start with i1 = k; and given ij we set ij+1 ≤ n as the largest integer satisfying that 22 ij+1 ≤ (1 + β)ij = (1 + ε/4)ij. It is not hard to verify that ij = k · (1 + θ(ε))j−1 (this implicitly relies on the fact that k ≥ 4/ε, ensured by the assumption of the theorem). Note that t = O(ln1+ε n) = O(ε−1 ln n). We next show that for this choice of i1, . . . , it, the above three conditions are satisfied simultaneously for all j ∈ [t − 1] with probability at least 1 − δ. This shall conclude the proof. For the first condition, apply Theorem 1.2 for any j ∈ [t − 1] with parameters (U, R), ε/42, δ′, ij where δ′ = δ/2t, concluding that if the memory size k satisfies k ≥ 2 · ln R + ln(4t/δ) (ε/4)2 = Θ(cid:18) ln R + ln(1/δ) + ln(1/ε) + ln ln n ε2 (cid:19) then for any j ∈ [t − 1], Pr(Sij is an ε/2-approximation of Xij) ≥ 1 − δ/2t. Taking a union bound, with probability at least 1 − δ/2 the first condition holds for all j ∈ [t − 1]. The second condition, regarding the boundedness of ij+1 as a function of ij, holds trivially (and deterministically) for our choice of i1 ≤ i2 ≤ . . . ≤ it. Finally, it remains to address the third condition. For any j ∈ [t − 1], let Aj denote the total number of sampled elements in rounds ij + 1, ij + 2, . . . , ij+1 of the game. Note that each such Aj is a random variable. We wish to show that Pr(Aj > εk/2) ≤ δ/2t. (4) Indeed, if (4) is true for any j ∈ [t − 1], then the probability that the third condition holds for any j is at least 1 − δ/2, which (in combination with our analysis of the other two conditions) completes the proof. Thus, it remains to prove (4). Recall that the probability of an element to be sampled in round i is exactly k/i, and that ij+1 ≤ (1 + ε/4)ij. Hence, Aj is a sum of up to ⌊εij/4⌋ independent random variables, each of which has probability less than k/ij to be sampled. In particular, the mean of Aj is less than (εij/4) · (k/ij) = εk/4. From Chernoff bound (Theorem 3.1), we get the desired bound: Pr(Aj ≥ εk/2) < exp(cid:18)− 22 · εk/4 2 + 2 · 2/3(cid:19) ≤ exp(cid:18)− εk 4 (cid:19) ≤ δ 2t , where the last inequality holds for k ≥ c · ε−1(ln 1/δ + ln 1/ε + ln ln n), for a sufficiently large constant c > 0; note that k in the theorem's statement indeed satisfies this inequality. Acknowledgments We are grateful to Moni Naor for suggesting the study of streaming algorithms in the adversarial setting and for helpful and informative discussions about it. We additionally thank Noga Alon, Nati Linial, and Ohad Shamir for invaluable comments and suggestions for the paper. References [AS16] Noga Alon and Joel H. Spencer. The Probabilistic Method. Wiley Publishing, 4th edition, 2016. 23 [BCEG07] Amitabha Bagchi, Amitabh Chaudhary, David Eppstein, and Michael T. Goodrich. Deterministic sampling and range counting in geometric data streams. ACM Transac- tions on Algorithms, 3(2):16, 2007. [BCM+13] Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Srndic, Pavel Laskov, Giorgio Giacinto, and Fabio Roli. Evasion attacks against machine learn- ing at test time. In Machine Learning and Knowledge Discovery in Databases - European Conference, ECML PKDD, pages 387 -- 402, 2013. [BOV15] Vladimir Braverman, Rafail Ostrovsky, and Gregory Vorsanger. Weighted sampling Information Processing Letters, 115(12):923 -- without replacement from data streams. 926, 2015. [BR18] Battista Biggio and Fabio Roli. Wild patterns: Ten years after the rise of adversarial machine learning. Pattern Recognition, 84:317 -- 331, 2018. [CBM18] Daniel Cullina, Arjun Nitin Bhagoji, and Prateek Mittal. PAC-learning in the presence In Proceedings of the 32Nd International Conference on Neural of evasion adversaries. Information Processing Systems, NIPS, pages 228 -- 239, 2018. [CDK+11] Edith Cohen, Nick G. Duffield, Haim Kaplan, Carsten Lund, and Mikkel Thorup. Ef- ficient stream sampling for variance-optimal estimation of subset sums. SIAM Journal on Computing, 40(5):1402 -- 1431, 2011. [CEM+96] Kenneth L. Clarkson, David Eppstein, Gary L. Miller, Carl Sturtivant, and Shang-Hua Teng. Approximating center points with iterative radon points. International Journal of Computational Geometry and Applications, 6(3):357 -- 377, 1996. [CG05] Graham Cormode and Minos N. Garofalakis. Sketching streams through the net: Dis- tributed approximate query tracking. In Proceedings of the 31st International Conference on Very Large Data Bases, VLDB, pages 13 -- 24, 2005. [CGP+18] Timothy Chu, Yu Gao, Richard Peng, Sushant Sachdeva, Saurabh Sawlani, and Junx- ing Wang. Graph sparsification, spectral sketches, and faster resistance computation, In 59th IEEE Annual Symposium on Foundations of via short cycle decompositions. Computer Science, FOCS, pages 361 -- 372, 2018. [Cha01] [Che52] Bernard Chazelle. The discrepancy method - randomness and complexity. Cambridge University Press, 2001. Herman Chernoff. A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations. The Annals of Mathematical Statistics, 23(4):493 -- 507, 1952. [CJSS03] Charles D. Cranor, Theodore Johnson, Oliver Spatscheck, and Vladislav Shkapenyuk. The gigascope stream database. IEEE Data Engineering Bulletin, 26(1):27 -- 32, 2003. [CL06] Fan Chung and Linyuan Lu. Concentration inequalities and martingale inequalities: a survey. Internet Mathematics, 3(1):79 -- 127, 2006. [CMY11] Graham Cormode, S. Muthukrishnan, and Ke Yi. Algorithms for distributed func- tional monitoring. ACM Transactions on Algorithms, 7(2):21:1 -- 21:20, 2011. 24 [CMYZ12] Graham Cormode, S. Muthukrishnan, Ke Yi, and Qin Zhang. Continuous sampling from distributed streams. Journal of the ACM, 59:10:1 -- 10:25, 2012. [CTW16] Yung-Yu Chung, Srikanta Tirthapura, and David P. Woodruff. A simple message- optimal algorithm for random sampling from a distributed stream. IEEE Transactions on Knowledge and Data Engineering, 28:1356 -- 1368, 2016. [DFH+15] Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Roth. The reusable holdout: Preserving validity in adaptive data analysis. Science, 349(6248):636 -- 638, 2015. [DGS15] Amit Daniely, Alon Gonen, and Shai Shalev-Shwartz. Strongly adaptive online learn- ing. In Proceedings of the 32nd International Conference on Machine Learning, ICML, pages 1405 -- 1411, 2015. [DLT05] Nick G. Duffield, Carsten Lund, and Mikkel Thorup. Estimating flow distributions IEEE/ACM Transactions on Networking, 13(5):933 -- 946, from sampled flow statistics. 2005. [ES06] [Fre75] Pavlos S. Efraimidis and Paul G. Spirakis. Weighted random sampling with a reser- voir. Information Processing Letters, 97(5):181 -- 185, 2006. David A. Freedman. On tail probabilities for martingales. The Annals of Probability, 3(1):100 -- 118, 1975. [GDG+17] Priya Goyal, Piotr Doll´ar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. [GHR+12] Anna C. Gilbert, Brett Hemenway, Atri Rudra, Martin J. Strauss, and Mary Wootters. Recovering simple signals. In Information Theory and Applications Workshop, ITA, pages 382 -- 391, 2012. [GHS+12] Anna C. Gilbert, Brett Hemenway, Martin J. Strauss, David P. Woodruff, and Mary In Wootters. Reusable low-error compressive sampling schemes through privacy. IEEE Statistical Signal Processing Workshop, SSP, pages 536 -- 539, 2012. [GK01] [GK16] Michael Greenwald and Sanjeev Khanna. Space-efficient online computation of quan- tile summaries. SIGMOD Record, 30(2):58 -- 66, 2001. Michael B. Greenwald and Sanjeev Khanna. Quantiles and equi-depth histograms over streams. In Minos Garofalakis, Johannes Gehrke, and Rajeev Rastogi, editors, Data Stream Management: Processing High-Speed Data Streams, pages 45 -- 86. Springer Berlin Heidelberg, 2016. [GLA16] Mohammed Ghesmoune, Mustapha Lebbah, and Hanene Azzag. State-of-the-art on clustering data streams. Big Data Analytics, 1(1):13, 2016. [GMP18] Ian J. Goodfellow, Patrick D. McDaniel, and Nicolas Papernot. Making machine learning robust against adversarial inputs. Communications of the ACM, 61(7):56 -- 66, 2018. 25 [HAK07] Elad Hazan, Amit Agarwal, and Satyen Kale. Logarithmic regret algorithms for on- line convex optimization. Machine Learning, 69(2-3):169 -- 192, 2007. [Haz16] Elad Hazan. Introduction to online convex optimization. Foundations and Trends in Optimization, 2(3-4):157 -- 325, 2016. [HW13] Moritz Hardt and David P. Woodruff. How robust are linear sketches to adaptive inputs? In Symposium on Theory of Computing Conference, pages 121 -- 130, 2013. [JMR05] [JPA04] Theodore Johnson, S. Muthukrishnan, and Irina Rozenbaum. Sampling algorithms in a stream operator. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 1 -- 12, 2005. Chris Jermaine, Abhijit Pol, and Subramanian Arumugam. Online maintenance of very large random samples. In Proceedings of the ACM SIGMOD International Confer- ence on Management of Data, pages 299 -- 310, 2004. [JSTW19] Rajesh Jayaram, Gokarna Sharma, Srikanta Tirthapura, and David P. Woodruff. Weighted reservoir sampling from distributed streams. In Proceedings of the 38th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS, pages 218 -- 235, 2019. [KLL16] Zohar Karnin, Kevin Lang, and Edo Liberty. Optimal quantile approximation in In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science streams. (FOCS), pages 71 -- 78, 2016. [Knu97] Donald E. Knuth. The Art of Computer Programming, Volume 2 (3rd Ed.): Seminumerical Algorithms. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1997. [LLS01] Yi Li, Philip M. Long, and Aravind Srinivasan. complexity of learning. Journal of Computer and System Sciences, 62(3):516 -- 527, 2001. Improved bounds on the sample [LMPL18] Thodoris Lykouris, Vahab Mirrokni, and Renato Paes Leme. Stochastic bandits robust to adversarial corruptions. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, pages 114 -- 122, 2018. [LN93] Richard J. Lipton and Jeffrey F. Naughton. Clocked adversaries for hashing. Algorith- mica, 9(3):239 -- 252, 1993. [McD98] Colin McDiarmid. Concentration. In Michel Habib, Colin McDiarmid, Jorge Ramirez- Alfonsin, and Bruce Reed, editors, Probabilistic Methods for Algorithmic Discrete Mathe- matics, pages 195 -- 248. Springer Berlin Heidelberg, 1998. [MHS19] Omar Montasser, Steve Hanneke, and Nathan Srebro. Vc classes are adversarially robustly learnable, but only improperly. In Alina Beygelzimer and Daniel Hsu, edi- tors, Proceedings of the Thirty-Second Conference on Learning Theory, COLT, volume 99 of Proceedings of Machine Learning Research, pages 2512 -- 2530, 2019. [MM19] Saeed Mahloujifar and Mohammad Mahmoody. Can adversarially robust learning In Algorithmic Learning Theory, ALT, pages 581 -- leverage computational hardness? 609, 2019. 26 [MNS11] Ilya Mironov, Moni Naor, and Gil Segev. Sketching in adversarial environments. SIAM Journal on Computing, 40(6):1845 -- 1870, 2011. [MRL99] Gurmeet Singh Manku, Sridhar Rajagopalan, and Bruce G. Lindsay. Random sam- pling techniques for space efficient online computation of order statistics of large datasets. SIGMOD Record, 28(2):251 -- 262, 1999. [MV17] Nabil H. Mustafa and Kasturi R. Varadarajan. Epsilon-approximations and epsilon- nets. In Csaba D. Toth, Joseph O'Rourke, and Jacob E. Goodman, editors, Handbook of Discrete and Computational Geometry, 3rd Edition, chapter 47, page 27. Chapman and Hall/CRC, New York, 2017. [MW18] Michael McCoyd and David A. Wagner. Background class defense against adversarial examples. In 2018 IEEE Security and Privacy Workshops, SP Workshops, pages 96 -- 102, 2018. [NY15] [OV11] Moni Naor and Eylon Yogev. Bloom filters in adversarial environments. In Advances in Cryptology - CRYPTO 2015 - 35th Annual Cryptology Conference, pages 565 -- 584, 2015. M. Tamer Ozsu and Patrick Valduriez. Principles of Distributed Database Systems. Springer Publishing Company, Incorporated, 3rd edition, 2011. [PMG+17] Nicolas Papernot, Patrick D. McDaniel, Ian J. Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In ACM Asia Conference on Computer and Communications Security, AsiaCCS, pages 506 -- 519, 2017. [Sau72] Norbert Sauer. On the density of families of sets. Journal of Combinatorial Theory, Series A, 13(1):145 -- 147, 1972. [SBM+18] Chawin Sitawarin, Arjun Nitin Bhagoji, Arsalan Mosenia, Mung Chiang, and Prateek Mittal. DARTS: deceiving autonomous cars with toxic signs. CoRR, abs/1802.06430, 2018. [Sha12] [She72] Shai Shalev-Shwartz. Online learning and online convex optimization. Foundations and Trends in Machine Learning, 4(2):107 -- 194, 2012. Saharon Shelah. A combinatorial problem; stability and order for models and theories in infinitary languages. Pacific Journal of Mathematics, 41(1):247 -- 261, 1972. [SKYL17] Samuel L. Smith, Pieter-Jan Kindermans, Chris Ying, and Quoc V. Le. Don't decay the learning rate, increase the batch size, 2017. Published as a conference paper at ICLR 2018. [SS17] [SST10] Ohad Shamir and Liran Szlak. Online learning with local permutations and delayed feedback. In Proceedings of the 34th International Conference on Machine Learning, ICML, pages 3086 -- 3094, 2017. Nathan Srebro, Karthik Sridharan, and Ambuj Tewari. Smoothness, low noise and fast rates. In Advances in Neural Information Processing Systems 23: Annual Conference on Neural Information Processing Systems, NIPS, pages 2199 -- 2207, 2010. 27 [STZ04] Subhash Suri, Csaba D. T ´oth, and Yunhong Zhou. Range counting over multidimen- sional data streams. In Proceedings of the Twentieth Annual Symposium on Computational Geometry, SCG '04, pages 160 -- 169, 2004. [SZS+14] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In 2nd International Conference on Learning Representations, ICLR, 2014. [Tal94] [Val84] [VC71] Michel Talagrand. Sharper bounds for gaussian and empirical processes. The Annals of Probability, 22(1):28 -- 76, 1994. L. G. Valiant. A theory of the learnable. Communications of the ACM, 27(11):1134 -- 1142, 1984. V. Vapnik and A. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory of Probability & Its Applications, 16(2):264 -- 280, 1971. [Vit85] Jeffrey Scott Vitter. Random sampling with a reservoir. ACM Transactions on Mathe- matical Software, 11(1):37 -- 57, 1985. [WFRS18] Blake E. Woodworth, Vitaly Feldman, Saharon Rosset, and Nati Srebro. The ever- In Advances in Neural Informa- lasting database: Statistical validity at a fair price. tion Processing Systems 31: Annual Conference on Neural Information Processing Systems, NeurIPS, pages 6532 -- 6541, 2018. [WLYC13] Lu Wang, Ge Luo, Ke Yi, and Graham Cormode. Quantiles over data streams: An experimental study. In Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data, pages 737 -- 748, 2013. [ZLZ18] Lijun Zhang, Shiyin Lu, and Zhi-Hua Zhou. Adaptive online learning in dynamic en- vironments. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems, NeurIPS, pages 1330 -- 1340, 2018. 28
1511.00648
2
1511
2016-10-19T23:01:30
Parameterized Algorithms for Constraint Satisfaction Problems Above Average with Global Cardinality Constraints
[ "cs.DS" ]
Given a constraint satisfaction problem (CSP) on $n$ variables, $x_1, x_2, \dots, x_n \in \{\pm 1\}$, and $m$ constraints, a global cardinality constraint has the form of $\sum_{i = 1}^{n} x_i = (1-2p)n$, where $p \in (\Omega(1), 1 - \Omega(1))$ and $pn$ is an integer. Let $AVG$ be the expected number of constraints satisfied by randomly choosing an assignment to $x_1, x_2, \dots, x_n$, complying with the global cardinality constraint. The CSP above average with the global cardinality constraint problem asks whether there is an assignment (complying with the cardinality constraint) that satisfies more than $(AVG+t)$ constraints, where $t$ is an input parameter. In this paper, we present an algorithm that finds a valid assignment satisfying more than $(AVG+t)$ constraints (if there exists one) in time $(2^{O(t^2)} + n^{O(d)})$. Therefore, the CSP above average with the global cardinality constraint problem is fixed-parameter tractable.
cs.DS
cs
Parameterized Algorithms for Constraint Satisfaction Problems Above Average with Global Cardinality Constraints Xue Chen∗ Computer Science Department University of Texas at Austin [email protected] Yuan Zhou Computer Science Department Indiana University at Bloomington [email protected] August 15, 2018 Abstract Given a constraint satisfaction problem (CSP) on n variables, x1, x2, . . . , xn ∈ {±1}, and m con- straints, a global cardinality constraint has the form ofPn i=1 xi = (1−2p)n, where p ∈ (Ω(1), 1−Ω(1)) and pn is an integer. Let AV G be the expected number of constraints satisfied by randomly choosing an assignment to x1, x2, . . . , xn, complying with the global cardinality constraint. The CSP above average with the global cardinality constraint problem asks whether there is an assignment (complying with the cardinality constraint) that satisfies more than (AV G + t) constraints, where t is an input parameter. In this paper, we present an algorithm that finds a valid assignment satisfying more than (AV G + t) constraints (if there exists one) in time (2O(t2) + nO(d)). Therefore, the CSP above average with the global cardinality constraint problem is fixed-parameter tractable. 6 1 0 2 t c O 9 1 ] S D . s c [ 2 v 8 4 6 0 0 . 1 1 5 1 : v i X r a ∗Supported by NSF Grant CCF-1526952. 1 Introduction In a d-ary constraint satisfaction problem (CSP), we are given a set of boolean variables {x1, x2,··· , xn} over {±1} and m constraints C1,··· , Cm, where each constraint Ci consists of a predicate on at most d variables. A constraint is satisfied if and only if the assignment of the related variables is in the predicate of the constraint. The task is to find an assignment to {x1,··· , xn} so that the greatest (or the least) number of constraints in {C1,··· , Cm} are satisfied. Simple examples of binary CSPs are the MAXCUT prob- lem and the MINCUT problem, where each constraint includes 2 variables, and the predicate is always {(−1, +1), (+1,−1)}. The MAX3SAT problem is an example of a ternary CSP. In a MAX3SAT problem, each constraint includes 3 variables, and the predicate includes 7 out 8 possible assignments to the 3 vari- ables. Another classical example of a ternary CSP is called the MAX3XOR problem, where each predicate is either {(−1,−1,−1), (−1, +1, +1), (+1,−1, +1), (+1, +1,−1)} or {(+1, +1, +1), (+1,−1,−1), (−1, +1, −1), (−1, −1, +1)}. Constraint satisfaction problem above average. For each CSP problem, there is a trivial randomized algorithm which chooses an assignment uniformly at random from all possible assignments. In a seminal work [21], Hastad showed that for MAX3SAT and MAX3XOR, it is NP-hard to find an assignment sat- isfying ǫm more constraints than the trivial randomized algorithm (in expectation) for an arbitrarily small constant ǫ > 0. In other words, there is no non-trivial approximation algorithm (i.e. better approximation than the trivial randomization) for MAX3SAT or MAX3XOR assuming P6=NP. Recently, this result was extended to many more CSPs by Chan [7]. Assuming the Unique Games Conjecture [23], Austrin and Mos- sel [3] provided a sufficient condition for CSPs to admit non-trivial approximation algorithms. Later, Khot, Tulsiani and Worah [24] gave a complete characterization for these CSPs. Guruswami et al. [15] showed that all ordering CSPs (a variant of CSP) do not admit non-trivial approximation algorithm under the Unique Games Conjecture. Therefore, it is natural to set the expected number of constraints satisfied by the trivial randomized algorithm as a baseline, namely AV G, and ask for better algorithms. In the constraint satisfaction problem above average, we are given a CSP instance I and a parameter t, and the goal is to decide whether there is an assignment satisfying t constraints more than the baseline AV G. The CSP above average problem has been extensively studied in the parameterized algorithms designing research community. Gutin et al. [18] showed that the MAX3XOR above average (indeed MAXdXOR for arbitrary d) is fixed-parameter tractable (FPT), i.e., there is an algorithm that makes the correct decision in time f (t)poly(n). Later, Alon et al. [1] showed that every CSP above average admits an algorithm with runtime (cid:16)2O(t2) + O(m)(cid:17), and therefore is fixed-parameter tractable. Later, Crowston et al. [8] improved the running time of MAXXOR to 2O(t log t) · poly(nm). Recently, Makarychev, Makarychev and Zhou [26] studied a variant, and showed that the ordering CSP above average is fixed-parameter tractable. Constraint satisfaction problem with a global cardinality constraint. Given a boolean CSP instance I, we can impose a global cardinality constraintPn i=1 xi = (1− 2p)n (we assume that pn is an integer). Such a constraint is called the bisection constraint if p = 1/2. For example, the MAXBISECTION problem is the MAXCUT problem with the bisection constraint. Constraint satisfaction problems with global cardinality constraints are natural generalizations of boolean CSPs. Researchers have been studying approximation algorithms for CSPs with global cardinality constraints for decades, where the MAXBISECTION problem [2, 10, 12, 16, 20, 34, 35] and the SMALLSET EXPANSION problem [31 -- 33] are two prominent examples. 1 Adding a global cardinality constraint could strictly enhance the hardness of the problem. The SMALL- SET EXPANSION problem can be viewed as the MINCUT problem with the cardinality of the selected subset to be ρV (ρ ∈ (0, 1)). While MINCUT admits a polynomial-time algorithm to find the optimal solution, we do not know a good approximation algorithm for SMALLSET EXPANSION. Raghavendra and Steurer [31] suggested that the SMALLSET EXPANSION problem is where the hardness of the notorious UNIQUEGAMES problem [23] stems from. For many boolean CSPs, via a simple reduction described in [16,34], if such a CSP does not admit a non- trivial approximation algorithm, neither does the CSP with the bisection constraint. Therefore, it is natural to set the performance of the trivial randomized algorithm as the baseline, and ask for better algorithms for CSPs with a global cardinality constraint. Specifically, given a CSP instance I and the cardinality constraint Pn i=1 xi = (1 − 2p)n, we define our baseline AV G to be the expected number of constraints satisfied by uniform randomly choosing an assignment complying with the cardinality constraint. The task is to decide whether there is an assignment (again complying with the cardinality constraint), satisfying at least AV G+t constraints. We call this problem CSP above average with a global cardinality constraint, and our goal is to design an FPT algorithm for the problem. Recently, Gutin and Yeo [19] showed that it is possible to decide whether there is an assignment sat- Zenklusen [27]. However, observe that in the MAXBISECTION problem, the trivial randomized algorithm isfying more than ⌈m/2 + t⌉ constraints in time(cid:16)2O(t2) + O(m)(cid:17) for the MAXBISECTION problem with m constraints and n variables. The running time was later improved to (cid:0)2O(t) + O(m)(cid:1) by Mnich and 2(n−1)(cid:17) m constraints in expectation. Therefore, when m ≫ n, our problem satisfies AV G = (cid:16) 1 MAXBISECTION above average asks more than what was proved in [19, 27]. For the MAXCUT problem without any global cardinality constraint, Crowston et al. [9] showed that optimizing above the Edwards- Erdos bound is fixed-parameter tractable, which is comparable to the bound in our work, while our algorithm 2 + 1 outputs a solution strictly satisfying the global cardinality constraintPn i=1 xi = (1 − 2p)n. 1.1 Our results In this paper, we show FPT algorithms for boolean CSPs above average with a global cardinality constraint problem. Our main theorem is stated as follows. Theorem 1.1 (Informal version of Theorem 4.1 and Theorem 6.1) For any integer constant d and real constant p0 ∈ (0, 1/2], given a d-ary CSP with n variables and m = nO(1) constraints, a global cardinality constraintPn i=1 xi = (1− 2p)n such that p ∈ [p0, 1− p0], and an integer parameter t, there is an algorithm that runs in time (nO(1) + 2O(t2)) and decides whether there is an assignment complying with the cardinality constraint to satisfy at least (AV G + t) constraints or not. Here AV G is the expected number of constraints satisfied by uniform randomly choosing an assignment complying with the cardinality constraint. One important ingredient in the proof of our main theorem is the 2 → 4 hypercontractivity of low- degree multilinear polynomials in a correlated probability space. Let Dp be the uniform distribution on all assignments to the n variables complying with the cardinality constraint Pn i=1 xi = (1 − 2p)n. We show the following inequality. Theorem 1.2 (Informal version of Corollary 4.8 and Corollary 5.2) For any degree d multilinear poly- nomial f on variables x1, x2, . . . , xn, we have EDp[f 4] ≤ poly(d) · C d p · EDp[f 2]2, 2 where the constant Cp = poly( 1 1−p , 1 p ). The ordinary 2 → 4 hypercontractive inequality (see Section 2.1 for details of the inequality) has wide applications in computer science, e.g., invariance principles [29], a lower bound on the influence of variables on Boolean cube [22], and an upper bound on the fourth moment of low degree functions [1,26] (see [30] for a complete introduction and more applications with the reference therein). The inequality admits an elegant induction proof, which was first introduced in [28]; and the proof was later extended to different settings (e.g. to the low-level sum-of-squares proof system [4], and to more general product distributions [26]). All the previous induction proofs, to the best of our knowledge, rely on the local independence of the variables (i.e. the independence among every constant-sized subset of random variables). In the 2 → 4 hypercontractive inequality we prove, however, every pair of the random variables is correlated. Because of the lack of pair-wise independence, our induction proof (as well as the proof to the main theorem (Theorem 1.1)) crucially relies on the analysis of the eigenvalues of several nO(d) × nO(d) set- symmetric matrices. We will introduce more details about this analysis in the next subsection. Independent work on the 2 → 4 hypercontractive inequality. Independently, Filmus and Mossel [11] provided a hypercontractive inequality over Dp based on the log-Sobolev inequality due to Lee and Yau [25]. They utilized the property that harmonic polynomials constitute an orthogonal basis in Dp. In this work, we use parity functions and their Fourier coefficients to analyze the eigenspaces of VarDp and prove the hypercontractivity in Dp. Parity functions do not constitute an orthogonal basis in Dp, e.g., the n variables i=1 xi = (1− 2p)n. However, there is another important component in the proof of our main theorem -- we need to prove the variance of a random solution is high if the optimal solution is much above average. Parity functions also play an important role in this component. More specifically, our analysis relies on the fact that the null space of VarDp is equivalent to the subspace spanned by the global cardinality constraint and all non-zero eigenvalues of VarDp are Θ(1) in terms of their Fourier coefficients (respect to parity functions). are not independent under any global cardinality constraintPn 1.2 Techniques and proof overview Our high level idea is similar to the framework introduced by Gutin et al. [17]. However, we employ very different techniques to deal with the fixed-parameter tractability above average under a global cardinality constraint. Specifically, we extensively use the analysis of the eigenspaces of the association schemes. For simplicity, we will first use the bisection constraint Pn i=1 xi = 0 as the global cardinality constraint to illustrate our main ideas. Then we discuss how to generalize it to a global cardinality constraint specified by p ∈ (0, 1). We first review the basic ideas underlying the work [1,26]. Let fI be the degree d multilinear polynomial counting the number of satisfied constraints in a d-ary CSP instance I and fI(S) be the coefficient of Qi∈S xi, i.e., the Fourier coefficient of χS =Qi∈S xi. We will also view the multilinear polynomial f as a ≤d(cid:1)o. vector in the linear space spannχSS ∈(cid:0)[n] We consider the variance of fI in the uniform distribution of {±1}n, namely Var(fI), and discuss the following 2 cases. only on t (i.e. a small kernel of variables). 1. Var(fI) = O(t2). In this case, we would like to reduce the problem to a problem whose size depends In [1], this was done because the coefficients in fI fI (S)2 in the uniform distribution. Then are multiples of 2−d and the variance Var(fI ) = PS6=∅ 3 there are at most O(t222d) terms with non-zero coefficients in fI, so the size of the kernel is at most O(d · t222d). One can simply enumerate all possible assignments to the kernel. 2. Var(fI) = Ω(t2). We will claim that the optimal value is at least AV G+t. This is done via the 2 → 4 hypercontractive inequality (Theorem 1.2), which shows that the low-degree polynomial fI is smooth under the uniform distribution over all valid assignments. Therefore fI is greater than its expectation plus its standard deviation with positive probability, via the fourth moment method [1, 5, 30]. example -- the value of a bisection in the complete graph with n vertices is always n Now we take a detailed look at the first case. For the uniform distribution D on all assignments comply- fI(S)2. Indeed, VarD(fI) might ing with the bisection constraint, we no longer have VarD(fI) = PS6=∅ fI(S)2. Let us consider a complete graph in the MAXBISECTION problem for be very different fromPS6=∅ 2 in D, which indicates fI(S)2 is Ω(n2). Another example for the MAXBISECTION problem that VarD(fI) = 0. However,PS6=∅ is a star graph, i.e., a graph with (n− 1) edges connecting an arbitrary vertex i to the rest of (n− 1) vertices. The variance for this instance is also 0. However, one can check thatPS6=∅ To solve the problem above, we first observe that in the star graph instance, the degree 2 polynomial fI = n 2 in the support of D. This is becausePi xi = 0 is a requirement for all valid assignments in D. In general, we have (Pi xi)h = 0 for all polynomials h under the bisection constraint. Therefore, 2 (say the center of the star is at Vertex 1), which always equals n fI(S)2 = Ω(n). 2 · n 2 − (Pi xi) x1 S =((Xi xi)h + c : h a degree-at-most (d − 1) multilinear polynomial, c constant) constitutes a linear subspace where all the functions in the subspace are equivalent to a constant function ≤d(cid:1) ×(cid:0)[n] multilinear polynomials f (this can be done because VarD(f ) is just a quadratic polynomial on the Fourier ≤d(cid:1) matrix so that f T Bf = VarD(f ) for all degree-at-most-d ≤d(cid:1)o). From the discussion above, we know that S is in the nullspace of B. in the support of D. Let B be a (cid:0)[n] coefficientsn f (S)S ∈(cid:0)[n] Projection onto the orthogonal complement of S, and the spectral analysis of B via association schemes. Somewhat surprisingly, we show that S indeed coincides with the nullspace of B, and the eigenvalues of B of the orthogonal complement of S are Θ(1) (when we treat d as a constant). Once we have this, we let (Pi xi)hf be the projection of (fI − fI(∅)) onto S = spann1, (Pi xi)χSS ∈(cid:0) [n] ≤d−1(cid:1)o, and have that the 2-norm2 of the projection onto the orthogonal complement of S, kfI − fI(∅) − (Pi xi)hfk2 Θ(VarD(fI)). the value of BS,T (where S, T ∈ (cid:0) n ≤d(cid:1)) only depends on S, T, and S ∩ T. If we only consider the homogeneous submatrices of B (i.e. the submatrix of all rows S and columns T so that S = T = d′ for some 0 ≤ d′ ≤ d), their eigenvalues and eigenspaces are well understood and easy to characterize as they correspond to a special association shceme called the Johnson scheme [13]. Then we follow the approach of [14] to provide a self-contained description of the eigenspaces and eigenvalues of B, which extensively To analyze the eigenvalues and eigenspaces of B, we crucially use the fact that B is set-symmetric, i.e. 2 = use the property Pi xi = 0 in the support of D. We will finally show that all eigenvalues of B in the orthogonal complement of S are between .5 and d. and eigenvectors of A in a similar fashion, for the purpose of our proof. We will also let A be the matrix corresponding to the quadratic form ED[f 2] and analyze the eigenvalues 4 follow the approach of [1]. Rounding procedure for the projection vector hf . We would like to use the argument that since kfI − fI(∅)− (Pi xi)hfk2 2 = Θ(VarD(fI)) = O(t2) is small, there are not so many non-zero Fourier coefficients for the function (fI − (Pi xi)hf ) (which is equivalent to fI on all valid assignments). Therefore we could reduce the whole problem to a small kernel. However, since hf might not have any integrality property, we cannot directly say that the Fourier coefficients of (fI − fI(∅) − (Pi xi)hf ) are multiples of 2−d, and To solve this problem, we need an extra rounding process. We "round" the projection vector hf to a new vector h so that the coefficients of h are multiples of 1/Γ (for some big constant Γ which only depends on d). At the same time, the rounding process guarantees that kfI − fI(∅) − (Pi xi)hk2 2 ≤ O(kfI − fI(∅)− (Pi xi)hfk2 2), so that we can use the argument of [1] with (fI − (Pi xi)h) (which is also The rounding process proceeds in a iterative manner. At each iteration, we only round the degree-d′ homogeneous part of hf (starting from d′ = d − 1, and decrease d′ after each iteration). We would like 2 is bounded by O(kfI − fI(∅) − (Pi xi)hfk2 to prove the rounding error k(Pi xi)h − (Pi xi)hfk2 2), so that kfI − fI(∅) − (Pi xi)hk2 2 + k(Pi xi)h − (Pi xi)hfk2 2) ≤ O(kfI − fI(∅) − (Pi xi)hfk2 2). We will first claim that the coefficients of hf are "quite" close to those of h, where, however, such closeness does not directly guarantee that the rounding error is well bounded. Then, using this closeness, we will bound the rounding error via a different argument. 2 ≤ 2(kfI − fI(∅) − (Pi xi)hfk2 equivalent to f on all valid assignments) instead. The 2 → 4 hypercontractive inequality for low-degree multilinear polynomials under D. For the second case, we need to prove the 2 → 4 hypercontractive inequality for low-degree multilinear polynomials in D, i.e. ED[f 4] = O(1) ED[f 2]2 for any low-degree multilinear polynomial f . We will use the special property of the bisection constraint and reduce the task to the ordinary 2 → 4 hypercontractive inequality (on the uniform production distribution). Specifically, we view the sampling process in D as first uniformly sampling a perfect matching M among the n variables then assigning +1 and −1 to the two vertices in each pair of matched variables independently. Observe that once we have the perfect matching, the second sampling step is a product distribution over n/2 unbiased coins. Let fM be the function on n/2 variables so that each pair of matched variables always take opposite values, we have ED[f 4] = EM E[f 4 M ], where the second expectation is over the uniform distribution. Now we can directly apply the ordinary hypercontractive inequality to E[f 4 M ])2, it remains to show that EM E[f 2 O(1) EM E[f 2 This final step, can be viewed as proving the "1 → 2 hypercontractivity of E[f 2 lyzing the Fourier coefficients of f . M ]2. Since ED[f 2]2 = (EM E[f 2 M ]". We prove this by ana- M ] and have ED[f 4] = M ]2 = O(1)(EM E[f 2 M ])2. Generalization to the general cardinality constraint Pi xi = (1 − 2p)n via random restriction. We now discuss how to generalize the parameterized algorithm to the general cardinality constraint Pi xi = (1−2p)n for any p ∈ [p0, 1−p0] (where p0 > 0 is a constant). Let Dp be the uniform distribution on all valid assignments complying with the global cardinality constraint. We first focus on Case 1: VarDp(fI ) = O(t2). There are two natural approaches to generalize our previous argument to Dp. The first idea is to define φi =pp/(1 − p) when xi = 1 and φi = −p(1 − p)/p when xi = −1 so that E φi = 0 and E φ2 i = 1, and do the analysis for g(φ1, . . . , φn) = fI(x1, . . . , xn). The second idea is to work with xi = ±1, and try to generalize the analysis. However, we adopt neither of the two approaches because of the following reasons. For the first idea, indeed one can prove that there exists some polynomial hg, so that kg − g(∅) − 2 = Θ(VarDp(fI)). However, since the Fourier coefficients of g have factors such as p1/2, p, p3/2, (Pi φi)hgk2 5 and fix these variables to 1. For any valid assignment, we see that the remaining .98n variables satisfy the when we round hg to h. For the second idea, the super-constant on the right-hand-side of the constraint Our final approach for the general cardinality constraint is via a reduction to the existing algorithm for the bisection constraint, using random restriction. Let us assume p = .49 to illustrate the high-level idea etc., it is not clear why the Fourier coefficients of (g − g(∅)− (Pi φi)h) are multiples of some number even Pi xi = (1 − 2p)n imposes a technical difficulty for bounding the rounding error. (and it works for any p). Given the constraintPi xi = .02n, we randomly choose a set Q of .02n variables bisection constraintPi∈Q xi = 0. Let fQ be the function on the remaining .98n variables derived by fixing the variables in Q to 1 for fI, i.e. let fQ(xQ) = fI(xQ, xQ = ~1), where xQ means {xi : i ∈ Q} and xQ means {xi : i ∈ Q}. Since sampling x from Dp is equivalent to sampling Q first then sampling xQ ∼ D and setting xQ = ~1, we have EQ VarD[fQ] ≤ VarDp[fI] ≤ O(t2). Therefore, for most Q's, we have VarD[fQ] ≤ O(t2). Using our parameterized algorithm for the bisection constraint, we know that for most Q's, fQ depends on merely O(t2) variables (on all assignments complying with the bisection constraint). Then we manage to show that to make this happen, a low-degree polynomial f itself has to depend on only O(t2) variables (on all valid assignments in Dp). The 2 → 4 hypercontractive inequality under distribution Dp. To deal with Case 2, we need the 2 → 4 hypercontractive inequality for low-degree multilinear polynomials in Dp. We let φi = pp/(1 − p) when xi = 1 and φi = −p(1 − p)/p when xi = −1 so that E φi = 0, E φ2 i = 1, andPi φi = 0 in the support of Dp then prove the inequality for multilinear polynomials on φ1, φ2, . . . , φn. We follow the paradigm introduced in [28] and apply induction on the number of variables and the degree of the polynomial. For any multilinear polynomial f , we write it in the form of f = φ1h0 + h1 (say the first variable f depends on is φ1), expand EDp[f 4] = EDp[(φ1h0 + h1)4], and control each term using induction hypothesis separately. 0h1 = 0] because of the lack of independence. While the latter one is easy to deal with, the main technical difficulty comes from the first term, namely upper-bounding EDp[φ1h0h3 1] in terms of kh0k2 and kh1k2. We reduce this problem to upper-bounding the spectral norm of a carefully designed set-symmetric matrix L, which again utilizes the analysis developed in Section 3. Unlike the proof in [28], we no longer have EDp[φ1h0h3 1] = 0 or EDp[φ3 1h3 1.3 Organization This paper is organized as follows. We introduce some preliminaries in Section 2. In Section 3, we provide a self-contained description of the eigenspaces and eigenvalues of the matrices corresponding to EDp[f 2] and VarDp(f ). In Section 4, we prove the fixed-parameter tractability of CSPs above average with the bisection constraint, and the 2 → 4 hypercontractive inequality under the distribution conditioned on the bisection constraint. In Section 5, we prove the more general 2 → 4 hypercontractive inequality under distribution Dp. At last, we show the fixed-parameter tractability of any d-ary CSP above average with a global cardinality constraint in Section 6. 2 Preliminaries Let [n] = {1, 2,··· , n}. For convenience, we always use (cid:0)[n] in [n] and (cid:0)[n] d(cid:1) to denote the set of all subsets of size d ≤d(cid:1) to denote the set of all subsets of size at most d in [n] (including ∅). For two subsets S 6 indicator variable of an event E, i.e. 1E = 1 when E is true, and 1E = 0 otherwise. and T , we use S∆T to denote the symmetric difference of S and T . Let n! denote the productQn i=1 i and [ n−1 2 ] i=0 (n − 2i). We use ~0 (~1 resp.) to denote the all 0 (1 resp.) vector. We also use 1E to denote the n!! = Q In this work, we only consider f : {±1}n → R. Let U denote the uniform distribution on {±1}n and Up denote the biased product distribution on {±1}n such that each bit equals to −1 with probability p and equals to 1 with probability 1 − p. For a distribution V , we use supp(V ) to denote the support of V . For a random variable X with standard deviation σ, it is known that the fourth moment is necessary and sufficient to guarantee that there exists x ∈ supp(X) greater than E[X] + Ω(σ) from [1,5,30]. We state this result as follows. Lemma 2.1 Let X be a real random variable. Suppose that E[X] = 0, E[X 2] = σ2 > 0, and E[X 4] < bσ4 for some b > 0. Then Pr[X ≥ σ/(2√b)] > 0. A global cardinality constraint defined by a parameter 0 < p < 1 is Pi∈[n] xi = (1 − 2p)n, which indicates that (1 − p) fraction of xi's are 1 and the rest p fraction are −1. For convenience, we call the global cardinality constraint with p = 1/2 as the bisection constraint. In this paper, we always use D to denote the uniform distribution on all assignments to the n variables complying with the bisection constraint i=1 xi = 0 and Dp to denote the uniform distribution on all assignments complying with the cardinality Pn constraintPn i=1 xi = (1 − 2p)n. 2.1 Basics of Fourier Analysis of Boolean functions We state several basic properties of the Fourier transform for Boolean functions those will be useful in this instead of 1 − p. work. We follow the notations in [30] except for q = 2p−1√p(1−p) We first introduce the standard Fourier transform in {±1}n. We will also use the p-biased Fourier transform in several proofs especially for the 2 → 4 hypercontractive inequality under Dp. More specifically, in Section 2.2, Section 3, and Section 5, we will use the Fourier transform with the p-biased basis {φS}. In Section 4 and Section 6, we will use the standard Fourier transform in the basis {χS}. For the uniform distribution U, we define the inner-product on a pair of functions f, g : {±1}n → R by hf, gi = Ex∼U [f (x)g(x)]. Hence χS(x) = Qi∈S xi over all subsets S ⊆ [n] constitute an orthonormal basis for the functions from {±1}n to R. For simplicity, we abuse the notation by writing χS instead of f (S)χS, χS(x). Hence every Boolean function has a unique multilinear polynomial expression f =PS⊆[n] where f (S) = hf, χSi is the coefficient of χS in f . In particular, f (∅) = Ex∼U [f (x)]. An important fact f (S)2 = Ex∼U [f (x)2], which indicates VarU (f ) = about Fourier coefficients is Parseval's identity, i.e.,PS PS6=∅ Given any Boolean function f , we define its degree to be the largest size of S with non-zero Fourier coefficient f (S). In this work, we focus on the multilinear polynomials f with degree-at-most d. We use the Fourier coefficients of weight i to denote all Fourier coefficients { f (S)S ∈ (cid:0)[n] i (cid:1)} of size i character space span{χSS ∈(cid:0)[n] ≤d(cid:1)}, where each coordinate corresponds to a character function χS of a subset S. We state the standard Bonami Lemma for Bernoulli ±1 random variables [6, 30], which is also known as the 2 → 4 hypercontractivity for low-degree multilinear polynomials. Lemma 2.2 Let f : {−1, 1}n → R be a degree-at-most d multilinear polynomial. Let X1,··· , Xn be independent unbiased ±1-Bernoulli variables. Then functions. For a degree-at-most d polynomial f , we abuse the notation f to denote a vector in the linear f (S)2. E[f (X1,··· , Xn)4] ≤ 9d · E[f (X1,··· , Xn)2]2. 7 1−p 1xi=1−q 1−p f (S)2. We state two facts of φi that will be useful in the later section. For the p-biased distribution Up, we define the inner product on pairs of function f, g : {±1}n → R by p 1xi=−1 and φS(x) =Qi∈S φi(x). We abuse the notation by writing φS instead of φS(x). It is straightforward to verify EUp[φi] = 0 and EUp[φ2 i ] = 1. Notice that φSφT 6= φS∆T unlike χSχS = χS∆T for all x. However, hφS , φTi = 0 for f (S)φS (x), where f (S)2 = EUp[f 2], which hf, gi = Ex∼Up[f (x)g(x)]. Then we define φi(x) =q p different S and T under Up. Thus we have the biased Fourier expansion f (x) =PS⊆[n] f (S) = hf, φSi in Up. We also have f (∅) = EUp[f ] and Parseval's identity PS demonstrates VarUp(f ) =PS6=∅ 1. xi = 2pp(1 − p) · φi + 1 − 2p. HencePi φi(x) = 0 for any x satisfyingPi xi = (1 − 2p)n. i = q · φi + 1 for q = 2p−1√p(1−p) Observe that the largest size of T with non-zero Fourier coefficient f (T ) in the basis {φSS ∈ (cid:0)[n] ≤d(cid:1)} is equivalent to the degree of f defined in {χSS ∈ (cid:0)[n] ≤d(cid:1)}. Hence we still define the degree of f to be maxS: f (S)6=0 S. We abuse the notation f to denote a vector in the linear space span{φSS ∈(cid:0)[n] ≤d(cid:1)}. 1−p + (1−p)2 i ] = p2 p ≥ 1. Therefore we state the 2 → 4 hypercontractivity in the biased distribution Up as follows. Lemma 2.3 Let f : {−1, 1}n → R be a degree-at-most d multilinear polynomial of φ1,··· , φn. Then . Thus we always write f as a multilinear polynomial of φi. For the biased distribution Up, we know EUp[φ4 2. φ2 EUp[f (X1,··· , Xn)4] ≤(cid:18)9 · p2 1 − p (1 − p)2 p + 9 · (cid:19)d · EUp[f (X1,··· , Xn)2]2. At last, we notice that the definition of φS is consistent with the definition of χS when p = 1/2. When the distribution Up is fixed and clear, we use kfk2 = Ex∼Up[f (x)2]1/2 to denote the L2 norm of a Boolean f (S)2)1/2. From the Cauchy-Schwarz inequality, function f . From Parseval's identity, kfk2 is also (PS one useful property is kf gk2 ≤ kf 2k1/2 2.2 Distributions conditioned on global cardinality constraints 2 kg2k1/2 2 . as a constant and hide it in the big-Oh notation. We will study the expectation and the variance of a low-degree multilinear polynomial f in Dp. Because φS is consistent with χS when p = 1/2, we fix the basis to be φS of the p-biased Fourier transform. Because p ∈ [p0, 1 − p0], we treat q = 2p−1√p(1−p) We first discuss the expectation of f under Dp. Because EDp[φS ] is not necessary 0 for any non- empty subset S, EDp[f ] 6= f (∅). Let δS = EDp[φS]. From symmetry, δS = δS′ for any S and S′ with the same size. For convenience, we use δk = δS for any S ∈ (cid:0)[n] k(cid:1). From the definition of δ, we have EDp[f ] =PS For p = 1/2 and D, δk = 0 for all odd k and δk = (−1)k/2 (n−1)·(n−3)···(n−k+1) for even k. We calculate it this way: pick any T ∈(cid:0)[n] k(cid:1) and consider ED[(Pi xi)χT ] = 0. This indicates k · δk−1 + (n − k)δk+1 = 0. f (S) · δS. (k−1)!! From δ0 = 1 and δ1 = 0, we could obtain δk for every k > 1. 8 Because δ2i−2 = (−1)i−1Θ(n−i+1) and δ2i−1 = (−1)iO(n−i), the major term of δ2i is determined by δ2i−2. We choose k = 2i − 1 in the equation (1) to obtain + O( (2i − 1)!! δ2i = (−1)i (n − 1)(n − 3)··· (n − 2i + 1) 1 ni+1 ) = (−1)i (2i − 1)!! ni + O( 1 ni+1 ). For p 6= 1/2 and Dp under the global cardinality constraintPi∈n xi = (1− 2p)n, we consider EDp[φS], becausePi∈n xi = (1 − 2p)n indicatesPi φi = 0. Thus we use δS = EDp[φS] and calculate it as follows: pick any T ∈(cid:0)[n] k(cid:1) and consider EDp[(Pi φi)φT ] = 0. φiφT = φT∪i for i /∈ T ; and φiφT = q · φT + φT\i for i ∈ T from the fact φ2 i = q · φi + 1. We have k · δk−1 + k · q · δk + (n − k)δk+1 = 0 (1) Remark 2.4 For p = 1/2 and the bisection constraint, q = 0 and the recurrence relation becomes k · δk−1 + (n − k)δk+1 = 0, which is consistent with the above characterization. Thus we abuse the notation δk when Up is fixed and clear. From δ0 = 1, δ1 = 0, and the relation above, we can determine δk for every k. For example, δ2 = − 1 n−1 2q n−2 · 2 · q = and δ3 = − δ2 Claim 2.5 For any i ≥ 1, δ2i−1 = (−1)iO(n−i) and δ2i = (−1)i (2i−1)!! Proof. We use induction on i. Base Case: δ0 = 1 and δ1 = 0. (n−1)(n−2) . We bound δi as follows: ni + O(n−i−1). At the same time, from δ2i and δ2i−1, δ2i+1 = (−1)i+1q · (2i)(2i − 1)!! + (2i)(2i − 2)(2i − 3)!! + ··· + (2i)!! 1 ni+2 ). ⊓⊔ Now we turn to EDp[f 2] and VarDp[f ] for a degree-at-most-d multilinear polynomial f . From the 1 ni+2 ) = (−1)i+1O( + O( ni+1 f (S)φS, f (S) f (T )δS∆T , VarDp(f ) = EDp[f 2] − EDp[f ]2 =XS,T ≤d(cid:1) ×(cid:0) n definition and the Fourier transform f =PS f (S) f (T )(δS∆T − δSδT ). EDp[f 2] =XS,T We associate a (cid:0) n ≤d(cid:1) matrix A with EDp[f 2] that A(S, T ) = δS∆T . Hence EDp[f 2] = f T · A · f from the definition when we think f is a vector in the linear space of span{φSS ∈(cid:0)[n] ≤d(cid:1)}. Similarly, we associate a(cid:0) n ≤d(cid:1) matrix B with VarDp(f ) that B(S, T ) = δS∆T − δS · δT . Hence VarDp(f ) = f T · B · f . Notice that an entry (S, T ) in A and B only depends on the size of S, T, and S ∩ T . Remark 2.6 Because B(∅, S) = B(S,∅) = 0 for any S and VarDp(f ) is independent with f (∅), we could neglect f (∅) in B such that B is a ((cid:0)[n] 1(cid:1)) matrix. f (∅) is the only difference between the analysis of eigenvalues in A and B. Actually, the difference δS · δT between A(S, T ) and B(S, T ) will not effect the analysis of their eigenvalues except the eigenvalue induced by f (∅). In Section 3, we study the eigenvalues of EDp[f 2] and VarDp(f ) in the linear space span{φSS ∈ (cid:0)[n] ≤d(cid:1)}, d(cid:1) + ···(cid:0)[n] d(cid:1) + ···(cid:0)[n] i.e., the eigenvalues of A and B. 1(cid:1)) × ((cid:0)[n] ≤d(cid:1) ×(cid:0) n 9 2.3 Eigenspaces in the Johnson Schemes We shall use a few characterizations about the eigenspaces of the Johnson scheme to analyze the eigenspaces and eigenvalues of A and B in Section 3 (please see [13] for a complete introduction). r )×([n] We divide A into (d + 1) × (d + 1) submatrices where Ai,j is the matrix of A(S, T ) over all S ∈ (cid:0)[n] i (cid:1) and T ∈ (cid:0)[n] j (cid:1). For each diagonal matrix Ai,i, observe that Ai,i(S, T ) only depends on S ∩ T because of S = T = i, which indicates Ai,i is in the association schemes, in particular, Johnson scheme. Definition 2.7 A matrix M ∈ R([n] r ) is set-symmetric if for every S, T ∈(cid:0)[n] r(cid:1), M (S, T ) depends only on the size of S ∩ T. For n, r ≤ n/2, let Jr ⊆ R([n] r ) be the subspace of all set-symmetric matrices. Jr is called the Johnson scheme. Let M ∈ R([n] r ) as a homogeneous f (T )φT , where each coordinate corresponds to a r-subset. Although degree r polynomial f = PT∈([n] the eigenvalues of M depend on the entries of M, the eigenspaces of M are independent with M as long as M is in the Johnson scheme. r ) be a matrix in the Johnson scheme Jr. We treat a vector in R([n] r )×([n] r )×([n] r ) V0). f (S). properties: i(cid:1) −(cid:0) n i−1(cid:1); i (cid:1), although M and f only i (cid:1)} with the following two i (cid:1)} satisfies thatPj /∈T ′ f (T ′ ∪ j) = 0 (neglect this property for Fact 2.8 There are r + 1 eigenspaces V0, V1,··· , Vr in M. For i ∈ [r], the dimension of Vi is(cid:0)n and the dimension of V0 is 1. We define Vi through f (S) over all S ∈ (cid:0)[n] r(cid:1)}. Vi is the linear space spanned by { f (S)φSS ∈(cid:0)[n] depend on { f (T )T ∈(cid:0)[n] i−1(cid:1), { f (S)S ∈ (cid:0)[n] 1. For any T ′ ∈ (cid:0) [n] r(cid:1), f (T ) =PS∈(T 2. For any T ∈(cid:0)[n] It is straightforward to verify that the dimension of Vi is(cid:0)n that the homogeneous degree i polynomialPS∈([n] Claim 2.9 For any j ≤ r and any S ∈(cid:0)[n] <j(cid:1),PT∈([n] Base Case S = j − 1: from the definition of f ,PT :S⊂T SupposePT :S⊂T j ):S⊂T Proof. We use induction on the size of S to show it is true. To show the orthogonality between Vi and Vj, it is enough to prove that f (T ) = 0 for any S ∈(cid:0) [n] i−1(cid:1) and Vi is an eigenspace in M. Notice f (S)φS is an eigenvector of matrices in Ji. i(cid:1) −(cid:0) n f (T ) = 0 for any f ∈ Vj. f (T ) = 0. i ) i ) k+1(cid:1). We prove it is true for any S ∈(cid:0)[n] k(cid:1): j − SXi /∈S XT :(S∪i)⊂T f (T ) = 0. 1 f (T ) = XT :S⊂T ⊓⊔ 10 2.4 CSPs with a global cardinality constraint In this work, we consider the constraint satisfaction problem on {−1, 1}n with a global cardinality con- straint. We allow different constraints using different predicates. Because we can add dummy variables in each constraint, we assume the number of variables in each constraint is d for simplicity. Definition 2.10 An instance I of a constraint satisfaction problem of arity d consists of a set of variables V = {x1,··· , xn} and a set of m constraints C1,··· , Cm. Each constraint Ci consists of d variables xi1,··· , xid and a predicate Pi ⊆ {−1, 1}d. An assignment on xi1,··· , xid satisfies Ci if and only if (xi1,··· , xid) ∈ Pi. The value valI (α) of an assignment α is the number of constraints in C1,··· , Cm that are satisfied by α. The goal of the problem is to find an assignment with maximum possible value. An instance I of a constraint satisfaction problem with a global cardinality constraint consists of an instance I of a CSP and a global cardinality constraint Pi∈[n] xi = (1 − 2p)n specified by a parameter p. The goal of the problem is to find an assignment of maximum possible value complying with the global cardinality constraintPi∈[n] xi = (1 − 2p)n. We denote the value of the optimal assignment by OP T = max α:Pi αi=(1−2p)n valI(α). The average value AV G of I is the expected value of an assignment chosen uniformly at random among all assignments complying the global cardinality constraint AV G = Eα:Pi αi=(1−2p)n[valI (α)]. Given an instance I of a constraint satisfaction problem of arity d, we associate a degree-at-most d multi- linear polynomial fI with I such that fI(α) = valI (α) for any α ∈ {±1}n as in [1]. fI(x) = Xi∈[m] Xσ∈Pi Qj∈[d](1 + σj · xi,j) 2d . Remark 2.11 The degree of fI is at most d; and the coefficients of fI in the standard basis {χSS ∈(cid:0)[n] ≤d(cid:1)} are always multiples of 2−d. Thus we focus on the study of degree-d polynomial f with coefficients of multiples of 2−d instead of the m constraints C1,··· , Cm. From the discussion above, given an instance I and a global cardinality constraint Pi∈n xi = (1 − 2p)n, the expectation of I under the global cardinality constraint is different than its expectation in the uniform distribution, even for CSPs of arity 2 in the bisection constraint: AV G = ED[fI] =XS f (S) ED[χS] = f (∅) +XS6=∅ f (S)δS . Definition 2.12 In the satisfiability above Average Problem, we are given an instance of a CSP of arity d, a global cardinality constraint Pi∈n xi = (1 − 2p)n, and a parameter t. We need to decide whether OP T ≥ AV G + t or not. In this work, we show that it is fixed-parameter tractable. Namely, given a parameter t and an instance of a CSP problem of arity d under a global cardinality constraintPi∈n xi = (1 − 2p)n, we design an algorithm that either finds a kernel on O(t2) variables or certifies that OP T ≥ AV G + t. 11 3 Eigenspaces and Eigenvalues of EDp[f 2] and VarDp(f ) In this section we analyze the eigenvalues and eigenspaces of A and B, following the approach of Grigoriev [14]. (d + 1) submatrices where we know the eigenspaces of the diagonal submatrices from the Johnson scheme, eigenspaces of these diagonal matrices characterized in Section 2.3, which is motivated by Grigoriev [14]. We will focus on the analysis of A in most time and discuss about B in the end of this section. We fix any p ∈ (0, 1) with the global cardinality constraint Pi xi = (1 − 2p)n and use the p-biased Fourier transform in this section, i.e., {φSS ∈ (cid:0)[n] ≤d(cid:1)}. Because χS is consistent with φS for p = 1/2, it is enough to study the eigenspaces of A and B in span{φSS ∈(cid:0)[n] ≤d(cid:1)}. Since A can be divided into (d + 1)× we study the eigenspaces of A through the global cardinality constraintPi φi = 0 and the relations between We first show the eigenspace V ′null with an eigenvalue 0 in A, i.e., the null space of A. BecausePi xi = (1 − 2p)n in the support of Dp,Pi φi(x) = 0 for any x in the support of Dp. Thus (Pi φi)h = 0 for all polynomial h of degree-at-most d − 1, which is in the linear subspace span{(Pi φi)φSS ∈(cid:0) [n] ≤d−1(cid:1)}. This ≤d−1(cid:1) = (cid:0) [n] d−1(cid:1) +(cid:0) [n] linear space is the eigenspace of A with an eigenvalue 0; and its dimension is(cid:0) n d−2(cid:1) + ···(cid:0)[n] 0(cid:1). By the same reason, V ′null is the eigenspace in B with an eigenvalue 0. Let Vd be the largest eigenspace in Ad,d on(cid:0)[n] d(cid:1) ×(cid:0)[n] d(cid:1). We demonstrate how to find an eigenspace of fd(T ∪ j) = 0 for any A based on Vd. From the definition of Vd, for any fd ∈ Vd, fd satisfies that Pj /∈T T ∈ (cid:0) [n] d−1(cid:1) from the property of the Johnson scheme. Thus, from Claim 2.9 and the fact that A(S, T ) only i (cid:1) and T ∈ (cid:0)[n] depends on S ∩ T given S ∈ (cid:0)[n] d(cid:1), we know Ai,dfd = ~0 for all i ≤ d − 1. We construct an eigenvector f in A from fd as follows: f (S) = 0 for all S ∈ (cid:0)[n] <d(cid:1) and f (T ) = fd(T ) for all T ∈ (cid:0)[n] d(cid:1), Then we move to Vd−1 in Ad,d and illustrate how to use an eigenvector in Vd−1 to construct an eigenvec- fd−1(S)φS be the homogeneous degree d − 1 polyno- tor of A. For any fd ∈ Vd−1, let fd−1 = PS∈( [n] fd−1(S)(cid:17) φT . From Claim 2.9, Ai,dfd = 0 for all i < d − 1 and mial such that fd =PT∈([n] Ai,d−1fd−1 = 0 for all i < d − 2. Observe that fd−1 is an eigenvector of Ad−1,d−1, although it is possible that the eigenvalue of fd−1 in Ad−1,d−1 is different than the eigenvalue of fd in Ad,d. At the same time, from the symmetry of A and the relationship between fd and fd−1, Ad−1,dfd = β0fd−1 and Ad,d−1fd−1 = β1fd for some constants β0 and β1 only depending on δ and d. Thus we can find a constant αd−1,d such that (~0, fd−1, αd−1,dfd) becomes an eigenvector of A. More directly, we determine the constant αd−1,d from the orthogonality between (~0, fd−1, αd−1,d · fd) and the null space span{(Pi φi)φSS ∈ (cid:0) [n] d−1(cid:1) and rewrite (Pi φi)φT = Pj∈T φT\j + q · T · φT +Pj /∈T φT∪j. From the orthogonality, qT · fd−1(T ) +Xj /∈T i.e., f = (~0, fd). It is straightforward to verify that A(~0, fd) = λd(~0, fd), where the eigenvalue λd is the eigenvalue of Vd in Ad,d. ≤d−1(cid:1)}. We pick any T ∈ (cid:0) [n] fd−1(T ′)(cid:1) = 0 d−1) d )(cid:16)PS∈( T d−1) αd−1,d(cid:0) XT ′∈(T ∪j d−1) ⇒(cid:18)qT + (n − T)αd−1,d(cid:19) fd−1(T ) + αd−1,d(cid:18) XT ′′∈( T d−2)Xj /∈T fd−1(T ′′ ∪ j)(cid:19) = 0. 12 From the property of fd−1 thatPj /∈T ′′ fd−1(T ′′ ∪ j) = 0 for all T ′′ ∈(cid:0) [n] (cid:0)qT + (n − 2T)αd−1,d(cid:1) fd−1(T ) = 0, d−2(cid:1), we simplify it to n−2d+2 directly. which determines αd−1,d = −(d−1)q Following this approach, we figure out all eigenspaces of A from the eigenspaces V0, V1,··· , Vd in Ad,d. For convenience, we use V ′k for k ≤ d to denote the kth eigenspace in A extended by Vk in Ad,d. We first choose the coefficients in the combination. Let αk,i = 0 for all i < k, αk,k = 1, and αk,k+1,··· , αk,d satisfy the recurrence relation (we will show the choices of α later): i · αk,k+i−1 + (k + i) · q · αk,k+i + (n − 2k − i)αk,k+i+1 = 0. (2) f (S); k) k ) k) following three properties: k(cid:1)} satisfy the f (T ∪ j) = 0 (neglect this property for V ′0); ≤d(cid:1) spanned by { f (S)S ∈(cid:0)[n] Now we show the recurrence relation of αk,k+i from the fact that f is orthogonal to the null space of A. k−1(cid:1),Pj /∈T >k(cid:1), f (T ) = αk,T ·PS∈(T <k(cid:1), f (T ) = 0. Then for every f ∈ Vk, the coefficients of f (T ) over all T ∈(cid:0)[n] 1. ∀T ∈(cid:0) [n] 2. ∀T ∈(cid:0)[n] 3. ∀T ∈(cid:0)[n] We consider (Pi φi)φT in the null space for a subset T of size k + i < d and simplify (Pi φi)φT to Pj∈T φT\j + q · T · φT +Pj /∈T φT∪j. We have Xj∈T αk,k+i−1 XS∈(T \j k)(cid:0)i· αk,k+i−1 + (k + i)q· αk,k+i + (n− k− i)αk,k+i+1(cid:1) f (S) + XT ′∈( T XS∈(T Using the first property ∀T ′ ∈(cid:0) [n] k−1(cid:1),Pj /∈T ′ f (T ′ ∪ j) = 0 to eliminate all S′ not in T , We obtain f (S) + (k + i) · q · αk,k+i XS∈(T αk,k+i+1 XS∈(T ∪j αk,k+i+1Xj /∈T f (S) +Xj /∈T k) k) f (S) = 0. relation in (2). (cid:0)i · αk,k+i−1 + (k + i) · q · αk,k+i + (n − 2k − i)αk,k+i+1(cid:1) XS∈(T f (S) is not necessary equal to 0 to satisfy the first property (actually PS∈(T Because PS∈(T for all T ∈ (cid:0) [n] k(cid:1)), the coefficient is 0, which provides the recurrence The dimension of V ′k is(cid:0)[n] k(cid:1)−(cid:0) [n] k−1(cid:1) from the first property (It is straightforward to verifyPd dim(V ′null) = Pd k(cid:1) −(cid:0) [n] k−1(cid:1)) +(cid:0) [n] d−2(cid:1) + ···(cid:0)[n] ≤d(cid:1)). The orthogonality between V ′i and V ′j follows from Claim 2.9 and the orthogonality of Vi and Vj. Remark 3.1 V ′1,··· , V ′d are the non-zero eigenspaces in B except for V ′0. For f ∈ V ′0, observe that f (T ) only depends on the size of T and f (∅). Hence for any polynomial f ∈ V ′0, f is a constant function over the support of Dp, i.e., VarDp(V ′0) = 0. Therefore V ′0 is in the null space of B. k+i(cid:1) indicates f (S) = 0 for all S ∈ (cid:0)[n] d−1(cid:1) +(cid:0) [n] 0(cid:1) = (cid:0)[n] k=0((cid:0)[n] f (S) = 0 k) f (S) = 0 ⇒ k ) f (T ′∪ j) = 0. k−1) k=0 dim(V ′k)+ 13 We use induction on i to bound αk,k+i. From αk,k = 1 and the recurrence relation (2), the first few n−2k−1 n−2k and αk,k+2 = − 1+(k+1)q·αk,k+1 ni + O(n−i−1) and αk,k+2i+1 = (−1)i+1O(n−i−1). terms would be αk,k+1 = − kq Claim 3.2 αk,k+2i = (−1)i (2i−1)!! Proof. We use induction on i again. Base Case: αk,k = 1 and αk,k+1 = − kq n−2k . From the induction hypothesis αk,k+2i−2 = (−1)i−1Θ(n−i+1) and αk,k+2i−1 = (−1)in−i, the ma- jor term of αk,k+2i is determined αk,k+2i−2 such that αk,k+2i = (−1)i (2i−1)!! ni + O(n−i−1). Similarly, αk,k+2i+1 = (−1)i+1O(n−i−1). ⊓⊔ n−2k−1 + O(n−2). = − 1 Now we bound the eigenvalue of V ′k. For convenience, we think 0! = 1 and (−1)!! = 1. (i−1)!!(i−1)!! Theorem 3.3 For any k ∈ {0,··· , d}, the eigenvalue of V ′k in A isPd−k any k ∈ {1,··· , d}, the eigenvalue of V ′k in B is the samePd−k ≤d) A(S, T ) f (T ) for the eigenvalue of Proof. We fix a polynomial f ∈ V ′k and S ∈(cid:0)[n] k(cid:1) to calculatePT∈([n] f (S′), we expand PT A(S, T ) f (T ) into the summation V ′k in A. From the fact f (T ) = αk,T ·PS′∈(T of f (S′) over all S′ ∈ (cid:0)[n] k(cid:1) with coefficients. From the symmetry of A, the coefficients of f (S′) in the expansion only depends on the size of S ∩ S′ (the sizes of S and S′ are k). Hence we use τi to denote the coefficients of f (S′) given S′∆S = i. ThusPT A(S, T ) f (T ) =PS′∈([n] We calculate τ0,··· , τ2d as follows. Because S′ = S = k, S∆S′ is always even. For τ0, we only ± O(n−1). For even i=0 (i−1)!!(i−1)!! ± O(n−1). k ) τS′△S consider T containing S and use k + i to denote the size of T . f (S′). even i=0 k) i! i! τ0 = d−k Xi=0(cid:18)n − k i (cid:19) · αk,k+i · δi. (3) i d−k τ2l = αk,k+i Xi=0 i − t (cid:19)δ2l+i−2t. For τ2l, we fix a subset S′ with S∆S′ = 2l and only consider T containing S′. We use k + i to denote the size of T and t to denote the size of the intersection of T and S \ S′. t(cid:19)(cid:18)n − k − 2l Xt=0(cid:18)l We will prove that τ0 = Θ(1) and τ2l = O(n−l) for all l ≥ 1 then eliminate all S′ 6= S inPT A(S, T ) f (T ) = k ) τS′△S f (S′) to obtain the eigenvalue of V ′k. PS′∈([n] From Claim 2.5 and Claim 3.2, we separate the summation of τ0 = Pd−k i (cid:1) · αk,k+i · δi to Peven i(cid:0)n−k i (cid:1) · αk,k+i · δi +Podd i(cid:0)n−k i (cid:1) · αk,k+i · δi. We replace δi and αk,k+i by the bound in Claim 2.5 Xeven i(cid:18)n − k i (cid:19)(−1) 2 (cid:18) (i − 1)!! (i − 1)!! i=0 (cid:0)n−k and Claim 3.2: 2 + i (4) n n i 2 i 2 i i+1 2 + i+1 2 · O(n− i+1 2 ) · O(n− i+1 2 ). + O(n−i−1)(cid:19) + Xodd i(cid:18)n − k i (cid:19)(−1) 14 even i=0 It shows τ0 = Pd−k the fact that for any T ′ ∈(cid:0) [n] (k − i) i) XS1∈([n]\S k−i )  XS0∈(S (i−1)!!(i−1)!! where O(n−l) comes from the fact that αk,k+i = O(n− i + O(n−1). For τ2l, we bound it by O(n−l) through similar method, ). At last, we show the eigenvalue of V ′k is O(1/n) close to τ0, which is enough to finish the proof. From i−t (cid:1) < ni−t, and δ2l+i−2t = O(n− 2l+i−2t 2 ),(cid:0)n−k−2l i! 2 k−1(cid:1),Pj /∈T ′ f (T ′ ∪ j) = 0, we have (recall thatS = k) f (S0 ∪ S1)  + (i + 1)  XS0∈( S i+1) XS1∈( [n]\S = XS0∈(S i) XS1∈( [n]\S k−i−1) k−i−1) Xj /∈S0∪S1 f (S0 ∪ S1)  f (S0 ∪ S1 ∪ j) = 0. Thus we apply it onPi τ2i(cid:0)PS′∈([n] k ):S∩S′=k−i f (S′)(cid:1) to remove all S′ 6= S. Let τ′2k = τ2k and Using the above rule, it is straightforward to verify τ′2k−2i−2 = τ2k−2i−2 − i + 1 k − i · τ′2k−2i. k Xi=j τ2i(cid:18) XS′∈([n] k ):S∩S′=k−i f (S′)(cid:19) = τ′2j(cid:18) i=0 τ2i(cid:0)PS′∈([n] XS′∈([n] k ):S∩S′=k−j f (S′)(cid:19) f (S′)(cid:1) = τ′0 i=0 τ2i · (−1)i(cid:0)k i(cid:1).) even i=0 from j = k to j = 0 by induction. Therefore Pd τ2i = O(n−i), we have τ′0 = τ0 ± O(1/n). (Remark: actually, τ′0 =Pk From all discussion above, the eigenvalue of V ′k in A is τ′0, which isPd−k ± O(n−1). For V ′k in B of k ≥ 1, observe that the difference δS · δT between A(S, T ) and B(S, T ) will not f (T )(cid:1) = 0 from the fact f is i ) δSδT f (T ) = δSδi(cid:0)PT∈([n] change the calculation of τ , because PT∈([n] ⊓⊔ orthogonal to V ′0. k ):S∩S′=k−i f (S). Because (i−1)!!(i−1)!! i ) i! i! Because (i−1)!!(i−1)!! .5 and [ d 2 ] + 1 ≤ d. between .5 and [ d+1 ≤ 1 for any even integer i ≥ 0, we have the following two corollaries. Corollary 3.4 All non-zero eigenvalues of EDp[f 2] in the linear space of span{φSS ∈(cid:0)[n] ≤d(cid:1)} are between Corollary 3.5 All non-zero eigenvalues of VarDp[f ] in the linear space of span{φSS ∈ (cid:0) [n] 1,··· ,d(cid:1)} are Because f + (Pi φi)h ≡ f over supp(Dp) for any h of degree-at-most d − 1, we define the projection of f onto V ′null to compare kfk2 Definition 3.6 Fix the global cardinality constraint Pi xi = (1 − 2p)n and the Fourier transform φS, let hf denote the projection of a degree d multilinear polynomial f onto the null space span{(Pi φi)φSS ∈ (cid:0) [n] ≤d−1(cid:1)} of EDp[f 2] and VarDp(f ), i.e., f − (Pi φi)hf is orthogonal to the eigenspace of an eigenvalue 0 in EDp[f 2] and VarDp(f ). 2 and EDp[f 2]. 2 ] ≤ d. 15 f (S)2. From the above two corollaries and the definition of hf , we bound EDp[f 2] by kfk2 VarDp(f ), we exclude f (∅) because VarDp(f ) is independent with f (∅). Recall that kfk2 PS Corollary 3.7 For any degree d multilinear polynomial f and a global cardinality constraint Pi xi = (1 − 2p)n, EDp[f 2] ≤ dkfk2 Corollary 3.8 For any degree d multilinear polynomial f and a global cardinality constraint Pi xi = (1 − 2p)n, VarDp(f ) ≤ dkf − f (∅)k2 2 and EDp[f 2] ≥ 0.5kf − (Pi φi)hfk2 2 as follows. For 2 = EUp[f 2] = 2 and VarDp(f ) ≥ 0.5kf − f (∅) − (Pi φi)hf− f (∅)k2 4 Parameterized algorithm for CSPs above average with the bisection con- 2. 2. straint We prove that CSPs above average with the bisection constraint are fixed-parameter tractable. Given an f (S)2 and bisection constraint. instance I from d-ary CSPs and the bisection constraint Pi xi = 0, we use the standard basis {χSS ∈ (cid:0)[n] ≤d(cid:1)} of the Fourier transform in U and abbreviate fI to f . Recall that kfk2 2 = EU [f 2] = PS D is the uniform distribution on all assignments in {±1}n complying with the bisection constraint. For f with a small variance in D, we use hf− f (∅) to denote the projection of f − f (∅) onto the null space ≤d−1(cid:1)}. We know kf − f (∅)− (Pi xi)hf− f (∅)k2 span{(Pi xi)χSS ∈(cid:0) [n] 2 ≤ 2VarD(f ) from Corollary 3.8, i.e., the lower bound of the non-zero eigenvalues in VarD(f ). Then we show how to round hf− f (∅) in Section 4.1 to a degree d − 1 polynomial h with integral coefficients such that kf − f (∅) − (Pi xi)hk2 2 = 2), which indicates that f − f (∅) − (Pi xi)h has a small kernel under the O(kf − f (∅) − (Pi xi)hf− f (∅)k2 Otherwise, for f with a large variance in D, we show the hypercontractivity in D that ED[(f − ED[f ])4] = O(ED[(f − ED[f ])2]2) in Section 4.2. From the fourth moment method, we know there exists α in the support of D satisfying f (α) ≥ ED[f ] + Ω(pVarD[f ]2). At last, we prove the main theorem in Section 4.3. Theorem 4.1 Given an instance I of a CSP problem of arity d and a parameter t, there is an algorithm with running time O(n3d) that either finds a kernel on at most Cdt2 variables or certifies that OP T ≥ AV G + t under the bisection constraint for a constant Cd = 24d2 · 7d · 9d · 22d ·(cid:0)d!(d − 1)!··· 2!(cid:1)2. 4.1 Rounding 2). In this section, we show that for any polynomial f of degree d with integral coefficients, there exists an 2 = efficient algorithm to round hf into an integral-coefficient polynomial h while it keeps kf − (Pi xi)hk2 O(kf − (Pi xi)hfk2 Theorem 4.2 For any constants γ and d, given a degree d multilinear polynomial f with kf−(Pi xi)hfk2 2 ≤ √n whose Fourier coefficient f (S) is a multiple of γ for all S ∈(cid:0)[n] ≤d(cid:1), there exists an efficient algorithm to find a degree-at-most d − 1 polynomial h such that d!(d−1)!···2! , which demonstrates that the Fourier coeffi- 1. The Fourier coefficients of h are multiples of γ γ cients of f − (Pi xi)h are multiples of 2. kf − (Pi xi)hk2 2 ≤ 7d · kf − (Pi xi)hfk2 2. d!(d−1)!···2! . 16 2) in the same order. The high level idea of the algorithm is to round hf (S) to h(S) from the coefficients of weight d − 1 to the coefficient of weight 0. At the same time, we guarantee that for any k < d, the rounding on the coefficients 2 = O(kf − (Pi xi)hfk2 of weight k will keep kf − (Pi xi)hk2 Because hf contains non-zero coefficients up to weight d − 1, we first prove that we could round {hf (S)S ∈(cid:0) [n] d−1(cid:1)} to multiples of γ/d!. Observe that for T ∈(cid:0)[n] d(cid:1), the coefficient of χT in f − (Pi xi)hf hf (T \ j). BecausePT∈([n] is f (T )−Pj∈T hf (T \ j) hf (T \ j))2 = o(n), f (T )−Pj∈T d )( f (T )−Pj∈T hf (T \ j) mod γ is close to 0 for most T . Our start point is is close to 0 for most T in(cid:0)[n] d(cid:1). HencePj∈T d−1(cid:1), h(S) is close to a multiple of γ/d! from the above discussion. to prove that for any S ∈(cid:0) [n] Lemma 4.3 If f (T ) is a multiple of γ and f (T ) −PS∈( T multiple of γ/d! for all S ∈(cid:0) [n] d−1(cid:1). hf (S) = 0 for all T ∈ (cid:0)[n] d(cid:1), then hf (S) is a Proof. From the two conditions, we know d−1) hf (S) ≡ 0 mod γ XS∈( T d−1) for any T ∈(cid:0)[n] d(cid:1). We prove that (d − 1)! · hf (S1) + (−1)d(d − 1)! · hf (S2) ≡ 0 mod γ for any S1 ∈(cid:0) [n] d−1(cid:1) and S2 ∈(cid:0)[n]\S d−1(cid:1). Thus 0 ≡ (d − 1)! · XS2∈( T d−1) hf (S2) ≡ d! · hf (S1) mod γ, d d−1) (cid:1), becausePS∈( T hf (T \ j), we use (T ) to denote the equation for any T with S1 ∩ T = ∅, which indicates hf (S1) is a multiple of γ/d!. Without loss of generality, we assume S1 = {1, 2,··· , d − 1} and S2 = {k1, k2,··· , kd−1}. For a subset T ∈(cid:0)S1∪S2 hf (S) =Pj∈T hf (T \ j) ≡ 0 mod γ Xj∈T Let βd−1,1 = (d − 2)! and βd−i−1,i+1 = −i d−i−1 · βd−i,i for any i ∈ {1,··· , d − 2} (we choose βd−1,1 to guarantee that all coefficients are integers). Consider the following linear combination of equations over T ∈(cid:0)S1∪S2 hf (T1∪ T2\ j)(cid:1) ≡ 0 mod γ. Xi=1 i(cid:1), the coefficient of hf (S ∪ S′) is Observe that for any i ∈ {1,··· , d − 2}, S ∈ (cid:0) S1 i · βd−i,i + (d − i − 1) · βd−i−1,i+1 = 0 in equation (5), where i comes from the number of choices of T1 is d − 1 − S = i and d − i − 1 comes from the number of choices of T2 is (d − 1) − S′. i )(cid:0) Xj∈T1∪T2 d−i−1(cid:1), and S′ ∈ (cid:0)S2 (cid:1) with coefficients βd−i,i: (T1∪ T2) ⇒ βd−i,i XT1∈( S1 βd−i,i XT1∈( S1 d−i),T2∈(S2 i ) d−i),T2∈(S2 d−1 Xi=1 d d−1 (T) (5) 17 Hence equation (5) indicates that (d − 1)βd−1,1hf (S1) + (d − 1)β1,d−1hf (S2) ≡ 0 mod γ. Setting into βd−1,1 = (d − 2)! and β1,d−1 = (−1)d−2(d − 2)!, we obtain (d − 1)! · hf (S1) + (−1)d(d − 1)! · hf (S2) ≡ 0 mod γ. ⊓⊔ d−1,(cid:1), hf (S) is 0.1 d−1) d−1) d(cid:1), PS∈( T d )( f (T ) −PS∈( T Following the proof in Lemma 4.3, we obtain that hf (S) is (2d)!(d!)2 hf (S))2 = k = o(n0.6), then for all S ∈ (cid:0) [n] Corollary 4.4 If PT∈([n] d · γ/d! close to a multiple of γ/d!. hf (S) is n−.1 Proof. From the condition, we know that except for n.8 choices of T ∈ (cid:0)[n] close to a multiple of γ because of n.8 · (n−.1)2 > k. Observe that the above proof depends on the Fourier coefficients in at most 2d + 1 variables of S1 ∪ T . Because n0.8 = o(n), for any subset S1 ∈(cid:0) [n] d−1(cid:1), there is a subset T ∈(cid:0)[n]\S1 d (cid:1) such that for any T ′ ∈(cid:0)S1∪T d · γ/d! close to a multiple of γ/d! for any S ∈(cid:0) [n] d−1(cid:1). ⊓⊔ We consider a natural method to round hf , which is to round hf (S) to the closet multiple of γ/d! for every S ∈(cid:0) [n] d−1(cid:1). Claim 4.5 Let hd−1 be the rounding polynomial of hf such that hd−1(S) = hf (S) for any S 6= d − 1 and hd−1(S) is the closest multiple of γ/d! to hf (S) for any S ∈(cid:0) [n] If ǫ(S) < .1/d · γ/d! and α(T ) is a multiple of γ for any T , then d )(cid:0)α(T ) − XS∈( T d−1(cid:1). Let ǫ(S) = hd−1(S) − hf (S). hf (S) is n−.1 close to a multiple of γ. ǫ(S)(cid:1)2 ≤ XT∈([n] d (cid:1),PS∈( T ′ n.1 < 0.1 d−1) d−1) d−1) d−1) d )(cid:0)α(T ) −PS∈( T d−1) ǫ(S)(cid:1)2 ≤PT∈([n] hf (S)(cid:1)2. d−1) ǫ(S) < 0.1 · γ/d!, then PS∈( T d )(cid:0)PS∈( T d )(cid:0) XS∈( T XT∈([n] Proof. For each T ∈ (cid:0)[n] d(cid:1), Because PS∈( T d−1) ǫ(S) < α(T ) − hf (S)(cid:1)2. hf (S). Hence we knowPT∈([n] PS∈( T ⊓⊔ From now on, we use hd−1 to denote the degree d − 1 polynomial of hf after the above rounding process on the Fourier coefficients of weight d − 1. Now we bound the summation of the square of the Fourier 2. Observe that rounding hf (S) only affect the coefficients in f − (Pi xi)hd−1, i.e., kf − (Pi xi)hd−1k2 hf (S)χS\i + terms of T ∈(cid:0)[n] hf (S)χS∪i. Pi /∈S Lemma 4.6 kf − (Pi xi)hd−1k2 2 ≤ 7kf − (Pi xi)hfk2 Proof. Let ǫ(S) = hd−1(S) − hf (S). It is sufficient to prove ǫ(S)  d−2(cid:1) inside S, because (Pi xi)hf (S)χS =Pi∈S d(cid:1) containing S and T ′ ∈(cid:0) [n] d )(cid:0) f (T ) − XS∈( T hf (S) − XS∈( T f (T ) − XS∈( T ≤ 4 XT∈([n] hf (S)(cid:1)2, XT∈([n]   d−1) d−1) d−1) d−1) 2. 2 18 d ) (6) and Claim 4.5. From the inequality of arithmetic and geometric means, we know the cross terms: 2 hf (T ′ ∪ {j}) − Xj /∈T ′ d )(cid:0)PS∈( T hf (S)(cid:12)(cid:12) · XS∈( T d−1) ǫ(S)(cid:1)2 ≤PT∈([n] ǫ(S) ≤ 2 XT∈([n] ǫ(T ′ ∪ {j}) ≤ 2kf−(Xi  d )(cid:0) f (T ) −PS∈( T d )(cid:0) f (T ) − XS∈( T d−1) d−1) hf (S)(cid:1)2. xi)hfk2 2. (7) d−1) hf (S)(cid:1)2 by   d−2) f (T ′) − XS∈( T ′ hf (S) − Xj /∈T ′ XT ′∈( [n] Equation (6) follows the fact thatPT∈([n] d−3) XT∈([n] d ) f (T ) − XS∈( T 2 ·(cid:12)(cid:12) d−1) For (7), observe that XT ′∈( [n] d−2)(cid:0)Xj /∈T ′ Hence we have ǫ(T ∪ {j})(cid:1)2 = (d − 1) XS∈( [n] ≤ XT∈([n] ǫ(S)2 + XS,S′:S∩S′=d−2 ǫ(S)(cid:1)2 ≤ XT∈([n] d )(cid:0) XS∈( T d−1) d−1) 2ǫ(S)ǫ(S′) d )(cid:0) f (T ) − XS∈( T d−1) hf (S)(cid:1)2. XT ′∈( [n] d−2)(cid:0) f (T ′) − XS∈( T ′ ≤ XT ′∈( [n] d−2)(cid:0) f (T ′) − XS∈( T ′ d−3) d−3) hf (S) − Xj /∈T ′ hf (T ′ ∪ {j})(cid:1) + XT ′∈( [n] d−2)(cid:0)Xj /∈T ′ hf (T ′ ∪ {j})(cid:1) + XT∈([n] ǫ(T ∪ {j})(cid:1)2 d )(cid:0) f (T ) − XS∈( T hf (S) − Xj /∈T ′ d−1) hf (S)(cid:1)2 xi)hfk2 2. ≤ kf − (Xi We use the inequality of arithmetic and geometric means again to obtain inequality (7). ⊓⊔ Proof of Theorem 4.2. We apply Claim 4.5 and Lemma 4.6 for d times on the Fourier coefficients of hf d−1(cid:1)},{hf (S)S ∈ (cid:0) [n] from {hf (S)S ∈ (cid:0) [n] d−2(cid:1)},··· to {hf (S)S ∈ (cid:0)[n] specific, let hi be the polynomial after rounding the coefficients on(cid:0)[n] Claim 4.5 to round coefficients of {hi(S)S ∈ (cid:0)[n] parameters of γ in different rounds: γ in the rounding of hd−1, γ/d! in the rounding of hd−2, rounding of hd−3 and so on. After d rounds, all coefficients in h0 are multiples of Because kf − (Pi xi)hik2 2 ≤ 7kf − (Pi xi)hi+1k2 7d · kf − (Pi xi)hfk2 4.2 2 → 4 hypercontractive inequality under distribution D We prove the 2 → 4 hypercontractivity for a degree d polynomial g in this section. 0(cid:1)} by choosing γ properly. More ≥i(cid:1) and hd = hf . Every time, we use i (cid:1)} from hi+1 for i = d − 1,··· , 0. We use different d!·(d−1)! in the 2 from Lemma 4.6. Eventually, kf − (Pi xi)h0k2 2 ≤ ⊓⊔ d!(d−1)!(d−2)!···2! . 2. γ γ 19 Theorem 4.7 For any degree-at-most d multilinear polynomial g, ED[g4] ≤ 3d · 92d · kgk4 2. Recall that kgk2 = EU [g2]1/2 = (PS g(S)2)1/2 and g − (Pi xi)hg ≡ g in the support of D. Because 2 ≤ 2 Ex∼D[g2] from the lower bound of non-zero eigenvalues in ED[g2] in Corollary 3.4, kg − (Pi xi)hgk2 without loss of generality, we assume g is orthogonal to the null space span{(Pi xi)χSS ∈(cid:0) [n] Corollary 4.8 For any degree-at-most d multilinear polynomial g, ED[g4] ≤ 12d · 92d · ED[g2]2. ≤d−1(cid:1)}. Before proving the above Theorem, we observe that uniform sampling a bisection (S, ¯S) is as same as first choosing a random perfect matching M and independently assigning each pair of M to the two subsets. For convenience, we use P (M ) to denote the product distribution on M and EM to denote the expectation over a uniform random sampling of perfect matching M. Let M (i) denote the vertex matched with i in M and M (S) = {M (i)i ∈ S}. From the 2 → 4 hypercontractive inequality on product distribution P (M ), we have the following claim: Claim 4.9 EM [EP (M )[g4]] ≤ 9d EM [EP (M )[g2]2]. Now we prove the main technical lemma of the 2 → 4 hypercontractivity under the bisection constraint to finish the proof. Lemma 4.10 EM [EP (M )[g2]2] ≤ 3d · 9d · kgk4 2. Theorem 4.7 follows from Claim 4.9 and Lemma 4.10. Now we proceed to the proof of Lemma 4.10. Proof of Lemma 4.10. Using g(x) =PS∈([n] EM(cid:20) EP (M )(cid:2)( XS∈([n] g(S)χS)2(cid:3)2(cid:21) ≤d) ≤d) g(S)χS, we rewrite EM [EP (M )[g2]2] as ≤d),S′6=S g(S)2 + ≤d) XS∈([n] ≤d),S′∈([n] = EM(cid:20) EP (M )(cid:2) XS∈([n] g(S)g(S′)χS△S′(cid:3)2(cid:21). Notice that EP (M )[χS∆S′] = (−1)S∆S′/2 if and only if M (S∆S′) = S∆S′; otherwise it is 0. We expand it to EM(cid:20)(cid:16)kgk2 = kgk4 g(S)g(S′) · 1S△S′=M (S△S′) · (−1)S△S′/2(cid:17)2(cid:21) 2 · EM(cid:20) XS∈([n] + EM (cid:16) XS∈([n] g(S)g(S′) · 1S△S′=M (S△S′) · (−1)S△S′/2(cid:21) g(S)g(S′) · 1S△S′=M (S△S′) · (−1)S△S′/2(cid:17)2  XS∈([n] 2 + 2kgk2 ≤d),S′∈([n] ≤d),S′∈([n] ≤d),S′6=S ≤d),S′∈([n] ≤d),S′6=S 2 + . ≤d),S′6=S 20 ≤d),S′6=S g(S)g(S′) · 1S△S′=M (S△S′) · (−1)S△S′/2 in We first bound the expectation of PS∈([n] ≤d),S′∈([n] the uniform distribution over all perfect matchings, then bound the expectation of its square. Observe that (m−1)(m−3)···(m−U+1) such that EM [1U =M (U ) · for a subset U ⊆ [n] with even size, EM [1U =M (U )] = (−1)U/2] = δU, i.e., the expectation ED[χU ] of χU in D. Hence EM(cid:2) g(S)g(S′)1S△S′=M (S△S′) · (−1)S△S′/2(cid:3) ≤XS,S′ g(S)g(S′) · δS△S′ = ED[g2]. XS∈([n] (U−1)(U−3)···1 ≤d),S′∈([n] ≤d),S′6=S From Corollary 3.4, the largest non-zero eigenvalue of the matrix constituted by δS∆S′ is at most d. Thus the expectation is upper bounded by d · kgk2 2. We define g′ to be a degree 2d polynomialPT∈( [n] ≤2d) g′(T )χT with coefficients X g(S)g(S′) ≤d):S∆S′=T g′(T ) = S∈([n] ≤d),S′∈([n] for all T ∈(cid:0) [n] ≤2d(cid:1). Hence we rewrite XS∈([n] EM (cid:18) = EM(cid:20)(cid:0) XT∈( [n] = EM(cid:20)XT,T ′ ≤2d) g(S)g(S′) · 1S△S′=M (S△S′) · (−1)S△S′/2(cid:19)2  ≤d),S′∈([n] ≤d),S′6=S g′(T ) · 1T =M (T )(−1)T/2(cid:1)2(cid:21) g′(T )g′(T ′) · 1T =M (T )1T ′=M (T ′)(−1)T/2+T ′/2(cid:21). 2 from the discussion above. However, we still need to bound the contribution from the Intuitively, because T ≤ 2d and T ′ ≤ 2d, most of pairs T and T ′ are disjoint such that EM [1T =M (T )1T ′=M (T ′)] = EM [1T =M (T )]·EM [1T ′=M (T ′)]. The summation is approximately EM [PT g′(T )1T =M (T )(−1)T/2]2, which is bounded by d2kgk4 correlated paris of T and T ′. Notice that kg′k2 2 from the standard 2 → 4 Instead of bounding it by kgk4 2 through the analysis 2 = EU [g4], which can be upper bounded by ≤ 9dkgk4 on its eigenvalues and eigenspaces to this end. For convenience, we rewrite it to 2 ≤ 2d· 9dkgk4 hypercontractivity. 2 directly, we will bound it by 2d·kg′k2 g′(T )g′(T )1T =M (T )1T ′=M (T ′)(−1)T/2+T ′/2(cid:21) = XT,T ′ EM(cid:20)XT,T ′ g′(T )g′(T ′)∆(T, T ′), where ∆(T, T ′) = 0 if T or T ′ is odd, otherwise ∆(T, T ′) = EM(cid:20)1T∩T ′=M (T∩T ′)1T =M (T )1T ′=M (T ′)(−1)T/2+T ′/2(cid:21) = T ∩ T ′ − 1!! · T \ T ′ − 1!! · T ′ \ T − 1!! (n − 1)(n − 3)··· (n − T ∪ T ′ + 1) (−1)T ∆T ′/2. 21 2d(cid:1) ×(cid:0) n Let A′ be the(cid:0) n 2d(cid:1) matrix whose entry (T, T ′) is ∆(T, T ′). We prove that the eigenspace of A′ with eigenvalue 0 is still span{(Pi xi)χTT ∈(cid:0) [n] ≤2d−1(cid:1)}. Because ∆T,T ′ 6= 0 if and only if T,T ′,and T ∩T ′ are even, it is sufficient to showPi A′(S, T ∆i) = 0 for all odd sized T and even sized S. 1. S ∩ T is odd: ∆(S, T △ i) 6= 0 if and only if i ∈ S. We separate the calculation into i ∈ S ∩ T or ∆(S, T ∪ i). not: Xi A′(S, T △ i) = Xi∈S∩T ∆(S, T \ i) + Xi∈S\T Plugging in the definition of ∆, we obtain S ∩ T · S ∩ T − 2!! · S \ T!! · T \ S!! (n − 1)(n − 3)··· (n − S ∪ T + 1) (−1)S/2+T−1/2 (−1)S/2+T +1/2 = 0. 2. S ∩ T is even: ∆(S, T △ i) 6= 0 if and only if i /∈ S. We separate the calculation into i ∈ T or not: (n − 1)(n − 3)··· (n − S ∪ T + 1) + S \ T · S ∩ T!! · S \ T − 2!! · T \ S!! Xi A′(S, T △ i) = Xi∈T\S ∆(S, T \ i) + Xi /∈S∪T ∆(S, T ∪ i). Plugging in the definition of ∆, we obtain T \ S · S ∩ T − 1!! · S \ T − 1!! · T \ S − 2!! (n − 1)(n − 3)··· (n − S ∪ T + 1) (−1)S/2+T−1/2 + (n − S ∪ T) · S ∩ T − 1!! · S \ T − 1!! · T \ S!! (n − 1)(n − 3)··· (n − S ∪ T) (−1)S/2+T +1/2 = 0. From the same analysis in Section 3, the eigenspaces of A′ are as same as the eigenspaces of A with degree 2d except the eigenvalues, whose differences are the differences between ∆S△T and δS△T . We can compute the eigenvalues of A′ by the same calculation of eigenvalues in A. However, we bound the eigenvalues of A′ by 0 (cid:22) A′ (cid:22) A as follows. Observe that for any S and T , A′(S, T ) and A(S, T ) always has the same sign. At the same time, A′(S, T ) = O(A(S,T ) nS∩T ). For a eigenspace V ′k in A, we focus on τ0 because the eigenvalue is O(1/n)- close to τ0 from the proof of Theorem 3.3. We replace δi by any ∆(S, T ) of S = k,T = k + i and i (cid:1) · αk,k+i · δi to obtain τ′0 for A′. Thus αk,k+i · ∆(S, T ) = Θ( αk,k+iδi S ∩ T = i in τ0 = Pd−k ) indicates τ′0 = Θ(1) < τ0 from the contribution of i = 0. Repeat this calculation to τ2l, we can show τ′2l = O(τ2l) for all l. Hence we know the eigenvalue of A′ in V ′k is upper bounded by the eigenvalue of A from the cancellation rule of τ in the proof of Theorem 3.3. On the other hand, A′ (cid:23) 0 from the definition that it is the expectation of a square term in M. i=0 (cid:0)n−k ni From Corollary 3.4 and all discussion above, we bound the largest eigenvalue of A′ by 2d. Therefore EM(cid:20)XT,T ′ g′(T )g′(T )1T =M (T )1T ′=M (T ′)(−1)T/2+T ′/2(cid:21) = XT,T ′ Over all discussion above, EM(cid:2) EP (M )[g2]2(cid:3) ≤ kgk4 22 g′(T )g′(T ′)∆(T, T ′) ≤ 2dkg′k2 2 ≤ 2d · 9d · kgk4 2. 2 + 2dkgk4 2 + 2d · 9d · kgk4 2 ≤ 3d · 9d · kgk4 2. ⊓⊔ 4.3 Proof of Theorem 4.1 In this section, we prove Theorem 4.1. Let f = fI be the degree d multilinear polynomial associated with the instance I and g = f − ED[f ] for convenience. We discuss VarD[f ] in two cases. If VarD[f ] = ED[g2] ≥ 12d · 92d · t2, we have ED[g4] ≤ 12d · 92d · ED[g2]2 from the 2 → 4 √ED[g2] 2√12d·92d ] > 0. Thus PrD[g ≥ t] > hypercontractivity of Theorem 4.7. By Lemma 2.1, we know PrD[g ≥ 0, which demonstrates that PrD[f ≥ ED[f ] + t] > 0. Otherwise we know VarD[f ] < 12d · 92d · t2. We consider f − f (∅) now. Let hf− f (∅) be the projection of f − f (∅) onto the linear space such that kf − f (∅) − (Pi xi)hf− f (∅)k2 2 ≤ 2Var(f ) from Corollary 3.8 and γ = 2−d. From Theorem 4.2, we could round hf− f (∅) to h for f − f (∅) in time nO(d) such that 1. the coefficients of f − f (∅) − (Pi xi)h are multiples of d!(d−1)!···2! ; 2. kf − f (∅) − (Pi xi)hk2 We first observe that f (α) = f (α)− (Pi αi)h(α) for any α in the support of D. Then we argue f − f (∅)− (Pi xi)h has a small kernel, which indicates that f has a small kernel. From the above two properties, we know there are at most kf − f (∅)−(Pi xi)hk2 d!(d−1)!···2! )2 non-zero coefficients in f − f (∅)−(Pi xi)h. Because each of the nonzero coefficients contains at most d variables, the instance I has a kernel of at most 24d2 · 7d · 9d · 22d ·(cid:0)d!(d − 1)!··· 2!(cid:1)2t2 variables. The running time of this algorithm is the running time to find hf and the rounding time O(nd). Therefore 2 ≤ 7dkf − f (∅) − (Pi xi)hf− f (∅)k2 2 ≤ 7d · 2 · 12d · 9d · t2. 2/( this algorithm runs in time O(n3d). γ γ 5 2 → 4 hypercontractive inequality under distribution Dp In this section, we prove the 2 → 4 hypercontractivity of low-degree multilinear polynomials in the distri- bution Dp conditioned on the global cardinality constraintPi xi = (1 − 2p)n. We assume p is in (0, 1) such that p · n is a integer. Then we fix the Fourier transform to be the p-biased Fourier transform in this section, whose basis is {φSS ∈ (cid:0)[n] ≤d(cid:1)}. Hence we use φ1,··· , φn instead of x1,··· , xn and say that a function only depends on a subset of characters {φii ∈ S} if this function only f (S)φS, we takes input from variables {xii ∈ S}. For a degree d multilinear polynomial f = PS∈([n] use kfk2 = EUp[f 2]1/2 = (PS We rewrite the global cardinality constraint as Pi φi = 0. For convenience, we use n+ = (1 − p)n to denote the number of q p 1−p's in the global cardinality constraint of φi and n− = pn to denote the number of −q 1−p p 's. If n+ = 1−p for some integers p1 and p2, we could follow the approach in n− Section 4.2 that first partition [n+ + n−] into tuples of size p1 + p2 then consider the production distribution over tuples. However, this approach will introduce a dependence on p1 + p2 to the bound, which may be superconstant. Instead of partitioning, we use induction on the number of characters and degree to prove the 2 → 4 hypercontractivity of low-degree multilinear polynomials in Dp. Theorem 5.1 For any degree-at-most d multilinear polynomial f on φ1,··· , φn, f (S)2)1/2 in this section. p = p1 p2 ≤d) EDp[f (φ1, . . . , φn)4] ≤ 3 · d3/2 ·(cid:18)256 ·(cid:0)( 1 − p p )2 + ( p 1 − p )2(cid:1)2(cid:19)d · kfk4 2. 23 Recall that hf is the projection of f onto the null space span{(Pi φi)φSS ∈ (cid:0) [n] ≤d−1(cid:1)}. We know f − (Pi φi)hf ≡ f in supp(Dp), which indicates EDp[f k] = EDp[(f−(Pi φi)hf )k] for any integer k. Without loss of generality, we assume f is orthogonal to span{(Pi φi)φSS ∈ (cid:0) [n] ≤d−1(cid:1)}. From the lower bound of eigenvalues in EDp[f 2] by Corollary 3.4, 0.5kfk2 Corollary 5.2 For any degree-at-most d multilinear polynomial f on φ1,··· , φn, 2 ≤ EDp[f 2]. We have a direct corollary as follows. EDp[f (φ1, . . . , φn)4] ≤ 12 · d3/2 ·(cid:18)256 ·(cid:0)( 1 − p p )2 + ( p 1 − p )2(cid:1)2(cid:19)d EDp[f (φ1, . . . , φn)2]2. Note that since xi can be written as a linear function of φi and linear transformation does not change the degree of the multilinear polynomial, we also have for any degree-at-most d multilinear polynomial g on x1,··· , xn, EDp[g(x1, . . . , xn)4] ≤ 12 · d3/2 ·(cid:18)256 ·(cid:0)( 1 − p p )2 + ( p 1 − p )2(cid:1)2(cid:19)d EDp[g(x1, . . . , xn)2]2. Proof of Theorem 5.1. We assume the inequality holds for any degree < d polynomials and use induction on the number of characters in a degree d multilinear polynomial f to prove that if the multilinear polynomial f of φ1,··· , φn depends on at most k characters of φ1,··· , φn, then EDp[f 4] ≤ d3/2 · C d · βk · kfk4 2 for C = 256 ·(cid:16)( 1−p 1−p )2(cid:17)2 and β = 1 + 1/n. p )2 + ( p Base case. f is a constant function that is independent from φ1,··· , φn, EDp[f 4] = f (∅)4 = kfk4 2. Induction step. Suppose there are k ≥ 1 characters of φ1,··· , φn in f . Without loss of generality, we assume φ1 is one of the characters in f and rewrite f = φ1h0 + h1 for a degree d − 1 polynomial h0 with at most k− 1 characters and a degree d polynomial h1 with at most k− 1 characters. Because f is a multilinear polynomial, kfk2 EDp[φ4 2. We expand EDp[f 4] = EDp[(φ1h0 + h1)4] to 0 · h1] + 6 EDp[φ2 2 = kh0k2 1 · h4 2 + kh1k2 1 · h3 1] + 4 EDp[φ1 · h0 · h3 0] + 4 EDp[φ3 1] + EDp[h4 1]. 1h4 0] + EDp[φ2 (EDp[φ4 Finally, we bound EDp[φ1 · h0 · h3 0h2 1h2 1])/2 ≤ d3/2(cid:0)C d−0.5βk−1kh0k4 1]. However, we cannot apply the Cauchy-Schwarz inequality or the inequality of arithmetic and geometric means, because we cannot afford a term like d3/2 · C dβk−1kh1k4 2 2 + C d−1/4 · βk−1 · kh0k2 2kh1k2 2(cid:1)/2. 24 0 · h2 2 and 1 · h2 1] ≤ C dβk−1kh1k4 )2, ( From the induction hypothesis, EDp[h4 1 − p p EDp[φ4 1 · h4 0 · h2 0] ≤ max{( 1] ≤ (EDp[φ4 1 · h2 Hence EDp[φ2 p 1 − p 0])1/2(EDp[h4 1h4 above discussion, this is at most d3/4 · C d/2 · β(k−1)/2 · kh1k2 Applying the inequality of arithmetic and geometric means on EDp[φ3 2 · d3/4 · C (d−0.5)/2β(k−1)/2kh0k2 0] ≤ d3/2 · C d−0.5βk−1kh0k4 2. )2} EDp[h4 1])1/2 from the Cauchy-Schwarz inequality. From the (8) 2 ≤ d3/2 · C d−1/4 · βk−1 · kh0k2 2kh1k2 2. (9) 0 · h1], we know it is at most (10) 1 · h3 any more. We use Dφ1>0 (Dφ1<0 resp.) to denote the conditional distribution of Dp on fixing φ1 =q p (−q 1−p resp.) and rewrite p 1−p EDp[φ1 · h0 · h3 1] =pp(1 − p) EDφ1>0[h0 · h3 1] −pp(1 − p) EDφi<0[h0 · h3 1]. Let L be the matrix corresponding to the quadratic form EDφ1>0[f g]−EDφ1<0[f g] for low-degree multilinear polynomials f and g (i.e. let L be a matrix such that f T Lg = EDφ1>0[f g]−EDφ1<0[f g]). The main technical lemma of this section is a upper bound on the spectral norm of L. (11) Lemma 5.3 Let g be a degree d(d ≥ 1) multilinear polynomial on characters φ2,··· , φn, we have EDφ1>0[g2] − EDφ1<0[g2] ≤ 3d3/2 p(1 − p) · kgk2 2√n . Therefore, the spectral norm of L is upper bounded by 3d3/2 p(1−p) · kgk2 2√n . From the above lemma, we rewrite the equation (11) from the upper bound of its eigenvalues: EDp[φ1 · h0 · h3 1] =pp(1 − p)(cid:16)EDφ1>0[h0 · h3 =pp(1 − p)(h0h1)T L · (h2 1](cid:17) 1] − EDφ1<0[h0 · h3 1) ≤pp(1 − p) · p(1 − p) · 3(2d)3/2 Then we use the inequality of arithmetic and geometric means on it: 1 √n · kh0h1k2 · kh2 1k2. EDp[φ1 · h0 · h3 1] ≤pp(1 − p) · Next, we use the 2 → 4 hypercontractivity kh2k2 Cauchy-Schwarz inequality to further simplify it to: EDp[φ1 · h0 · h3 1] ≤ 5d3/2 pp(1 − p) · (kh2 0k2 · kh2 1k2 + ≤ 5d3/2 pp(1 − p) · 9d ·(cid:18) p2 1k2 2 + kh2 2/n 2 . p (cid:17)d 1−p + (1−p)2 10d3/2 p(1 − p) · kh0h1k2 2 = EUp[h4] ≤ 9d ·(cid:16) p2 p (cid:17)d 1−p + (1−p)2 (cid:19)d (kh0k2 9d ·(cid:16) p2 (1 − p)2 1 − p + n p kh1k4 2) khk4 2 in Up and the 2 · kh1k2 2 + 1 nkh1k4 2). (12) 25 From all discussion, we bound E[f 4] by the upper bound of each inequalities in (8),(10),(9),(12): EDp[(φ1h0 + h1)4] + 4 5d3/2 1 · h4 (1 − p)2 0 · h1] + 6EDp[φ2 1] + 4EDp[φ1 · h0 · h3 =EDp[φ4 0] + 4EDp[φ3 ≤d3/2C d−0.5βk−1kh0k4 1 · h3 1 · h2 0 · h2 2 + 4d3/2(cid:16)C d−0.5βk−1kh0k4 2 + C d−1/4βk−1kh0k2 (cid:19)d(cid:18)kh0k2 1 nkh1k4 2 + 8d3/2 · C d−1/4 · βk−1 + · pp(1 − p) · 9d ·(cid:18) p2 1 − p (cid:19)d + d3/2 · C dβk−1!kh1k4 p 2 + d3/2 · (C d/n + C dβk−1)kh1k4 2kh1k2 ≤3d3/2 · C d−0.5βk−1kh0k4 pp(1 − p) · 9d ·(cid:18) p2 + 20d3/2 pp(1 − p) · 9d ·(cid:18) p2 ≤d3/2 · C dβkkh0k4 2 + d3/2 · C dβk · 2kh0k2 2kh1k2 20d3/2 (1 − p)2 + 1 − p 1 − p 2 + + p 1 n 2 2 ≤ d3/2 · C dβkkfk4 2. 1] + EDp[h4 1] 2(cid:17) /2 + 6d3/2C d−1/4βk−1kh0k2 2kh1k2 2(cid:19) + d3/2 · C dβk−1kh1k4 2 2kh1k2 2 + (1 − p)2 p (cid:19)d! · kh0k2 2kh1k2 2 We prove Lemma 5.3 to finish the proof. ⊓⊔ Intuitively, both EDφ1>0[g2] and EDφ1<0[g2] are close to EDp[g2] (we add the dummy character φ1 back in Dp) for a low-degree multilinear polynomial g; therefore their gap should be small compared to EDp[g2] = O(kgk2 2). Recall that Dp is a uniform distribution on the constraintPi φi = 0, i.e., there are always n+ characters of φi withq p p . For convenience, we abuse the notation φ to denote a vector of characters (φ1,··· , φn). Proof of Lemma 5.3. 1−p and n− characters with −q 1−p Let F be the p-biased distribution on n − 2 characters with the global cardinality 1−p +q 1−p p = −q, i.e., n+ − 1 of the characters are alwaysq p constraintPn−1 1−p and n− − 1 of the characters are always −q 1−p p . Let ~φ−i denote the vector (φ2,··· , φi−1, φi+1,··· , φn) of n − 2 characters such that we could sample ~φ−i from F . Hence φ ∼ Dφ1<0 is equivalent to the distribution that first samples i from 2,··· , n then fixes φi = q p 1−p and samples ~φ−i ∼ F . Similarly, φ ∼ Dφ1>0 is equivalent to the distribution that first samples i from 2,··· , n then fixes φi = −q 1−p and samples ~φ−i ∼ F . i=2 φi = −q p p For a multilinear polynomial g depending on characters φ2,··· , φn, we rewrite EDφ1>0[g2] − EDφ1<0[g2] = Ei Eφ∼F (cid:20)g(φi =r p 1 − p , ~φ−i = φ)2 − g(φi = −r 1 − p p , ~φ−i = φ)2(cid:21) . (13) 26 Eφ∼F (cid:20)(cid:18)g(φi =r p 1 − p ≤ Eφ∼F "(cid:18)g(φi =r p 1 − p , ~φ−i = φ)(cid:19) p , ~φ−i = φ) − g(φi = −r 1 − p ·(cid:18)g(φi =r p 1 − p , ~φ−i = φ) − g(φi = −r 1 − p · Eφ∼F "(cid:18)g(φi =r p 1 − p , ~φ−i = φ) + g(φi = −r 1 − p , ~φ−i = φ)(cid:19)2#1/2 p p , ~φ−i = φ)(cid:19)(cid:21) We will show its eigenvalue is upper bounded by 3d3/2 p(1−p)·p1/n. We first use the Cauchy-Schwarz inequality: , ~φ−i = φ) + g(φi = −r 1 − p From the inequality of arithmetic and geometric means and the fact that EDp[g2] ≤ dkgk2 second term is bounded by p , ~φ−i = φ)(cid:19)2#1/2 . 2, observe that the Eφ∼F "(cid:18)g(φi =r p 1 − p ≤2 EDφ1>0(cid:20)g(φi =r p 1 − p 3d p(1 − p) · kgk2 ≤ p(1 − p) EDp[g2] ≤ 3 2. , ~φ−i = φ)(cid:19)2# , ~φ−i = φ) + g(φi = −r 1 − p , ~φ−i = φ)2(cid:21) + 2 EDφ1<0(cid:20)g(φi = −r1 − p p p , ~φ−i = φ)2(cid:21) 1/2 . We use p , ~φ−i = φ)(cid:17)2(cid:21)1/2 p , ~φ−i = φ): 1−p , ~φ−i = φ) − g(φi = −q 1−p Then we turn to Eφ∼F (cid:20)(cid:16)g(φi =q p f (S)φS\i to replace g(φi =q p gi =PS:i∈S Eφ∼F   XS:i∈S +r 1 − p g(S)(cid:18)r p 1 − p 1−p , ~φ−i = φ) − g(φi = −q 1−p p (cid:19) φS\i!2 p (cid:19) Eφ∼F (cid:2)gi(φ)2(cid:3)1/2  Eventually we bound Eφ∼F [gi(φ)2] by its eigenvalue. Observe that F is the distribution on n − 2 1−p's and (n−−1) −q 1−p characters with (n+−1)q p p 's, which indicatesPj φj +q = 0 in F . However, the small difference betweenPj φj + q = 0 andPj φj = 0 will not change the major term in the eigenvalues of Dp. From the same analysis, the largest eigenvalue of EF [g2 a calculation in Section 5.1. Claim 5.4 For any degree-at-most d multilinear polynomial gi, Eφ∼F [gi(φ)2] ≤ dkgik2 2. i ] is at most d. For completeness, we provide Therefore we have Ei[Eφ∼F [gi(φ)2]1/2] ≤ √d · Ei[kgi(φ)k2] and simplify the right hand side of in- =(cid:18)r p 1 − p +r 1 − p . 27 equality (13) further: Ei(cid:26) Eφ∼F "(cid:18)g(φi =r p 1 − p · Eφ∼F "(cid:18)g(φi =r p 1 − p ≤ Ei"(cid:18)r p +r 1 − p p (cid:19) · 1 − p ≤ p(1 − p) · kgk2 · Ei[kgik2] 3d √d · kgik2 ·s 3d , ~φ−i = φ) − g(φi = −r1 − p p , ~φ−i = φ)(cid:19)2#1/2 , ~φ−i = φ) + g(φi = −r 1 − p p(1 − p) · kgk2# p , ~φ−i = φ)(cid:19)2#1/2 (cid:27) Using the fact thatPi kgik2 to obtain the desired upper bound on the absolute value of eigenvalues of EDφ1=1[g2] − EDφ1=−1[g2] : 2 and Cauchy-Schwartz again, we further simplify the expression above 2 ≤ dkgk2 3d p(1 − p) · kgk2 · Ei[kgik2] ≤ 3d p(1 − p) · kgk2 · 5.1 Proof of Claim 5.4 2)1/2 (Pi kgik2 √n p(1 − p) · kgk2 ·r d ≤ 3d nkgk2 ≤ 3d3/2 p(1 − p) · kgk2 2√n . ⊓⊔ We follow the approach in Section 3 to determine the eigenvalues of EF [f 2] for a polynomial f =PS∈([n−2] Recall thatPi φi + q = 0 over all support of F for q = 2p−1√p(1−p) We abuse δk = EF [φS] for a subset S with size k. We start with δ0 = 1 and δ1 = −q/(n − 2). From (Pi φi + q)φS ≡ 0 for k ≤ d − 1 and any S ∈(cid:0)[n] k(cid:1), we have as defined before. ≤d ) φS∪j] = 0 ⇒ k · δk−1 + (k + 1)q · δk + (n − 2 − k) · δk+1 = 0 E[Xj∈S φjφS + qχS +Xj /∈S Now we determine the eigenspaces of EF [f 2]. The eigenspace of an eigenvalue 0 is span{(Pi φ+q)φSS ∈ (cid:0)[n−2] ≤d−1(cid:1)}. There are d + 1 non-zero eigenspaces V0, V1,··· , Vd. The eigenspace Vi of EF [f 2] is spanned by { f (S)φSS ∈(cid:0)[n−2] 1. ∀T ′ ∈(cid:0)[n−2] 2. ∀T ∈(cid:0)[n] 3. ∀T ∈(cid:0)[n−2] i (cid:1)}. For each f ∈ Vi, f satisfies the following properties: i−1 (cid:1),Pj /∈T ′ f (S ∪ j) = 0 (neglect this contraint for V0). <i(cid:1), f (T ) = 0. >i (cid:1), f (T ) = αk,TPS∈T f (S) where αk,k = 1 and αk,k+i satisfies i · αk,k+i−1 + (k + i + 1) · q · αk,k+i + (n − 2 − 2k − i)αk,k+i+1 = 0. 28 f (S)φS. We show the calculation of αk,k+i as follows: fix a subset T of size k + i and consider the orthogonality between (Pi φi + q)]φT and f ∈ Vk: Xj∈T ⇒ XS∈(T k ) f (S) + (k + i + 1) · q · αk,k+i XS∈(T αk,k+i−1 XS∈(T \j k)(cid:16)(k + i + 1) · q · αk,k+i + (n − 2 − k − i)αk,k+i+1 + i · αk,k+i−1(cid:17) f (S) αk,k+i+1Xj /∈T f (S) +Xj /∈T + XT ′∈( T k−1) k) αk,k+i+1 XS∈(T ∪j k ) f (S) = 0 f (T ′ ∪ j) = 0. Using the first property ∀T ′ ∈(cid:0)[n−2] i−1 (cid:1),Pj /∈T ′ f (S ∪ j) = 0 to remove all S′ /∈ T , we have k)(cid:0)i · αk,k+i−1 + (k + i + 1) · q · αk,k+i + (n − 2 − 2k − i)αk,k+i+1(cid:1) f (S) = 0 XS∈(T We calculate the eigenvalues of Vk following the approach in Section 3. Fix S and S′ with i = S △ S′, we still use τi to denote the coefficients of f (S′) in the expansion ofPT (δS△T − δS δT ) f (T ). Observe that τi is as same as the definition in Section 3 in terms of δ and αk : τ0 = d−k Xi=0(cid:18)n − 2 − k i (cid:19) · αk,k+i · δi, τ2l = d−k Xi=0 αk,k+i i Xt=0(cid:18)l t(cid:19)(cid:18)n − 2 − k − 2l i − t (cid:19)δ2l+i−2t. Observe that the small difference between (Pi φi + q) ≡ 0 andPi φi ≡ 0 only changes a little in the recurrence formulas of δ and α. For δ2i and αk,k+2i of an integer i, the major term is still determined by δ2i−2 and αk,k+2i−2. For δ2i+1 and αk,k+2i+1, they are still in the same order (the constant before n−i−1 will not change the order). Using the same induction on δ and α, we have ni + O(n−i−1); 1. δ2i = (−1)i (2i−1)!! 2. δ2i+1 = O(n−i−1); 3. αk,k+2i = (−1)i (2i−1)!! 4. αk,k+2i+1 = O(n−i−1). ni + O(n−i−1); even i=0 (i−1)!!(i−1)!! Hence τ0 = Pd−k we know the eigenvalue of Vk is τ0 ± O(τ2) =Pd−k (i−1)!!(i−1)!! From all discussion above, the eigenvalues of EF [f 2] is at most [ d even i=0 i! i! + O(n−1). 2 ] + 1 ≤ d. + O(n−1) and τ2l = O(n−l). Follow the same analysis in Section 3, 6 Parameterized algorithm for CSPs above average with global cardinality constraints We show that CSPs above average with the global cardinality constraint Pi xi = (1 − 2p)n are fixed- parameter tractable for any p ∈ [p0, 1 − p0] with an integer pn. We still use Dp to denote the uniform distribution on all assignments in {±1}n complying withPi xi = (1 − 2p)n. 29 Without loss of generality, we assume p < 1/2 and (1 − 2p)n is an integer. We choose the standard basis {χS} in this section instead of {φS}, because the Fourier coefficients in {φS} can be arbitrary small for some p ∈ (0, 1). Theorem 6.1 For any constant p0 ∈ (0, 1) and d, given an instance of d-ary CSP, a parameter t, and a parameter p ∈ [p0, 1 − p0], there exists an algorithm with running time nO(d) that either finds a kernel on at most C · t2 variables or certifies that OP T ≥ AV G + t under the global cardinality constraint Pi xi = (1 − 2p)n for a constant C = 160d2 · 30d(cid:16)( 1−p0 Let f be a degree d polynomial whose coefficients are multiples of γ in the standard basis {χSS ∈(cid:0)[n] ≤d(cid:1)}. We show how to find an integral-coefficients polynomial h such that f −(cid:0)Pi xi−(1−2p)n(cid:1)h only depends polynomial h such that f −(cid:0)Pi xi(cid:1)h only depends on O(VarD(f )) variables (where D is the distribution conditioned on the bisection constraint). Without loss of generality, we assume f (∅) = 0 because VarDp(f ) is independent with f (∅). Before proving that f depends on at most O(VarDp(f )) variables, we first define the inactivity of a variable xi in f . on O(VarDp(f )) variables. We use the rounding algorithm in Section 4.1 as a black box, which provides a · (d!)3d2 · (1/2p0)4d. 6.1 Rounding )2 + ( p0 1−p0 )2(cid:17)d p0 equations. ≤d) f (S)χS if f (S) = 0 for all S containing xi. In general, there are multiple ways to choose h to turn a variable into inactive. However, if we know a Definition 6.2 A variable xi for i ∈ [n] is inactive in f =PS A variable xi is inactive in f under the global cardinality constraint Pi xi = (1 − 2p)n if there exists a polynomial h such that xi is inactive in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h. subset S of d variables and the existence of some h to turn S into inactive in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h, we show that h is uniquely determined by S. Intuitively, for any subset S1 with d − 1 variables, there are d (cid:1) =(cid:0)2d−1 (cid:0)S1∪S d (cid:1) ways to choose a subset of size d. Any d-subset T in S1 ∪ S contains at least one inactive h(T \ j) = 0 from the assumption. At the same time, there are at most variable such that f (T ) −Pj∈T d−1(cid:1) coefficients of h in S1 ∪ S. So there is only one solution of coefficients in h to satisfy these(cid:0)2d−1 (cid:0)2d−1 d (cid:1) f (T )χT and p ∈ [p0, 1 − p0], let S be a subset with at least d variables Claim 6.3 Given f = PT∈([n] such that there exists a degree ≤ d − 1 multilinear polynomial h turning S into inactive in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h. Then h is uniquely determined by any d elements in S and f . Proof. Without lose of generality, we assume S = {1,··· , d} and determine h(S1) for S1 = {i1,··· , id−1}. For simplicity, we first consider the case S ∩ S1 = ∅. From the definition, we know that for any T ∈ (cid:0)S∪S1 h(T \ j) = 0. Hence we can repeat the argument in Lemma 4.3 to determine h(S1) from f (T ) over all T ∈(cid:0)S∪S1 d (cid:1). Let βd−1,1 = (d − 2)! and βd−i−1,i+1 = −i d−i−1 βd−i,i for any i ∈ {1,··· , d − 2} be the parameters define in Lemma 4.3. For any S2 ∈(cid:0) S βd−i,i XT1∈( S1 d (cid:1), T contains at least one inactive variable, which indicates f (T ) −Pj∈T d−1(cid:1), by the same calculation,  f (T1 ∪ T2) − Xj∈T1∪T2  h(T1 ∪ T2 \ j)  = 0 d−i),T2∈(S2 i ) d−1 Xi=1 30 indicates that (all h(S) not S1 or S2 cancel with each other) (d − 1)! · h(S1) + (−1)d(d − 1)! · h(S2) = d−1 Xi=1 βd−i,i XT1∈( S1 d−i),T2∈(S2 i ) f (T1 ∪ T2). d−i),T2∈(S2 i ) ≤d) the definition, and vice versa. i=1 βd−i,i (d−1)!(cid:0)PT1∈( S1 d−1) h(S2) = 0, we obtain h(S1) in terms of f and S. Remark 6.4 The coefficients of h are multiples of γ/d! if the coefficients of f are multiples of γ. d−1(cid:1), we repeat this argument for S1 ∈ (cid:0) [n] ≤d−1(cid:1) from S and the coefficients in f . Hence h(S2) = (−1)d−1h(S1) + (−1)dPd−1 f (T1 ∪ T2)(cid:1) for any S2 ∈(cid:0) S d−1(cid:1). Replacing all h(S2) in the equation f (S) −PS2∈( S If S ∩ S1 6= ∅, then we set S′ = S \ S1. Next we add arbitrary S ∩ S1 more variables into S′ such that S′ = d and S′ ∩ S1 = ∅. Observe that S′ ∪ S1 contains at least d inactive variables. Repeat the above argument, we could determine h(S1). After determining h(S1) for all S1 ∈ (cid:0) [n] d−2(cid:1) and so on. There- fore we could determine h(S1) for all S1 ∈(cid:0) [n] ⊓⊔ Let h1 and h2 be two polynomials such that at least d variables are inactive in both f−(cid:0)Pi xi−(1−2p)n(cid:1)h1 and f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h2. We know that h1 = h2 from the above claim. Furthermore, it implies that any variable that is inactive in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h1 is inactive in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h2 from Based on this observation, we show how to find a degree d − 1 function h such that there are fews active variables left in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h. The high level is to random sample a subset Q of (1 − 2p)n variables and restrict all variables in Q to 1. Thus the rest variables constitutes the bisection constraint on 2pn variables such that we could use the rounding process in Section 4.1. Let k be a large number, Q1,··· , Qk be k random subsets and h1,··· , hk be the k functions after rounding in Section 4.1. Intuitively, the number of active variables in f − (Pi /∈Q1 xk)hk are small with high probability such that h1,··· , hk share at least d inactive variables. We can use one function h to represent xi)hj over all h1,··· , hk from the above claim such that the union of inactive variables in f − (Pi /∈Qj j ∈ [k] are inactive in f − (Pi xi)h from the definition. Therefore there are a few active variables in f − (Pi xi)h. Let us move to f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h. Because h is a degree-at-most d− 1 function, (1 − 2p)n · h is a degree ≤ d − 1 function. Thus we know that the number of active variables among degree d terms in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h is upper bounded by the number of active variables in f − (Pi xi)h. For the degree < d terms left in f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h, we repeat the above process again. Theorem 6.5 Given a global cardinality constraint Pi xi = (1 − 2p)n and a degree d function f = PS∈([n] running in time O(dn2d) to find a polynomial h such that there are at most C′ f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h for C′p,d = 20d27d·(d!)2d2 (1−2p)n(cid:1), we consider the assignments conditioned on xQ = ~1 and use fQ to Proof. For any subset Q ∈ (cid:0) rest variables isPi /∈Q xi = 0. We use DQ denote the distribution on assignments of {xii /∈ Q} satisfying Pi /∈Q xi = 0, i.e., the distribution of {xii /∈ ¯Q} under the bisection constraint. denote the restricted function f on xQ = ~1. Conditioned on xQ = ~1, the global cardinality constraint on the f (S) with VarDp(f ) < n0.5 and coefficients of multiples of γ , there is an efficient algorithm xi)h1,··· , f − (Pi /∈Qi p,d·VarDp (f ) γ2 active variables in (2p)4d . [n] 31 Let XQ(i) ∈ {0, 1} denote whether xi is active in fQ under the bisection constraint of ¯Q or not after the bisection rounding in Theorem 4.2. From Theorem 4.2, we get an upper bound on the number of active variables in fQ, i.e., for C′d = 7d(d!(d−1)!···2!)2 γ2 We claim that XQ(i) ≤ 2C′d · VarDQ(fQ) Xi and any Q with VarDQ(fQ) = O(n0.6). EQ[VarDQ(fQ)] ≤ VarDp(f ). From the definition, EQ[VarDQ(fQ)] = EQ Ey∼DQ[fQ(y)2]− EQ(cid:2) Ey∼DQ[fQ(y)](cid:3)2. At the same time, we observe that EQ Ey∼DQ[fQ(y)2] = ED[f 2] and EQ[Ey∼DQ fQ(y)]2 ≥ EDp[f ]2. Therefore EQ[VarDQ(fQ)] ≤ VarDp[f ]. One observation is that PrQ[VarDQ ≥ n0.6] < n−0.1 from the assumption VarDp(f ) < n0.5, which is very small such that we can neglect it in the rest of proof. From the discussion above, we have EQ[Pi XQ(i)] ≤ 2C′d · VarDp(f ) with high probability. Now we consider the number of i's with EQ[XQ(i)] ≤ (2p)2d denote the number of i's with EQ[XQ(i)] ≤ (2p)2d convenience. Hence for any i > m, EQ[XQ(i)] > (2p)2d is at least 1 − (2p)2d 5d . Without loss of generality, we use m to and further assume these variables are {1, 2,··· , m} for 5d . We know the probability VarDQ(f ) ≤ , which implies 2VarDp (f ) (2p)2d 5d 2 n − m ≤ 2C′d · VarDQ(f ) (2p)2d 5d ≤ 20d · C′d VarDp(f ) . (2p)4d 5d − (2p)2d We are going to show that EQ[XQ(i)] is either 0 or at least (2p)2d 5d , which means that only xm+1,··· , xn are active in f under Pi xi = 0. Then we discuss how to find out a polynomial hd such that x1,··· , xm are inactive in the degree d terms of f −(cid:0)Pi xi − (1 − 2p)n(cid:1)hd. We fix d variables x1,··· , xd and pick d arbitrary variables xj1,··· , xjd from {d + 1,··· , n}. We focus on {x1, x2,··· , xd, xj1,··· , xjd} now. With probability at least (2p)2d − o(1) ≥ 0.99(2p)2d over random sampling Q, none of these 2d variables is in Q. At the same time, with probability at least 1 − 2d · (2p)2d 5d , all variables in the intersction {x1, . . . , xm} ∩ {x1, x2,··· , xd, xj1,··· , xjd} are inactive in fQ under the bisection constraint on ¯Q (2d is for xj1,··· , xjd if necessary). Therefore, with probability at least 0.99(2p)2d − 2d · (2p)2d 2 ≥ 0.09(2p)2d, x1, x2,··· , xd are inactive in fQ underPi /∈Q xi = 0 and such that the variables in {x1, . . . , xm} ∩ n − m is small. Namely there exists a polynomial hxj1 ,··· ,xjd {x1, x2,··· , xd, xj1,··· , xjd} are inactive in fQ − (Pi /∈Q xi)hxj1 ,··· ,xjd Now we apply Claim 6.3 on S = {1,··· , d} in f to obtain the unique polynomial hd, which is the combination of hxj1 ,··· ,xjd over all choices of j1,··· , jd, and consider f − (Pi xi)hd. Because of the arbitrary choices of xj1,··· , xjd, it implies that x1,··· , xd are inactive in f − (Pi xi)hd. For example, we fix any j1,··· , jd and T = {1, j1,··· , jd−1}. we know f (T ) −Pj∈T (T \ j) = 0 from the on the Fourier coefficients from Claim 6.3, we definition of hxj1 ,··· ,xjd have f (T ) −Pj∈T Furthermore, it implies that xd+1,··· , xm are also inactive in f − (Pi xi)hd. For example, we fix j1 ∈ {d + 1,··· , m} and choose j2,··· , jd arbitrarily. Then x1,··· , xd, and xj1 are inactive in fQ − for some Q from the discussion above, which indicates that xj1 are inactive in f − (Pi /∈Q xi)hxj1 ,··· ,xjd (Pi xi)hd by Claim 6.3. . Because hd agrees with hxj1 ,··· ,xjd hd(T \ j) = 0. hxj1 ,··· ,xjd . 32 To find hd in time O(n2d), we enumerate all possible choices of d variables in [n] as S. Then we apply Claim 6.3 to find the polynomial hS corresponding to S and check f − (Pi xi)hS. If there are more than m inactive variables in f − (Pi xi)hS, then we set hd = hS. Therefore the running time of this process is (cid:0)n d(cid:1) · O(nd) = O(n2d). Hence, we can find a polynomial hd efficiently such that at least m variables are inactive in f − (Pi xi)hd. Let us return to the original global cardinality constraintPi xi = (1 − 2p)n. Let fd = f −(cid:0)Xi xi − (1 − 2p)n(cid:1)hd. x1,··· , xm are no longer inactive in fd because of the extra term (1 − 2p)n · h. However, x1,··· , xm are at least independent with the degree d terms in fd. Let Ad denote the set for active variables in the degree d terms of fd, which is less than 20d·C′ VarDp(f ) from the upper bound of n − m. d (2p)4d For fd, observe that VarDp(fd) = VarDp(f ) and all coefficients of fd are multiples of γd−1 = γ/d! from Claim 6.3. For fd, we neglect its degree d terms in Ad and treat it as a degree d − 1 function from now on. Then we could repeat the above process again for the degree d − 1 terms in fd to obtain a degree d − 2 polynomial hd−1 such that the active set Ad−1 in the degree d − 1 terms of fd−1 = fd −(cid:0)Pi xi − (1 − 2p)n(cid:1)hd−1 contains at most 20d·C′ that the degree of(cid:0)Pi xi − (1 − 2p)n(cid:1)hd−1 is at most d − 1 such that it will not introduce degree d terms to fd−1. Then we repeat it again for terms of degree d − 2, d − 3, and so on. To summarize, we can find a polynomial h such that Ad∪ Ad−1 ···∪ A1 is the active set in f −(cid:0)Pi xi− (1 − 2p)n(cid:1)h. At the same time, Ad ∪ Ad−1 ··· ∪ A1 ≤Pi Ai ≤ ⊓⊔ variables for C′d−1 = ((d−1)2···2!)2 20d27d·VarDp (f )·(d!)2d2 . At the same time, observe γ2·(2p)4d d−1 (2p)4d VarDp(f ) p )2 + ( p p 1 − p · t2, we have 6.2 Proof of Theoreom 6.1 In this section, we prove Theorem 6.1. Let f = fI be the degree d function associated with the instance I and g = f − EDp[f ] for convenience. We discuss VarDp[f ] in two cases. If VarDp[f ] = EDp[g2] ≥ 8(cid:16)16 ·(cid:0)( 1−p EDp[g4] ≤ 12 ·(cid:18)256 ·(cid:0)( 1−p )2(cid:1) · d3(cid:17)d )2(cid:1)2 · d6(cid:19)d qEDp[g2] p )2 + ( p from the 2 → 4 hypercontractivity in Theorem 5.2. By Lemma 2.1, we know   2r12 ·(cid:16)256 ·(cid:0)( 1−p 1−p )2(cid:1)2 · d6(cid:17)d Thus PrDp[g ≥ t] > 0, which demonstrates that PrDp[f ≥ EDp[g] + t] > 0. Otherwise we know VarDp[f ] ≤ 8(cid:16)16 ·(cid:0)( 1−p · t2. We set γ = 2−d. From Theorem 6.5, we could find a degree d − 1 function h in time O(n2d) such that f −(cid:0)Pi xi − (1 − 2p)n(cid:1)h contains variables. We further observe that f (α) = f (α) −(cid:0)Pi αi − (1 − 2p)n(cid:1)h(α) for any 1−p )2(cid:1) · d3(cid:17)d p )2 + ( p 1 − p p at most C′ p,d·VarDp (f ) Pr Dp g ≥ EDp[g2]2   )2 + ( > 0. γ2 d−1 . γ2 33 α in the support of Dp. Then we know the kernel of f and I is at most 8(cid:18)16 ·(cid:0)( )2(cid:1) · d3(cid:19)d p 1 − p 1 − p p )2 + ( C′p,d γ2 < 8(cid:18)16 ·(cid:0)( 1 − p p )2 + ( )2(cid:1) · d3(cid:19)d · t2 · The running time of this algorithm is O(dn2d). · t2 · p 1 − p 20d27d · VarDp(f ) · (d!)2d2 · 22d γ2 · (2p)4d < C · t2. Acknowledgement We would like to thank Ryan O'Donnell and Yu Zhao for useful discussion on the hypercontractive inequal- ities. The first author is grateful to David Zuckerman for his constant support and encouragement, as well as for many fruitful discussions. References [1] Noga Alon, Gregory Gutin, EunJung Kim, Stefan Szeider, and Anders Yeo. Solving MAX-r-SAT Above a Tight Lower Bound. Algorithmica, 61(3):638 -- 655, 2011. 1, 3, 4, 5, 7, 11 [2] Per Austrin, Siavosh Benabbas, and Konstantinos Georgiou. Better Balance by Being Biased: A 0.8776-Approximation for Max Bisection. In Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '13, pages 277 -- 294, 2013. 1 [3] Per Austrin and Elchanan Mossel. Approximation Resistant Predicates from Pairwise Independence. Computational Complexity, 18(2):249 -- 271, 2009. 1 [4] Boaz Barak, Fernando G.S.L. Brandao, Aram W. Harrow, Jonathan Kelner, David Steurer, and Yuan Zhou. Hypercontractivity, Sum-of-squares Proofs, and Their Applications. In Proceedings of the 44th Annual ACM Symposium on Theory of Computing, STOC '14, pages 307 -- 326, 2014. 3 [5] Bonnie Berger. The Fourth Moment Method. SIAM J. Comput., 26(4):1188 -- 1207, August 1997. 4, 7 [6] Aline Bonami. ´Etude des coefficients Fourier des fonctions de Lp(G). Annales de l'Institut Fourier, 20(2):335 -- 402, 1970. 7 [7] Siu On Chan. Approximation Resistance from Pairwise Independent Subgroups. In Proceedings of the 45th Annual ACM Symposium on Theory of Computing, STOC '13, pages 447 -- 456, New York, NY, USA, 2013. ACM. 1 [8] R. Crowston, M. Fellows, G. Gutin, M. Jones, E.J. Kim, F. Rosamond, I.Z. Ruzsa, S. Thomass´e, and A. Yeo. Satisfying more than half of a system of linear equations over gf(2). J. Comput. Syst. Sci., 80(4):687 -- 696, June 2014. 1 [9] Robert Crowston, Mark Jones, and Matthias Mnich. Max-cut parameterized above the edwards-erdos bound. Algorithmica, 72(3):734 -- 757, 2015. 2 34 [10] Uriel Feige and Michael Langberg. The RPR2 Rounding Technique for Semidefinite Programs. J. Algorithms, 60(1):1 -- 23, July 2006. 1 [11] Yuval Filmus and Elchanan Mossel. Harmonicity and Invariance on Slices of the Boolean Cube. In Computational Complexity Conference 2016, CCC 2016, 2016. 3 [12] Alan Frieze and Mark Jerrum. Improved approximation algorithms for max k-cut and max bisec- tion. In Proceedings of the 4th International Conference on Integer Programming and Combinatorial Optimization, pages 1 -- 13, 1995. 1 [13] Chris Godsil. Association Schemes. http://www.math.uwaterloo.ca/cgodsil/pdfs/assoc2.pdf, 2010. Last accessed: November 6, 2015. 4, 10 [14] Dmitry Grigoriev. Complexity of Positivstellensatz proofs for the knapsack. Computational Complex- ity, 10(2):139 -- 154, 2001. 4, 12 [15] Venkatesan Guruswami, Johan Hastad, Rajsekar Manokaran, Prasad Raghavendra, and Moses Charikar. Beating the Random Ordering Is Hard: Every Ordering CSP Is Approximation Resistant. SIAM J. Comput., 40(3):878 -- 914, June 2011. 1 [16] Venkatesan Guruswami, Yury Makarychev, Prasad Raghavendra, David Steurer, and Yuan Zhou. Find- ing Almost-Perfect Graph Bisections. In Proceedings of the 2nd Symposium on Innovations in Com- puter Science, ICS '11, pages 321 -- 337, 2011. 1, 2 [17] Gregory Gutin, Eun Jung Kim, Stefan Szeider, and Anders Yeo. A probabilistic approach to problems parameterized above or below tight bounds. In Parameterized and Exact Computation, 4th Inter- national Workshop, IWPEC 2009, Copenhagen, Denmark, September 10-11, 2009, Revised Selected Papers, pages 234 -- 245, 2009. 3 [18] Gregory Gutin, Eun Jung Kim, Stefan Szeider, and Anders Yeo. A Probabilistic Approach to Problems Parameterized Above or Below Tight Bounds. J. Comput. Syst. Sci., 77(2):422 -- 429, March 2011. 1 [19] Gregory Gutin and Anders Yeo. Note on maximal bisection above tight lower bound. Inf. Process. Lett., 110(21):966 -- 969, 2010. 2 [20] Eran Halperin and Uri Zwick. A Unified Framework for Obtaining Improved Approximation Algo- rithms for Maximum Graph Bisection Problems. Random Struct. Algorithms, 20(3):382 -- 402, May 2002. 1 [21] Johan Hastad. Some optimal inapproximability results. J. ACM, 48(4):798 -- 859, 2001. 1 [22] J. Kahn, G. Kalai, and N. Linial. The Influence of Variables on Boolean Functions. In Proceedings of the 29th Annual Symposium on Foundations of Computer Science, FOCS '88, pages 68 -- 80, 1988. 3 [23] Subhash Khot. On the Power of Unique 2-prover 1-round Games. In Proceedings of the 34th Annual ACM Symposium on Theory of Computing, STOC '02, pages 767 -- 775, New York, NY, USA, 2002. ACM. 1, 2 [24] Subhash Khot, Madhur Tulsiani, and Pratik Worah. A characterization of strong approximation resis- tance. In Proceedings of the 46th ACM STOC, pages 634 -- 643, 2014. 1 35 [25] Tzong-Yau Lee and Horng-Tzer Yau. Logarithmic Sobolev inequality for some models of random walks. Ann. Prob., 26(4):1855 -- 1873, 1998. 3 [26] Konstantin Makarychev, Yury Makarychev, and Yuan Zhou. Satisfiability of Ordering CSPs Above Average Is Fixed-Parameter Tractable. In Proceedings of the 56th Annual IEEE Symposium on Foun- dations of Computer Science, FOCS '15, pages 975 -- 993, 2015. 1, 3 [27] Matthias Mnich and Rico Zenklusen. Bisections above tight lower bounds. In the 38th International Workshop on Graph-Theoretic Concepts in Computer Science, WG '12, pages 184 -- 193, 2012. 2 [28] Elchanan Mossel, Ryan O'Donnell, and Krzysztof Oleszkiewicz. Noise stability of functions with In Proceedings of the 46th Annual IEEE Symposium on low influences: invariance and optimality. Foundations of Computer Science, FOCS '05, pages 21 -- 30, 2005. 3, 6 [29] Elchanan Mossel, Ryan O'Donnell, and Krzysztof Oleszkiewicz. Noise stability of functions with low influences: invariance and optimality. Annals of Mathematics, 171(1):295 -- 341, 2010. 3 [30] Ryan O'Donnell. Analysis of Boolean Functions. Cambridge University Press, 2014. 3, 4, 7 [31] Prasad Raghavendra and David Steurer. Graph expansion and the unique games conjecture. In Pro- ceedings of the 42nd ACM STOC, pages 755 -- 764, 2010. 1, 2 [32] Prasad Raghavendra, David Steurer, and Prasad Tetali. Approximations for the isoperimetric and spectral profile of graphs and related parameters. In Proceedings of the 42nd ACM STOC, pages 631 -- 640, 2010. 1 [33] Prasad Raghavendra, David Steurer, and Madhur Tulsiani. Reductions between expansion problems. In Proceedings of the 27th Conference on Computational Complexity, pages 64 -- 73, 2012. 1 [34] Prasad Raghavendra and Ning Tan. Approximating CSPs with global cardinality constraints using SDP hierarchies. In Proceedings of the 23rd Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '12, pages 373 -- 387, 2012. 1, 2 [35] Yinyu Ye. A .699-approximation algorithm for Max-Bisection. Math. Program., 90(1):101 -- 111, 2001. 1 36
1606.04978
1
1606
2016-06-15T20:54:04
Distance geometry approach for special graph coloring problems
[ "cs.DS" ]
One of the most important combinatorial optimization problems is graph coloring. There are several variations of this problem involving additional constraints either on vertices or edges. They constitute models for real applications, such as channel assignment in mobile wireless networks. In this work, we consider some coloring problems involving distance constraints as weighted edges, modeling them as distance geometry problems. Thus, the vertices of the graph are considered as embedded on the real line and the coloring is treated as an assignment of positive integers to the vertices, while the distances correspond to line segments, where the goal is to find a feasible intersection of them. We formulate different such coloring problems and show feasibility conditions for some problems. We also propose implicit enumeration methods for some of the optimization problems based on branch-and-prune methods proposed for distance geometry problems in the literature. An empirical analysis was undertaken, considering equality and inequality constraints, uniform and arbitrary set of distances, and the performance of each variant of the method considering the handling and propagation of the set of distances involved.
cs.DS
cs
Distance geometry approach for special graph coloring problems Rosiane de Freitasa, Bruno Diasa, Nelson Maculanb, and Jayme Szwarcfiterb aInstituto de Computa¸cao, Universidade Federal do Amazonas, Av. Rodrigo Ot´avio 3000, 69000-000, Manaus, bCOPPE, Universidade Federal do Rio de Janeiro, C.P. 68530, 21945-970, Rio de Janeiro, Brazil E-mail: [email protected] [deFreitas]; [email protected] [Dias]; [email protected] [Maculan]; [email protected] [Szwarcfiter] Brazil Abstract One of the most important combinatorial optimization problems is graph coloring. There are several variations of this problem involving additional constraints either on vertices or edges. They constitute models for real applications, such as channel assignment in mobile wireless networks. In this work, we consider some coloring problems involving distance constraints as weighted edges, modeling them as distance geometry problems. Thus, the vertices of the graph are considered as embedded on the real line and the coloring is treated as an assignment of positive integers to the vertices, while the distances correspond to line segments, where the goal is to find a feasible intersection of them. We formulate different such coloring problems and show feasibility conditions for some problems. We also propose implicit enumeration methods for some of the optimization problems based on branch-and-prune methods proposed for distance geometry problems in the literature. An empirical analysis was undertaken, considering equality and inequality constraints, uniform and arbitrary set of distances, and the performance of each variant of the method consid- ering the handling and propagation of the set of distances involved. Keywords: branch-and-prune; channel assignment; constraint propagation; graph theory; T-coloring. 1 Introduction Let G = (V, E) be an undirected graph. A k-coloring of G is an assignment of colors {1, 2, . . . , k} to the vertices of G so that no two adjacent vertices share the same color. The chromatic number χG of a graph is the minimum value of k for which G is k-colorable. The classic graph coloring problem, which consists in finding the chromatic number of a graph, is one of the most important combinatorial optimization problems and it is known to be NP-hard (Karp, 1972). There are several versions of this classic vertex coloring problem, involving additional constraints, in both edges as vertices of the graph, with a number of practical applications as well as theoretical challenges. One of the main applications of such problems consists of assigning channels to transmitters in a mobile wireless network. Each transmitter is responsible for the calls made in the area it covers and the communication among devices is made through a channel consisting of a discrete slice of the electromagnetic spectrum. However, the channels cannot be assigned to calls in an arbitrary way, since there is the problem of interference among devices located near each other using approximate channels. There are three main types of interferences: co-channel, among calls of two transmitters using the same channels; adjacent channel, among calls of two transmitters using adjacent channels and co-site, among calls on the same cell that do not respect a minimal separation. It is necessary to assign channels to the calls such that interference is avoided and the spectrum usage is minimized (Audhya et al., 2011; Koster and Munhoz, 2010; Koster, 1999). Thus, the channel assignment scenario is modeled as a graph coloring problem by considering each transmitter as a vertex in a undirected graph and the channels to be assigned as the colors that the vertices will receive. Some more general graph coloring problems were proposed in the literature in order to take the separation among channels into account, such as the T-coloring problem, also known as the Generalized Coloring Problem (GCP) where, for each edge, the absolute difference between 1 Figure 1: Example of channel assignment with distance constraints, where the separation is given by the weight in each edge. The image on the right shows the network as an undirected graph and the projection of vertices on the real number line, but considering only natural numbers. colors assigned to each vertex must not be in a given forbidden set (Hale, 1980). The Bandwidth Coloring Problem, a special case of T-coloring where the absolute difference between colors assigned to each vertex must be greater or equal a certain value (Malaguti and Toth, 2010), and the coloring problem with restrictions of adjacent colors (COLRAC), where there is a restriction graph for which adjacent colors in it cannot be assigned to adjacent vertices (Akihiro et al., 2002). The separation among channels is a type of distance constraint, so we can see the channel assign- ment as a type of distance geometry (DG) problem (Liberti et al., 2014) since we have to place the channels in the transmitters respecting some distances imposed in the edges, as can be seen in Figure 1. One method to solve DG problems is the branch-and-prune approach proposed by Lavor et al. (2012a,b), where a solution is built and if at some point a distance constraint is violated, then we stop this construction (prune) and try another option for the current solution in the search space. See also: Mucherino et al. (2013); Lavor et al. (2012a); Freitas et al. (2014a,b); Dias (2014); Dias et al. (2013, 2012). For graph theoretic concepts and terminology, see the book by Bondy and Murty (2008). The main contribution of this paper consists of a distance geometry approach for special cases of T-coloring problems with distance constraints, involving a study of graph classes for which some of these distance coloring problems are unfeasible, and branch-prune-and-bound algorithms, combining concepts from the branch-and-bound method and constraint propagation, for the considered problems. The remainder of this paper is organized as follows. Section 2 defines the distance geometry models for some special graph coloring problems. Section 3 shows some properties regarding the structure of those distance geometry graph coloring problems, including the determination of feasibility for some graphs classes. Section 4 formulates the branch-prune-and-bound (BPB) algorithms proposed for the problems and shows properties regarding optimality results. Section 5 shows results of some experiments done with the BPB algorithms using randomly generated graphs for each proposed model. Finally, Section 6 concludes the paper and states the next steps for ongoing research. 2 Distance geometry and graph colorings We propose an approach in distance geometry for special vertex coloring problems with distance constraints, based on the Discretizable Molecular Distance Geometry Problem (DMDGP), which is a special case of the Molecular Distance Geometry Problem, where the set V of vertices from the input graph G are ordered such that the set E of edges contain all cliques on quadruplets of consecutive vertices, that is, any four consecutive vertices induce a complete graph (∀i ∈ {4, . . . , n} ∀j, k ∈ {i − 3, . . . , i} ({j, k} ∈ E)) (Lavor et al., 2012a). Furthermore, a strict triangular inequality holds on weights of edges between consecutive vertices in such ordering (∀i ∈ {2, . . . , n − 1} di−1,i+1 < di−1,i + di,i+1). All coordinates are given in R3 space. The position for a point i (where i ≥ 4) can be 2 123544132512431Channel ofstation 1 = 5Channel ofstation 2 = 1Channel ofstation 3 = 6Channel ofstation 4 = 2Channel ofstation 5 = 314325Color forvertex 1 = 5Color forvertex 3 = 6Color forvertex 4 = 24541113322Color forvertex 2 = 1Color forvertex 5 = 312345(ℕ ⊂ ℝ)ℝ16 Figure 2: Some types of n-spheres. A (n − 1)-sphere is a projection of a n-sphere on a lower dimension. Figure 3: Example from Figure 1 using 0-spheres (line segments). determined using the positions of the previous three points i − 1, i − 2 and i − 3 by intersecting three spheres with radii di−3,i, di−2,i and di−1,i, obtaining two possible points that are checked for feasibility. A similar reasoning can be used in vertex coloring problems with distance constraints, where the distances that must be respected involve the absolute difference between two values x(i) and x(j) (respectively, the color points attributed to i and j), but for these problems the space considered is actually unidimensional. The positioning of a vertex i can be determined by using a neighbor j that is already positioned. Thus, we have a 0-sphere, consisting of a projection of a 1-sphere (a circle), which itself is a projection of a 2-sphere (the three-dimensional sphere), as shown in Figure 2. The 0-sphere is a line segment with a radius di,j, and feasible colorings consist of treating the intersections of these 0-spheres. Figure 3 exemplifies the correlations between these types of spheres and shows the example from Figure 1 as the positioning of these line segments. In this work we focus on problems with exact distances between colors, and also in the analysis of different types of BPB algorithms and integer programming models. Based on DMDGP, which is a decision problem involving equality distance constraints, the basic distance graph coloring model we consider also involves equality constraints between colors of two neighbor vertices i and j. That is, the absolute difference between them must be exactly equal to an arbitrary weight imposed on the edge (i, j), and the solution candidate must satisfy all given constraints. We can formally define as follows. Given a graph G = (V, E), we define di,j as a positive integer weight associated to an edge (i, j) ∈ E(G). In distance coloring, for each vertex i, a color must be determined for it (denoted by x(i)) such that the constraints imposed on the edges between i and its neighbors are satisfied. A variation of the classic graph coloring problem consists in finding the minimum span of G, that is, in determining that the maximum x(i), or color used, be the minimum possible. Based on these preliminary definitions, we describe the following distance geometry vertex coloring problems. 3 2-sphere (ℝ3)1-sphere (ℝ2)0-sphere (ℝ1)14325Color forvertex 1 = 5Color forvertex 3 = 6Colorforvertex4=24541113322Color forvertex 2 = 1Color forvertex 5 = 312345(ℕ ⊂ ℝ)ℝ1612345(ℕ ⊂ ℝ)ℝ16(2,5) = 2(5,3) = 3(2,4) = 1(4,1) = 3(4,5) = 1(2,3) = 5(5,1) = 2(1,3) = 1(2,1) = 4(4,3) = 4 Figure 4: Specific order of 0-spheres that leads to the optimal solution for Figure 1. Definition 1. Coloring Distance Geometry Problem (CDGP): Given a simple weighted undi- rected graph G = (V, E), where, for each (i, j) ∈ E, there is a weight di,j ∈ N, find an embedding x : V → N (that is, an embedding of G on the real number line, but considering only the natural number points) such that x(i) − x(j) = di,j for each (i, j) ∈ E. CDGP involves equality constraints, and thus is named as Equal Coloring Distance Geometry Problem and labeled as EQ-CDGP. A solution for this problem consists of a tree, whose vertices are colored with colors that respect the equality constraints involving the weighted edges (see Figure 4). Since CDGP (or EQ-CDGP) is a decision problem, only a feasible solution is required. This problem is NP-complete, as shown below. Theorem 1. EQ-CDGP is NP-complete. Proof. To prove that EQ-CDGP ∈ NP-complete, we must show that EQ-CDGP ∈ NP and EQ-CDGP ∈ NP-hard. 1. EQ-CDGP ∈ NP. Given, for a graph G = (V, E), an embedding x : V → N, its feasibility can be checked by taking each edge (i, j) ∈ E and examining if its endpoints do not violate the corresponding distance constraint, that is, if x(i) − x(j) = di,j. If all distance constraints are valid, then x is a certificate for a positive answer to the EQ-CDGP instance, meaning that a certificate for a YES answer can be verified in O(E) time, which is linear. Thus, EQ-CDGP ∈ NP. 2. EQ-CDGP ∈ NP-hard. Since EQ-CDGP is equivalent to 1-Embeddability with integer weights, which is NP-hard (Saxe, 1979), we can use the same proof for the latter problem to show that EQ-CDGP is also NP-hard. The proof is made by reducing the Partition problem, which is known to be NP-complete (Garey and Johnson, 1979) to EQ-CDGP. Consider a Partition instance, consisting of a set I of r integers, that is, M = {m1, m2, . . . , mr}. Let G be a weighted graph G = (V, E), where G is a cycle such that V = E = r and, for each edge (i, j), its weight is a natural number denoted by di,j. This graph is constructed from M by considering: • V = {i0, i1, . . . , ir−1}. • E = {(ib, ib+1 mod r) 0 ≤ b ≤ r}. • dib,ib+1 mod r = mb (∀0 ≤ b ≤ r). Now, let x : V → N be an embedding of the vertices on the number line. If it is a valid embedding, then we can define two sets: • S1 = {mb x(ib) < x(ib+1 mod r)}. 4 14325Color forvertex 1 = 5Color forvertex 3 = 6Color forvertex 4 = 251133Color forvertex 2 = 1Color forvertex 5 = 3(2,4) = 1(4,5) = 1(4,1) = 3(2,3) = 5Vertex order: 2 → 4 → 5 → 1 → 3 (a) Instance with a YES solution. (b) Instance with a NO solution. Figure 5: Partition instances and corresponding transformations to EQ-CDGP. • S2 = {mb x(ib) > x(ib+1 mod r)}. We have that S1 and S2 are disjoint subsets of M (that is, they form a partition of M ) where the sum of all S1 elements is equal to the sum of all S2 elements, that is, if the cyclic graph constructed from G admits an embedding on the line (which means that its solution to EQ-CDGP is YES), then M has a YES solution for Partition and vice-versa. This reduction can be made in O(r) time, thus, EQ-CDGP ∈ NP-hard. To illustrate the reasoning from Theorem 1, let M be an instance of Partition such that M = {1, 4, 5, 6, 7, 9}. Figure 5 shows its corresponding EQ-CDGP solution. Since most graph coloring problems in the literature and in real world applications are optimization problems, we define an optimization version of this basic distance geometry graph coloring problem, as shown below. Definition 2. Minimum Equal Coloring Distance Geometry Problem (MinEQ-CDGP): Given a simple weighted undirected graph G = (V, E), where, for each (i, j) ∈ E, there is a weight di,j ∈ N, find an embedding x : V → N such that x(i) − x(j) = di,j for each (i, j) ∈ E whose span S, defined as S = maxi∈V x(i), that is, the maximum used color, is the minimum possible. Figure 6 shows an example of this model and its corresponding 0-sphere visualization. 5 x(5) = 1034x(3)=2125= 1x(0) = 10x(1) = 11x(2) = 7x(4) = 8M = {1, 4, 5, 6, 7, 9}S1 = {1, 6, 9} S2 = {4, 5, 7}Sum(S2) = Sum(S1) = 16x(0) < x(1)m1 → S1x(1) > x(2)m2 → S2x(2) > x(3)m3 → S2x(3) < x(4)m4 → S1x(4) > x(5)m5 → S2x(5) < x(0)m6→S1= 4= 5= 6= 7= 9034x(3) = 4125= 2x(0) = 10x(1) = 12x(2) = 9x(4) = 10M = {2, 3, 5, 6, 7, 10}S1 = {2, 4} S2 = {3, 5}7 and 10 → undefined Infeasible for Partitionx(0) < x(1)m1 → S1x(1) > x(2)m2 → S2x(2) > x(3)m3 → S2x(3) < x(4)m4 → S1??Cannot beembeddedx(5) = ?= 3= 5= 6= 7= 10 Figure 6: MinEQ-CDGP instance with solution and its 0-sphere representation. On the other hand, instead of equalities, we can consider inequalities, such that the weight di,j on an edge (i, j) is actually a lower bound for the distance to be respected between the color points x(i) and x(j), that is, x(i) − x(j) ≥ dij. Thus, we can modify MinEQ-CDGP to deal with this scenario, which becomes the following model. Definition 3. Minimum Greater than or Equal Coloring Distance Geometry Problem (MinGEQ-CDGP): Given a simple weighted undirected graph G = (V, E), where, for each (i, j) ∈ E, there is a weight di,j ∈ N, find an embedding x : V → N such that x(i)−x(j) ≥ di,j for each (i, j) ∈ E whose span (max i∈V x(i)) is the minimum possible. MinGEQ-CDGP is equivalent to the bandwidth coloring problem (BCP) (Malaguti and Toth, 2010), which itself is equivalent to the minimum span frequency assignment problem (MS-FAP) (Koster, 1999; Audhya et al., 2011). Figure 6 In Figure 7, this model, along with its 0-sphere representation, is exemplified. Figure 7: MinGEQ-CDGP instance with solution and its 0-sphere representation. 2.1 Special cases For the models previously stated, we can identify some specific scenarios for which additional properties can be identified. The first special case is for EQ-CDGP, the decision distance coloring problem, where all distances are the same, that is, the input is a graph with uniform edge weights, as stated below. Definition 4. Coloring Distance Geometry Problem with Uniform Distances (EQ-CDGP- Unif ): Given a simple weighted undirected graph G = (V, E), and a nonnegative integer ϕ, find an embedding x : V → N such that x(i) − x(j) = ϕ for each (i, j) ∈ E. For the optimization version, we can also define this special case, as shown below. Definition 5. Minimum Equal Coloring Distance Geometry Problem with Uniform Dis- tances (MinEQ-CDGP-Unif ): Given a simple weighted undirected graph G = (V, E), and a 6 x(1) = 1135= 3= 1x(3) = 2x(5) = 3x(6) = 1= 2x(2) = 32= 1= 2= 34x(4) = 461234(ℕ ⊂ ℝ)ℝ1(1,2) = 2(1,4) = 3(3,4) = 2(6,4) = 3(3,2) = 1(5,4) = 1x(1) = 114x(4) = 43x(2) = 425≥ 1≥ 3≥ 2≥ 2≥ 3≥ 2x(3) = 1x(5) = 2x(6) = 261234(ℕ ⊂ ℝ)ℝ1(3,2) = 3(1,4) = 3(5,4) = 2(1,2) = 3(3,4) = 3(6,4) = 2 nonnegative integer ϕ, find an embedding x : V → N such that x(i) − x(j) = ϕ for each (i, j) ∈ E whose span (maxi∈V x(i)) is the minimum possible. In this model, an input graph can be defined by its sets of vertices and edges and the ϕ value, instead of a set of weights for each edge. A similar special case exists for MinGEQ-CDGP, as stated in the following definition. Definition 6. Minimum Greater than or Equal Coloring Distance Geometry Problem with Uniform Distances (MinGEQ-CDGP-Unif ): Given a simple weighted undirected graph G = (V, E), and a nonnegative integer ϕ, find an embedding x : V → N such that x(i)− x(j) ≥ ϕ for each (i, j) ∈ E whose span (maxi∈V x(i)) is the minimum possible. When ϕ = 1, MinGEQ-CDGP-Unif is equivalent to the classic graph coloring problem (Figure 8). A summary of all distance coloring models, including special cases, is given in Table 1. Table 1: Summary of distance coloring models. Problem Constraint type EQ-CDGP and MinEQ-CDGP ∀(i, j) ∈ E, x(i)−x(j) = di,j ∀(i, j) ∈ E, x(i)−x(j) ≥ di,j EQ-CDGP-Unif and MinEQ-CDGP-Unif ∀(i, j) ∈ E, x(i)−x(j) = di,j MinGEQ-CDGP MinGEQ-CDGP-Unif ∀(i, j) ∈ E, x(i)−x(j) ≥ di,j Distance type ∀(i, j) ∈ E, di,j ∈ N ∀(i, j) ∈ E, di,j ∈ N ∀(i, j) ∈ E, di,j = ϕ ∀(i, j) ∈ E, di,j = ϕ (ϕ ∈ N) (ϕ ∈ N) (a) MinEQ-CDGP-Unif. (b) MinGEQ-CDGP-Unif. Figure 8: Examples of instances for the special cases of distance coloring models with constant edge weights and feasible solutions for them. 3 Feasibility conditions of distance graph coloring problems In this section, we discuss feasibility conditions related to our proposed EQ-CDGP problems. Clearly, the problems involving inequality constraints are always feasible. This is the case for the MinGEQ-CDGP and MinGEQ-CDGP problems (and the special cases with uniform distances, MinGEQ- CDGP-Unif and MinGEQ-CDGP-Unif). However, this is not so for versions that involve only equality constraints, EQ-CDGP and its special case with uniform distances, the EQ-CDGP-Unif problem. 3.1 Feasibility conditions for EQ-CDGP-Unif Graphs that admit a solution for the EQ-CDGP-Unif problem are characterized by the following theorem. Theorem 2. A graph G has solution YES for EQ-CDGP-Unif problem if and only if G is bipartite. 7 x(1) = 1143x(2) = 3256= 2= 2= 2= 2= 2= 2x(6) = 1x(4) = 3x(3) = 1x(5) = 1x(1) = 114x(4) = 23x(2) = 2256≥ 1≥ 1≥ 1≥ 1≥ 1≥ 1x(3) = 1x(5) = 1x(6) = 1 Proof. Let G be a graph, input to a EQ-CDGP-Unif problem, where for each edge vivj of G, the distance required is dij = ϕ, ϕ ∈ N, constant. Suppose G has a YES solution for the problem such that x : V → N is a certificate for that solution. Let x(i) be the color assigned to vi ∈ V . Choose an arbitrary path v1, v2, ..., vk of G, not necessarily simple. Then x(i) − x(j) = ϕ, for i − j = 1. The latter implies x(i) = x(i + 2), i = 1, 2, ..., k − 2. Consequently, if the path contains the same vector vi twice, their corresponding indices are the same. That is, all edges of G are necessarily even, and G is bipartite. Conversely, if G is bipartite, its vertices admit a proper coloring with two distinct colors. Assign the value x(i) to the vertices of the first color, and the value ϕ+1 to the second one. Then x(i)−x(j) = ϕ, for each edge vivj of G, and EQ-CDGP-Unif has a YES solution. As an alternative way of proving that if a graph is bipartite then it has a YES solution for EQ-CDGP, observe that, since the input graph is bipartite, it is also 2-colorable (considering the classic graph coloring problem), that is, the entire graph can be colored using only two different colors, which can be determined by considering a single edge from the graph. All edges (i, j) have the same distance constraint, that is, x(i) − x(j) = ϕ, so the two colors that will be used are {1, 1+ϕ}, which form the solution for the EQ-CDGP-Unif instance. In order to prove the converse statement, that is, if a graph has a YES solution for EQ-CDGP, it is bipartite, we will use a proof by contrapositive, which states that if a graph is not bipartite, then it has a NO solution for EQ-CDGP. This will be done by mathematical induction on odd cycles, since a graph is not bipartite if, and only if, it contains an odd cycle. Let V = 2z + 1. The proof will be by induction on z (the number of vertices). Base case: z = 1. We have the cycle C3, with three vertices (V = {1, 2, 3}) and three edges ({(1, 2), (1, 3), (2, 3)}), with x(i) − x(j) = ϕ for all of them. Without loss of generality, let x(1) = 1 and x(2) = 1 + ϕ. Then we have that: • Since (1, 3) ∈ E and x(1) = 1, then x(3) − 1 = ϕ. All colors must be positive integers, so x(3) = 1 + ϕ. • Since (2, 3) ∈ E and x(2) = 1 + ϕ, then x(3) − (1 + ϕ) = ϕ ⇒ x(3) − 1 − ϕ = ϕ. By this inequation, x(3) = 1 or x(3) = 1 + 2ϕ. From this result, we have that x(3) = 1 + ϕ and (x(3) = 1 or x(3) = 1 + 2ϕ) at the same time, which is impossible. Then C3 has a NO solution for EQ-CDGP, as seen in Figure 9. Induction hypothesis: The cycle C2z+1 has a NO solution for EQ-CDGP. Inductive step: By the inductive hypothesis, the cycle C2z+1 is infeasible for EQ-CDGP. If we consider the cycle C2(z+1)+1 = C2z+3, we have that the size of the cycle increases by two vertices, but it will still be an odd cycle. If we add only one vertex, that is, we consider the cycle C2z+1+1 = C2z+2, we will have an even cycle. Since all even cycles are bipartite, they are feasible in EQ-CDGP according to Theorem 2. Now, consider that another vertex is added to C2z+2, becoming C2z+3. Without loss of generality, consider that the new vertex 2z + 3 is adjacent to vertices 2z + 2 and 1, that is, we have {(2z + 2, 2z + 3), (2z + 3, 1)} ⊆ E, and x(2z + 2) = 1 + ϕ and x(1) = 1 (these colors can be seen as having been assigned when we added only one vertex, generating an even cycle). Then we have that: • Since (2z + 2, 2z + 3) ∈ E and x(2z + 2) = 1 + ϕ, then x(2z + 3) − (1 + ϕ) = ϕ ⇒ x(2z + 3) − 1 − ϕ = ϕ. By this inequation, x(2z + 3) = 1 or x(2z + 3) = 1 + 2ϕ. • Since (2z + 3, 1) ∈ E and x(1) = 1, then x(2z + 3)− 1 = ϕ. All colors must be positive integers, so x(2z + 3) = 1 + ϕ. From this result, we have that x(2z + 3) = 1 + ϕ and (x(2z + 3) = 1 or x(2z + 3) = 1 + 2ϕ) at the same time, which is impossible. Therefore C2z+3 has a NO solution for EQ-CDGP, as can be seen in Figure 10. 8 Figure 9: C3 graph that has a NO solution for EQ-CDGP-Const when all distances are the same. Figure 10: Odd cycle C2z+3 that has a NO solution for EQ-CDGP-Const when all distances are the same. As a complementary result, graphs which have odd-length cycles as induced subgraphs will always have a NO solution for EQ-CDGP-Unif, because a graph is bipartite if, and only if, it contains no odd-length cycles. Since the recognition of bipartite graphs can be done in linear time using a graph search algorithm such as depth-first search (DFS), the EQ-CDGP-Unif problem can be solved in linear time. 3.2 Feasibility conditions for EQ-CDGP Clearly, Theorem 2 does not apply when the distances are arbitrarily defined. Depending on the edge weights, bipartite graphs may have NO solutions for EQ-CDGP, and graphs which include odd- length cycles may have YES solutions. Figure 11 shows examples of instances considering each case. However, this decision problem can be easily solved for trees, as shown below. Theorem 3. Let G = (V, E, d), be a tree, where ∀(i, j) ∈ E di,j is an arbitrary positive integer. Then G always has a YES solution for EQ-CDGP. Proof. We describe a simple algorithm for assigning colors that satisfy the EQ-CDGP problem. Initially unmark all vertices. Choose an arbitrary vertex vi, assign any positive integer value x(vi) to vi, and mark vi. Iteratively, choose an unmarked vertex vj, adjacent to some marked vertex vk. Assign the value x(vj) = djk + x(vj) and mark vj. Repeat the iteration until all vertices become marked. The algorithm described in Theorem 3 has linear time complexity. It is important to note that when this procedure is applied to a MinEQ-CDGP instance, that is, the optimization problem with equality constraints, it only guarantees that a feasible solution is found for a tree, not the optimal one. 4 Algorithmic techniques and methods to solve EQ-CDGP models In this section, we show some algorithmic strategies to solve our distance geometry graph coloring models, and discuss some algorithmic strategies considering the EQ-CDGP models proposed in the previous section. 4.1 Branch-prune-and-bound methods For solving the three distance geometry graph coloring models shown in Section 2, we developed three algorithms that combine concepts from constraint propagation and optimization techniques. 9 = φ111+φ2= φ= φ3Cannot becolored111+φ22z+3131+φ42z+2=φ=φ=φ=φTo becolored (a) Bipartite graphs. (b) Graphs with odd-length cycles. Figure 11: Examples of instances for the special cases of distance coloring models with constant edge weights and feasible solutions for them. A branch-and-prune (BP) algorithm was proposed by Lavor et al. (2012a) for the Discretizable Molecular Distance Geometry Problem (DMDGP), based on a previous version for the MDGP by Liberti et al. (2008). The algorithm proceeds by enumerating possible positions for the vertices that must be located in three-dimensional space (R3), by manipulating the set of available distances. The position for a vertex i, where i ∈ [4, n] and n is the number of vertices that must be placed in R3, is determined with respect to the last three vertices that have already been positioned, following the ordering and sphere intersection cited in Section 2. However, a distance between the currently positioned vertex and a previous one that was placed before the last three can be violated, which requires feasibility tests to guarantee that the solution being built is valid. The authors applied the Direct Distance Feasibility (DDF) pruning test, where ∀(i, j) ∈ E x(i)− x(j)− di,j < , and where  is a given tolerance. In this work, we adapted these concepts to study and solve our proposed distance geometry coloring models. One of the first reflections that can be made is that for the distance geometry coloring models, there are no initial assumptions to be respected, and thus, there is no explicit vertex ordering to be considered, so we build the ordering by an implicit enumerating process. We mix concepts from branch- and-prune for DMDGP and branch-and-bound procedures to obtain partial solutions (sequences of vertices that have already been colored) that cannot improve on the current best solution. Our branch-prune-and-bound (BPB) method works as follows. First, a vertex i that has not been colored yet is selected as a starting point. This vertex receives the color 1, which is the lowest available (since all colors are positive integers). Then a neighbor j of i that has not been colored yet is selected. A color selection algorithm is used for setting a color to j and the process is repeated recursively for neighbors of j that have not been colored yet. When an uncolored neighbor of the current vertex cannot be found, a uncolored vertex of the graph is used. Pseudocode for this general procedure is given in Algorithm 1. We propose different strategies for selecting a color for a vertex and illustrate how the feasibility checking can be done in different levels of the procedure. Each of these cases are discussed below. Color selection for a vertex There are two possibilities for determining which colors a vertex can use, determined by the call to SelectColors()), which returns a set of possible colors for a vertex. 10 x(1) = 113x(3) = 2= 2x(2) = 32= 1= 2= 34x(4) = 4x(1) = 113x(3) = 3= 3x(2) = 42= 1= 3= 24Cannot becoloredx(1) = 113x(2) = 22Cannot becolored= 1= 3= 1x(3) = 113x(1) = 22= 1= 1x(2) = 3= 2 Algorithm 1 Branch-prune-and-bound general algorithm. Require: graph G (with set V of vertices and set E of edges), function d : E → N of distances for each edge, previous vertex i, current vertex j to be colored, current partial coloring x, best complete coloring found xbest, upper bound ub, array pred of predecessors from each vertex (initially all set to -1) and enumeration tree depth dpt. predec[k] ← i for each neighbor k of j do if predec[k] = −1 then 1: function Branch-Prune-And-Bound(G = (V, E), d, i, j, x, xbest, ub, pred, dpt) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: if i = −1 then i ← predec[j] colorsAvail ← SelectColors(G, d, i, j, x, ub) while colorsAvail (cid:54)= ∅ do color ← element of colorsAvail colorsAvail ← colorsAvail − {color} x(j) ← color max if x(v) ≥ ub then (cid:46) Set current vertex as predecessor of neighbors (cid:46) If this call did not come from a neighbor, use predecessor information v∈V v is colored Remove color from i continue (cid:46) Discard this possible partial solution by bounding if FeasibilityTest(G, d, f, x, i) = false then Remove color from i return if dpt = V then if max v∈V xbest ← x ub ← max v∈V x(v) x(v) < max v∈V xbest(v) then (cid:46) Distance violation, discard partial solution by pruning (cid:46) If true, then all vertices are colored else hasN eighbor ← false for each neighbor k of j do if k is not colored then hasN eighbor ← true Branch-Prune-And-Bound(G, d, f, j, k, x, xbest, ub, dpt + 1) if hasN eighbor = false then for each vertex k of G such that predec[k] (cid:54)= −1 do (cid:46) Only from vertices with predecessors if k is not colored then Branch-Prune-And-Bound(G, d, f,−1, k, x, xbest, ub, dpt + 1) Remove color from i return xbest 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: The first one, denoted by BPB-Prev, is based on the original BP algorithm by Lavor et al. (2012a). When a vertex i has to be colored, the single previously colored vertex j is taken into account. If j is an invalid vertex, which means that i is not an uncolored neighbor of j, then the only color that i can receive is 1. Otherwise, the function returns a set of cardinality at most 2, whose elements are: 1. x(j) + di,j. 2. x(j) − di,j (returned only if x(j) > di,j). This means that this criterion uses only information from the previous vertex to determine colors, which makes the BPB that uses it an inexact algorithm, something that the original BP for DMDGP also is (Lavor et al., 2012a). However, to counter this in our BPB, when a vertex is colored, its neighbors are marked so that they can use the current vertex as a predecessor in case the search restarts from one of such neighbors. Since we assume the input graph is connected and the algorithm essentially walks through the graph, this information helps to find the true optimal solution. This procedure is done in O(1) time, since only two arithmetic operations are made to determine the colors. An example of this color selection possibility is given in Figure 12. When using this criterion, we apply the feasibility checking at each colored vertex. However, an alternative is to prune only infeasible solutions where all vertices have colors, that is, we apply the 11 Figure 12: Partial enumeration of solutions starting from vertex 2 for the MinEQ-CDGP instance defined by Figures 1 and 2 using BPB-Prev, with color selection based only on the previous vertex and feasibility checking at each partial solution. feasibility test only at the last level of the enumeration tree. An example of this alternative is shown in Figure 13, where it is possible to see that this strategy makes the tree grow very large. The second selection criterion is undertaken using information from all colored neighbors to deter- mine the color for the current vertex i. This is done by solving a system of absolute value inequalities (or equalities, in the case of MinEQ). Those inequalities arise from the distance constraints for the edges. Let i be the vertex that must be colored. The color x(i) must be the solution of a system of absolute value (in)equalities where there is one for each colored neighbor j and each one is as follows: x(j) − x(i) OP di,j Where OP is either "=" (for MinEQ-CDGP type problems) or "≥" (for MinGEQ-CDGP type prob- lems). The color that will be assigned to j is the smallest value that satisfies all (in)equalities. We note that this procedure always returns a set of cardinality 1, that is, only one color (since only the lowest index is returned) which is also feasible for the partial solution and eventually leads to the optimal solution, although it requires more work per vertex. This selection strategy runs in O(ub) time, where ub is an upper bound for the span, since, to solve the system, we have to mark each possible solution in the interval [1, ub] and select the smallest value. Figure 14 shows an example of an enumeration tree using this color selection strategy. Feasibility checking When building a partial solution we must verify if it is feasible when not all distances are taken into account at the same time, especially on BPB-Prev. We used a similar feasibility test to the Direct Distance Feasibility (DDF) used on the BP algorithm for the DMDGP. Let i be the vertex that has just been colored. Then we must check, for each neighbor j that has already been colored, if the condition x(i) − x(j) ≥ di,j (if f ((i, j)) = 0) or x(i) − x(j) = di,j (if f ((i, j)) = 1). This test can be seen as a variation of DDF setting  to zero and allowing inequalities in the test. We denote this procedure as Direct Distance Coloring Feasibility (DDCF) and its pseudocode 12 Vertex 2Color 1Vertex 1Color 5Vertex 1Color -34+-Vertex 3Color 6Vertex 4Color 101+4+Pruned x(4) - x(1) = 3 10 - 5 = 35 = 3 --> FalseVertex 4Color 2-Vertex 5Color 31+Vertex 5Color 1-x(1) = 5 / x(2) = 1x(3) = 6 / x(4) = 2x(5) = 3Feas. solutionUpper bound = 6BoundedCurrent span = 6Upper bound = 66 < 6 --> FalseVertex 5Color 9+Vertex 5Color 3-3BoundedCurrent span = 9Upper bound = 69 < 6 --> FalseBoundedCurrent span = 6Upper bound = 66 < 6 --> FalseVertex 3Color 4Pruned x(3) - x(2) = 5 4 - 1 = 53 = 5--> FalseStartVertex 1Color 1Vertex 3Color 1Vertex 5Color 1Vertex 4Color 1-. . .. . .. . .. . .. . .Vertex 2Color -34+-Invalid colorVertex 2Color 5Vertex 3Color 0Invalid colorVertex 3Color 105+-Pruned x(3) - x(1) = 1 10 - 5 = 19 = 1 --> FalseInvalid color Figure 13: Partial enumeration of solutions starting from vertex 2 for the MinEQ-CDGP instance defined by Figures 1 and 2 using BPB-Prev-FeasCheckFull with color selection based only on the previous vertex and feasibility checking only when all vertices are colored. The backtracking points are indicated when the solution is pruned. Figure 14: Partial enumeration of solutions starting from vertex 2 for the MinEQ-CDGP instance defined by Figures 1 and 2 using BPB-Select, where a color is determined using a system of absolute value expressions (equalities or inequalities). 13 Vertex 2Color 1Vertex 1Color 5Vertex 1Color -34+-Vertex 3Color 6Vertex 4Color 101+4+Pruned x(4) - x(1) = 3 10 - 5 = 35 = 3 --> FalseVertex 4Color 2-Vertex 5Color 31+Vertex 5Color 1-x(1) = 5 / x(2) = 1x(3) = 6 / x(4) = 2x(5) = 3Feas. solutionUpper bound = 6BoundedCurrent span = 6Upper bound = 66 < 6 --> FalseVertex 5Color 9+Vertex 5Color 3-3BoundedCurrent span = 9Upper bound = 69 < 6 --> FalseBoundedCurrent span = 6Upper bound = 66 < 6 --> FalseVertex 3Color 4StartVertex 1Color 1Vertex 3Color 1Vertex 5Color 1Vertex 4Color 1-. . .. . .. . .. . .Vertex 5Color 31+Vertex 5Color 1-Pruned x(4) - x(1) = 3 10 - 5 = 35 = 3 --> False. . .Vertex 2Color -34+-Invalid colorVertex 2Color 5Vertex 3Color 0Invalid colorVertex 3Color 105+-Vertex 4Color6Vertex 4Color 14+-4Vertex 5Color 13Vertex 5Color 15+-1Pruned x(3) - x(1) = 1 10 - 5 = 19 = 1 --> FalsePruned x(3) - x(1) = 1 10 - 5 = 19 = 1 --> FalseVertex5Color 5Vertex 5Color 7+-1Pruned x(3) - x(1) = 1 10 - 5 = 19 = 1 --> FalsePruned x(3) - x(1) = 1 10 - 5 = 19 = 1 --> False. . .Vertex 4Color 8Vertex 4Color 0BoundedCurrent span = 8Upper bound = 68 < 6 --> False4-+Invalid color. . .Invalid colorVertex 2Color 1Vertex 1Color 5Vertex 3Color 6Vertex 4Color 2Vertex 5Color 3x(1) = 5 / x(2) = 1x(3) = 6 / x(4) = 2x(5) = 3Feas. solutionUpper bound = 6BoundedCurrent span = 6Upper bound = 66 < 6 --> FalseStartVertex 1Color 1Vertex 3Color 1Vertex 5Color 1Vertex 4Color 1. . .. . .. . .. . .. . .Vertex 2Color 5Vertex 3Color -1PrunedNo valid coloravailableVertex 5Color 3. . . is given in Algorithm 2. Algorithm 2 Direct Distance Coloring Feasibility (DDCF) check Require: graph G (with set V of vertices and set E of edges), problem type t (MinGEQ-CDGP or MinEQ-CDGP), matrix d of distances for each edge, current coloring x and vertex i. for each neighbor k of i do if k is colored then 1: function DDCF-Check(G, d, f, x, i) 2: 3: 4: 5: 6: 7: 8: 9: 10: if t = MinGEQ-CDGP then if x(k) − x(i) > di,j then if x(k) − x(i) (cid:54)= di,j then return false else return false return true (cid:46) Inequality constraint (cid:46) Equality constraint We note that when selecting a color using the first criterion (only taking into account the previously colored vertex) the feasibility check can be made at each colored vertex or only when all vertices have been colored (which will require that the function DDF-Check() is called for each vertex). Each check (for only one vertex) runs in O(V ) time, and if the entire coloring is checked (that is, for all vertices), it runs in O(V 2) time. We also note that, when using the second criterion (using a system of absolute value (in)equalities), the feasibility check can be skipped, since the color that it returns is always feasible. The combination of these selection criteria and the corresponding feasibility checks result in three possible BPB algorithms, which are summarized in Table 2. Table 2: Summary of branch-prune-and-bound methods. Algorithm Color set size BPB-Prev - Previous neighbor BPB-Prev-CheckFull - Alternate previous neighbor BPB-Select - System of all neighbors 2 2 1 Color selection of a vertex Feasibility checking Strategy x(i) = x(j) + di,j or x(i) = x(j) + di,j (if x(i) > x(j) + di,j) x(i) = x(j) + di,j or x(i) = x(j) + di,j (if x(i) > x(j) + di,j) O(1) O(1) Time complexity When Time complexity O(V ) for each vertex At each colored vertex Only when all vertices are colored O(V 2) for entire coloring x(i) = min{k ∈ [1, U B] : ∀(i, j) ∈ E x(j) − k = (or ≥) di,j}, O(ub) Not needed - 5 Computational experiments In order to analyze the behavior of the proposed distance geometry coloring problems and the branch-prune-and-bound algorithms, we made two main sets of experiments: the first one involved generating many random graphs with different numbers of vertices according to some configurations and counting how many include even or odd cycles (while the rest are trees), since some of the properties of distance geometry coloring are related to these types of graphs. All algorithms used in these experiments were implemented in C language (compiled with gcc 4.8.4 using options -Ofast -march=native -mtune=native) and executed on a computer equipped with an Intel Core i7-3770 (3,4GHz), 8GB of memory and Linux Mint 17 operating system. We describe each set of experiments below. 14 Table 3: Number of random graphs with even, odd or no cycles (trees) and bipartite graphs generated for each number of vertices. For each size, 1,000,000 graphs were generated. V Average E 637.56 2523.52 5656.64 10059.56 15675.94 22586.52 30688.21 40120.76 50678.60 62628.32 Average Density # Graphs with # Graphs with Odd Cycles Even Cycles # Trees 0.5205 0.5098 0.5062 0.5055 0.5036 0.5036 0.5025 0.5028 0.5016 0.5020 998309 999553 999832 999910 999926 999958 999975 999975 999971 999988 854 238 74 45 41 18 13 14 15 6 837 209 94 45 33 24 12 11 14 6 # Bipartite CPU Time Graphs 1691 447 168 90 74 42 25 25 29 12 (sec) 257.07 753.25 1808.25 3403.02 4553.07 6764.28 10042.43 11886.32 14415.33 23332.64 50 100 150 200 250 300 350 400 450 500 5.1 Counting members of graph classes in random instances (cid:104)V − 1, (cid:105) Using Theorems 2 and 3, we have information about some types of graphs which always have feasible embeddings for EQ-CDGP and EQ-CDGP-Unif. Based on this, we generated a large amount of random graphs with different number of vertices and counted how many were cyclic (and based on that, how many there were for each possibility of having even or odd cycles) and how many were trees. Each random graph always starts as a random spanning tree, that is, a connected undirected graph G = (V, E), where E = V − 1. To generate this initial tree, we used a random walk algorithm proposed independently by Broder (1989) and Aldous (1990). The procedure works by using a set V ∗ of the vertices outside the tree and a set W of edges of the spanning tree. Then, whenever the random walk reaches a vertex j outside the tree, the edge (i, j) is added to E and j is removed from V ∗. This continues until V ∗ = ∅. We note that this amounts to making a random walk in a complete graph of V vertices and it generates trees in a uniform manner, that is, for all possible spanning trees of a given complete graph, each one has the same probability of being generated by the algorithm. V (V −1) After the initial tree is generated, we add random new edges to it until the graph has the desired number of edges. This parameter is also randomly set, sampled from interval . This interval ensures that the generated graph is always connected and is, at least, a tree and, at most, a complete graph. In Table 3, we outline statistics obtained from using the described procedure to generate 1,000,000 (one million) random graphs for each V ∈ {50, 100, 150, 200, 250, 300, 350, 400, 450, 500}. As we can observe, most of the graphs (more than 99%) generated have odd cycles, which translates into a very small set of possible EQ-CDGP-Unif instances with feasible embeddings for this configuration of random graphs. By increasing the number of vertices, more possibilities for generating edges appear, but the number of possible connections which will lead to trees or graphs with even cycles is very small. In fact, we can deduce that this configuration generated very few bipartite graphs. For EQ-CDGP (with arbitrary distances), the space of instances with guaranteed feasible embeddings is even smaller, since only trees are certain to have them. However, as shown in Section 3, odd and even cycles can have embeddings depending on how the edges are weighted. 2 In Figure 15, we can observe the growth of the average number of edges between all generated graphs for each number of vertices. Since the number of edges in a graph is proportional to the square ∈ O(V 2), the curve follows a similar pattern, being a half of the number of edges (since parabola. V (V −1) 2 5.2 Results for branch-prune-and-bound algorithms In order to use some of the random graphs in experiments with the BPB algorithms, we selected four graphs of each type (with even cycle, with odd cycle and trees) for each number of vertices and 15 Figure 15: Growth of the average number of edges generated when the number of vertices increases. (a) V ∈ [50, 500] (b) V ∈ [200, 500] (for scale) Figure 16: Total number of bipartite graphs generated from 1,000,000 random graphs of each number of vertices. 16 0 10000 20000 30000 40000 50000 60000 70000 50 100 150 200 250 300 350 400 450 500Average number of edgesNumber of vertices 200 400 600 800 1000 1200 1400 1600 1800 100 200 300 400 500Number of bipartitesNumber of vertices 10 20 30 40 50 60 70 80 90 200 300 400 500Number of bipartitesNumber of vertices Table 4: Results for BP algorithm (decision/search) applied to EQ-CDGP instances - 4, 5, 6, 7 and 8 vertices. V Type Inst Span # Prunes # Nodes CPU Time (s) Span # Prunes # Nodes CPU Time (s) Span # Prunes # Nodes CPU Time (s) BPB-Prev BPB-Prev-FeasCheckFull BPB-Select 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.001 0.000 0.001 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.003 0.007 0.006 0.006 0.001 0.000 0.001 0.001 0.000 0.000 0.000 0.000 0.041 0.002 0.004 0.018 0.000 0.007 0.005 0.000 0.000 0.000 0.000 0.000 Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible 24 19 14 14 20 21 38 Infeasible 20 Infeasible 32 24 Infeasible Infeasible 17 19 20 20 Infeasible Infeasible Infeasible Infeasible Infeasible 21 Infeasible Infeasible 13 19 27 39 Infeasible Infeasible Infeasible Infeasible Infeasible 23 Infeasible Infeasible 19 14 27 35 Infeasible Infeasible Infeasible Infeasible 28 Infeasible Infeasible 18 34 29 22 20 16 12 12 12 8 8 0 0 0 0 0 0 1 20 0 30 1 0 20 20 0 0 0 1 45 76 48 43 30 0 60 30 0 0 5 0 66 148 138 144 91 26 70 100 0 0 2 1 220 145 99 311 1 230 352 4 0 0 0 1 34 30 30 30 28 28 4 4 4 4 4 4 7 54 5 62 7 5 60 60 5 5 5 7 105 128 105 95 97 6 160 100 6 6 17 6 139 229 219 227 246 105 178 259 7 7 11 10 336 438 251 563 10 511 883 19 8 8 8 10 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.000 0.000 0.001 0.000 0.000 0.000 0.000 0.000 4 5 6 7 8 OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible 24 19 21 34 29 41 38 Infeasible 20 Infeasible 44 36 Infeasible Infeasible 20 19 23 39 Infeasible Infeasible Infeasible Infeasible Infeasible 46 Infeasible Infeasible 16 54 34 39 Infeasible Infeasible Infeasible Infeasible Infeasible 36 Infeasible Infeasible 34 33 27 35 Infeasible Infeasible Infeasible 28 21 21 19 20 20 0 0 0 0 0 0 0 38 1 61 0 0 54 51 0 0 0 0 149 176 167 126 100 0 155 84 0 0 0 0 191 360 383 378 263 151 250 293 0 0 0 0 650 896 696 Infeasible 1092 51 Infeasible Infeasible 0 1005 1474 40 45 47 43 71 0 0 0 0 0 36 32 32 32 32 32 4 4 4 4 4 4 5 58 5 69 5 5 77 76 5 5 5 5 161 168 161 135 131 6 223 137 6 6 6 6 196 307 323 310 361 193 283 382 7 7 7 7 505 1202 652 1075 8 1072 1934 8 8 8 8 8 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.001 0.001 0.001 0.001 0.000 0.001 0.002 0.000 0.000 0.000 0.000 0.000 54 42 41 41 32 32 4 4 4 4 4 4 5 88 6 175 5 5 97 96 5 5 5 5 533 1114 465 624 187 6 381 203 6 6 6 6 2880 6875 6506 6470 686 243 1422 745 7 7 7 7 41815 2191 4052 18078 8 6544 4369 8 8 8 8 8 Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible 24 19 21 34 29 41 38 Infeasible 20 Infeasible 44 36 Infeasible Infeasible 20 19 23 39 Infeasible Infeasible Infeasible Infeasible Infeasible 46 Infeasible Infeasible 16 54 34 39 Infeasible Infeasible Infeasible Infeasible Infeasible 36 Infeasible Infeasible 34 33 27 35 36 25 22 21 20 20 0 0 0 0 0 0 0 56 1 106 0 0 66 62 0 0 0 0 378 887 374 504 122 0 242 120 0 0 0 0 2234 5398 5360 5391 429 192 1093 511 0 0 0 0 Infeasible 34796 Infeasible Infeasible 1750 3192 Infeasible 13940 51 Infeasible Infeasible 0 5410 3346 40 45 47 43 71 0 0 0 0 0 17 Table 5: Results for BP algorithm (decision/search) applied to EQ-CDGP instances - 9, 10, 12, 14 and 16 vertices. Type Inst Span # Prunes # Nodes CPU Time (s) Span # Prunes # Nodes CPU Time (s) Span # Prunes # Nodes CPU Time (s) BPB-Prev BPB-Prev-FeasCheckFull BPB-Select V 9 10 12 14 16 OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Infeasible Infeasible Infeasible Infeasible 61 26 Infeasible Infeasible 55 68 88 45 1638 1633 1165 1417 0 0 2011 946 0 0 0 0 1537 1219 923 1801 9 9 2542 1142 9 9 9 9 Infeasible 33183 42018 Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible 72 59 40 49 46 2619 3529 4379 3500 46618 70914 1 0 0 0 0 Infeasible 108359 Infeasible 24433 Infeasible Infeasible 49 7440 8467 0 Infeasible 13801 41 0 Infeasible 18820 38 50 48 52 0 0 0 0 1974 2963 3333 3114 48740 86532 10 10 10 10 10 103428 23227 5294 5648 12 16577 12 19828 12 12 12 12 Infeasible 2725363 2744206 Infeasible Infeasible Infeasible Infeasible 34217 25749 17520 22438 Infeasible 8815580 Infeasible 8022290 Infeasible 4979521 55 63 67 59 0 0 0 0 23821 16751 11848 20427 9620137 8013781 5359288 14 14 14 14 Infeasible 9674081 8970218 Infeasible Infeasible Infeasible 79 40827 64340 79312 0 26130 40739 71850 16 Infeasible 41169779 41680959 72 0 16 Infeasible 61277800 71043803 65 86 74 79 0 0 0 0 16 16 16 16 0.002 0.001 0.001 0.002 0.000 0.000 0.003 0.001 0.000 0.000 0.000 0.000 0.042 0.002 0.003 0.004 0.003 0.045 0.086 0.000 0.000 0.000 0.000 0.000 0.115 0.026 0.006 0.006 0.000 0.017 0.000 0.021 0.000 0.000 0.000 0.000 2.820 0.019 0.018 0.013 0.022 9.640 7.269 4.921 0.000 0.000 0.000 0.000 8.843 0.019 0.031 0.056 0.000 35.448 0.000 55.371 0.000 0.000 0.000 0.000 Infeasible Infeasible Infeasible Infeasible 61 26 Infeasible Infeasible 55 68 88 45 46903 328822 385150 2479 0 0 3414 1347 0 0 0 0 Infeasible 155000 Infeasible 2108251 Infeasible 316389 Infeasible 1481970 Infeasible Infeasible Infeasible 157665 160032 254208 72 59 40 49 46 1 0 0 0 0 60000 400892 467221 3574 9 9 4392 1785 9 9 9 9 173304 2797473 400670 1818952 199713 193409 304707 10 10 10 10 10 Infeasible 965368 Infeasible 1559180 1140595 1807872 0.065 0.397 0.456 0.003 0.000 0.000 0.005 0.002 0.000 0.000 0.000 0.000 0.168 2.814 0.367 1.868 0.174 0.224 0.249 0.000 0.000 0.000 0.000 0.000 1.284 1.927 Infeasible 36724085 44121832 Infeasible 544947529 645413373 41.883 390.399 49 0 Infeasible 53860 41 0 12 62497 12 Infeasible 381806 495804 38 50 48 52 0 0 0 0 12 12 12 12 0.000 0.073 0.000 0.393 0.000 0.000 0.000 0.000 Infeasible 104517592 118562122 Infeasible 3407171273 4097250986 101.605 3314.219 Infeasible 11200102605 14120166774 10800.000 Infeasible 4872771100 5921495589 5148.447 Infeasible 1726508 Infeasible 38618944 Infeasible 32873088 Infeasible 16804920 1934194 42925314 37749326 21169856 55 63 67 59 0 0 0 0 14 14 14 14 1.889 27.755 29.182 17.424 0.000 0.000 0.000 0.000 Infeasible Infeasible Infeasible Infeasible 34 20 Infeasible Infeasible 38 27 29 21 434 456 452 297 0 7 226 88 10 0 0 0 777 650 620 801 9 24 788 357 30 9 9 9 Infeasible 7939 15821 Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible 38 27 31 33 29 Infeasible Infeasible Infeasible Infeasible 22 Infeasible 35 792 710 1030 520 4718 4662 0 4 1 4 3 9947 1578 1426 2293 42 954 16 1127 1184 1441 1036 9984 10887 10 18 12 18 16 18283 3718 2058 2876 146 2799 51 Infeasible 6572 13539 27 22 34 26 58 0 440 2 139 12 1016 16 Infeasible 119828 218219 Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible Infeasible 29 37 31 39 5217 4890 2844 286 240185 146774 160477 54 164 60 647 6949 6169 3883 955 480564 329350 354148 138 385 166 1432 Infeasible 270950088 312103257 218.788 Infeasible 229364 464467 0.001 0.001 0.000 0.001 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.011 0.001 0.001 0.001 0.001 0.006 0.007 0.000 0.000 0.000 0.000 0.000 0.012 0.003 0.002 0.002 0.000 0.002 0.000 0.009 0.000 0.000 0.001 0.000 0.146 0.005 0.005 0.003 0,001 0.306 0.205 0.225 0.000 0.000 0.000 0.001 0.295 0.010 0.012 0.010 0.001 Infeasible Infeasible Infeasible 35 10334 13417 7508 356 12037 15677 14908 799 Infeasible 10410162 19341115 12.607 29 1390 3171 Infeasible 787682 1851608 30 30 36 23 222 15 329 9 502 50 756 42 0.002 1.155 0.000 0.000 0.001 0.000 Infeasible 9212314467 13585438967 10800.000 Infeasible 12857613205 16238297924 10800.000 Infeasible 135939959 153954534 79 0 16 Infeasible 881601120 1035374397 72 0 16 Infeasible 250169040 273392839 65 86 74 79 0 0 0 0 16 16 16 16 104.928 0.000 712.612 0.000 196.395 0.000 0.000 0.000 0.000 18 V 18 20 Table 6: Results for BP algorithm (decision/search) applied to EQ-CDGP instances - 18 and 20 vertices. Type Inst Span # Prunes # Nodes CPU Time (s) Span # Prunes # Nodes CPU Time (s) Span # Prunes # Nodes CPU Time (s) BPB-Prev BPB-Prev-FeasCheckFull BPB-Select OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree OddCycle OddCycle OddCycle OddCycle EvenCycle EvenCycle EvenCycle EvenCycle Tree Tree Tree Tree 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Infeasible 508400 Infeasible 1151865 Infeasible Infeasible 164231 117988 411189 809413 137272 72425 Infeasible 11859360 10893632 Infeasible 152740084 167194942 Infeasible 466856235 439993043 Infeasible 54784145 53791828 88 61 91 71 0 0 0 0 18 18 18 18 0.324 0.630 0.093 0.050 8.610 127.611 298.974 36.624 0.000 0.000 0.000 0.000 Infeasible 14249119873 14806963853 10800.000 Infeasible 6511737586 7859547065 10800.000 Infeasible 2830789695 3168256401 3927.393 Infeasible 8764779022 9900318687 10800.000 Infeasible 1336188416 1468424277 Infeasible 611753448 711245102 979.763 598.378 Infeasible Infeasible Infeasible Infeasible Infeasible 18527 29654 1411 25336 92766 Infeasible 996127 Infeasible 6868230379 7523523165 10800.000 Infeasible 2312073 Infeasible 285915264 360281393 505.807 Infeasible 2527172 88 61 91 71 0 0 0 0 18 18 18 18 0.000 0.000 0.000 0.000 31 25 28 30 6170 1171 57 1634 33062 46174 3456 28579 208614 2340311 4373462 5361369 12737 2731 157 3433 Infeasible 273165199 217944054 169.144 Infeasible 6147895146 9044193773 10800.000 Infeasible 1786324 3216901 Infeasible 2231047 1503222 Infeasible 1049440 Infeasible 414762 744982 249339 1.467 0.542 0.170 Infeasible 6371122973 8069928711 Infeasible 7751043598 8898429750 10800.000 10800.000 Infeasible 13950045871 14504063426 10800.000 Infeasible Infeasible Infeasible 63034 31642 56488 89385 48916 64593 Infeasible 7618735112 8591239945 7112.081 141 0 20 Infeasible 20754606 17374721 0.000 14.777 $ - 141 - 0 - 20 Infeasible 7684808926 7634511236 10800.000 Infeasible 167148 Running Infeasible 20719998 47209517 0.000 36 13158 25609 351029 0.023 0.032 0.002 0.022 0.135 1.429 2.787 3.354 0.008 0.002 0.000 0.002 2.101 0.066 0.035 0.051 29.050 0.017 0.225 Infeasible 15355600960 14057177765 10800.000 Infeasible 5426010704 7820985965 10800.000 Infeasible 335043320 686615646 428.222 64 103 96 115 0 0 0 0 20 20 20 20 0.000 0.000 0.000 0.000 64 103 96 115 0 0 0 0 20 20 20 20 0.000 0.000 0.000 0.000 24 29 36 27 107586 201000 560 2908 57601 1443 6536 151814 0.132 0.001 0.004 0.095 randomly weighted the edges with a uniform distribution in the interval [1, 30]. We made two subsets of experiments: the first one involved only the EQ-CDGP and EQ-CDGP-Const models, in order to find a feasible solution for each of its instances that were generated (that is, the algorithms use the pruning procedure, but not bounding - equivalently, stopping the search as soon as the first feasible solution is found), and the second one involved the optimization models for each discussed model (MinEQ-CDGP, MinEQ-CDGP-Const, MinGEQ-CDGP and MinGEQ-CDGP-Const). Tables 4, 5 and 6 give detailed results with 4 to 8, 9 to 16 and 18 to 20 vertices, respectively, considering each BPB algorithm applied to the decision versions. We can see that BPB-Prev reaches a feasible solution faster than the other methods (that is, it solves the decision problem in less time), but it also returns the first feasible solution with a worst span than BPB-Select (noting that BPB- Prev-FeasCheckFull always returns the same span from BPB-Prev because only the pruning point is changed). However, it is much slower to prove that an instance is infeasible (that is, the answer to the decision problem is NO). This is explained by the fact that the enumeration tree is smaller in BPB-Select, since instead of two color possibilities for each vertex, there is only one. Although the time complexity of determining the color for a vertex in BPB-Select is higher (as shown in Table 2), this is compensated by generating a smaller tree and that the feasibility check is not explicitly needed, since it is guaranteed by the color selection algorithm. We also note that BPB-Prev-FeasCheckFull has the worst CPU times for infeasible instances, because the method will keep branching the enumeration tree to find a feasible solution, but since feasibility checking is only done at the leaf nodes, the tree will tend to become the full enumeration tree. In the same manner, Table 7 shows the results for the BPB algorithms considering the optimization versions and applied only to feasible MinEQ-CDGP instances. For almost all of these instances, BPB- Prev is the best method, BPB-Prev-FeasCheckFull shows similar performance and BPB-Select has worse CPU times. The ties between BPB-Prev and BPB-Prev-FeasCheckFull are explained by the fact that although, in the latter method, the feasibility checking at the leaf nodes increases the time required to find a feasible solution, we keep using the bounding procedures at each node, which reduces the amount of work needed to find the optimal solution. We also note that, for the 4th Tree instance with 20 vertices, BPB-Select does not find the true optimum for the problem. This happens because the method is recursively applied only to vertices which have recorded neighbors, in the same manner as the other two BPBs, but the system of absolute value expressions returns only one color, which may not be the one for the optimal solution when applying the recursion only on some vertices. On some experiments, we detected that, if we generate all vertice orders and apply the color selection of BPB-Select, on them, the optimal solution is found, but the CPU times become very high, since this procedure does not take advantage of the 0-sphere intersection characteristic. 19 The last experiments were made by applying the BPB algorithms on all instances considered for the algorithms, but by transforming them to MinGEQ-CDGP (changing the = in constraints to ≥). Since they are always feasible for MinGEQ-CDGP because of its equivalence to BCP, we only have to consider optimization problems, as was already done in Section 2. The same pattern of previous experiments occur here, with BPB-Prev being the best method of the three, however, the CPU time difference between it and BPB-Prev-FeasCheckFull becomes much more apparent here, since there are many more feasible solutions for MinGEQ-CDGP than MinEQ-CDGP. 6 Concluding remarks In this paper, we proposed some distance geometry models for graph coloring problems with distance constraints that can be applied to important, modern real world applications, such as in telecommunications for channel assignment in wireless networks. In these proposed coloring distance geometry problems (CDGPs), the vertices of the graph are embedded on the real line and the coloring is treated as an assignment of natural numbers to the vertices, while the distances correspond to line segments, whose objective is to determine a feasible intersection of them. We tackle such problems under the graph theory approach, to establish conditions of feasibility through behavior analysis of the problems in certain classes of graphs, identifying prohibited structures for which the occurrence indicates that it can not admit a valid solution, as well as identifying classes graphs that always admit valid solution. We also developed exact and approximate enumeration algorithms, based on the Branch-and-Prune (BP) algorithm proposed for the Discretizable Molecular Distance Geometry Problem (DMDGP), combining concepts from constraint propagation and optimization techniques, resulting in Branch- Prune-and-Bound algorithms (BPB), that handle the set of distances in different ways in order to get feasible and optimal solutions. The computational experiments involved equality and inequality constraints and both uniform and arbitrary sets of distances, where we measure the number of prunes and bounds and the CPU time needed to reach the best solution. The main contribution of this paper consists of a distance geometry approach for special cases of T-coloring problems with distance constraints, involving a study of graph classes for which some of these distance
1301.0995
1
1301
2013-01-06T11:44:35
On the Complexity of Connectivity in Cognitive Radio Networks Through Spectrum Assignment
[ "cs.DS" ]
Cognitive Radio Networks (CRNs) are considered as a promising solution to the spectrum shortage problem in wireless communication. In this paper, we initiate the first systematic study on the algorithmic complexity of the connectivity problem in CRNs through spectrum assignments. We model the network of secondary users (SUs) as a potential graph, where two nodes having an edge between them are connected as long as they choose a common available channel. In the general case, where the potential graph is arbitrary and the SUs may have different number of antennae, we prove that it is NP-complete to determine whether the network is connectable even if there are only two channels. For the special case where the number of channels is constant and all the SUs have the same number of antennae, which is more than one but less than the number of channels, the problem is also NP-complete. For the special cases in which the potential graph is complete, a tree, or a graph with bounded treewidth, we prove the problem is NP-complete and fixed-parameter tractable (FPT) when parameterized by the number of channels. Exact algorithms are also derived to determine the connectability of a given cognitive radio network.
cs.DS
cs
Noname manuscript No. (will be inserted by the editor) On the Complexity of Connectivity in Cognitive Radio Networks Through Spectrum Assignment Hongyu Liang · Tiancheng Lou · Haisheng Tan · Yuexuan Wang · Dongxiao Yu 3 1 0 2 n a J 6 ] S D . s c [ 1 v 5 9 9 0 . 1 0 3 1 : v i X r a the date of receipt and acceptance should be inserted later Abstract Cognitive Radio Networks (CRNs) are considered as a promising solution to the spectrum shortage problem in wireless communication. In this paper, we initiate the first systematic study on the algorithmic complexity of the connectivity problem in CRNs through spectrum assignments. We model the network of secondary users (SUs) as a potential graph, where two nodes having an edge between them are connected as long as they choose a common available channel. In the general case, where the potential graph is arbitrary and the SUs may have different number of antennae, we prove that it is NP- complete to determine whether the network is connectable even if there are only two channels. For the special case where the number of channels is con- stant and all the SUs have the same number of antennae, which is more than one but less than the number of channels, the problem is also NP-complete. For the special cases in which the potential graph is complete, a tree, or a graph with bounded treewidth, we prove the problem is NP-complete and fixed-parameter tractable (FPT) when parameterized by the number of chan- nels. Exact algorithms are also derived to determine the connectability of a given cognitive radio network. A preliminary version of this paper appears in ALGOSENSORS 2012 [13]. The main exten- sions are that we give more details of our results and investigate the special case where the potential graphs are of bounded treewidth. Hongyu Liang, Haisheng Tan(Corresponding Author), Yuexuan Wang Institute for Theoretical Computer Science, IIIS, Tsinghua University, Beijing, China E-mail: [email protected], {tan,wangyuexuan}@mail.tsinghua.edu.cn Tiancheng Lou Google Inc., California, USA E-mail: [email protected] Dongxiao Yu Department of Computer Science, the University of Hong Kong, Hong Kong, China 2 1 Introduction Hongyu Liang et al. Cognitive Radio is a promising technology to alleviate the spectrum shortage in wireless communication. It allows the unlicensed secondary users to utilize the temporarily unused licensed spectrums, referred to as white spaces, without interfering with the licensed primary users. Cognitive Radio Networks (CRNs) is considered as the next generation of communication networks and attracts numerous research from both academia and industry recently. In CRNs, each secondary user (SU) can be equipped with one or multiple antennae for communication. With multiple antennae, a SU can communicate on multiple channels simultaneously (in this paper, channel and spectrum are used interchangeably.). Through spectrum sensing, each SU has the capacity to measure current available channels at its site, i.e. the channels are not used by the primary users (PUs). Due to the appearance of PUs, the available channels of SUs have the following characteristics [1]: -- Spatial Variation: SUs at different positions may have different available channels; -- Spectrum Fragmentation: the available channels of a SU may not be con- tinuous; and -- Temporal Variation: the available channels of a SU may change over time. Spectrum assignment is to allocate available channels to SUs to improve system performance such as spectrum utilization, network throughput and fairness. Spectrum assignment is one of the most challenging problems in CRNs and has been extensively studied such as in [12,19,20,22,23]. Connectivity is a fundamental problem in wireless communication. Con- nection between two nodes in CRNs is not only determined by their distance and their transmission powers, but also related to whether the two nodes has chosen a common channel. Due to the spectrum dynamics, communication in CRNs is more difficult than in the traditional multi-channel radio networks studied in [4]. Authors in [14,15,16] investigated the impact of different pa- rameters on connectivity in large-scale CRNs, such as the number of channels, the activity of PUs, the number of neighbors of SUs and the transmission power. In this paper, we initiate the first systematic study on the complexity of connectivity in CRNs through spectrum assignment. We model the network as a potential graph and a realized graph before and after spectrum assignment respectively (refer to Section 2). We start from the most general case, where the network is composed of heterogenous SUs1, SUs may be equipped with different number of antennae and the potential graph can be arbitrary (Fig- ure 1). Then, we proceed to study the special case when all the SUs have the same number of antennae. If all the SUs are homogenous with transmission ranges large enough, the potential graph will be a complete graph. For some hierarchically organized networks, e.g. a set of SUs are connected to an access 1 We assume two heterogenous SUs cannot communicate even when they work on a com- mon channel and their distance is within their transmission ranges. On the Complexity of Connectivity in CRNs Through Spectrum Assignment 3 Fig. 1 the general case. a) the potential graph: the set besides each SU is its available channels, and β is its number of antennae. u2 and u4 are not connected directly because they are a pair of heterogenous nodes or their distance exceeds at least one of their transmission ranges. b) the realization graph which is connected: the set beside each SU is the channels assigned to it. point, the potential graph can be a tree. Therefore, we also study these special cases. Exact algorithms are also derived to determine connectivity for different cases. Our results are listed below. To the best of knowledge, this is the first work that systematically studies the algorithmic complexity of connectivity in CRNs with multiple antennae. Our Contributions: In this paper we study the algorithmic complexity of the connectivity problem through spectrum assignment under different models. Our main results are as follows. -- When the potential graph is a general graph, we prove that the problem is NP-complete even if there are only two channels. This result is sharp as the problem is polynomial-time solvable when there is only one channel. We also design exact algorithms for the problem. For the special case when all SUs have the same number of antennae, we prove that the problem is NP- complete when k > β ≥ 2, where k and β are the total amount of channels in the white spaces and the number of antennae on an SU respectively. -- When the potential graph is complete,2 the problem is shown to be NP- complete even if each node can open at most two channels. However, in contrast to the general case, the problem is shown to be polynomial-time solvable if the number of channels is fixed. In fact, we prove a stronger result saying that the problem is fixed parameter tractable when parame- terized by the number of channels. (See [5] for notations in parameterized complexity.) -- When the potential graph is a tree, we prove that the problem is NP- complete even if the tree has depth one. Similar to the complete graph case, we show that the problem is fixed parameter tractable when parame- terized by the number of channels. We then generalize this result, showing that the problem remains fixed parameter tractable when parameterized 2 The complete graph is a special case of disk graphs, which are commonly used to model wireless networks such as in [11, 21]. 4 Hongyu Liang et al. by the number of channels if the underlying potential graph has bounded treewidth. Paper Organization: In Section 2 we formally define our model and problems studied in this paper. We study the problem with arbitrary potential graphs in Section 3. The special cases where the potential graph is complete or a tree are investigated in Sections 4 and 5. The paper is concluded in Section 6 with possible future works. 2 Preliminaries 2.1 System Model and Problem Definition We first describe the model used throughout this paper. A cognitive radio network is comprised of the following ingredients: -- U is a collection of secondary users (SUs) and C is the set of channels in the white spaces. -- Each SU u ∈ U has a spectrum map, denoted by SpecMap(u), which is a subset of C representing the available channels that u can open. -- The potential graph PG = (U, E), where each edge of E is also called a potential edge. If two nodes are connected by a potential edge, they can communicate as long as they choose a common available channel. -- Each SU u ∈ U is equipped with a number of antennas, denoted as antenna budget β(u), which is the maximum number of channels that u can open simultaneously. For a set S, let 2S denote the power set of S, i.e., the collection of all subsets of S. A spectrum assignment is a function SA : U → 2C satisfying that SA(u) ⊆ SpecMap(u) and SA(u) ≤ β(u) for all u ∈ U. Equivalently, a spectrum assignment is a way of SUs opening channels such that each SU opens at most β channels and can only open those in its spectrum map. Given a spectrum assignment SA, a potential edge {u, v} ∈ E is called re- alized if SA(u) ∩ SA(v) 6= ∅, i.e., there exists a channel opened by both u and v. The realization graph under a spectrum assignment is a graph RG = (U, E′), where E′ is the set of realized edges in E. Note that RG is a spanning subgraph of the potential graph PG. A cognitive radio network is called connectable if there exists a spectrum assignment under which the realization graph is con- nected, in which case we also say that the cognitive radio network is connected under this spectrum assignment. Now we can formalize the problems studied in this paper. The Spectrum Connectivity Problem. The Spectrum Connectivity problem is to decide whether a given cognitive radio network is connectable. On the Complexity of Connectivity in CRNs Through Spectrum Assignment 5 We are also interested in the special case where the number of possible channels is small3 and SUs have the same antenna budget. Therefore, we define the following subproblem of the Spectrum Connectivity problem: The Spectrum (k, β)-Connectivity Problem. For two constants k, β ≥ 1, the Spectrum (k, β)-Connectivity problem is to decide whether a given cognitive radio network with k channels in which all SUs have the same budget β is connectable. For convenience we write SpecCon(k, β) to represent this problem. Finally, we also consider the problem with special kinds of potential graphs, i.e. the potential graph is complete or a tree. In the sequel, unless otherwise stated, we always use n := U and k := C to denote respectively the number of secondary users and channels. 2.2 Tree Decomposition In this subsection we give some basic notions regarding the tree decomposition of a graph, which will be used later. The concept of treewidth was introduced by Robertson and Seymour in their seminal work on graph minors [17]. A tree decomposition of a graph G = (V, E) is given by a tuple (T = (I, F ), {Xi i ∈ I}), where T is a tree and each Xi is a subset of V called a bag satisfying that -- Si∈I Xi = V ; -- For each edge {u, v} ∈ E, there exists a tree node i with {u, v} ⊆ Xi; -- For each vertex u ∈ V , the set of tree nodes {i ∈ I u ∈ Xi} forms a connected subtree of T . Equivalently, for any three vertices t1, t2, t3 ∈ I such that t2 lies in the path from t1 to t3, it holds that Xt1 ∩ Xt3 ⊆ Xt2. The width of the tree decomposition is maxi∈I {Xi − 1}, and the treewidth of a graph G is the minimum width of a tree decomposition of G. For each fixed integer d, there is a polynomial time algorithm that decides whether a given graph has treewidth at most d, and if so, constructs a tree decomposition of width d [2]. Such a decomposition can easily be transformed to a nice tree decomposition (T, {Xi}) of G with the same width, in which T is a rooted binary tree with at most O(V ) nodes (see e.g. [10]). 3 The Spectrum Connectivity Problem In this section, we study the the Spectrum Connectivity problem from both complexity and algorithmic points of view. 3 Commonly, the white spaces include spectrums from channel 21 (512Mhz) to 51 (698Mhz) excluding channel 37, which is totally 29 channels [1]. 6 Hongyu Liang et al. 3.1 NP-completeness Results We show that the Spectrum Connectivity problem is NP-complete even if the number of channels is fixed. In fact we give a complete characterization of the complexity of SpecCon(k, β) by proving the following dichotomy result: Theorem 1 SpecCon(k, β) is NP-complete for any integers k > β ≥ 2, and is in P if β = 1 or k ≤ β. The second part of the statement is easy: When β = 1, each SU can only open one channel, and thus all SUs should be connected through the same channel. Therefore, the network is connectable if and only if there there exists a channel that belongs to every SU's spectrum map (and of course the potential graph must be connected), which is easy to check. When k ≤ β, each SU can open all channels in its spectrum map, and the problem degenerates to checking the connectivity of the potential graph. In the sequel we prove the NP-completeness of SpecCon(k, β) when k > β ≥ 2. First consider the case k = β + 1. We will reduce a special case of the Boolean Satisfiability (SAT) problem, which will be shown to be NP-complete, to SpecCon(β + 1, β), thus showing the NP-completeness of the latter. A clause is called positive if it only contains positive literals, and is called negative if it only contains negative literals. For example, x1 ∨ x3 ∨ x5 is positive and x2 ∨ x4 is negative. A clause is called uniform if it is positive or negative. A uniform CNF formula is the conjunction of uniform clauses. Define Uniform-SAT as the problem of deciding whether a given uniform CNF formula is satisfiable. Lemma 1 Uniform-SAT is NP-complete. Proof Let F be a CNF formula with variable set {x1, x2, . . . , xn}. For each i such that xi appears in F , we create a new variable yi, and do the following: -- substitute yi for all occurrences of xi; -- add two clauses xi ∨ yi and xi ∨ yi to F . More formally, let F ← F ∧ (xi ∨ yi) ∧ (xi ∨ yi). This ensures yi = xi in any satisfying assignment of F . Call the new formula F ′. For example, if F = (x1 ∨ x2) ∧ (x1 ∨ x3), then F ′ = (x1 ∨ y2) ∧ (y1 ∨ x3) ∧ (x1 ∨ y1) ∧ (x1 ∨ y1) ∧ (x2 ∨ y2) ∧ (x2 ∨ y2). It is easy to see that F ′ is a uniform CNF formula, and that F is satisfi- able if and only if F ′ is satisfiable. This constitutes a reduction from SAT to Uniform-SAT, which concludes the proof. ⊓⊔ Theorem 2 SpecCon(β + 1, β) is NP-complete for any integer β ≥ 2. Proof The membership of SpecCon(β + 1, β) in NP is clear. In what follows we reduce Uniform-SAT to SpecCon(β +1, β), which by Lemma 1 will prove the NP-completeness of the latter. Let c1 ∧ c2 ∧ . . . ∧ cm be an input to Uniform-SAT where cj, 1 ≤ j ≤ m, is a uniform clause. Assume the variable set is {x1, x2, . . . , xn}. We construct an instance of SpecCon(β + 1, β) as follows. On the Complexity of Connectivity in CRNs Through Spectrum Assignment 7 -- Channels: There are β + 1 channels {0, 1, 2, . . . , β}. -- SUs: -- For each variable xi, there is a corresponding SU Xi with spectrum map SpecMap(Xi) = {0, 1, 2, . . . , β} (which contains all possible channels); -- for each clause cj, 1 ≤ j ≤ m, there is a corresponding SU Cj with SpecMap(Cj) = {pj}, where pj = 1 if cj is positive and pj = 0 if cj is negative; -- there is an SU Y2 with SpecMap(Y2) = {2}. For every 1 ≤ i ≤ n and 2 ≤ k ≤ β, there is an SU Yi,k with SpecMap(Yi,k) = {k}; and -- all SUs have the same antenna budget β. -- Potential Graph: For each clause cj and each variable xi that appears in cj (either as xi or xi), there is a potential edge between Xi and Cj . For each 1 ≤ i ≤ n and 3 ≤ k ≤ β, there is a potential edge between Xi and Yi,k. Finally, there is a potential edge between Y2 and every Xi, 1 ≤ i ≤ n. Denote the above cognitive radio network by I, which is also an instance of SpecCon(β + 1, β). We now prove that c1 ∧ c2 ∧ . . . ∧ cm is satisfiable if and only if I is connectable. First consider the "only if" direction. Let A : {x1, . . . , xn} → {0, 1} be a satisfying assignment of c1 ∧ c2 ∧ . . . ∧ cm, where 0 stands for FALSE and 1 for TRUE. Define a spectrum assignment as follows. For each 1 ≤ i ≤ n, let user Xi open the channels {2, 3, . . . , β} ∪ {A(i)}. Every other SU opens the only channel in its spectrum map. We verify that I is connected under the above spectrum assignment. For each 1 ≤ i ≤ n, Xi is connected to Y2 through channel 2. Then, for every 2 ≤ l ≤ β, Yi,l is connected to Xi through channel l. Now consider SU Cj where 1 ≤ j ≤ m. Since A satisfies the clause cj, there exists 1 ≤ i ≤ n such that: 1) xi or xi occurs in cj; and 2) A(xi) = 1 if cj is positive, and A(xi) = 0 if cj is negative. Thus Xi and Cj are connected through channel A(xi). Therefore the realization graph is connected, completing the proof of the "only if" direction. We next consider the "if" direction. Suppose there is a spectrum assign- ment that makes I connected. For every 1 ≤ i ≤ n and 2 ≤ l ≤ β, Xi must open channel l, otherwise Yi,l will become an isolated vertex in the realization graph. Since Xi can open at most β channels in total, it can open at most one of the two remaining channels {0, 1}. We assume w.l.o.g. that Xi opens exactly one of them, which we denote by ai. Now, for the formula c1 ∧ c2 ∧ . . . ∧ cm, we define a truth assignment A : {x1, . . . , xn} → {0, 1} as A(xi) = ai for all 1 ≤ i ≤ n. We show that A satisfies the formula. Fix 1 ≤ j ≤ m and assume that cj is negative (the case where cj is positive is totally similar). Since the spectrum map of SU Cj only contains channel 0, some of its neighbors must open channel 0. Hence, there exists 1 ≤ i ≤ n such that xi appears in cj and the corresponding SU Xi opens channel 0. By our construction of A, we have A(xi) = 0, and thus the clause cj is satisfied by A. Since j is chosen arbitrarily, the formula 8 Hongyu Liang et al. c1 ∧c2 ∧. . .∧cm is satisfied by A. This completes the reduction from Uniform- SAT to SpecCon(β, β + 1), and the theorem follows. ⊓⊔ Corollary 1 SpecCon(k, β) is NP-complete for any integers k > β ≥ 2. Proof By a simple reduction from SpecCon(β + 1, β): Given an instance of SpecCon(β+1, β), create k−β−1 new channels and add them to the spectrum map of an (arbitrary) SU. This gives a instance of SpecCon(k, β). Since the new channels are only contained in one SU, they should not be opened, and thus the two instances are equivalent. Hence the theorem follows. ⊓⊔ Theorem 2 indicates that the Spectrum Connectivity problem is NP- complete even if the cognitive radio network only has three channels. We further strengthen this result by proving the following theorem: Theorem 3 The Spectrum Connectivity problem is NP-complete even if there are only two channels. Proof We present a reduction from Uniform-SAT similar as in the proof of Theorem 2. Let c1 ∧ c2 ∧ . . . ∧ cm be a uniform CNF clause with variable set {x1, x2, . . . , xn}. Construct a cognitive radio network as follows: There are two channels {0,1}. For each variable xi there is a corresponding SU Xi with spectrum map SpecMap(Xi) = {0, 1} and antenna budget β(Xi) = 1. For each clause cj there is a corresponding SU Cj with SpecMap(Cj ) = {pj} and β(Cj ) = 1, where pj = 1 if cj is positive and pj = 0 if cj is negative. There is an SU Y with SpecMap(Y ) = {0, 1} and β(Y ) = 2. Note that, unlike in the case of SpecCon(k, β), SUs can have different antenna budgets. Finally, the edges of the potential graph include: {Xi, Cj } for all i, j such that xi or xi appears in cj, and {Y, Xi} for all i. This completes the construction of the cognitive radio network, which is denoted by I. By an analogous argument as in the proof of Theorem 2, c1 ∧ c2 ∧ . . . ∧ cm is satisfiable if and only if I is connectable, concluding the proof of Theorem 3. ⊓⊔ Theorem 3 is sharp in that, as noted before, the problem is polynomial-time solvable when there is only one channel. 3.2 Exact Algorithms In this subsection we design algorithms for deciding whether a given cognitive radio network is connectable. Since the problem is NP-complete, we cannot expect a polynomial time algorithm. Let n, k, t denote the number of SUs, the number of channels, and the maximum size of any SU's spectrum map, respectively (t ≤ k). The simplest idea is to exhaustively examine all possible spectrum assignments to see if there exists one that makes the network connected. Since each SU can have at most 2t possible ways of opening channels, the number of assignments is at most 2tn. Checking each assignment takes poly(n, k) time. Thus the running On the Complexity of Connectivity in CRNs Through Spectrum Assignment 9 time of this approach is bounded by 2tn(nk)O(1), which is reasonable when t is small. However, since in general t can be as large as k, this only gives a 2O(kn) bound, which is unsatisfactory if k is large. In the following we present another algorithm for the problem that runs faster than the above approach when k is large. Theorem 4 There is an algorithm that decides whether a given cognitive radio network is connectable in time 2O(k+n log n). Proof Let I be a given cognitive radio network with potential graph PG. Let n be the number of SUs and k the number of channels. Assume that I is connected under some spectrum assignment. Clearly the realization graph contains a spanning tree of PG, say T , as a subgraph. If we change the poten- tial graph to T while keeping all other parameters unchanged, the resulting network will still be connected under the same spectrum assignment. Thus, it suffices to check whether there exists a spanning tree T of G such that I is connectable when substituting T for PG as its potential graph. Using the algorithm of [7], we can list all spanning trees of PG in time O(N n) where N is the number of spanning trees of PG. By Cayley's formula [3,18] we have N ≤ nn−2. Finally, for each spanning tree T , we can use the algorithm in Theorem 9 (which will appear in Section 5) to decide whether the network is connectable in time 2O(k)nO(1). The total running time of the algorithm is O(nn−2)2O(k)nO(1) = 2O(k+n log n). ⊓⊔ Combining Theorem 4 with the brute-force approach, we obtain: Corollary 2 The Spectrum Connectivity problem is solvable can be solved in time 2O(min{kn,k+n log n}). 4 Spectrum Connectivity with Complete Potential Graphs In this section we consider the special case of the Spectrum Connectivity problem, in which the potential graph of the cognitive radio network is com- plete. We first show that this restriction does not make the problem tractable in polynomial time. Theorem 5 The Spectrum Connectivity problem is NP-complete even when the potential graph is complete and all SUs have the same antenna budget β = 2. Proof The membership in NP is trivial. The hardness proof is by a reduc- tion from the Hamiltonian Path problem, which is to decide whether a given graph contains a Hamiltonian path, i.e., a simple path that passes ev- ery vertex exactly once. The Hamiltonian Path problem is well-known to be NP-complete [8]. Let G = (V, E) be an input graph of the Hamiltonian Path problem. Construct an instance of the Spectrum Connectivity prob- lem as follows: The collection of channels is E and the set of SUs is V ; that 10 Hongyu Liang et al. is, we identify a vertex in V as an SU and an edge in E as a channel. For every v ∈ V , the spectrum map of v is the set of edges incident to v. All SUs have antenna budget β = 2. Denote this cognitive radio network by I. We will prove that G contains a Hamiltonian path if and only if I is connectable. First suppose G contains a Hamiltonian path P = v1v2 . . . vn, where n = V . Consider the following spectrum assignment of I: for each 1 ≤ i ≤ n, let SU vi open the channels corresponding to the edges incident to vi in the path P . Thus all SUs open two channels except for v1 and vn each of whom opens only one. For every 1 ≤ i ≤ n− 1, vi and vi+1 are connected through the channel (edge) {vi, vi+1}. Hence the realization graph of I under this spectrum assignment is connected. Now we prove the other direction. Assume that I is connectable. Fix a spectrum assignment under which the realization graph of I is connected, and consider this particular realization graph RG = (V, E′). Let {vi, vj} be an arbitrary edge in E′. By the definition of the realization graph, there is a channel opened by both vi and vj. Thus there is an edge in E incident to both vi and vj, which can only be {vi, vj}. Therefore {vi, vj} ∈ E. This indicates E′ ⊆ E, and hence RG is a connected spanning subgraph of G. Since each SU can open at most two channels, the maximum degree of RG is at most 2. Therefore RG is either a Hamiltonian path of G, or a Hamiltonian cycle which contains a Hamiltonian path of G. Thus, G contains a Hamiltonian path. The reduction is complete and the theorem follows. ⊓⊔ Notice that the reduction used in the proof of Theorem 5 creates a cognitive radio network with an unbounded number of channels. Thus Theorem 5 is not stronger than Theorem 1 or 3. Recall that Theorem 3 says the Spectrum Connectivity problem is NP-complete even if there are only two channels. In contrast we will show that, with complete potential graphs, the problem is polynomial-time tractable when the number of channels is small. Theorem 6 The Spectrum Connectivity problem with complete potential graphs can be solved in 22k+O(k)nO(1) time. Proof Consider a cognitive radio network I with SU set U , channel set C and a complete potential graph, i.e., there is a potential edge between every pair of distinct SUs. Recall that n = U and k = C. For each spectrum assignment SA, we construct a corresponding spectrum graph GSA = (V, E) where V = {C′ ⊆ C ∃u ∈ U s.t. SA(u) = C′} and E = {{C1, C2} C1, C2 ∈ V ; C1 ∩ C2 6= ∅}. Thus, V is the collection of subsets of C that is opened by some SU, and E reflexes the connectivity between pairs of SUs that open the corresponding channels. Since each vertex in V is a subset of C, we have V ≤ 2k, and the number of different spectrum graphs is at most 22k . We now present a relation between GSA and the realization graph of I under SA. If we label each vertex u in the realization graph with SA(u), and contract all edges between vertices with the same label, then we obtain precisely the spectrum graph GSA = (V, E). Therefore, in the language of graph theory, GSA = (V, E) is a minor of the realization graph under SA. On the Complexity of Connectivity in CRNs Through Spectrum Assignment 11 Since graph minor preserves connectivity, I is connectable if and only if there exists a connected spectrum graph. Hence we can focus on the problem of deciding whether a connected spectrum graph exists. Consider all possible graphs G = (V, E) such that V ⊆ 2C, and E = {{C1, C2} C1, C2 ∈ V ; C1 ∩ C2 6= ∅}. There are 22k such graphs each of which has size 2O(k). Thus we can list all such graphs in 22k+O(k) time. For each graph G, we need to check whether it is the spectrum graph of some spectrum assignment of I. We create a bipartite graph in which nodes on the left side are the SUs in I, and nodes on the right side all the vertices of G. We add an edge between an SU u and a vertex C′ of G if and only if C′ ⊆ SpecMap(u) and C′ ≤ β(u), that is, u can open C′ in a spectrum assignment. The size of H is poly(n, 2k) and its construction can be finished in poly(n, 2k) time. Now, if G is the spectrum graph of some spectrum assignment SA, then we can identify SA with a subgraph of H consisting of all edges (u, SA(u)) where u is an SU. In addition, in this subgraph we have -- every SU u has degree exactly one; and -- every node C′ on the right side of H has degree at least one. Conversely, a subgraph of H satisfying the above two conditions clearly induces a spectrum assignment whose spectrum graph is exactly G. Therefore it suffices to examine whether H contains such a subgraph. Furthermore, the above conditions are easily seen to be equivalent to: -- every SU u has degree at least one in G; and -- G contains a matching that includes all nodes on the right side. The first condition can be checked in time linear in the size of H, and the second one can be examined by any polynomial time algorithm for bipartite matching (e.g., [9]). Therefore, we can decide whether such subgraph exists (and find one if so) in time poly(n, 2k). By our previous analyses, this solves the Spectrum Connectivity problem with complete potential graphs. The total running time of our algorithm is 22k+O(k)poly(n, 2k) = 22k+O(k)nO(1). ⊓⊔ Theorem 7 The Spectrum Connectivity problem with complete potential graphs is fixed parameter tractable (FPT) when parameterized by the number of channels. 5 Spectrum Connectivity on Trees and Bounded Treewidth Graphs In this section, we study another special case of the Spectrum Connectiv- ity problem where the potential graph of the cognitive radio network is a tree. We will also investigate the problem on the class of bounded-treewidth graphs. Many NP-hard combinatorial problems become easy on trees, e.g., the domi- nating set problem and the vertex cover problem. Nonetheless, as indicated by the following theorem, the Spectrum Connectivity problem remains hard on trees. 12 5.1 Trees Hongyu Liang et al. We state the complexity of the spectrum connectivity problem with trees as the potential graph in the following theorem. Theorem 8 The Spectrum Connectivity problem is NP-complete even if the potential graph is a tree of depth one. Proof We give a reduction from the Vertex Cover problem which is well known to be NP-complete [8]. Given a graph G = (V, E) and an integer r, the Vertex Cover problem is to decide whether there exists r vertices in V that cover all the edges in E. Construct a cognitive radio network I as follows. The set of channels is C = {cv v ∈ V }. For each edge e = {u, v} ∈ E there is an SU Ue with SpecMap(Ue) = {cu, cv} and antenna budget 2. There is another SU M with SpecMap(M ) = C and antenna budget r. The potential graph is a star centered at M , that is, there is a potential edge between M and Ue for every e ∈ E. This finishes the construction of I. We prove that G has a vertex cover of size r if and only if I is connectable. First assume G has a vertex cover S ⊆ V with S ≤ r. Define a spectrum assignment A(S) as follows: M opens the channels {cv v ∈ S}, and Ue opens both channels in its spectrum map for all e ∈ E. Since S is a vertex cover, we have u ∈ S or v ∈ S for each e = {u, v} ∈ E. Thus at least one of cu and cv is opened by M , which makes it connected to Ue. Hence the realization graph is connected. On the other hand, assume that the realization graph is connected under some spectrum assignment. For each e = {u, v} ∈ E, since the potential edge {M, Ue} is realized, M opens at least one of cu and cv. Now define S = {v ∈ V cv is opened by M }. It is clear that S is a vertex cover of G of size at most β(M ) = r. This completes the reduction, and the theorem follows. ⊓⊔ We next show that, in contrast to Theorems 2 and 3, this special case of the problem is polynomial-time solvable when the number of channels is small. Theorem 9 Given a cognitive radio network whose potential graph is a tree, we can check whether it is connectable in 2O(t)(kn)O(1) time, where t is the maximum size of any SU's spectrum map. In particular, this running time is at most 2O(k)nO(1). Proof Let I be a given cognitive radio network whose potential graph PG = (V, E) is a tree. Root PG at an arbitrary node, say r. For each v ∈ V let PGv denote the subtree rooted at v, and let Iv denote the cognitive radio network obtained by restricting I on PGv. For every subset S ⊆ SpecMap(v), define f (v, S) to be 1 if there exists a spectrum assignment that makes Iv connected in which the set of channels opened by v is exactly S; let f (v, S) = 0 otherwise. For each channel c ∈ C, define g(v, c) to be 1 if there exists S, {c} ⊆ S ⊆ SpecMap(v), for which f (v, S) = 1; define g(v, c) = 0 otherwise. Clearly I is connectable if and only if there exists S ⊆ SpecMap(r) such that f (r, S) = 1. On the Complexity of Connectivity in CRNs Through Spectrum Assignment 13 We compute all f (v, S) and g(v, c) by dynamic programming in a bottom- up manner. Initially all values to set to 0. The values for leaf nodes are easy to obtain. Assume we want to compute f (v, S), given that the values of f (v′, S′) and g(v′, c) are all known if v′ is a child of v. Then f (v, S) = 1 if and only if for every child v′ of v, there exists c ∈ S such that g(v′, c) = 1 (in which case v and v′ are connected through channel c). If f (v, S) turns out to be 1, we set g(v, c) to 1 for all c ∈ S. It is easy to see that g(v, c) will be correctly computed after the values of f (v, S) are obtained for all possible S. After all values have been computed, we check whether f (r, S) = 1 for some S ⊆ SpecMap(r). Recall that n = V , k = C, and denote t = maxv∈V SpecMap(v). There are at most n(2t + k) terms to be computed, each of which takes time poly(n, k) by our previous analysis. The final checking step takes 2tpoly(n, k) time. Hence the total running time is 2tpoly(n, k) = 2t(kn)O(1), which is at most 2O(k)nO(1) since t ≤ k. Finally note that it is easy to modify the algorithm so that, given a connectable network it will return a spectrum assignment that makes it connected. ⊓⊔ Corollary 3 The Spectrum Connectivity problem with trees as poten- tial graphs is fixed parameter tractable when parameterized by the number of channels. 5.2 Bounded Treewidth Graphs In this part we deal with another class of potential graphs, namely the class of graphs with bounded treewidth. Our main result is the following theorem, which generalizes Theorem 9 as a tree has treewidth one. Theorem 10 There is an algorithm that, given a cognitive radio network whose potential graph has bounded treewidth, checks whether it is connectable in 2O(k)nO(1) time. Proof Suppose we are given a cognitive radio network I with potential graph G = (V, E), which has treewidth tw = O(1). Let (T = (I, F ), {Xi i ∈ I}) be a nice tree decomposition of G of width tw (see Section 2.2 for the related notions). Recall that T is a rooted binary tree with O(V ) nodes and can be found in polynomial time. Let r be the root of T . For every non-leaf node i of T , let iL and iR be the two children of i. (We can always add dummy leaf-nodes to make every non-leaf node have exactly two children, which at most doubles the size of T .) For each i ∈ I, define Yi := {v ∈ Xj j = i or j is a descendent of i}, and let Ii be a new instance of the problem that is almost identical to I except that we replace the potential graph with G[Yi], i.e., the subgraph of G induced on the vertex set Yi ⊆ V . 14 Hongyu Liang et al. For each i ∈ I, suppose Xi = {v1, v2, . . . , vt} where t = Xi and vj ∈ V for all 1 ≤ j ≤ t. For each tuple (S1, S2, . . . , St) such that Sj ⊆ SpecMap(vj ) for all 1 ≤ j ≤ t, we use a Boolean variable Bi(S1, S2, . . . , St) to indicate whether there exists a spectrum assignment SAi that makes Ii connected such that SAi(vj) = Sj for all 1 ≤ j ≤ t. Notice that for each i, the number of such variables is at most (2k)Xi ≤ 2k·tw, and we can list them in 2O(k·tw) time. Initially all variables are set to FALSE. Assume Xr = {w1, w2, . . . , wXr } (recall that r is the root of T ). Then, clearly, deciding whether I is connectable is equivalent to checking whether there exists (S1, S2, . . . , SXr ), where Sj ⊆ SpecMap(wj) for all 1 ≤ j ≤ Xr, such that Br(S1, S2, . . . , SXr) is TRUE. We will compute the values of all possible Bi(S1, S2, . . . , St) by dynamic programming. For each leaf node l, we can compute the values of all the variables related to Il in time 2O(k·tw)nO(1) by the brute-force approach. Now suppose we want to decide the value of Bi(S1, S2, . . . , SXi) for some non-leaf node i, provided that the variables related to any children of i have all been correctly computed. Recall that iL and iR are the two children of i. We define: -- N EW = Xi \ (YiL ∪ YiR ); -- OLD = Xi \ N EW = Xi ∩ (YiL ∪ YiR); -- ZL = YiL \ Xi, and ZR = YiR \ Xi. It is clear that Yi = N EW ∪ OLD ∪ ZL ∪ ZR. By using the properties of a tree decomposition, we have the following fact: Lemma 2 N EW , ZL, and ZR are three pairwise disjoint subsets of V , and there is no edge of G whose endpoints lie in different subsets. Proof Since N EW ⊆ Xi and ZL = YiL \ Xi, we have N EW ∩ ZL = ∅, and similarly N EW ∩ ZR = ∅. Assume that ZL ∩ ZR 6= ∅, and let v ∈ ZL ∩ ZR. Since ZL ⊆ YiL and ZR ⊆ YiR , we have v ∈ YiL ∩ YiR . By the definition of a tree decomposition, v ∈ Xi, so v ∈ Xi ∩ ZL = Xi ∩ (YiL \ Xi) = ∅, a contradiction. Therefore ZL ∩ ZR = ∅. This proves the pairwise disjointness of the three sets. Now assume that there exists an edge e = (u, v) ∈ E such that u ∈ ZL and v ∈ ZR. Then, by the definition of a tree decomposition, there exists p ∈ I such that {u, v} ⊆ Xp. We know that p 6= i. So there are three possibilities: p lines in the subtree rooted at XiL , or in the subtree rooted at XiR, or it is not in the subtree rooted at Xi. It is easy to verify that, in each of the three cases, we can find a path that connects two tree nodes both containing u (or v) and goes through i, which implies u ∈ Xi or v ∈ Xi by the property of a tree decomposition. This contradicts our previous result. Thus there is no edge with one endpoint in ZL and another in ZR. Similarly, we can prove that there exists no edge with one endpoint in N EW and another in ZL or ZR. This completes the proof of the lemma. ⊓⊔ We now continue the proof of Theorem 10. Recall that we want to decide Bi(S1, S2, . . . , SXi), i.e., whether Ii, the network with G[Yi] as the potential On the Complexity of Connectivity in CRNs Through Spectrum Assignment 15 graph, is connectable under some spectrum assignment SA such that SA(vj) = Sj for all 1 ≤ j ≤ Xi (we assume that Xi = {v1, v2, . . . , vXi}). Note that Yi = N EW ∪ OLD ∪ ZL ∪ ZR. Due to Lemma 2, the three subsets N EW , ZL and ZR can only be connected through OLD (or, we can think OLD as an "intermediate" set). Therefore, for any spectrum assignment SA such that SA(vj) = Sj for all j, Ii is connected under SA if and only if the following three things simultaneously hold: -- G[Xi] is connected under SA; -- BiL (S′ 1, . . . , S′ XiL ) is TRUE for some (S′ XiL ) that accords with (S1, . . . , SXi), i.e., the two vectors coincide on any component correspond- ing to a vertex in Xi ∩ XiL ; 1, . . . , S′ -- BiR(S′ 1, . . . , S′ XiR ) is TRUE for some (S′ XiR ) that accords with (S1, . . . , SXi), i.e., the two vectors coincide on any component correspond- ing to a vertex in Xi ∩ XiR. 1, . . . , S′ The first condition above can be checked in polynomial time, and the last two conditions can be verified in 2O(k·tw)nO(1) time. Thus the time spent on determining Bi(S1, . . . , SXi) is 2O(k·tw)nO(1). After all such terms have been computed, we can get the correct answer by checking whether there ex- ists (S1, . . . , SXr ) such that Br(S1, . . . , SXr) is TRUE, which costs another 2O(k·tw)nO(1) time. Since there are at most O(V ) = O(n) nodes in T , the to- tal running time of the algorithm is 2O(k·tw)nO(1) = 2O(k)nO(1) as tw = O(1). The proof is complete. ⊓⊔ Corollary 4 The Spectrum Connectivity problem on bounded treewidth graphs is fixed parameter tractable when parameterized by the number of chan- nels. 6 Conclusion and Future Work In this paper, we initiate a systematic study on the algorithmic complexity of connectivity problem in cognitive radio networks through spectrum assign- ment. The hardness of the problem in the general case and several special cases are addressed, and exact algorithms are also derived to check whether the network is connectable. In some applications, when the given cognitive radio network is not con- nectable, we may want to connect the largest subset of the secondary users. This optimization problem is NP-hard, since the decision version is already NP-complete on very restricted instances. Thus it is interesting to design poly- nomial time approximation algorithms for this optimization problem. In some other scenarios, we may wish to connect all the secondary users but keep the antenna budget as low as possible. That is, we want to find the smallest β such that there exists a spectrum assignment connecting the graph in which each SU opens at most β channels. It is easy to see that this problem generalizes the minimum-degree spanning tree problem [8], which 16 Hongyu Liang et al. asks to find a spanning tree of a given graph in which the maximum vertex degree is minimized. The latter problem is NP-hard, but there is a polynomial time algorithm that finds a spanning tree of degree at most one more than the optimum [6]. It would be interesting to see whether this algorithm can be generalized to the min-budget version of our connectivity problem, or whether we can at least obtain constant factor approximations. Another meaningful extension of this work is to design distributed algo- rithms to achieve network connectivity. Moreover, due to interference in wire- less communications, the connected nodes using the same channel may not be able to communicate simultaneously. Therefore, it is also interesting to in- vestigate distributed algorithms with channel assignment and link scheduling jointly considered to achieve some network objective such as connectivity and capacity maximization, especially under the realistic interference models. Acknowledgements The authors would like to give thanks to Dr. Thomas Moscibroda at Microsoft Research Asia for his introduction of the original problem. This work was supported in part by the National Basic Research Program of China Grant 2011CBA00300, 2011CBA00302, the National Natural Science Foundation of China Grant 61073174, 61103186, 61202360, 61033001, and 61061130540. References 1. P. Bahl, R. Chandra, T. Moscibroda, R. Murty, and M. Welsh. White space networking with Wi-Fi like connectivity. In ACM SIGCOMM, 2009. 2. H. L. Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput., 25(6):1305 -- 1317, 1996. 3. A. Cayley. A theorem on trees. Quarterly Journal on Pure and Applied Mathematics, 23:376 -- 378, 1889. 4. S. Dolev, S. Gilbert, R. Guerraoui, and C. C. Newport. Gossiping in a multi-channel radio network. In DISC, 2007. 5. R. Downey and M. Fellows. Parameterized Complexity. Springer, 1998. 6. M. Furer and B. Raghavachari. Approximating the minimum-degree steiner tree to within one of optimal. J. Algorithms, 17(3):409 -- 423, 1994. 7. H. Gabow and E. Myers. Finding all spanning trees of directed and undirected graphs. SIAM J. Comput., 7(3):280 -- 287, 1978. 8. M. Garey and D. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman, 1979. 9. J. Hopcroft and R. Karp. An n5/2 algorithm for maximum matchings in bipartite graphs. SIAM J. Comput., 2(4):225 -- 231, 1973. 10. T. Kloks. Treewidth: Computations and Approximations, volume 842 of LNCS. Springer, 1994. 11. F. Kuhn, R. Wattenhofer, and A. Zollinger. Ad hoc networks beyond unit disk graphs. Wireless Netwoks, 14(5):715 -- 729, 2008. 12. X.-Y. Li, P. Yang, Y. Yan, L. You, S. Tang, and Q. Huang. Almost optimal accessing of nonstochastic channels in cognitive radio networks. In IEEE INFOCOM, 2012. 13. H. Liang, T. Lou, H. Tan, Y. Wang, and D. Yu. Complexity of connectivity in cognitive radio networks through spectrum assignment. In ALGOSENSORS'12, volume 7718 of LNCS, pages 108 -- 119, 2013. On the Complexity of Connectivity in CRNs Through Spectrum Assignment 17 14. D. Lu, X. Huang, P. Li, and J. Fan. Connectivity of large-scale cognitive radio ad hoc networks. In IEEE INFOCOM, 2012. 15. W. Ren, Q. Zhao, and A. Swami. Connectivity of cognitive radio networks: Proximity vs. opportunity. In ACM CoRoNet, 2009. 16. W. Ren, Q. Zhao, and A. Swami. Power control in cognitive radio networks: How to cross a multi-lane highway. IEEE JSAC, 27(7):1283 -- 1296, 2009. 17. N. Robertson and P. D. Seymour. Graph minors. ii. algorithmic aspects of treewidth. J. Algorithms, 7:309 -- 322, 1986. 18. A. Shukla. A short proof of Cayley's tree formula. arXiv:0908.2324v2. 19. B. Wang and K. J. R. Liu. Advances in cognitive radio networks: A survey. IEEE J. Selected Topics in Signal Processing, 5(1):5 -- 23, 2011. 20. C. Xu and J. Huang. Spatial spectrum access game: nash equilibria and distributed learning. In ACM MobiHoc, 2012. 21. J. Yu, H. Roh, W. Lee, S. Pack, and D.-Z. Du. Topology control in cooperative wireless ad-hoc networks. IEEE JSAC, 30(9):1771 -- 1779, 2012. 22. Y. Yuan, P. Bahl, R. Chandra, T. Moscibroda, and Y. Wu. Allocating dynamic time- spectrum blocks in cognitive radio networks. In ACM MobiCom, 2007. 23. X. Zhou, S. Gandhi, S. Suri, and H. Zheng. ebay in the sky: Strategyproof wireless spectrum auctions. In ACM MobiCom, 2008.
1612.06016
1
1612
2016-12-19T00:52:17
A Characterization of Constant-Sample Testable Properties
[ "cs.DS" ]
We characterize the set of properties of Boolean-valued functions on a finite domain $\mathcal{X}$ that are testable with a constant number of samples. Specifically, we show that a property $\mathcal{P}$ is testable with a constant number of samples if and only if it is (essentially) a $k$-part symmetric property for some constant $k$, where a property is {\em $k$-part symmetric} if there is a partition $S_1,\ldots,S_k$ of $\mathcal{X}$ such that whether $f:\mathcal{X} \to \{0,1\}$ satisfies the property is determined solely by the densities of $f$ on $S_1,\ldots,S_k$. We use this characterization to obtain a number of corollaries, namely: (i) A graph property $\mathcal{P}$ is testable with a constant number of samples if and only if whether a graph $G$ satisfies $\mathcal{P}$ is (essentially) determined by the edge density of $G$. (ii) An affine-invariant property $\mathcal{P}$ of functions $f:\mathbb{F}_p^n \to \{0,1\}$ is testable with a constant number of samples if and only if whether $f$ satisfies $\mathcal{P}$ is (essentially) determined by the density of $f$. (iii) For every constant $d \geq 1$, monotonicity of functions $f : [n]^d \to \{0, 1\}$ on the $d$-dimensional hypergrid is testable with a constant number of samples.
cs.DS
cs
A Characterization of Constant-Sample Testable Properties Eric Blais∗ Yuichi Yoshida† David R. Cheriton School of Computer Science National Institute of Informatics and University of Waterloo [email protected] Preferred Infrastructure, Inc. [email protected] April 23, 2018 Abstract We characterize the set of properties of Boolean-valued functions on a finite domain X that are testable with a constant number of samples. Specifically, we show that a property P is testable with a constant number of samples if and only if it is (essentially) a k-part symmetric property for some constant k, where a property is k-part symmetric if there is a partition S1, . . . , Sk of X such that whether f : X → {0, 1} satisfies the property is determined solely by the densities of f on S1, . . . , Sk. We use this characterization to obtain a number of corollaries, namely: • A graph property P is testable with a constant number of samples if and only if whether a graph G satisfies P is (essentially) determined by the edge density of G. • An affine-invariant property P of functions f : Fn p → {0, 1} is testable with a constant number of samples if and only if whether f satisfies P is (essentially) determined by the density of f . • For every constant d ≥ 1, monotonicity of functions f : [n]d → {0, 1} on the d-dimensional hypergrid is testable with a constant number of samples. 1 Introduction Property testing [22, 17] is concerned with the general question: for which properties of combi- natorial objects can we efficiently distinguish the objects that have the property from those that are "far" from having the same property? Consideration of this question has led to surprisingly powerful results: many natural graph properties [17, 2], algebraic properties of functions on finite fields [22, 27], and structural properties of Boolean functions [12, 10], for example, can be tested with a constant number of queries to the object being tested. Nearly all of these results appear to rely critically on the testing algorithm's ability to query the unknown object at locations of its choosing. The goal of the present work is to determine to what extent this is actually the case: is it possible that some (or most!) of these properties can still be tested efficiently even if the tester has no control over the choice of queries that it makes? ∗Supported by an NSERC Discovery Grant †Supported by JSPS Grant-in-Aid for Young Scientists (B) (No. 26730009), MEXT Grant-in-Aid for Scientific Research on Innovative Areas (24106003), and JST, ERATO, Kawarabayashi Large Graph Project. 1 Our main question is made precise in the sample-based property testing model originally intro- duced by Goldreich, Goldwasser, and Ron [17]. For a finite set X , let {0, 1}X denote the set of Boolean-valued functions on X endowed with the normalized Hamming distance metric d(f, g) := {x ∈ X : f (x) 6= g(x)}/X . A property of functions mapping X to {0, 1} is a subset P ⊆ {0, 1}X . A function is ǫ-close to P if it is in the set Pǫ := {f ∈ {0, 1}X : ∃g ∈ P s.t. d(f, g) ≤ ǫ}; otherwise, it is ǫ-far from P. An s-sample ǫ-tester for a property P is a randomized algorithm with bounded error that observes s pairs (x1, f (x1)), . . . , (xs, f (xs)) ∈ X × {0, 1} with x1, . . . , xs drawn indepen- dently and uniformly at random from X and then accepts when f ∈ P and rejects when f is ǫ-far from P. The sample complexity of P for some ǫ > 0 is the minimum value of s such that it has an s-sample ǫ-tester. When the sample complexity of P is independent of the domain size X of the functions for every ǫ > 0, we say that P is constant-sample testable. In the 20 years since the original introduction of the sample-based property testing model, a number of different properties have been shown to be constant-sample testable, including all symmetric properties (folklore; see the discussion in [19]), unions of intervals [20], decision trees over low-dimensional domains [20], and convexity of images [21, 5]. Conversely, many other properties, such as monotonicity of Boolean functions [16], linearity [3, 18], linear threshold functions [4], and k-colorability of graphs [18], are known to not be constant-sample testable. Yet, despite a wide- spread belief that most properties are not testable with a constant number of samples, it remained open until now to determine whether this is actually the case or not. Our main result settles this question, and in the process unifies all of the above results and explains what makes various properties testable with a constant number of samples or not. 1.1 Main result We show that constant-sample testability is closely tied to a particular notion of symmetry-or invariance-of properties. Let SX denote the set of permutations on a finite set X , and for any subset S ⊆ X , let S (S) denote the set of permutations on X that preserves the elements in S. X A permutation π ∈ SX acts on functions f : X → {0, 1} in the obvious way: πf is the function that satisfies (πf )(x) = f (πx) for every x ∈ X . The property P ⊆ {0, 1}X is invariant under a permutation π ∈ SX if for every f ∈ P, we also have πf ∈ P. P is (fully) symmetric if it is invariant under all permutations in SX . The following definition relaxes this condition to obtain a notion of "partial" symmetry. Definition 1. For any k ∈ N, the property P ⊆ {0, 1}X is k-part symmetric if there is a partition of X into k parts X1, . . . , Xk such that P is invariant under all the permutations in SX1 × · · · × SXk , where SXi is the set of permutations over X that preserves elements in Xi. Equivalently, P is k-part symmetric if there exists a partition X1, . . . , Xk of X such that the event f ∈ P is completely determined by the density f −1(1)∩Xi of f in each of the sets X1, . . . , Xk. Our main result shows that O(1)-part symmetry is also essentially equivalent to constant-sample testability. Xi Theorem 1. The property P of a function f : X → {0, 1} is constant-sample testable if and only if for any ǫ > 0, there exists a constant k = kP (ǫ) that is independent of X and a k-part symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. In words, Theorem 1 says that constant-sample testable properties are the properties P that can be covered by some O(1)-part symmetric property P ′ that does not include any function that 2 is ǫ-far from P. Note that this characterization cannot be replaced with the condition that P itself is k-part symmetric. To see this, consider the function non-identity property NotEq(g) that includes every function except some non-constant function g : X → {0, 1}. This property is not k-part symmetric for any k = O(1), but the trivial algorithm that accepts every function is a valid ǫ-tester for NotEq(g) for any constant ǫ > 0. Theorem 1 can easily be generalized to apply to properties of functions mapping X to any finite set Y. We restrict our attention to the range Y = {0, 1} for simplicity and clarity of presentation. The sample-based property testing model is naturally extended to non-uniform distributions over the input domain. It appears likely that Theorem 1 can be generalized to this more general setting as well, though we have not attempted to do so. The proof of Theorem 1 follows the general outline of previous characterizations of the properties testable in the query-based model (e.g., [2, 27, 6]). As with those results, the most interesting part of the proof is the direction showing that constant-sample testability implies coverage by an O(1)- part symmetric property, and this proof is established with a regularity lemma. Our proof departs from previous results in both the type of regularity lemma that we use and in how we use it. For a more detailed discussion of the proof, see Section 2.1. 1.2 Applications The characterization of constant-sample testability in Theorem 1 can be used to derive a number of different corollaries. We describe a few of these. When X is identified with the (cid:0)n 2(cid:1) pairs of vertices in V , the function f : X → {0, 1} represents a graph G = (V, E) where E = f −1(1). A graph property is a property of these functions that is invariant under relabelling of the vertices. Observant readers will have noted that no non- symmetric graph property was present in the list of properties that have been determined to be constant-sample testable. Using Theorem 1, we can show that this is unavoidable: the only graph properties that are constant-sample testable are those that are (essentially) fully symmetric. Corollary 1. For every ǫ > 0, if P is a graph property that is ǫ-testable with a constant number of samples, then there is a symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. When X is identified with a finite field Fn invariant under any affine transformation over Fn properties are essentially the only constant-sample testable affine-invariant properties. p , a property P ⊆ {0, 1}X is affine-invariant if it is p . Theorem 1 can be used to show that symmetric Corollary 2. For every ǫ > 0, if P is an affine-invariant property of functions f : Fn p → {0, 1} that is ǫ-testable with a constant number of samples, then there is a symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. These two corollaries show that Theorem 1 can be used to show that some properties are In our third application, we show that the other direction of the not constant-sample testable. characterization can also be used to show that some properties are constant-sample testable. Fix a constant d ≥ 1. Two points x, y ∈ [n]d := {1, 2, . . . , n}d satisfy x (cid:22) y when x1 ≤ y1, . . ., and xd ≤ yd. The function f : [n]d → {0, 1} is monotone if for every x (cid:22) y ∈ [n]d, we have f (x) ≤ f (y). When d = 1, it is folklore knowledge that monotonicity of Boolean-valued functions on the line is constant-sample testable. Using Theorem 1, we give an easy proof showing that the same holds for every other constant dimension d. 3 Corollary 3. For every constant d ≥ 1 and constant ǫ > 0, we can ǫ-test monotonicity of functions f : [n]d → {0, 1} on the d-dimensional hypergrid with a constant number of samples. Chen, Servedio, and Tan [8] showed that the number of queries (and thus also of samples) required to test monotonicity of f : [n]d → {0, 1} must depend on d. (The same result for the case where n = 2 was first established by Fischer et al. [14].) Combined with the result above, this shows that monotonicity of Boolean-valued functions on the hypergrid is constant-sample testable if and only if the number of dimensions of the hypergrid is constant. 1.3 Related work Sample-based property testing. The first general result regarding constant-sample testable properties goes back to the original work of Goldreich, Goldwasser, and Ron [17]. They showed that every property with constant VC dimension (and, more generally, every property that corresponds to a class of functions that can be properly learned with a constant number of samples) is constant- sample testable. As they also show, this condition is not necessary for constant-sample testability- in fact, there are even properties that are testable with a constant number of samples whose corresponding class require a linear number of samples to learn [17, Prop. 3.3.1]. More general results on sample-based testers were obtained by Balcan et al. [4]. In particular, they defined a notion of testing dimension of a property P in terms of the total variation distance between the distributions on the tester's observations when a function is drawn from distributions πyes and πno essentially supported on P and Pǫ, respectively. They show that this testing dimension captures the sample complexity of P up to constant factors, and observe that it can be interpreted as an "average VC dimension"-type of complexity measure. It would be interesting to see whether the combinatorial characterization in Theorem 1 could be combined with these results to offer new insights into the connections between invariance and VC dimension-like complexity measures. Finally, Goldreich and Ron [18] and Fischer et al. [11, 13] established connections between the query- and sample-based models of property testing giving sufficient conditions for sublinear -sample testability of properties. The exact bounds between sample complexity and partial symmetry in the proof of Theorem 1 yield another sufficient condition for sublinear-sample testability: every property P that can be ǫ-covered by an o(log log X )-part symmetric function P ′ has sublinear sample complexity o(X ). As far as we can tell, these two characterizations are incomparable. Symmetry and testability. The present work was heavily influenced by the systematic ex- ploration of connections between the invariances of properties and their testability initiated by Kaufman and Sudan [19]. (See also [24].) In that work, the authors showed that such connections yield new insights into the testability of algebraic properties in the query-based property testing model, and advocated for further study of the invariance of properties as a means to better un- derstand their testability. Theorem 1 provides evidence that this approach is a critical tool in the study of sample-based property testing model as well. The notion of partial symmetry and its connections to computational efficiency has a long history-it goes back at least to the pioneering work of Shannon [23]. Partial symmetry also ap- peared previously in a property testing context in the authors' joint work with Amit Weinstein on characterizing the set of functions for which isomorphism testing is constant-query testable [7]. However, it should be noted that the notion of partial symmetry considered in [7] does not cor- respond to the notion of k-part symmetry studied here. In fact, as mentioned in the conference 4 version of that paper, there are 2-part symmetric functions for which isomorphism testing is not constant-query testable, so the two characterizations inherently require different notions of partial symmetry. 1.4 Organization The proof of Theorem 1 is presented in Section 2. The proofs of the application results are in Section 3. Finally, since the weak regularity lemma that we use in the proof of Theorem 1 is not completely standard, we include its proof in Section 4 for completeness. 2 Proof of Theorem 1 We prove the two parts (sufficiency and necessity) of Theorem 1 in Sections 2.2 and 2.3, respectively. But first, we provide a high-level overview of the proof and discuss the connections with regularity lemmas in Section 2.1. 2.1 Overview of the proof Symmetry implies testability. The proof of this direction of the theorem is straightforward and is obtained by generalizing the following folklore proof that symmetric properties can be tested with a constant number of samples. Let P be any symmetric property. A tester can estimate the density Ex∈X [f (x)] up to additive accuracy γ for any small γ > 0 with a constant number of samples. This estimated density can be used to accept or reject the function based on how close it is to the density of the functions in P. The validity of this tester is established by showing that a function can be ǫ-far from P only when its density is far from the density of every function in P. Consider now a property P that is k-part symmetric for some constant k. Let X1, . . . , Xk be a partition of X associated with P. We show that a tester which estimates the densities µi(f ) := Ex∈Xi[f (x)] for each i = 1, . . . , k and then uses these densities to accept or reject is a valid tester for P. We do so by showing that any function that is ǫ-far from P must have a density vector that is far from those of every function in P. Testability implies symmetry. To establish the second part of the theorem, we want to show that the existence of a constant-sample tester T for a property P implies that there is a partition of X into a constant number of parts for which P is nearly determined by the density of functions within those parts. We do so by using a variant of the Frieze–Kannan weak regularity lemma [15] for hypergraphs. An s-uniform weighted hypergraph is a hypergraph G = (V, E) on V vertices where E : V s → [0, 1] denotes the weight associated with each hyperedge. Given a partition V1, . . . , Vk of V and a multi-index I = (i1, . . . , is) with i1, . . . , is ∈ [k], the expected weight of hyperedges of G in VI is wG(VI ) = wG(Vi1, . . . , Vis) = {E(v1, . . . , vs) : v1 ∈ Vi1, . . . , vs ∈ Vis}/Qi∈I Vi. Furthermore, for any subset S ⊆ V , we define S ∩ VI = (S ∩ Vi1, . . . , S ∩ Vis). Lemma 1 (Weak regularity lemma). For every ǫ > 0 and every s-uniform weighted hypergraph G = (V, E), there is a partition V1, . . . , Vk of V with k = 2O(log( 1 ǫ )/ǫ2) parts such that for every subset S ⊆ V , (1) Qi∈I S ∩ Vi V s X I∈[k]s (cid:12)(cid:12)wG(S ∩ VI ) − wG(VI )(cid:12)(cid:12) ≤ ǫ. 5 This specific formulation of the weak regularity lemma seems not to have appeared previously in the literature, but its proof is essentially the same as that of usual formulations of the weak regularity lemma. For completeness, we provide a proof of Lemma 1 in Section 4. Lemma 1 is best described informally when we consider the special case where we consider unweighted graphs. In this setting, the weak regularity lemma says that for every graph G, there is a partition of the vertices of G into k = O(1) parts V1, . . . , Vk such that for every subset S of vertices, the density of edges between S ∩ Vi and S ∩ Vj is close to the density between Vi and Vj on average over the choice of Vi and Vj. Regularity lemmas where this density-closeness condition is satisfied for almost all pairs of parts Vi and Vj are known as "strong" regularity lemmas. To the best of our knowledge, all previous characterization results in property testing that relied on regularity lemmas (e.g., [2, 27, 6]) used strong regularity lemmas. This approach unavoidably introduces tower-type dependencies between the query complexity and the characterization parameters. By using a weak regularity lemma instead, we get a much better (though still doubly-exponential) dependence between the sample complexity and the partial symmetry parameter. The second point of departure of our proof from previous characterizations is in how we use the regularity lemma. In the prior work, the regularity lemma was applied to the tested object itself (e.g., the dense graphs being tested in [2]) and the testability of the property was used to show that the objects with the given property could be described by some combinatorial characteristics related to the regular partition whose existence is promised by the regularity lemma. Instead, in our proof of Theorem 1, we apply Lemma 1 to a hypergraph associated with the tester itself, not with the tested object. Specifically, let T be an s-sample ǫ-tester for some property P ⊆ {0, 1}X . We associate T with an s-uniform weighted hypergraph GT on the set of vertices X × {0, 1}. The weight of each s-hyperedge of GT is the acceptance probability of T when its s observations correspond to the s vertices covered by the hyperedge. By associating each function f : X → {0, 1} with the subset S ⊆ X × {0, 1} that includes all 2X vertices of the form (x, f (x)), we see that the probability that T accepts f is the expected value of a hyperedge whose s vertices are drawn uniformly and independently at random from the set S. We can use Lemma 1 to show that there is a partition of V into a constant number of parts such that for each function f with associated set S, this probability is well approximated by some function of the density of S in each of the parts. We then use this promised partition of V to partition the original input domain X into a constant number of parts where membership in P is essentially determined by the density of a function in each of these parts, as required. 2.2 Proof that symmetry implies testability We now begin the proof of Theorem 1 with the easy direction. Lemma 2. Let P ⊆ {0, 1}X be a property where for every ǫ > 0, there exists a constant k = kP (ǫ) that is independent of X and a k-part symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. Then P is constant-sample testable. Proof. Fix ǫ > 0. We show that we can distinguish functions in P from functions that are ǫ-far from P with a constant number of samples. From the condition in the statement of the lemma, there exists a k-part symmetric property P ′ with P ⊆ P ′ ⊆ Pǫ/2 for some k = kP (ǫ/2). Let S1, . . . , Sk be a partition of X such that whether a function f : X → {0, 1} satisfies P ′ is determined by µS1(f ), . . . , µSk (f ). For a set S ⊆ X , let cS(f ) = µS(f )S be the number of x ∈ S with f (x) = 1. 6 Our algorithm for testing P is as follows. For each i ∈ [k], we draw q := O(k2 log k/ǫ2) samples f (xj) for each i ∈ [k]. We accept x1, . . . , xq and computes the estimates ecSi(f ) := X if there exists g ∈ P ′ such that q Pj∈[q]:xj∈Si X i∈[k] ecSi(f ) − cSi(g) < ǫ 4 X , and reject otherwise. Let us now establish the correctness of the algorithm. By Hoeffding's bound, for each i ∈ [k], 3k by choosing the hidden constant in the definition of q sufficiently large. By union bound, with probability at least 2/3, we have we have cSi(f ) −ecSi(f ) < ǫ cSi(f ) −ecSi(f ) < ǫ If f ∈ P, then the algorithm accepts f because Pi∈[k] ecSi(f ) − cSi(f ) < ǫ 4 X and f ∈ P ⊆ P ′. If f is ǫ-far from satisfying P, then for any g ∈ P ′, the triangle inequality and the fact that 4k X for every i ∈ [k]. In what follows, we assume this happens. 4k X with probability at least 1 − 1 P ′ ⊆ Pǫ/2 imply that X i∈[k] ecSi(f ) − cSi(g) ≥ X i∈[k] (cid:16)cSi(f ) − cSi(g) − ecSi(f ) − cSi(f )(cid:17) > ǫ 2 X − ǫ 4 X = ǫ 4 X and, therefore, the algorithm rejects f . 2.3 Testability implies symmetry Suppose that a property P is testable by a tester T with sample complexity s. We want to show that for any ǫ > 0, there exists a k-part symmetric property P ′ for k = k(ǫ) such that P ⊆ P ′ ⊆ Pǫ For any x = (x1, . . . , xs) ∈ X s, we define f (x) = (cid:0)f (x1), . . . , f (xs)(cid:1) and we let T (x, f (x)) ∈ [0, 1] denote the acceptance probability of the tester T of f when the samples drawn are x. The overall acceptance probability of f by T is pT (f ) = E [T (x, f (x))]. x (2) We show that there is a family S of a constant number of subsets of X such that, for every function f : X → {0, 1}, the acceptance probability pT (f ) is almost completely determined by the density of f on the subsets in S. Lemma 3. For any ǫ > 0 and any s-sample tester T , there is a family S = {S1, . . . , Sm} of m ≤ 2O(22s/ǫ2) subsets of X such that for every f : X → {0, 1}, (cid:12)(cid:12)pT (f ) − ϕT (µS1(f ), . . . , µSm(f ))(cid:12)(cid:12) ≤ ǫ where µS(f ) = Ex∈S[f (x)] is the density of f on the subset S ⊆ X and ϕT : [0, 1]m → [0, 1] is some fixed function. Proof. We consider the weighted hypergraph G = (V, E) where V = X ×{0, 1} and E is constructed by adding a hyperedge ((x1, y1), . . . , (xs, ys)) of weight T (x, y) for each x = (x1, . . . , xs) ∈ X s and y = (y1, . . . , ys) ∈ {0, 1}s. 7 A function f : X → {0, 1} corresponds to a subset S ⊆ V of size X = V /2, that is, S := {(x, f (x)) x ∈ X }. The probability that T accepts f is pT (f ) = E x∈X s [T (x, f (x))] = E v∈V s [E(v) v ∈ Ss] = X Qi∈I Vi ∩ S Ss wG(S ∩ VI ) = X I∈[k]s 2sQi∈I Vi ∩ S V s wG(S ∩ VI ) = X I∈[k]s I∈[k]s 2sQi∈I Vi ∩ S V s wG(VI ) ± ǫ where the last step is by Lemma 1 applied with approximation parameter ǫ/2s. For every part Vi, let V 1 i = {x ∈ X : (x, 0) ∈ Vi}. Then the value of k , V 0 k . w(VI ) is completely determined by the density of f on V 1 i = {x ∈ X : (x, 1) ∈ Vi} and let V 0 2 , . . . , V 1 1 , V 1 1 , V 0 2 , V 0 PI∈[k]s 2s Qi∈I Vi∩S V s We are now ready to complete the second part of the proof of Theorem 1. Lemma 4. Let P ⊆ {0, 1}X be constant-sample testable. Then for every ǫ > 0, there exists a constant k = kP (ǫ) that is independent of X and a k-part symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. Proof. Fix any ǫ > 0 and let T be an s-sample ǫ-tester for P. Let γ < 1 less than 1 m = 2O(22s/γ2) sets such that for every f : X → {0, 1}, 3 be any constant that is 3 . By Lemma 3 applied with the parameter γ, there is a family S = {S1, . . . , Sm} with pT (f ) − ϕT (µS1(f ), . . . , µSk (f )) ≤ γ. (3) Define P ′ = {f : X → {0, 1} : ∃g ∈ P s.t. (µS1(f ), . . . , µSk (f )) = (µS1(g), . . . , µSk (g))}. This construction trivially guarantees that P ′ ⊇ P. Furthermore, (3) guarantees that for every f ∈ P ′, if we let g ∈ P be one of the elements with the same density profile as f , pT (f ) ≥ ϕT (µS1(f ), . . . , µSk (f )) − γ = ϕT (µS1(g), . . . , µSk (g)) − γ ≥ pT (g) − 2γ. Since γ < 1/3, the fact that T is an ǫ-tester for P and that g ∈ P imply that f ∈ Pǫ. Let S′ 1, . . . , S′ S1, . . . , Sm. Note that S′ , . . . , µS′ by µS′ the partition S′ k be the family of sets obtained by taking intersections and complements of k forms a partition of X and µS1, . . . , µSm is completely determined . Furthermore, k = O(2m). Hence, P ′ is a k-part symmetric property induced by 1, . . . , S′ k with P ⊆ P ′ ⊆ Pǫ. 1, . . . , S′ k 1 Theorem 1 follows immediately from Lemmas 2 and 4. 3 Applications 3.1 Affine-invariant properties For an affine transformation A : Fn to be the function that satisfies Af (x) = f (Ax) for every x ∈ Fn p and a function f : Fn p → Fn p → {0, 1}, we define Af : Fn p → {0, 1} p . A property P of functions 8 p → {0, 1} is affine-invariant if for any affine transformation A : Fn f : Fn p and f ∈ P, we have Af ∈ P. Our characterization shows that the only affine-invariant properties of functions f : Fn p → {0, 1} that are testable with a constant number of samples are the (fully symmetric) properties that are determined by the density of f . Corollary 2 (Restated). For every ǫ > 0, if P is an affine-invariant property of functions f : Fn p → {0, 1} that is ǫ-testable with a constant number of samples, then there is a symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. p → Fn Proof. By Theorem 1, if P is testable with O(1) samples, then there are subsets S1, . . . , Sk of p with k = O(1) and a property P ′′ such that P ⊆ P ′′ ⊆ Pǫ and P ′′ is invariant under all Fn permutations of S1, . . . , Sk. Let P ′ be the closure of P ′′ under all affine transformations over Fn p . (I.e., P ′ = {Af : f ∈ P ′′, A is affine}.) Since P itself is invariant under affine transformations, we have that P ′ ⊆ Pǫ. We want to show that P ′ is symmetric. To show this, it suffices to show that p and f ∈ P ′, the function g obtained P ′ is closed under transpositions. I.e., that for every x, y ∈ Fn by setting g(x) = f (y), g(y) = f (x), and g(z) = f (z) for every other z /∈ {x, y} is also in P ′. We write g = (x y)f to denote the action of the transposition (x y) on f . If x, y ∈ Si for some i ∈ [k], then our conclusion follows immediately from the invariance of P ′′ over permutations on Si. Otherwise, let w, z ∈ Sj for some j ∈ [k]. Since the set of affine transformations is a doubly-transitive action on Fn p , there is a transformation A such that A(x) = w and A(y) = z. Then (x y)f = A−1(w z)Af ∈ P ′, as we wanted to show. 3.2 Graph properties Similarly, our characterization shows that the only graph properties that are testable with a constant number of samples are the (fully symmetric) properties that are determined by the edge density of the graph. Corollary 1 (Restated). For every ǫ > 0, if P is a graph property that is ǫ-testable with a constant number of samples, then there is a symmetric property P ′ such that P ⊆ P ′ ⊆ Pǫ. Proof. The proof is nearly identical. By Theorem 1, if P is testable with O(1) samples, then there are subsets S1, . . . , Sk of the edge set with k = O(1) and a property P ′′ such that P ⊆ P ′′ ⊆ Pǫ and P ′′ is invariant under all permutations of S1, . . . , Sk. Let P ′ be the closure of P ′′ under all permutations of the vertex set. We again have that P ⊆ P ′ ⊆ Pǫ and we want to show that P ′ is invariant under every transposition of the edge set. The one change with the affine-invariant property proof is that the set of permutations of the vertices of a graph is not a 2-transitive action on the set of edges of this graph. But the same idea still works because we can always find a vertex permutation to send two edges on disjoint vertices to a same part Si that also contains a pair of edges on disjoint vertices, and we can find a vertex permutation to send two edges that share a common vertex to a part Sj that also contains two edges that share a common vertex. So for every pair of edges e1, e2, we have a vertex permutation πV and a pair of edges e3, e4 ∈ Sℓ such that if G ∈ P ′, then (e1 e2)G = π −1 V (e3 e4)πV G ∈ P ′. 3.3 Testing monotonicity With Theorem 1, to show that monotonicity of functions f : [n]d → {0, 1} is constant-sample testable, it suffices to identify an O(1)-part symmetric function that covers all the monotone func- tions and does not include any function that is far from monotone. This is what we do below. 9 Corollary 3 (Restated). For every constant d ≥ 1 and constant ǫ > 0, we can ǫ-test monotonicity of functions f : [n]d → {0, 1} on the d-dimensional hypergrid with a constant number of samples. Proof. For any ǫ > 0, fix k = ⌈d/ǫ⌉ and let R be a partition of the space [n]d into kd subgrids of side length (at most) ⌊ǫn⌋ each. We identify the parts in R with the points in [k]d. For an input x ∈ [n]d, let φR(x) denote the part of R that contains x. Given some function f : [n]d → {0, 1}, define the R-granular representation of f to be the function fR : [k]d → {0, 1, ∗} defined by fR(x) =   0 if ∀y ∈ [n]d with φR(y) = x, f (y) = 0 1 if ∀y ∈ [n]d with φR(y) = x, f (y) = 1 ∗ otherwise. Let P = {f : [n]d → {0, 1} : ∃ monotone g s.t. fR = gR} be the property that includes every function whose R-granular representation equals that of a monotone function. By construction P includes all the monotone functions and is invariant under any permutations within the O(1) parts of R. To complete the proof of the theorem, we want to show that every function in P is ǫ-close to monotone. Fix any f ∈ P and let g : [n]d → {0, 1} be a monotone function for which fR = gR. The distance between f and g is bounded by d(f, g) ≤ g−1 R (∗) kd . Now consider the poset P on [k]d where x ≺ y iff xi < yi for every i ∈ [d]. We first observe that the set g−1 R (∗) forms an anti-chain on this poset. Indeed, if there exist x, y ∈ [k]d with x ≺ y and g(x) = g(y) = ∗, then there exist x′, y′ ∈ [n]d such that φR(x′) = x, φR(y′) = y, g(x′) = 1, and g(y′) = 0. But this contradicts the monotonicity of g because x′ ≤ y′ holds from x ≺ y. For x ∈ [k]d, let xmax = maxi∈[d] xi and xmin = mini∈[d] xi. Define 1 = (1, 1, 1, . . . , 1) ∈ [k]d and S = {x ∈ [k]d : xmin = 1}. We can partition [k]d into S = kd − (k − 1)d ≤ dkd−1 chains (x, x + 1, x + 2 · 1, . . . , x + (xmax − 1) · 1), one for each x ∈ S. Therefore, by Dilworth's theorem, every anti-chain on P has size at most dkd−1. In particular, this bound holds for the anti-chain g−1(∗) so d(f, g) ≤ dkd−1 kd = d k ≤ ǫ. 4 Proof of the weak regularity lemma 4.1 Information theory The proof we provide for Lemma 1 is information-theoretic. In this section, we will use bold fonts to denote random variables. We assume that the reader is familiar with the basic concepts of entropy and mutual information; a good introduction to these definitions is [9]. The only facts we use about these concepts is the chain rule for mutual information and the fact that the entropy of a random variable is at most the logarithm of the number of values it can take. The one non-basic information-theoretic inequality that we use in the proof is an inequality established by Tao [25] and later refined by Ahlswede [1]. 10 Lemma 5 (Tao [25], Ahlswede [1]). Let y, z, and z′ be discrete random variables where y ∈ [−1, 1] and z′ = φ(z) for some function φ. Then Eh(cid:12)(cid:12) E[y z′] − E[y z](cid:12)(cid:12)i ≤ p2 ln 2 · I(y; z z′). Tao originally used his inequality to offer an information-theoretic proof of Szemer´edi's (strong) Regularity Lemma. The proof we offer below follows (a simplified version of) the same approach. The fact that Tao's proof of the strong regularity lemma can also be applied (with simplifications) to prove the Frieze–Kannan weak regularity lemma was observed previously by Trevisan [26]. 4.2 Proof of Lemma 1 For τ > 0, we say that a hypergraph is τ -granular if the weight of each hyperedge is a multiple of τ . When proving Lemma 1, we can assume that the given graph is τ -granular for τ = Θ(ǫ). To see this, let G′ = (V, E′) be the hypergraph obtained from G = (V, E) by rounding the weight of each hyperedge to a multiple of τ . Then, for any set S ⊆ V and a partition V1, . . . , Vk of V , we have Qi∈I S ∩ Vi V s X I∈[k]s wG(S ∩ VI ) − wG(VI ) = X = X I∈[k]s I∈[k]s V s Qi∈I S ∩ Vi Qi∈I S ∩ Vi V s (wG′(S ∩ VI ) ± τ ) − (wG′(VI ) ± τ ) wG′(S ∩ VI ) − wG′(VI ) ± 2τ. In order to make the right-hand side less than ǫ, it suffices to show that the claim of Lemma 1 holds for ǫ/3-granular hypergraphs with an error parameter ǫ/3. In what follows, we assume the input graph G is ǫ/3-granular. Let V1, . . . , Vℓ be any partition of V . Draw v ∈ V s uniformly at random. Define y = E(v). Let ψ : V s → [ℓ]s be the function that identifies the parts containing each of s vertices. For any set S ⊆ V , let 1S : V s → {0, 1}s be the indicator function of S for s-tuples of vertices. Define zS = (ψ(v), 1S (v)) and z′ = ψ(v). We consider two cases. First, consider the situation where for every set S ⊆ V , I(y; zS z′) ≤ (ǫ/3)2 2 ln 2 . (4) Then by Tao's lemma, for every set S we also have X I∈[k]s,b∈{0,1}s Qj∈[s] Sbj ∩ Vij V s wG(Sb ∩ VI ) − wG(VI ) = E[E(v) ψ(v)] − E[E(v) ψ(v), 1S (v)] = E[y z′] − E[y zS] ≤ ǫ/3. And clearly Qj∈[s] S ∩ Vij V s X I∈[k]s wG(S ∩ VI) − wG(VI ) ≤ X I∈[k]s,b∈{0,1}s Qj∈[s] Sbj ∩ Vij V s wG(Sb ∩ VI ) − wG(VI ) since the expression in the left-hand side is one of the terms in the sum (over b) on the right-hand side. So in this case the lemma holds. 11 Second, we need to consider the case where there is some set S ⊆ V for which I(y; zS z′) > (ǫ/3)2 2 ln 2 . (5) Then by the chain rule for mutual information I(y; zS ) = I(y; z′) + I(y; zS z′) ≥ I(y; z′) + (ǫ/3)2 2 ln 2 . Define the information value of a partition with indicator function ψ as I(E(v); ψ(v)). Then the above observation shows that when (5) holds, we can obtain a refined partition with 2ℓ parts whose information value increases by at least (ǫ/3)2 2 ln 2 . The information value of any partition is bounded above by H(y), so after at most 2 ln 2·H(y) refinements, we must obtain a partition (with at most (ǫ/3)2 2 ln 2·H(y) (ǫ/3)2 2 lemma follows. parts) that satisfies (4). Since G is ǫ/3-granular, we have H(y) = O(log(1/ǫ)), and the References [1] Rudolf Ahlswede. The final form of Tao's inequality relating conditional expectation and conditional mutual information. Advances in Mathematics of Communications, 1(2):239–242, 2007. [2] Noga Alon, Eldar Fischer, Ilan Newman, and Asaf Shapira. A combinatorial characterization It's all about regularity. SIAM Journal on Computing, of the testable graph properties: 39(1):143–167, 2009. [3] Noga Alon, Rani Hod, and Amit Weinstein. On active and passive testing. Combinatorics, Probability and Computing, 25(1):1–20, 2016. [4] Maria-Florina Balcan, Eric Blais, Avrim Blum, and Liu Yang. Active property testing. Pro- ceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 21–30, 2012. [5] Piotr Berman, Meiram Murzabulatov, and Sofya Raskhodnikova. Tolerant testers of image properties. In Proceedings of the 43rd International Colloquium on Automata, Languages, and Programming (ICALP), pages 90:1–90:14, 2016. [6] Arnab Bhattacharyya and Yuichi Yoshida. An algebraic characterization of testable Boolean In Proceedings of the 40th International Colloquium Conference on Automata, Lan- CSPs. guages, and Programming (ICALP), pages 123–134, 2013. [7] Eric Blais, Amit Weinstein, and Yuichi Yoshida. Partially symmetric functions are efficiently isomorphism testable. SIAM Journal on Computing, 44(2):411–432, 2015. [8] Xi Chen, Rocco A Servedio, and Li-Yang Tan. New algorithms and lower bounds for monotonic- ity testing. In Proceedings of the 55th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 286–295, 2014. 12 [9] Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012. [10] Ilias Diakonikolas, Homin K. Lee, Kevin Matulef, Krzysztof Onak, Ronitt Rubinfeld, Rocco A. Servedio, and Andrew Wan. Testing for concise representations. In Proc. 48th Symposium on Foundations of Computer Science, pages 549–558, 2007. [11] Eldar Fischer, Yonatan Goldhirsh, and Oded Lachish. Partial tests, universal tests and de- composability. In Proceedings of the 5th Conference on Innovations in Theoretical Computer Science (ITCS), pages 483–500, 2014. [12] Eldar Fischer, Guy Kindler, Dana Ron, Shmuel Safra, and Alex Samorodnitsky. Testing juntas. J. Comput. Syst. Sci., 68(4):753–787, 2004. [13] Eldar Fischer, Oded Lachish, and Yadu Vasudev. Trading query complexity for sample-based testing and multi-testing scalability. In Proceedings of the 56th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 1163–1182, 2015. [14] Eldar Fischer, Eric Lehman, Ilan Newman, Sofya Raskhodnikova, Ronitt Rubinfeld, and Alex Samorodnitsky. Monotonicity testing over general poset domains. In Proceedings of the 34th Annual ACM Symposium on Theory of Computing (STOC), pages 474–483, 2002. [15] Alan M. Frieze and Ravi Kannan. The regularity lemma and approximation schemes for dense problems. In Proceedings of the 37th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 12–20, 1996. [16] Oded Goldreich, Shafi Goldwasser, Eric Lehman, Dana Ron, and Alex Samorodnitsky. Testing monotonicity. Combinatorica, 20(3):301–337, 2000. [17] Oded Goldreich, Shafi Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. Journal of the ACM, 45(4):653–750, 1998. [18] Oded Goldreich and Dana Ron. On sample-based testers. In Proceedings of the 6th Conference on Innovations in Theoretical Computer Science (ITCS), pages 337–345, 2015. [19] Tali Kaufman and Madhu Sudan. Algebraic property testing: the role of invariance. In Proceedings of the 40th Annual ACM Symposium on Theory of Computing (STOC), pages 403–412, 2008. [20] Michael Kearns and Dana Ron. Testing problems with sublearning sample complexity. Journal of Computer and System Sciences, 61(3):428–456, 2000. [21] Sofya Raskhodnikova. Approximate testing of visual properties. In Proceedings of the 7th International Workshop on Randomization and Computation (RANDOM), pages 370–381, 2003. [22] Ronitt Rubinfeld and Madhu Sudan. Robust characterizations of polynomials with applications to program testing. SIAM Journal on Computing, 25(2):252–271, 1996. [23] Claude Shannon. The synthesis of two-terminal switching circuits. Bell System Technical Journal, 28(1):59–98, 1949. 13 [24] Madhu Sudan. Invariance in property testing. In Oded Goldreich, editor, Property Testing: Current Research and Surveys, pages 211–227. Springer, 2010. [25] Terence Tao. Szemer´edi's regularity lemma revisited. Contributions to Discrete Mathematics, 1(1), 2006. [26] Luca Trevisan. Entropy and the weak regularity lemma. https://lucatrevisan.wordpress.com/2006/09/10/entropy-and-the-weak-regularity-lemma/, 2006. [27] Yuichi Yoshida. A characterization of locally testable affine-invariant properties via decompo- sition theorems. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), pages 154–163, 2014. 14
1204.1467
1
1204
2012-04-06T12:42:24
Learning Fuzzy {\beta}-Certain and {\beta}-Possible rules from incomplete quantitative data by rough sets
[ "cs.DS", "cs.LG" ]
The rough-set theory proposed by Pawlak, has been widely used in dealing with data classification problems. The original rough-set model is, however, quite sensitive to noisy data. Tzung thus proposed deals with the problem of producing a set of fuzzy certain and fuzzy possible rules from quantitative data with a predefined tolerance degree of uncertainty and misclassification. This model allowed, which combines the variable precision rough-set model and the fuzzy set theory, is thus proposed to solve this problem. This paper thus deals with the problem of producing a set of fuzzy certain and fuzzy possible rules from incomplete quantitative data with a predefined tolerance degree of uncertainty and misclassification. A new method, incomplete quantitative data for rough-set model and the fuzzy set theory, is thus proposed to solve this problem. It first transforms each quantitative value into a fuzzy set of linguistic terms using membership functions and then finding incomplete quantitative data with lower and the fuzzy upper approximations. It second calculates the fuzzy {\beta}-lower and the fuzzy {\beta}-upper approximations. The certain and possible rules are then generated based on these fuzzy approximations. These rules can then be used to classify unknown objects.
cs.DS
cs
Mining Fuzzy β-Certain and β-Possible rules from incomplete quantitative data by rough sets A.S,Mohammadi Department of Information Technology, Payame Noor University, PO BOX 19395-3697 Tehran, IRAN Ali_s [email protected] L. Asadzadeh Department of Information Technology, Payame Noor University, PO BOX 19395-3697 Tehran, IRAN [email protected] Abstract—The rough-set theory proposed by Pawlak, has been widely used in dealing with data classification problems. The original rough-set model is, however, quite sensitive to noisy data. Tzung thus proposed deals with the problem of producing a set of fuzzy certain and fuzzy possible rules from quantitative data with a predefined uncertainty tolerance degree of and misclassification. This model allowed , which combines the variable precision rough-set model and the fuzzy set theory, is thus proposed to solve this problem. This paper thus deals with the problem of producing a set of fuzzy certain and fuzzy possible rules from incomplete quantitative data with a predefined tolerance degree of uncertainty and misclassification. A new method, incomplete quantitative data for rough-set model and the fuzzy set theory, is thus proposed to solve this problem. It first transforms each quantitative value into a fuzzy set of linguistic terms using membership functions and then finding incomplete quantitative data with lower and the fuzzy upper approximations. It second calculates the fuzzy β-lower and the fuzzy β-upper approximations. The certain and possible rules are then generated based on these fuzzy approximations. These rules can then be used to classify unknown objects. Keywords-component: Fuzzy set; Rough set; Data mining; Certain rule; Possible rule; Quantitative value; incomplete data I. Introduction Machine learning and data mining techniques have recently been developed to find implicitly meaningful the knowledge-acquisition pat-terns and ease bottleneck. Among these appr oaches, deriving inference or association rules from training examples is the most common [9,12,13]. Given a set of examples and counterexamples of a concept, the learning program tries to induce general rules that describe all or most of the positive training instances and none or few of the coun terexamples [6,7]. If the training instances belong to more than two classes, the learning program tries to induce general rules that D.D,Rezaee Department of Information Technology, Payame Noor University, PO BOX 19395-3697 Tehran, IRAN [email protected] describe each class. Recently, the rough-set theory has been used reasoning and knowledge in acquisition for expert systems [4,14]. It was proposed by Pawlak in 1982 [19], with the concept of equivalence classes as its basic principle. Several applications and extensions of the rough-set theory have also been proposed. Examples are [14,18] reasoning with incomplete information,[2] knowledge-base reduction, [10] data mining, [16] rule discovery. Due to the success of the rough-set theory to knowledge acquisition, many researchers in database and machine learning fields are interested in this new research topic because it offers opportunities to discover useful information in training examples. [6,17] mentioned that the main issue in the rough-set approach was the formation of good rules. II. Review of the variable precision rough-set model The rough-set theory, proposed by Pawlak in 1982, can serve as a new mathematical tool to deal with data classification problems [19]. It adopt s the concept of equivalence classes to partition the training instances according to some criteria. Two kinds of partitions are formed in the mining process: lower approximations and upper approximations, from which certain and possible rules are easily derived. Let X be an arbitrary subset of the universe U, and B be an arbitrary subset of the attribute set A. The lower and the upper approximations for B on X, denoted B* (X) and B* (X) respectively, are defined B* (X) = {xx ϵ U, B(X)⊆ X} , as follows: (X) = {xx ϵ U and B(X) ∩ X ≠Ø} . (1) B * (2) Elements in B* (x) can be classified using attribute set B as members of the set X with full certainty, and B * (x) is thus called a lower approximation of X. On the other hand, elements in B (x) can be classified using attribute set B as members of the set X only with partial certainty, and B* (x) is thus called an uppe r approximation of X. The origina l rough-set model is quite sensitive to noisy data [7]. When noisy data exists, the lower and the upper approximations cannot normally be formed [17]. Let two sets X and Y be non-empty subsets of the un iversal set (X, Y, U). The rough inclusion function is then defined as follows: (3) Y) = (X, µ card(X Y) ∩ X card ( ) If the rough inclusion value equals to 1, then X is totally included in Y (X,Y). Otherwise, the rough inclusion value ranges between 0 to 1, and X is said partially included in Y. Also, the relative degree of misclassification of the set X with respect to set Y is defined as : (4) c (X, (5) (6) 1 Y) −= card(X Y) ∩ X card ( ) Based on the relative degree of misclassification, in the[17], generalized the lower and upper approximations of the original rough-set model with a majority inclusion threshold β. The β-lower and the β-upper approximations are defined as follows: B* (X) = {xx ϵ U , c(B(x),X) ≤ β } (X) = {xx ϵ U , c(B(x),X) <1- β } . B *β β III. Incomplete data sets Data sets can be rough ly classified into two classes: complete and incomplete data sets. All the objects in a complete data set have known attribute values. If at least one object in a data set has a missing value, the data set is incomplete. the symbol ‘*’ denotes an unknown attribute value. Learning rules from incomplete data sets is usually more difficult than from complete data sets. In the past, several methods were proposed the to handle problem of incomplete data sets [21]. For example, incomplete data sets may be transformed into complete data sets by similarity measures or by removing obj ects with unknown values before learning programs begin. Incomplete data sets may also be directly processed in a particular way to get the rules [20,22]. In the [20] proposed a rough-set approach to directly learn rules from incomplete data sets without guessing unknown attribute values. In the [22] modified [20] approach by introducing the rough entropy to distinguish the power of the attribute subsets that have the same partition for similarity relations. IV. Notation Notation used in this paper is described as follows : U universe of all objects β tolerance degree of noise and misclassification n total number of training examples (objects) in U Obj (i) ith training example (object), 1 ≤i ≤n A set of all attributes describing U m total number of attributes in A B an arbitrary subset of A A j j th attribute, 1 ≤ j≤ m A j j number of fuzzy regions for A jk k th fuzzy region of A j ,1 ≤k ≤Aj R (i) quantitative value of A j for Obj (i) v j (i) fuzzy set converted from v f j (i) membership value of v in region R f jk C set of classes to be determined c total number of classes in C l th class, 1 ≤ l≤ c X l (i)) the fuzzy incomplete equivalence classes in B(Obj which Obj(i) exists c(Obj (i)) the certain part of the kth fuzzy incomplete B k equivalence class in B(Obj(i) ) B (X) the fuzzy incomplete lower approximation for * B on X * B (X) the fuzzy incomplete upper approximation for B on X When the same linguistic term RRjkR of an attribute ARjR ( i) (r ) P and ObjP P with exists in two fuzzy objects ObjP ( i) (r) P larger than zero, P and fRjk RP membership values fRjkRP ( i) (r) to have a fuzzy P are said and ObjP P ObjP indiscernibility relation (or fuzzy equivalence relation) on attribute ARj R with a membership value (i) (r) P ∩ fRjkRP P ). Also, if the same equal to min (fRjkRP linguistic terms of an attribute subset B exist in both ( i) (r) P with membership values larger than Pand ObjP ObjP ( i) (r ) P and ObjP P are said to have a fuzzy zero, Obj P indiscernibility relation (or a fuzzy equivalence relation) on attribute subset B with a membership value equal to the minimum of all the membership values .These fuzzy equivalence relations thus partition the fuzzy object set U into several fuzzy subsets that may overlap, and the result is denoted by U/B. The set of fuzzy partitions, based on B and ( i) ( i) P). Thus, is denoted B(ObjP P , including ObjP ( i) (i) ( i) (r) P)= {((BR1 R(ObjP P, µ RB1 R(ObjP P)) … ((BRrR(ObjP P, µ B(ObjP (r) RBrR(ObjP P)) , where r is the number of partitions (i) ( i) included in B(ObjP P) , BRjR(ObjP P) is the jth partition in ( i) ( r) P) ,and µ RB jR(ObjP P) is the membership value of B(ObjP the jth partition. Since an incomplete quantitative data set contains ( i) P is thus unknown attribute values, each object ObjP (i) P ,symbol), where the represented as a tuple (ObjP symbol may be certain (c) or uncertain (u). If an (i) P has an uncertain value for attribute ARjR, object ObjP ( i) P ,u) is put in each fuzzy equivalence class then (ObjP of attribute ARjR. The fuzzy sets formed in this way are called fuzzy incomplete equi valence classes, which are not necessarily equi valence classes.The fuzzy incomplete lower and upper approximations for B on * X, denoted BR* R(X) and BP P(X) respectively, are P ϵ XRlR , defined as follows: B RkRPc P(ObjP(i)P)⊆ Xl , 1≤k≤B(ObjP(i)P)}. (7) ( i) ( i) ( i) P)) 1≤i ≤n , objP P),µRBkR(ObjP BR* R(X Rl R) = {(BRk R(ObjP P)) 1≤i ≤n , B RkRPc P(ObjP(i)P)∩ Xl ≠ Ø , B RkRPc P(ObjP(i)P)⊄ X Rl R (i) * ( i) P),µRBkR(ObjP P(X Rl R) = {(BRk R(ObjP BP 1≤k≤B(ObjP(i)P}. (8) P)⊄ X to Here, the definition of the fuzzy incompl ete upp er c ( i) P(ObjP approximation has the constraint BRk RP exclude the objects in the fuzzy incomplete lower approximation for avoiding redundant calculation. The fu zzy β-lo wer and the fu zzy β-upper appr oximations for B on X, denoted BR*β R(X) and * PRβ R(X) respectively, are defined as follows: BP BR*β R(X Rl R) = {(BRk R(x),µRBk R(x)) x ϵ U , c(B RkR(x), X)≤ β , 1≤k≤B(x)} (9) PRβ R(X Rl R) = {(BRk R(x),µRBk R(x)) x ϵ U , β< c(B RkR(x), X)≤1- β , 1≤k≤B(x)}. * BP (10) After the fu zzy β-lower and the fu zzy β-upper approximations are found, both β-certain and β-uncertain rules can thus be derived. V. The proposed algorithm for incomplete quantitative data sets In the section, a learning algorithm based on rough sets is proposed, which can simultaneously estimate the missing values and derive fuzzy certain and possible rules from incomplete quantitative data sets. The proposed fuzzy learning algorithm first transforms each quantitative value into a fuzzy set of linguistic terms using membership functions. The details of the proposed fuzzy learning algorithm are described as follows. The fuzzy mining algorithm for β-certain and β- possible rules: Input: A incomplete quantitative data set with n objects ,each with m attribute values, β is tolerance degree of noise and misclassification ,and a set of membership functions. Output: A set of maximally general fuzzy β-certain and fuzzy β-possible rules. Step 1: Partition the object set into disjoint subsets according to class labels. Denote each set of objects belonging to the same class CRl R as XRl R. (i ) Step 2: Transform the quantitative value vRj RP P of each (i) P ;i =1 to n, for each attribute ARj R; j = 1 to object ObjP (i) P , represented as, m , into a fuzzy set fRj RP i i i )( )( )( f j 1 R j 1 f j 2 R j f jl R (11) ... ++ + jl 2 using the given membership functions, where RRjkR is ( i) ( i) the kth fuzzy region of attribute ARjR ; fRjkRP P’s P is vRjRP fuzzy membership value in region RRjk R, and l (= ARjR) (i) is the number of fuzzy regions for ARj R. If ObjP P has a missing value for ARjR, keep it with a missing value (*). Step 3: Find the fuzzy incomplete elementary sets of (i) P has a singleton attributes; That is, if an object ObjP ( i) P for attribute ARj R, certain fuzzy membership value fRjkRP (i) P ,c) into the fuzzy incomplete equivalence put (ObjP ( i) class from ARjR = RRjk R; If ObjP P has a missing value for (i) ARj R, put (ObjP P ,u) into each fuzzy incomplete equivalence class from ARjR; The membership value µRAjk R of a fuzzy incomplete class for ARjR=RRjkR is calculated as: f (i) Min =µ jkA jk (i) ( i) P≠ 0. P is certain and fRjkRP where ObjP Step 4: Initialize q = 1, where q is used to count the number of attributes currently being processed for fuzzy incomplete lower approximations. (12) Step 5: Compute lower incomplete the fuzzy approximations of each subset B with q attributes for each class XRl R as: P ϵ XRlR , B RkRPc P(ObjP(i)P)⊆ Xl , 1≤k≤B(ObjP(i)P)}. (13) ( i) ( i) ( i) P)) 1≤i ≤n , objP P),µRBkR(ObjP BR* R(X Rl R) = {(BRk R(ObjP ( i) P) is the set of fuzzy incomplete where B(ObjP ( i) P and derived from equivalence classes including ObjP c ( i) P) is the certain part of the P(ObjP attribute subset B, BRk RP (i) P) . kth fuzzy incomplete equivalence class in B(ObjP r )( obj (14) r )( jk (i) in fuzzy incomplete P exists Step 6: If ObjP c (i) equivalence class BRkRP the kth region P) of P(ObjP k P from attribute subset B in a fuzzy combination RRBRP incomplete lower approximation, assign the uncertain ( i) P as: value of ObjP ∑ r )( v f . j c i )( obj B ( ) ∈ k ∑ r )( f jk c i )( obj B ( ∈ k (r) (r) P is the quantitative value of ObjP where vRjRP P for (r) (r) P’s fuzzy membership value attribute ARjR and fRjk RP P is vRjRP k ( i) in RRBRP P . Also transform the estimated ObjP P value into ( i) P ,u)’s with membership a fuzzy set, remove (ObjP values equal to zero from the fuzzy incomplete (i) ,u)’s with P equivalence classes, change (ObjP ( i) P ,c)’s membership values not equal to zero into (ObjP and re-calculate the membership values of the fuzzy incomplete equivalence classes including them by the obj r )( ) P P the to minimum operation. Besides, backtrack lower previously incomplete fuzzy found approximations for doing the same actions on Obj(i) . Step 7: Set q = q+1 and repeat Steps 5–7 unt il q > m. Step 8: Initialize h = 1, where h is used to count the number of attributes currently being processed for fuzzy incomplete upper approximations. incomplete upper the fuzzy Step 9: Compute approximations of each subset B with q attributes for each class X l B RkRPc P(ObjP(i)P)∩ Xl ≠ Ø , B RkRPc P(ObjP(i)P)⊄ XRlR (i) ( i) * , P)) 1≤i ≤n P(X Rl R) = {(BRkR(ObjP BP P),µRBkR(ObjP 1≤k≤B(ObjP(i)P}. (15) ( i) P) is the set of fuzzy incomplete where B(ObjP ( i) equivalence classes including ObjP P and derived from c ( i) P) is the certain part of the P(ObjP attribute subset B, BRk RP (i) P) . kth fuzzy incomplete equivalence class in B(ObjP Step 10: Do the following sub steps for each (i) P in the fuzzy incomplete uncertain instance ObjP upper approximations: l ( ( X X ∈ r )( r )( r )( obj obj c B ∈ k ( i) P exists in fuzzy incomplete equivalence a) If ObjP c (i) k P(ObjP P) of the kth region combination RRB RP P class BRk RP from attribute subset B in a fuzzy incomplete lower ( i) P as: approximation, assign the uncertain value of ObjP ∑ (16) r r )( )( v f . j jk r i )( )( obj obj &) ∈ ∑ r )( f jk i )( obj obj &) c B ∈ l k (r) (r) P is the quantitative value of ObjP P for where vRjRP (r) (r) attribute ARjR and fRjk RP P’s fuzzy membership value P is vRjRP k ( i) P . Also transform the estimated ObjP P value into in RRBRP ( i) P ,u)’s with membership a fuzzy set, remove (ObjP values equal to zero from the fuzzy incomplete (i) P ,u)’s with equivalence classes, change (ObjP ( i) P ,c)’s membership values not equal to zero into (ObjP and re-calculate the membership values of the fuzzy incomplete equivalence classes including them by the minimum operation. Besides, backtrack to the lower previously incomplete fuzzy found (i) P . approximations for doing the same actions on ObjP ( i) P still exists in more than one b) If an object ObjP fuzzy incomplete equivalence class in a fuzzy incomplete upper approximation, use the equivalence class with the maximum plausibility measure to ( i) P . The estimation estimate the uncertain value of ObjP and processing are the same as those stated in Step 10(a). Calculate the plausibility measures of each fuzzy incomplete equivalence class in an upper approximation for each class XRl R as: (17) r )( µ jk ( = r )( r )( )) i )( &) obj obj c B ∈ k X ∈ l r )( µ jk c k obj BP ( ( ∑ i )( obj ∑ c r i )( )( obj obj B ( ) ⊂ k ( i) c) If an object ObjP P exists in more than one fuzzy incomplete equivalence class in a fuzzy incomplete upper approximation and them plausibility measure together are equal, define for determine uncertain ( i) Pin it equivalence class that number value of ObjP certain objects that more of classes other. If number certain objects classes are equa l, hence define that class than are include least label. Step 11: Set h=h+1 and repeat Steps 9–11until h > m. Step 12 : Initialize l= 1, where l is used to count the number of classes being processed. Step 13: Calculate relative degree of the misclassification of each attribute subset BRkR for class XRl R as: l (18) XxBc ( ( ), k ∑ y )( µ B k X xBy ) ( )( ∩ ∈−= l k 1) ∑ y )( µ B k xBy )( ∈ k Step 14: Calculate the modified fuzzy β-lower and β- uppe r approximation of each attribute subset B for Step 15: Derive the β-certain rules from the fuzzy β- class XRl R as equation “(9)” and “(10)”. lower approximation BR*β R(XRl R) of any subset B, set the membership values in the β-lower approximation as the effectiveness for future data, and calculate the plausibility measure of each rule for BRkR(x) as : (19) XxBc− ( 1 ( ), ) k l Step 16: Remove the β-certain rules with the condition parts more specific and effectiveness measure equa l to or smaller than those of some other β-certain rules. Step 17: Derive the β-possible rules from the fuzzy β- * PRβ R(X ) of any subset B, set the uppe r approximation BP membership values in the β-upper approximation as the effectiveness for future data, and calculate the plausibility measure of each rule for BRkR(x) as equa tion “(19)” . Step 18: Remove the β-possible rules with the condition parts more the specific and both effectiveness and plausibility equal to or smaller than those of some other β-certain or β-possible rules. Step 19: Set l=l+1and Repeat Steps 13 to19 until l≤ c. Step 20 : Output the β-certain and β-possible fuzzy rules . VI. an example In this section, an example is given to show how the proposed algorithm can be used to generate maximally general fuzzy β-certain and fuzzy β- as: possible rules from incomplete quantitative data. Table 1 shows an incomplete quantitative data set. Assume the membership functions for each attribute are given by experts as shown in Fig. 1. The proposed learning algorithm processes this incomplete quantitative data set as follows. (1) ObjP (2) ObjP (3) ObjP (4) ObjP (5) ObjP (6) ObjP (7) ObjP Table 1 : T he quantita tive data set a s an Example Systo lic Diasto lic Blood Object pressure pressure pressure (BP) (SP) (DP) 122 80 N H 90 155 130 92 N 87 68 L * 93 H H 100 150 * 95 L Step 1: Since three classes exist in the data set, three partitions are thus formed as follows: )4( )7( X X X L N H L L = obj { obj { = obj { = )1( obj , obj , )2( obj , )3( }, }, )5( obj , N )6( }. H 140 100 90 Systolic Pressure (SP) N 160 H 75 70 Diastolic Pressure (DP) 90 95 Fig. 1. The given membe rship functions of each attribute. Step 2: The quantitative values of each object are transformed into fuzzy sets. Take the attribute (2) P as an example. The Systolic Pressure (SP) in ObjP value ‘‘155’’ is converted into a fuzzy set (0.1/N + 0.75/H) using the given membership functions. Results for all the objects are shown in Table 2. (1) (2) (3) (4) (5) (6) (7) Obj P Obj P Obj P Obj P Obj P Obj P Obj P 0.9/N 0.1/N+0.75/H 0.85/N 1/L * 0.3/N+0.5/H 0.5/L+0.1/N Table 2 : T he fu zzy set transformed from the data in Table 1 Systo lic Diasto lic Blood Object pressure pressure (DP) pressure (SP) (BP) N H N L H H L 0.9/N 0.4/N 0.3/N+0.4/H 1/L 0.16/N+0.6/H 1/H * Step 3: The elementary fuzzy sets of the singleton attributes SP and DP are found as follows: (1) (2) (3) U/{SP} {{(obj c)(obj c)(obj = , , c), (5) (7) (6) (obj c)(obj c)(obj , , , u),0.1} (5) (6) (2) {(obj c)(obj c)(obj u),0.5} , , , (5) (7) (4) {(obj c)(obj c)(obj , u),0.5}} , , and (2) (1) {{(obj c)(obj U/{DP} c), , = (5) (7) (3) (obj c)(obj u)(obj c),0.16} , , , (7) (6) (5) (3) {(obj c)(obj c)(obj c)(obj , , , (7) (4) {(obj c)(obj , u),0.5}} , , u),0.4} Step 4: q is initially set at 1, where q is used to count the number of the attributes currently being processed for fuzzy incomplete lower approximations. Step 5: The fuzzy incomplete lower approximation of (2) (5) (6) one attribute for XRHR={ObjP P , ObjP P , ObjP P } is first (2) P,c) of the calculated. Since only the certain part (ObjP first incomplete equivalence class for attribute SP is (5) included in XRH Rand the uncertain instances ObjP Pbelong to XRHR, thus: (XSP H* {(obj = ) (2) (6) c)(obj , (5) c)(obj , , u),0.5} Since the certain part of each fuzzy incomplete equivalence class for attribute DP is not included in XRH R, thus: (XDP H* φ = ) Similarly, the fuzzy incomplete lower approximations of single attributes for XRN R and XRLR are found as follows: = ) (XSP φ N* = ) (XDP φ N* (4) (XSP {(obj = ) * L (XDP = ) {(obj * L (7) c)(obj c),0.5} , , (4) (7) c)(obj , , u),1} Step 6: Each uncertain object in the above fuzzy incomplete lower approximations is checked for change to certain objects. For example in SP * (X H ), since Obj(5) exist in only one fuzzy incomplete equivalence class of SP = H, their values can then be estimated from the certain objects in the same equivalence class. Since only one certain object Obj(2) and Obj(6) exists in the fuzzy incomplete equivalence class of SP = H, the estimated value of Obj(5) is then (155*0.75+150*0.5)/1.25 (=153), where 153 is the quantitative value of Obj(2) and Obj(6) for attribute SP and 0.75 , 0.5 are there fuzzy membership values for the region of SP = H. The estimated values of Obj(5) fuzzy set the transformed as then is (0.2/N+0.65/H) . (Obj(5) ,u) is then changed as (Obj(5) ,c). The modified SP * (X H ) and The fuzzy incomplete elementary set of attribute SP are then: (2) (5) (6) c)(obj c)(obj , c),0.5} , , {(obj = ) (XSP H * (3) (2) (1) U/{SP} c)(obj c)(obj {{(obj , , c), = (6) (5) (7) (obj c)(obj c)(obj , c),0.1} , , (2) (6) (5) c)(obj c)(obj {(obj , , c),0.5} , (7) c)(obj {(obj , , c),0.5}} (4) Similarly , Since the uncertain object Obj(7) in DP * (X L ) exist in only the fuzzy incomplete equivalence class of DP = L, the estimated value of Obj(7) is then (68*1)/1 (=68)), where 68 is the quantitative value of Obj(4) for attribute DP and 1 is its fuzzy membership value of DP = L. The estimated value of Obj(7) is then transformed as the fuzzy set (1/L) for attribute DP. Also, (Obj(7) ,u) is then changed as (Obj(7) ,c). The modified DP * (X H ) and The fuzzy incomplete elementary set of attribute DP are then: (4) (7) c)(obj c),1} , , {(obj = ) (XDP L * (1) (2) U/{DP} = c)(obj {{(obj , c), (5) (3) (obj c)(obj , c),0.16} , (6) (5) (3) c)(obj c)(obj {(obj , , (7) c)(obj {(obj , c),0.5}} , c),0.4} (4) , Step 7: q = q+1, and Steps 5–7 are repeated. Until the fuzzy incomplete elementary set of attributes {SP, DP} is found as follows: (1) (2) c)(obj c), U/{SP, (3) , (obj (3) {(obj {(obj {(obj {(obj (5) (4) (2) {{(obj , = DP} (5) c)(obj c),0.1} , (5) (6) c)(obj c)(obj , , (5) c)(obj , , c),0.16} (7) c)(obj , , c),0.5}{(o bj (6) c)(obj , , c),0.5}} , c),0.2} (7) , c),0.1} Because , It is requirement for next steps . Step 8: Since all objects in the fuzzy incomplete lower approximations have become certain, go to the step12 is executed. Step 12 : Initialize l=l+1, where l is used to count the number of classes then beg in find in g β-certain and β-possible rules processed. with the relative degree β = 0.2 of misclassification can be calculated as follows: for XN : = − + = 31.0 SP, c( = 28.0 DP c( N 85.09.0 + 1= )X(x), SP c( N N 85.01.03.02.01.09.0 + + + + + 1 0-1 )X(x), SP c( = = N H 1 0-1 )X(x), SP c( = = N L 90. 0.3 + -1 )X(x), = N 0.16 0.9 0.3 0.4 + + 40. 8.0 -1 )X(x), DP c( = = N H 1 0.6 0.4 ++ 10-1 )X(x), DP c( = = N L 90. 0.3 + -1 )X(x), DP = N NN 0.16 0.9 0.1 + + 1 0-1 )X(x), DP = = N HN 4.0 -1 )X(x), = N 0.2 0.3 + + 1 0-1 )X(x), = = N 1 0-1 )X(x), = = N 1 0-1 )X(x), = = N DP NH DP LL DP NL DP HH SP, c( SP, c( SP, c( c( SP, Step 1 3 : Assume β =0.2. The fu zzy β-lower and β- upper approximation for class XN=({Obj(1) ,Obj(3) }) is first calculated. Since only {Obj(1) ,Obj(3) } is , thus: included in XN *0.2 (XN ) = {{( Obj(1) ,Obj(2), Obj(3), Obj(5) SP,DP ),0.1} SP, c( 55.0 18.0 0.4 = + 0.3 β-upper Similarly, fuzzy modified the N is approximations of single attributes for class X then calculated . Since only {Obj(1) ,Obj(3) } is , thus: included in XN 0.2 (X N ) = {( Obj(1) ,Obj(2), Obj(3), Obj(5) ,Obj(6), * SP Obj(7) ),0.1} ),0.16} 0.2 (X N ) = {{( Obj(1) ,Obj(2), Obj(3) ,Obj(5) DP* (3) ,Obj(5) ,Obj(6) ),0.4}} {( Obj * 0.2 (XN ) = {{( Obj(3) ,Obj(5) ,Obj(6) SP,DP Step 1 5 : in the fu zzy β-lower Each partition approximation is used to derived a β-certain rule with and plausibility measure effectiveness future measure. From SP * 0.2 (X N ), the following rule is derived: ),0.2} 1. If Systolic Pressure = Normal and Diastolic Pressure = Normal Then Blood Pressure = Normal , with plausibility=0.82 and future effectiveness = 0.1 . Similarly, not exist rules are derived for DP *0.2 (XN ) and SP,DP *0.2 (XN ). Step 16: Since the condition part of this rule is not more specific than any other rule in the β-certain rule sets, it is then kept in the fuzzy β-certain rule set. Step 1 7 : in the fu zzy β-upper Each partition approximation is used to derived a β-possible rule with plausibility measure and future effectiveness measure. From SP* ), the following rule is 0.2 (X N derived: 2. If Systolic Pressure = Normal Then Blood Pressure = Normal , with plausibility=0.72 and future effectiveness = 0.1 . the following rules are derived for Similarly, 0.2 (X N ) and SP,DP* DP* 0.2 (XN ) : 3. If Diastolic Pressure = Normal Then Blood Pressure = Normal, with plausibility =0.6 and future effectiveness = 0.16. 4. If Diastolic Pressure = High Then Blood Pressure =Normal, with plausibility =0.2 and future effectiveness = 0.4. 5. If Systolic Pressure = Normal and Diastolic Pressure = High Then Blood Pressure = Normal , with plausibility =0.45 and future effectiveness = 0.2 . Step 18: Since the condition part of this rule is not more specific than any other rule in the β-possible rule sets, it is then k ept in the fu zzy β-possible rule set. Step 19: Steps 13–19 are repeated to find rules for until l ≤ c . classes XL and XH Similarly , perform for X L and XH . thus, 6. If Systolic Pressure = Low Then Blood Pressure = Low, with plausibility =1 and future effectiveness = 0.5. 7. If Diastolic Pressure = Low Then Blood Pressure = Low, with plausibility = 1 and future effectiveness = 1; 8. If Systolic Pressure =Low and Diastolic Pressure = Low Then Blood Pressure = Low, with plausibility =1 and future effectiveness = 0.5. 9. If Systolic Pressure = Normal and Diastolic Pressure = Low Then Blood Pressure = Low , with plausibility=1 and future effectiveness = 0.1. 10. If Systolic Pressure = High Then Blood Pressure = High, with plausibility =1 and future effectiveness = 0.5. 11. If Diastolic Pressure = High Then Blood Pressure = High, with plausibility = 0.8 and future effectiveness = 0.4; 12. If Systolic Pressure = High and Diastolic Pressure = Normal Then Blood Pressure = High, with plausibility =1 and future effectiveness = 0.16 . 13. If Systolic Pressure = High and Diastolic Pressure = High Then Blood Pressure = High , with plausibility=1 and future effectiveness = 0.5 . 14. If Diastolic Pressure = Normal Then Blood Pressure = High, with plausibility = 0.32 and future effectiveness = 0.16; 15. If Systolic Pressure = Normal and Diastolic Pressure = High Then Blood Pressure = High, with plausibility =0.56 and future effectiveness = 0.2 . 16. If Systolic Pressure = Normal Then Blood Pressure = High , with plausibility=0.25 and future effectiveness = 0.1. Since the condition part of the eightieth rule is more specific and both its plausibility (1) and effectiveness (0.5) is equal to those of the sixth rule, this rule is thus removed from the β-certain rule set. Similarly, rules 9,12 and 13 are also removed by fuzzy rules 7 and 10 . Step 2 0 : all the fu zzy β-certain and β-possible rules are shown below: Fuzzy β-certain rules : 1. If Systolic Pressure = Normal and Diastolic Pressure = Normal Then Blood , with Pressure = Normal plausibility=0.82 and future effectiveness = 0.1 . 2. If Systolic Pressure = Low Then Blood Pressure = Low, with plausibility =1 and future effectiveness = 0.5. 3. If Diastolic Pressure = Low Then Blood Pressure = Low, with plausibility = 1 and future effectiveness = 1; 4. If Systolic Pressure = High Then Blood Pressure = High, with plausibility =1 and future effectiveness = 0.5. 5. If Diastolic Pressure = High Then Blood Pressure = High, with plausibility = 0.8 and future effectiveness = 0.4. Fuzzy β-possible rules : 1. If Systolic Pressure = Normal Then Blood Pressure = Normal , with plausibility=0.72 and future effectiveness = 0.1 . 2. If Diastolic Pressure = Normal Then Blood Pressure = Normal, with plausibility =0.6 and future effectiveness = 0.16 . 3. If Diastolic Pressure = High Then Blood Pressure = Normal, with plausibility =0.2 and future effectiveness = 0.4 . [4] J. W,Grzymala-Busse,” Knowledge acquisition under uncertainty: A rough set approach”, Journal of Intelligent Robotic Systems, 1,pp. 3–16, 1988. [5] T. P,Hong,C. S,Kuo,, S. C,Chi , ”Mining association rules from quantitative data”, Intelligent Data Analysis, 3, pp.363–376, 1999. [6] T. P,Hong, C.Y,Lee, ”.Induction of fuzzy rules and membership functions from training examples”, Fuzzy Sets and Systems, 84, pp.33–47, 1996. [7] T. P,Hong, S.S,Tseng, “A generalized version space learning algorithm for noisy and uncertain data”,IEEE Transactions on Knowledge and Data Engineering, 9, pp.336–340,1997 [8] T. P,Hong, T.T,Wang, S.L,Wang,” Knowledge acquisition from quantitative data using the rough-set theory”, Intelligent Data Analysis, 4, pp.289–304, 2000. [9] Y,Kodratoff, R.S,Michalski, “Machine learning: An artificial intelligence artificial intelligence approach”, 3. San Mateo, CA: Morgan Kaufmann Publishers, 1983 . [10] P.J,Lingras, Y.Y,Yao,“Data mining using extensions of the rough set model”, Journal of the American Society for Information Science, 49(5), pp.415–422, 1998. [11] T.P,Hong, L.H ,Tseng, S.L,Wang,”Learning rules from incomplete training examples by rough sets”, Expert System with Application, 22,pp. 285–293, 2002. [12] R.S,Michalski, J.G, Carbonell, T.M,Mitchell,”Machine Learning: An Artificial Intelligence Approach 1”, Los Altos, CA: Morgan Kaufmann Publishers, 1983. [13] R.S,Michalski,J.G, Carbonell, T.M,Mitchell,“Machine learning: An artificial intelligence approach 2”, Los Altos, CA: Morgan Kaufmann Publishers,1983. [14] E,Orlowska,“Reasoning with incomplete information: rough set based information logics”, In V. Alagar, S. Bergler, & F. Q. Dong (Eds.), Incompleteness and uncertainty in information systems, pp. 16–33,1993. [15] Y,Yuan, Y., & M.J,Shaw, “Induction of fuzzy decision trees”, Fuzzy Sets and Systems, 69, pp.125–139,1995. [16] N,Zhong, J.Z,Dong, S,Ohsuga, T.Y,Lin,” An incremental, probabilistic rough set approach to rule discovery”, IEEE International Conference on Fuzzy Systems, 2,pp. 933–938,1998. [17] W,Ziarko, “Variable precision rough set model”, Journal of Computer and System Sciences, 46, pp.39–59,1993. [18] T.P,Hong, L.H,Tseng, B.C ,Chien,“Mining from incomplete quantitative data by fuzzy rough sets”, Expert System with Application, 37, pp.2644–2653,2010. [19] Z. Pawlak, “Rough set,” International Journal of Computer and Information Sciences, pp.341-356,1983. [20] M. Kryszkiewicz, “Rough set approach to incomplete informationsystems”, Information Science, Vol. 112, pp. 39- 49,1998. [21] M. R,Chmielewski, J. W,Grzymala-Busse, N. W,Peterson, S,Than,“The rule induction system LERS – a version for sonal computers”, Foundations of Computing and Decision Sciences, Vol .18, pp. 181-212,1993. [22] J,Liang , Z,Xu ,”Uncertainty measures of roughness of knowledge and rough sets in incomplete information systems”, The third world congress on intelligent control and automation , pp.2526-2529, 2000 . 4. If Systolic Pressure = Normal and Diastolic Pressure = High Then Blood Pressure = Normal , with plausibility =0.45 and future effectiveness = 0.2. 5. If Diastolic Pressure = Normal Then Blood Pressure = High, with plausibility = 0.32 and future effectiveness = 0.16; 6. If Systolic Pressure = Normal and Diastolic Pressure = High Then Blood Pressure = High, with plausibility =0.56 and future effectiveness = 0.2 . 7. If Systolic Pressure = Normal Then Blood Pressure = High , with plausibility=0.25 and future effectiveness = 0.1. VII. Discussion and conclusion In this paper, we have proposed a novel data mining algorithm, which can process incomplete quantitative data with a predefined tolerance degree of uncertainty and misclassification. The interaction between data and approximations helps derive β- certain and β-possible rules from fuzzy incomplete data sets and estimate appropriate unknown values. The fuzzy β-certain rules with misclassification degrees smaller than β and the fuzzy β-possible rules with misclassification degrees smaller than 1-β are derived. Noisy training examples (as outliers) may then be omitted. The rules thus mined exhibit fuzzy quantitative regularity in databases and can be used to provide some sugge stions to appropr iate supervisors. The proposed algorithm can also solve conventional incomplete quantitative data problems by using degraded membership functions. The selection of β values is remarked here. When β =0, the proposed approach will be reduced to the one for the original rough-set model with incomplete quantitative data. A larger β value represents a larger tolerance of uncertainty and misclassification, but with a smaller gap between lower approximations and upper approximations. The selection of an appropriate β value then depends on given training instances. Acknowledgement This research was supported by the affiliation must be Islamic Azad University, Arak Branch of Iran. References [1] T.P,Hong, T.T,Wang, S.L,Wang,” Mining fuzzy b-certain and b-possible rules from quantitative data based on the variable precision rough-set mode”, Expert System with Application, 32,pp. 223–232, 2007. [2] L.T,Germano, P,Alexandre ,”Knowledge-base reduction based on rough set techniques”, Canadian conference on electrical and computer engineering , pp. 278–281, 1996. [3] I.Graham, P.L,Jones ,”Expert systems—knowledge ,uncertainty and decision”, Boston: Chapman and Computing, pp. 117–158 ,1988.
1902.04427
2
1902
2019-05-29T09:59:23
Compressed Range Minimum Queries
[ "cs.DS" ]
Given a string $S$ of $n$ integers in $[0,\sigma)$, a range minimum query RMQ$(i, j)$ asks for the index of the smallest integer in $S[i \dots j]$. It is well known that the problem can be solved with a succinct data structure of size $2n + o(n)$ and constant query-time. In this paper we show how to preprocess $S$ into a compressed representation that allows fast range minimum queries. This allows for sublinear size data structures with logarithmic query time. The most natural approach is to use string compression and construct a data structure for answering range minimum queries directly on the compressed string. We investigate this approach in the context of grammar compression. We then consider an alternative approach. Instead of compressing $S$ using string compression, we compress the Cartesian tree of $S$ using tree compression. We show that this approach can be exponentially better than the former, is never worse by more than an $O(\sigma)$ factor (i.e. for constant alphabets it is never asymptotically worse), and can in fact be worse by an $\Omega(\sigma)$ factor.
cs.DS
cs
Compressed Range Minimum Queries$ Pawe(cid:32)l Gawrychowskia, Seungbum Job, Shay Mozesc, Oren Weimannb aUniversity of Wroc(cid:32)law bUniversity of Haifa cInterdisciplinary Center Herzliya 9 1 0 2 y a M 9 2 ] S D . s c [ 2 v 7 2 4 4 0 . 2 0 9 1 : v i X r a Abstract Given a string S of n integers in [0, σ), a range minimum query RMQ(i, j) asks for the index of the smallest integer in S[i . . . j]. It is well known that the problem can be solved with a succinct data structure of In this paper we show how to preprocess S into a compressed size 2n + o(n) and constant query-time. representation that allows fast range minimum queries. This allows for sublinear size data structures with logarithmic query time. The most natural approach is to use string compression and construct a data structure for answering range minimum queries directly on the compressed string. We investigate this approach in the context of grammar compression. We then consider an alternative approach. Instead of compressing S using string compression, we compress the Cartesian tree of S using tree compression. We show that this approach can be exponentially better than the former, is never worse by more than an O(σ) factor (i.e. for constant alphabets it is never asymptotically worse), and can in fact be worse by an Ω(σ) factor. Keywords: RMQ, grammar compression, SLP, tree compression, Cartesian tree. 1. Introduction Given a string S of n integers in [0, σ), a range minimum query RMQ(i, j) returns the index of the smallest integer in S[i . . . j]. A range minimum data structure consists of a preprocessing algorithm and a query algorithm. The preprocessing algorithm takes as input the string S, and constructs the data structure, whereas the query algorithm takes as input the indices i, j and, by accessing the data structure, returns RMQ(i, j). The range minimum problem is a fundamental data structure problem that has been extensively studied, both in theory and in practice (see e.g. [11] and references therein). Range minimum data structures fall into two categories. Systematic data structures store the input string S in plain form, whereas non-systematic data structures do not. A significant amount of attention has been devoted to devising RMQ data structures that answer queries in constant time and require as little space as possible. There are succinct systematic structures that answer queries in constant time and require fewer than 2n bits in addition to the n log σ bits required to represent S [11]. Similarly, there are succinct non-systematic structures that answer queries in constant time, and require 2n + o(n) bits [11, 7]. The Cartesian tree C of S is a rooted ordered binary tree with n nodes. It is defined recursively. The Cartesian tree of an empty string is an empty tree. Let i be the index of the smallest element of S (if the smallest element appears multiple times in S, let i be the first such appearance). The Cartesian tree of S is composed of a root node whose left subtree is the Cartesian tree of S[1, i− 1], and whose right subtree is the Cartesian tree of S[i + 1, n]. See Figure 1. By definition, the character S[i] corresponds to the i'th node in an inorder traversal of C (we will refer to this node as node i). Furthermore, for any nodes i and j in C, their $Preliminary version of this paper appeared in SPIRE 2018. The work is supported in part by Israel Science Foundation grant 592/17. Email addresses: [email protected] (Pawe(cid:32)l Gawrychowski), [email protected] (Seungbum Jo), [email protected] (Shay Mozes), [email protected] (Oren Weimann) 1 lowest common ancestor LCA(i, j) in C corresponds to RMQ(i, j) in S. It follows that the Cartesian tree of S completely characterizes S in terms of range minimum queries. Indeed, two strings return the same answers for all possible range minimum queries if and only if their Cartesian trees are identical. This well known property has been used by many RMQ data structures including the succinct structures mentioned above. Since there are 22n−O(log n) distinct rooted binary trees with n nodes, there is an information theoretic lower bound of 2n− O(log n) bits for RMQ data structures. In this sense, the above mentioned 2n + o(n) bits data structures [11, 7] are nearly optimal. 1.1. Our results and techniques In this work we present RMQ data structures in the word-RAM model (without using any bit tricks). The size (in words) of our data structures can be sublinear in the size of the input string and the query time is O(log n). This is achieved by using compression techniques, and developing data structures that can answer RMQ/LCA queries directly on the compressed objects. Since we aim for sublinear size data structures, we focus on non-systematic data structures. We consider two different approaches to achieve this goal. The first approach is to use string compression to compress S, and devise an RMQ data structure on the compressed representation. This approach has also been suggested in [1, Section 7.1] in the context of compressed suffix arrays and the LCP array. See also [7, Theorem 2], [11, Theorem 4.1], and [3] for steps in this direction. The other approach is to use tree compression to compress the Cartesian tree C, and devise an LCA data structure on the compressed representation. To the best of our knowledge, this is the first time such approach has been suggested. Note that these two approaches are not equivalent. For example, consider a sorted sequence of an arbitrary subset of n different integers from [1, 2n]. As a string this sorted sequence is not compressible, but its Cartesian tree is an (unlabeled) path, which is highly compressible. In a nutshell, we show that the tree compression approach can exponentially outperform the string compression approach. Furthermore, it is never worse than the string compression approach by more than an O(σ) factor, and this O(σ) factor is unavoidable. We next elaborate on these two approaches. Using string compression. In Section 2.1, we show how to answer range minimum queries on a grammar compression of the input string S. A grammar compression is a context-free grammar that generates only S. The grammar is represented as a straight line program (SLP) S. I.e., the right-hand side of each rule in S either consists of the concatenations of two non-terminals or of a single terminal symbol. The size S of the SLP S is defined as the number of rules in S. Ideally, S (cid:28) S. Computing the smallest possible SLP is NP-hard [6], but there are many theoretically and practically efficient compression schemes for constructing S [6, 14, 18] that reasonably approximate the optimal SLP. In particular, Rytter [17] showed an SLP S of depth log n (the depth of an SLP is the depth of its parse tree) whose size is larger than the optimal SLP by at most a multiplicative log n factor. Very recently, Ganardi et al. [13] showed that any SLP can be turned (with no asymptotic overhead) into an equivalent SLP that is of depth log n. In [1], it was shown how to support range minimum queries on S with a data structure of size O(S) in time proportional to the depth of the SLP S. Bille et al. [5] designed a data structure of size O(S) that supports random-access to S (i.e. retrieve the i'th symbol in S) in O(log n) time (i.e. regardless of the depth of the SLP S). We show how to simply augment their data structure within the same O(S) size bound to answer range minimum queries in O(log n) time (i.e. how to avoid the logarithmic overhead incurred by using the solution of [1] on Rytter's SLP). Theorem 1.1. Given a string S of length n and an SLP-grammar compression S of S, there is a data structure of size O(S) that answers range minimum queries on S in O(log n) time. Using tree compression. In Section 2.2, we give a data structure for answering LCA queries on a com- pressed representation of the Cartesian tree C. By the discussion above, this is equivalent to answering range minimum queries on S. There are various ways to compress trees. In this work we use DAG compression of the top-tree of the Cartesian tree C of S. These concepts will be explained in the next paragraph. It is likely that other tree compression techniques (see, e.g., [15, 16, 12]) can also yield interesting results. We leave this as future work. 2 A top-tree [2] of a tree T is a hierarchical decomposition of the edges of T into clusters. A cluster is a connected subgraph of T that has at most two boundary nodes (nodes with neighbors outside the cluster); the root of the cluster (called the top boundary node), and a leaf of the cluster (called a bottom boundary node). The intersection of any two clusters is either empty, or consists of exactly one (boundary) node. Such a decomposition can be described by a rooted ordered binary tree T , called a top-tree, whose leaves correspond to clusters with individual edges of T , and whose root corresponds to the entire tree T . The cluster corresponding to a non-leaf node of T is obtained from the clusters of its two children by either identifying their top boundary nodes (horizontal merge) or by identifying the top boundary node of the left child with the bottom boundary node of the right child (vertical merge). See Figure 1. A DAG compression [9] of a tree T is a representation of T by a DAG whose nodes correspond to nodes of T . All nodes of T with the same subtree are represented by the same node of the DAG. Thus, the DAG compression of a top-tree has two sinks (due to T being a binary unlabeled tree), corresponding to the two types of leaf nodes of T (a single edge cluster, either left or right), and a single source, corresponding to the root of T . If u is the parent of (cid:96) and r in T , then the node in the DAG representing the subtree of T rooted at u has edges leading to the two nodes of the DAG representing the subtree of T rooted at (cid:96) and the subtree of T rooted at r. Thus, repeating rooted subtrees in T are represented only once in the DAG. See Figure 1. A top-tree compression [4] of a tree T is a DAG compression of T 's top-tree T . Bille et al. [4] showed how to construct a data structure whose size is linear in the size of the DAG of T and supports navigational queries on T in time linear in the depth of T . In particular, given the preorder numbers of two vertices u, v in T , their data structure can return the preorder number of LCA(u, v) in T . We show that their data structure can be easily adjusted to work with inorder numbers instead of preorder, so that, given the inorder numbers i, j of two vertices in T one can return the inorder number of LCA(i, j) in T . This is precisely RMQ(i, j) when T is taken to be the Cartesian tree C of S. Theorem 1.2. Given a string S of length n and a top-tree compression T of the Cartesian tree C, we can construct a data structure of size O(T ) that answers range minimum queries on S in O(depth(T )) time. By combining Theorem 1.2 with the greedy construction of T given in [4] (in which depth(T ) = O(log n)), we can obtain an O(T ) space data structure that answers RMQ in O(log n) time. We already mentioned that, on some RMQ instances, top-tree compression can be much better than any string compression technique. As an example, consider the string S = 1, 2, 3,··· , n. Its Cartesian tree is a single (rightmost, and unlabeled) path, which compresses using top-tree compression into size T = O(log n). On the other hand, since σ = n, S is uncompressible with an SLP. By Theorem 1.2, this shows that the tree compression approach to the RMQ problem can be exponentially better than the string compression approach. In fact, for any string over an alphabet of size σ = Ω(n), any SLP must have S = Ω(n) while for top-trees T = O(n/ log n) [4]. In Section 3.1 we show that, for small alphabets, T cannot be much larger nor much deeper than S for any SLP S. Theorem 1.3. Given a string S of length n over an alphabet of size σ, for any SLP-grammar compression S of S there is a top-tree compression T of the Cartesian tree C with size O(S·σ) and depth O(depth(S)·log σ). Observe that in the above theorem, in order to obtain small depth of T , one could use, e.g, the SLP of Rytter [17] or that of Ganardi et al. [13]. Another way of achieving small depth is to ignore the SLP and use the top-tree compression of Bille et al. [4] as T . This guarantees T has size O(n/ log n) words and depth O(log n). Finally, observe that T can be larger than S by an O(σ) multiplicative factor which can be large for large alphabets. It is tempting to try and improve this. However, in Section 3.2 we prove a tight lower bound, showing that this factor is unavoidable. Theorem 1.4. For every sufficiently large σ and s = Ω(σ2), there exists a string S of integers in [0, σ) that can be described with an SLP S of size s, such that any top-tree compression T of the Cartesian tree C of S is of size Ω(s · σ). 3 2. RMQ on Compressed Representations 2.1. Compressing the string Given an SLP compression S of S, Bille et al. [5] presented a data structure of size O(S) that can report any S[i] in O(log n) time. We now prove Theorem 1.1 using a rather straightforward extension of this data structure to support range minimum queries. The key technique used in [5] is an efficient representation of the heavy path decomposition of the SLP's parse tree. For each node v in the parse tree, we select the child of v that derives the longer string to be a heavy node. The other child is light. Ties can be broken arbitrarily. Heavy edges are edges going into a heavy node and light edges are edges going into a light node. The heavy edges decompose the parse tree into heavy paths. The number of light edges on any path from a node v to a leaf is O(log v) where v denotes the length of the string derived from v. A traversal of the parse tree from its root to the i'th leaf S[i] enters and exists at most log n heavy paths. Bille et al. show how to simulate this traversal in O(log n) time on a representation of the heavy path decomposition that uses only O(S) space. In other words, their structure finds the entry and exit vertices of all heavy paths encountered during the root-to-leaf traversal in total O(log n) time. We elaborate on this now. Note that we cannot afford to store the entire parse tree as its size is n which can be exponentially larger than S. Instead, Bille et al. use the following O(S)-space representation H of the heavy paths: H is a forest of trees whose roots correspond to terminals of S (integers in [0, σ)) and whose non-root nodes correspond to nonterminals of S. A node u is the parent of v in H iff u is the heavy child of v in the parse tree (observe that wherever the nonterminal u appears in the parse tree it always has the same heavy child v). We assign the edge of H from v to its parent u with a left weight (cid:96)(v, u) and right weight r(v, u) defined as follows. If u is the left child of v in H then the left weight is 0 and the right weight is the subtree size of the right child of v in the parse tree. Otherwise, the right weight is 0 and the left weight is the subtree size of the left child of v in the parse tree. Using H, we can then simulate a root-to-leaf traversal of the parse tree. Suppose we have reached a vertex u on some heavy path P . Finding out where we need to exit P (and enter another heavy path) easily translates to a weighted level ancestor query (using the (cid:96)(v, u) or r(v, u) weights) from u on H (see [5] for details). Given a positive number x, such a query returns the rootmost ancestor of u in H whose distance from the root is at least x. Bille et al. showed how to answer all such queries (i.e. how to find the entry point and exit point on all heavy paths visited during a root-to-leaf traversal of the parse tree) in total O(log n) time. Extending their structure to support range minimum queries is quite simple. We perform a random access to the i'th and the j'th leaves in the parse tree. This identifies the entry and exit points of all traversed heavy paths, and, in particular, the unique heavy path P (cid:48) containing the lowest common ancestor of i and j. Then, we wish to find the minimum leaf value in all the subtrees hanging to the right (resp. left) of the path starting from P (cid:48) and going down to i (resp. j). To achieve this for i (the case of j is symmetric), in addition to the subtree sizes (r(v, u)) we also store the minimum leaf value (r(cid:48)(v, u)) in these subtrees. This way, the problem now boils down to performing O(log n) bottleneck edge queries on H. Given a forest H with edge weights (the r(cid:48)(v, u) weights), a bottleneck edge query between two vertices x, y (the entry and exit points) returns the minimum edge weight on the unique x-to-y path in H. Demaine et al. [8] showed that, after sorting the edge weights in H, one can construct in O(H) = O(S) time and space a data structure that answers bottleneck edge queries in constant time. This concludes the proof of Theorem 1.1. 2.2. Compressing the Cartesian tree We next prove Theorem 1.2, i.e. how to support range minimum queries on S using a compressed representation of the Cartesian tree [19]. Recall that the Cartesian tree C of S is defined as follows: If the smallest character in S is S[i] (in case of a tie we choose a leftmost position) then the root of C corresponds to S[i], its left child is the Cartesian tree of S[1, i − 1] and its right child is the Cartesian tree of S[i + 1, n]. By definition, the i'th character in S corresponds to the node in C with inorder number i (we will refer to this node as node i). Observe that for any nodes i and j in C, the lowest common ancestor LCA(i, j) of these 4 Figure 1: The string S = "23110122102313" and its corresponding (a) Cartesian tree , (b) top-tree, and (c) DAG representation of the top-tree. In (a), each node is labeled by its corresponding character in S (these labels are for illustration only, the top-tree construction treats the Cartesian tree as an unlabeled tree). In (b) and (c), each node is labeled by el or er (atomic edge clusters), v (a vertical merge), or h (a horizontal merge). Four clusters are marked with matching colors in (a) and in (b). nodes in C corresponds to RMQ(i, j) in S. This implies that without storing S explicitly, one can answer range minimum queries on S by answering LCA queries on C. In this section, we show how to support LCA queries on C on a top-tree compression [4] T of C. The query time is O(depth(T )) which can be made O(log n) using the (greedy) construction of Bille et al. [4] that gives depth(T ) = O(log n). We first briefly restate the construction of Bille et al., and then extend it to support LCA queries. The top-tree of a tree T (in our case T will be the Cartesian tree C) is a hierarchical decomposition of T into clusters. Let v be a node in T with children v1, v2.1 Define T (v) to be the subtree of T rooted at v. Define F (v) to be the forest T (v) without v. A cluster with top boundary node v can be either (1) T (v), (2) {v}∪ T (v1), or (3) {v}∪ T (v2). For any node u (cid:54)= v in a cluster with top boundary node v, deleting from the cluster all descendants of u (not including u itself) results in a cluster with top boundary node v and bottom boundary node u. The top-tree is a binary tree defined as follows (see Figure 1): • The root of the top-tree is the cluster T itself. • The leaves of the top-tree are (atomic) clusters corresponding to the edges of T . An edge (v, parent(v)) of T is a cluster where parent(v) is the top boundary node. If v is a leaf then there is no bottom boundary node, otherwise v is a bottom boundary node. If v is the right child of parent(v) then we label the (v, parent(v)) cluster as er and otherwise as e(cid:96). • Each internal node of the top-tree is a merged cluster of its two children. Two edge disjoint clusters A and B whose nodes overlap on a single boundary node can be merged if their union A ∪ B is also a cluster (i.e. contains at most two boundary nodes). If A and B share their top boundary node then the merge is called horizontal. If the top boundary node of A is the bottom boundary node of B then the merge is called vertical and in the top-tree A is the left child and B is the right child. Bille et al. [4] proposed a greedy algorithm for constructing the top-tree: Start with n − 1 clusters, one for each edge of T , and at each step merge all possible clusters. More precisely, at each step, first do all possible horizontal merges and then do all possible vertical merges. After constructing the top-tree, the actual compression T is obtained by representing the top-tree as a directed acyclic graph (DAG) using the 1Bille et al. considered trees with arbitrary degree, but since our tree T is a Cartesian tree we can focus on binary trees. 5 001323211(a) Cartesian tree31221(b) Top-treevervh(c) DAG vvvhvvhhvererererererelelelerelelelvvvvvhherh algorithm of [9]. Namely, all nodes in the top-tree that have a child with subtree X will point to the same subtree X (see Figure 1). Bille et al. [4] showed that using the above greedy algorithm, one can construct T of size T that can be as small as log n (when the input tree T is highly repetitive) and in the worst-case is at most O(n/ log0.19 σ n). Dudek and Gawrychowski [10] have recently improved the worst-case bound to O(n/ logσ n) by merging in the i'th step only clusters whose size is at most αi for some constant α. Using either one of these merging algorithms to obtain the top-tree and its DAG representation T , a data structure of size O(T ) can then be constructed to support various queries on T . In particular, given nodes i and j in T (specified by their position in a preorder traversal of T ) Bille et al. showed how to find the (preorder number of) node LCA(i, j) in O(log n) time. Therefore, the only change required in order to adapt their data structure to our needs is the representation of nodes by their inorder rather than preorder numbers. The local preorder number uC of a node u in T and a cluster C in T is the preorder number of u in a preorder traversal of the cluster C. To find the preorder number of LCA(i, j) in O(log n) time, Bille et al. showed that it suffices if for any node u and any cluster C we can compute uC in constant time from uA or uB (the local preorder numbers of u in the clusters A and B whose merge is the cluster C) and vice versa. In Lemma 6 of [4] they show that indeed they can compute this in constant time. The following lemma is a modification of that lemma to work when uA, uB and uC are local inorder numbers. Lemma 2.1 (Modified Lemma 6 of [4]). Let C be an internal node in T corresponding to the cluster obtained by merging clusters A and B. For any node u in C, given uC we can tell in constant time if u is in A (and obtain uA) in B (and obtain uB) or in both. Similarly, if u is in A or in B we can obtain uC in constant time from uA or uB. Proof. We show how to obtain uA or uB when uC is given. Obtaining uC from uA or uB is done similarly. For each node C, we store a following information: • (cid:96)(A) (r(A)): the first (last) node visited in an inorder traversal of C that is also a node in A. • (cid:96)(B) (r(B)): the first (last) node visited in an inorder traversal of C that is also a node in B. • the number of nodes in A and in B. • u(cid:48) C, where u(cid:48) is the common boundary node of A and B. Consider the case where C is obtained by merging A and B vertically (when the bottom boundary node of A is the top boundary node of B), and where B includes vertices that are in the left subtree of this boundary node, the other case is handled similarly: • if uC < (cid:96)(B) then u is a node in A and uA = uC. • if (cid:96)(B) ≤ uC ≤ r(B) then u is a node in B and uB = uC − (cid:96)(B) + 1. For the special case when uC = u(cid:48) C then u is also the bottom boundary node in A and uA = (cid:96)(B). • if uc > r(B) then u is a node in A visited after visiting all the nodes in B then uA = uC − B + 1. When C is obtained by merging A and B horizontally (when A and B share their top boundary node and A is to the left of B): • if uC < r(A) then u is a node in A and uA = uC. • if uC ≥ r(A) then u is a node in B and uB = uC − A + 1. For the special case when uC = u(cid:48) is also the top boundary node in A and uA = A. C then u 2 To complete the proof of Theorem 1.2, we now explain how to use Lemma 2.1, given the inorder numbers of nodes x and y in T , to compute in O(depth(T )) time the inorder number of LCA(x, y) in T . This is identical to the procedure of Bille et al. (except for replacing preorder with inorder) and is given here for completeness. 6 We begin with a top-down search on T to find the first cluster whose top boundary node is LCA(x, y) (or alternatively to reach a leaf cluster whose top or bottom boundary node is LCA(x, y)). At each cluster C in the search we compute the local inorder numbers xC and yC of x and y in C. Initially, for the root cluster T we set xT = x and yT = y. If we reach a leaf cluster C we stop the search. Otherwise, C is an internal cluster with children A and B. If xC and yC are in the same child cluster, we continue the search in that cluster after computing the new local inorder numbers of x and y in the appropriate child cluster (in constant time using Lemma 2.1). Otherwise, xC and yC are in different child clusters. If C is a horizontal merge then we stop the search. If C is a vertical merge (where A's bottom boundary node is B's top boundary node) then we continue the search in A after setting the local inorder number of the node (either x or y) that is in B to be the bottom boundary node of A. After finding the cluster C whose top boundary node v is LCA(x, y), we have the inorder number of v in C and we need to compute the inorder number of v in the entire tree T . This is done by repeatedly applying Lemma 2.1 on the path in T from C to the root of T . 3. Compressing the String vs. the Cartesian Tree In this section we compare the sizes of the SLP compression S and the top-tree compression T . 3.1. An upper bound We now show that given any SLP S of height h, we can construct a top-tree compression T based on S (i.e. non-greedily) such that T = O(S· σ) and the height of T is O(h log σ). Using T , we can then answer range minimum queries on S in time O(h log σ) as done in Section 2.2. Furthermore, we can construct T in O(n log σ + S · σ) time using Rytter's SLP [17] as S. Then, the height of S is h = log n and the size of S is larger than the optimal SLP by at most a multiplicative log n factor. Consider a rule C → AB in the SLP. We will construct a top-tree (a hierarchy of clusters) of C (i.e. of the Cartesian tree CT (C) of the string derived by the SLP variable C) assuming we have the top-trees of (the Cartesian trees of the strings derived by) A and of B. We show that the top-tree of C contains only O(σ) new clusters that are not clusters in the top-trees of A and of B, and that the height of the top-tree is only O(log σ) larger than the height of the top-tree of A or the top-tree of B. To achieve this, for any variable A of the SLP, we will make sure that certain clusters (associated with its rightmost and leftmost paths) must be present in its top-tree. See Figure 2. The structure of CT (C). We first describe how the Cartesian tree CT (C) of the string derived by variable C can be described in terms of the Cartesian trees CT (A) and CT (B). We label each node in a Cartesian tree with its corresponding character in the string. These labels are only used for the sake of this description, the actual Cartesian tree is an unlabeled tree. By definition of the Cartesian tree, the labels are monotonically non-decreasing as we traverse any root-to-leaf path. Let (cid:96)(A) (respectively r(A)) denote the path in CT (A) starting from the root and following left (respectively right) edges. Since we break ties by taking the leftmost occurrence of the same character we have that the path (cid:96)(A) is strictly increasing (the path r(A) is just non-decreasing). Let x be the label of the root of CT (B). To simplify the presentation we assume that the label of the root of CT (A) is smaller or equal to x (the other case is symmetric). Split CT (A) by deleting the edge connecting the last node on r(A) that is smaller or equal to x with its right child. The resulting two subtrees are the Cartesian trees CT (Ap) and CT (As) of a prefix Ap and a suffix As of A whose concatenation is A. The prefix Ap ends at the last character of A that is at most x. Split CT (B) by deleting the edge connecting the root to its right child. The resulting two subtrees are the Cartesian trees CT (Bp) and CT (Bs) of a prefix and a suffix of B. The prefix Bp ends with the first occurrence of x in B. The Cartesian tree CT (C) of the concatenation C = AB can be described as follows: Consider the Cartesian trees CT (Ap) of Ap, CT (Bs) of Bs, and CT (AsBp) of the concatenation of As and Bp. It is easy to verify that the root of CT (AsBp) has no right child. Attach CT (Bs) as the right child of the root of CT (AsBp). Then attach the resulting tree as the right child of the last node of the rightmost path of CT (Ap). See Figure 2. 7 Figure 2: The Cartesian tree of SLP variables A, B, C where C → AB. The single additional cluster Cr 3 (in green) is formed by merging existing clusters from A (in blue) and from B (in red). First, cluster CAB (corresponding to the tree CT (AsBp)) is formed by alternating subpaths of the leftmost path in CT (B) and the rightmost path in CT (A). Then, CAB is merged with Br 3. In this example, As = {Ar 3 , v, and Ar i i > 3} and Bp = {B(cid:96) i i > 3}. 8 A`1A`017A`70A`2201Ar03337788Ar1Ar3Ar7Ar83849B`4B`8B`9B`0CT(A)CT(B)334Br4Br3170201Ar0333Ar17788Ar889B`8B`93Ar34B`4Ar7CT(C)Cr3334Br4Br3vCABA`1A`A`7A`2 The above structural description of CT (C) is not enough for our purposes. In particular, a recursive computation of CT (AsBp) would lead to a linear O(σ) increase in the height of the top-tree of CT (C) compared to that of CT (A) and CT (B). In order to guarantee a logarithmic O(log σ) increase, we need to describe the structure in more detail. For a node v with label i appearing in (cid:96)(A) other than the root of A, we define A(cid:96) i subtree rooted at the v's right child, together with v. Next consider the path r(A). For every label i there can be multiple vertices with label i that are consecutive on r(A). We define Ar i to be the subtree of A induced by the union of all vertices of r(A) that have label i together with the subtrees rooted at their left children. Again, we treat the first node of r(A) (i.e. the root of CT (A)) differently: if the label of the root is i then Ar i does not include the root nor its left subtree. See Figure 2 (left). j for j ≤ x. i 's. The structure of CT (AsBp) It is easy to see that CT (Ap) consists of the subtree of A induced by all the A(cid:96) See Figure 2 (right). It is also easy to see that CT (Bs) consists of all the Br is a bit more involved. It consists of alternations of Ar i 's and all the Ar i 's which we describe next. i 's and B(cid:96) We describe the structure of CT (AsBp) constructively from top to bottom. This constructive procedure is just for the sake of describing the structure of CT (AsBp). We will later describe a different procedure for constructing the clusters of the corresponding top-trees. The root of CT (AsBp) is the root of B. Initially, the root is marked L (indicating that the root can only obtain a left child). Throughout the procedure we will make sure that exactly one node is marked (by either L or R). For increasing values of i, starting with i = x + 1 and ending when i exceeds σ, we do the following: 1. if Ar i is defined: (a) attach Ar i as the left child of the marked node if the marked node is marked with L, and as the right child otherwise, (b) unmark the marked node, and instead mark the last node on the rightmost path of Ar i with R. 2. if B(cid:96) i is defined: (a) attach B(cid:96) i as the left child of the marked node if the marked node is marked with L, and as the right child otherwise, (b) unmark the marked node, and instead mark the root of B(cid:96) i with L. Note that CT (AsBp) consists of all subtrees B(cid:96) i for i > x, and O(σ) additional edges (these are the edges that were created when attaching subtrees to a marked node during the construction procedure). Also observe that each subtree Ar i is incident to at most two new edges, one incident to the root of Ar i is incident to at most two new edges, both incident to the root of B(cid:96) i into a single node. Then the result would be a single "zigzag" path of new edges. We will next use these properties when describing the clusters of CT (C). i and the other incident to the rightmost node of Ar i . Imagine contracting each Ar i . Similarly, each subtree B(cid:96) i , the subtrees Ar i and each B(cid:96) The clusters of CT (C). We next describe how to obtain the clusters for the top-tree of CT (C) from the the clusters of the top-trees of CT (A) and CT (B). For each variable (say A) of the SLP S of S, we require that in the top-tree of S there is a cluster for every A(cid:96) i only have a top boundary node. Clusters for Ar i ), and a bottom boundary node (the last node on the rightmost path of Ar i clusters of C by merging clusters of the form A(cid:96) i while introducing only O(σ) new clusters, and with O(log σ) increase in height. First observe that, by the structure of CT (Ap), we have that, for every i, C (cid:96) i . Recall that x denotes the label of the root of CT (B). By the structure of CT (Ap), C r i for every i < x and, by the structure of CT (Bs), C r i , so we already have these clusters. Next consider the clusters C r i for every i > x. Therefore, the only new cluster we need to create is C r x. i have a top boundary node (the root of Ar i ). We will show how to construct all the C (cid:96) i . Clusters for A(cid:96) i and every Ar i , and Br i and C r The cluster C r it contains the cluster Ar Finally, Br Ar x and Br cluster C r x corresponds to a subtree of CT (C) that is composed of the following components: First, x. Then, CT (AsBp) is connected as the right child of the rightmost node of Ar x. x is connected as the right child of the root of CT (AsBp). Since we already have the clusters for x, we only need to describe how to construct a cluster CAB corresponding to CT (AsBp). The x will be obtained by merging these three clusters together. i , Ar i , B(cid:96) i = Br i = Ar i = A(cid:96) 9 Recall from the structural discussion of CT (AsBp) that CT (AsBp) consists of all subtrees B(cid:96) i and the subtrees Ar i for i > x. We already have the clusters for these O(σ) subtrees. These subtrees are connected together to form CT (AsBp) by O(σ) new edges that are only incident to the boundary nodes of the clusters. We will merge the existing clusters to form the cluster CAB by creating O(σ) new clusters, but only increasing the height of the top-tree by O(log σ). Performing the merges linearly would increase the height of the top- tree by O(σ). Instead, the merging process consists of O(log σ) phases. In each phase we choose a maximal set of disjoint pairs of clusters that need to be merged and perform these merges. Since CT (AsBp) is a binary tree, we can perform half the remaining merges in each phase. This process can be described by a binary tree of height O(log σ) whose leaves are the O(σ) clusters B(cid:96) To conclude, given the clusters A(cid:96) i . Once we have all clusters of the SLP's start variable, we merge them into a single cluster (i.e. obtain the top-tree of the entire Cartesian tree of S) by merging all its O(σ) clusters (introducing O(σ) new clusters and increasing the height by O(log σ)) similarly to the description above. This concludes the proof of Theorem 1.3. i , Br i , C r i , Ar i , B(cid:96) i that we started with. i , we have shown how to compute all clusters C (cid:96) i and Ar 3.2. A lower bound We now prove Theorem 1.4. That is, for every sufficiently large σ and s = Ω(σ2) we will construct a string S of integers in [0, σ) that can be described with an SLP S of size s, such that any top-tree compression T of the Cartesian tree C of S is of size Ω(s · σ). Let us first describe the high-level intuition. The shuffle of two strings x[1..(cid:96)] and y[1..(cid:96)] is defined as x[1]y[1]x[2]y[2] . . . x[(cid:96)]y[(cid:96)]. It is not very difficult to construct a small SLP describing a collection of many strings Ai and Bj of length (cid:96), and choose s pairs (ik, jk) such that every SLP describing all shuffles of Aik and Bjk contains Ω(s · (cid:96)) nonterminals. However, our goal is to show a lower bound on the size of a top-tree compression of the Cartesian tree, not on the size of an SLP. This requires designing the strings Ai and Bj so that a top-tree compression of the Cartesian tree of AiBj roughly corresponds to an SLP describing the shuffle of Ai and Bj. Let σ(cid:48) = (cid:98)(σ − 4)/2(cid:99) and (cid:96) be a parameter such that 2(cid:96) − 1 ≥ σ(cid:48). We start with constructing 2(cid:96) − 1 distinct auxiliary strings Xi over {σ − 2, σ − 1}, each of the same length (cid:96). We construct every such string except for (σ − 1)(cid:96), so that Cartesian trees corresponding to Xis are all distinct. The total number of Xis is 2(cid:96) − 1 and there is an SLP X of size O(2(cid:96)) that contains a nonterminal deriving every Xi. Next, let Xi,j denote the string Xi(σ − 3)Xj. By construction, Cartesian trees corresponding to Xi,js are all distinct, and all Xi,js are of the same length. The second and the third step are symmetric. We construct strings Ai of the form: X1,i2X2,i4··· (2σ (cid:48) − 4)Xσ(cid:48)−1,i(2σ (cid:48) − 2)Xσ(cid:48),i(2σ (cid:48) ) for every i = 1, 2, . . . , 2(cid:96) − 1. There are 2(cid:96) − 1 such strings Ai, and there is an SLP A of size O((2(cid:96) − 1) · σ(cid:48)) that contains a nonterminal deriving every Ai. Similarly, we construct strings Bj of the form: (cid:48) − 1)Xσ(cid:48),j(2σ (cid:48) − 3) . . . 3X2,j1X1,j. (2σ Finally, we obtain S by concatenating the strings AiBj0 for all i, j = 1, 2, . . . , 2(cid:96) − 1. The total size of an SLP that generates S is O(2(cid:96) · σ(cid:48) + 4(cid:96)). It remains to analyze the size of a top-tree compression T of the Cartesian tree C of S. We first need to understand the structure of C. Because all strings AiBj are separated by 0s, the Cartesian tree of S consists of a right path of length (2(cid:96) − 1)2 and the Cartesian tree of AiBj attached as the left subtree of the ((i − 1)(2(cid:96) − 1) + j)-th node of the path. The Cartesian tree of a string AiBj consists of a path of length 2σ(cid:48) starting at the root and consisting of nodes u1 − v1 − u2 − v2 − . . . − uσ(cid:48) − vσ(cid:48) such that vi is the left child of ui and ui+1 is the right child of vi. For every k ∈ {1, . . . , σ(cid:48)}, the right subtree of uk is the Cartesian tree of Xk,i and the left subtree of vk is the Cartesian tree of Xk,j. See Figure 3. We define a zigzag to be an edge u − v such that v is the left child of u. Furthermore, for some k ∈ {1, . . . , σ(cid:48)} and i, j ∈ {1, . . . , 2(cid:96) − 1}, the right subtree of u should be the Cartesian tree of Xk,j, while the left subtree of v should be the Cartesian tree of Xk,i. 10 Figure 3: Structure of the Cartesian tree of AiBj for σ(cid:48) = 4. Proposition 3.1. The Cartesian tree of AiBj contains σ(cid:48) distinct zigzags. Furthermore, a zigzag contained in the Cartesian tree of AiBj is not contained in the Cartesian tree of Ai(cid:48)Bj(cid:48) for any i(cid:48) (cid:54)= i or j(cid:48) (cid:54)= j. Lemma 3.2. If T is a top-tree compression of a tree T with x distinct zigzags then T = Ω(x). Proof. We associate each distinct zigzag with a smallest cluster of the top-tree of T that contains it. We claim that each cluster obtained by merging clusters A and B is associated with O(1) zigzags. Since the size of T equals the number of distinct clusters in the top-tree of T , the lemma follows. Consider a zigzag z = u − v associated with A ∪ B. Hence, z is not contained in A nor in B. We consider two cases. 1. A and B are merged horizontally. Then A and B share the top boundary node b, and in fact u = b. It follows that z is the only zigzag in A ∪ B that is not in A nor in B. 2. A and B are merged vertically. Then the top boundary node of A is the bottom boundary node b of B. Then either b = u, b = v, or b is a node of the Cartesian tree of some Xk,x attached as the right subtree of u or the left subtree of v. Each of the first two possibilities gives us one zigzag associated with A∪ B that is not in A nor in B. In the remaining two possibilities (i.e. when the Cartesian tree of Xk,x is attached as the right subtree of u or as the left subtree of v), because the size of the Cartesian tree of every Xk,x is the same, we can determine u or v, respectively, by navigating up from b as long 2 as the size of the current subtree is too small, and proceed as in the previous two cases. Combining Proposition 3.1 and Lemma 3.2 we conclude that T = Ω(4(cid:96) · σ(cid:48)). Recall that the size of an SLP that generates S is O(2(cid:96) · σ(cid:48) + 4(cid:96)), where σ(cid:48) = (cid:98)(σ − 4)/2(cid:99) = Θ(σ) and (cid:96) is parameter such that 2(cid:96) − 1 ≥ σ(cid:48). Given a sufficiently large σ and s = Ω(σ2), we first choose (cid:96) = (cid:100)1/2 log s(cid:101). Observe that then 2(cid:96) − 1 ≥ σ(cid:48) indeed holds because of the assumption s = Ω(σ2). We construct a string S generated by an SLP of size O(2(cid:96) · σ(cid:48) + 4(cid:96)) = O(s), and any top-tree compression T of the Cartesian tree of S has size Ω(s · σ(cid:48)). This concludes the proof of Theorem 1.4. 11 u1u2u3v1v2v3v4u4X1,iX2,iX3,iX4,iX4,jX3,jX2,jX1,j References [1] A. Abeliuk, R. C´anovas, and G. Navarro. Practical compressed suffix trees. Algorithms, 6(2):319 -- 351, 2013. [2] S. Alstrup, J. Holm, K. de Lichtenberg, and M. Thorup. Maintaining information in fully-dynamic trees with top trees. ACM Transactions on Algorithms, 1:243 -- 264, 2003. [3] J. Barbay, J. Fischer, and G. Navarro. LRM-trees: Compressed indices, adaptive sorting, and com- pressed permutations. Theor. Comput. Sci., 459:26 -- 41, 2012. [4] P. Bille, I. L. Gørtz, G. M. Landau, and O. Weimann. Tree compression with top trees. Inf. Comput., 243:166 -- 177, 2015. [5] P. Bille, G. M. Landau, R. Raman, K. Sadakane, S. R. Satti, and O. Weimann. Random access to grammar-compressed strings and trees. SIAM J. Comput., 44(3):513 -- 539, 2015. [6] M. Charikar, E. Lehman, D. Liu, R. Panigrahy, M. Prabhakaran, A. Sahai, and A. Shelat. The smallest grammar problem. IEEE Trans. Information Theory, 51(7):2554 -- 2576, 2005. [7] P. Davoodi, R. Raman, and S. R. Satti. On succinct representations of binary trees. Mathematics in Computer Science, 11(2):177 -- 189, 2017. [8] E. D. Demaine, G. M. Landau, and O. Weimann. On cartesian trees and range minimum queries. Algorithmica, 68(3):610 -- 625, 2014. [9] P. J. Downey, R. Sethi, and R. E. Tarjan. Variations on the common subexpression problem. J. ACM, 27(4):758 -- 771, 1980. [10] B. Dudek and P. Gawrychowski. Slowing down top trees for better worst-case compression. In 29th Annual Symposium on Combinatorial Pattern Matching (CPM), pages 16:1 -- 16:8, 2018. [11] J. Fischer and V. Heun. Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM Journal on Computing, 40(2):465 -- 492, 2011. [12] M. Ganardi, D. Hucke, M. Lohrey, and E. Noeth. Tree compression using string grammars. Al- gorithmica, 80(3):885 -- 917, 2018. doi: 10.1007/s00453-017-0279-3. URL https://doi.org/10.1007/ s00453-017-0279-3. [13] M. Ganardi, A. Jez, and M. Lohrey. Balancing straight-line programs. CoRR, abs/1902.03568, 2019. URL http://arxiv.org/abs/1902.03568. [14] K. Goto, H. Bannai, S. Inenaga, and M. Takeda. Fast q-gram mining on SLP compressed strings. J. Discrete Algorithms, 18:89 -- 99, 2013. [15] A. Jez and M. Lohrey. Approximation of smallest linear tree grammar. Inf. Comput., 251:215 -- 251, 2016. [16] M. Lohrey. Grammar-based tree compression. In Developments in Language Theory - 19th International Conference, DLT 2015, pages 46 -- 57, 2015. [17] W. Rytter. Application of Lempel-Ziv factorization to the approximation of grammar-based compres- sion. Theor. Comput. Sci., 302(1-3):211 -- 222, 2003. [18] Y. Takabatake, T. I, and H. Sakamoto. A space-optimal grammar compression. In 25th Annual European Symposium on Algorithms (ESA), pages 67:1 -- 67:15, 2017. [19] J. Vuillemin. A unifying look at data structures. Commun. ACM, 23(4):229 -- 239, 1980. 12
1606.07425
2
1606
2016-06-27T19:48:50
Generalized Preconditioning and Network Flow Problems
[ "cs.DS" ]
We consider approximation algorithms for the problem of finding $x$ of minimal norm $\|x\|$ satisfying a linear system $\mathbf{A} x = \mathbf{b}$, where the norm $\|\cdot \|$ is arbitrary and generally non-Euclidean. We show a simple general technique for composing solvers, converting iterative solvers with residual error $\|\mathbf{A} x - \mathbf{b}\| \leq t^{-\Omega(1)}$ into solvers with residual error $\exp(-\Omega(t))$, at the cost of an increase in $\|x\|$, by recursively invoking the solver on the residual problem $\tilde{\mathbf{b}} = \mathbf{b} - \mathbf{A} x$. Convergence of the composed solvers depends strongly on a generalization of the classical condition number to general norms, reducing the task of designing algorithms for many such problems to that of designing a \emph{generalized preconditioner} for $\mathbf{A}$. The new ideas significantly generalize those introduced by the author's earlier work on maximum flow, making them more widely applicable. As an application of the new technique, we present a nearly-linear time approximation algorithm for uncapacitated minimum-cost flow on undirected graphs. Given an undirected graph with $m$ edges labelled with costs, and $n$ vertices labelled with demands, the algorithm takes $\epsilon^{-2}m^{1+o(1)}$-time and outputs a flow routing the demands with total cost at most $(1+\epsilon)$ times larger than minimal, along with a dual solution proving near-optimality. The generalized preconditioner is obtained by embedding the cost metric into $\ell_1$, and then considering a simple hierarchical routing scheme in $\ell_1$ where demands initially supported on a dense lattice are pulled from a sparser lattice by randomly rounding unaligned coordinates to their aligned neighbors. Analysis of the generalized condition number for the preconditioner follows that of the classical multigrid algorithm for lattice Laplacian systems.
cs.DS
cs
Generalized Preconditioning and Network Flow Problems Jonah Sherman∗ University of California, Berkeley October 13, 2018(preliminary draft) Abstract We consider approximation algorithms for the problem of finding x of minimal norm (cid:107)x(cid:107) satisfying a linear system Ax = b, where the norm (cid:107) · (cid:107) is arbitrary and generally non-Euclidean. We show a simple general technique for composing solvers, converting iterative solvers with residual error (cid:107)Ax−b(cid:107) ≤ t−Ω(1) into solvers with residual error exp(−Ω(t)), at the cost of an increase in (cid:107)x(cid:107), by recursively invoking the solver on the residual problem b = b − Ax. Convergence of the composed solvers depends strongly on a generalization of the classical condition number to general norms, reducing the task of designing algorithms for many such problems to that of designing a generalized preconditioner for A. The new ideas significantly generalize those introduced by the author's earlier work on maximum flow, making them more widely applicable. As an application of the new technique, we present a nearly-linear time approximation algorithm for uncapacitated minimum-cost flow on undirected graphs. Given an undirected graph with m edges labelled with costs, and n vertices labelled with demands, the algorithm takes −2m1+o(1)-time and outputs a flow routing the demands with total cost at most (1 + ) times larger than minimal, along with a dual solution proving near-optimality. The generalized preconditioner is obtained by embedding the cost metric into (cid:96)1, and then considering a simple hierarchical routing scheme in (cid:96)1 where demands initially supported on a dense lattice are pulled from a sparser lattice by randomly rounding unaligned coordinates to their aligned neighbors. Analysis of the generalized condition number for the corresponding preconditioner follows that of the classical multigrid algorithm for lattice Laplacian systems. 1 Introduction A fundamental problem in optimization theory is that of finding solutions x of minimum-norm (cid:107)x(cid:107) to rectangular linear systems Ax = b. Such solvers have extensive applications, due to the fact that many practical optimization problems reduce to minimum norm problems. When the norm is Euclidean, classical iterative solvers such as steepest descent and conjugate gradient methods produce approximately optimal solutions with residual error (cid:107)Ax − b(cid:107) exponentially small in iteration count, The rate of exponential convergence depends strongly on the condition number of the square matrix AA∗. Therefore, the algorithm design process for such problems typically consists entirely of efficiently con- structing preconditioners: easily computable left-cancellable operators P, for which the transformed prob- lem PA = Pb is well-conditioned so iterative methods converge rapidly. In a seminal work, Spielman and Teng[17] present a nearly-linear-time algorithm to construct preconditioners with condition number poly- logarithmic in problem dimension for a large class of operators A, including Laplacian systems and others arising from discretization of elliptic PDEs. There are many fundamental optimization problems that can be expressed as minimum-norm problems with respect to more general, non-Euclidean norms, including some statistical inference problems and network flow problems on graphs. In particular, the fundamental maximum-flow and uncapacitated minimum-cost flow problems reduce respectively to (cid:96)∞ and (cid:96)1 minimum-norm problems in the undirected case. For such problems, there is presently no known black-box iterative solver analagous to those for (cid:96)2 that converge exponentially with rate independent of problem dimension. Therefore, one is forced to choose between interior point methods to obtain zero or exponentially small error[4], at the cost of iteration count depending strongly on problem dimension, or alternative methods that have error only polynomially small with respect to iterations[15, 9, 14]. ∗Research supported by NSF Grant CCF-1410022 An important idea implicitly used by classical iterative (cid:96)2 solvers is residual recursion: reducing the error of an approximate solution x by recursively applying the solver to b = b − Ax. Such recursion is implicit in those solvers due to the fact that in (cid:96)2, the map b (cid:55)→ xopt is linear, with xopt = (AA∗)+b. Therefore, the classical methods are effectively recursing on every iteration, with no distinction between iterations and recursive solves. In general norms, an xopt may not be unique, and there is generally no linear operator mapping b to some xopt. In this paper, we make two primary contibutions. Our first contribution is to extend analysis of residual recursion to arbitrary norms. We present a general and modular framework for efficiently solving minimum- norm problems by composing simple well-known base solvers. The main tool is the composition lemma, de- scribing the approximation parameters of a solver composed via residual recursion of two black-box solvers. The resulting parameters depend on a generalization of the condition number to arbitrary norms; therefore, much like (cid:96)2, the algorithm design process is reduced to constructing good generalized preconditioners. Our second contribution is to present, as a practical application of those tools, a nearly-linear time approximation algorithm for the uncapacitated minimum-cost flow problem on undirected graphs. Having established the former framework, the latter algorithm is entirely specified by the construction of a generalized precondi- tioner, and analyzed by bounding its generalized condition number. Our framework builds upon earlier work[16], where we leveraged ideas introduced by Spielman and Teng to obtain nearly-linear time approximation algorithms for undirected maximum flow. We have since realized that some of the techniques applied to extend (cid:96)2-flows to (cid:96)∞-flows are in no way specific to flows, and indeed the composition framework presented here is a generalization of those ideas to non-Euclidean minimum-norm problems. Moreover, a significantly simpler max-flow algorithm may be recovered using black-box solvers and general composition as presented here, requiring only the truly flow-specific part of the earlier work: the congestion approximator, now understood to be a specific instance of a more widely-applicable generalized preconditioner. We proceed to discuss those contributions separately in more detail, and outline the corresponding sections of the paper. We also discuss some related work. 1.1 Minimum Norm Problems In section 2, we define the minimum norm problem more precisely, and introduce a useful bicriteria notion of approximation we call (α, β)-solutions. In that notion, α quantifies how much (cid:107)x(cid:107) relatively exceeds (cid:107)xopt(cid:107), and β quantifies the residual error (cid:107)Ax − b(cid:107), with an appropriate relative scale factor. We may succinctly describe some frequently used algorithms as (α, β)-solvers; we discuss some examples in section 4, including steepest descent and conjugate gradient for (cid:96)2, and multiplicative weights for (cid:96)1 and (cid:96)∞. In section 3, we present the composition lemma, which shows that by composing a (α1, β1)-solver with a (α2, β2)-solver in a black-box manner, we obtain a (α3, β3)-solver with different parameter tradeoffs. The composed algorithm's parameters (α3, β3) depends crucially on a generalization of the classical condition number to rectangular matrices in general norms; Demko[7] provides essentially the exact such generalization needed, so we briefly recall that definition before stating and proving the composition lemma. The proof of the composition lemma is not difficult; it follows quite easily once the right definitions of (α, β)-solutions and a generalized condition number have been established. Nevertheless, the modularity of the composition lemma proves to quite useful. By recursively composing a solver with itself t times, we may decrease β exponentially with t, at the cost of a single fixed increase in α. By composing solvers with different parameters, better parameters may be obtained than any single solver alone. A particularly useful example uses a (M, 0)-solver, where M is uselessly-large on its own, to terminate a chain of t solvers and obtain zero error. As the final step in the chain, we get all of the benefits (zero error), and almost none of the costs, as it contributes M 2−t instead of M to the final solver. By composing the existing solvers discussed in section 4, we obtain solvers for (cid:96)1 and (cid:96)∞ problems with residual error exponentially small in t. We state the final composed algorithms parameters. As a result, the algorithm design problem for such problems is reduced to that of designing a generalized preconditioner for A. We briefly discuss such preconditioning in section 5. 1.2 Minimum Cost Flow The second part of this paper applies generalized preconditioning to solve a fundamental problem in net- work optimization. In the uncapacitated minimum-cost flow problem on undirected graphs, we are given a connected graph G with m edges, each annotated with a cost, and a specified demand at each vertex. The 2 problem is to find an edge flow with vertex divergences equal to the specified demands, of minimal total cost. Our main result is a randomized algorithm that, given such a problem, takes −2m1+o(1) time and outputs a flow meeting the demands with cost at most (1 + )-times that of optimal. We define various flow-related terms and give a more precise statement of the problem and our result in section 6. We describe and analyze the algorithm in section 7. Having built up our general tools in earlier sections, our task is reduced to the design and analysis of a generalized preconditioner for min-cost flow. We begin by interpreting the edge costs as lengths inducing a metric on the graph, and then apply Bourgain's small- distortion embedding[3] into (cid:96)1. That is, by paying a small distortion factor in our final condition number, we may focus entirely on designing a preconditioner for min-cost flow in (cid:96)1 space. The construction of our precondtitioner is based on an extremely simple hierarchical routing scheme, inspired by a combination of the multigrid algorithm for grid Laplacians, and the Barnes-Hut algorithm for n-body simulation[2]. The routing scheme proceeds on a sequence of increasingly dense lattices V0, V1, . . . in (cid:96)1, where Vt are the lattice points with spacing 2−t, and the input demands are specified on the densest level VT . Starting at level t = T , the routing scheme sequentially eliminates the demand supported on Vt \ Vt−1 by pulling the demand from level t − 1 using a random-rounding based routing: each vertex x ∈ Vt picks a random nearest neighbor in Vt−1, corresponding to randomly rounding its unaligned coordinates, and then pulls a fractional part of its demand from that neighbor via any shortest path. Afterwards, all demands on Vt \ Vt−1 are met, leaving a reduced problem with demands supported on Vt−1. The scheme then recurses on the reduced problem. At level 0, the demands are supported on the corners of a hypercube, for which the simple routing scheme of pulling all demand from a uniformly random corner performs well-enough. Having described the routing scheme, we need not actually carry it out. Instead, our preconditioner crudely estimates the cost of that routing. Furthermore, while the routing has been described on an infinite lattice, we'll observe that if the demands are only initially supported on a small set of n vertices, the support remains small throughout. 1.3 Related Work Spielman and Teng present a nearly-linear time algorithm for preconditioning and solving symmetric diag- onally dominant matrices, including those of graph Laplacians[17]. The ideas introduced in that work have led to breakthroughs in various network cut and flow algorithms for the case of undirected graphs. Chris- tiano et. al. apply the solver as a black-box to approximately solve the maximum flow problem in Θ(m4/3) time. Madry[13] opens the box and uses the ideas directly to give a family of algorithms for approximating cut-problems, including a mo(1)-approximation in m1+o(1) time. Both the present author[16] and Kelner et. al.[11] combine madry's ideas with (cid:96)∞ optimization methods to obtain (1 − )-approxmations to maximum flow in m1+o(1)−O(1) time. While those two algorithms use similar ideas, the actual path followed to achieve the result is rather different. Kelner et. al. construct an oblivious routing scheme that is no(1)-competetive, and then show how to use it to obtain a flow. The algorithm maintains a demand-respecting flow at all times, and minimizes a potential function measuring edge congestion. In contrast, our earlier algorithm short-cuts the need to explicitly construct the routing scheme by using Madry's construction directly, maintaining a flow that is neither demand nor capacity respecting, aiming to minimize a certain potential function that measures both the congestion and the demand error. For min-cost flow, earlier work considers the more general directed, capacitated case, with integer ca- pacities in {1, . . . , U}. The Θ(nm log log U )-time double-scaling algorithm of Ahuja, Goldberg, Orlin, and Tarjan[1] remained the fastest algorithm for solving min-cost flow for 25 years between its publication and the Laplacian breakthrough. Shortly after that breakthrough, Daitch and Spielman[5] showed how to use the Laplacian solver with interior-point methods to obtain an Θ(m3/2 log2 U )-time algorithm. Lee and Sidford O(1) U ) by a general improvement in interior point methods[12]. We are further reduce this to Θ(m not aware of prior work n log √ 2 Approximate Solutions Let X ,Y be finite dimensional vector spaces, where X is also a Banach space, and let A ∈ Lin(X ,Y) be fixed throughout this section. We consider the problem of finding a minimal norm pre-image of a specified b in the image of A; that is, finding x ∈ X with Ax = b and (cid:107)x(cid:107)X minimal. Let xopt be an exact solution, with Axopt = b, and (cid:107)xopt(cid:107)X minimal. There are multiple notions of 3 approximate solutions for this problem. The most immediate is x ∈ X with Ax = b and (cid:107)x(cid:107) (cid:107)xopt(cid:107) ≤ α (1) . We call such x an (α, 0)-solution; we shall be interested in finding (1 + , 0)-solutions for small . A weaker notion of approximation is obtained by further relaxing Ax = b to Ax (cid:117) b. Quantifying that requires more structure on Y, so let us further assume Y to also be a Banach space. In that case, we say x is an (α, β)-solution if equation 1 holds and (cid:107)Ax − b(cid:107) (cid:107)A(cid:107)(cid:107)xopt(cid:107) ≤ β (2) The practical utility of such solutions depends on the application. However, the weaker notion has the distinct advantage of being approachable by a larger family of algorithms, such as penalty and dual methods, by avoiding equality constraints. We discuss such existing algorithms in section 4, but mention that they typically yield (1, )-solutions after some number of iterations. For (cid:96)2, the iteration dependency on  is O(log(1/)), while for some more general norms it is −O(1). 3 Recursive Composition and Generalized Condition Numbers We now consider how to trade an increase in α for a decrease in β. Residual recursion suggests a natural strategy: after finding an (α, β)-solution, recurse on b = b − Ax. More precisely, we define the composition of two algorithms as follows. Definition 3.1. Let Fi be an (αi, βi)-algorithm for A, for i ∈ {1, 2}. The composition F2 ◦ F1 takes input b, and first runs F1 on b to obtain x. Next, setting b = b− Ax, it runs F2 on input b to obtain x. Finally, it outputs x + x. Success of composition depends on (cid:107)b(cid:107)Y being small implying b has a small-norm pre-image. The extent to which that is true is quantified by the condition number of A. The condition number in (cid:96)2 may be defined several ways, resulting in the same quantity. When generalized to arbitrary norms, those definitions differ. We recall two natural definitions, following Demko[7]. Definition 3.2. The non-linear condition number of A : X → Y is (cid:26)(cid:107)A(cid:107)X→Y(cid:107)x(cid:107)X (cid:107)Ax(cid:107)Y (cid:27) : Ax (cid:54)= 0 κX→Y (A) = min The linear condition number is defined by κX→Y (A) = min{(cid:107)A(cid:107)X→Y(cid:107)G(cid:107)Y→X : G ∈ Lin(Y,X ) : AGA = A} Of course, κ ≤ κ. Having defined the condition number, we may now state how composition affects the approximation parameters. Theorem 3.3 (Composition). Let Fi be an (αi, βi/κ)-algorithm for A : X → Y, where A has non-linear condition number κ Then, the composition F2 ◦ F1 is an (α1 + α2β1, β1β2/κ-algorithm for the same problem. Before proving lemma 3.3, we state two useful corollaries. The first concerns the result of recursively composing a (α, β/κ)-algorithm with itself. Corollary 3.4. Let F be a (α, β/κ)-algorithm for β < 1. Let F t be the sequence formed by iterated compo- sition, with F 1 = F , F t+1 = F t ◦ F . Then, F t is a (α/(1 − β), βt/κ)-algorithm. Proof. By induction on t. To start, an (α, β/κ)-algorithm is trivially a (α/(1−β), β/κ)-algorithm. Assuming the claim holds for F t, lemma 3.3 implies F t+1 is a (α + αβ/(1 − β), βt+1/κ)-algorithm. We observe that to obtain (1 + O(), δ)-solution, only the first solver in the chain need be very accurate. Corollary 3.5. Let F be a (1+, /2κ-solver and G be a (2, 1/2κ)-solver. Then, Gt◦F is a (1+5, 2−t−1/κ- solver. For some problems, there is a very simple (M, 0)-solver known. A final composition with that solver serves to elimate the error. Corollary 3.6. Let F be a (1 + , δ/κ)-solver and G be a (M, 0)-solver. Then G◦ F is a (1 + (1 + δM ), 0)- solver. 4 3.1 Proof of lemma 3.3 Since F1 is an (α1, β1/κ)-algorithm, we have (cid:107)x(cid:107) ≤ α1(cid:107)xopt(cid:107) (cid:107)b(cid:107) (cid:107)xopt(cid:107) (cid:107)A(cid:107) ≤ β1 κ (cid:107)xopt(cid:107) ≤ κ (cid:107)b(cid:107) (cid:107)A(cid:107) ≤ β1(cid:107)xopt(cid:107) By the definition of κ, Since F2 is an (α2, β2/κ)-algorithm, (cid:107)x(cid:107) ≤ α2(cid:107)xopt(cid:107) ≤ α2β1(cid:107)x(cid:107)opt ≤ β2 κ (cid:107)xopt(cid:107) ≤ β1β2 κ (cid:107)Ax − b(cid:107) (cid:107)A(cid:107) The conclusion follows from (cid:107)x + x(cid:107) ≤ (cid:107)x(cid:107) + (cid:107)x(cid:107). 4 Solvers for (cid:96)p The recursive composition technique takes existing (α, β)-approximation algorithms and yields new algo- In this section, we discuss the parameters of existing rithms with different approximation parameters. well-known base solvers. Let A : Rm → Rn be linear and fixed throughout this section. To concisely describe results and ease comparison, for a norm (cid:107) · (cid:107)X on Rm and a norm (cid:107) · (cid:107)Y in Rn, we write (α, β)X→Y to denote an (α, β) solution with respect to A : X → Y. The classical (cid:96)2 solvers provide a useful goalpost for comparison. Theorem 4.1 ([4]). The steepest-descent algorithm produces a (1, δ)2→2-solution after O(κ2→2(A)2 log(1/δ)) simple iterations The conjugate gradient algorithm produces a (1, δ)2→2-solution after O(κ2→2(A) log(1/δ)) simple iterations. There are many existing algorithms for p-norm minimization, and composing them yields algorithms with exponentially small error. For this initial manuscript, we simply state the (cid:96)1 version required for min-cost flow. The general cases consist of describing the many existing algorithms[14] in terms of (α, β)-solvers. Theorem 4.2. There is a (1 + , δ)1→1-solver with simple iterations totalling O(cid:0)κ1→1(A)2 log(m)(cid:0)−2) + log(δ−1)(cid:1)(cid:1) O(cid:0)κ∞→∞(A)2 log(n)(cid:0)−2 + log(δ−1)(cid:1)(cid:1) Theorem 4.3. There is a (1 + , δ)∞→∞-solver with simple iterations totalling The preceding theorems follow by combining the multiplicative weights algorithm[15, 9] with the com- position lemma. The former algorithm applies in a more general online setting; for our applications, the algorithm yields the "weak" approximation algorithms that shall be composed. A support oracle for a compact-convex set C takes input y and returns some x ∈ C maximizing x · C. Let (cid:52)n be the unit simplex in Rn (i.e., the convex hull of the standard basis). The multiplicative weights method finds approximate solutions to the saddle point problem, In particular, it obtains an additive -approximation in O(ρ2−2 log n) iterations with each iteration taking O(n) time plus a call to a support oracle for C. max w∈(cid:52)n min z∈C w · z 5 Let Bp be the unit ball in (cid:96)p. A point w ∈ B1 is represented as w = w+ − w− for (w+, w−) ∈ (cid:52)2n. The base solvers follow by considering the saddle-point problems, max y∗∈b1 max x∈b1 min x∈b∞ min y∗∈b∞ y∗ · (Ax − µb) y∗ · (Ax − µb) where µ is scaled via binary-search as needed. The search adds a factor O(log κ) to the complexity. This factor may be avoided by using (cid:96)p-norm for p = log n and p = (log m)/ regularization, respectively, instead. 5 Generalized Preconditioning Let A : X → Y be linear. The minimum-norm problem for A does not intrinsically require Y to be normed; nor does the definition of a (α, 0)-solution. Thus, an algorithm designer seeking to solve a class of minimum norm problems may freely choose how to norm Y. The best choice requires balancing two factors. First, the norm should be sufficiently "simple" that (1, ) solutions for polynomially-small  are easy to find. Second, the norm should be chosen so that κ(A)X→Y is small. If only the latter constraint existed, the ideal choice would be the optimal A pre-image norm,1 (cid:107)b(cid:107)opt(A) = min{(cid:107)x(cid:107)X : Ax = b} By construction, κ(A)X→opt(A) = 1. Of course, simply evaluating that norm is equivalent to the original problem we aim to solve. It follows that Y should be equipped with the relatively closest norm to opt(A) that can be efficiently minimized. Following the common approach in (cid:96)2, when X = (cid:96)p, we propose to choose a generalized pre-conditioner P : Y → (cid:96)p injective and consider the norm (cid:107)Pb(cid:107)p. Again, P should be chosen such that κ(PA)p→p is small, and P, P∗ are easy to compute. 6 Graph Problems In this section we discuss some applications of generalized preconditioning to network flow problems. Let G = (V, E) be an undirected graph with n vertices and m edges. While undirected, we assume the edges are oriented arbitrarily. We denote by V∗,E∗ the spaces of real-valued functions f : V → R and f : E → R on vertices and edges, respectively. We denote by V,E the corresponding dual spaces of demands and flows. For S ⊆ V , we write 1S ∈ V∗ for the indicator function on S. The discrete derivative operator D∗ : V∗ → E∗ is defined by (D∗f )(xy) = f (y) − f (x) for each oriented edge xy. The constant function has zero derivative, D∗1V = 0. The (negative) adjoint −D : E → V is the discrete divergence operator ; for a flow  ∈ E and vertex x ∈ V , −(D)(x) is the net quantity being transported away from vertex x by the flow. A single-commodity flow problem is specified by a demand vector b ∈ V, and requires finding a flow  ∈ E satisfying D = b, minimizing some cost function. When the cost-function is a norm on E, the problem is a minimum-norm pre-image problem. Assuming G is connected, b has a pre-image iff the total demand 1V · b is zero. We hereafter assume G to be connected and total demands equal to zero. Having established the generalized preconditioning framework, we may now design fast algorithms for fundamental network flow problems by designing generalized preconditioners for the corresponding minimum- norm problems. As a result, we obtain nearly-linear time algorithms for max-flow and uncapacitated min-cost flow in undirected graphs. The max-flow algorithm was presented previously[16], and involved a combination of problem-specific definitions (e.g. congestion approximators) and subroutines (e.g. gradient-based (cid:96)∞ minimization). The brief summary in subsection 6.1 shows how the same result may be immediately obtained by combining theorem ?? with only small part of the earlier flow-specific work[16]: the actual construction of the preconditioner. In section 7, we present a nearly-linear time algorithm for uncapacitated min-cost flows, another fun- damental network optimization problem. Once again, all that is needed is description and analysis of the preconditioner. 1We remark this is only defined on the image space of A, rather than the entire codomain. However, we only consider b in that image space 6 6.1 Max-Flow norm on E∗ by (cid:107)f(cid:107)c∗ =(cid:80) e c(e)f (e); the dual congestion norm on E is defined by (cid:107)(cid:107)c = maxe (e) c(e) . A capacitated graph associates with each edge e, a capacity c(e) > 0. Given capacities, we define the capacity The boundary capacity of a set S ⊆ V is (cid:107)D∗1S(cid:107)c, which we abbreviate as c(∂S). The single-commodity flow problem with capacity norm is undirected maximum flow problem, and is a fundamental problem in network design and optimization. Following the work of Spielman and Teng for (cid:96)2-flows[17], and Madry[13] for cut problems, the author has obtained a nearly-linear time algorithm for maximum flow[16]. We have since realized that only certain parts of the ideas introduced in that paper are actually specific to maximum-flow, and the present work has been obtained through generalizing the other parts. The (previously presented as) flow-specific composition and optimization parts of that paper are entirely subsumed by the earlier sections of this paper. The truly flow-specific part of that work required to complete the algorithm is the generalized preconditioner construction, which we have previously called a congestion-approximator. We briefly describe the main ideas of the construction, and some simple illustrative examples. For the full details, we refer the reader to the third section of [16]. Let F ⊆ 2V be a family of subsets. Such a family, together with a capacity norm on E, induces a cut- 1S·b congestion semi-norm on V via (cid:107)b(cid:107)c(F) = maxS∈F c(∂S) . That is, for each set in the family, consider the ratio of the total aggregate demand in that set to the total capacity of all edges entering that set. If the indicator functions of sets in F span V, then it is a norm. Note also that we may write (cid:107)b(cid:107)c(F) = (cid:107)Pb(cid:107)∞, where P : Rn → RF is defined by (Pb)S = 1S·b c(∂S) . If F is taken to be the full power set F = 2V , the max-flow, min-cut theorem is equivalent to the statement that the non-linear condition number κc→c(F)(D∗) is exactly one. If F is taken to be the family of singleton sets, the non-linear condition number is the inverse of the combinatorial conductance of G. That is, for high- conductance graphs, composition yields a fast algorithm requiring only a simple diagonal preconditioner. This is closely analagous to the situation for (cid:96)2, where diagonal preconditioning yields fast algorithms for graphs of large algebraic conductance. A particularly illustrative example consists of a unit-capacity 2t × 2t 2-D grid. With low (Θ(2−t) = √ n) conductance, the singleton family F performs poorly. A simple but dramatically better family Θ(1/ consists of taking F to be all power-of-two size, power-of-two aligned subgrids. The latter family yields linear condition number O(t) = O(log n). Furthermore, computing the aggregate demand in all such sets requires only O(n) time, with each sub-grid aggregate equal to the sum of its four child aggregates. This algorithm is analagous to an (cid:96)∞ version of multi-grid [?]. Note that the indicator "step" functions 1S are different from the bilinear "pyramid" functions used by multigrid. Theorem 6.1 ([16]). There is an algorithm that given a capacitated graph (G, c) with n vertices and m edges, takes m1+o(1) time and outputs a data structure of size n1+o(1) that efficiently represents a preconditioner P with κ(PD)c→∞ ≤ no(1). Given the data structure, P and P∗ can be applied in n1+o(1) time. Let C : Rm → E be the diagonal capacity matrix; (Cx)(e) = c(e)x(e). The nearly-linear time algorithm follows by using the preconditioner P in the preceding theorem, applying theorem ?? to the problem of minimizing (cid:107)x(cid:107)∞ subject to PDCx = b. A final minor flow-specific part is needed to achieve zero error: the simple (m, 0)-approximation algorithm that consists of routing all flow through a maximum-capacity spanning tree. 7 Uncapacitated Min-Cost Flow the space of flows E is defined by (cid:107)(cid:107)l = (cid:80) In this section, we present a nearly-linear time algorithm for the uncapacitated minimum-cost flow problem on undirected graphs. A cost graph associates a cost l(e) > 0 with each edge e in G. The cost norm on e (cid:107)(e)(cid:107)l(e). The undirected uncapacitated minimum-cost flow problem is specified by the graph G, lengths (cid:96), and demands b ∈ V, and consists of finding  ∈ E with D = b minimizing (cid:107)(cid:107)l. Note that, unlike max-flow, the single-source uncapacitated min-cost flow problem is significantly easier than the distributed source case: the optimal solution is to route along a single-source shortest path away from the source. The problem only becomes interesting with distributed sources and sinks. As a new application of generalized preconditioning, we obtain a nearly-linear time algorithm for approx- imately solving this problem. 7 Theorem 7.1. There is a randomized algorithm that, given a length-graph G = (V, E, l), takes m1+o(1) and outputs a (1 + , 0)-solution to the undirected uncapacitated min-cost flow problem. 2 time As expected, the bulk of the algorithm lies in constructing a good preconditioner. After introducing some useful definitions and lemmas, we spend the majority of this section constructing and analyzing a preconditioner for this problem. Theorem 7.2. There is a randomized algorithm that, given a length-graph G, takes O(m log2 n + n1+o(1)) time and outputs a n1+o(1) × n matrix P with κlto∞(PD) ≤ no(1). Every column of P has no(1) non-zero entries. Dual to cost is the stretch norm on E∗ is (cid:107)f(cid:107)l∗ = maxe f (e)/l(e). We say a function φ ∈ V is L-Lipschitz iff (cid:107)D∗φ(cid:107)l∗ ≤ L; that is, φ(x) − φ(y) ≤ Ll(xy) for all edges xy. The dual problem is to maximize φ · b over 1-Lipschitz φ ∈ V. A length function l induces an intrinsic metric d : V × V → R, with distances determined by shortest paths. The preceding definition of Lipschitz is equivalent to φ(x) − φ(y) ≤ Ld(x, y) for all x, y ∈ V . That is, the Lipschitz constant of φ depends only on the metric, and is otherwise independent of the particular graph or edge lengths inducing that metric. As the dual problem depends only on the induced metric, so must the value of the min-cost flow. Therefore, we may unambiguously write (cid:107)b(cid:107)opt(d) = max{φ · b : φ is 1-Lipschitz w.r.t. d} The monotonicity of cost with distance follows immediately. Lemma 7.3. If d(x, y) ≤ d(x, y) for all x, y ∈ V, then for all b ∈ V⊥1, (cid:107)b(cid:107)opt(d) ≤ (cid:107)b(cid:107)opt(d) We recall that in some cases, the identity operator is a good preconditioner; for max-flow, such is the case in constant-degree expanders. For min-cost flow, the analagous case is a metric where distances between any pair of points differ relatively by small factors. Definition 7.4. Let U ⊆ V . We say U is r-separated if d(x, y) ≥ r for all x, y ∈ U with x (cid:54)= y. We say U is R-bounded if d(x, y) ≤ R for all x, y ∈ U . Lemma 7.5. Let U ⊂ V be R-bounded and r-separated with respect to d. Let b ∈ V⊥1 be demands supported on U . Then, r 2 (cid:107)b(cid:107)1 ≤ (cid:107)b(cid:107)opt(d) ≤ R 2 (cid:107)b(cid:107)1 Proof. Note r the star graph with edge lengths r/2, with a leaf for each x ∈ U ). The inequalities follow by monotonicity. 2(cid:107)b(cid:107)1 is exactly the min-cost of routing b in the metric where all distances are exactly r (consider To complete the proof of theorem 7.1, assuming theorem 7.2, we also need a simple approximation algorithm that yields a poor approximation, but with zero error. This is easily achieved by the algorithm that routes all flow through a minimum cost (i.e., total length) spanning tree T . Lemma 7.6. Let T be a minimum cost spanning tree with respect to l on G. Consider the algorithm that, given b ∈ V⊥1, outputs the flow  ∈ E routing b using only the edges in T . Then, (cid:107)(cid:107) ≤ n(cid:107)b(cid:107)opt(d) Proof. The flow on T is unique, and therefore, optimal for the metric d induced by paths restricted to lie in T . As T is a minimum cost spanning tree, d(x, y) ≤ nd(x, y). We now prove theorem 7.1. Let L : Rm → E be the diagonal length matrix (Lx)(e) = (cid:96)(e)x(e), and let P be the preconditioner from theorem 7.2. Computing P takes O(m log2 n) + n1+o(1) time. The minimum-cost flow problem is equivalent to the problem of minimizing (cid:107)x(cid:107)1 subject to PDL−1x = Pb. As P has n1+o(1) non-zero entries and κ1→1(PDL−1) ≤ no(1), the total running time is m1+o(1) . 2 8 8 Preconditioning Min-Cost Flow A basic concept in metric spaces is that of an embedding: ψ : V → V , with respective metrics d, d. An embedding has distortion L if for some µ > 0, 1 ≤ µ d(ψ(x), ψ(y)) d(x, y) ≤ L Metric embeddings are quite useful for preconditioning; if d embeds into d with distortion L, then the monotonicity lemma implies the relative costs of flow problems differ by a factor L. It follows that if we can construct a preconditioner P for the min-cost flow problem on d, the same P may be used to precondition min-cost flow on d, with condition number at most L-factor worse. Our preconditioner uses embeddings in two ways. The preconditioner itself is based on a certain hi- erarchical routing scheme. Hierarchical routing schemes based on embeddings into tree-metrics have been studied extensively(see e.g. [8]), and immediately yield preconditioners with polylogarithmic condition num- ber. However, we are unable to efficiently implement those schemes in nearly-linear time. Instead, we apply Bourgain's O(log n)-distortion embedding[3] into (cid:96)1. That is, by paying an O(log n) factor in condition number, we may completely restrict our attention to approximating min-cost flow in (cid:96)1 space. Theorem 8.1 (Bourgain's Embedding[3]). Any n-point metric space embeds into (cid:96)p space with distortion O(log n). If d is the intrinsic metric of a length-graph G = (V, E) with m edges, there is a randomized algorithm that takes O(m log2 n) time and w.h.p. outputs such an embedding, with dimension O(log2 n). √ log n), incuring another distortion factor of exp(O( The complexity of constructing and evaluating our preconditioner is exponential in the embedding's di- mension. Therefore, we reduce the dimension to Θ( √ log n)). Theorem 8.2 (Johnson-Lindenstrauss Lemma[10, 6]). Any n points in Euclidean space embed into k- dimensional Euclidean space with distortion nO(1/k), for k ≤ Ω(log n). In particular, k = O(log n) yields √ O(1) distortion, and k = O( an embedding in O(nd) time. If the original points are in d > k dimensions, there is a randomized algorithm that w.h.p outputs such √ log n) yields exp(O( log n)) distortion. √ k = O( of exp(O( log n)). Our reduction consists of first embedding the vertices into (cid:96)2 via theorem 8.1, reducing the dimension to √ log n) using lemma 8.2, and then using the identity embedding of (cid:96)2 into (cid:96)1, for a total distortion To estimate routing costs in (cid:96)1, we propose an extremely simple hierarchical routing algorithm in (cid:96)1, and show it achieves a certain competetive ratio. The routing scheme applies to the exponentially large graph corresponding to a lattice discretization of the k-dimensional cube in (cid:96)1; after describing such a scheme, we show that if the demands in that graph are supported on n vertices, the distributed routing algorithm finds no demand to route in most of the graph, and the same routing algorithm may be carried out in a k − d-tree instead of the entire lattice. On the lattice, the routing algorithm consists of sequentially reducing the support set of the demands from a lattice with spacing 2−t−1 to a lattice with spacing 2−t, until all demand is supported on the corners of a cube containing the original demand points. On each level, the demand on a vertex not appearing in the coarser level is eliminated by pushing its demand to a distribution over the aligned points nearby. 8.1 Lattice Algorithm For t ∈ Z, let Vt = (2−tZ)k be the lattice with spacing 2−t. We design a routing scheme and preconditioner for min-cost flow in (cid:96)1, with initial input demands bT supported on a bounded subset of VT . For t = T, T −1, . . ., the routing scheme recursively reduces a min-cost flow problem with demands supported on Vt to a min-cost flow problem with demands supported on the sparser lattice Vt−1. Given demands bt supported on Vt, the scheme consists of each vertex x ∈ Vt pulling its demand bt(x) uniformly from the closest points to x in Vt−1 along any shortest path, the lengths of which are at most k2−t. For example, a point x = (x1, . . . , xk) ∈ V1 with j ≤ k non-integer coordinates and demand b1(x) pulls b1(x)2−j units of flow from each of the 2j points in V0 corresponding to rounding those j coordinates in any way. By construction, all points in Vt \ Vt−1 have their demands met exactly, and we are left with a reduced problem residual demands bt−1 supported on Vt−1. As we show, eventually the demands are supported entirely on the 2k corners of a hypercube forming a 9 bounding box of the original support set, at which point the the simple scheme of distributing the remaining demand uniformly to all corners is a k-factor approximation. We do not actually carry out the routing; rather, we state a crude upper-bound on its cost, and then show that bound itself exceeds the true min-cost by a factor of some κ. For the preconditioner, we shall only require the sequence of reduced demands bt, bt−1, . . ., and not the flow actually routing them. Theorem 8.3. (cid:107)bt(cid:107)opt ≤ t(cid:88) s=0 k2−s(cid:107)bs(cid:107)1 ≤ 2k(t + 1)(cid:107)bt(cid:107)opt Assuming theorem 8.3 holds, we take our preconditioner to be a matrix P such that, T(cid:88) (cid:107)PbT(cid:107)1 = k2−t(cid:107)bt(cid:107)1 t=0 The proof of theorem 8.3 uses two essential properties of the routing scheme described. The first is that the cost incurred in the reduction from bt to bt−1 is not much larger than the min-cost of routing bt. The second is the reduction does not increase costs. That is, the true min-cost for routing the reduced problem bt−1 is at most that of routing the original demands bt. Lemma 8.4. Let bt−1 be the reduced demands produced when the routing scheme is given bt. Then, 1. The cost incurred by that level of the scheme is at most k2−t(cid:107)bt(cid:107)1 ≤ 2k(cid:107)bt(cid:107)opt 2. The reduction is non-increasing with respect to min-cost: (cid:107)bt−1(cid:107)opt ≤ (cid:107)bt(cid:107)opt Assuming lemma 8.4, we now prove 8.3. We argue the sum is an upper bound on the total cost incurred by the routing scheme, when applied to bt. The left inequality follows immediately, as the true min-cost is no larger. The total cost of the scheme is at most the cost incurred on each level, plus the cost of the final routing of b0. Lemma 8.4(a) accounts for all terms above s = 0. For the final routing, the demands b0 are supported in {0, 1}k, so the cost of routing all demand to a random corner is at most 1 2 k(cid:107)b0(cid:107)1. For the right inequality, we observe t(cid:88) k2−t(cid:107)bt(cid:107)1 ≤ t(cid:88) 2k(cid:107)bs(cid:107)opt The inequality follows termwise, using lemma 8.4(a) for s ≥ 1; the s = 0 case follows from lemma 7.5 because V0 is 1-separated. s=0 s=0 8.2 Proof of Lemma 8.4 For the first part, each vertex x ∈ Vt routes its demand bt(x) to the closest points in Vt−1 any shortest path. As such paths have length at most k2−t, each point x contributes at most k2−tbt(x). For the second part, by scale-invariance it suffices to consider t = 1. Moreover, it suffices to consider the case where b1 consists of a unit demand from between two points x, y ∈ V1 with (cid:107)x − y(cid:107)1 = 1 2 . To see this, we observe any flow routing arbitrary demands b1 consists of a sum of such single-edge flows. As the reduction is linear, if the cost of each single-edge demand-pair is not increased, then the cost their sum is not increased. By symmetry, it suffices to consider x, y with x = (0, z) and y = ( 1 2 , z). Then, the reduction distributes x's demand to a distribution over (0, z(cid:48)) where z(cid:48) ∼ Z(cid:48); y's demand is split over (0, z(cid:48)) and (1, z(cid:48)) where z(cid:48) ∼ Z(cid:48). Therefore, half of the demand at (0, z(cid:48)) is cancelled, leaving the residual problem of routing 1/2 unit from (0, z(cid:48)) to (1, z(cid:48)). That problem has cost 1/2, by routing each fraction directly from (0, z(cid:48)) to (1, z(cid:48)). References [1] Ravindra K Ahuja, Andrew V Goldberg, James B Orlin, and Robert E Tarjan. Finding minimum-cost flows by double scaling. Mathematical programming, 53(1-3):243 -- 266, 1992. 10 [2] Josh Barnes and Piet Hut. A hierarchical o (n log n) force-calculation algorithm. nature, 324(6096):446 -- 449, 1986. [3] J. Bourgain. On lipschitz embedding of finite metric spaces in hilbert space. Israel Journal of Mathe- matics, 52(1):46 -- 52, 1985. [4] Stephen Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University Press, New York, NY, USA, 2004. [5] Samuel I Daitch and Daniel A Spielman. Faster approximate lossy generalized flow via interior point In Proceedings of the fortieth annual ACM symposium on Theory of computing, pages algorithms. 451 -- 460. ACM, 2008. [6] Sanjoy Dasgupta and Anupam Gupta. An elementary proof of a theorem of johnson and lindenstrauss. Random Structures & Algorithms, 22(1):60 -- 65, 2003. [7] Stephen Demko. Condition numbers of rectangular systems and bounds for generalized inverses. Linear Algebra and its Applications, 78:199 -- 206, 1986. [8] Jittat Fakcharoenphol, Satish Rao, and Kunal Talwar. A tight bound on approximating arbitrary metrics by tree metrics. In Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pages 448 -- 455. ACM, 2003. [9] Yoav Freund and Robert E Schapire. Adaptive game playing using multiplicative weights. Games and Economic Behavior, 29(1):79 -- 103, 1999. [10] William B Johnson and Joram Lindenstrauss. Extensions of lipschitz mappings into a hilbert space. Contemporary mathematics, 26(189-206):1, 1984. [11] Jonathan A Kelner, Yin Tat Lee, Lorenzo Orecchia, and Aaron Sidford. An almost-linear-time algorithm for approximate max flow in undirected graphs, and its multicommodity generalizations. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 217 -- 226. Society for Industrial and Applied Mathematics, 2014. [12] Yin Tat Lee and Aaron Sidford. Path finding methods for linear programming: Solving linear programs in o (vrank) iterations and faster algorithms for maximum flow. In Foundations of Computer Science (FOCS), 2014 IEEE 55th Annual Symposium on, pages 424 -- 433. IEEE, 2014. [13] Aleksander Madry. Fast approximation algorithms for cut-based problems in undirected graphs. In Foundations of Computer Science (FOCS), 2010 51st Annual IEEE Symposium on, pages 245 -- 254. IEEE, 2010. [14] Yu Nesterov. Smooth minimization of non-smooth functions. Math. Program., 103(1):127 -- 152, May 2005. [15] Serge A. Plotkin, David B. Shmoys, and Eva Tardos. Fast approximation algorithms for fractional packing and covering problems. Mathematics of Operations Research, 20:257 -- 301, 1995. [16] Jonah Sherman. Nearly maximum flows in nearly linear time. In Foundations of Computer Science (FOCS), 2013 IEEE 54th Annual Symposium on, pages 263 -- 269. IEEE, 2013. [17] Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for preconditioning and solving symmetric, diagonally dominant linear systems. CoRR, abs/cs/0607105, 2006. 11
1904.08255
1
1904
2019-04-17T13:10:38
Online Matching with General Arrivals
[ "cs.DS" ]
The online matching problem was introduced by Karp, Vazirani and Vazirani nearly three decades ago. In that seminal work, they studied this problem in bipartite graphs with vertices arriving only on one side, and presented optimal deterministic and randomized algorithms for this setting. In comparison, more general arrival models, such as edge arrivals and general vertex arrivals, have proven more challenging and positive results are known only for various relaxations of the problem. In particular, even the basic question of whether randomization allows one to beat the trivially-optimal deterministic competitive ratio of $\frac{1}{2}$ for either of these models was open. In this paper, we resolve this question for both these natural arrival models, and show the following. 1. For edge arrivals, randomization does not help --- no randomized algorithm is better than $\frac{1}{2}$ competitive. 2. For general vertex arrivals, randomization helps --- there exists a randomized $(\frac{1}{2}+\Omega(1))$-competitive online matching algorithm.
cs.DS
cs
Online Matching with General Arrivals Buddhima Gamlath EPFL Michael Kapralov∗ EPFL [email protected] [email protected] Andreas Maggiori EPFL Ola Svensson EPFL David Wajc† CMU [email protected] [email protected] [email protected] Abstract The online matching problem was introduced by Karp, Vazirani and Vazirani nearly three decades ago. In that seminal work, they studied this problem in bipartite graphs with vertices arriving only on one side, and presented optimal deterministic and randomized algorithms for this setting. In comparison, more general arrival models, such as edge arrivals and general vertex arrivals, have proven more challenging and positive results are known only for various relaxations of the problem. In particular, even the basic question of whether randomization allows one to beat the trivially-optimal deterministic competitive ratio of 1/2 for either of these models was open. In this paper, we resolve this question for both these natural arrival models, and show the following. 1. For edge arrivals, randomization does not help -- no randomized algorithm is better than 1/2 competitive. 2. For general vertex arrivals, randomization helps -- there exists a randomized (1/2 + Ω(1))- competitive online matching algorithm. 9 1 0 2 r p A 7 1 ] S D . s c [ 1 v 5 5 2 8 0 . 4 0 9 1 : v i X r a ∗Supported in part by ERC Starting Grant 759471. †Work done in part while the author was visiting EPFL. Supported in part by NSF grants CCF-1618280, CCF- 1814603, CCF-1527110, NSF CAREER award CCF-1750808, and a Sloan Research Fellowship. 1 Introduction Matching theory has played a prominent role in the area of combinatorial optimization, with many applications [21, 23]. Moreover, many fundamental techniques and concepts in combinatorial op- timization can trace their origins to its study, including the primal-dual framework [19], proofs of polytopes' integrality beyond total unimodularity [8], and even the equation of efficiency with polytime computability [9]. Given the prominence of matching theory in combinatorial optimization, it comes as little sur- prise that the maximum matching problem was one of the first problems studied from the point of view of online algorithms and competitive analysis. In 1990, Karp, Vazirani, and Vazirani [18] introduced the online matching problem, and studied it under one-sided bipartite arrivals. For such arrivals, Karp et al. noted that the trivial 1/2-competitive greedy algorithm (which matches any arriving vertex to an arbitrary unmatched neighbor, if one exists) is optimal among deterministic algorithms for this problem. More interestingly, they provided an elegant randomized online al- gorithm for this problem, called ranking, which achieves an optimal (1 − 1/e) competitive ratio. (This bound has been re-proven many times over the years [2, 6, 7, 11, 13].) Online matching and many extensions of this problem under one-sided bipartite vertex arrivals were widely studied over the years, both under adversarial and stochastic arrival models. See recent work [5, 15, 16, 17] and the excellent survey of Mehta [22] for further references on this rich literature. Despite our increasingly better understanding of one-sided online bipartite matching and its extensions, the problem of online matching under more general arrival models, including edge arrivals and general vertex arrivals, has remained staunchly defiant, resisting attacks. In particular, the basic questions of whether the trivial 1/2 competitive ratio is optimal for the adversarial edge- arrival and general vertex-arrival models have remained tantalizing open questions in the online algorithms literature. In this paper, we answer both of these questions. 1.1 Prior Work and Our Results Here we outline the most relevant prior work, as well as our contributions. Throughout, we say an algorithm (either randomized or fractional) has competitive ratio α, or equivalently is α-competitive, if the ratio of the algorithm's value (e.g., expected matching size, or overall value,Pe xe) to OPT is at least α 6 1 for all inputs and arrival orders. As is standard in the online algorithms literature on maximization problems, we use upper bounds (on α) to refer to hardness results, and lower bounds to positive results. Edge Arrivals. Arguably the most natural, and the least restricted, arrival model for online matching is the edge arrival model. In this model, edges are revealed one by one, and an online matching algorithm must decide immediately and irrevocably whether to match the edge on arrival, or whether to leave both endpoints free to be possibly matched later. On the hardness front, the problem is known to be strictly harder than the one-sided vertex arrival model of Karp et al. [18], which admits a competitive ratio of 1− 1/e ≈ 0.632. In particular, 1+ln 2 ≈ 0.591 for this problem, recently improved by Epstein et al. [10] gave an upper bound of Huang et al. [16] to 2−√2 ≈ 0.585. (Both bounds apply even to online algorithms with preemption; i.e., allowing edges to be removed from the matching in favor of a newly-arrived edge.) On the positive side, as pointed out by Buchbinder et al. [3], the edge arrival model has proven challenging, and results beating the 1/2 competitive ratio were only achieved under various relaxations, including: random order edge arrival [14], bounded number of arrival batches [20], on trees, either with or without preemption [3, 24], and for bounded-degree graphs [3]. The above papers all asked whether 1 1 there exists a randomized (1/2 + Ω(1))-competitive algorithm for adversarial edge arrivals (see also Open Question 17 in Mehta's survey [22]). In this work, we answer this open question, providing it with a strong negative answer. In particular, we show that no online algorithm for fractional matching (i.e., an algorithm which immediately and irrevocably assigns values xe to edge e upon arrival such that ~x is in the fractional matching polytope P = {~x > ~0 Pe∋v xe 6 1 ∀v ∈ V }) is better than 1/2 competitive. As any randomized algorithm induces a fractional algorithm with the same competitive ratio, this rules out any randomized online matching algorithm which is better than deterministic algorithms. Theorem 1.1. No fractional online algorithm is 1/2 + Ω(1) competitive for online matching under adversarial edge arrivals, even in bipartite graphs. This result shows that the study of relaxed variants of online matching under edge arrivals is not only justified by the difficulty of beating the trivial bound for this problem, but rather by its impossibility. In the online matching problem under vertex arrivals, vertices are General Vertex Arrivals. revealed one at a time, together with their edges to their previously-revealed neighbors. An online matching algorithm must decide immediately and irrevocably upon arrival of a vertex whether to match it (or keep it free for later), and if so, who to match it to. The one-sided bipartite problem studied by Karp et al. [18] is precisely this problem when all vertices of one side of a bipartite graph arrive first. As discussed above, for this one-sided arrival model, the problem is thoroughly understood (even down to lower-order error terms [11]). Wang and Wong [25] proved that general vertex arrivals are strictly harder than one-sided bipartite arrivals, providing an upper bound of 0.625 < 1 − 1/e for the more general problem, later improved by Buchbinder et al. [3] to 3+φ2 ≈ 0.593. Clearly, the general vertex arrival model is no harder than the online edge arrival model but is it easier ? The answer is "yes" for fractional algorithms, as shown by combining our Theorem 1.1 with the 0.526-competitive fractional online matching algorithm under general vertex arrivals of Wang and Wong [25]. For integral online matching, however, the problem has proven challenging, and the only positive results for this problem, too, are for various relaxations, such as restriction to trees, either with or without preemption [3, 4, 24], for bounded-degree graphs [3], or (recently) allowing vertices to be matched during some known time interval [15, 16]. 2 We elaborate on the last relaxation above. In the model recently studied by Huang et al. [15, 16] vertices have both arrival and departure times, and edges can be matched whenever both their endpoints are present. (One-sided vertex arrivals is a special case of this model with all online vertices departing immediately after arrival and offline vertices departing at ∞.) We note that any α-competitive online matching under general vertex arrivals is α-competitive in the less restrictive model of Huang et al. As observed by Huang et al., for their model an optimal approach might as well be greedy; i.e., an unmatched vertex v should always be matched at its departure time if possible. In particular, Huang et al. [15, 16], showed that the ranking algorithm of Karp et al. is optimal in this model, giving a competitive ratio of ≈ 0.567. For general vertex arrivals, however, ranking (and indeed any maximal matching algorithm) is no better than 1/2 competitive, as is readily shown by a path on three edges with the internal vertices arriving first. Consequently, new ideas and algorithms are needed. The natural open question for general vertex arrivals is whether a competitive ratio of (1/2+Ω(1)) is achievable by an integral randomized algorithm, without any assumptions (see e.g., [25]). In this work, we answer this question in the affirmative: Theorem 1.2. There exists a (1/2 + Ω(1))-competitive randomized online matching algorithm for general adversarial vertex arrivals. 2 1.2 Our Techniques Edge Arrivals. All prior upper bounds in the online literature [3, 10, 11, 16, 18] can be rephrased as upper bounds for fractional algorithms; i.e., algorithms which immediately and irrevocably assign each edge e a value xe on arrival, so that ~x is contained in the fractional matching polytope, P = {~x > ~0 Pe∋v xe 6 1 ∀v ∈ V }. With the exception of [3], the core difficulty of these hard instances is uncertainty about "identity" of vertices (in particular, which vertices will neighbor which vertices in the following arrivals). Our hardness instances rely on uncertainty about the "time horizon". In particular, the underlying graph, vertex identifiers, and even arrival order are known to the algorithm, but the number of edges of the graph to be revealed (to arrive) is uncertain. Consequently, an α-competitive algorithm must accrue high enough value up to each arrival time to guarantee a high competitive ratio at all points in time. As we shall show, for competitive ratio 1/2 + Ω(1), this goal is at odds with the fractional matching constraints, and so such a competitive ratio is impossible. In particular, we provide a family of hard instances and formulate their prefix- competitiveness and matching constraints as linear constraints to obtain a linear program whose objective value bounds the optimal competitive ratio. Solving the obtained LP's dual, we obtain by weak duality the claimed upper bound on the optimal competitive ratio. General Vertex Arrivals. Our high-level approach here will be to round online a fractional online matching algorithm's output, specifically that of Wang and Wong [25]. While this approach sounds simple, there are several obstacles to overcome. First, the fractional matching polytope is not integral in general graphs, where a fractional matching may have value,Pe xe, some 3/2 times larger than the optimal matching size. (For example, in a triangle graph with value xe = 1/2 for each edge e.) Therefore, any general rounding scheme must lose a factor of 3/2 on the competitive ratio compared to the fractional algorithm's value, and so to beat a competitive ratio of 1/2 would require an online fractional matching with competitive ratio > 3/4 > 1− 1/e, which is impossible. To make matters worse, even in bipartite graphs, for which the fractional matching polytope is integral and offline lossless rounding is possible [1, 12], online lossless rounding of fractional matchings is impossible, even under one-sided vertex arrivals [5]. Despite these challenges, we show that a slightly better than 1/2-competitive fractional matching computed by the algorithm of [25] can be rounded online without incurring too high a loss, yielding (1/2 + Ω(1))-competitive randomized algorithm for online matching under general vertex arrivals. To outline our approach, we first consider a simple method to round matchings online. When vertex v arrives, we pick an edge {u, v} with probability zu = xuv/ Pr[u free when v arrives], and add it to our matching if u is free. However, we observe that, for the correct set of parameters, the fractional matching algorithm be in our matching with the right marginal probability, xe, resulting in a lossless rounding. Unfor- tunately, we know of no better-than-1/2-competitive fractional algorithm for which this rounding IfPu zu 6 1, this allows us to pick at most one edge per vertex and have each edge e = {u, v} guaranteesPu zu 6 1. of Wang and Wong [25] makesPu zu close to one, while still ensuring a better-than-1/2-competitive algorithm so thatPu zu 6 1+O(ε), while retaining a competitive ratio of 1/2+O(ε). Now consider u = zu/ max{1,Pu zu} and match if u is free. As the sum of zu's is slightly the same rounding algorithm with normalized probabilities: I.e., on v's arrival, sample a neighbor u with probability z′ above one in the worst case, this approach does not drastically reduce the competitive ratio. But the normalization factor is still too significant compared to the competitive ratio of the fractional solution, driving the competitive ratio of the rounding algorithm slightly below 1/2. fractional solution. Namely, as we elaborate later in Section 3.3, we set the parameters of their 3 To account for this minor yet significant loss, we therefore augment the simple algorithm by allowing it, with small probability (e.g., say √ε), to sample a second neighbor u2 for each arriving vertex v, again with probabilities proportional to z′ u2: If the first sampled choice, u1, is free, we match v to u1. Otherwise, if the second choice, u2, is free, we match v to u2. What is the marginal probability that such an approach matches an incoming vertex v to a given neighbor u? Letting Fu denote the event that u is free when v arrives, this probability is precisely Pr[Fu] · z′ u + z′ u · √ε ·Xw w · (1 − Pr[Fw Fu])! . z′ (1) Here the first term in the parentheses corresponds to the probability that v matches to u via the first choice, and the second term corresponds to the same happening via the second choice (which is only taken when the first choice fails). Ideally, we would like (1) to be at least xuv for all edges, which would imply a lossless rounding. However, as mentioned earlier, this is difficult and in general impossible to do, even in much more restricted settings including one-sided bipartite vertex arrivals. We therefore settle for showing that (1) is at least xuv = Pr[Fu] · zu for most edges (weighted by xuv). Even this goal, however, is challenging and requires a nontrivial understanding of the correlation structure of the random events Fu. To see this, note that for example if the Fw events are perfectly positively correlated, i.e., Pr[Fw Fu] = 1, then the possibility of picking e as a second edge does not increase this edge's probability of being matched at all compared to if we only picked a single edge per vertex. This results in e being matched with probability Pr[Fu] · z′ does not lead to any gain over the 1/2 competitive ratio of greedy. Such problems are easily shown not to arise if all Fu variables are independent or negatively correlated. Unfortunately, positive correlation does arise from this process, and so we the need to control these positive correlations. The core of our analysis is therefore dedicated to showing that even though positive correlations do arise, they are by and large rather weak. Our main technical contribution consists of developing techniques for bounding such positive correlations. The idea behind the analysis is to consider the primary choices and secondary choices of vertices as defining a graph, and showing that after a natural pruning operation that reflects the structure of dependencies, most vertices are most often part of a very small connected component in the graph. The fact that connected components are typically very small is exactly what makes positive correlations weak and results in the required lower bound on (1) for most edges (in terms of x-value), which in turn yields our 1/2 + Ω(1) competitive ratio. u = Pr[Fu] · zu/Pw zw = xuv/Pw zw, which 2 Edge Arrivals In this section we prove the asymptotic optimality of the greedy algorithm for online matching under adversarial edge arrivals. As discussed briefly in Section 1, our main idea will be to provide a "prefix hardness" instance, where an underlying input and the arrival order is known to the online matching algorithm, but the prefix of the input to arrive (or "termination time") is not. Consequently, the algorithm must accrue high enough value up to each arrival time, to guarantee a high competitive ratio at all points in time. As we show, the fractional matching constraints rule out a competitive ratio of 1/2 + Ω(1) even in this model where the underlying graph is known. Theorem 2.1. There exists an infinite family of bipartite graphs with maximum degree n and edge arrival order for which any online matching algorithm is at best(cid:16) 1 2 + 1 2n+2(cid:17)-competitive. 4 Proof. We will provide a family of graphs for which no fractional online matching algorithm has better competitive ratio. Since any randomized algorithm induces a fractional matching algorithm, this immediately implies our claim. The nth graph of the family, Gn = (U, V, E), consists of a bipartite graph with U = V = n vertices on either side. We denote by ui ∈ U and vi ∈ V the ith node on the left and right side of Gn, respectively. Edges are revealed in n discrete rounds. In round i = 1, 2, . . . , n, the edges of a perfect matching between the first i left and right vertices arrive in some order. I.e., a matching of u1, u2, . . . , ui and v1, v2, . . . , vi is revealed. Specifically, edges (uj, vi−j+1) for all i > j arrive. (See Figure 1 for example.) Intuitively, the difficulty for an algorithm attempting to assign much value to edges of OP T is that the (unique) maximum matching OP T changes every round, and no edge ever re-enters OP T . U u1 u2 u3 u4 u5 V v1 v2 v3 v4 v5 U u1 u2 u3 u4 u5 V v1 v2 v3 v4 v5 U u1 u2 u3 u4 u5 V v1 v2 v3 v4 v5 U u1 u2 u3 u4 u5 V v1 v2 v3 v4 v5 U u1 u2 u3 u4 u5 V v1 v2 v3 v4 v5 (a) round 1 (b) round 2 (c) round 3 (d) round 4 (e) round 5 Figure 1: G5, together with arrival order. Edges of current (prior) round are solid (dashed). Consider some α-competitive fractional algorithm A. We call the edge of a vertex w in the (unique) maximum matching of the subgraph of Gn following round i the ith edge of w. For i > j, denote by xi,j the value A assigns to the ith edge of vertex uj (and of vi−j+1); i.e., to (uj, vi−j+1). By feasibility of the fractional matching output by A, we immediately have that xi,j > 0 for all i, j, as well as the following matching constraints for uj and vj. (For the latter, note that the ith edge of vi−j+1 is assigned value xi,j = xi,i−(i−j+1)+1 and so the ith edge of vj is assigned value xi,i−j+1). xi,j 6 1. (uj matching constraint) nXi=j xi,i−j+1 6 1. (vj matching constraint) nXi=j (2) (3) On the other hand, as A is α-competitive, we have that after some kth round -- when the maximum matching has cardinality k -- algorithm A's fractional matching must have value at least α · k. (Else an adversary can stop the input after this round, leaving A with a worse than α-competitive matching.) Consequently, we have the following competitiveness constraints. kXi=1 iXj=1 xi,j > α · k ∀k ∈ [n]. (4) Combining constraints (2), (3) and (4) together with the non-negativity of the xi,k yields the following linear program, LP(n), whose optimal value upper bounds any fractional online matching algorithm's competitiveness on Gn, by the above. 5 maximize α subject to: Pn Pn Pk i=1Pi xi,j > 0 i=j xi,j 6 1 i=j xi,i−j+1 6 1 j=1 xi,j > α · k ∀j ∈ [n] ∀j ∈ [n] ∀k ∈ [n] ∀i, j ∈ [n]. To bound the optimal value of LP(n), we provide a feasible solution its LP dual, which we denote by Dual(n). By weak duality, any dual feasible solution's value upper bounds the optimal value of LP(n), which in turn upper bounds the optimal competitive ratio. Using the dual variables ℓj, rj for the degree constraints of the jth left and right vertices respectively (uj and vj) and dual variable ck for the competitiveness constraint of the kth round, we get the following dual linear program. Recall here again that xi,i−j+1 appears in the matching constraint of vj, with dual variable rj, and so xi,j = xi,i−(i−j+1)+1 appears in the same constraint for vi−j+1.) minimize Pn subject to: Pn j=1 (ℓj + rj) k=1 k · ck > 1 ℓj + ri−j+1 −Pn ℓj, rj, ck > 0 k=i ck > 0 ∀i ∈ [n], j ∈ [i] ∀j, k ∈ [n]. We provide the following dual solution. 2 ck = n(n + 1) ℓj = rj =( n−2(j−1) n(n+1) 0 ∀k ∈ [n] if j 6 n/2 + 1 if n/2 + 1 < j 6 n. We start by proving feasibility of this solution. The first constraint is satisfied with equality. 2(n−i+1) For the second constraint, as Pn n(n+1) for all i ∈ [n], j ∈ [i]. Note that if j > n/2 + 1, then ℓj = rj = 0 > n−2(j−1) n(n+1) . So, for all j we n(n+1) + n−2(i−j+1−1) for all have ℓj = rj > i ∈ [n], j ∈ [i]. Non-negativity of the ℓj, rj, ck variables is trivial, and so we conclude that the above is a feasible dual solution. n−2(j−1) n(n+1) . Consequently, ℓj + ri−j+1 > it suffices to show that ℓj + ri−j+1 > k=i ck = 2(n−i+1) = 2(n−i+1) n(n+1) n−2(j−1) n(n+1) n(n+1) It remains to calculate this dual feasible solution's value. We do so for n even,1 for which nXj=1 (ℓj + rj) = 2 · nXj=1 ℓj = 2 · n/2+1Xj=1 n − 2(j − 1) n(n + 1) = 1 2 + 1 2n + 2 , completing the proof. Remark 1. Recall that Buchbinder et al. [3] and Lee and Singla [20] presented better-than- 1/2-competitive algorithms for bounded-degree graphs and bounded number of arrival batches. Our upper bound above shows that a deterioration of the competitive guarantees as the maximum degree and number of arrival batches increase (as in the algorithms of [3, 20]) is inevitable. Remark 2. Recall that the asymptotic competitive ratio of an algorithm is the maximum c such that the algorithm always guarantees value at least ALG > c · OP T − b for some fixed b > 0. Our proof extends to this weaker notion of competitiveness easily, by revealing multiple copies of the hard family of Theorem 2.1 and letting xik denote the average of its counterparts over all copies. 1The case of n odd is similar. As it is unnecessary to establish the result of this theorem, we omit it. 6 3 General Vertex Arrivals In this section we present a (1/2 + Ω(1))-competitive randomized algorithm for online matching under general arrivals. As discussed in the introduction, our approach will be to round (online) a fractional online matching algorithm's output. Specifically, this will be an algorithm from the family of fractional algorithms introduced in [25]. In Section 3.1 we describe this family of algorithms. To motivate our rounding approach, in Section 3.2 we first present a simple lossless rounding method for a 1/2-competitive algorithm in this family. In Section 3.3 we then describe our rounding algorithm for a better-than-1/2-competitive algorithm in this family. Finally, in Section 3.4 we analyze this rounding scheme, and show that it yields a (1/2 + Ω(1))-competitive algorithm. 3.1 Finding a fractional solution In this section we revisit the algorithm of Wang and Wong [25], which beats the 1/2 competitiveness barrier for online fractional matching under general vertex arrivals. Their algorithm (technically, family of algorithms) applies the primal-dual method to compute both a fractional matching and a fractional vertex cover -- the dual of the fractional matching relaxation. The LPs defining these dual problems are as follows. Primal-Matching maximize Pe∈E xe subject to: Pu∈N (v) xuv 6 1 ∀u ∈ V ∀e ∈ E xe > 0 Dual-Vertex Cover minimize Pu∈V yu subject to: yu + yv > 1 ∀e = {u, v} ∈ E yu > 0 ∀u ∈ V Before introducing the algorithm of [25], we begin by defining the fractional online vertex cover problem for vertex arrivals. When a vertex v arrives, if Nv(v) denotes the previously-arrived neighbors of v, then for each u ∈ Nv(v), a new constraint yu + yv > 1 is revealed, which an online algorithm should satisfy by possibly increasing yu or yv. Suppose v has its dual value set to yv = 1 − θ. Then all of its neighbors should have their dual increased to at least θ. Indeed, an algorithm may as well increase yu to max{yu, θ}. The choice of θ therefore determines an online fractional vertex cover algorithm. The increase of potential due to the newly-arrived vertex v is thus 1 − θ +Pu∈Nv(v)(θ − yu)+.2 In [25] θ is chosen to upper bound this term by 1 − θ + f (θ) for some function f (·). The primal solution (fractional matching) assigns values xuv so as to guarantee feasibility of ~x and a ratio of β between the primal and dual values of ~x and ~y, implying 1 β -competitiveness of this online fractional matching algorithm, by feasibility of ~y and weak duality. The algorithm, parameterized by a function f (·) and parameter β to be discussed below, is given formally in Algorithm 1. In the subsequent discussion, Nv(u) denotes the set of neighbors of u that arrive before v. Algorithm 1 is parameterized by a function f and a constant β. The family of functions considered by [25] are as follows. As we will see, choices of β guaranteeing feasibility of ~x are related to the following quantity. Definition 3.1. Let fκ(θ) :=(cid:0) 1+κ Definition 3.2. For a given f : [0, 1] −→ R+ let β∗(f ) := maxθ∈[0,1] 1 + f (1 − θ) +R 1 2κ (cid:0)θ + κ−1 2 − θ(cid:1) 1+κ 2Here and throughout the paper, we let x+ := max{0, x} for all x ∈ R. 2κ . We define W := {fκ κ > 1}. 2 (cid:1) κ−1 1−t f (θ) dθ. θ 7 Input : A stream of vertices v1, v2, . . . vn. At step i, vertex vi and Nvi(vi) are revealed. Output: A fractional vertex cover solution ~y and a fractional matching ~x. 1 Let yu ← 0 for all u, let xuv ← 0 for all u, v. 2 foreach v in the stream do 3 4 5 6 7 maximize θ subject to: θ 6 1 Pu∈Nv(v) (θ − yu)+ (cid:16)1 + 1−θ f (θ)(cid:17) . foreach u ∈ Nv(v) do xuv ←− (θ−yu)+ yu ←− max{yu, θ}. β 6 f (θ) yv ←− 1 − θ. Algorithm 1: Online general vertex arrival fractional matching and vertex cover For functions f ∈ W this definition of β∗(f ) can be simplified to β∗(f ) = 1 + f (0), due to the observation (see [25, Lemmas 4,5]) that all functions f ∈ W satisfy β∗(f ) = 1 + f (1 − θ) +Z 1 θ 1 − θ f (θ) dθ ∀θ ∈ [0, 1]. (5) As mentioned above, the competitiveness of Algorithm 1 for appropriate choices of f and β is later), one can even bound individual vertices' contributions to these sums. In particular, for any obtained by relating the overall primal and dual values,Pe xe andPv yv. As we show (and rely on vertex v's arrival time, each vertex u's contribution to Pe xe, which we refer to as its fractional degree, xu :=Pw∈Nv(u) xuw, can be bounded in terms of its dual value by this point, yu, as follows. fractional degree just before v arrives, xu :=Pw∈Nv(u) xuw, is bounded as follows: Lemma 3.3. For any vertex u, v ∈ V , let yu be the potential of u prior to arrival of v. Then the yu β 6 xu 6 yu + f (1 − yu) . β Broadly, the lower bound on xu is obtained by lower bounding the increase xu by the increase to yu/β after each vertex arrival, while the upper bound follows from a simplification of a bound given in [25, Invariant 1] (implying feasibility of the primal solution), which we simplify using (5). See Appendix B for a full proof. Another observation we will need regarding the functions f ∈ W is that they are decreasing. Observation 3.4. Every function f ∈ W is non-increasing in its argument in the range [0, 1]. Proof. As observed in [25], differentiating (5) with respect to z yields −f ′(1 − z) − 1−z f (z) = 0, from which we obtain f (z) · f ′(1 − z) = z − 1. Replacing z by 1 − z, we get f (1 − z) · f ′(z) = −z, or f ′(z) = − z f (1−z) . As f (z) is positive for all z ∈ [0, 1], we have that f ′(z) < 0 for all z ∈ [0, 1]. The next lemma of [25] characterizes the achievable competitiveness of Algorithm 1. Lemma 3.5 ([25]). Algorithm 1 with function f ∈ W and β > β∗(f ) = 1 + f (0) is 1 β competitive. Wang and Wong [25] showed that taking κ ≈ 1.1997 and β = β∗(fκ), Algorithm 1 is ≈ 0.526 In later sections we show how to round the output of Algorithm 1 with fκ with competitive. κ = 1 + 2ε for some small constant ε and β = 2 − ε to obtain a (1/2 + Ω(1))-competitive algorithm. But first, as a warm up, we show how to round this algorithm with κ = 1 and β = β∗(f1) = 2. 8 3.2 Warmup: a 1/2-competitive randomized algorithm In this section we will round the 1/2-competitive fractional algorithm obtained by running Algo- rithm 1 with function f (θ) = f1(θ) = 1 − θ and β = β∗(f ) = 2. We will devise a lossless rounding of this fractional matching algorithm, by including each edge e in the final matching with a proba- bility equal to the fractional value xe assigned to it by Algorithm 1. Note that if v arrives after u, then if Fu denotes the event that u is free when v arrives, then edge {u, v} is matched by an online algorithm with probability Pr[{u, v} ∈ M ] = Pr[{u, v} ∈ M Fu]· Pr[Fu]. Therefore, to match each edge {u, v} with probability xuv, we need Pr[{u, v} ∈ M Fu] = xuv/ Pr[Fu]. That is, we must match {u, v} with probability zu = xuv/ Pr[Fu] conditioned on u being free. The simplest way of doing so (if possible) is to pick an edge {u, v} with the above probability zu always, and to match it only if u is free. Algorithm 2 below does just this, achieving a lossless rounding of this fractional algorithm. As before, Nv(u) denotes the set of neighbors of u that arrive before v. Input : A stream of vertices v1, v2, . . . , vn. At step i, vertex vi and Nvi(vi) are revealed. Output: A matching M . 1 Let yu ← 0 for all u, let xuv ← 0 for all u, v. 2 Let M ← ∅. 3 foreach v in the stream do 4 Update yu's and xuv's using Algorithm 1 with β = 2 and f = f1. foreach u ∈ Nv(v) do 5 6 7 8 9 zu ← Pr[u is free when v arrives] . xuv // zu is xuv/(1 − yu) as shown later Sample (at most) one neighbor u ∈ Nv(v) according to zu. if a free neighbor u is sampled then Add {u, v} to M . Algorithm 2: Online vertex arrival warmup randomized fractional matching Algorithm 2 is well defined if for each vertex v's arrival, z is a probability distribution; i.e., Pu∈Nv(v) zu 6 1. The following lemma asserts precisely that. Moreover, it asserts that Algorithm 2 matches each edge with the desired probability. Lemma 3.6. Algorithm 2 is well defined, since for every vertex v on arrival, z is a valid probability distribution. Moreover, for each v and u ∈ Nv(v), it matches edge {u, v} with probability xe. Proof. We prove both claims in tandem for each v, by induction on the number of arrivals. For the base case (v is the first arrival), the set Nv(v) is empty and thus both claims are trivial. Consider the arrival of a later vertex v. By the inductive hypothesis we have that each vertex u ∈ Nv(v) is β = 2, if w arrives after u, then yu and θ at arrival of w satisfy xuw = (θ−yu)+ That is, xuw is precisely the increase in yu following arrival of w. On the other hand, when u arrived previously matched with probabilityPw∈Nv(u) xwu. But by our choice of f (θ) = f1(θ) = 1 − θ and f (θ)(cid:17) = (θ−yu)+. we have that its dual value yu increased by 1 − θ =Pv′∈Nu(u)(θ − yv′)+ =Pv′∈Nu(u) xuv′. To see this last step, we recall first that by definition of Algorithm 1 and our choice of f (θ) = 1 − θ, the value θ on arrival of v is chosen to be the largest θ 6 1 satisfying ·(cid:16)1 + 1−θ β X∀u∈Nv(v) (θ − yu)+ 6 1 − θ. (6) But the inequality (6) is an equality whether or not θ = 1 (if θ = 1, both sides are zero). We conclude that yu =Pv′∈Nv(u) xuv′ just prior to arrival of v. But then, by the inductive hypothesis, 9 this implies that Pr[u free when v arrives] = 1 − yu (yielding an easily-computable formula for zu). Consequently, by (6) we have that when v arrives z is a probability distribution, as (θ − yu)+ 6 1. Xu∈Nv(v) zu = Xu∈Nv(v) (θ − yu)+ 1 − yu 6 Xu∈Nv(v): yu6θ 1 − θ (θ − yu)+ 1 − θ = Xu∈Nv(v) Finally, for u to be matched to a latter-arriving neighbor v, it must be picked and free when v arrives, and so {u, v} is indeed matched with probability Pr[{u, v} ∈ M ] = Pr[u is free when v arrives] · Pr[u is free when v arrives] = xuv. xuv In the next section we present an algorithm which allows to round better-than-1/2-competitive algorithms derived from Algorithm 1. 3.3 An improved algorithm In this section, we build on Algorithm 2 and show how to improve it to get a (1/2+Ω(1)) competitive ratio. There are two concerns when modifying Algorithm 2 to work for a general function from the family W . The first is how to compute the probability that a vertex u is free when vertex v arrives, in Line 6. In the simpler version, we inductively showed that this probability is simply 1−yu, where yu is the dual value of u as of v's arrival (see the proof of Lemma 3.6). With a general function f , this probability is no longer given by a simple formula. Nevertheless, it is easily fixable: We can either use Monte Carlo sampling to estimate the probability of u being free at v's arrival to a given inverse polynomial accuracy, or we can in fact exactly compute these probabilities by maintaining their marginal values as the algorithm progresses. In what follows, we therefore assume that our algorithm can compute these probabilities exactly. The second and more important issue is with the sampling step in Line 7. In the simpler algo- rithm, this step is well-defined as the sampling probabilities indeed form a valid distribution: I.e., Pu∈Nv(v) zu 6 1 for all vertices v. However, with a general function f , this sum can exceed one, rendering the sampling step in Line 7 impossible. Intuitively, we can normalize the probabilities to make it a proper distribution, but by doing so, we end up losing some amount from the approxi- mation guarantee. We hope to recover this loss using a second sampling step, as we mentioned in Section 1.2 and elaborate below. significant to ignore. Suppose that, instead of β = 2 and f = f1 (i.e., the function f (θ) = 1 − θ), we use f = f1+2ε and β = 2 − ε to define xuv and yu values. As we show later in this section, for an ε sufficiently 1 + O(ε). However, since the approximation factor of the fractional solution is only 1/2 + O(ε) Now suppose that we allow arriving vertices to sample a second edge with a small (i.e., √ε) probability and match that second edge if the endpoint of the first sampled edge is already matched. u denote the normalized zu values. Further let Fw denote the event that vertex w is free (i.e, unmatched) at the arrival of v. Then the probability that v matches u for some u ∈ Nv(v) using either of the two sampled edges is small, we then have Pu∈Nv(v) zu 6 1 + O(ε), implying that the normalization factor is at most for such a solution, (i.e., P{u,v}∈E xuv > (1/β) ·Pu∈V yu), the loss due to normalization is too Consider the arrival of a fixed vertex v such thatPu∈Nv(v) zu > 1, and let z′ w · (1 − Pr[Fw Fu]) , Pr[Fu] ·z′ u√ε · Xw∈Nv(v) u + z′ (7) z′ 10 which is the same expression from (1) from Section 1.2, restated here for quick reference. Recall that the first term inside the parentheses accounts for the probability that v matches u via the first sampled edges, and the second term accounts for the probability that the same happens via the second sampled edge. Note that the second sampled edge is used only when the first one is incident to an already matched vertex and the other endpoint of the second edge is free. Hence we have the summation of conditional probabilities in the second term, where the events are conditioned on the other endpoint, u, being free. If the probability given in (7) is xuv for all {u, v} ∈ E, we would have the same guarantee as the fractional solution xuv, and the rounding would be lossless. This seems unlikely, yet we can show that the quantity in (7) is at least (1 − ε2)· xuv for most (not by number, but by the total fractional value of xuv's) of the edges in the graph, showing that our rounding is almost lossless. We postpone further discussion of the analysis to Section 3.4 where we highlight the main ideas before proceeding with the formal proof. Input : A stream of vertices v1, v2, . . . , vn. At step i, vertex vi and Nvi(v) are revealed. Output: A matching M . 1 Let yu ← 0 for all u, let xuv ← 0 for all u, v. 2 Let M ← ∅. 3 foreach v in the stream do 4 */ */ 5 6 7 8 9 10 11 12 13 14 15 16 Update yu's and xuv's using Algorithm 1 with β = 2 − ε and f = f1+2ε. foreach u ∈ Nv(v) do /* Compute Pr[u is free when v arrives] as explained in Section 3.3 zu ← Pr[u is free when v arrives] . xuv foreach u ∈ Nv(v) do z′ u ← zu/ maxn1,Pu∈Nv(v) zuo. Pick (at most) one u1 ∈ Nv(v) with probability z′ u1. if Pu∈Nv(v) zu > 1 then With probability √ε, pick (at most) one u2 ∈ Nv(v) with probability z′ /* Probability of dropping edge {u, v} can be computed using (7). Drop u2 with minimal probability ensuring {u2, v} is matched with probability at most xu2v. u2. if a free neighbor u1 is sampled then Add {u1, v} to M . else if a free neighbor u2 is sampled then Add {u2, v} to M . Algorithm 3: A randomized online matching algorithm under general vertex arrivals. Our improved algorithm is outlined in Algorithm 3. Up until Line 6, it is similar to Algorithm 2 except that it uses β = 2 − ε and f = f1+2ε where we choose ε > 0 to be any constant small enough such that the results in the analysis hold. In Line 8, if the sum of zu's exceeds one we normalize the zu to obtain a valid probability distribution z′ u. In Line 9, we sample the first edge incident to an arriving vertex v. In Line 11, we sample a second edge incident to the same vertex with probability √ε if we had to scale down zu's in Line 8. Then in Line 12, we drop the sampled second edge with the minimal probability to ensure that no edge {u, v} is matched with probability more than xuv. Since (7) gives the exact probability of {u, v} being matched, this probability of dropping an edge {u, v} can be computed by the algorithm. However, to compute this, we need the 11 conditional probabilities Pr[Fw Fu], which again can be estimated using Monte Carlo sampling3. In the subsequent lines, we match v to a chosen free neighbor (if any) among its chosen neighbors, prioritizing its first choice. For the purpose of analysis we view Algorithm 3 as constructing a greedy matching on a directed acyclic graph (DAG) Hτ defined in the following two definitions. Definition 3.7 (Non-adaptive selection graph Gτ ). Let τ denote the random choices made by the vertices of G. Let Gτ be the DAG defined by all the arcs (v, u1), (v, u2) for all vertices v ∈ V . We call the arcs (v, u1) primary arcs, and the arcs (v, u2) the secondary arcs. Definition 3.8 (Pruned selection graph Hτ ). Now construct Hτ from Gτ by removing all arcs (v, u) (primary or secondary) such that there exists a primary arc (v′, u) with v′ arriving before v. We further remove a secondary arc (v, u) if there is a primary arc (v, u); i.e., if a vertex u has at least one incoming primary arc, remove all incoming primary arcs that came after the first primary arc and all secondary arcs that came after or from the same vertex as the first primary arc. It is easy to see that the matching constructed by Algorithm 3 is a greedy matching constructed on Hτ based on order of arrival and prioritizing primary arcs. The following lemma shows that the set of matched vertices obtained by this greedy matching does not change much for any change in the random choices of a single vertex v, which will prove useful later on. It can be proven rather directly by an inductive argument showing the size of the symmetric difference in matched vertices in Gτ and Gτ ′ does not increase after each arrival besides the arrival of v, whose arrival clearly increases this symmetric difference by at most two. See Appendix A for details. Lemma 3.9. Let Gτ and Gτ ′ be two realizations of the random digraph where all the vertices in the two graphs make the same choices except for one vertex v. Then the number of vertices that have different matched status (free/matched) in the matchings computed in Hτ and Hτ ′ at any point of time is at most two. 3.4 Analysis In this section, we analyze the competitive ratio of Algorithm 3. We start with an outline of the analysis where we highlight the main ideas. 3.4.1 High-Level Description of Analysis As described in Section 3.3, the main difference compared to the simpler 1/2-competitive algorithm is the change of the construction of the fractional solution, which in turn makes the rounding more complex. The majority of the analysis is therefore devoted to such "problematic" vertices since otherwise, In particular, we may have at the arrival of a vertex v that Pu∈Nv(v) zu > 1. if Pu∈Nv(v) zu 6 1, the rounding is lossless due to the same reasons as described in the simpler setting of Section 3.2. We now outline the main ideas in analyzing a vertex v withPu∈Nv(v) zu > 1. Let Fw be the event that vertex w is free (i.e., unmatched) at the arrival of v. Then, as described in Section 3.3, the probability that we select edge {u, v} in our matching is the minimum of xuv (because of the pruning in Line 12), and Pr[Fu] ·z′ z′ w · (1 − Pr[Fw Fu]) . 3It is also possible to compute them exactly if we allow the algorithm to take exponential time. u + z′ u√ε · Xw∈Nv(v) 12 By definition, Pr[Fu] · zu = xuv, and the expression inside the parentheses is at least zu (implying Pr[{u, v} ∈ M ] = xuv) if 1 + √ε · Xw∈Nv(v) z′ w · (1 − Pr[Fw Fu]) > zu z′ u . (8) To analyze this inequality, we first use the structure of the selected function f = f1+2ε and the (see Lemma 3.10 and Corollary 3.11 in Section 3.4.2). In particular, there are absolute constants 0 < c < 1 and C > 1 (both independent of ε) such that selection of β = 2 − ε to show that if Pu∈Nv(v) zu > 1 then several structural properties hold 1. Pu∈Nv(v) zu 6 1 + Cε; 2. zu 6 C√ε for every u ∈ Nv(v); and 3. c 6 Pr[Fw] 6 1 − c for every w ∈ Nv(v). The first property implies that the right-hand-side of (8) is at most 1+ Cε; and the second property implies that v has at least Ω(1/√ε) neighbors and that each neighbor u satisfies z′ u 6 zu 6 C√ε. For simplicity of notation, we assume further in the high-level overview that v has exactly 1/√ε u = √ε. Inequality (8) would then be implied by neighbors and each u ∈ Nv(v) satisfies z′ Xw∈Nv(v) (1 − Pr[Fw Fu]) > C . (9) To get an intuition why we would expect the above inequality to hold, it is instructive to consider the unconditional version: Xw∈Nv(v) (1 − Pr[Fw]) > cNv(v) = c/√ε ≫ C , where the first inequality is from the fact that Pr[Fw] 6 1 − c for any neighbor w ∈ Nv(v). The large slack in the last inequality, obtained by selecting ε > 0 to be a sufficiently small constant, is used to bound the impact of conditioning on the event Fu. Indeed, due to the large slack, we have that (9) is satisfied if the quantity Pw∈Nv(v) Pr[FwFu] is not too far away from the same summation with unconditional probabilities, i.e., Pw∈Nv(v) Pr[Fw]. Specifically, it is sufficient to show Xw∈Nv(v) (Pr[FwFu] − Pr[Fw]) 6 c/√ε − C . (10) We do so by bounding the correlation between the events Fu and Fw in a highly non-trivial manner, which constitutes the heart of our analysis. The main challenges are that events Fu and Fw can be positively correlated and that, by conditioning on Fu, the primary and secondary choices of different vertices are no longer independent. We overcome the last difficulty by replacing the conditioning on Fu by a conditioning on the component in Hτ (at the time of v's arrival) that includes u. As explained in Section 3.3, the matching output by our algorithm is equivalent to the greedy matching constructed in Hτ and so the component containing u (at the time of v's arrival) determines Fu. But how can this component look like, assuming the event Fu? First, u cannot have any incoming primary arc since then u would be matched (and so the event Fu would be false). However, u could have incoming secondary arcs, 13 u u Figure 2: Two examples of the component of Hτ containing u. Vertices are depicted from right to left in the arrival order. Primary and secondary arcs are solid and dashed, respectively. The edges that take part in the matching are thick. assuming that the tails of those arcs are matched using their primary arcs. Furthermore, u can have an outgoing primary and possibly a secondary arc if the selected neighbors are already matched. These neighbors can in turn have incoming secondary arcs, at most one incoming primary arc (due to the pruning in the definition of Hτ ), and outgoing primary and secondary arcs; and so on. In Figure 2, we give two examples of the possible structure, when conditioning on Fu, of u's component in Hτ (at the time of v's arrival). The left example contains secondary arcs, whereas the component on the right is arguably simpler and only contains primary arcs. An important step in our proof is to prove that, for most vertices u, the component is of the simple form depicted to the right with probability almost one. That is, it is a path P consisting of primary arcs, referred to as a primary path (see Definition 3.13) that further satisfies: (i) it has length O(ln(1/ε)); and (ii) the total z-value of the arcs in the blocking set of P is O(ln(1/ε)). The blocking set is defined in Definition 3.14. Informally, it contains those arcs that if appearing as primary arcs in Gτ would cause arcs of P to be pruned (or blocked) from Hτ . Let P be the primary paths of above type that appear with positive probability as u's component in Hτ . Further let EQP be the event that u's component equals P . Then we show (for most vertices) thatPP ∈P Pr[EQP Fu] is almost one. For simplicity, let us assume here that the sum is equal to one. Then by the law of total probability and sincePP ∈P Pr[EQP Fu] = 1, (Pr[Fw Fu, EQP ] − Pr[Fw]) Xw∈Nv(v) (Pr[Fw EQP ] − Pr[Fw]) , (Pr[Fw Fu] − Pr[Fw]) = XP ∈P = XP ∈P Pr[EQP Fu] Xw∈Nv(v) Pr[EQP Fu] Xw∈Nv(v) where the last equality is because the component P determines Fu. The proof is then completed by analyzing the term inside the parentheses for each primary path P ∈ P separately. As we prove in Lemma 3.15, the independence of primary and secondary arc choices of vertices is maintained after conditioning on EQP .4 Furthermore, we show that there is a bijection between the outcomes of the unconditional and the conditional distributions, so that the expected number of vertices 4To be precise, conditioning on a primary path P with a so-called termination certificate T , see Definition 3.13. In the overview, we omit this detail and consider the event EQP,T (instead of EQP ) in the formal proof. 14 that make different choices under this pairing can be upper bounded by roughly the length of the path plus the z-value of the edges in the blocking set. So, for a path P as above, we have that the expected number of vertices that make different choices in the paired outcomes is O(ln(1/ε)) which, by Lemma 3.9, implies that the expected number of vertices that change matched status is also upper bounded by O(ln(1/ε)). In other words, we have for every P ∈ P that (Pr[FwEQP ] − Pr[Fw]) = O(ln(1/ε)), Xw∈Nv(v) (Pr[FwEQP ] − Pr[Fw]) 6 Xw∈V which implies (10) for a small enough choice of ε. This completes the overview of the main steps in the analysis. The main difference in the formal proof is that not all vertices satisfy that their component is a short primary path with probability close to 1. To that end, we define the notion of good vertices in Section 3.4.4, which are the vertices that are very unlikely to have long directed paths of primary arcs rooted at them. These are exactly the vertices v for which we can perform the above analysis for most neighbors u (in the proof of the "key lemma") implying that the rounding is almost lossless for v. Then, in Section 3.4.6, we show using a rather simple charging scheme that most of the vertices in the graph are good. Finally, in Section 3.4.7, we put everything together and prove Theorem 1.2. 3.4.2 Useful Properties of W Functions and Algorithm 3 For the choice of f = f1+2ε as we choose, we have f (θ) = (1 + ε − θ)·(cid:16) θ+ε 1+2ε . In Appendix C we give a more manageable upper bound for f (θ) which holds for sufficiently small ε. Based on this simple upper bound on f and some basic calculus, we obtain the following useful structural properties for the conditional probabilities, zu, of Algorithm 3. See Appendix C. Lemma 3.10. (Basic bounds on conditional probabilities zu) There exist absolute constants c ∈ (0, 1) and C > 1/c > 1 and ε0 ∈ (0, 1) such that for every ε ∈ (0, ε0) the following holds: for every vertex v ∈ V , if yu is the dual variable of a neighbor u ∈ Nv(v) before v's arrival and θ is the value chosen by Algorithm 1 on v's arrival, then for zu as defined in Algorithm 3, we have: 1+ε−θ(cid:17) ε (1) If θ 6∈ (c, 1 − c), thenPu∈Nv(v) zu 6 1, (2) If θ ∈ [0, 1], thenPu∈Nv(v) zu 6 1 + Cε, (3) IfPu∈Nv(v) zu > 1, then zu 6 C√ε for every u ∈ Nv(v), (4) IfPu∈Nv(v) zu > 1, then for every u ∈ Nv(v) such that zu > 0, one has yu ∈ [c/2, 1− c/2], and (5) For all u ∈ Nv(v), one has zu 6 1/2 + O(√ε). The following corollary will be critical to our analysis: Corollary 3.11. There exist absolute constants c > 0 and ε0 > 0 such that for all ε ∈ (0, ε), on u ∈ Nv(v) we have arrival of any vertex v ∈ V , if z as defined in Algorithm 3 satisfiesPu∈Nv(v) zu > 1, then for every Proof. By Lemma 3.10, (1) and (4) we have that ifPu∈Nv(v) zu > 1, then θ ∈ (c, 1 − c) (c is the constant from Lemma 3.10), and for every u ∈ Nv(v) one has c 6 Pr[u is free when v arrives] 6 1 − c. yu ∈ [c/2, 1 − c/2]. 15 (11) On the other hand, by Lemma 3.3 one has yu β 6 xu 6 yu + f (1 − yu) β , (12) where xu is the fractional degree of u when v arrives. We now note that by Lemma 3.10, (2), we have that Algorithm 3 matches every vertex u with probability at least xu/(1 + Cε) (due to choices of primary arcs), and thus Pr[u is free when v arrives] 6 1 − 6 1 − xu 1 + Cε yu β(1 + Cε) (by (12)) c/2 2(1 + Cε) 6 1 − 6 1 − c/5, (by (11) and the setting β = 2 − ε 6 2) as long as ε is sufficiently small. For the other bound we will use two facts. The first is that the since f (y) is monotone decreasing by Observation 3.4 and since we picked β > β∗(f ) = 1 + f (0), we have that for any y 6 1− c/2 6 1, (13) y + f (1 − y) 6 1 − c/2 + f (0) < β − c/2. Then, using the fact that by Line 12, Algorithm 3 matches every vertex u with probability at most xu, we obtain the second bound, as follows. Pr[u is free when v arrives] > 1 − xu yu + f (1 − yu) > 1 − > 1 − > c/5. β β − c/2 β (by (12)) (by (11) and (13)) (β = 2 − ε < 2.5) Choosing c/5 as the constant in the statement of the lemma, we obtain the result. Finally, for our analysis we will rely on the competitive ratio of the fractional solution maintained in Line 4 being 1/β. This follows by Lemma 3.5 and the fact that for our choices of β = 2 − ε and f = f1+2ε we have that β > β∗(f ). See Appendix C for a proof of this fact. Fact 3.12. For all sufficiently small ε > 0, we have that 2 − ε > β∗(f1+2ε). 3.4.3 Structural Properties of Gτ and Hτ In our analysis later, we focus on maximal primary paths (directed paths made of primary arcs) in Hτ , in the sense that the last vertex along the primary path has no outgoing primary arc in Hτ . The following definition captures termination certificates of such primary paths. Definition 3.13 (Certified Primary Path). A tuple (P, T ) is a certified primary path in Hτ if P is a directed path of primary arcs in Hτ and either (a) the last vertex of P does not have an outgoing primary arc in Gτ and T = ∅, or 16 (b) the last vertex u of P has an outgoing primary arc (u, w) in Gτ and T = (u′, w) is a primary arc in Hτ such that u′ precedes u in the arrival order. To elaborate, a certified primary path (P, T ) is made of a (directed) path P of primary arcs in Hτ and T is a certificate of P 's termination in Hτ that ensures the last vertex u in P has no outgoing primary arc in Hτ , either due to u not picking a primary arc with T = ∅, or due to the picked primary arc (u, w) being blocked by another primary arc T = (u′, w) which appears in Hτ . As described, Gτ and Hτ differ in arcs (u, w) that are blocked by previous primary arcs to their target vertex w. We generally define sets of arcs which can block an edge, or a path, or a certified path from appearing in Hτ as in the following definition: Definition 3.14 (Blocking sets). For an arc (u, w), define its blocking set B(u, w) := {(u′, w) {u′, w} is an edge and u′ arrived before u} to be those arcs, the appearance of any of which as primary arc in Gτ blocks (u, v) from being in Hτ . In other words, an arc (u, v) is in Hτ as primary or secondary arc if and only if (u, v) is in Gτ and none of the arcs in its blocking set B(u, v) is in Gτ as a primary arc. The blocking set of a path P is simply the union of its arcs' blocking sets, B(P ) := [(u,v)∈P B(u, v) . The blocking set of a certified primary path (P, T ) is the union of blocking sets of P and T , B(P, T ) := B(P ∪ T ). The probability of an edge, or path, or certified primary path appearing in Hτ is governed in part by the probability of arcs in their blocking sets appearing as primary arcs in Gτ . As an arc (v, u) is picked as primary arc by when v arrives with probability roughly zu (more precisely, u ∈ [zvu/(1 + Cε), zvu], by Lemma 3.10), it will be convenient to denote by z(v, u) and z′(v, u) the z′ u when v arrives, and by z(S) =Ps∈S z(s) and z′(S) =Ps∈S z(s) the sum of z- values zu and z′ and z′-values of arcs in a set of arcs S. Product distributions. Note that by definition the distribution over primary and secondary arc choices of vertices are product distributions (they are independent). As such, their joint dis- tribution is defined by their marginals. Let pw and sw denote the distribution on primary and secondary arc choices of w, respectively. That is, for every u ∈ Nw(w), pw(u) is the marginal prob- ability that w selects (w, u) as its primary arc, and sw(u) is the marginal probability that w selects (w, u) as its secondary arc. Given our target bound (8), it would be useful to show that condition- ing on Fu preserves the independence of these arc choices. Unfortunately, conditioning on Fu does not preserve this independence. We will therefore refine our conditioning later on the existence of primary paths in Hτ , which as we show below maintains independence of the arc choices. Lemma 3.15. For a certified primary path (P, T ) let EQ(P,T ) be the event that the path P equals a maximal connected component in Hτ and the termination of P is certified by T . Then the conditional distributions of primary and secondary choices conditioned on EQ(P,T ) are product distributions; i.e., these conditional choices are independent. Moreover, if we let pw and sw denote the conditional distribution on primary and secondary choices of w, respectively, then TV(pw, pw) 6 z(R(w)) and TV(sw, sw) 6 z(R(w)), 17 where R(w) ⊆ {w} × Nw(w) is the set of arcs leaving w whose existence as primary arcs in Gτ is ruled out by conditioning on EQ(P,T ), and the union of these R(w), denoted by R(P, T ), satisfies R(P, T ) :=[w R(w) ⊆ B(P, T ) ∪ {(w, r) r is root of P} ∪ [ w∈P ∪{w: T =(w,w′)} {w} × Nw(w). (14) Proof. We first bound the total variation distance between the conditional and unconditional dis- tributions. For primary choices, conditioning on EQ(P,T ) rules out the following sets of primary arc choices. For vertex w /∈ P arriving before the root r of P this conditioning rules out w picking any edge in B(P, T ) as primary arc. For vertices w /∈ P with w arriving after the root r of P this conditioning rules out picking arcs (w, r). Finally, this conditioning rules out some subset of arcs leaving vertices in P ∪ {w : T = (w, w′)}. Taking the union over these supersets of R(w), we obtain (14). Now, the probability of each ruled out primary choice (w, u) ∈ R(w) is zero under pw and z′(w, u) under pw, and all other primary choices have their probability increase, with a total increase ofP(w,u)∈R(w) z′(w, u), from which we conclude that TV(pw, pw) = pw(u) − pw(u) = z′(R(w)) 6 z(R(w)). 1 2 Xu∈Nw(w) The proof for secondary arcs is nearly identical, the only differences being that the sets of ruled out secondary arcs can be smaller (specifically, secondary arcs to w′ such that T = (u, w′) are not ruled out by this conditioning), and the probability of any arc (w, u) being picked as secondary arc of w is at most √ε · z′(w, u) 6 z(w, u). Finally, we note that primary and secondary choices for different vertices are independent. Therefore, conditioning on each vertex w not picking a primary arc in its ruled out set R(w) still yields a product distribution, and similarly for the distributions over secondary choices. It is easy to show that a particular certified primary path (P, T ) with high value of z(B(P, T )) is unlikely to appear in Hτ , due to the high likelihood of arcs in its breaking set being picked as primary arcs. The following lemma asserts that the probability of a vertex u being the root of any primary certified path (P, T ) with high z(B(P, T )) value is low. Lemma 3.16. For any k > 0 and any vertex u, we have the following Pr[Hτ contains any certified primary path (P, T ) with P rooted at u and z(B(P, T )) > k] 6 e−k/2, Pr[Hτ contains any primary path P rooted at u with z(B(P )) > k] 6 e−k/2. Proof. We first prove the bound for certified primary paths. For a certified primary path (P, T ) where the last vertex of P is w, define P ∗ as follows: P ∗ =(P P ∪ {(w, w′′)} if T = ∅ if T = (w′, w′′). Observe that z(B(P ∗)) > k whenever z(B(P, T )) > k. This is trivial when T = ∅. To see this for the case T = (w′, w′′), let w be the last vertex of P , and note that B(w′, w′′) ⊆ B(w, w′′), as w arrives after w′. Also note that for (P, T ) to be in Hτ , we have that P ∗ must be in Gτ . We say a directed primary path P ′ = u → u1 → ··· → uℓ−1 → uℓ is k-minimal if z(B(P ′)) > k and z(B(P ′ \ {(uℓ−1, uℓ)})) < k. For such a path P ′, define B∗(P ′) as follows: Initially set 18 B∗(P ′) = B(P \ {(uℓ−1, uℓ)}). Then from B(uℓ−1, uℓ), the breaking set of the last arc of P ′, add arcs to B∗(P ′) in reverse order of their sources' arrival until z(B∗(P ′)) > k. Consider a certified primary path (P, T ) with P rooted at u. If a k-minimal path rooted at u which is not a prefix of P ∗ is contained in Gτ , then (P, T ) does not appear in Gτ , and therefore it does not appear in Hτ . On the other hand, if z(B(P, T )) > k then for (P, T ) to appear in Hτ , we must have that the (unique) k-minimal prefix P ′ of P ∗ must appear in Gτ , and that none of the edges of B∗(P ′) appear in Gτ . Moreover, for any certified primary path with z(B(P, T )), conditioning on the existence of P ′ in Gτ does not affect random choices of vertices with outgoing arcs in B∗(P ′), as these vertices are not in P ′. Since by Lemma 3.10 each arc (w, w′) appears in Gτ with probability z′(v, u) > z(v, u)/(1 + Cε) > z(v, u)/2, we conclude that for any k-minimal primary path P ′ rooted at u, we have (1 − Pr[Some primary edge in B∗(P ′) ∩ ({w} × Nw(w)) is in Gτ ]) Pr[Hτ contains any certified primary path (P, T ) with z(B(P, T )) > k P ′ is in Gτ ] 6 Pr[No edge in B∗(P ′) is in Gτ P ′ is in Gτ ] = Yw /∈P ′ 6 Yw /∈P ′ 6 exp(−z(B∗(P ′))/2) 6 e−k/2. exp(cid:16)−P(w,w′)∈B(P,T )×Nw(w) z(w, w′)/2(cid:17) Taking total probability Pu, the set of all k-minimal primary paths P ′ rooted at u, we get that indeed, since u is the root of at most one k-minimal primary path in any realization of Gτ , Pr[Hτ contains a certified primary path (P, T ) rooted at u with z(B(P, T )) > k] 6 XP ′∈Pu Pr[Hτ contains a (P, T ) with z(B(P, T )) > k P ′ is in Gτ ] } {z The proof for primary path is essentially the same as the above, taking P ∗ = P . 6 e−k/2 · Pr[P ′ is in Gτ ] 6 e−k/2. 3.4.4 Analyzing Good Vertices Consider the set of vertices that are unlikely to be roots of long directed paths of primary arcs in Hτ . In this section, we show that Algorithm 3 achieves almost lossless rounding for such vertices, and hence we call them good vertices. We start with a formal definition: Definition 3.17 (Good vertices). We say that a vertex v is good if Pr τ [Hτ has a primary path rooted at v of length at least 2000 · ln(1/ε)] 6 ε6. Otherwise, we say v is bad. As the main result of this section, for good vertices, we prove the following: Theorem 3.18. Let v be a good vertex. Then Pr[v is matched on arrival] > (1 − ε2) · Xu∈Nv(v) xuv. 19 Notational conventions. Throughout this section, we fix v and let z, z′ be as in Algorithm 3. Moreover, for simplicity of notation, we suppose that the stream of vertices ends just before v's arrival and so quantities, such as Gτ and Hτ , refer to their values when v arrives. For a vertex u, we let Fu denote the event that u is free (i.e., unmatched) when v arrives. In other words, Fu is the event that u is free in the stream that ends just before v's arrival. To prove the theorem, first note that it is immediate ifPu∈Nv(v) zu 6 1: in that case, we have z′ = z and so the probability to match v by a primary edge, by definition of zu, is simply Xu∈Nv(v) zu · Pr[Fu] = Xu∈Nv(v) xuv. u = 1, From now on we therefore assumePu∈Nv(v) zu > 1, which implies (I) Pu∈Nv(v) z′ and moreover, by Lemma 3.10 and Corollary 3.11, for every u ∈ Nv(v): (II) zu 6 C√ε, (III) zu 6 (1 + Cε) · z′ (IV) c 6 Pr[Fu] 6 1 − c , where c is the constant of Corollary 3.11 and C is the constant of Lemma 3.10. u, and We now state the key technical lemma in the proof of Theorem 3.18: Lemma 3.19. Consider a neighbor u ∈ Nv(v) such that Pr τ [Hτ has a primary path rooted at u of length at least 2000 · ln(1/ε) Fu] 6 ε2 . (15) Then, Xw∈Nv(v) z′ w · Pr[Fw Fu] − Xw∈Nv(v) z′ w · Pr[Fw] 6 ε1/3 . (16) Note that the above lemma bounds the quantityPw∈Nv(v) z′ w · Pr[Fw Fu], which will allow us to show that (8) holds and thus the edge {u, v} is picked in the matching with probability very close to xuv. Before giving the proof of the lemma, we give the formal argument why the lemma implies the theorem. Proof of Theorem 3.18. Define S to be the neighbors u in Nv(v) satisfying Pr τ [Hτ has a primary path rooted at u of length at least 2000 · ln(1/ε) Fu] > ε2 . In other words, S is the set of neighbors of v that violate (15). As v is good, we have ε6 > Pr τ [Hτ has a primary path rooted at v of length at least 2000 · ln(1/ε)] z′ u · Pr[Fu] · Pr τ [Hτ has a primary path rooted at u of length at least 2000 · ln(1/ε) − 1 Fu] z′ u · Pr[Fu] · Pr τ [Hτ has a primary path rooted at u of length at least 2000 · ln(1/ε) Fu] > Xu∈Nv(v) > Xu∈Nv(v) >Xu∈S z′ u · Pr[Fu] · ε2. 20 The second inequality holds because v selects the primary arc (u, v) with probability z′ u and, conditioned on Fu, u cannot already have an incoming primary arc, which implies that (u, v) is present in Hτ . The last inequality follows from the choice of S. By Property (III), zu 6 (1 + Cε) · z′ u and so by rewriting we get Xu∈S xuv =Xu∈S zu · Pr[Fu] 6 (1 + Cε) ·Xu∈S z′ u · Pr[Fu] 6 (1 + Cε) · ε4 6 ε3. In other words, the contribution of the neighbors of v in S to Pu∈Nv(v) xuv is insignificant compared to the contribution of all neighbors, Xu∈Nv(v) xuv = Xu∈Nv(v) zu · Pr[Fu] > c, (17) where the inequality follows by the assumptionPu∈Nv(v) zu > 1 and Pr[Fu] > c by Property (IV). We proceed to analyze a neighbor u ∈ Nv(v) \ S. Recall that it is enough to verify (8) to conclude that edge {u, v} is picked in the matching with probability xuv. We have that z′ w · (1 − Pr[Fw Fu]) w · (1 − Pr[Fw]) − √ε · ε1/3 w · c − √ε · ε1/3 z′ z′ 1 + √ε Xw∈Nv(v) > 1 + √ε Xw∈Nv(v) > 1 + √ε Xw∈Nv(v) = 1 + √εc − √ε · ε1/3 > 1 + Cε > zu/z′ u. (by Lemma 3.19) (Pr[Fw] 6 1 − c by (IV))  Xw∈Nv(v) z′ w = 1 by (I) (for ε small enough) (by (III)) Therefore, by definition of S and Lemma 3.19, we thus have that for every u ∈ Nv(v) \ S, the edge {u, v} is taken in the matching with probability xuv. Thus, the probability that v is matched on arrival is, as claimed, at least Xu∈Nv(v)\S xuv = Xu∈Nv(v) xuv −Xu∈S xuv > Xu∈Nv(v) xuv − ε3 > (1 − ε2) Xu∈Nv (v) xuv , where the last inequality holds because we havePu∈Nv(v) xuv > c, as calculated in (17). 3.4.5 Proof of the Key Lemma It remains to prove the key lemma, Lemma 3.19, which we do here. Proof of Lemma 3.19. For a certified primary path (P, T ) let EQ(P,T ) be the event as defined in Lemma 3.15, and let IN(P,T ) be the event that P is a maximal primary path in Hτ and the termination of P is certified by T . Further, let C = {(P, T ) : (P, T ) is a certified primary path rooted at u with Pr[IN(P,T )] > 0} 21 be the set of certified primary paths rooted at u that have a nonzero probability of being maximal in on Fu implies in particular that u has no incoming primary arc), we can rewrite the expression to Hτ . Then, by the law of total probability and sinceP(P,T )∈C Pr[IN(P,T ) Fu] = 1 (since conditioning bound,Pw∈Nv(v) z′ X(P,T )∈C w · Pr[Fw Fu] −Pw∈Nv(v) z′ Pr[IN(P,T ) Fu] Xw∈Nv(v) z′ w · Pr[Fw Fu, IN(P,T )] − Xw∈Nv(v) z′ w · Pr[Fw] . w · Pr[Fw], as We analyze this expression in two steps. First, in the next claim, we show that we can focus on the case when the certified path (P, T ) is very structured and equals the component of u in Hτ . We then analyze the sum in that structured case. Claim 3.20. Let P ⊆ C contain those certified primary paths (P, T ) of C that satisfy: P has length less than 2000 · ln(1/ε) and z(B(P, T )) 6 2 ln(1/ε). Then, we have (18) (18) 6 X(P,T )∈P Pr[EQ(P,T ) Fu] Xw∈Nv(v) z′ w · Pr[Fw EQ(P,T )] − Xw∈Nv(v) z′ w · Pr[Fw] + ε1/3/2. Proof. Define the following subsets of certified primary paths rooted at u: C1 = {(P, T ) ∈ C P is of length at least 2000 · ln(1/ε)} C2 = {(P, T ) ∈ C \ C1 z(B(P, T )) > 2 ln(1/ε)} Note that P = C \ (C1 ∪ C2). Since u satisfies (15), we have that X(P,T )∈C1 Pr[IN(P,T ) Fu] 6 ε2 6 ε1/3/6. On the other hand, by Lemma 3.16 and Pr[Fu] > c (by Property (IV)), we have that X(P,T )∈C2 Pr[IN(P,T ) Fu] 6 c−1 · X(P,T )∈C2 Pr[IN(P,T )] 6 c−1 · ε 6 ε1/3/6. In other words, almost all probability mass lies in those outcomes where one of the certified paths (P, T ) ∈ P is in Hτ . It remains to prove that, in those cases, we almost always have that the component of u in Hτ equals the path P (whose termination is certified by T ). Specifically, let EQ(P,T ) denote the complement of EQ(P,T ). We show PrhEQ(P,T ) IN(P,T )i 6 ε1/3/7 . (19) To see this, note that by the definition of the event IN(P,T ), if we restrict ourselves to primary edges then the component of u in Hτ equals P . We thus have that for the event EQ(P,T ) to be true at least one of the vertices in P must have an incoming or outgoing secondary edge. Hence the expression PrhEQ(P,T ) IN(P,T )i can be upper bounded by Pr[a vertex in P has an incoming or outgoing secondary arc in Gτ IN(P,T )] (20) 22 Note that event IN(P,T ) is determined solely by choices of primary arcs. By independence of these choices and choices of secondary arcs, conditioning on IN(P,T ) does not affect the distribution of secondary arcs. So the probability that any of the nodes in P selects a secondary edge is at most √ε. Thus, by union bound, the probability that any of the P 6 2000 · ln(1/ε) vertices in P pick a secondary arc is at most √ε · 2000 · ln(1/ε). We now turn our attention to incoming secondary arcs. First, considering the secondary arcs that go into u, we have c 6 Pr[Fu] 6 Y(w,u)∈B(v,u) (1 − z(w, u)/2) 6 exp(−z(B(v, u))/2), because any arc (w, u) ∈ B(v, u) appears as a primary arc in Gτ independently with probability at least z(w, u)/2 and the appearance of such an arc implies that u has an incoming primary arc in Hτ and is therefore matched; i.e., the event Fu is false in this case. We thus have z(B(v, u)) 6 2 ln(1/c). Further, since (P, T ) 6∈ C2, we have z(B(P )) 6 z(B(P, T )) 6 2 ln(1/ε). Again using that the conditioning on IN(P,T ) does not affect the distribution of secondary edges, we have that the probability of an incoming secondary arc to any vertex in P is at most √ε · (2 ln(1/c) + 2 ln(1/ε)) . Thus, by union bound, the probability that any vertex in P has an incoming or outgoing secondary arc conditioned on IN(P,T ) is at most √ε · 2000 · ln(1/ε) + √ε · (2 ln(1/c) + 2 ln(1/ε)) 6 ε1/3/7, for sufficiently small ε, which implies (19) via (20). We now show how the above concludes the proof of the claim. We have shown that each one of w = 1). Hence, the two sets C1,C2 contributes at most ε1/3/6 to (18) (where we use thatPw∈Nv(v) z′ (18) 6 X(P,T )∈P w · Pr[Fw IN(P,T ), Fu] − Xw∈Nv(v) Pr[IN(P,T ) Fu] Xw∈Nv(v) w · Pr[Fw] + 2ε1/3/6. This intuitively concludes the proof of the claim as (19) says that Pr[EQ(P,T )IN(P,T )] is almost 1. The formal calculations are as follows. Since the event EQ(P,T ) implies the event IN(P,T ), we have that z′ z′ Pr[EQ(P,T )] = Pr[EQ(P,T ) ∧ IN(P,T )] = Pr[IN(P,T )] − Pr[EQ(P,T ) ∧ IN(P,T )], which by (19) implies Pr[EQ(P,T )] = Pr[IN(P,T )](cid:16)1 − PrhEQ(P,T ) IN(P,T )i(cid:17) > Pr[IN(P,T )](cid:16)1 − ε1/3/7(cid:17) . w · Pr[Fw IN(P,T ), Fu] −Pw∈Nv(v) z′ Specifically, by law of total probability, it can be rewritten as the sum of the expressions (22) and (23) below: (21) We use this to rewrite Pr[IN(P,T ) Fu](cid:16)Pw∈Nv(v) z′ Pr[EQ(P,T ) ∧ IN(P,T ) Fu] Xw∈Nv(v) = Pr[EQ(P,T ) Fu] Xw∈Nv(v) z′ z′ w · Pr[Fw](cid:17). w · Pr[Fw] (22) w · Pr[Fw EQ(P,T ), IN(P,T ), Fu] − Xw∈Nv(v) w · Pr[Fw] w · Pr[Fw EQ(P,T )] − Xw∈Nv(v) z′ z′ 23 and Pr[EQ(P,T ) ∧ IN(P,T ) Fu] Xw∈Nv(v) where (23) can be upper bounded as follows: z′ w · Pr[Fw EQ(P,T ), IN(P,T ), Fu] − Xw∈Nv(v) z′ w · Pr[Fw] , (23) (23) 6 Pr[EQ(P,T ) ∧ IN(P,T ) Fu] 6 c−1 · Pr[EQ(P,T ) ∧ IN(P,T )] = c−1 · Pr[IN(P,T )] · PrhEQ(P,T ) IN(P,T )i 6 c−1 · 6 Pr[EQ(P,T )] · ε1/3/6. 1 − ε1/3/7 · (ε1/3/7) Pr[EQ(P,T )] (by Xw∈Nv(v) z′ w 6 1) (by c 6 Pr[Fu]) (by (19) and (21)) (for ε small enough) As at most one of the events {EQ(P,T )}(P,T )∈P is true in any realization of Gτ , we have that P(P,T )∈P Pr[EQ(P,T )∧ IN(P,T ) Fu] 6P(P,T )∈P(cid:16)Pr[EQ(P,T )] · ε1/3/6(cid:17) 6 ε1/3/6. Thus, again using thatPw∈Nv(v) zw 6 1, we have that w · Pr[Fw] + 2ε1/3/6 Pr[IN(P,T ) Fu] Xw∈Nv(v) (18) 6 X(P,T )∈P w · Pr[Fw] + 3ε1/3/6, Pr[EQ(P,T ) Fu] Xw∈Nv(v) 6 X(P,T )∈P w · Pr[Fw IN(P,T ), Fu] − Xw∈Nv(v) w · Pr[Fw EQ(P,T )] − Xw∈Nv(v) z′ z′ z′ z′ as claimed. The previous claim bounded the contribution of certified primary paths in C \ P to (18). The following claim bounds the contribution of paths in P. Claim 3.21. Let P ⊆ C contain those certified primary paths (P, T ) of C that satisfy: P has length less than 2000 · ln(1/ε) and z(B(P, T )) 6 2 ln(1/ε). Then, we have X(P,T )∈P Pr[EQ(P,T )] Xw∈Nv(v) z′ w · Pr[Fw EQ(P,T )] − Xw∈Nv(v) z′ w · Pr[Fw] 6 ε1/3/2. Proof. We prove the claim in two steps: first we construct a chain of distributions that interpolates between the unconditional distribution of Hτ and its conditional distribution, and then bound the expected number of vertices that change their matched status along that chain. For the remainder of the proof we fix the certified primary path (P, T ). 24 τ Constructing a chain of distributions. Let H (0) τ denote the unconditional distribution of Hτ when v arrives, and let H (n) denote the distribution of Hτ conditioned on EQ(P,T ) when v arrives. Here n = V is the number of vertices in the input graph. For every w ∈ V let F (0) w denote the indicator of w being free when v arrives (unconditionally) and let F (n) denote the indicator w variables of w being free when v arrives conditioned on EQ(P,T ). Note that F (0) is determined by H (0) that interpolate between H (0) and F (n) is determined by H (n) as follows. . For t = 0, . . . , n, we define distributions H (t) τ and H (n+1) τ τ τ τ As in Lemma 3.15, for every w ∈ V we denote the unconditional distribution of its primary choice by pw, and the unconditional distribution of its secondary choice by sw. Similarly, we t+1, . . . , n are sampled independently from the unconditional distribution pwt. Similarly, secondary denote the conditional distribution given EQ(P,T ) of the primary choice by epw and the conditional distribution of the secondary choice by esw. For every t = 0, . . . , n the primary choice of vertices wj, j = 1, . . . , t are sampled independently from epwj , and the primary choices of vertices wj, j = choices of vertices wj, j = 1, . . . , t are sampled independently from eswj and secondary choices of vertices wj, j = t + 1, . . . , n are sampled independently from swj . Note that H (0) from the unconditional distribution of Hτ , and H (n) is sampled from the conditional distribution (conditioned on EQ(P,T )), as required, due to the independence of the conditional probabilities pwj and swj , by Lemma 3.15. For t = 0, . . . , n let Mt denote the matching constructed by our algorithm on H (t) w be the indicator variable for w being free when v arrives in the DAG sampled from H (t) τ . τ , and let F (t) is sampled τ τ Coupling the distributions of H (t) Specifically, we will show that for every such t the following holds. τ . We now exhibit a coupling between the H (t) τ , t = 0, . . . , n. (24) where R(wt+1) is as defined in Lemma 3.15 with regard to the certified primary path R(P, T ). Recall that z(R(wt+1)) is the total probability assigned to arcs leaving wt+1 which are ruled out from being primary arcs in Gτ by conditioning on EQ(P,T ). We construct the coupling by induction. The base case corresponds to t = 0 and is trivial. We now give the inductive step (t → t + 1). We write w := wt+1 to simplify notation. Let Z p ∈ Nw(w) denote the primary choice of w in H (t) τ , and let Z s ∈ Nw(w) denote the secondary choice of w in Nw(w) (they are sampled according to the unconditional distributions pw and sw respectively). Let eZ p ∈ Nw(w) and eZ s ∈ Nw(w) be sampled from the conditional distributionsepw andesw respectively, such that that the joint distributions (Z p,eZ p) and (Z s,eZ s) satisfy First, we note that if Z p = eZ p and Z s = eZ s, then w = wt+1 is matched to the same neighbor Pr[Z p 6= eZ p] = TV(pw,epw) and Pr[Z s 6= eZ s] = TV(sw,esw). under H (t) , and so Mt = Mt+1, due to the greedy nature of the matching constructed. Otherwise, by Lemma 3.9, at most two vertices have different matched status in Mt and Mt+1 in the latter case (in the former case every vertex has the same matched status). To summarize, we τ and H (t+1) (25) τ 25 EXq∈V F (t+1) q − F (t) q  6 4z(R(wt+1)), have, for R(w) determined by (P, T ) as in Lemma 3.15, that EXq∈V F (t+1) q − F (t) q This concludes the proof of the inductive step, and establishes (24). In particular, we get (by (25) and union bound) (by Lemma 3.15) 6 4z(R(w)).  6 2 · Pr[Z p 6= eZ p or Z s 6= eZ s] 6 2(TV(pw,epw) + TV(sw,esw)) EXq∈V  6 F (n) q − F (0) q EXq∈V n−1Xt=0 n−1Xt=0 F (t+1) q − F (t) q  6 4z(R(wt+1)) (by (26)) = 4z(R(P, T )), (26) (27) by the definition of R(P, T ) =Sw R(w) in Lemma 3.15. ln(1/ε) and z(B(P, T )) 6 2 ln(1/ε) one has Pw z(R(w)) = z(R(P, T )) = O(ln(1/ε)). Indeed, by We now finish the claim. First note that for any (P, T ) such that P has length at most 2000 · Lemma 3.15 and linearity of z, recalling that u is the root of P and that no vertex appears after v (and thus B(v, u) = {(w, u) w arrives between u and v}), we have z(R(P, T )) 6 z(B(P, T )) + z(B(v, u)) + Xw∈P ∪{w: T =(w,w′)} z ({w} × Nw(w)) . (28) We now bound the contribution to the above upper bound on Pw z(R(w)) = z(R(P, T )) in (28). First, we have that z(B(P, T )) 6 2 ln(1/ε) by assumption of the lemma. To bound the contribution of z(B(v, u)), we note that by Property IV, we have c 6 Pr[Fu] = Ye∈B(v,u) (1 − ze) 6 exp− X(w,u)∈B(v,u) z(w, u)/2 6 exp(−z(B(v, u))/2), because any arc e = (w, u) appears as a primary arc in Gτ with probability z′(w, u) > z(w, u)/2, independently of other such arcs, and the appearance of any such an edge implies that u has an incoming primary edge in Hτ when v arrives and is therefore matched; i.e., the event Fu is false in this case. We thus have z(B(v, u)) 6 2 ln(1/c). Finally, it remains to note that for every one of the at most 2000 · ln(1/ε) + 1 vertices w ∈ P ∪ {w : T = (w, w′)} the contribution of z({w} × Nw(w)) to the right hand side of (28) is at most 1 + Cε 6 2, by Lemma 3.10, (2). Putting these bounds together, we get that for sufficiently small ε, z(R(P, T )) 6 2 ln(1/ε) + 2 ln(1/c) + 2 · 2000 · ln(1/ε) + 2 = O(ln(1/ε)). (29) 26 The term we wish to upper bound is at most z′ z′ w∈Nv(v) z′ w · Pr[Fw] w · Pr[Fw EQ(P,T )] − Xw∈Nv(v) w(cid:19) · Xw∈Nv(v)(cid:12)(cid:12)(cid:12)Pr[Fw EQ(P,T )] − Pr[Fw](cid:12)(cid:12)(cid:12) Xw∈Nv(v) 6(cid:18) max 6C√ε · Xw∈Nv(v)(cid:12)(cid:12)(cid:12)Pr[Fw EQ(P,T )] − Pr[Fw](cid:12)(cid:12)(cid:12) =C√ε · E Xw∈Nv(v) F (n) w − F (0) w  w # 6C√ε · E"Xw∈V w − F (0) F (n) 6C√ε · z(R(P, T )) =O(√ε · log(1/ε)) 6ε1/3/2, then, using (27) and (29), we find that the term we wish to upper bound is at most (by Lemma 3.10, (3)) (by definition of F (0) and F (n)) (by (27)) (by (29)) completing the proof. Finally, we obtain Lemma 3.19 by combining Claim 3.20 and Claim 3.21, to find that, as claimed (18) 6 X(P,T )∈P Pr[EQ(P,T ) Fu] Xw∈Nv(v) z′ w · Pr[Fw EQ(P,T )] − Xw∈Nv(v) z′ w · Pr[Fw] + ε1/3/2 6 ε1/3/2 + ε1/3/2 = ε1/3. 3.4.6 Bounding the Impact of Bad Vertices In this section, we show that we can completely ignore the bad vertices without losing too much. From the definition of good vertices, for a bad vertex v, we have that Pr τ [Hτ has a primary path rooted at v of length at least 2000 · ln(1/ε)] > ε6. As the main result of this section, we prove the following theorem: To prove this, we first describe a charging mechanism in which, for each bad vertex, a charge of one is distributed among a subset of other vertices. Then, using the following supplementary lemma, Theorem 3.22. The number of bad vertices is at most ε3 ·Pe∈E xe. we show that the total distributed charge over all vertices in the graph is at most ε3 ·P(u,v)∈E xuv. Lemma 3.23. We call a primary path P a primary predecessor path of v if it ends at v. That is, P = vℓ → vℓ−1 → ··· → v1 = v. We have Pr τ [v has any primary predecessor path P with z(B(P )) 6 20 · ln(1/ε) and P > 1000 · ln(1/ε)] 6 ε10. 27 Proof. We use the principle of deferred decisions and traverse the path backwards. Let b be the current vertex, which is initially set to v. Consider all incoming arcs to b, say (a1, b), . . . , (ak, b) where we index a's by time of arrival; i.e., ai arrives before aj if i < j (and b arrived before any ai). First consider the random choice of a1 and see if it selected the arc (a1, b). • If it does, then the path including b in Hτ will use the arc (a1, b). • Otherwise, if a1 does not select the arc (a1, b), then go on to consider a2 and so on. If no a1, . . . , ak selects b, then the process stops; i.e., the primary path starts at this vertex since b has no incoming primary arc. Otherwise let i be the first index so that (ai, b) was selected. Then (ai, b) is in the primary path ending at v in Hτ . Now, observe that no a1, . . . , ai−1 may be in the path in this case, because these vertices arrived before ai and after b. Moreover, we have not revealed any randomness regarding ai+1, . . . , ak that may appear later in the path. We can therefore repeat the above process with b now set to ai and "fresh" randomness for all vertices we consider, as the random choices of arcs of all vertices are independent. We now show that this process, with good probability, does not result in a long predecessor path P of low z(B(P )) value. Recall from Lemma 3.10, (5), that z(u, v) 6 3/5 for all (u, v) ∈ V × V . Suppose that i=1 z(ai, b) 6 i=1(1−z(ai, b)) > i=1 z(ai, b) > 1/5. Consequently, with probability at least 1/5, vertex b either has no prede- Pk i=1 z(ai, b) > 4/5. Let j be the first index such that Pj 4/5, and hence the probability that none of the first j vertices select b is at leastQj 1 −Pj In the other case, we havePk i=1(1 − z(ai, b)) > 1 −Pk isQk Therefore, at any step in the above random process, with probability at least 1/5, we either stop or increase z(B(P )) by 1/5. Let Zi be an indicator variable for the random process either stopping or increasing z(B(P )) by at least 1/5 at step i, and notice that according to the above random process, each Zi is lower bounded by an independent Bernoulli variable with probability i=1 z(ai, b) > 1/5. ThusPj i=1 z(ai, b) 6 4/5. Then the probability that b has no predecessor 1/5. Thus if we define Z =Pi∈[1000·ln(1/ε)] Zi, we have E[Z] > 200 · ln(1/ε), and thus by standard coupling arguments and Chernoff bounds, we have that cessor or the increase to z(B(P )) is at least 1/5. i=1 z(ai, b) > 1/5. Pr[Z 6 100 · ln(1/ε)] 6 Pr [Z 6 (1 − 1/2) · E[Z]] 6 e−(1/2)·(1/2)2 ·200·ln(1/ε) 6 ε10. But if the path does not terminate within 1000·ln(1/ε) steps and Z > 100·ln(1/ε), then z(B(P )) > 20 · ln(1/ε). We now prove Theorem 3.22. Proof of Theorem 3.22. By Lemma 3.16, the probability that Hτ has a primary path P with z(B(P )) > 20 · ln(1/ε) starting at v is at most ε10. Thus, for a bad vertex u, the probability that Hτ has some primary path P rooted at u with P > 2000 · ln(1/ε) and z(B(P )) 6 20· ln(1/ε) is at least ε6 − ε10 > ε6/2. Let k = 20 · ln(1/ε) and ℓ = 2000 · ln(1/ε). Let Pu be the set of all primary paths P rooted at u such that z(B(P )) 6 k and P = ℓ starting at u. Since all such primary paths with length more than ℓ are extensions of those with length exactly ℓ, we have PP ∈Pu Pr[P is in Hτ ] > ε6/2. For each such path P ∈ Pu, consider the two vertices wP ℓ−1 at distances ℓ and ℓ− 1 respectively from u. For each such vertex wP . Then the sum of these charges is j (j ∈ {ℓ − 1, ℓ}), charge (2/ε6) · Pr[P is in Hτ ] · ywP ℓ and wP j XP ∈Pu (2/ε6) · Pr[P is in Hτ ] · (ywP ℓ >1 {z + ywP ℓ−1 28 Pr[P is in Hτ ] > 1. > (2/ε6) · XP ∈Pu ) } Notice that the fact (ywP vertex cover problem). ℓ + ywP ℓ−1 ) > 1 follows because yw's form a feasible dual solution (to the As Q = ℓ − 1 > 1000 · ln(1/ε) for all Q ∈ Qw, by Lemma 3.23,PQ∈Qw Pr[Q is in Hτ ] 6 ε10 . For On the other hand, consider how many times each vertex is charged. For this, for every vertex w, let Qw be the set of primary predecessor paths Q of u such that Q = ℓ − 1 and z(B(P )) 6 k. a primary predecessor path Q ∈ Qw (or one of its extensions), the vertex w can be charged at most twice according to the above charging mechanism. Since any predecessor path of w with length more than ℓ − 1 must be an extension of one with length exactly ℓ − 1, we have that the amount w is charged is at most XQ∈Qw 2 · 2 · Pr[Q is in Hτ ] · yw/ε6 6 4 · (ε10/ε6) · yw 6 4 · ε4 · yw. Summing over all w ∈ V and using Lemma 3.3, the total charge is at most Xw∈v 4 · ε4 · yw 6 4 · ε4 · β ·Xe∈E xe 6 ε3Xe∈E xe. 3.4.7 Calculating the Competitive Ratio of Algorithm 3 We now show that the competitive ratio of Algorithm 3 is indeed (1/2 + α) competitive for some sufficiently small absolute constant α > 0, thus proving Theorem 1.2. This essentially combines the facts that for good vertices, the matching probability is very close to the fractional values of incident edges, and that the number of bad vertices is very small compared to the total value of the fractional algorithm (over the entire graph). Proof of Theorem 1.2. Let OPT denote the size of the maximum cardinality matching in the input graph G. Then, by Lemma 3.5 and our choice of f = f1+2ε and β = 2 − ε > β∗(f1+2ε), we have thatPe xe > (1/β)· OPT > (1/2 + ε/4)· OPT, where the xe's are the fractional values we compute in Algorithm 3. Now let M be the matching output by Algorithm 3. We have xuv Pr[e is matched] (1 − ε2) · Xu∈Nv(v) E[M] =Xe∈E > Xgood v∈V > (1 − ε2) ·Xe∈E > (1 − ε2) · Xe∈E > (1 − ε2) · Xe∈E > (1 − 2ε2) ·Xe∈E > (1 − 2ε2) · (1/2 + ε/4) · OPT > (1/2 + ε/5) · OPT, xe − Xbad v∈V Xu∈Nv(v) 1! xe − Xbad v∈V xe! xe − ε3Xe∈E xe xuv (By Theorem 3.18) ( Xu∈Nv(v) xuv 6 1) (By Theorem 3.22) where the last line holds for a sufficiently small constant ε > 0. 29 Appendix A Deferred Proofs of Section 3.3 Here we prove that a change of the realized arc choices of any vertex does not change the matched status of more than two vertices (at any point in time). This is Lemma 3.9, restated below. Lemma 3.9. Let Gτ and Gτ ′ be two realizations of the random digraph where all the vertices in the two graphs make the same choices except for one vertex v. Then the number of vertices that have different matched status (free/matched) in the matchings computed in Hτ and Hτ ′ at any point of time is at most two. Proof. We consider the evolution, following each vertex arrival, of the matchings Mτ and Mτ ′ computed in Hτ and Hτ ′, respectively, as well as the set of vertices with different matched status in these matchings, denoted by D := (Mτ \ Mτ ′) ∪ (Mτ ′ \ Mτ ). The set D is empty before the first arrival and remains empty until the arrival of v, as all earlier vertices than v have the same primary and secondary arcs and have the same set of free neighbors in Hτ and Hτ ′ (as D = ∅, by induction). Now, if immediately after v arrives it remains free in both Mτ and Mτ ′, or it is matched to the same neighbor in both matchings, then clearly D remains empty. Otherwise, either v is matched to different neighbors in Mτ and Mτ ′, or v is matched in one of these matchings but not in the other. Both these cases result in D = 2. We now show by induction that the cardinality of D does not increase following subsequent arrivals, implying the lemma. Let u be some vertex which arrives after v. If when u arrives u is matched to the same neighbor w in Mτ and Mτ ′ or if u remains free in both matchings, then D is unchanged. If u is matched to some w on arrival in Mτ , but not in Mτ ′, then since the arcs of u are the same in Gτ and Gτ ′, this implies that w must have been free in Mτ but not in Mτ ′, and so D ∋ w. Therefore, after u arrives, we have D ← (D\{w})∪{u}, and so D's cardinality is unchanged. Finally, if u is matched to two distinct neighbors, denoted by w and w′, respectively, then one of (u, w) and (u, w′) must be the primary arc of u in both Gτ and Gτ ′. Without loss of generality, say (u, w) is this primary arc. Since u is matched to w in Mτ but not in Mτ ′, then w must be free in Mτ when u arrives, but not in Mτ ′, and so D ∋ w. Consequently, we have that after u arrives we have D ← S for some set S ⊆ (D \ {w}) ∪ {w′}, and so D's cardinality does not increase. B Deferred Proofs of Section 3.1 Here we prove the bound on the fractional degree xu in terms of its dual value, restated below. Lemma 3.3. For any vertex u, v ∈ V , let yu be the potential of u prior to arrival of v. Then the fractional degree just before v arrives, xu :=Pw∈Nv(u) xuw, is bounded as follows: yu β 6 xu 6 yu + f (1 − yu) . β Proof. Let y0 be u's potential after u's arrival. For the lower bound, note that it suffices to prove that every increase in the fractional degree is bounded below by the increase in the potential divided by β. When vertex u first arrived, we consider two cases. 1. y0 > 0 (thus y0 = 1 − θ > 0, and so θ < 1), then the increase in u's fractional degree was: Xv∈Nu(u) (θ − yv)+ β (cid:18)1 + 1 − θ f (θ)(cid:19) = 30 f (θ) + 1 − θ β = f (1 − y0) + y0 β > y0 β . 2. y0 = 0 (thus θ = 1), then the increase in u's fractional degree was: (θ − yv)+ (θ − yv)+ > 0 = y0 β . β Xv∈Nu(u) β (cid:18)1 + 1 − θ f (θ)(cid:19) = Xv∈Nu(u) f (θ)(cid:19) > (cid:18)1 + 1 − θ (θ − yold u )+ β , (θ − yold u )+ β For every subsequent increase of the fractional degree due to a newly-arrived vertex we have that: Which concludes the proof for the lower bound. For the upper bound, by [25, Invariant 1], we have that β · xu 6 yc + f (1 − y0) +Z yc subtracting 1 + f (1 − yu) and writing the integral R yu f (x) dx -R 1 R 1 1−x f (x) dx, and relying on Equation (5), we find that 1−x yu y0 y0 This upper bound can be simplified by using Equation (5), as follows. Taking (30), adding and 1−x f (x) dx as the difference of two integrals y0 1 − x f (x) dx. (30) y0 dx 1 − x f (x) 1 − x f (x) β · xu 6 yc + f (1 − y0) +Z yc =(cid:18)1 + f (1 − y0) +Z 1 = β∗(f ) + yc −(cid:18)1 + f (1 − yc) +Z 1 = β∗(f ) + yc − β∗(f ) + f (1 − yc) = yc + f (1 − yc), yc y0 dx(cid:19) − 1 + yc +Z yc 1 1 − x f (x) dx 1 − x f (x) dx(cid:19) + f (1 − yc) from which the lemma follows. C Deferred Proofs of Section 3.4.2 In this section we present the proofs deferred from Section 3.4.2. We start by presenting a more manageable form for the function f = f1+2ε which we use. A function in the WW family is determined by a parameter k > 1 and takes the following form fκ(θ) =(cid:18) 1 + κ 2 − θ(cid:19) 1+κ 2κ (cid:18)θ + Letting κ = 1 + 2ε, we get that f := fκ is of the form 2κ κ − 1 2 (cid:19) κ−1 . 1+ε ε 1+2ε f (θ) = (1 + ε − θ) 1+2ε · (θ + ε) = (1 + ε − θ) ·(cid:18) θ + ε 1 + ε − θ(cid:19) ε 1+2ε . Clearly this is water filling when ε = 0 and otherwise we have that the first term is like water filling and then the second term is less than 1 for z 6 1/2 and greater than 1 if z > 1/2. By Taylor expansion, we obtain the following more manageable form for f . 31 1+2ε i! = (1 + ε − θ) · Lemma C.1. There exists ε0 ∈ (0, 1) such that for every ε ∈ (0, ε0) and every θ ∈ [0, 1], we have Proof. Taking the Taylor expansion of ex, we find that 1 + ε − θ(cid:19)(cid:19) + 1.01ε. f (θ) = (1 + ε − θ) ·(cid:18) θ + ε f (θ) 6 (1 − θ)(cid:18)1 + ε ln(cid:18) θ + ε 1 + ε − θ(cid:19) ε 1+2ε(cid:17)i 1+ε−θ(cid:17) · (cid:16)ln(cid:16) θ+ε ∞Xi=0 = (1 + ε − θ)(cid:18)1 + ln(cid:18) θ + ε 1 + 2ε(cid:19) + o(ε) 1 + ε − θ(cid:19) · 1 + ε − θ(cid:19) · = (1 + ε − θ) + (1 − θ) ln(cid:18) θ + ε = (1 + ε − θ) + (1 − θ)ε ln(cid:18) θ + ε 1 + ε − θ(cid:19) + o(ε) = (1 − θ)(cid:18)1 + ε ln(cid:18) θ + ε 1 + ε − θ(cid:19)(cid:19) + ε + o(ε). 6 2 To be precise, for θ ∈ [0, 1] and 0 < ε 6 ε0 6 1 (implying for example θ+ε ε ), we will show that terms dropped in the third, fourth and fifth lines are all at most some O((ln( 1 ε ) · ε)2) = o(ε), from which the lemma follows as the sum of these terms is at most 0.01ε for ε 6 ε0 and ε0 sufficiently small. 1+ε−θ ε 1 + 2ε + o(ε) ε ε Indeed, in the third line, we dropped (1 + ε − θ) · ∞Xi=2 1+ε−θ(cid:17) · (cid:16)ln(cid:16) θ+ε i! ε 1+2ε(cid:17)i 6 2 · ∞Xi=2 (ln( 2 ε ) · ε)i i! 6 · ∞Xi=2 (cid:0)ln(cid:0) 2 ε(cid:1) · ε(cid:1)i i2 = O((ln(1/ε) · ε)2), where the last step used that ln(1/ε) · ε 6 1 holds for all ε > 0. In the fourth line, we dropped ε 1 + 2ε 6 ε2 · ln (2/ε) = O((ln(1/ε) · ε)2). Finally, in the fifth line, we dropped ε · ln(cid:18) θ + ε 1 + ε − θ(cid:19) · 1 + 2ε(cid:19) · ln(cid:18) θ + ε ε (1 − z) ·(cid:18)ε − 1 + ε − θ(cid:19) 6 1 · (ε2/(1 + 2ε)) · ln (2/ε) = O((ln(1/ε) · ε)2). Given this more manageable form for f , we can now turn to prove Lemma 3.10, restated below. Lemma 3.10. (Basic bounds on conditional probabilities zu) There exist absolute constants c ∈ (0, 1) and C > 1/c > 1 and ε0 ∈ (0, 1) such that for every ε ∈ (0, ε0) the following holds: for every vertex v ∈ V , if yu is the dual variable of a neighbor u ∈ Nv(v) before v's arrival and θ is the value chosen by Algorithm 1 on v's arrival, then for zu as defined in Algorithm 3, we have: (1) If θ 6∈ (c, 1 − c), thenPu∈Nv(v) zu 6 1, (2) If θ ∈ [0, 1], thenPu∈Nv(v) zu 6 1 + Cε, 32 (3) IfPu∈Nv(v) zu > 1, then zu 6 C√ε for every u ∈ Nv(v), (4) IfPu∈Nv(v) zu > 1, then for every u ∈ Nv(v) such that zu > 0, one has yu ∈ [c/2, 1− c/2], and (5) For all u ∈ Nv(v), one has zu 6 1/2 + O(√ε). Proof. We begin by getting a generic upper bound for zu. We note that each edge e is matched by Algorithm 3 with probability at most xe by Line 12. Therefore, u is matched before v arrives with probability at most xu :=Pw∈Nv(u)\{v} xwu, the fractional degree of u before v arrives. Therefore, by Lemma 3.3, the probability that u is free is at least Pr[u free when v arrives] > 1 − xu > 1 − yu + f (1 − yu) β , (31) from which, together with the definition of xuv = 1 upper bound on zu: β (θ − yu)+(cid:16)1 + 1−θ zu = xuv Pr[u is free when v arrive] 6 1 β (θ − yu)+(cid:16)1 + 1−θ f (θ)(cid:17) 1 − yu+f (1−yu) β = f (θ)(cid:17), we obtain the following (θ − yu)(cid:16)1 + 1−θ f (θ)(cid:17) (32) β − (yu + f (1 − yu)) . We start by upper boundingPu∈Nv(v) zu, giving a bound which will prove useful in the proofs of both (1) and (2). Recall that θ is defined as the largest θ 6 1 such that Xu∈Nv(v) (θ − yu)+ 6 f (θ). (33) Summing (32) over all u ∈ Nv(v), we find that Xu∈Nv(v) zu 6 Xu∈Nv(v) (θ − yu)+ · (1 + 1−θ f (θ) ) β − (θ + f (1 − θ)) (f (·) is non-increasing, by Observation 3.4) f (θ) + 1 − θ 6 β − (θ + f (1 − θ)) We therefore wish to upper bound f (θ)+1−θ proceeding to the proof, it would be useful to summarize some properties of the function γ(θ, ε). (by (33) and β > β∗(f ) = 1 + f (0) > θ + f (1 − θ)) 1+ε−θ(cid:17). Before β−θ−f (1−θ) . To this end let γ(θ, ε) := ε ln(cid:16) θ+ε 1. γ(θ, ε) = −γ(1 − θ, ε) for all θ ∈ [0, 1] . 2. For c, ε0 sufficiently small we have for all θ ∈ [0, c) that γ(θ, ε) 6 ε ln(cid:16) c+ε for all θ ∈ (1 − c, 1] that γ(θ, ε) > ε ln(cid:16) 1−c+ε 1+ε−(1−c)(cid:17) > 20 · ε. 1+ε−c(cid:17) 6 −20 · ε, and 3. γ(θ, ε) · (1 − 2θ) 6 0 for θ ∈ [0, 1], since γ(θ, ε) 6 0 for θ 6 1/2 and γ(θ, ε) > 0 for θ > 1/2. 4. θ · γ(θ, ε) > −ε for all θ ∈ [0, 1]. The last property follows from ln(cid:16) 1+ε−θ θ+ε (cid:17) 6 ln(cid:16) 1+ε+θ implies in particular that θ · γ(θ, ε) = θ · ε ·(cid:16)− ln(cid:16) 1+ε−θ θ+ε (cid:17) 6 ln(cid:16)1 + 1 θ+ε (cid:17)(cid:17) > −ε. θ+ε(cid:17) 6 1 θ+ε 6 1 θ , which 33 We will use γ as shorthand for γ(θ, ε). Recalling that β = 2− ε and using Lemma C.1, we have: f (θ) + 1 − θ β − (θ + f (1 − θ)) 6 6 (1 − θ)(cid:16)1 + ε ln(cid:16) θ+ε 2 − ε − θ − θ(cid:16)1 + ε ln(cid:16) 1−θ+ε 1+ε−θ(cid:17)(cid:17) − θ + 1 + 1.01ε θ+ε (cid:17)(cid:17) − 1.01ε (34) (1 − θ)(2 + γ) + 2ε 2 − 2θ + θγ − 3ε γ(1 − 2θ) + 5ε 2 − 2θ + θγ − 3ε . = 1 + 20 ) = γ 4 + 5 · (− γ We will continue by proving that the second term is negative. First we prove that the de- nominator is positive. To this end, first consider the case when θ ∈ [0, c). In this case for ε0, c sufficiently small one has that: 2 − 2θ + θγ − 2ε > 2 − 2θ − ε − 2ε > 0 from Item 4. More- over, when θ ∈ (1 − c, 1] one has that θ > 1 2 (since c is small) and γ > 20ε from Item 2. Thus 2 − 2θ + θγ − 2ε > θγ − 2ε > 1 2 · 20ε − 3ε = 7ε > 0. Now, it remains to prove that the numerator is always negative. When θ ∈ [0, c) we have that 1 − 2θ > 3/4(since c is small) and γ 6 −20ε from Item 2, therefore γ(1 − 2θ) + 5ε 6 γ · 3 2 < 0. In the case where θ ∈ (1 − c, 1], we have that 1 − 2θ < −3/4, and θ > 1/2 (since c is small), and γ > 20ε from Item 2, thus γ(1 − 2θ) + 5ε 6 − 3 We now turn to (2). We assume that θ ∈ (c, 1 − c), since otherwise the claim is trivial, by (1). 2−2θ+θγ−3ε . We have that γ(1− 2θ) + 5ε 6 5ε from Item 3. We have by (34) that Furthermore, using Item 4 we have that 2 − 2θ + θγ − 3ε > 2c + −4ε > c for a sufficiently small ε0. Overall, the second term is bounded above by 5 We now prove (3). Note that by (1), Pu∈Nv(v) zu > 1 implies that θ ∈ (c, 1 − c). Now, for every u ∈ Nv(v), let αu := (θ−yu)+ definition of αu and our choice of θ, we have Pu∈Nv(v) αu =Pu∈Nv(v) , so that yu = θ − f (θ) · αu if yu 6 θ. We also note that by 6 1. In the proof of (3) and (4) we will assume for notational simplicity that all u ∈ Nv(v) have yu 6 θ, implying zu > 0. Summing up (32) over all u ∈ Nv(v) and substituting in αu, we thus find that c · ε < C · ε, for C > 5 4 · 20ε + 5ε = −10ε < 0. 6 1 + γ(1−2θ)+5ε c > 1 c as required. f (θ)+1−θ β−(θ−f (1−θ)) (θ−yu)+ f (θ) f (θ) Xu∈Nv(v) zu 6 Xu∈Nv(v) = Xu∈Nv(v) 6 Xu∈Nv(v) 6 Xu∈Nv(v) αu · αu · αu · (θ − yu)+(1 + 1−θ f (θ) ) β − (yu + f (1 − yu)) f (θ) + 1 − θ β − (yu + f (1 − yu)) f (θ) + 1 − θ 2 − yu − f (1 − yu) − 2.01ε f (θ) + 1 − θ 2 − 4ε − 2yu , (by Lemma C.1 and β = 2 − ε) In the last transition we used again (as in Item 4) that yu · ε ln(cid:16) 1−yu+ε f (θ) 6 1 − θ + ε for all θ ∈ [0, 1]. Substituting yu = θ − f (θ) · αu into the above upper bound on yu+ε (cid:17) 6 ε, which implies 34 Pu∈Nv(v) zu, we get Xu∈Nv(v) zu 6 Xu∈Nv(v) = Xu∈Nv(v) αu · αu · f (θ) + 1 − θ 2 − 4ε − 2θ + 2f (θ) · αu f (θ) + 1 − θ 2 − 4ε − 2θ − Xu∈Nv(v) a − b (f (θ) + 1 − θ) · 2f (θ) · α2 u (2 − 4ε − 2θ) · (2 − 4ε − 2θ + 2f (θ) · αu) , (35) (36) (37) using the elementary identity 1 a(a+b) for appropriate a and b. Now, both terms in the last line of (35) can be significantly simplified, as follows. For the former term, again using that a+b = 1 f (θ) 6 1 − θ + ε, together withPu∈Nv(v) αu 6 1 noted above, we find that αu ·(cid:18)1 + Xu∈Nv(v) f (θ) + 1 − θ 2 − 4ε − 2θ 2 + ε − 2θ 2 − 4ε − 2θ = Xu∈Nv(v) 6 Xu∈Nv(v) αu · αu · 5ε 2 − 4ε − 2θ(cid:19) 6 1 + O(ε), where in the last step we used that θ 6 1 − c and c is some fixed constant. For the second term in the last line of (35), we note that Xu∈Nv(v) (f (θ) + 1 − θ) · 2f (θ) · α2 u (2 − 4ε − 2θ) · (2 − 4ε − 2θ + 2f (θ) · αu) = Ω(1) · Xu∈Nv(v) α2 u . u > Ω(α2 1+ε−c(cid:17) ε u), since f is decreasing by Observation 3.4 and f (c) > 1 To see this, first note that for θ ∈ (c, 1 − c), the numerator of each summand of the LHS is at least 2f (c)2 · α2 2 · (1 + ε − c) > Ω(1) for c and ε sufficiently small. To verify the first inequality of this lower bound for f (c), recall that f (c) = (1 + ε − c) ·(cid:16) c+ε 1+2ε 1+2ε . Now, for ε tending to zero and c < 1/2, the term (cid:16) θ+ε tends to one as ε tends to zero. Therefore for ε sufficiently small we have f (c) > 1 2 · (1 + ε − c) for all c < 1/2. We now turn to upper bounding the denominator of each summand in the LHS of Equation (37). Indeed, substituting yu = θ − f (θ) · αu, we find that each such denominator is at most (2− 4ε− 2θ)· (2− 4ε− 2θ + 2f (θ)· αu) 6 (1/2)· (2− 4ε− 2yu) 6 (1/2)· (2− 4ε− 2c) 6 O(1) for c and ε sufficiently small. Note that both numerator and denominator are positive for sufficiently small c and ε0. Substituting the bounds of (36) and (37) into (35), we obtain 1+ε−θ(cid:17) ε u . From Eq. (38) andPu∈Nv(v) zu > 1 by assumption of (3), we get that zu 6 1 + O(ε) − Ω(1) · Xu∈Nv(v) Xu∈Nv(v) α2 ′ Xu∈Nv(v) α2 u 6 C ε (38) (39) 35 for an absolute constant C ′ > 1, since otherwisePu∈Nv(v) zu 6 1. Finally, it remains to note that Xu∈Nv(v) z2 α2 β − (yu + f (1 − yu))(cid:19)2 u = Xu∈Nv(v)(cid:18) αu · (f (θ) + 1 − θ) u ·(cid:18) f (θ) + 1 − θ 6 Xu∈Nv(v) β − (θ + f (1 − θ))(cid:19)2 6 Xu∈Nv(v) u ·(cid:18) f (θ) + 1 − θ β − (1 − c + f (c))(cid:19)2 u ·(cid:18) 1 − θ + ε + 1 − θ 6 Xu∈Nv(v) β − (1 − c + 1 − c + ε)(cid:19)2 6 Xu∈Nv(v) u · 2c − 2ε α2 α2 α2 2 6 Cε, (by Observation 3.4 and yu 6 θ) (by Observation 3.4 and θ 6 1 − c) (f (c) 6 1 − c + ε) 2c−2ε . Thus z2 for some constant C > 2 u 6Pu∈Nv(v) zu 6 Cε and so zu 6 √C · ε 6 C√ε, as claimed. We now prove (4). SincePu∈Nv(v) zu > 1 implies θ ∈ (c, 1 − c) by (1), using the definition of αu's from the proof of (3) together with the fact that αu 6 C ′√ε for every u ∈ Nv(v) by (39) and the fact that f (θ) 6 2 for all θ ∈ [0, 1] (by Lemma C.1), we get that yu = θ − f (θ) · αu ∈ [c − O(√ε), 1 − c] ⊆ [c/2, 1 − c/2], for sufficiently small ε0 > 0, as required. As for (5), simplifying (32) and using the fact that θ − yu 6 f (θ), we get zu 6 θ − yu + 1 − θ β − yu − f (1 − yu) = 1 − yu . β − yu − f (1 − yu) which implies the following: Recall from Lemma C.1 that for all θ ∈ [0, 1], we have f (θ) 6 (1− θ)(cid:16)1 + ε ln(cid:16) θ+ε 1. For all θ ∈ [0, 1], we have f (θ) 6 1 − θ + √ε, and 2. For θ < e−10, we have f (θ) 6 (1 − θ)(1 + ε(ln((e−10 + ε)/(1 − e−10 + ε)) + 1.01ε 6 1 − θ − 2ε. 1+ε−θ(cid:17)(cid:17)+ 1.01ε, Suppose that yu 6 1 − e−10. Then using Item 1, we have zu 6 6 1 − yu β − yu − f (1 − yu) 2(1 − yu) − 2√ε 1 − yu 6 2 − ε − yu − yu − √ε 1 − yu 2√ε 6 1/2 + 2e−10 − 2√ε 6 1/2 + O(√ε). Now suppose that yu > 1 − e−10. Then 1 − yu < e−10, and so by Item 2, f (1 − yu) 6 1 − yu − 2ε. Thus we have zu 6 1 − y β − yu − f (1 − yu) completing the proof. 6 1 − yu 2 − ε − yu − (yu − 2ε) = 1 − yu 2(1 − yu) + ε 6 1/2, 36 Finally, we rely on Lemma C.1 to prove that the fractional solution maintained by Line 4 is 1/β competitive, as implied by Lemma 3.5 and the following restated fact. Fact 3.12. For all sufficiently small ε > 0, we have that 2 − ε > β∗(f1+2ε). Proof. Let us denote as before f = f1+2ε. Recall that β∗(f ) = 1 + f (0). By Lemma C.1, this is at most 1+f (0) 6 1+(cid:16)1 + ε ln(cid:16) ε 1+ε(cid:17)(cid:17)+1.01ε. But for small enough ε, we have that ln(cid:16) ε 1+ε(cid:17) 6 −2.01, implying that 1 + f (0) 6 2 − ε, as claimed. References [1] Ageev, A. A. and Sviridenko, M. I. 2004. Pipage rounding: A new method of constructing algorithms with proven performance guarantee. Journal of Combinatorial Optimization 8, 3, 307 -- 328. [2] Birnbaum, B. and Mathieu, C. 2008. On-line bipartite matching made simple. ACM SIGACT News 39, 1, 80 -- 87. [3] Buchbinder, N., Segev, D., and Tkach, Y. 2018. Online algorithms for maximum cardi- nality matching with edge arrivals. Algorithmica, 1 -- 19. [4] Chiplunkar, A., Tirodkar, S., and Vishwanathan, S. 2015. On randomized algorithms In Proceedings of the 23rd Annual European for matching in the online preemptive model. Symposium on Algorithms (ESA). 325 -- 336. [5] Cohen, I. R. and Wajc, D. 2018. Randomized online matching in regular graphs. In Pro- ceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). 960 -- 979. [6] Devanur, N. R., Jain, K., and Kleinberg, R. D. 2013. Randomized primal-dual analysis of ranking for online bipartite matching. In Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). 101 -- 107. [7] Eden, A., Feldman, M., Fiat, A., and Segal, K. 2018. An economic-based analysis of ranking for online bipartite matching. arXiv preprint arXiv:1804.06637 . [8] Edmonds, J. 1965a. Maximum matching and a polyhedron with 0, 1-vertices. Journal of research of the National Bureau of Standards B 69, 125-130, 55 -- 56. [9] Edmonds, J. 1965b. Paths, trees, and flowers. Canadian Journal of mathematics 17, 3, 449 -- 467. [10] Epstein, L., Levin, A., Segev, D., and Weimann, O. 2013. Improved bounds for online preemptive matching. In Proceedings of the 30th International Symposium on Theoretical Aspects of Computer Science (STACS). 389. [11] Feige, U. 2018. Tighter bounds for online bipartite matching. arXiv preprint arXiv:1812.11774 . [12] Gandhi, R., Khuller, S., Parthasarathy, S., and Srinivasan, A. 2006. Dependent rounding and its applications to approximation algorithms. Journal of the ACM (JACM) 53, 3, 324 -- 360. 37 [13] Goel, G. and Mehta, A. 2008. Online budgeted matching in random input models with applications to adwords. In Proceedings of the 19th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). 982 -- 991. [14] Guruganesh, G. P. and Singla, S. 2017. Online matroid intersection: Beating half for ran- dom arrival. In Proceedings of the 19th Conference on Integer Programming and Combinatorial Optimization (IPCO). 241 -- 253. [15] Huang, Z., Kang, N., Tang, Z. G., Wu, X., Zhang, Y., and Zhu, X. 2018a. How to match when all vertices arrive online. In Proceedings of the 50th Annual ACM Symposium on Theory of Computing (STOC). 17 -- 29. [16] Huang, Z., Peng, B., Tang, Z. G., Tao, R., Wu, X., and Zhang, Y. 2019. Tight competitive ratios of classic matching algorithms in the fully online model. In Proceedings of the 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). 2875 -- 2886. [17] Huang, Z., Tang, Z. G., Wu, X., and Zhang, Y. 2018b. Online vertex-weighted bipar- In Proceedings of the 45th International tite matching: Beating 1-1/e with random arrivals. Colloquium on Automata, Languages and Programming (ICALP). 1070 -- 1081. [18] Karp, R. M., Vazirani, U. V., and Vazirani, V. V. 1990. An optimal algorithm for on-line bipartite matching. In Proceedings of the 22nd Annual ACM Symposium on Theory of Computing (STOC). 352 -- 358. [19] Kuhn, H. W. 1955. The hungarian method for the assignment problem. Naval research logistics quarterly 2, 1-2, 83 -- 97. [20] Lee, E. and Singla, S. 2017. Maximum matching in the online batch-arrival model. In Proceedings of the 19th Conference on Integer Programming and Combinatorial Optimization (IPCO). 355 -- 367. [21] Lov´asz, L. and Plummer, M. D. 2009. Matching theory. Vol. 367. American Mathematical Society. [22] Mehta, A. 2013. Online matching and ad allocation. Foundations and Trends R(cid:13) in Theoretical Computer Science 8, 4, 265 -- 368. [23] Schrijver, A. 2003. Combinatorial optimization: polyhedra and efficiency. Vol. 24. Springer Science & Business Media. [24] Tirodkar, S. and Vishwanathan, S. 2017. Maximum matching on trees in the online preemptive and the incremental dynamic graph models. In Proceedings of the 23rd International Computing and Combinatorics Conference (COCOON). 504 -- 515. [25] Wang, Y. and Wong, S. C.-w. 2015. Two-sided online bipartite matching and vertex cover: Beating the greedy algorithm. In Proceedings of the 42nd International Colloquium on Automata, Languages and Programming (ICALP). 1070 -- 1081. 38
1911.10262
1
1911
2019-11-21T18:18:43
An Algorithm for Strong Stability in the Student-Project Allocation Problem with Ties
[ "cs.DS" ]
We study a variant of the Student-Project Allocation problem with lecturer preferences over Students where ties are allowed in the preference lists of students and lecturers (SPA-ST). We investigate the concept of strong stability in this context. Informally, a matching is strongly stable if there is no student and lecturer $l$ such that if they decide to form a private arrangement outside of the matching via one of $l$'s proposed projects, then neither party would be worse off and at least one of them would strictly improve. We describe the first polynomial-time algorithm to find a strongly stable matching or to report that no such matching exists, given an instance of SPA-ST. Our algorithm runs in $O(m^2)$ time, where $m$ is the total length of the students' preference lists.
cs.DS
cs
An Algorithm for Strong Stability in the Student-Project Allocation Problem with Ties Sofiat Olaosebikan⋆ and David Manlove⋆⋆ School of Computing Science, University of Glasgow, e-mail: [email protected], [email protected] Abstract. We study a variant of the Student-Project Allocation problem with lecturer preferences over Students where ties are allowed in the preference lists of students and lecturers (spa-st). We investigate the concept of strong stability in this context. Informally, a matching is strongly stable if there is no student and lecturer l such that if they decide to form a private arrangement outside of the matching via one of l's proposed projects, then neither party would be worse off and at least one of them would strictly improve. We describe the first polynomial-time algorithm to find a strongly stable matching or to report that no such matching exists, given an instance of spa-st. Our algorithm runs in O(m2) time, where m is the total length of the students' preference lists. Keywords: student-project allocation problem, indifference, strongly stable matching, polynomial-time algorithm 1 Introduction Matching problems, which generally involve the assignment of a set of agents to another set of agents based on preferences, have wide applications in many real-world settings, including, for example, allocating junior doctors to hospitals [25] and assigning students to projects [16]. In the context of assigning students to projects, each project is proposed by one lecturer and each student is required to provide a preference list over the available projects that she finds acceptable. Also, lecturers may provide a preference list over the students that find their projects acceptable, and/or over the projects that they propose. Typically, each project and lecturer have a specific capacity denoting the maximum number of students that they can accommodate. The goal is to find a matching, i.e., an assignment of students to projects that respects the stated preferences, such that each student is assigned at most one project, and the capacity constraints on projects and lecturers are not violated -- the so-called Student-Project Allocation problem (spa) [1,6,20]. Two major models of spa exist in the literature: one permits preferences only from the stu- dents [16], while the other permits preferences from the students and lecturers [1,15]. In the latter case, three different variants have been studied based on the nature of the lecturers' preference lists. These include SPA with lecturer preferences over (i) students [15], (ii) projects [13,22,23], and (iii) (student, project) pairs [2]. Outwith assigning students to projects, applications of each of these three variants can be seen in multi-cell networks where the goal is to find a stable assignment of users to channels at base-stations [3,4,5]. ⋆ Supported by a College of Science and Engineering Scholarship, University of Glasgow. Orcid ID: 0000-0002-8003-7887. ⋆⋆ Supported by grant EP/P028306/1 from the Engineering and Physical Sciences Research Council. Orcid ID: 0000-0001-6754-7308. 2 In this work, we will concern ourselves with variant (i), i.e., the Student-Project Allocation problem with lecturer preferences over Students (spa-s). In this context, it has been argued in [25] that a natural property for a matching to satisfy is that of stability. Informally, a stable matching ensures that no student and lecturer would have an incentive to deviate from their current assignment. Abraham et al. [1] described two linear-time algorithms to find a stable matching in an instance of spa-s where the preference lists are strictly ordered. In their paper, they also proposed an extension of spa-s where the preference lists may include ties, which we refer to as the Student-Project Allocation problem with lecturer preferences over Students with Ties (spa-st). If we allow ties in the preference lists of students and lecturers, three different stability definitions are possible [9,10,11]. We give an informal definition in what follows. Suppose that M is a matching in an instance of spa-st. Then M is (i) weakly stable, (ii) strongly stable, or (iii) super-stable, if there is no student and lecturer l such that if they decide to become assigned outside of M via one of l's proposed projects, respectively, (i) both of them would strictly improve, (ii) one of them would be better off, and the other would not be worse off (iii) neither of them would be worse off. These concepts were first defined and studied by Irving [9] in the context of the Stable Marriage problem with Ties (smt) (the restriction of spa-st in which each lecturer offers only one project, the capacity of each project and lecturer is 1, the numbers of students and lecturers are equal, each student finds all projects acceptable, and each lecturer finds all students acceptable). It was subsequently extended to the Hospitals/Residents problem with Ties (HRT) [10,11] (where HRT is the special case of spa-st in which each lecturer offers only one project, and the capacity of each project is the same as the capacity of the lecturer offering the project). Existing results in spa-st. Every instance of spa-st admits a weakly stable matching, which could be of different sizes [21]. Moreover, the problem of finding a maximum size weakly stable matching (MAX-SPA-ST) is NP-hard [12,21], even for the so-called Stable Marriage problem with Ties and Incomplete lists (smti). Cooper and Manlove [7] described a 3 2 -approximation algorithm for MAX-SPA-ST. On the other hand, Irving et al. argued in [10] that super-stability is a natural and most robust solution concept to seek in cases where agents have incomplete information. Recently, Olaosebikan and Manlove [24] showed that if an instance of spa-st admits a super- stable matching M , then all weakly stable matchings in the instance are of the same size (equal to the size of M ), and match exactly the same set of students. The main result of their paper was a polynomial-time algorithm to find a super-stable matching or report that no such matching exists, given an instance of spa-st. Their algorithm runs in O(L) time, where L is the total length of all the preference lists. Motivation. It was motivated in [11] that weakly stable matching may be undermined by bribery or persuasion, in practical applications of hrt. In what follows, we give a corresponding argument for an instance I of spa-st. Suppose that M is a weakly stable matching in I, and suppose that a student si prefers a project pj (where pj is offered by lecturer lk) to her assigned is offered by a lecturer different from lk). Suppose further project in M , say pj ′ (where pj ′ that pj is full and lk is indifferent between si and one of the worst student/s assigned to pj in M , say si′ . Clearly, the pair (si, pj) does not constitute a blocking pair for the weakly stable matching M , as lk would not improve by taking on si in the place of si′ . However, si might be overly invested in pj that she is even ready to persuade or even bribe lk to reject si′ and accept her instead; lk being indifferent between si and si′ may decide to accept si's proposal. We can reach a similar argument if the roles are reversed. However, if M is strongly stable, it cannot be potentially undermined by this type of (student, project) pair. 3 Henceforth, if a spa-st instance admits a strongly stable matching, we say that such an instance is solvable. Unfortunately not every instance of spa-st is solvable. To see this, consider the case where there are two students, two projects and two lecturers, the capacity of each project and lecturer is 1, the students have exactly the same strictly ordered preference list of length 2, and each of the lecturers preference list is a single tie of length 2 (any matching will be undermined by a student and lecturer that are not matched together). However, it should be clear from the discussions above that in cases where a strongly stable matching exists, it should be preferred over a matching that is merely weakly stable. Related work. The following are previous results for strong stability in the literature. Irving [9] gave an O(n4) algorithm for computing strongly stable matchings in an instance of smt, where n is the number of men (equal to the number of women). This algorithm was subsequently extended by Manlove [19] to instances of smti, which is a generalisation of smt for which the preference lists need not be complete. The extended algorithm also has running time O(n4). Irving et al. [11] described an algorithm to find a strongly stable matching or report that no such matching exists, given an instance of HRT. The algorithm has running time O(m2), where m is the total number of acceptable (resident, hospital) pairs. Subsequently, Kavitha et al. [14] presented two strong stability algorithms with improved running time; one for smti with running time O(nm), where n is the number of vertices and m is the number of edges, and the other for hrt with running time O(mPh∈H ph), where H is the set of all hospitals and ph is the capacity of a hospital h. These two algorithms build on the ones described in [9,11,19]. A recent result in strong stability is the work of Kunysz [17], where he described an O(nm log(W n)) algorithm for computing a maximum weight strongly stable matching given an instance of smti, where W is the maximum weight of an edge. Our contribution. We present the first polynomial-time algorithm to find a strongly stable matching or report that no such matching exists, given an instance of spa-st -- thus solving an open problem given in [1,24]. Our algorithm is student-oriented, which implies that if the given instance is solvable then our algorithm will output a solution in which each student has at least as good a project as she could obtain in any strongly stable matching. We note that our algorithm is a non-trivial extension of the strong stability algorithms for smt [9], smti [19], and hrt [11] (we discuss this further in Sect. 4.3). The remainder of this paper is structured as follows. We give a formal definition of the spa-s problem, the spa-st variant, and the three stability concepts in Sect. 2. We give some intuition for the strong stability definition in Sect. 3. We describe our algorithm for spa-st under strong stability in Sect. 4. Further, in Sect. 4, we also illustrate an execution of our algorithm with respect to an instance of spa-st before moving on to present the algorithm's correctness and complexity results, along with proof of correctness. Finally, we present some potential direction for future work in Sect. 5. 2 Preliminary definitions In this section, we give a formal definition of spa-s as described in the literature [1]. We also give a formal definition of spa-st -- a generalisation of spa-s in which preference lists can include ties. 2.1 Formal definition of spa-s An instance I of spa-s involves a set S = {s1, s2, . . . , sn1 } of students, a set P = {p1, p2, . . . , pn2 } of projects and a set L = {l1, l2, . . . , ln3} of lecturers. Each student si ranks a subset of P in 4 strict order, which forms her preference list. We say that si finds pj acceptable if pj appears on si's preference list. We denote by Ai the set of projects that si finds acceptable. Each lecturer lk ∈ L offers a non-empty set of projects Pk, where P1, P2, . . . , Pn3 partitions P, and lk provides a preference list, denoted by Lk, ranking in strict order of preference those students who find at least one project in Pk acceptable. Also lk has a capacity dk ∈ Z+, indicating the maximum number of students she is willing to supervise. Similarly each project pj ∈ P has a capacity cj ∈ Z+ indicating the maximum number of students that it can accommodate. We assume that for any lecturer lk, max{cj : pj ∈ Pk} ≤ dk ≤ P{cj : pj ∈ Pk} (i.e., the capacity of lk is (i) at least the highest capacity of the projects offered by lk, and (ii) at most the sum of the capacities of all the projects lk is offering). We denote by Lj k, the projected preference list of lecturer lk for pj, which can be obtained from Lk by removing those students that do not find pj acceptable (thereby retaining the order of the remaining students from Lk). An assignment M is a subset of S × P such that (si, pj) ∈ M implies that si finds pj acceptable. If (si, pj) ∈ M , we say that si is assigned to pj, and pj is assigned si. For convenience, if si is assigned in M to pj, where pj is offered by lk, we may also say that si is assigned to lk, and lk is assigned si. For any project pj ∈ P, we denote by M (pj) the set of students assigned to pj in M . Project pj is undersubscribed, full or oversubscribed according as M (pj) is less than, equal to, or greater than cj, respectively. Similarly, for any lecturer lk ∈ L, we denote by M (lk) the set of students assigned to lk in M . Lecturer lk is undersubscribed, full or oversubscribed according as M (lk) is less than, equal to, or greater than dk, respectively. A matching M is an assignment such that M (si) ≤ 1, M (pj) ≤ cj and M (lk) ≤ dk. If si is assigned to some project in M , for convenience we let M (si) denote that project. 2.2 Ties in the preference lists We now give a formal definition, similar to the one given in [24], for the generalisation of spa-s in which the preference lists can include ties. In the preference list of lecturer lk ∈ L, a set T of r students forms a tie of length r if lk does not prefer si to si′ for any si, si′ ∈ T (i.e., lk is indifferent between si and si′ ). A tie in a student's preference list is defined similarly. For convenience, in what follows we consider a non-tied entry in a preference list as a tie of length one. We denote by spa-st the generalisation of spa-s in which the preference list of each student (respectively lecturer) comprises a strict ranking of ties, each comprising one or more projects (respectively students). An example spa-st instance I1 is given in Fig. 1, which involves the set of students S = {s1, s2, s3}, the set of projects P = {p1, p2, p3} and the set of lecturers L = {l1, l2}. Ties in the preference lists are indicated by round brackets. Student preferences s1: (p1 p2) s2: p2 p3 s3: p3 p1 Lecturer preferences l1: l2: s3 (s1 (s3 s2) s2) l1 offers p1, p2 l2 offers p3 Project capacities: c1 = c2 = c3 = 1 Lecturer capacities: d1 = 2, d2 = 1 Fig. 1: An example spa-st instance I1. In the context of spa-st, we assume that all notation and terminology carries over from spa- s with the exception of stability, which we now define. When ties appear in the preference lists, three types of stability arise, namely weak stability, strong stability and super-stability [10,11]. 5 In what follows, we give a formal definition of these three stability concepts in the context of spa-st. Henceforth, I is an instance of spa-st, (si, pj) is an acceptable pair in I and lk is the lecturer who offers pj. Definition 1 (weak stability [7]). Let M be a matching in I. We say that M is weakly stable if it admits no blocking pair, where a blocking pair of M is an acceptable pair (si, pj) ∈ (S ×P)\M such that (a) and (b) holds as follows: (a) either si is unassigned in M or si prefers pj to M (si); (b) either (i), (ii), or (iii) holds as follows: (i) pj is undersubscribed and lk is undersubscribed; (ii) pj is undersubscribed, lk is full and either si ∈ M (lk), or lk prefers si to the worst student/s in M (lk); (iii) pj is full and lk prefers si to the worst student/s in M (pj). Definition 2 (super-stability [24]). We say that M is super-stable if it admits no blocking pair, where a blocking pair of M is an acceptable pair (si, pj) ∈ (S × P) \ M such that (a) and (b) holds as follows: (a) either si is unassigned in M , or si prefers pj to M (si) or is indifferent between them; (b) either (i), (ii), or (iii) holds as follows: (i) pj is undersubscribed and lk is undersubscribed; (ii) pj is undersubscribed, lk is full, and either si ∈ M (lk) or lk prefers si to the worst student/s in M (lk) or is indifferent between them; (iii) pj is full and lk prefers si to the worst student/s in M (pj) or is indifferent between them. Definition 3 (strong stability). We say that M is strongly stable in I if it admits no blocking pair, where a blocking pair of M is an acceptable pair (si, pj) ∈ (S × P) \ M such that either (1a and 1b) or (2a and 2b) holds as follows: (1a) either si is unassigned in M , or si prefers pj to M (si); (1b) either (i), (ii), or (iii) holds as follows: (i) pj is undersubscribed and lk is undersubscribed; (ii) pj is undersubscribed, lk is full, and either si ∈ M (lk) or lk prefers si to the worst student/s in M (lk) or is indifferent between them; (iii) pj is full and lk prefers si to the worst student/s in M (pj) or is indifferent between them. (2a) si is indifferent between pj and M (si); (2b) either (i), (ii), or (iii) holds as follows: (i) pj is undersubscribed, lk is undersubscribed and si /∈ M (lk); (ii) pj is undersubscribed, lk is full, si /∈ M (lk), and lk prefers si to the worst student/s in M (lk); (iii) pj is full and lk prefers si to the worst student/s in M (pj). In the remainder of this paper, any usage of the term blocking pair refers to the version of this term for strong stability as defined in Definition 3. We give an intuition behind the strong stability definition is what follows. 6 3 Justification of the strong stability definition It should be clear from our definition of a blocking pair (si, pj) that if si seeks to become assigned to pj outside of M , then at most one of si and lk can be indifferent to the switch, whilst at least one of them must strictly improve. In what follows, we justify our definition in more detail (we remark that some of the argument is similar to that given for the blocking pair definition in the spa-s case [1, Sect 2.2]). We consider the first part of the definition. In Definition 3(1a); clearly if the assignment between si and pj is permitted, si will improve relative to M . Now, let us consider lk's perspec- tive. In Definition 3(1b)(i), lk will be willing to take on si for pj, since there is a free space. In Definition 3(1b)(ii), if si was already assigned in M to a project offered by lk then lk will agree to the switch, since the total number of students assigned to lk remains the same. However, if si was not already assigned in M to a project offered by lk, since lk is full, lk will need to reject some student assigned to her in order to take on si. Obviously, lk will not reject a student that she prefers to si; thus lk will either improve or be no worse off after the switch. Finally, in Definition 3(1b)(iii), since pj is full, lk will need to reject some student assigned to pj in order to take on si. Again, lk will either improve or be no worse off after the switch. Under this definition, as observed in [1, Sect 2.2], if si was already assigned in M to a project offered by lk, then the number of students assigned to lk will decrease by 1 (the reason for this was further justified in [1, Sect 6.1]). Next, we consider the second part of the definition. In Definition 3(2a), if the assignment between si and pj is permitted, clearly si will be no worse off after the switch. Again, we consider lk's perspective (we note that in this case, lk must improve after the switch.). In Definition 3(2b)(i), if pj and lk is undersubscribed, then the only way that lk would improve is if si is not already assigned in M to a project offered by lk. If this is the case, then lk will agree to the switch since there is a free space and she will get one more student to supervise, namely si. In Definition 3(2b)(ii), if pj is undersubscribed and lk is full, the only way lk could improve is first for si to not be assigned in M to a project offered by lk. If this is the case then lk will need to reject some student assigned to her in M in order to take on si. Obviously, lk will be willing to reject a student that is worse than si on her list. Similarly, in Definition 3(2b)(iii), if pj is full in M , lk will need to reject some student assigned to pj in M in order to take on si. Clearly, lk must prefer si to such student so that lk can have a better set of students assigned to pj after the switch. We remark that if si is already assigned in M to a project offered by lk, the number of students assigned to lk in M will decrease by 1 after the switch. We illustrate this using the example spa-st instance I2 in Fig. 2. Clearly, M1 = {(s1, p2), (s2, p1)} is a matching in I2. However, by satisfying the blocking pair (s1, p1), we obtain the matching M2 = {(s1, p1)}, which is strongly stable. In going from M1 to M2, lecturer l1 got a better student to take on p1, with l1 having to lose one student, namely s2. Following a similar argument as in [1, Sect 6.1] for the spa-s case, in practice, l1 might not agree to take on s1 for p1, since in doing so l1 loses a student. So, one could relax Definition 3(2b)(iii) to prevent such change from happening. Further, we argue that this could lead to two new problems. 1. We introduce an element of strategy into the problem by allowing a matching such as M1 to be strongly stable. That is, a student could provide a shorter preference list in order to obtain a more suitable project. To illustrate this, suppose that s1 has only listed p1 in the example instance I2. Irrespective of how we relax Definition 3(2b)(iii), si would be assigned to p1. However, this strategy might not be beneficial for a student in all cases, since by not listing all of her acceptable projects, a student is at risk of not being assigned in the final strongly stable matching. Student preferences s1: (p1 p2) s2: p1 Lecturer preferences l1: s1 s2 7 l1 offers p1, p2 Project capacities: c1 = c2 = 1 Lecturer capacities: d1 = 2 Fig. 2: An example spa-st instance I2. 2. If we allow both M1 and M2 to be strongly stable, this would imply that the instance admits strongly stable matchings of different sizes. Hence, we would seek a maximum size strongly stable matching in order to match as many students to projects as possible. However, we conjecture that this problem is NP-hard, following from related problems of finding maximum size stable matching in the literature. 4 An algorithm for spa-st under strong stability In this section we present our algorithm for spa-st under strong stability, which we will refer to as Algorithm SPA-ST-strong. In Sect. 4.1, we give some definitions relating to the algorithm. In Sect. 4.2, we give a description of our algorithm and present it in pseudocode form. In Sect. 4.3, we briefly describe the non-trivial modifications that are involved in extending the existing strong stability algorithms for smt [9], smti [19] and hrt [11] to our algorithm for the spa-st case. We illustrate an execution of our algorithm with respect to a spa-st instance in Sect. 4.4. Finally, in Sect. 4.5, we present our algorithm's correctness results along with proof of correctness. 4.1 Definitions relating to the algorithm Given a pair (si, pj) ∈ M , for some strongly stable matching M in I, we call (si, pj) a strongly stable pair. During the execution of the algorithm, students become provisionally assigned to projects (and implicitly to lecturers), and it is possible for a project (and lecturer) to be provi- sionally assigned a number of students that exceeds its capacity. We describe a project (respec- tively lecturer) as replete if at any time during the execution of the algorithm it has been full or oversubscribed. We say that a project (respectively lecturer) is non-replete if it is not replete. As stated earlier, for a project pj, it is possible that dG(pj) > cj at some point during the algorithm's execution. Thus, we denote by qj = min{cj, dG(pj)} the quota of pj in G, which is the minimum between pj's capacity and the number of students provisionally assigned to pj in G. Similarly, for a lecturer lk, it is possible that dG(lk) > dk at some point during the algorithm's execution. At this point, we denote by αk = P{qj : pj ∈ Pk ∩ P } the total quota of projects offered by lk that is provisionally assigned to students in G and we denote by qk = min{dk, dG(lk), αk} the quota of lk in G. The algorithm proceeds by deleting from the preference lists certain (si, pj) pairs that are not strongly stable. By the term delete (si, pj), we mean the removal of pj from si's preference list and the removal of si from Lj k (the projected preference list of lecturer lk for pj); in addition, if (si, pj) ∈ E we delete the edge from G. By the head and tail of a preference list at a given point we mean the first and last tie respectively on that list after any deletions might have occurred (recalling that a tie can be of length 1). Given a project pj, we say that a student si is dominated in Lj k if si is worse than at least cj students who are provisionally assigned to pj. The concept of a student becoming dominated in a lecturer's preference list is defined in a slightly different manner. 8 Definition 4 (Dominated in Lk). At a given point during the algorithm's execution, let αk and dG(lk) be as defined above. We say that a student si is dominated in Lk if min{dG(lk), αk} ≥ 1, and si is worse than at least dk students who are provisionally assigned in G to a project dk offered by lk. Definition 5 (Lower rank edge). We define an edge (si, pj) ∈ E as a lower rank edge if si is in the tail of Lk and min{dG(lk), αk} > dk. Definition 6 (Bound). Given an edge (si, pj) ∈ E, we say that si is bound to pj if (i) and (ii) holds as follows: (i) pj is not oversubscribed or si is not in the tail of Lj (ii) (si, pj) is not a lower rank edge or si is not in the tail of Lk (or both). k (or both); If si is bound to pj, we may also say that (si, pj) is a bound edge. Otherwise, we refer to it as an unbound edge.2 3 and we reduce the quota of pj in Gr (and intuitively lk We form a reduced assignment graph Gr = (Sr, Pr, Er) from a provisional assignment graph G as follows. For each edge (si, pj) ∈ E such that si is bound to pj, we remove the edge (si, pj) 4) by one. Further, we remove from Gr all other unbound edges incident to si in Gr. Each isolated student vertex is then removed from Gr. Finally, if the quota of any project is reduced to 0, or pj becomes an isolated vertex, then pj is removed from Gr. For each surviving pj in Gr, we denote by q∗ j the revised quota of pj, where q∗ j is the difference between pj's quota in G (i.e., qj ) and the number of students that are bound to pj. Similarly, we denote by q∗ k is the difference between lk's quota in G (i.e., qk) and the number of students that are bound to a project offered by lk. j : pj ∈ Pk ∩ Pr} − q∗ Further, for each lk who offers at least one project in Gr, we let n = P{q∗ k, where n is the difference between the total revised quota of projects in Gr that are offered by lk and the revised quota of lk in Gr. Now, if n ≤ 0, we do nothing; otherwise, we extend Gr as follows. We add n dummy student vertices to Sr. For each of these dummy vertex, say sdi, and for each project pj ∈ Pk ∩ Pr that is adjacent to a student vertex in Sr via a lower rank edge, we add the edge (sdi, pj) to Er.5 k the revised quota of lk in Gr, where q∗ Given a set X ⊆ Sr of students, define N (X), the neighbourhood of X, to be the set of project vertices adjacent in Gr to a student in X. If for all subsets X of Sr, each student in X can be assigned to one project in N (X), without exceeding the revised quota of each project in N (X) (i.e., X ≤ P{q∗ j : pj ∈ N (X)} for all X ⊆ Sr); then we say Gr admits a perfect matching that saturates Sr. Definition 7 (Critical set). It is well known in the literature [18] that if Gr does not admit a perfect matching that saturates Sr, then there must exist a deficient subset Z ⊆ Sr such that Z > P{q∗ j : pj ∈ N (Z)}. To be precise, the deficiency of Z is defined by δ(Z) = Z − P{q∗ j : 1 If a student si is provisionally assigned in G to two different projects offered by lk then, potentially, dG(lk) < αk. Thus, it is important that we take the minimum of these two parameters, to avoid deleting strongly stable pairs. 2 An edge (si, pj) ∈ E can change state from bound to unbound, but not vice versa. 3 We note that we only remove this edge to form Gr, we do not delete the edge from G. 4 If si is bound to more than one projects offered by lk, for all the bound edges involving si and these projects that we remove from Gr, we only reduce lk's quota in Gr by one. 5 An intuition as to why we add dummy students to Gr is as follows. Given a lecturer lk whose project j : pj ∈ Pk ∩ Pr}, then we need n dummy k, so that we don't oversubscribe is provisionally assigned to a student in Gr. If q∗ j : pj ∈ Pk ∩ Pr} and q∗ students to offset the difference between P{q∗ lk in any maximum matching obtained from Gr. k < P{q∗ 9 pj ∈ N (Z)}. The deficiency of Gr, denoted δ(Gr), is the maximum deficiency taken over all subsets of Sr. Thus, if δ(Z) = δ(Gr), we say that Z is a maximally deficient subset of Sr, and we refer to Z as a critical set. We denote by PR the set of replete projects in G and we denote by P ∗ R a subset of projects in PR which is obtained as follows. For each project pj ∈ PR, let lk be the lecturer who offers pj. For each student si such that (si, pj) has been deleted, we add pj to P ∗ R if (i) and (ii) holds as follows: (i) either si is unassigned in G, or (si, pj ′ ) ∈ G where si prefers pj to pj ′ , or (si, pj ′ ) ∈ G and si is indifferent between pj and pj ′ where pj ′ /∈ Pk; (ii) either lk is undersubscribed, or lk is full and either si ∈ G(lk) or lk prefers si to some student assigned in G(lk). Definition 8 (Feasible matching). A feasible matching in the final provisional assignment graph G is a matching M which is obtained as follows: 1. Let G∗ be the subgraph of G induced by the students who are adjacent to a project in P ∗ R. First, find a maximum matching M ∗ in G∗;6 2. Using M ∗ as an initial solution, find a maximum matching M in G. 4.2 Description of the algorithm Algorithm SPA-ST-strong, described in Algorithm 1, begins by initialising an empty bipartite graph G which will contain the provisional assignments of students to projects (and intuitively to lecturers). We remark that such assignments (i.e., edges in G) can subsequently be broken during the algorithm's execution. k, such that st is dominated in Lj The while loop of the algorithm involves each student si who is not adjacent to any project in G and who has a non-empty list applying in turn to each project pj at the head of her list. Immediately, si becomes provisionally assigned to pj in G (and to lk). If, by gaining a new provisional assignee, project pj becomes full or oversubscribed then we set pj as replete. Further, for each student st in Lj k, we delete the pair (st, pj). As we will prove later, such pairs cannot belong to any strongly stable matching. Similarly, if by gaining a new provisional assignee, lk becomes full or oversubscribed then we set lk as replete. For each student st in Lk, such that st is dominated in Lk and for each project pu ∈ Pk that st finds acceptable, we delete the pair (st, pu). This continues until every student is provisionally assigned to one or more projects or has an empty list. At the point where the while loop terminates, we form the reduced assignment graph Gr and we find the critical set Z of students in Gr (Lemma 3 describes how to find Z). As we will see later, no project pj ∈ N (Z) can be assigned to any student in the tail of Lj k in any strongly stable matching, so all such pairs are deleted. At the termination of the inner repeat-until loop in line 21, i.e., when Z is empty, if some project pj that is replete ends up undersubscribed, we let sr be any one of the most preferred students (according to Lj k) who was provisionally assigned to pj during some iteration of the algorithm but is not assigned to pj at this point (for convenience, we henceforth refer to such sr as the most preferred student rejected from pj according to Lj k). If the students at the tail of Lk (recalling that the tail of Lk is the least-preferred tie in Lk after any deletions might have occurred) are no better than sr, it turns out that none of these students st can be assigned to any 6 At the point in the algorithm when we need to construct the feasible matching M from G, if P ∗ R is R to avoid a potential blocking non-empty, this phase ensures that we fill up all of the projects in P ∗ pair involving some student that has been rejected by some project in P ∗ R. 10 project offered by lk in any strongly stable matching -- such pairs (st, pu), for each project pu ∈ Pk that st finds acceptable, are deleted. The repeat-until loop is then potentially reactivated, and the entire process continues until every student is provisionally assigned to a project or has an empty list. At the termination of the outer repeat-until loop in line 30, if a student is adjacent in G to a project pj via a bound edge, then we may potentially carry out extra deletions as follows. First, we let lk be the lecturer that offers pj and we let U be the set of projects that are adjacent to si in G via an unbound edge. For each project pu ∈ U \ Pk, it turns out that the pair (si, pu) cannot belong to any strongly stable matching, thus we delete all such pairs. Finally, we let M be any feasible matching in the provisional assignment graph G. If M is strongly stable relative to the given instance I then M is output as a strongly stable matching in I. Otherwise, the algorithm reports that no strongly stable matching exists in I. We present Algorithm SPA-ST-strong in pseudocode form in Algorithm 1. Finding the critical set. Consider the reduced assignment graph Gr = (Sr, Pr, Er) formed from G at a given point during the algorithm's execution (at line 15). To find the critical set of students in Gr, first we need to construct a maximum matching Mr in Gr, with respect to the revised quota q∗ j , for each pj ∈ Pr. In this context, a matching Mr ⊆ Er is such that Mr(si) ≤ 1 for all si ∈ Sr, and Mr(pj) ≤ q∗ j for all pj ∈ Pr. We describe how to construct Mr as follows: 1. Let G′ r be the subgraph of Gr induced by the dummy students adjacent to a project in Gr. First, find a maximum matching M ′ r in G′ r. 2. Using M ′ r as an initial solution, find a maximum matching Mr in Gr.7 If a student si is not assigned to any project in Mr, we say that vertex si is free in Gr. Similarly, if a project pj is such that pj has fewer than q∗ j assignees in Mr, we say that vertex pj is free in Gr. An alternating path in Gr relative to Mr is any simple path in which edges are alternately in, and not in, Mr. An augmenting path in Gr is an alternating path from a free student to a free project. The following lemmas are classical results with respect to matchings in bipartite graphs. Lemma 1. A matching Mr in a reduced assignment graph Gr has maximum cardinality if and only if there is no augmenting path relative to Mr in Gr. Lemma 2. Let Mr be a maximum matching in the reduced assignment graph Gr. Then Mr = Sr − δ(Gr). The classical augmenting path algorithm can be used to obtain Mr, and as explained in [11], this can be implemented to run in O(min{n,P cj}m) time, where n is the number of students and m is the total length of the students' preference lists. Now that we have described how to construct a maximum matching in the reduced assignment graph, the following lemma tells us how to find the critical set of students. Lemma 3. Given a maximum matching Mr in the reduced assignment graph Gr, the critical set Z consists of the set U of unassigned students together with the set U ′ of students reachable from a student in U via an alternating path. 7 By making sure that all the dummy students are matched in step 1, we are guaranteed that no lecturer is oversubscribed with non-dummy students in Gr. Algorithm 1 Algorithm SPA-ST-strong 11 delete (st, pu) k do repeat for each project pj at the head of si's list do for each student st dominated in Lj k do delete (st, pj) if lk is full or oversubscribed then for each student st dominated in Lk do for each project pu ∈ Pk ∩ At do while some student si is unassigned and has a non-empty list do lk ← lecturer who offers pj add the edge (si, pj) to G if pj is full or oversubscribed then form the reduced assignment graph Gr find the critical set Z of students for each project pu ∈ N (Z) do lk ← lecturer who offers pu for each student st at the tail of Lu Input: spa-st instance I Output: a strongly stable matching in I or "no strongly stable matching exists in I" 1: G ← ∅ 2: repeat 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: until every unassigned student has an empty list 31: for each student si in G do 32: 33: 34: 35: 36: 37: M ← a feasible matching in G 38: if M is a strongly stable matching in I then 39: 40: else 41: lk ← lecturer who offers pj U ← unbound projects adjacent to si in G for each pu ∈ U \ Pk do lk ← lecturer who offers pj sr ← most preferred student rejected from pj in Lj if the students at the tail of Lk are no better than sr then k {any if > 1} for each student st at the tail of Lk do for each project pu ∈ Pk ∩ At do delete (st, pu) until Z is empty for each pj ∈ P do delete (si, pu) return M delete (st, pu) if si is adjacent in G to a project pj via a bound edge then if pj is replete and pj is undersubscribed then return "no strongly stable matching exists in I" Proof. First, we note that δ(Gr) = U . Let C = U ∪ U ′, we claim that δ(C) = U . By the definition of δ(Gr), clearly δ(C) ≤ δ(Gr) = U . Now suppose that δ(C) < U , then U > δ(C) = U ∪ U ′ − X pj ∈N (C) q∗ j = U + U ′ − X pj ∈N (C) q∗ j (since U ∩ U ′ = ∅) U ′ < X pj ∈N (C) q∗ j . (1) 12 Inequality 1 implies that there is a project pj ∈ N (C) such that pj has fewer than q∗ j assignees in Mr; thus pj is free in Mr. We claim that every student that is assigned in Gr to a project pj ′ ∈ N (C) must be in C. For suppose there is a student si /∈ C such that si is assigned to pj ′ in Mr. Since pj ′ ∈ N (C), then pj ′ must be adjacent to some student si′ ∈ C. Now, if si′ ∈ U , then there is an alternating path from si′ to si via pj ′ , a contradiction. Otherwise, if si′ ∈ U ′, since si′ is reachable from a student in U via an alternating path, si is also reachable from the same student in U via an alternating path. Hence our claim is established. Now, given that pj has fewer than q∗ j assignees in Mr, since each student in U ′ is reachable from a student in U via an alternating path, and the students in U ∪ U ′ are collectively adjacent to projects in N (C), we can find an alternating path from a student in U to pj. Thus Mr admits an augmenting path, contradicting the maximality of Mr. Further, the critical set Z must contain every student who is unassigned in some maximum matching in Gr. For, suppose not. Let M ∗ r = Sr − δ(Gr)), and suppose there is some student si ∈ Sr \ Z such that si is unassigned in M ∗ r . There must be δ(Gr) unassigned students, with at most δ(Gr) − 1 of these students contained in Z (since si /∈ Z). Hence Z contains at least Z − δ(Gr) + 1 assigned students. It follows that r be an arbitrary such matching (where M ∗ or X pj ∈N (Z) q∗ j ≥ Z − δ(Gr) + 1 Z − X pj ∈N (Z) q∗ j ≤ δ(Gr) − 1 contradicting the required deficiency of Z. But, for every si ∈ U ′, there is a maximum matching in which si is unassigned, obtainable from Mr via an alternating path from a student in U to si. Hence C ⊆ Z; and since δ(C) = δ(Z), ⊓⊔ this completes the proof. 4.3 The non-triviality of extending Algorithm HRT-strong to spa-st Algorithm SPA-ST-strong is a non-trivial extension of Algorithm HRT-strong for hrt [11]. Here we outline the major distinctions between our algorithm and Algorithm HRT-strong, which indicate the challenges involved in extending the earlier approach to the spa-st setting. 1. Given a lecturer lk, it is possible that during some iteration of our algorithm, some pj ∈ Pk is oversubscribed which causes lk to become full or oversubscribed (see Fig. 4(a) in Sect. 4.4, at the point where s3 applies to p1). Finding the dominated students in Lk becomes more complex in spa-st -- to achieve this we introduced the notion of quota (i.e., qk) for lk. 2. To form Gr in the spa-st case, we extended the approach described in the hrt case [11] by introducing the concept of lower rank edges for each lecturer who offers a project in Gr, and we also introduced dummy students. 3. Lines 22 - 29 of Algorithm SPA-ST-strong refer to additional deletions that must be car- ried out in a certain situation; this type of deletion was also carried out in Algorithm SPA-ST-super for super-stability [24] (see the description corresponding to Fig. 5 in Sect. 4.4 for an example showing why we may need to carry out this type of deletion in the strong stability context). 4. Constructing a feasible matching M in G in the spa-st setting is much more challenging: we first identify some replete projects that must be full in M , denoted by P ∗ R (see the description corresponding to Fig. 6 in Sect. 4.4). Also, in the hrt case, when constructing M from G, preference is given to a bound edge over an unbound edge; in general, this is not always true in the spa-st case. 13 4.4 Example algorithm execution In this section, we illustrate an execution of Algorithm SPA-ST-strong with respect to the spa-st instance I3 shown in Fig. 3, which involves the set of students S = {si : 1 ≤ i ≤ 8}, the set of projects P = {pj : 1 ≤ j ≤ 6} and the set of lecturers L = {lk : 1 ≤ k ≤ 3}. The algorithm starts by initialising the bipartite graph G = {}, which will contain the provisional assignment of students to projects. We assume that the students become provisionally assigned to each project at the head of their list in subscript order. Figs. 4, 5 and 6 illustrate how this execution of Algorithm SPA-ST-strong proceeds with respect to I3. Student preferences s1: p1 p6 s2: p1 p2 s3: (p1 p4) s4: p2 (p5 p6) s5: (p2 p3) s6: (p2 p4) s7: p3 p1 s8: p5 p1 s1 s2 s3 s4 s5 s6 s7 s8 p1 : 2 p2 : 2 p3 : 1 p4 : 1 p5 : 1 (a) The provisional as- signment graph G(1) at the end of the while loop, with the quota of each project labelled be- side it. Lecturer preferences {3} l1: s8 {2} l2: s6 {3} l3: (s1 s7 (s1 s5 (s7 s4) s8 s2 s3) s3) (s4 s5) s6 offers p1, p2 p3, p4 p5, p6 Project capacities: c1 = c2 = c6 = 2, c3 = c4 = c5 = 1 Lecturer capacities: d1 = d3 = 3, d2 = 2 Fig. 3: An instance I3 of spa-st. s1 s2 s3 s4 sd1 p1 : 1 p2 : 2 s4 s5 s6 s7 s8 p1 : 1 p2 : 2 p3 : 1 p4 : 1 p5 : 1 (b) The reduced assign- ment graph G(1) r , with the revised quota of each project labelled beside it. The collection of the dashed edges is the maxi- mum matching M (1) . r (c) The provisional as- signment graph G(1) at the termination of itera- tion (1). Fig. 4: Iteration (1). Iteration 1: At the termination of the while loop during the first iteration of the inner repeat-until loop, every student, except s3, s6 and s7, is provisionally assigned to every project in the first tie on their preference list. Edge (s3, p4) /∈ G(1) because (s3, p4) was deleted as a result of s6 be- coming provisionally assigned to p4, causing s3 to be dominated in L4 2. Also, edge (s6, p2) /∈ G(1) because (s6, p2) was deleted as a result of s4 becoming provisionally assigned to p2, causing s6 to be dominated in L1 (at that point in the algorithm, min{dG(l1), α1} = min{4, 3} = 3 = d1 and s6 is worse than at least d1 students who are provisionally assigned to l1). Finally, edge (s7, p3) /∈ G(1) because (s7, p3) was deleted as a result of s5 becoming provisionally assigned to p5, causing s7 to be dominated in L3 2. 14 To form G(1) r , the bound edges (s5, p3), (s6, p4), (s7, p1) and (s8, p5) are removed from the graph. We can verify that edges (s4, p2) and (s5, p2) are unbound, since they are lower rank edges for l1. Also, since p1 is oversubscribed, and each of s1, s2 and s3 is at the tail of L1 1, edges (s1, p1), (s2, p1) and (s3, p1) are unbound. Further, the revised quota of l1 in G(1) is 2, and the total revised quota of projects offered by l1 (i.e., p1 and p2) is 3. Thus, we add one dummy student vertex sd1 to G1 r, and we add an edge between sd1 and p2 (since p2 is the only project in G(1) adjacent to a student in the tail of L1 via a lower rank edge). With respect to the maximum matching M (1) , it is clear that the critical set Z (1) = {s1, s2, s3}, thus we delete the edges (s1, p1), (s2, p1) and (s3, p1) from G(1); and the inner repeat-until loop is reactivated. r r r s1 s2 s4 s5 s6 s7 s8 p1 : 1 p2 : 2 p3 : 1 p4 : 1 p5 : 1 p6 : 1 (a) The provisional as- signment graph G(2) at the end of the while loop. s4 p2 : 1 (b) The reduced assign- ment graph G(2) r . Fig. 5: Iteration (2). s1 s2 s5 s6 s7 s8 p1 : 1 p2 : 1 p3 : 1 p4 : 1 p5 : 1 p6 : 1 (c) The provisional as- signment graph G(2) at the termination of itera- tion (2). Iteartion 2: At the beginning of this iteration, each of s1 and s2 is unassigned and has a non- empty list; thus we add edges (s1, p6) and (s2, p2) to the provisional assignment graph obtained r . It can be verified that every edge in G(2) at the termination of iteration (1) to form G(2) r , except (s4, p2) and (s5, p2), is a bound edge. Clearly, the critical set Z (2) = ∅, thus the inner repeat-until loop terminates. At this point, project p1, which was replete during iteration (1), is undersubscribed in iteration (2). Moreover, the students at the tail of L1 (i.e., s4 and s5) are no better than s3, where s3 is one of the most preferred students rejected from p1 according to L1 1; thus we delete edges (s4, p2) and (s5, p2). The outer repeat-until loop is then reactivated (since s4 is unassigned and has a non-empty list). 15 s1 s2 s4 s5 s6 s7 s8 p1 : 2 p2 : 1 p3 : 1 p4 : 1 p5 : 1 p6 : 2 (a) The provisional as- signment graph G(3) at the end of the while loop. Fig. 6: Iteration (3). Iteration 3: At the beginning of this iteration, the only student that is unassigned and has a non-empty list is s4; thus we add edges (s4, p5) and (s4, p6) to the provisional assignment graph obtained at the termination of iteration (2) to form G(3) r . The provisional assignment of s4 to p5 led to p5 becoming oversubscribed; thus (s8, p5) is deleted (since s8 is dominated on L5 3). Further, s8 becomes provisionally assigned to p1. It can be verified that all the edges in G(3) are bound edges. Moreover, the reduced assignment graph G(3) r = ∅. r Again, every unassigned students has an empty list. We also have that a project p2, which was replete in iteration (2), is undersubscribed in iteration (3). However, no further deletion is carried out in line 29 of the algorithm, since the student at the tail of L1 (i.e., s2) is better than s4 and s5, where s4 and s5 are the most preferred students rejected from p2 according to L2 R = {p5}, since (s8, p5) has been deleted, s8 prefers p5 to her provisional assignment in G and l3 is undersubscribed. Thus we need to ensure p5 fills up in the feasible matching M constructed from G, so as to avoid (s8, p5) from blocking M . Finally, the algorithm outputs the feasible matching M = {(s1, p6), (s2, p2), (s4, p5), (s5, p3), (s6, p4), (s7, p1), (s8, p1)} as a strongly stable matching. 1. Hence, the repeat-until loop terminates. We observe that P ∗ 4.5 Correctness of the algorithm We now present the following results regarding the correctness of Algorithm SPA-ST-strong. The first of these results deals with the fact that no strongly stable pair is ever deleted during the execution of the algorithm. Lemma 4. If a pair (si, pj) is deleted during the execution of Algorithm SPA-ST-strong, then (si, pj) does not belong to any strongly stable matching in I. In order to prove Lemma 4, we present Lemmas 5, 6 and 7. Lemma 5. If a pair (si, pj) is deleted within the inner repeat-until loop during the execution of Algorithm SPA-ST-strong, then (si, pj) does not belong to any strongly stable matching in I. Proof. Suppose that (si, pj) is the first strongly stable pair to be deleted within the inner repeat-until loop during an arbitrary execution E of Algorithm SPA-ST-strong. Let M ∗ be some strongly stable matching in which si is assigned to pj. Let lk be the lecturer who offers pj. Suppose that G is the provisional assignment graph immediately after the deletion of (si, pj). There are three cases to consider. 16 1. Suppose that (si, pj) is deleted (in line 10) because some other student became provisionally assigned to pj during E, causing pj to become full or oversubscribed, so that si is dominated in Lj k. Since (si, pj) ∈ M ∗ \ G, there is some student, say sr, such that lk prefers sr to si and (sr, pj) ∈ G \ M ∗, for otherwise pj would be oversubscribed in M ∗. We note that sr cannot be assigned to a project that she prefers to pj in any strongly stable matching, for otherwise some strongly stable pair must have been deleted before (si, pj), as pj must be in the head of sr's list when she applied. So sr is either unassigned in M ∗, or sr prefers pj to M ∗(si) or is indifferent between them. Clearly for any combination of lk and pj being full or undersubscribed in M ∗, it follows that (sr, pj) blocks M ∗, a contradiction. 2. Suppose that (si, pj) is deleted (in line 14) because some other student became provisionally assigned to a project offered by lk during E, causing lk to become full or oversubscribed, so that si is dominated in Lk. We denote by Ck the set of projects that are full or oversubscribed in G, which are offered by lk. We denote by Dk the set of projects that are undersubscribed in G, which are offered by lk. Clearly the projects offered by lk that are provisionally assigned to a student in G at this point can be partitioned into Ck and Dk. We consider two subcases. (i) Each student who is provisionally assigned in G to a project in Dk (if any) is also assigned to that same project in M ∗. However, after the deletion of (si, pj), we know that X pt∈Ck∪Dk qt = X pt∈Ck ct + X pt∈Dk dG(pt) ≥ dk; (2) i.e., the total quota of projects in Ck ∪ Dk is at least the capacity of lk. Now, since pj has one more assignee in M ∗ than it has provisional assignees in G, namely si, then some other project pj ′ ∈ Ck must have fewer than cj ′ assignees in M ∗, for otherwise lk would be oversubscribed in M ∗. This implies that there is some student, say sr, such that lk prefers sr to si and (sr, pj ′ ) ∈ G \ M ∗. Moreover, sr cannot be assigned to a project that she prefers to pj ′ in M ∗, as explained in (1) above. Hence, (sr, pj ′ ) blocks M ∗, a contradiction. (ii) Each project in Ck at this point ends up full in M ∗. This implies that there is some project pj ′ ∈ Dk with fewer assignees in M ∗ than provisional assignees in G, for other- wise lk would be oversubscribed in M ∗. Thus pj ′ is undersubscribed in M ∗ (since Dk is the set of undersusbcribed projects offered by lk). Moreover, there is some student, say sr, such that lk prefers sr to si and (sr, pj ′ ) ∈ G \ M ∗. Following a similar argument in (i) above, (sr, pj ′ ) blocks M ∗, a contradiction. 3. Suppose that (si, pj) is deleted (in line 20) because pj is provisionally assigned to a student in the critical set Z at some point, and at that point si is in the tail of Lj k. We refer to the set of preference lists at that point as the current lists. Let Z ′ be the set of students in Z who are assigned in M ∗ to a project from the head of their current lists, and let P ′ be the set of projects in N (Z) assigned in M ∗ to at least one student from the tail of its current list. We have that pj ∈ P ′, so P ′ 6= ∅. Consider si′ ∈ Z. Now si′ cannot be assigned in M ∗ to a project that she prefers to any project in the head of her current list, for otherwise some strongly stable pair must have been deleted before (si, pj). Hence, any student si′ in Z who is provisionally assigned to pj must be in Z ′, otherwise (si′ , pj) would 6= ∅, because Z − P{q∗ block M ∗. Thus Z ′ j : pj ∈ N (Z)} > 0 and Z ′ −P{q∗ j : pj ∈ P ′} ≤ 0, since every student in Z ′ is assigned in M ∗ to a project in P ′. 6= ∅. Also Z \ Z ′ j : pj ∈ N (Z)} ≤ Z ′ −P{q∗ We now claim that there must be an edge (sr, pj ′ ) in Gr such that sr ∈ Z \ Z ′ and pj ′ ∈ P ′. For otherwise N (Z \ Z ′) ⊆ N (Z) \ P ′, and 17 Z \ Z ′ − X{q∗ j : pj ∈ N (Z \ Z ′)} ≥ Z \ Z ′ − X{q∗ j : pj ∈ N (Z) \ P ′} = Z − X{q∗ ≥ Z − X{q∗ j : pj ∈ N (Z)} − (cid:16)Z ′ − X{q∗ j : pj ∈ N (Z)}, j : pj ∈ P ′}(cid:17) j : pj ∈ P ′} ≤ 0. Hence Z \ Z ′ has deficiency at least that of Z, contradicting since Z ′ −P{q∗ the fact that Z is the critical set. Thus our claim is established, i.e., there is some student sr ∈ Z \ Z ′ and some project pj ′ ∈ P ′ such that sr is adjacent to pj ′ in Gr. Since sr is either unassigned in M ∗ or prefers pj ′ to M ∗(sr), and since the lecturer who offers pj ′ is indifferent between sr and at least one student in M ∗(pj ′ ), we have that (sr, pj ′ ) blocks M ∗, a contradiction. ⊓⊔ Lemma 6. If a pair (si, pj) is deleted in line 29 during the execution of Algorithm SPA-ST- strong, then (si, pj) does not belong to any strongly stable matching in I. Proof. Suppose that (si, pj) was deleted in line 29 of the algorithm. Let pj ′ be some other project offered by lk which was replete during an iteration of the inner repeat-until loop and subsequently ends up undersubscribed at the end of the loop, i.e., pj ′ plays the role of pj in line 23. Suppose that si′ plays the role of sr in line 25, i.e., si′ was the most preferred student rejected from pj ′ according to Lj ′ k (possibly si′ = si). Then lk prefers si′ to si or is indifferent between them, since si plays the role of st at some for loop iteration in line 27. Moreover si′ was provisionally assigned to pj ′ during an iteration of the inner repeat-until loop but (si′ , pj ′ ) /∈ G at the end of the loop. Thus (si′ , pj ′ ) /∈ M ∗, since no strongly stable pair is deleted within the inner repeat-until loop, as proved in Lemma 5. Let lz0 = lk, pt0 = pj ′ and sq0 = si′ . Again, none of the students who are provisionally assigned to some project in G can be assigned to any project better than their current assignment in any strongly stable matching as this would mean a strongly stable pair must have been deleted before (si, pj), as each student apply to projects in the head of her list. So, either (a) sq0 is unassigned in M ∗ or sq0 prefers pt0 to M ∗(sq0 ), or (b) sq0 is indifferent between pt0 and M ∗(sq0 ). If (a) holds, then by the strong stability of M ∗, pt0 is full in M ∗ and lz0 prefers the worst student/s in M ∗(pt0 ) to sq0 ; for if pt0 is undersubscribed in M ∗ then (sq0 , pt0) blocks M ∗, since si ∈ M ∗(lz0) and lz0 prefers sq0 to si or is indifferent between them, a contradiction. If (b) holds we claim that lz0 prefers sq0 to si. Thus, irrespective of whether M ∗(sq0 ) is offered by lz0 or not, the argument follows from (a), i.e., pt0 is full in M ∗ and lz0 prefers the worst student/s in M ∗(pt0 ) to sq0. Just before the deletion of (si, pj) occurred, pt0 is undersubscribed in G. Since pt0 is full in M ∗, it follows that there exists some student, say sq1 , such that (sq1 , pt0) ∈ M ∗ \ G. We note that lz0 prefers sq1 to sq0. Let pt1 = pt0. Since (si, pj) is the first strongly stable pair to be deleted, sq1 is provisionally assigned in G to a project pt2 such that sq1 prefers pt2 to pt1. For otherwise, as students apply to projects in the head of their list, that would mean (sq1 , pt1) must have been deleted during an iteration of the inner repeat-until loop, a contradiction. We note that pt2 6= pt1, since (sq1 , pt2 ) ∈ G and (sq1 , pt1) /∈ G. Let lz1 be the lecturer who offers pt2. By the strong stability of M ∗, it follows that either (i) pt2 is full in M ∗ and lz1 prefers the worst student/s in M ∗(pt2 ) to sq1 , or 18 (ii) pt2 is undersubscribed in M ∗, lz1 is full in M ∗, sq1 /∈ M ∗(lz1 ) and lz1 prefer the worst student/s in M ∗(lz1) to sq1. Otherwise (sq1 , pt2 ) blocks M ∗. In case (i), there exists some student sq2 ∈ M ∗(pt2 ) \ G(pt2). Let pt3 = pt2 . In case (ii), there exists some student sq2 ∈ M ∗(lz1) \ G(lz1 ). We note that lz1 prefers sq2 to sq1 . Now, suppose M ∗(sq2 ) = pt3 (possibly pt3 = pt2). It is clear that sq2 6= sq1 . Applying similar reasoning as for sq1, sq2 is assigned in G to a project pt4 such that sq2 prefers pt4 to pt3. Let lz2 be the lecturer who offers pt4 . We are identifying a sequence hsqi ii≥0 of students, a sequence hpti ii≥0 of projects, and a sequence hlziii≥0 of lecturers, such that, for each i ≥ 1 1. sqi prefers pt2i to pt2i−1 , 2. (sqi , pt2i) ∈ G and (sqi , pt2i−1) ∈ M ∗, 3. lzi prefers sqi+1 to sqi ; also, lzi offers both pt2i and pt2i+1 (possibly pt2i = pt2i+1 ). First we claim that for each new project that we identify, pt2i 6= pt2i−1 for i ≥ 1. Suppose pt2i = pt2i−1 for some i ≥ 1. From above sqi was identified by lzi−1 such that (sqi , pt2i−1 ) ∈ M ∗\G. Moreover (sqi , pt2i) ∈ G. Hence we reach a contradiction. Clearly, for each student sqi for i ≥ 1 we identify, sqi must be assigned to distinct projects in G and in M ∗. Next we claim that for each new student sqi that we identify, sqi 6= sqt for 1 ≤ t < i. We prove this by induction on i. For the base case, clearly sq2 6= sq1 . We assume that the claim holds for some i ≥ 1, i.e., the sequence sq1 , sq2 , . . . , sqi consists of distinct students. We show that the claim holds for i + 1, i.e, the sequence sq1 , sq2 , . . . , sqi , sqi+1 also consists of distinct students. Clearly sqi+1 6= sqi since lzi prefers sqi+1 to sqi . Thus, it suffices to show that sqi+1 6= sqj for 1 ≤ j ≤ i − 1. Now, suppose sqi+1 = sqj for 1 ≤ j ≤ i − 1. This implies that sqj was identified by lzi and clearly lzi prefers sqj to sqj−1 . Now since sqi+1 was also identified by lzi to avoid ) in M ∗, it follows that either (i) pt2i is full in M ∗, or (ii) pt2i is the blocking pair (sqi , pt2i undersubscribed in M ∗ and lzi is full in M ∗. We consider each cases further as follows. (i) If pt2i is full in M ∗, we know that (sqi , pt2i) ∈ G \ M ∗. Moreover sqj was identified by lzi+1 because of case (i). Furthermore (sqj−1 , pt2i ) ∈ G \ M ∗. In this case, pt2i+1 = pt2i and we have that (sqi , pt2i+1 ) ∈ G \ M ∗ and (sqi+1 , pt2i+1 ) ∈ M ∗ \ G, (sqj−1 , pt2i+1) ∈ G \ M ∗ and (sqj , pt2i+1) ∈ M ∗ \ G. By the inductive hypothesis, the sequence sq1 , sq2 , . . . , sqj−1 , sqj , . . . , sqi consists of distinct students. This implies that sqi 6= sqj−1 . Thus since pt2i+1 is full in M ∗, lzi should have been able to identify distinct students sqj and sqi+1 to avoid the blocking pairs (sqj−1 , pt2i+1 ) and (sqi , pt2i+1) respectively in M ∗, a contradiction. (ii) pt2i is undersubscribed in M ∗ and lzi is full in M ∗. Similarly as in case (i) above, we have that sqi ∈ G(lzi) \ M ∗(lzi) and sqi+1 ∈ M ∗(lzi) \ G(lzi ), sqj−1 ∈ G(lzi) \ M ∗(lzi) and sqj ∈ M ∗(lzi) \ G(lzi). Since sqi 6= sqj−1 and lzi is full in M ∗, lzi should have been able to identify distinct students sqj and sqi+1 corresponding to students sqj−1 and sqi respectively, a contradiction. This completes the induction step. As the sequence of distinct students and projects is infinite, ⊓⊔ we reach an immediate contradiction. 19 Lemma 7. If a pair (si, pj) is deleted in line 36 during the execution of Algorithm SPA-ST- strong, then (si, pj) does not belong to any strongly stable matching in I. Proof. Suppose that (si, pj) is the first strongly stable pair to be deleted during an arbitrary execution E of Algorithm SPA-ST-strong. Then by Lemmas 5 and 6, (si, pj) was deleted in line 36. Let lk be the lecturer who offers pj and let M ∗ be some strongly stable matching in which si is assigned to pj. Let G be the provisional assignment graph. At this point in the algorithm where the deletion of (si, pj) occured, si is adjacent to some other project pj ′ ∈ G via a bound edge, where pj ′ is offered by lk′ (note that lk 6= lk′ ). By the definition of a bound edge, it follows that either pj ′ is not oversubscribed in G or lk′ prefers si to some student in G(pj ′ ) (or both). Also, either (si, pj ′ ) is not a lower rank edge or lk′ prefers si to some student in G(lk′ ) (or both). Let lz0 = lk′ , pt0 = pj ′ and sq0 = si. We note that sq0 is indifferent between pj and pt0. Now, since (sq0 , pt0 ) ∈ G \ M ∗, by the strong stabiity of M ∗, either (i) or (ii) holds as follows: (i) pt0 is full in M ∗ and lz0 prefers the worst student/s in M ∗(pt0 ) to sq0 or is indifferent between them; (ii) pt0 is undersubscribed in M ∗, lz0 is full in M ∗ and lz0 prefers the worst students in M ∗(lz0) to sq0 or is indifferent between them. Otherwise (sq0 , pt0 ) blocks M ∗. In case (i), since sq0 is bound to pt0 in G and since (sq0 , pt0) ∈ G \ M ∗, there exists some student sq1 ∈ M ∗(pt0) \ G(pt0 ). Let pt1 = pt0. In case (ii), since sq0 is assigned in G to a project offered by lz0 (i.e., pt0 ) via a bound edge, and since sq0 is not assigned to lz0 in M ∗, there exists some student sq1 ∈ M ∗(lz0 ) \ G(lz0 ). We note that lz0 either prefers sq1 to sq0 or is indifferent between them; clearly sq1 6= sq0 . Now, suppose M ∗(sq1 ) = pt1 (possibly pt1 = pt0). Since (sq0 , pj) is the first strongly stable pair to be deleted, sq1 is provisionally assigned in G to a project pt2 such that sq1 prefers pt2 to pt1. For otherwise, as students apply to projects in the head of their list and since (sq1 , pt1) /∈ G, that would mean (sq1 , pt1) must have been deleted during an iteration of the repeat-until loop, a contradiction. We note that pt2 6= pt1, since (sq1 , pt2) ∈ G and (sq1 , pt1 ) /∈ G. Let lz1 be the lecturer who offers pt2. Again by the strong stability of M ∗, either (i) or (ii) holds as follows: (i) pt2 is full in M ∗ and lz1 prefers the worst student/s in M ∗(pt2 ) to sq1 ; (ii) pt2 is undersubscribed in M ∗, lz1 is full in M ∗ and lz1 prefers the worst students in M ∗(lz1) to sq1 . Otherwise (sq1 , pt2 ) blocks M ∗. In case (i), there exists some student sq2 ∈ M ∗(pt2 ) \ G(pt2). Let pt3 = pt2. In case (ii), there exists some student sq2 ∈ M ∗(lz1) \ G(lz1 ). We note that lz1 prefers sq2 to sq1; again it is clear that sq2 6= sq1 . Now, suppose M ∗(sq2 ) = pt3 (possibly pt3 = pt2). Applying similar reasoning as for sq1 , sq2 is provisionally assigned in G to a project pt4 such that sq2 prefers pt4 to pt3 . Let lz2 be the lecturer who offers pt4 . We are identifying a sequence hsqi ii≥0 of students, a sequence hptiii≥0 of projects, and a sequence hlziii≥0 of lecturers, such that, for each i ≥ 1 1. sqi prefers pt2i to pt2i−1 , 2. (sqi , pt2i) ∈ G and (sqi , pt2i−1) ∈ M ∗, 3. lzi prefers sqi+1 to sqi ; also, lzi offers both pt2i and pt2i+1 (possibly pt2i = pt2i+1 ). Following a similar argument as in the proof of Lemma 6, we can identify an infinite sequence ⊓⊔ of distinct students and projects, a contradiction. Lemmas 5, 6 and 7 immediately give rise to Lemma 4. The next two lemmas will be used as a tool in the proof of the remaining lemmas. 20 Lemma 8. Every student who is assigned to a project (intuitively a lecturer) in the final provi- sional assignment graph G must be assigned in any feasible matching M . Proof. Suppose si is a student who is provisionally assigned to some project in G, but si is not assigned in a feasible matching M , then si must be in the critical set Z, and hence Z 6= ∅, a ⊓⊔ contradiction. Lemma 9. Let M be a feasible matching in the final provisional assignment graph G and let M ∗ be any strongly stable matching. Let lk be an arbitrary lecturer; (i) if lk is undersubscribed in M ∗ then every student who is assigned to lk in M is also assigned to lk in M ∗, and (ii) if lk is undersubscribed in M then lk has the same number of assignees in M ∗ as in M . Proof. Let lk be an arbitrary lecturer. First, we show that (i) holds. Suppose otherwise, then there exists a student, say si, such that si ∈ M (lk) \ M ∗(lk). Moreover, there exists some project pj ∈ Pk such that si ∈ M (pj) \ M ∗(pj). By Lemma 4, si cannot be assigned to a project that she prefers to pj in M ∗. Also, by the strong stability of M ∗, pj is full in M ∗ and lk prefers the worst student/s in M ∗(pj) to si. Let lz0 = lk, pt0 = pj, and sq0 = si. As pt0 is full in M ∗ and no project is oversubscribed in M , there exists some student sq1 ∈ M ∗(pt0) \ M (pt0 ) such that lz0 prefers sq1 to sq0 . Let pt1 = pt0. By Lemma 4, sq1 is assigned in M to a project pt2 such that sq1 prefers pt2 to pt1. We note that sq1 cannot be indifferent between pt2 and pt1; for otherwise, as students apply to projects in the head of their list, since (sq1 , pt1) /∈ M , that would mean (sq1 , pt1) must have been deleted during the algorithm's execution, contradicting Lemma 4. It follows that sq1 ∈ M (pt2 ) \ M ∗(pt2). Let lz1 be the lecturer who offers pt2 . By the strong stability of M ∗, either (i) pt2 is full in M ∗ and lz1 prefers the worst student/s in M ∗(pt2 ) to sq1 , or (ii) pt2 is undersubscribed in M ∗, lz1 is full in M ∗, sq1 /∈ M ∗(lz1) and lz1 prefers the worst student/s in M ∗(lz1) to sq1. Otherwise (sq1 , pt2) blocks M ∗. In case (i), there exists some student sq2 ∈ M ∗(pt2 ) \ M (pt2 ). Let pt3 = pt2 . In case (ii), there exists some student sq2 ∈ M ∗(lz1) \ M (lz1). We note that lz1 prefers sq2 to sq1 . Now, suppose M ∗(sq2 ) = pt3 (possibly pt3 = pt2). It is clear that sq2 6= sq1 . Applying similar reasoning as for sq1 , student sq2 is assigned in M to a project pt4 such that sq2 prefers pt4 to pt3 . Let lz2 be the lecturer who offers pt4. We are identifying a sequence hsqi ii≥0 of students, a sequence hptiii≥0 of projects, and a sequence hlzi ii≥0 of lecturers, such that, for each i ≥ 1 1. sqi prefers pt2i to pt2i−1 , 2. (sqi , pt2i) ∈ G and (sqi , pt2i−1) ∈ M ∗, 3. lzi prefers sqi+1 to sqi ; also, lzi offers both pt2i and pt2i+1 (possibly pt2i = pt2i+1 ). Following a similar argument as in the proof of Lemma 6, we can identify an infinite sequence of distinct students and projects, a contradiction. Hence, if lk is undersubscribed in M ∗ then every student who is assigned to lk in M is also assigned to lk in M ∗. Next, we show that (ii) holds. By the first claim, any lecturer who is full in M is also full in M ∗, and any lecturer who is undersubscribed in M has as many assignees in M ∗ as she has in M . Hence X lk∈L M (lk) ≤ X lk∈L M ∗(lk) . (3) 21 Let S1 and S2 denote the set of students who are assigned to a project in M and M ∗ respectively. By Lemma 8, each student who is provisionally assigned to a project in the final provisional assignment graph G must be assigned to a project in M . Moreover, any student who is not provisionally assigned to a project in G must have an empty list. It follows that these students are unassigned in M ∗, since Lemma 4 guarantees that no strongly stable pairs are deleted. Thus S2 ≤ S1. Further, we have that X lk∈L M ∗(lk) = S2 ≤ S1 = X lk∈L M (lk), From Inequality 3 and 4, it follows that M (lk) = M ∗(lk) for each lk ∈ L. (4) ⊓⊔ The next three lemmas deal with the case that Algorithm SPA-ST-strong reports the non- existence of a strongly stable matching in I. Lemma 10. Let M be a feasible matching in the final provisional assignment graph G. Suppose that (a) some non-replete lecturer lk has fewer assignees in M than provisional assignees in G, or (b) some replete lecturer is not full in M . Then I admits no strongly stable matching. Proof. Suppose that M ∗ is a strongly stable matching for the instance. By Lemma 8, each student who is provisionally assigned to a project in G must be assigned to a project in M . Moreover, any student who is not provisionally assigned to a project in G must have an empty list. It follows that these students are unassigned in M ∗, since Lemma 4 guarantees that no strongly stable pairs are deleted. Thus M ∗ ≤ M . Suppose that condition (a) is satisfied. Then some non-replete lecturer lk′ satisfies M (lk′ ) < dG(lk′ ), where dG(lk′ ) is the number of students provisionally assigned in G to a project offered by lk′ . As lk′ is non-replete, it follows that dG(lk′ ) < dk′ . Now M (lk) ≤ min{dk, dG(lk)} for all lk ∈ L. Hence M = X lk∈L M (lk) < X lk∈L min{dk, dG(lk)} . (5) Now, suppose that M ∗(lk) ≥ min{dk, dG(lk)} for all lk ∈ L. Then M ∗ > M by 5, a contradiction. Hence M ∗(lk) < min{dk, dG(lk)} for some lk ∈ L. This implies that lk is undersubcribed in M ∗. Moreover, lk has fewer assignees in M ∗ than provisional assignees in G. Thus there exists some student si who is provisionally assigned to lk in G but not in M ∗. It follows that there exists some project pj ∈ Pk such that (si, pj) ∈ G \ M ∗. By Lemma 4, si is not assigned to a project that she prefers to pj in M ∗. Also, by the strong stability of M ∗, pj is full in M ∗ and lk prefers the worst student/s in M ∗(pj) to si; for if pj is undersubscribed in M ∗ then (si, pj) blocks M ∗, a contradiction. Since pj is full in M ∗ with students that are better than si in Lj k and (si, pj) ∈ G \ M ∗, then there is some student, say si′ , such that lk prefers si′ to si and (si′ , pj) ∈ M ∗ \ G. For if all the students assigned to pj in M ∗ are also assigned to pj in G, then si would be dominated in Lj k and thus (si, pj) would have been deleted in G. Let lz0 = lk, pt0 = pt1 = pj, sq0 = si, sq1 = si′ . Again, by Lemma 4, sq1 is provisionally assigned in G to a project pt2 such that sq1 prefers pt2 to pt1. For otherwise, as students apply to projects in the head of their list, since (sq1 , pt1) /∈ G, that would mean (sq1 , pt1) must have been deleted during the algorithm's execution, a contradiction. We note that pt2 6= pt1, since (sq1 , pt2) ∈ G and (sq1 , pt1) /∈ G. Let lz1 be the lecturer who offers pt2 . By the strong stability of M ∗, either (i) pt2 is full in M ∗ and lz1 prefers the worst student/s in M ∗(pt2 ) to sq1 , or 22 (ii) pt2 is undersubscribed in M ∗, lz1 is full in M ∗, sq1 /∈ M ∗(lz1) and lz1 prefers the worst student/s in M ∗(lz1) to sq1. Otherwise (sq1 , pt2 ) blocks M ∗. In case (i), there exists some student sq2 ∈ M ∗(pt2 ) \ G(pt2). Let pt3 = pt2 . In case (ii), there exists some student sq2 ∈ M ∗(lz1) \ G(lz1 ). We note that lz1 prefers sq2 to sq1 . Now, suppose M ∗(sq2 ) = pt3 (possibly pt3 = pt2). It is clear that sq2 6= sq1 . Applying similar reasoning as for sq1 , student sq2 is assigned in G to a project pt4 such that sq2 prefers pt4 to pt3 . Let lz2 be the lecturer who offers pt4. We are identifying a sequence hsqi ii≥0 of students, a sequence hptiii≥0 of projects, and a sequence hlzi ii≥0 of lecturers, such that, for each i ≥ 1 1. sqi prefers pt2i to pt2i−1 , 2. (sqi , pt2i) ∈ G and (sqi , pt2i−1) ∈ M ∗, 3. lzi prefers sqi+1 to sqi ; also, lzi offers both pt2i and pt2i+1 (possibly pt2i = pt2i+1 ). Following a similar argument as in the proof of Lemma 6, we can identify an infinite sequence of distinct students and projects, a contradiction. Now suppose condition (b) is satisfied, i.e., some replete lecturer is not full in M . Let L1 and L2 be the set of replete and non-replete lecturers respectively. Then some lk′′ ∈ L1 satisfies M (lk′′ ) < dk′′ . Condition (a) cannot be satisfied, for otherwise the first part of the proof shows that M ∗ does not exist. Hence M (lk) = dG(lk) < dk for all lk ∈ L2. Now M (lk) ≤ dk for all lk ∈ L1. Hence M = X lk∈L1 M (lk) + X lk∈L2 M (lk) < X lk∈L1 dk + X lk∈L2 dG(lk) . (6) Now suppose that M ∗(lk) = dk for all lk ∈ L1, and M ∗(lk) ≥ dG(lk) for all lk ∈ L2. Then M ∗ > M by 6, a contradiction. Hence either (i) M ∗(lk′ ) < dk′ for some lk′ ∈ L1, or (ii) M ∗(lk′ ) < dG(lk′ ) for some lk′ ∈ L2. In case (ii), we reach a similar contradiction to that arrived at for condition (a). In case (i), we have that lk′ is undersubscribed in M ∗. As lk′ is replete, there exists some student si who was provisionally assigned to lk′ during the algorithm's execution, but si is not assigned to lk′ in M ∗. Moreover, there exists some project pj ∈ Pk′ such that (si, pj) /∈ M ∗ By Lemma 4, si is not assigned to a project in M ∗ that she prefers to pj. Following a similar argument as above, we can identify a sequence of distinct students and projects, and as this sequence is infinite, we reach a contradiction. Thus I admits no strongly ⊓⊔ stable matching. Lemma 11. Suppose that in the final provisional assignment graph G, a student is bound to two or more projects that are offered by different lecturers. Then I admits no strongly stable matching. Proof. Suppose that a strongly stable matching exists for the instance. Let M be a feasible matching in the final provisional assignment graph G. Denote by L1 and L2 the set of replete and non-replete lecturers respectively. Denote by S1 the set of students who are bound to one or more projects in G, and by S2 the other students who are provisionally assigned to one or more projects in G. By Lemma 8, Also, M = S1 + S2 . M = X lk∈L1 M (lk) + X lk∈L2 M (lk) . (7) (8) Moreover, we have that X lk∈L1 M (lk) + X lk∈L2 M (lk) = X lk∈L1 dk + X lk∈L2 dG(lk); 23 (9) for otherwise, no strongly stable matching exists by Lemma 10. Now, if some student is bound to more than one project offered by different lecturers, by considering how the lecturers' quotas are reduced when the students in S1 are removed in forming Gr from G, it follows that X lk∈L1 (dk − q∗ k) + X lk∈L2 (dG(lk) − q∗ k) ≥ X lk∈L1 (dk − q∗ k) + X lk∈L2 (min{dG(lk), αk} − q∗ k) = X lk∈L1 (qk − q∗ k) + X lk∈L2 (qk − q∗ k) (qk − q∗ k) = X lk∈L1∪L2 > S1, (10) (dk − q∗ where Plk∈L1 k) is the number of students that are bound to at least one project offered by a lecturer in L1 and L2 respectively. By substituting Equality 9 into Inequality 10, we obtain the following k) and Plk∈L2 (min{dG(lk), αk} − q∗ X lk∈L1 M (lk) − X lk∈L1 k + X q∗ lk∈L2 M (lk) − X lk∈L2 q∗ k > S1 . Combining 7 and 8 into 11, we have S1 + S2 − X lk∈L1 k − X q∗ lk∈L2 X lk∈L1∪L2 q∗ k > S1, q∗ k < S2 . (11) (12) Since the total revised quota of lecturers in L1 ∪ L2 whose projects are provisionally assigned to a student in Gr is strictly less than the number of students in S2, the preceding inequality ⊓⊔ suffices to establish that the critical set is non-empty, a contradiction. Lemma 12. Let M be a feasible matching in the final provisional assignment graph G. Suppose that the pair (si, pj), where pj is offered by lk, was deleted during the algorithm's execution. Suppose further that for any pj ′ ∈ Pk such that si is indifferent between pj and pj ′ , (si, pj ′ ) /∈ M . Finally, suppose each of pj and lk is undersubscribed in M . Then I admits no strongly stable matching. Proof. Suppose for a contradiction that there exists a strongly stable matching M ∗ in I. Let (si, pj) be a pair that was deleted during an arbitrary execution E of the algorithm. This implies that (si, pj) /∈ M ∗ by Lemma 4. Let M be the feasible matching at the termination of E. By the hypothesis of the lemma, lk is undersubscribed in M . This implies that lk is undersubscribed in M ∗, as proved in Lemma 9. Since pj is offered by lk, and pj is undersubscribed in M , it follows from the proof of [24, Lemma 5] that pj is undersubscribed in M ∗. Further, by the hypothesis of the lemma, either si is unassigned in M , or si prefers pj to M (si) or is indifferent between them, where M (si) is not offered by lk. By Lemma 4, this is true for si in M ∗. Hence (si, pj) blocks M ∗, a contradiction. ⊓⊔ 24 The next lemma shows that the feasible matching M may be used to determine the existence, or otherwise, of a strongly stable matching in I. Lemma 13. Let M be a feasible matching in the final provisional assignment graph G. If M is not strongly stable then there is no strongly stable matching for the instance. Proof. Suppose that M is not strongly stable. Let (si, pj) be a blocking pair for M , and let lk be the lecturer who offers pj. We consider two cases. 1. Suppose si is unassigned in M or prefers pj to M (si). Then (si, pj) has been deleted. Suppose (si, pj) was deleted as a result of pj being full or oversubscribed in line 8. Then pj is replete. Suppose firstly that pj ends up full in M , then (si, pj) cannot block M irrespective of whether lk is undersubscribed or full in M , since lk prefers the worst assigned student/s in M (pj) to si. Thus pj is not full in M . As pj was previously full, each pair (st, pu), for each st that is no better than si at the tail of Lk and each pu ∈ Pk ∩ At, would have been deleted in line 29. Thus if lk is full in M , then (si, pj) does not block M . Now suppose lk is undersubscribed in M . If lk was full at some point during the algorithm's execution, then no strongly stable matching exists, by Lemma 10. Thus lk was never full during the algorithm's execution. This implies that lk is non-replete. To recap, we have that pj is a replete project that is not full in M , which is offered by a non-replete lecturer. Moreover, since (si, pj) has been deleted, no strongly stable matching exists, by Lemma 12. Thus (si, pj) was not deleted because pj became replete in line 8. Now, suppose (si, pj) was deleted as a result of lk being full or oversubscribed in line 11. Then (si, pj) could only block M if lk ends up undersubscribed in M . If this is the case, then no strongly stable matching exists for the instance, by Lemma 10. Next, suppose (si, pj) was deleted because pj was a neighbour of some student si′ ∈ Z at a point when si was in the tail of Lj k. Denote by Z ′ the set of students in Z who are provisionally assigned to pj in Gr. Suppose pj is non-replete, it follows that 0 < Z ′ ≤ q∗ j . Let Z ′′ = Z \ Z ′. Then N (Z ′′) ⊆ N (Z) \ {pj}, so that X pj′ ∈N (Z ′′) Hence j ′ ≤  q∗  X pj′ ∈N (Z) q∗ j ′   − q∗ j . δ(Z ′′) = Z ′′ − X pj′ ∈N (Z ′′) q∗ j ′ = Z − Z ′ − X pj′ ∈N (Z ′′) q∗ j ′ ≥ Z − Z ′ −   X pj′ ∈N (Z) q∗ j ′   + q∗ j = Z + q∗ j − Z ′ − X pj′ ∈N (Z) q∗ j ′ ≥ Z − X pj′ ∈N (Z) q∗ j ′ = δ(Z) 25 If δ(Z ′′) > δ(Z), then we reach a contradiction to the fact Z is maximally deficient; hence δ(Z ′′) = δ(Z). Moreover, Z ′′ ⊂ Z, contradicting the minimality of Z. Now, suppose pj is replete. The argument that no strongly stable matchings exists follows from the first paragraph. Next, suppose (si, pj) was deleted (at line 29) because some other project pj ′ offered by lk is replete and subsequently becomes undersubscribed at line 23. Then lk must have identified her most preferred student, say sr, rejected from pj ′ such that si is at the tail of Lk and si is no better than sr in Lk. Moreover, every project offered by lk that si finds acceptable would have been deleted from si's preference list at the for loop iteration in line 29. Thus if pj ends up full in M , then (si, pj) does not block M . Suppose pj ends up undersubscribed in M . If lk is full in M , then (si, pj) does not block M , since si /∈ M (lk) and lk prefers the worst student/s in M (lk) to si. Suppose lk is undersubscribed in M . Again, if lk is replete, then no strongly stable matching exists, by Lemma 10. Thus lk is non-replete. Since (si, pj) has been deleted, no strongly stable matching exists, by Lemma 12. 2. Suppose si is indifferent between pj and M (si). First, suppose pj is undersubscribed in M . By the strong stability definition, M (si) is not offered by lk. Suppose lk is undersubscribed in M . If lk is replete, then by Lemma 10, no strongly stable matching exists. Hence lk is non-replete. First suppose (si, pj) ∈ G, since si /∈ M (lk), this implies that lk has fewer assignees in M than provisional assignees in G. Thus no strongly stable matching exists by Lemma 10. Now suppose (si, pj) /∈ G. Then (si, pj) has been deleted. If pj is replete, then no strongly stable matching exists by Lemma 12. Hence pj is non-replete. To recap, (si, pj) has been deleted, and each of pj and lk is non-replete. There are two points in this algorithm where this deletion could have happened; (i) if pj was a neighbour of some student si′ ∈ Z at a point when si was in the tail of Lj k, or (ii) at line 29 -- because some other project pj ′ offered by lk is replete and subsequently becomes undersubscribed at line 23. In any of the cases, the argument that no strongly stable matching exists follows from (1) above. Finally, suppose pj is full in M . Then (si, pj) cannot block M irrespective of whether lk is full or undersubscribed in M , since the worst student/s in M (pj) are either better or no worse than si, according to Lj k. Since (si, pj) is an arbitrary pair, this implies that M admits no blocking pair. Hence I ⊓⊔ admits no strongly stable matching. Lemma 14. Algorithm SPA-ST-strong may be implemented to run in O(m2) time, where m is the total length of the students' preference lists. Proof. It is clear that the work done in the inner repeat-until loop other than in finding the maximum cardinality matchings and critical sets is bounded by a constant times the number of deleted pairs, and so is O(m) (where m is the total length of the students' preference lists). We remark that the total amount of work done outside the inner repeat-until loop (i.e., in deleting pairs when a replete project ends up undersubscribed in line 23) is bounded by the total length of the students' preference lists, and so is O(m). During each iteration of the inner repeat-until loop of Algorithm SPA-ST-strong, we need to form the reduced assignment graph Gr, which takes O(m) time. Further, we need to search for a maximum matching in Gr, which allows us to use Lemma 3 to find the critical set. Next we show how we can bound the total amount of work done in finding the maximum matchings. Suppose that Algorithm SPA-ST-strong finds a maximum matching M (i) in the reduced assignment graph G(i) r at the ith iteration of the inner repeat-until loop. Suppose also that, during the ith iteration in this loop, xi pairs are deleted because they involve students in the r 26 r r r critical set Z (i), or students tied with them in the tail of a project in N (Z (i)). Suppose further that in the (i + 1)th iteration, yi pairs are deleted before the reduced assignment graph G(i+1) is formed. Note that any edge in G(i) r which is not one of these xi + yi deleted pairs must be in G(i+1) , since an edge in the provisional assignment graph cannot change state from unbound to bound. In particular, at least M (i) at the (i + 1)th iteration. Hence we can start from these edges in that iteration and find a maximum matching M (i+1) which were not in G(i) r . in O(min{nm, (xi + yi + zi)m}) time, where zi is the number of edges in G(i+1) remain in G(i+1) r − xi − yi edges of M (i) r r r Suppose that a total of s iterations of the inner repeat-until loop are carried out, and that in t of these, min{nm, (xi + yi + zi)m}) = nm. Then the time complexity of maximum matching operations, taken over the entire execution of the algorithm, is O(min{n,P cj}m + tnm + mP(xi + yi + zi)) where the first term is for the maximum matching computation in the first iteration, and the sum in the third term is over the appropriate s − t − 1 values of i. We note that Ps i=1(xi + yi + zi) ≤ 2m (since each of the total number of deletions and provisional assignments is bounded by the total length of the students' preference lists), and since xi + yi + zi ≥ n for the appropriate t values of i, it follows that tnm + mX(xi + yi + zi) ≤ m s X i=1 (xi + yi + zi) ≤ 2m2. Thus mX(xi + yi + zi) ≤ 2m2 − tnm. At the termination of the outer repeat-until loop, a feasible matching is constructed by taking the final maximum matching and combining it with the bound (student, project) pairs in the final provisional assignment graph. This operation is clearly bounded by the number of bound pairs, hence is O(m). It follows that the overall complexity of Algorithm SPA-ST-strong is O(m + min{n,P cj}m +2m2) = O(m2). We remark that the problem of finding a maximum matching in Gr is also called the Upper Degree Constrained Subgraph problem (UDCS) [8]. An instance of Gr can be viewed as an instance of UDCS, except that students have no explicit preferences in the UDCS case. Using Gabow's UDCS j ). However, it is not clear how this algorithm can be used to improve the overall running time of Algorithm ⊓⊔ SPA-ST-strong. algorithm [8], we can find a maximum matching in Gr in time O(ErqP q∗ The following theorem collects together Lemmas 4-14 and establishes the correctness of Algorithm SPA-ST-strong. Theorem 1. For a given instance I of spa-st, Algorithm SPA-ST-strong determines in O(m2) time whether or not a strongly stable matching exists in I. If such a matching does exist, all pos- sible executions of the algorithm find one in which each assigned student is assigned at least as good a project as she could obtain in any strongly stable matching, and each unassigned student is unassigned in every strongly stable matchings. Given the optimality property established by Theorem 1, we define the strongly stable matching found by Algorithm SPA-ST-strong to be student-optimal. For example, in the spa- st instance illustrated in Fig. 3 (Page 13), the student-optimal strongly stable matching is M = {(s1, p6), (s2, p2), (s4, p5), (s5, p3), (s6, p4), (s7, p1), (s8, p1)}. 27 5 Conclusion We leave open the formulation of a lecturer-oriented counterpart to Algorithm SPA-ST-strong. From an experimental perspective, an interesting direction would be to carry out an empirical analysis of Algorithm SPA-ST-strong, to investigate how various parameters (e.g., the density and position of ties in the preference lists, the length of the preference lists, or the popularity of some projects) affect the existence of a strongly stable matching, based on randomly generated and/or real instances of spa-st. Acknowledgement The authors would like to convey their sincere gratitude to Adam Kunysz for valuable discussions and helpful suggestions concerning Algorithm SPA-ST-strong. They would also like to thank anonymous reviewers for their helpful suggestions. References 1. 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. 2. A.H. Abu El-Atta and M.I. Moussa. Student project allocation with preference lists over (stu- dent,project) pairs. In Proceedings of ICCEE 09, pp. 375 -- 379, 2009. 3. M. Baidas, Z. Bahbahani, E. Alsusa. User association and channel assignment in downlink multi-cell NOMA networks: A matching-theoretic approach. EURASIP Journal on Wireless Communications and Networking, 2019:220, 2019. 4. M. Baidas, M. Bahbahani, E. Alsusa, K. Hamdi and Z. Ding. D2D Group Association and Channel Assignment in Uplink Multi-Cell NOMA Networks: A Matching Theoretic Approach. To appear in IEEE Transactions on Communications, 2019. 5. M. Baidas, Z. Bahbahani, N. El-Sharkawi, H. Shehada and E. Alsusa. Joint relay selection and max- min energy-efficient power allocation in downlink multicell NOMA networks: A matching-theoretic approach. Transactions on Emerging Telecommunications Technologies, 30:5, 2019. 6. M. Chiarandini, R. Fagerberg, and S. Gualandi. Handling preferences in student-project allocation. Annals of Operations Research, 275(1):39 -- 78, 2019. 7. Frances Cooper and David Manlove. A 3/2-Approximation Algorithm for the Student-Project Allocation Problem. In Proceedings of SEA '18, volume 103 of Leibniz International Proceedings in Informatics (LIPIcs), pages 8:1 -- 8:13, 2018. 8. H.N. Gabow. An efficient reduction technique for degree-constrained subgraph and bidirected network flow problems. In Proceedings of STOC '83, pages 448 -- 456. ACM, 1983. 9. R.W. Irving. Stable marriage and indifference. Discrete Applied Mathematics, 48:261 -- 272, 1994. 10. R.W. Irving, D.F. Manlove, and S. Scott. The Hospitals/Residents problem with Ties. In Proceedings of SWAT '00, vol. 1851 of LNCS, pp. 259 -- 271, 2000. 11. R. Irving, D. Manlove, and S. Scott. Strong stability in the Hospitals/Residents problem. In Proceedings of STACS '03, vol. 2607 of LNCS, pp. 439 -- 450, 2003. 12. K. Iwama, D. Manlove, S. Miyazaki, and Y. Morita. Stable marriage with incomplete lists and ties. In Proceedings of ICALP '99, vol. 1644 of LNCS, pp. 443 -- 452, 1999. 13. 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. 14. T. Kavitha, K. Mehlhorn, D. Michail, and K. Paluch. Strongly stable matchings in time O(nm) and extension to the Hospitals-Residents problem. In Proceedings of STACS '04, volume 2996 of LNCS, pages 222 -- 233. Springer, 2004. Co-ordination Manuscript, University from http://www-users.cs.york.ac.uk/kazakov/papers/proj.pdf (last accessed 26 June 2019), 2001. student-project of Computer allocation. Science. 15. D. Kazakov. Available of York, Department of 28 16. A. Kwanashie, R.W. Irving, D.F. Manlove, and C.T.S. Sng. Profile-based optimal matchings in the Student -- Project Allocation problem. In Proceedings of IWOCA '14, volume 8986 of LNCS, pages 213 -- 225. Springer, 2015. 17. A. Kunysz. An Algorithm for the Maximum Weight Strongly Stable Matching Problem. In Pro- ceedings of ISAAC '18, vol. 123 of LIPIcs, pages 42:1 -- 42:13, 2018. 18. C.L. Liu. Introduction to Combinatorial Mathematics. McGraw-Hill, NY, 1968. 19. D. Manlove. Stable marriage with ties and unacceptable partners. Technical Report TR-1999-29, University of Glasgow, Department of Computing Science, Jan 1999. 20. D. Manlove. Algorithmics of Matching Under Preferences. World Scientific, 2013. 21. D. Manlove, R.W. Irving, K. Iwama, S. Miyazaki, and Y. Morita. Hard variants of stable marriage. Theoretical Computer Science, 276(1-2):261 -- 279, 2002. 22. D. Manlove, D. Milne, and S. Olaosebikan. An Integer Programming Approach to the Student- Project Allocation Problem with Preferences over Projects. In Proceedings of ISCO '18, volume 10856 of LNCS, pp. 313 -- 325. Springer, 2018. 23. D. Manlove and G. O'Malley. Student project allocation with preferences over projects. Journal of Discrete Algorithms, 6:553 -- 560, 2008. 24. S. Olaosebikan and D. Manlove. Super-Stability in the Student-Project Allocation Problem with Ties. In Proceedings of COCOA '18, volume 11346 of Lecture Notes in Computer Science, pages 357 -- 371. Springer, 2018. 25. A.E. Roth. The evolution of the labor market for medical interns and residents: a case study in game theory. Journal of Political Economy, 92(6):991 -- 1016, 1984.
1608.07022
1
1608
2016-08-25T06:16:32
Kernelization and Parameterized Algorithms for 3-Path Vertex Cover
[ "cs.DS" ]
A 3-path vertex cover in a graph is a vertex subset $C$ such that every path of three vertices contains at least one vertex from $C$. The parameterized 3-path vertex cover problem asks whether a graph has a 3-path vertex cover of size at most $k$. In this paper, we give a kernel of $5k$ vertices and an $O^*(1.7485^k)$-time and polynomial-space algorithm for this problem, both new results improve previous known bounds.
cs.DS
cs
Kernelization and Parameterized Algorithms for 3-Path Vertex Cover ⋆ Mingyu Xiao and Shaowei Kou University of Electronic Science and Technology of China, Chengdu 611731, China School of Computer Science and Engineering, [email protected], kou [email protected] Abstract. A 3-path vertex cover in a graph is a vertex subset C such that every path of three vertices contains at least one vertex from C. The parameterized 3-path vertex cover problem asks whether a graph has a 3-path vertex cover of size at most k. In this paper, we give a kernel of 5k vertices and an O∗(1.7485k)-time polynomial-space algorithm for this problem, both new results improve previous known bounds. 1 Introduction A vertex subset C in a graph is called an ℓ-path vertex cover if every path of ℓ vertices in the graph contains at least one vertex from C. The ℓ-path vertex cover problem, to find an ℓ-path vertex cover of minimum size, has been studied in the literature [5,6]. When ℓ = 2, this problem becomes the famous vertex cover problem and it has been well studied. In this paper we study the 3-path vertex cover problem. A 3-path vertex cover is also known as a 1-degree-bounded deletion set. The d-degree-bounded deletion problem [11,25,26] is to delete a minimum number of vertices from a graph such that the remaining graph has degree at most d. The 3-path vertex cover problem is exactly the 1-degree- bounded deletion problem. Several applications of 3-path vertex covers have been proposed in [6,16,27]. It is not hard to establish the NP-hardness of the 3-path vertex cover problem by reduction from the vertex cover problem. In fact, it remains NP-hard even in planar graphs [28] and in C4-free bipartite graphs with vertex degree at most 3 [4]. There are several graph classes, in which the problem can be solved in polynomial time [2,3,4,6,7,14,15,18,19,20]. The 3-path vertex cover problem has been studied from approximation algo- rithms, exact algorithms and parameterized algorithms. There is a randomized approximation algorithm with an expected approximation ratio of 23 11 [16]. In terms of exact algorithms, Kardos et al. [16] gave an O∗(1.5171n)-time algo- rithm to compute a maximum dissociation set in an n-vertex graph. Chang et al. [8] gave an O∗(1.4658n)-time algorithm and the result was further improved to O∗(1.3659n) later [27]. ⋆ This is the version accepted by TAMC 2016. To appear in: TAMC 2016, LNCS 9796, pp. 1 -- 15, 2016. 2 In parameterized complexity, this problem is fixed-parameter tractable by taking the size k of the 3-path vertex cover as the parameter. The running time bound of parameterized algorithm for this problem has been improved at least three times during the last one year. Tu [22] showed that the problem can be solved in O∗(2k) time. Wu [24] improved the result to O∗(1.882k) by using the measure-and-conquer method. The current best result is O∗(1.8172k) by Katrenic [17]. In this paper we will further improve the bound to O∗(1.7485k). Another important issue in parameterized complexity is kernelization. A ker- nelization algorithm is a polynomial-time algorithm which, for an input graph with a parameter (G, k) either concludes that G has no 3-path vertex cover of size k or returns an equivalent instance (G′, k′), called a kernel, such that k′ ≤ k and the size of G′ is bounded by a function of k. Kernelization for the d-degree- bounded deletion problem has been studied in the literature [11,25]. For d = 1, Fellows et al.'s algorithm [11] implies a kernel of 15k vertices for the 3-path vertex cover problem, and Xiao's algorithm [25] implies a kernel of 13k vertices. There is another closed related problem, called the 3-path packing problem. In this problem, we are going to check if a graph has a set of at least k vertex-disjoint 3-paths. When we discuss kernelization algorithms, most structural properties of the 3-path vertex cover problem and the 3-path packing problem are similar. Several previous kernelization algorithms for the 3-path packing problem are possible to be modified for the 3-path vertex cover problem. The bound of the kernel size of the 3-path packing problem has been improved for several times from the first bound of 15k [21] to 7k [23] and then to 6k [10]. Recently, there is a paper claiming a bound of 5k vertices for the 3-path packing problem in net-free graphs [9]. Although the paper [9] provides some useful ideas, the proof in it is incomplete and the algorithm may not stop. Several techniques for the 3-path packing problem in [23] and [9] will be used in our kernelization algorithm. We will give a kernel of 5k vertices for the 3-path vertex cover problem. Omitted proofs in this extended abstract can be found in the full version of this paper. 2 Preliminaries We let G = (V, E) denote a simple and undirected graph with n = V vertices and m = E edges. A singleton {v} may be simply denoted by v. The vertex set and edge set of a graph G′ are denoted by V (G′) and E(G′), respectively. For a subgraph (resp., a vertex subset) X, the subgraph induced by V (X) (resp., X) is simply denoted by G[X], and G[V \ V (X)] (resp., G[V \ X]) is also written as G \ X. A vertex in a subgraph or a vertex subset X is also called a X-vertex. For a vertex subset X, let N (X) denote the set of open neighbors of X, i.e., the vertices in V \ X adjacent to some vertex in X, and N [X] denote the set of closed neighbors of X, ie., N (X) ∪ X. The degree of a vertex v in a graph G, denoted by d(v), is defined to be the number of vertices adjacent to v in G. Two vertex-disjoint subgraphs X1 and X2 are adjacent if there is an edge with one endpoint in X1 and the other in X2. The number of connected components in 3 a graph G is denoted by Comp(G) and the number of connected components of size i in a graph G is denoted by Compi(G). thus, Comp(G) = Pi Compi(G). A 3-path, denoted by P3, is a simple path with three vertices and two edges. A vertex subset C is called a 3-path vertex cover or a P3V C-set if there is no 3-path in G \ C. Given a graph G = (V, E), a P3-packing P = {L1, L2, ..., Lt} of size t is a collection of vertex-disjoint P3 in G, i.e., each element Li ∈ P is a 3-path in G and V (Li1 ) ∩ V (Li2 ) = ∅ for any two different 3-paths Lii, Li2 ∈ P. A P3-packing is maximal if it is not properly contained in any strictly larger P3-packing in G. The set of vertices in 3-paths in P is denoted by V (P). Let P be a P3-packing and A be a vertex set such that A ∩ V (P) = ∅ and A induces a graph of maximum degree 1. We use Ai to denote the set of degree-i vertices in the induced graph G[A] for i = 0, 1. A component of two vertices in G[A] is called an A1-edge. For each Li ∈ P, we use A(Li) to denote the set of A-vertices that are in the components of G[A] adjacent to Li. For a 3-path Li ∈ P, the degree-2 vertex in it is called the middle vertex of it and the two degree-1 vertices in it are call the ending vertices of it. 3 A Parameterized Algorithm In this section we will design a parameterized algorithm for the 3-path ver- tex cover problem. Our algorithm is a branch-and-reduce algorithm that runs in O∗(1.7485k) time and polynomial space, improving all previous results. In branch-and-reduce algorithms, the exponential part of the running time is de- termined by the branching operations in the algorithm. In a branching operation, the algorithm solves the current instance I by solving several smaller instances. We will use the parameter k as the measure of the instance and use T (k) to denote the maximum size of the search tree generated by the algorithm running on any instance with parameter at most k. A branching operation, which gener- ates l small branches with measure decrease in the i-th branch being at least ci, creates a recurrence relation T (k) ≤ T (k−c1)+T (k−c2)+···+T (k−cl)+1. The largest root of the function f (x) = 1 − Pl i=1 x−ci is called the branching factor of the recurrence. Let γ be the maximum branching factor among all branch- ing factors in the algorithm. The running time of the algorithm is bounded by O∗(γk). More details about the analysis and how to solve recurrences can be found in the monograph [13]. Next, we first introduce our branching rules and then present our algorithm. 3.1 Branching Rules We have four branching rules. The first branching rule is simple and easy to observe. Branching rule (B1): Branch on a vertex v to generate N [v] + 1 branches by either (i) deleting v from the graph, including it to the solution set, and decreasing k by 1, or 4 (ii) deleting N [v] from the graph, including N (v) to the solution set, and de- creasing k by N (v), or (iii) for each neighbor u of v, deleting N [{u, v}] from the graph, including N ({u, v}) to the solution set, and decreasing k by N ({u, v}). A vertex v is dominated by a neighbor u of it if v is adjacent to all neighbors of u. The following property of dominated vertices has been proved and used in [27]. Lemma 1. Let v be a vertex dominated by u. If there is a minimum 3-path vertex cover C not containing v, then there is a minimum 3-path vertex cover C′ of G such that v, u /∈ C′ and N ({u, v}) ⊆ C′. Based on this lemma, we design the following branching rule. Branching rule (B2): Branch on a vertex v dominated by another vertex u to generate two instances by either (i) deleting v from the graph, including it to the solution set, and decreasing k by 1, or (ii) deleting N [{u, v}] from the graph, including N ({u, v}) to the solution set, and decreasing k by N ({u, v}) = N (v) − 1. For a vertex v, a vertex s ∈ N2(v) is called a satellite of v if there is a neighbor p of v such that N [p] − N [v] = {s}. The vertex p is also called the parent of the satellite s at v. Lemma 2. Let v be a vertex that is not dominated by any other vertex. If v has a satellite, then there is a minimum 3-path vertex cover C such that either v ∈ C or v, u 6∈ C for a neighbor u of v. Branching rule (B3): Let v be a vertex that has a satellite but is not dominated by any other vertex. Branch on v to generate N [v] instances by either (i) deleting v from the graph, including it to the solution set, and decreasing k by 1, or (ii) for each neighbor u of v, deleting N [{u, v}] from the graph, including N ({u, v}) to the solution set, and decreasing k by N ({u, v}). Lemma 3. Let v be a degree-3 vertex with a degree-1 neighbor u1 and two adja- cent neighbors u2 and u3. There is a minimum 3-path vertex cover C such that either C ∪ {u1, v} = ∅ or C ∪ {u1, u2, u3} = ∅. Branching rule (B4): Let v be a degree-3 vertex with a degree-1 neighbor u1 and two adjacent neighbors u2 and u3. Branch on v to generate two instances by either (i) deleting N [{u1, v}] from the graph, including {u2, u3} to the solution set, and decreasing k by 2, or (ii) deleting N [{u2, u3}] ∪ {u1} from the graph, including N ({u2, u3}) to the solution set, and decreasing k by N ({u2, u3}). 5 3.2 The Algorithm We will use P3VC(G, k) to denote our parameterized algorithm. The algorithm contains 7 steps. When we execute one step, we assume that all previous steps are not applicable anymore on the current graph. We will analyze each step after describing it. Step 1 (Trivial cases) If k ≤ 0 or the graph is an empty graph, then return the result directly. If the graph has a component of maximum degree 2, find a minimum 3-path vertex cover S of it directly, delete this component from the graph, and decrease k by the size of S. After Step 1, each component of the graph contains at least four vertices. A degree-1 vertex v is called a tail if its neighbor u is a degree-2 vertex. Let v be a tail, u be the degree-2 neighbor of v, and w be the other neighbor of u. We show that there is a minimum 3-path vertex cover containing w but not containing any of u and v. At most one of u and v is contained in any minimum 3-path vertex cover C, otherwise C ∪ {w} \ {u, v} would be a smaller 3-path vertex cover. If none of u and v is in a minimum 3-path vertex cover C, then w must be in C to cover the 3-path uvw and then C is a claimed minimum 3-path vertex cover. If exactly one of u and v is contained in a minimum 3-path vertex cover C, then C′ = C ∪ {w} \ {u, v} is a claimed minimum 3-path vertex cover. Step 2 (Tails) If there is a degree-1 vertex v with a degree-2 neighbor u, then return p3vc(G \ N [{v, u}], k − 1). Step 3 (Dominated vertices of degree ≥ 3) If there is a vertex v of de- gree ≥ 3 dominated by u, then branch on v with Rule (B2) to generate two branches p3vc(G \ {v}, k − 1) and p3vc(G \ N [{v, u}], k − N ({v, u})). Lemma 1 guarantees the correctness of this step. Note that N ({v, u}) = d(v)−1. This step gives a recurrence T (k) ≤ T (k − 1) + T (k − (d(v) − 1)) + 1, (1) where d(v) ≥ 3. For the worst case that d(v) = 3, the branching factor of it is 1.6181. A degree-1 vertex with a degree-1 neighbor will be handled in Step 1, a degree- 1 vertex with a degree-2 neighbor will be handled in Step 2, and a degree-1 vertex with a neighbor of degree ≥ 3 will be handled in Step 3. So after Step 3, the graph has no vertex of degree ≤ 1. Next we consider degree≥ 4 vertices. Step 4 (Vertices of degree ≥ 4 with satellites) If there is a vertex v of d(v) ≥ 4 having a satellite, then branch on v with Rule (B3) to generate d(v) + 1 branches p3vc(G\{v}, k−1) and p3vc(G\N [{v, u}], k−N ({v, u})) for each u ∈ N (v). 6 The correctness of this step is guaranteed by lemma 2. Note that there is no dominated vertex after Step 3. Each neighbor u of v is adjacent to at least one vertex in N2(v) and then N ({v, u}) ≥ d(v). This step gives a recurrence T (k) ≤ T (k − 1) + d(v) · T (k − d(v)) + 1, (2) where d(v) ≥ 4. For the worst case that d(v) = 4, the branching factor of it is 1.7485. After Step 4, if there is still a vertex of degree ≥ 4, we use the following branching rule. Note that now each neighbor u of v is adjacent to at least two vertices in N2(v) and then N ({v, u}) ≥ d(v) + 1. Step 5 (Normal vertices of degree ≥ 4 ) If there is a vertex v of d(v) ≥ 4, then branch on v with Rule (B1) to generate d(v) + 2 branches p3vc(G \ {v}, k − 1), p3vc(G \ N [v], k − N (v)) and p3vc(G \ N [{v, u}], k − N ({v, u})) for each u ∈ N (v). Since N ({v, u}) ≥ d(v) + 1, this step gives a recurrence T (k) ≤ T (k − 1) + T (k − d(v)) + d(v) · T (k − (d(v) + 1)) + 1, (3) which d(v) ≥ 4. For the worst case that d(v) = 4, the branching factor of it is 1.6930. After Step 5, the graph has only degree-2 and degree-3 vertices. We first consider degree-2 vertices. A path u0u1u2u3 of four vertices is called a chain if the first vertex u0 is of degree ≥ 3 and the two middle vertices are of degree 2. Note that there is no chain with u0 = u3 after Step 3. So when we discuss a chain we always assume that u0 6= u3. A chain can be found in linear time if it exists. In a chain u0u1u2u3, u2 is a satellite of u0 with a parent u1. Step 6 (Chains) If there is a chain u0u1u2u3, then branch on u0 with Rule (B3). In the branch where u0 is deleted and included to the solution set, u1 becomes a tail and we further handle the tail as we do in Step 2. We get the following branches p3vc(G \ N [{u1, u2}], k − 2) and p3vc(G \ N [{u0, u}], k − N ({u0, u})) for each u ∈ N (u0). Note that N ({u0, u}) ≥ d(u0) since there is no dominated vertex. We get a recurrence T (k) ≤ T (k − 2) + d(u0) · T (k − d(u0)) + 1, where d(u0) ≥ 3. For the worst case that d(u0) = 3, the branching factor of it is 1.6717. After Step 6, each degree-2 vertex must have two nonadjacent degree-3 ver- tices. Note that no degree-2 is in a triangle if there is no dominated vertex. Step 7 (Degree-2 vertices with a neighbor in a triangle) If there is a degree-2 vertex v with N (v) = {u, w} such that a neighbor u of it is in a triangle uu1u2, then branch on w with Rule (B1) and then in the branch w is deleted and included in the solution set further branch on u with Rule (B4). We get the following branches 7 p3vc(G \ N [{u, v}], k − N ({u, v})), p3vc(G \ N [{u1, u2}] ∪ {u, w}, k − N ({u1, u2}) ∪ {w}), and p3vc(G \ N [{w, u′}], k − N ({w, u′})) for each u′ ∈ N (w). There two neighbors u and w of v are degree-3 vertices. Since there is no dominated vertex, for any edge v1v2 it holds N ({v1, v2}) ≥ min{d(v1), d(v2)}. We know that N ({u, v}) ≥ d(u) = 3, N ({u1, u2}) ∪ {w} ≥ N ({u1, u2}) ≥ 3 (since no degree-2 vertex is in a triangle) and N ({w, u′}) ≥ d(w) for each u′ ∈ N (w). We get the following recurrence T (k) ≤ T (k − 3) + T (k − 3) + 3 · T (k − 3) + 1. The branching factor of it is 1.7100. After Step 7, no degree-3 vertex in a triangle is adjacent to a degree-2 vertex. Step 8 (Degree-2 vertices v with a degree-3 vertex in N2(v)) If there is a degree-2 vertex v such that at least one of its neighbors u and w, say u, has a degree-3 neighbor u1, then branch on u with Rule (B1) and in the branch where u is deleted and included to the solution set, branch on w with Rule (B2). We get the branches p3vc(G \ {u, v, w}, k − 2), p3vc(G \ N [{w, v}], k − N ({w, v})), and p3vc(G \ N [{u, u′}], k − N ({u, u′})) for each u′ ∈ N (u). Note that d(u) = d(w) = 3. It holds N ({w, v}) ≥ d(w) = 3 and N ({u, u′}) ≥ d(u) = 3 for u′ ∈ N (u). Furthermore, we have that N ({u, u1}) ≥ 4 because u and u1 are degree-3 vertices not in any triangle. We get the following recurrence T (k) ≤ T (k − 2) + T (k − 3) + 2 · T (k − 3) + T (k − 4). The branching factor of it is 1.7456. Lemma 4. After Step 8, if the graph is not an empty graph, then each compo- nent of the graph is either a 3-regular graph or a bipartite graph with one side of degree-2 vertices and one side of degree-3 vertices. Lemma 5. Let G = (V1 ∪ V2, E) be a bipartite graph such that all vertices in V1 are of degree 2 and all vertices in V2 are of degree 3. The set V1 is a minimum 3-path vertex cover of G. Step 9 (Bipartite graphs) If the graph has a component H being a bi- partite graph with one side V1 of degree-2 vertices and one side V2 of degree-3 vertices, then return p3vc(G \ H, k − V1). 8 Step 10 (3-regular graphs) If the graph is a 3-regular graph, pick up an arbitrary vertex v and branch on it with Rule (B1). Lemma 4 shows that the above steps cover all the cases, which implies the cor- rectness of the algorithm. Note that all the branching operations except Step 10 in the algorithm have a branching factor at most 1.7485. We do not analyze the branching factor for Step 10, because this step will not exponentially in- crease the running time bound of our algorithm. Any proper subgraph of a connected 3-regular graph is not a 3-regular graph. For each connected compo- nent of a 3-regular graph, Step 10 can be applied for at most one time and all other branching operations have a branching factor at most 1.7485. Thus each connected component of a 3-regular graph can be solved in O∗(1.7485k) time. Before getting a connected component of a 3-regular graph, the algorithm always branches with branching factors of at most 1.7485. Therefore, Theorem 1. The 3-path vertex cover problem can be solved in O∗(1.7485k) time and polynomial space. 4 Kernelization In this section, we show that the parameterized 3-path vertex cover problem allows a kernel with at most 5k vertices. 4.1 Graph decompositions The kernelization algorithm is based on a vertex decomposition of the graph, called good decomposition, which can be regarded as an extension of the crown decomposition [1]. Based on a good decomposition we show that an optimal solution to a special local part of the graph is contained in an optimal solution to the whole graph. Thus, once we find a good decomposition, we may be able to reduce the graph by adding some vertices to the solution set directly. We only need to find good decompositions in polynomial time in graphs with a large size to get problem kernels. Some previous rules to kernels for the parameterized 3-path packing problem [10,12,23] are adopted here to find good decompositions in an effective way. Definition 1. A good decomposition of a graph G = (V, E) is a decomposition (I, C, R) of the vertex set V such that 1. the induced subgraph G[I] has maximum degree at most 1; 2. the induced subgraph G[I ∪ C] has a P3-packing of size C; 3. no vertex in I is adjacent to a vertex in R. Lemma 6. A graph G that admits a good decomposition (I, C, R) has a P3- vertex cover (resp., P3-packing) of size k if and only if G[R] has a P3-vertex cover (resp., P3-packing) of size k − C. 9 Lemma 6 provides a way to reduce instances of the parameterized 3-path vertex cover problem based on a good decomposition (I, C, R) of the graph: deleting I ∪ C from the graph and adding C to the solution set. Here arise a question: how to effectively find good decompositions? It is strongly related to the quality of our kernelization algorithm. The kernel size will be smaller if we can polynomially compute a good decomposition in a smaller graph. Recall that we use Comp(G′) and Compi(G′) to denote the number of components and number of components with i vertices in a graph G′, respectively. For a vertex subset A that induces a graph of maximum degree at most 1 and j = {1, 2}, we use Nj(A) ⊆ N (A) to denote the set of vertices in N (A) adjacent to at least one component of size j in G[A], and N ′ 2(A) ⊆ N2(A) be the set of vertices in N (A) adjacent to at least one component of size 2 but no component of size 1 in G[A]. We will use the following lemma to find good decompositions, which was also used in [9] to design kernel algorithms for the 3-path packing problem. Lemma 7. Let A be a vertex subset of a graph G such that each connected component of the induced graph G[A] has at most 2 vertices. If Comp(G[A]) > 2N (A) − N ′ 2(A), (4) then there is a good decomposition (I, C, R) of G such that ∅ 6= I ⊆ A and C ⊆ N (A). Furthermore, the good decomposition (I, C, R) together with a P3- packing of size C in G[I ∪ C] can be computed in O(√nm) time. By using Lemma 7, we can get a linear kernel for the parameterized 3-path vertex cover problem quickly. We find an arbitrary maximal P3-packing S and let A = V \ V (S). We assume that S contains less than k 3-paths and then V (S) < 3k, otherwise the problem is solved directly. Note that N (A) ⊆ V (S). If A > 12k, then Comp(G[A]) ≥ A 2 > 6k > 2V (S) ≥ 2N (A) and we reduce the instance by Lemma 7. So we can get a kernel of 15k vertices. This bound can be improved by using a special case of Lemma 7. For a vertex subset A such that G[A] has maximum degree at most 1. Let A0 be the set of degree-1 vertices in G[A]. Note that Comp(G[A0]) = Comp2(G[A]) and N (A0) = N2(A0) = N2(A). By applying Lemma 7 on A0, we can get Corollary 1 Let A be a vertex subset of a graph G such that each connected component of the induced graph G[A] has at most 2 vertices. Let N2(A) ⊆ N (A) be the set of vertices in N (A) adjacent to at least one vertex in a component of size 2 in G[A]. If Comp2(G[A]) > N2(A), (5) then there is a good decomposition (I, C, R) of G such that ∅ 6= I ⊆ A and C ⊆ N (A). Furthermore, the good decomposition (I, C, R) together with a P3- packing of size C in G[I ∪ C] can be computed in O(√nm) time. Note that A = Comp1(G[A])+2·Comp2(G[A]). If A > 9k, then Comp1(G[A])+ 2 · Comp2(G[A]) = A > 9k > 3V (S) ≥ 3N (A) ≥ (2N (A) − N ′ 2(A)) + 10 N2(A) and at least one of (4) and (5) holds. Then by using Lemma 7 and Corollary 1, we can get a kernel of size 9k + 3k = 12k. It is possible to bound N (A) by k and then to get a kernel of size 3k + 3k = 6k. To further improve the kernel size to 5k, we need some sophisticated techniques and deep analyses on the graph structure. 4.2 A 5k kernel In this section, we use "crucial partitions" to find good partitions. A vertex partition (A, B, Z) of a graph is called a crucial partition if it satisfies Basic Conditions and Extended Conditions. Basic Conditions include the following four items: (B1) A induces a graph of degree at most 1; (B2) B is the vertex set of a P3-packing P; (B3) No vertex in A is adjacent to a vertex in Z; (B4) Z ≤ 5 · γ(G[Z]), where γ(G[Z]) is the size of a minimum P3V C-set in the induced subgraph G[Z]. Before presenting the definition of Extended Conditions, we give some used definitions. We use Pj to denote the collection of 3-paths in P having j vertices adjacent to A-vertices (j = 0, 1, 2, 3). Then P = P0 ∪P1 ∪P2 ∪P3. We use P 1 to denote the collection of 3-paths L ∈ P such that A(L) = 1. We also partition P1 \ P 1 into two parts: let PM ⊆ P1 \ P 1 be the collection of 3-paths with the middle vertex adjacent to some A-vertices; let PL ⊆ P1 \ P 1 be the collection of 3-paths Li such that A(Li) ≥ 2 and one ending vertex of Li is adjacent to some A-vertices. A vertex in a 3-path in P is free if it is not adjacent to any A-vertex. A 3-path in P0 is bad if it has at least two vertices adjacent to some free-vertex in a 3-path in PL and good otherwise. A 3-path in PL is bad if it is adjacent to a bad 3-path in P0 and good otherwise. Extended Conditions include the following seven items: vertex in A, i.e., P \ P 1 = P0 ∪ P1; (E1) For each 3-path Li ∈ P \ P 1, at most one vertex in Li is adjacent to some (E2) No 3-path in PM is adjacent to both of A0-vertices and A1-vertices; (E3) No free-vertex in a 3-path in PL is adjacent to a free-vertex in another 3-path in PL; (E4) No free-vertex in a 3-path in PL is adjacent to a free-vertex in a 3-path in PM ; (E5) Each 3-path in P 1 has at most one vertex adjacent to a free-vertex in a 3-path in PL; (E6) If a 3-path in P 0 has at least two vertices adjacent to some free-vertex in a 3-path in PL, then all those free-vertices are from one 3-path in PL, i.e., each bad 3-path in P 0 is adjacent to free-vertices in only one bad 3-path in PL; 11 (E7) No free-vertex in a 3-path in PL is adjacent to a vertex in Z. Lemma 8. A crucial partition of the vertex set of any given graph can be found in polynomial time. After obtaining a crucial partition (A, B, Z), we use the following three re- duction rules to reduce the graph. In fact, Extended Conditions are mainly used for the third reduction rule and the analysis of the kernel size. Reduction Rule 1 If the number of 3-paths in P is greater than k −Z/5, halt and report it as a no-instance. Note that each P3V C-set of the graph G must contain at least Z/5 vertices in Z by Basic Condition (B4) and each P3V C-set must contain one vertex from each 3-path in P. If the number of 3-paths in P is greater than k − Z/5, then any P3V C-set of the graph has a size greater than k. Reduction Rule 2 If Comp2(G[A]) > N2(A) (the condition in Corol- lary 1) holds, then find a good decomposition by Corollary 1 and reduce the instance based on the good decomposition. Reduction Rule 2 is easy to observe. Next, we consider the last reduction rule. Let B∗ be the set of free-vertices in good 3-paths in PL and let A∗ be the set of A0-vertices adjacent to 3-paths in P 1. Let A′ = A ∪ B∗ \ A∗. By the definition of crucial decompositions, we can get that Lemma 9. The set A′ still induces of a graph of maximum degree 1. Proof. Vertices in B∗ are free-vertices and then any vertex in B∗ is not adjacent to a vertex in A. Furthermore, no two free-vertices in B∗ from two different 3- paths in PL are adjacent by Extended Condition (E3). Since A induces a graph of maximum degree 1, we know that A∪ B∗ induces a graph of maximum degree 1. The set A′ = A∪ B∗ \ A∗ is a subset of A∪ B∗ and then A′ induces of a graph ⊓⊔ of maximum degree 1. Based on Lemma 9, we can apply the following reduction rule. Reduction Rule 3 If Comp(G[A′]) > 2N (A′) − N ′ 2(A′) (the condition in Lemma 6 on set A′) holds, then find a good decomposition by Lemma 6 and reduce the instance based on the good decomposition. Next, we assume that none of the three reduction rules can be applied and prove that the graph has at most 5k vertices. We consider a crucial partition (A, B, Z) of the graph. Let k1 be the number of 3-paths in P. Since Reduction Rule 1 cannot be applied, we know that k1 ≤ k − Z/5. (6) 12 Since Reduction Rule 2 and Reduction Rule 3 cannot be applied, we also have the following two relations and Comp2(G[A]) ≤ N2(A), Comp(G[A′]) ≤ 2N (A′) − N ′ 2(A′). (7) (8) By Extended Condition (E1), we know that P = P0 ∪ P1 ∪ P 1 = P0 ∪ PL ∪ PM ∪ P 1. Let x1 and x2 be the numbers of good and bad 3-paths in PL, respectively. Let yi (i = 0, 1) be the number of 3-paths in P0 with i vertices adjacent to some free-vertex in a 3-path in PL, and y2 be the number of 3-paths in P0 with at least two vertices adjacent to some free-vertex in a 3-path in PL, i.e., the number of bad 3-paths in P0. Let z1 and z2 be the numbers of 3-paths in PM adjacent to only A0-vertices and only A1-vertices, respectively. Let w1 be the number of 3-paths in P 1 adjacent to some free-vertex in a 3-path in PL and w2 be the number of 3-paths in P 1 not adjacent to any free-vertex in a 3-path in PL. We get that k1 = x1 + x2 + y0 + y1 + y2 + z1 + z2 + w1 + w2. (9) By Extended Conditions (E1) and (E2), we know that N (A)2 ≤ x1 + x2 + z2. (10) Extended Condition (E6) implies the number of bad 3-paths in PL is at most the number of bad 3-paths in P0, i.e., x2 ≤ y2. (11) Each 3-path in P 1 is adjacent to only one A0-vertex. Since A∗ is the set of A0-vertices adjacent to 3-paths in P 1, we know that A∗ is not greater than w1 + w2, i.e., the number of 3-paths in P 1. By the definition of A′, we know that (12) Comp(G[A′]) ≥ Comp(G[A]) + x1 − (w1 + w2). Next, we consider N (A′) and N ′ 2(A′). Note that each 3-path has at most one vertex adjacent to vertices in A \ A∗ by Extended Condition (E1). This property will also hold for the vertex set A′ = (A \ A∗) ∪ B∗. We prove the following two relations N (A′) ≤ x1 + x2 + y0 + y1 + z1 + z2 + w1, and N ′ 2(A′) ≥ y1 + z2 + w1. (13) (14) By Extended Conditions (E1) and (E3), we know that each 3-path in PL has at most one vertex in N ((A\ A∗)∪ B∗) = N (A′). By the definition of good 3-paths 13 in P0, we know that each good 3-path in P0 has no vertex adjacent to vertices in A and has at most one vertex adjacent to vertices in B∗ (which will be in a component of size 2 in G[A′]). There are exactly y1 vertices in good 3-paths in P0 adjacent to vertices in B∗. No vertex in a bad 3-path in P0 is adjacent to a vertex in A ∪ B∗ by the definitions of bad 3-paths and B∗. Each 3-path in PM has at most one vertex adjacent to A′ by Extended Conditions (E1) and (E4). Only z2 vertices in 3-paths in PM are adjacent to vertices in A′, all of which are vertices of degree-1 in G[A′]. No vertex in a 3-path in P 1 is adjacent to a vertex in A \ A∗ ⊇ A′ by the definition of A∗. Furthermore, each 3-path in P 1 has at most one vertex adjacent to vertices in B∗ (which will be in a component of size 2 in G[A′]) by Extended Condition (E5) and there are exactly w1 vertices in 3-paths in P 1 adjacent to vertices in B∗. No vertex in Z is adjacent to a vertex in A ∪ B∗ by Basic Condition (B3) and Extended Condition (E7). Summing all above up, we can get (13) and (14). Relations (8), (12), (13) and (14) imply Comp(G[A]) ≤ 2(x2 + y0 + z1 + w1) + x1 + y1 + z2 + w2. According to (7) and (10), we know that (15) (16) Comp2(G[A]) ≤ x1 + x2 + z2. Note that A = Comp(G[A]) + Comp2(G[A]), we get A = Comp(G[A]) + Comp2(G[A]) ≤ 2(x1 + x2 + y0 + z1 + z2 + w1) + x2 + y1 + w2 ≤ 2(x1 + x2 + y0 + z1 + z2 + w1) + y2 + y1 + w2 ≤ 2k1 by (15) and (16) by (11) by (9). Note that B = 3k1 and k1 ≤ k − Z/5 by (6). We get that V = A + B + Z ≤ 5k1 + Z ≤ 5k. Theorem 2. The parameterized 3-path vertex cover problem allows a kernel of at most 5k vertices. References 1. FN.Abu-Khzam, RL.Collins, MR.Fellows, MA.Langston: Kernelization Algorithms for the Vertex Cover Problem: Theory and Experiments. ALENEX/ANALC. 62 -- 69 (2004) 2. V.E.Alekseev, R.Boliac, D.V.Korobitsyn, V.V.Lozin: NP-hard graph problems and boundary classes of graphs. Theoretical Computer Science. 389(1 -- 2), 219 -- 236 (2007) 3. K.Asdre, S.D.Nikolopoulos, C.Papadopoulos: An optimal parallel solution for the path cover problem on P4-sparse graphs. Journal of Parallel and Distributed Com- puting. 67(1), 63 -- 76 (2007) 14 4. R.Boliac, K.Cameron, V.V.Lozin: On computing the dissociation number and the induced matching number of bipartite graphs. Ars Combinatoria. 72, 241 -- 253 (2004) 5. B.Bresar, M.Jakovac, J.Katrenic, G.Semanisin, A.Taranenko: On the vertex k-path cover. Discrete Applied Mathematics. 161(13 -- 14), 1943 -- 1949 (2013) 6. B.Bresar, F.Kardos, J.Katrenic, G.Semanisin: Minimum k-path vertex cover. Dis- crete Applied Mathematics. 159(12), 1189 -- 1195 (2011) 7. K.Cameron, P.Hell: Independent packings in structured graphs. Mathematical Pro- gramming. 105(2 -- 3) , 201 -- 213 (2006) 8. M-S.Chang, L-H.Chen, L-J.Hung, Y-Z.Liu, P.Rossmanith, S.Sikdar: An O∗(1.4658n)-time exact algorithm for the maximum bounded-degree-1 set problem. In: The 31st Workshop on Combinatorial Mathematics and Computation Theory. pp, 9 -- 18 (2014) 9. M-S.Chang, L-H.Chen, L-J.Huang: A 5k kernel for P2-packing in net-free graphs. International Computer Science and Engineering Conference, 12 -- 17, IEEE (2014) 10. J.Chen, H.Fernau, P.Shaw, J.Wang, Z.Yang: Kernels for Packing and Covering Problems. In FAW-AAIM 2012, LNCS 7285, 199 -- 211. Springer, Heidelberg (2012) 11. MR.Fellows, J.Guo, H.Moser, R.Niedermeier: A generalization of Nemhauser and Trotter's local optimization theorem. JCSS 77(6), 1141 -- 1158 (2011) 12. H.Fermau, D.Raible: A parameterized perspective on packing paths of length two. Journal of Combinatorial Optimization. 18(4), 319 -- 341 (2009) 13. F.V.Fomin, D.Kratsch: Exact exponential algorithms. Berlin:Springer (2010) 14. F.Goring, J.Harant, D.Rautenbach, I.Schiermeyer: On F-independence in graphs. Discussiones Mathematica Graph Theory. 29(2), 377 -- 383 (2009) 15. R-W.Hung, M-S.Chang: Finding a minimum path cover of a distance-hereditary graph in polynomial time. Discrete Applied Mathematics. 155(17), 2242 -- 2256 (2007) 16. F.Kardos, J.Katrenic: On computing the minimum 3-path vertex cover and disso- ciation number of graphs. Theoretical Computer Science. 412(50), 7009 -- 7017 (2011) 17. J.Katrenic: A faster FPT algorithm for 3-path vertex cover. Information Processing Letters. 116(4): 273 -- 278(2016) 18. V.V.Lozin, D.Rautenbach: Some results on graphs without long induced paths. Information Processing Letters. 88(4), 167 -- 171 (2003) 19. Y.Orlovich, A.Dolgui, G.Finke, V.Gordon, F.Werner: The complexity of dissocia- tion set problems in graphs. Disc. Appl. Math. 159(13), 1352 -- 1366 (2011) 20. C.H.Papadimitriou, M.Yannakakis: The complexity of restricted spanning tree problems. Journal of ACM. 29(2), 285 -- 309 (1982) 21. E.Prieto, C.Sloper: Looking at the stars. Theor. Comp. Sci. 351(3), 437 -- 445 (2006) 22. J.Tu: A fixed-parameter algorithm for the vertex cover P3 problem. Information Processing Letters. 115(2), 96 -- 99 (2015) 23. J.Wang, D.Ning, Q.Feng, J.Chen: An improved kernelization for P2-packing. In- formation Processing Letters. 110(5), 188 -- 192 (2010) 24. B.Y.Wu: A Measure and Conquer Approach for the Parameterized Bounded Degree-One Vertex Deletion. In: COCOON 2015. LNCS 9198, 469 -- 480 (2015) 25. M.Xiao: On a Generalization of Nemhauser and Trotter's Local Optimization The- orem. In: ISAAC 2015. LNCS 9472, pp. 442 -- 452. Springer, Heidelberg (2015) 26. M. Xiao: A Parameterized Algorithm for Bounded-Degree Vertex Deletion. In: T.N. Dinh and M.T. Thai (Eds.): COCOON 2016, Springer, Heidelberg (2016) 27. M.Xiao, S.Kou: Exact algorithms for the maximum dissociation set and min- (2016) imum 3-path vertex cover problems. Theoretical Computer Science. doi:10.1016/j.tcs.2016.04.043 28. M.Yannakakis: Node-deletion problems on bipartite graphs. SIAM Journal on Computing. 10(2), 310 -- 327 (1981)
1511.00310
2
1511
2017-04-10T11:39:57
Parameterized Integer Quadratic Programming: Variables and Coefficients
[ "cs.DS" ]
In the Integer Quadratic Programming problem input is an n*n integer matrix Q, an m*n integer matrix A and an m-dimensional integer vector b. The task is to find a vector x in Z^n, minimizing x^TQx, subject to Ax <= b. We give a fixed parameter tractable algorithm for Integer Quadratic Programming parameterized by n+a. Here a is the largest absolute value of an entry of Q and A. As an application of our main result we show that Optimal Linear Arrangement is fixed parameter tractable parameterized by the size of the smallest vertex cover of the input graph. This resolves an open problem from the recent monograph by Downey and Fellows.
cs.DS
cs
Parameterized Integer Quadratic Programming: Variables and Coefficients Daniel Lokshtanov∗ April 11, 2017 Abstract In the Integer Quadratic Programming problem input is an n × n integer matrix Q, an m × n integer matrix A and an m-dimensional integer vector b. The task is to find a vector x ∈ Zn minimizing xT Qx, subject to Ax ≤ b. We give a fixed parameter tractable algorithm for Integer Quadratic Programming parameterized by n + α. Here α is the largest absolute value of an entry of Q and A. As an application of our main result we show that Optimal Linear Arrangement is fixed parameter tractable parameterized by the size of the smallest vertex cover of the input graph. This resolves an open problem from the recent monograph by Downey and Fellows. 1 Introduction While Linear Programming is famously polynomial time solvable [16], most generalizations are not. In particular, requiring the variables to take integer values gives us the Integer Linear Programming problem, which is easily seen to be NP-hard. On the other hand, integer linear programs (ILPs) with few variables can be solved efficiently. The celebrated algorithm of Lenstra [19] solves ILPs with n variables in time f (n)LO(1) where f is a (doubly exponential) function depending only on n and L is the total number of bits required to encode the input integer linear program. In terms of parameterized complexity this means that Integer Linear Programming is fixed parameter tractable (FPT) when parameterized by the number n of variables to the input ILP. In parameterized complexity input instances come with a parameter k, and an algorithm is called fixed parameter tractable if it solves instances of size L with parameter k in time f (k)LO(1) for some function f depending only on k. For an introduction to parameterized complexity we refer to the recent monograph of Downey and Fellows [6], as well as the textbook by Cygan et al. [5]. Following the algorithm of Lenstra [19] there has been a significant amount of research into parameterized algorithms for Integer Linear Programming, as well as generalizations of the problem to (quasi) convex optimization. Highlights include the algorithms for Integer Linear Programming with improved dependence on n by Kannan [14], Clarkson [4] and Frank and Tardos [10] and generalizations to N -fold integer programming due to Hemmecke et al. [13], see also the book by Onn [20]. Heinz [12] generalized the FPT algorithm of Lenstra to quasi-convex polynomial optimization. More concretely, the algorithm of Heinz finds an integer assignment to variables x1, . . . , xn minimizing f (x1, . . . xn) subject to the constraints gi(x1, . . . , xn) ≤ 0 for 1 ≤ i ≤ m, where f and g1, . . . , gm are quasi-convex polynomials of degree d ≥ 2. Here a function f : Rn → R is quasi-convex if for every real λ the set {x ∈ Rn : f (x) ≤ λ} is convex. The algorithm has running time LO(1)nO(dn)2O(n3), that is, it is fixed parameter tractable in the dimension n and the degree d of the input polynomials. Khachiyan and Porkolab [15] gave an ∗Department of Informatics, University of Bergen, Norway, e-mail: [email protected] 1 even more general algorithm that covers the case of minimization of convex polynomials over the integer points in convex semialgebraic sets given by arbitrary (not necessarily quasi-convex) polynomials, see [17] for more details. On the other hand, generalizations of Integer Linear Programming to optimization of possibly non-convex functions over possibly non-convex domains quickly become computation- ally intractable in the strongest possible sense. In fact, solving a system of quadratic equations over 232 integer valued variables is undecidable [17], and the same holds for finding an integer root of a single multi-variate polynomial of degree 4 [17]. Nevertheless, there are interesting spe- cial cases of non-convex (integer) mathematical programming for which algorithms are known to exist, and it is an under-explored research direction to investigate the parameterized com- plexity of these problems. Perhaps the simplest such generalization is the Integer Quadratic Programming problem. Here the input is a n× n integer matrix Q, an m× n integer matrix A and an m-dimensional integer vector b. The task is to find a vector x ∈ Zn minimizing xT Qx, subject to Ax ≤ b. Thus, in this problem, the domain is convex, but the objective function might not be. It is a major open problem whether there exists a polynomial time algorithm for Integer Quadratic Programming with a constant number of variables. Indeed, until quite recently the problem was not even known to be in NP [21], and the first polynomial time algorithm for Integer Quadratic Programming in two variables was given by Del Pia and Weismantel [22] in 2014. In this paper we take a more modest approach to Integer Quadratic Programming, and consider the problem when parameterized by the number n of variables and the largest absolute value α of the entries in the matrices Q and A. Our main result is an algorithm for Integer Quadratic Programming with running time f (n, α)LO(1), demonstrating that the problem is fixed parameter tractable when parameterized by the number of variables and the largest coefficient appearing in the objective function and in the constraints. On one hand Integer Quadratic Programming is a more general problem than In- teger Linear Programming. On the other hand the parameterization by variables and coefficients is a much stronger parameterization than parameterizing just by the number n of variables. By making the largest entry α of Q and A a parameter we allow the running time of our algorithms to depend in arbitrary ways on essentially all of the input. The only reason that designing an FPT algorithm for this parameterization is non-trivial is that the entries in the vector b may be arbitrarily large compared to the parameters n and α. This makes the number of possible assignments to the variables much too large to enumerate all assignments by brute force. Indeed, despite being quite restricted our algorithm for Integer Quadratic Programming allows us to show fixed parameter tractability of a problem whose parameter- ized complexity was unknown prior to this work. More concretely we use the new algorithm for Integer Quadratic Programming to prove that Optimal Linear Arrangement parameterized by the size of the smallest vertex cover of the input graph is fixed parameter tractable. In the Optimal Linear Arrangement problem we are given as input an undirected graph G on n vertices. The task is to find a permutation σ : V (G) → {1, . . . , n} minimizing the cost of σ. Here the cost of a permutation σ is val(σ, G) = Puv∈E(G) σ(u)− σ(v). The problem was shown to be NP-complete already in the 70's [11], admits a factor O(√log n log log n) approx- imation algorithm [2, 7], but no admits no polynomial time approximation scheme, assuming plausible complexity-theoretic assumptions [1]. We consider Optimal Linear Arrangement parameterized by the size of the smallest vertex cover of the input graph G. A vertex cover of a graph G is a vertex set C such that every edge in G has at least one endpoint in C. When Optimal Linear Arrangement is parameterized by the vertex cover number of the input graph, an integer parameter k is also given as input together with G and n. An FPT algorithm is allowed to run in time f (k)nO(1) and only has to provide an optimal layout σ of G if there exists a vertex cover in 2 G of size at most k. We remark that one can compute a vertex cover of size k, if it exists, in time O(1.2748k + nO(1)) [3]. Hence, when designing an algorithm for Optimal Linear Arrangement parameterized by vertex cover we may just as well assume that a vertex cover C of G of size at most k is given as input. The parameterized complexity of Optimal Linear Arrangement parameterized by ver- tex cover was first posed as an open problem by Fellows et al. [9]. Fellows et al. [9] showed that a number of well-studied graph layout problems, such as Bandwidth and Cutwidth can be shown to be FPT when parameterized by vertex cover, by reducing the problems to Integer Linear Programming parameterized by the number of variables. For the most natural for- malization of Optimal Linear Arrangement as an integer program the objective function is quadratic (and not necessarily convex), and therefore the above approach fails. Motivated by the lack of progress on this problem, Fellows et al. [8] recently showed an FPT approximation scheme for Optimal Linear Arrangement parameterized by vertex cover. In partiular they gave an algorithm that given as input a graph G with a vertex cover of size at most k and a rational ǫ > 0, produces in time f (k, ǫ)nO(1) a layout σ with cost at most a factor (1 + ǫ) larger than the optimum. Fellows et al. [8] re-state the parameterized complexity of Optimal Linear Arrangement parameterized by vertex cover as an open problem. Finally, the problem was re-stated as an open problem in the recent monograph of Downey and Fellows [6]. Interestingly, Downey and Fellows motivate the study of this problem as follows. "Our enthusiasm for this concrete problem is based on its connection to Integer Lin- ear Programming. The problem above is easily reducible to a restricted form of Integer Quadratic Programming which may well be FPT". We give an FPT algorithm for Optimal Linear Arrangement parameterized by vertex cover, resolving the open problem of [6, 8, 9]. Our algorithm for Optimal Linear Arrange- ment works by directly applying the new algorithm for Integer Quadratic Programming to the most natural formulation of Optimal Linear Arrangement on graphs with a small vertex cover as an integer quadratic program, confirming the intuition of Downey and Fellows [6]. Preliminaries and notation. In Section 2 lower case letters denote vectors and scalars, while upper case letters denote matrices. All vectors are column vectors. For an integer p ≥ 2, the ℓp norm of an n-dimensional vector v = [v1, v2, . . . , vn] is denoted by vp and is defined to be vp = (vp n)1/p. The ℓ1 norm of v is v1 = v1 + v2 + . . . + vn, while the ℓ∞ norm of v is v∞ = max(v1,v2, . . . ,vn). 2 + . . . + vp 1 + vp 2 Algorithm for Integer Quadratic Programming We consider the following problem, called Integer Quadratic Programming. Input consists of an n × n integer symmetric matrix Q, an m × n integer matrix A and m-dimensional integer vector b. The task is to find an optimal solution x⋆ to the following optimization problem. Minimize xT Qx subject to: Ax ≤ b x ∈ Zn. (1) A vector x ∈ Zn that satisfies the constraints Ax ≤ b is called a feasible solution to the IQP (1). Given an input on the form (1) there are three possible scenarios. A possible scenario is that there are no feasible solutions, in which case this is what an algorithm for Integer Quadratic Programming should report. Another possibility is that for every integer β there exists some feasible solution x such that xT Qx ≤ β. In that case the algorithm should report that the IQP is unbounded. Finally, it could be that there exist feasible solutions, and that the minimum 3 value of xT Qx over the set of all feasible x is well defined. This is the most interesting case, and in this case the algorithm should output a feasible x such that xT Qx is minimized. Note that the requirement that Q is symmetric can easily be avoided by replacing Q by Q + QT . This operation does not change the set of optimal solutions, since it multiplies the objective function value of every solution by 2. We will denote by aT i the i'th row of the matrix A, and by bi the i'th entry of the vector b. Thus, Ax ≤ b means that aT i x ≤ bi for all i. The maximum absolute value of an entry of A and Q is denoted by α. Using a pair of inequalities one can encode equality constraints. It is useful to rewrite the IQP (1) to separate out the equality constraints explicitely, obtaining the following equivalent form. Minimize xT Qx subject to: Ax ≤ b Cx = d x ∈ Zn. (2) If input is given on the form (2), Here C is an integer matrix and d is an integer vector. then we still use α to denote the maximum value of an entry of A and Q. The IQP (2) could be generalized by changing the objective function from xT Qx to xT Qx + qT x for some n- dimensional vector q also given as input. This generalization can be incorporated in the original formulation (2) at the cost of introducing a new variable x, adding the constraint x = 1 to the system Cx = d and adding [0, q] as the row corresponding to the new variable x in Q. We will denote by ∆ the maximum absolute value of the determinant of a square submatrix of C. We may assume without loss of generality that the rows of C are linearly independent; otherwise we may in polynomial time either conclude that the IQP has no feasible solutions, or remove one of the equality constraints in the system Cx = d without changing the set of feasible solutions. Thus C has at most n rows. If the IQP (2) is obtained from (1) by replacing constraints aT i x = bi, the maximum entry of C is also upper bounded by α and then we have ∆ ≤ n! · αn. The next simple observation shows that we can in polynomial time reduce the number of constraints to a function of n and α. i x ≤ −bi with aT i x ≤ bi, −aT Lemma 1. There is a polynomial time algorithm that given as input the matrix A and vector b outputs an m′ × n submatrix A′ of A and vector b′ such that m′ ≤ (2α + 1)n and for every x ∈ Zn, Ax ≤ b if and only if A′x ≤ b′. Proof. Suppose A has more than (2α + 1)n rows. Then, by the pigeon hole principle the system Ax ≤ b has two rows aT j x ≤ bj where i 6= j but ai = aj. Without loss of generality bi ≤ bj, and then any x ∈ Zn such that aT j x ≤ bj. Thus we can safely remove the inequality aT i x ≤ bi satisfies aT i x ≤ bi and aT j x ≤ bj from the system, and the lemma follows. In the following we will assume that the input is on the form (2). We will give an algorithm that runs in time f (n, m, α, ∆) · LO(1), where L is the length of the bit-representation of the input instance. Since we can reduce the input using Lemma 1 first and ∆ is upper bounded in terms of n and α this will yield an FPT algorithm for Integer Quadratic Programming parameterized by n and α. Let r be the dimension of the nullspace of C. Using Cramer's rule (see [18]) we can in polynomial time compute a basis y1, . . . yr for the nullspace of C, such that each yi is an integer vector and yi∞ ≤ ∆2. We let Y be the n × r matrix whose columns are the vectors y1, . . . yr. We will abuse notation and write yi ∈ Y to denote that we chose the i'th column yi of Y . We will say that a feasible solution x is deep if x + yi and x− yi are feasible solutions for all yi ∈ Y . A feasible solution that is not deep is called shallow. Lemma 2. Let x be a shallow feasible solution to (2). Then there exists a row aT integer b′ from the rows of C. j ∈ {bj−α·n·∆2, . . . , bj}. Further, aT j of A and j is linearly independent j such that aT j and b′ j x = b′ 4 Proof. We prove the statement for yi ∈ Y such that x + yi is not a feasible solution to (2). Then there exists a row aT j of A such that aT j (x + yi) > bj, and thus bj − aT j x ≤ bj. j yi < aT Thus aT j x = b′ j for b′ We now show that aT j ∈ {bj−α·n·yi∞, bj}. Since yi∞ ≤ ∆2 we have that b′ j ∈ {bj−α·n·∆2, bj}. j is linearly independent from the rows of C. Suppose not, then there exists a coefficient vector λ such that λT C = aT j . But then aT j (x + yi) = λT C(x + yi) = λT Cx + λT Cyi = λT Cx = aT j x ≤ bj, which contradicts that aT rows of C. The proof for the case when x − yi is not a feasible solution to (2) is symmetric. j (x + yi) > bj. We conclude that aT j is linearly independent from the Lemma 2 suggests the following branching strategy: either all optimal solutions are deep or Lemma 2 applies to some shallow optimal solution x⋆. In the latter case the algorithm can branch on the choice of row aT j to the set of constraints. This decreases the dimension of the nullspace of C by 1. We are left with handling the case when all optimal solutions are deep. Lemma 3. For any pair of vectors x, y ∈ Rn and symmetric matrix Q ∈ Rn×n, the following are equivalent. j and add the equation aT j and b′ j x = b′ 1. (x + y)T Q(x + y) ≥ xT Qx and (x − y)T Q(x − y) ≥ xT Qx, 2. −yT Qy ≤ 2xT Qy ≤ yT Qy. Proof. Expanding the inequalities of (1) yields xT Qx + 2xT Qy + yT Qy ≥ xT Qx, xT Qx − 2xT Qy + yT Qy ≥ xT Qx. Cancelling the xT Qx terms and re-organizing yields 2xT Qy ≥ −yT Qy and 2xT Qy ≤ yT Qy. Since the left hand side of the inequalities is the same we can combine the two inequalities in a single inequality, −yT Qy ≤ 2xT Qy ≤ yT Qy, completing the proof. Note that all the manipulations we did on the inequalities are reversible, thus the above argument does indeed prove equivalence and not only the forward direction (1) → (2). Lemma 3 suggests a branching strategy to find a deep solution x⋆: pick a vector yi in Y such that yT i Q is linearly independent of the rows of C, guess the value z of 2(x⋆)T Qyi and add the linear equation 2(x⋆)T Qyi = z to the set of constraints. In each branch the dimension of the nullspace of C decreases by 1. Thus we are left with the case that all solutions are deep and there is no yi in Y such that yT i Q is linearly independent of the rows of C. We now handle this case. Lemma 4. For any deep optimal solution x⋆ of the IQP (2) and yi ∈ Y such that yT i Q is linearly dependent of the rows of C, the vectors x⋆ + yi and x⋆ − yi are also optimal solutions. Proof. We prove the statement for x⋆ + yi. Since x⋆ is deep it follows that x⋆ + yi is feasible, and it remains to lower bound the objective function value of x⋆ + yi. Since yT i Q is linearly i Q = λT C. Therefore, dependent of the rows of C there exists a coefficient vector λT such that yT 2(x⋆ + yi)T Qyi = 2yT i Q(x⋆ + yi) = 2λT C(x⋆ + yi) = 2λT Cx⋆ + 2λT Cyi = 2λT Cx⋆ = 2yT i Qx⋆ = 2(x⋆)T Qyi 5 Since x⋆ is deep, it follows that both x⋆ + yi and x⋆ − yi are feasible and therefore cannot have a higher value of the objective function than x⋆. Hence, by Lemma 3 we have that −yT i Qyi. Since 2(x⋆ + yi)T Qyi = 2(x⋆)T Qyi, we have that i Qyi ≤ 2(x⋆)T Qyi ≤ yT −yT i Qyi ≤ 2(x⋆ + yi)T Qyi ≤ yT i Qyi. Hence, Lemma 3 applied to (x⋆ + yi) implies that (x⋆)T Qx⋆ = (x⋆ + yi − yi)T Q(x⋆ + yi − yi) ≥ (x⋆ + yi)T Q(x⋆ + yi). This means that the objective function value of x⋆ + yi is at most that of x⋆, hence x⋆ + yi is optimal. The proof for x⋆ − yi is symmetric. Lemma 4 immediately implies the following corollary. Corollary 1. Suppose the IQP (2) has an optimal solution, all optimal solutions to (2) are deep, and for every yi ∈ Y , yT i Q is linearly dependent of the rows of C. Then, for every optimal solution x⋆ and integer vector λ ∈ Zr, x⋆ + Y λ is also an optimal solution of (2). Proof. Since x⋆ is optimal and deep, and for every yi ∈ Y , yT i Q is linearly dependent of the rows of C, it follows from Lemma 4 that for every yi ∈ Y , x⋆ + yi and x⋆ − yi are also optimal solutions of (2). Since all optimal solutions are deep, x⋆ +yi and x⋆−yi are deep. The statement of the corollary now follows by induction on λ1. We are now ready to state the main structural lemma underlying the algorithm for Integer Quadratic Programming. Lemma 5. For any Integer Quadratic Program of the form (2) that has an optimal solution and any x0 such that Cx0 = d, there exists an optimal solution x⋆ such that at least one of the following three cases holds. 1. There exists a row aT j of A and integer b′ j ∈ {bj − α · n · ∆2, . . . , bj} such that aT j x⋆ = b′ j, and aT j is linearly independent from the rows of C. 2. There exists a yi ∈ Y such that yT z for z ∈ {−n2∆4α, . . . , n2∆4α}. 3. x⋆ − x01 ≤ ∆2 · n. i Q is linearly independent of the rows of C and 2yT i Qx⋆ = i Qyi, . . . , yT i Qx⋆ = z for z ∈ {−yT i Qyi}. Furthermore, yT Proof. Suppose the integer quadratic program (2) has a shallow optimal solution x⋆. Then, by Lemma 2 case 1 applies. In the remainder of the proof we assume that all optimal solutions are deep. Suppose now that there is a yi ∈ Y such that yT i Q is linearly independent of the rows of C. Then, since x⋆ is a deep optimal solution, both x⋆ + yi and x⋆ − yi are feasible solutions, so (x⋆ + yi)T Q(x⋆ + yi) ≥ (x⋆)T Qx⋆ and (x⋆ − yi)T Q(x⋆ − yi) ≥ (x⋆)T Qx⋆. Thus, Lemma 3 implies that 2yT i Qyi is the sum of n2 terms where each term a product of an element of yi (and thus at most ∆2), another element of yi, and an element of Q. Thus z ∈ {−n2∆4α, . . . , n2∆4α} and therefore case 2 applies. Finally, suppose that all yi ∈ Y are linearly dependent of the rows of C. Let x be an arbitrarily chosen optimal solution to (2). Since C(x0 − x) = 0 and Y forms a basis for the nullspace of C there is a coefficient vector λ ∈ Rr such that x0 = x + Y λ. Define λ from In other words, for every i we set λ by rounding each entry down to the nearest integer. λi = ⌊λi⌋. Set x⋆ = x + Y λ. By Corollary 1 we have that x⋆ is an optimal solution to (2). But x⋆ − x01 = Y (λ − λ)1 ≤ (maxi yi1) · n ≤ ∆(C)2 · n, concluding the proof. Theorem 1. There exists an algorithm that given an instance of Integer Quadratic Pro- gramming, runs in time f (n, α)LO(1), and outputs a vector x ∈ Zn. If the input IQP has a feasible solution then x is feasible, and if the input IQP is not unbounded, then x is an optimal solution. 6 Proof. We assume that input is given on the form (2). The algorithm starts by reducing the input system according to Lemma 1. After this preliminary step the number of constraints m in the IQP is upper bounded by (2α + 1)n. We give a recursive algorithm, based on Lemma 5. The algorithm begins by computing in polynomial time a basis Y = y1, . . . , yr for the nullspace of C, as described in the beginning of Section 2. In particular Y is a matrix of integers, and for every i, yi∞ ≤ ∆2. If the dimension of the nullspace of C is 0 the algorithm solves the system Cx = d of linear equations in polynomial time. Let x⋆ be the (unique) solution to this linear system. If x⋆ is not an integral vector, or Ax⋆ ≤ b does not hold the algorithm reports that the input IQP has no feasible solution. Otherwise it returns x⋆ as the optimum. If C is not full-dimensional, i.e the dimension of the nullspace of C is at least 1, the algorithm j ∈ {bj − α · n · ∆2, bj} such that proceeds as follows. For each row aT aT is linearly independent from the rows of C, the algorithm calls itself recursively on the j same instance, but with the equation aT j added to the system Cx = d. Furthermore, for each yi ∈ Y such that yT i Q is linearly independent of the rows of C and every integer z ∈ {−n2∆4α, . . . , n2∆4α} the algorithm calls itself recursively on the same instance, but with the equation 2yT i Qx = z added to the system Cx = d. Finally the algorithm computes an arbitrary (not necessarily integral) solution x0 of the system Cx = d, and checks all (integral) vectors within ℓ1 distance at most ∆2 · n from x0. The algorithm returns the feasible solution with the smallest objective function value among the ones found in any of the recursive calls, and the search around x0. j of A and integer b′ j x = b′ In the recursive calls, when we add a linear equation to the system Cx = d we extend the matrix C and vector d to incorporate this equation. The algorithm terminates, as in each recursive call the dimension of the nullspace of C is decreased by 1. Further, any feasible solution found in any of the recursive calls is feasible for the original system. Thus, if the algorithm reports a solution then it is feasible. To see that the algorithm reports an optimal solution, consider an optimal solution x⋆ satisfying the conditions of Lemma 5 applied to the quadratic integer program (2) and vector x0. Either x⋆ will be found in the search around x0, or x⋆ satisfies the linear constraint added in at least one of the recursive calls. In the latter case x⋆ is an optimal solution to the integer quadratic program of the recursive call, and in this call the algorithm will find a solution with the same objective function value. This concludes the proof of correctness. We now analyze the running time of the algorithm. First, consider the time it takes to search all integral vectors within ℓ1 distance at most ∆2 · n from x0. It is easy to see that there are at most 3∆2·n+n such vectors. For the running time analysis only we will treat this search as at most 3∆2·n+n recursive calls to instances where the dimension of the nullspace of C is 0. Then the running time in each recursive call is polynomial, and it is sufficient to upper bound the number of leaves in the recursion tree of the algorithm. We bound the number of leaves of the recursion tree as a function of n – the number of variables, m – the number of rows in A, α – the maximum value of an entry in A or Q, ∆ – the maximum absolute value of the determinant of a square submatrix of C, and r – the dimension of the nullspace of C. Notice that the algorithm never changes Q or A, and that the number of variables remains the same throughout the execution of the algorithm. Thus n, m and α do not change throughout the execution. For a fixed value of n, m and α, we let T (r, ∆) be the maximum number of leaves in the recursion tree of the algorithm when called on an instance with the given value of n, m, α, r and ∆. In each recursive call the algorithm adds a new row to the matrix C. Let C ′ be the new matrix after the addition of this row, r′ be the dimension of the nullspace of C and ∆′ be the maximum value of a determinant of a square submatrix of C ′. Since the new added row is linearly independent of the rows of C it follows that r′ = r − 1 in each of the recursive calls arising from case 1 and case 2 of Lemma 5. The remaining recursive calls are to leaves of the 7 recursion tree. When the algorithm explores case 1, it guesses a row aj, for which there are m possibilities, j, for which there are α· n·∆2 possibilities. This generates m· α· n·∆2 recursive and a value for b′ calls. In each of these recursive calls aj is the new row of C ′, and so, by the cofactor expansion of the determinant [18], ∆′ ≤ nα∆. When the algorithm explores case 2, it guesses a vector yi ∈ Y , and there are at most n possibilities for yi. For each of these possibilities the algorithm guesses a value for z, for which there are 2n2∆4α possible choices. Thus this generates 2n3∆4α recursive calls. In each of the recursive calls the algorithm makes a new matrix C ′ from C by adding the new row 2yT i Q∞ ≤ n · ∆2 · α, and the cofactor expansion of the determinant [18] applied to the new row yields ∆′ ≤ n2∆3 · α, where ∆′ is the maximum value of a determinant of a square submatrix of C ′. It follows that the number of leaves of the recursion tree is gouverned by the following recurrence. i Q. We have that yi∞ ≤ ∆2. Thus, 2yT T (r, ∆) ≤ m · α · n · ∆2 · T (r − 1, nα∆) + 2n3 · ∆4 · α · T (r − 1, n2∆3α) + 3(∆2+1)·n ≤ α · m · n3 · ∆4 · T (r − 1, n2∆3α) + 3(∆2+1)·n The above recurrence is clearly upper bounded by a function of n, m, ∆ and α. Since m is upper bounded by (2α + 1)n from Lemma 1, the theorem follows. 2.1 Detecting Unbounded IQPs Theorem 1 allows us to solve bounded IQPs, and is sufficient for the application to Optimal Linear Arrangement. However, it is somewhat unsatisfactory that the algorithm of Theo- rem 1 is unable to detect whether the input IQP is bounded or not. Next we resolve this issue. Towards this, we inspect the algorithm of Theorem 1. For purely notational reasons we will consider the algorithm of Theorem 1 when run on an instance on the form (1). The first step of the algorithm is to put the the IQP on the form (2), and then proceed as described in the proof of Theorem 1. The algorithm is recursive, and the only variables that change from one recursive call to the next are the matrix C and the vector d. Furthermore, when making a recursive call, the new matrix C ′ is computed from C by either adding the row aT i Q to C. The vector yT is a vector from the basis Y for the nullspace of C. In other words C ′ depends i only on Q, A, C and i, and is independent of b and d. Furthermore, the recursion stops when C has full column rank. Thus, the family C of matrices C that the algorithm of Theorem 1 ever generates depends only on the input matrices Q and A (and not on the input vector b). At this point we remark that the only reason we assumed input was on the form (1) rather than (2) was to avoid the confusing sentence "Thus, the family C of matrices C that the algorithm of Theorem 1 ever generates depends only on the input matrices Q and A, and C," where the meaning of the matrix C is overloaded. j to C or adding the row 2yT Let ∆ be the maximum absolute value of the determinant of a square submatrix of a matrix C ∈ C ever generated by the algorithm. In other words, ∆ is the maximum value of the variable ∆ throughout the execution of the algorithm. Because ∆ only depends on C, it follows that ∆ only depends on C, and therefore ∆ is a function of the input matrices A and Q. We now discuss all the different vectors d ever generated by the algorithm. In each recursive call, the algorithm adds a new entry to the vector d, this entry is either from the set {bj − α · n · ∆2, bj} or from the set {−n2 ∆4α, . . . , n2 ∆4α}. Thus, any vector d ever generated by the algorithm is at ℓ∞ distance at most n2 ∆4α from some vector whose entries are either 0 or equal to bj for some j ≤ m. Given the vector b and the integer n, we define the vector set D(b, n) be the set of all integer vectors in at most n dimensions with entries either 0 or equal to bj for some j ≤ m. Observe that D(b, n) ≤ (m + 1)n. We have that every vector d ever generated by the algorithm is at ℓ∞ distance at most n2 ∆4α from some vector in D(b, n). 8 The algorithm of Theorem 1 generates potential solutions x to the input IQP by finding a (not necessarily integral) solution x0 to the linear system Cx = d, and then lists integral vectors within ℓ1-distance at most ∆2 · n from x0. From Theorem 1 it follows that if the input IQP is feasible and bounded, then one of the listed vectors x is in fact an optimum solution to the IQP. The above discussion proves the following lemma. Lemma 6. Given an n × n integer matrix Q, and an m × n integer matrix A, let C be the set of matrices C generated by the algorithm of Theorem 1 when run on the IQP Minimize xT Qx subject to: Ax ≤ 0 x ∈ Zn, and let ∆ be the maximum absolute value of the determinant of a square submatrix of a matrix C ∈ C. Then, for any m-dimensional integer vector b such that the IQP (1) is feasible and bounded, there exists a C ∈ C, a vector d0 ∈ D(b, n), and an integer vector d at ℓ∞ distance at most n2 ∆4α from d0 such that the following is satisfied. For any x0 such that Cx0 = d, there exists an integer vector x∗ at ℓ1 distance at most ∆2 · n from x0 such that x∗ is an optimal solution to the IQP (1). The algorithm in Theorem 1 only adds a row to the matrix C if this row is linearly inde- pendent from the rows of C. Hence all matrices in C have full row rank, and therefore they have right inverses. Specifically, for each C ∈ C, we define C −1 right = C T (CC T )−1. It follows that CC −1 rightd is a solution to the system Cx = d for any vector d. Note that C −1 right is not necessarly an integer matrix, however Cramer's rule [18] shows that C −1 right is a matrix with rational entries with common denominator det(CC T ). This leads to the following lemma. right = I and that therefore, x0 = C −1 rightd0 + v is an optimal solution to the IQP (1). Lemma 7. There exists an algorithm that given an n × n integer matrix Q, and an m × n integer matrix A outputs a set C−1 of rational matrices, and a set V of rational vectors with the following property. For any m-dimensional integer vector b such that the IQP (1) defined by Q, A and b is feasible and bounded, there exists a matrix C −1 right ∈ C a vector v ∈ V and a vector d0 ∈ D(b, n), such that x∗ = C −1 Proof. The algorithm starts by applying the algorithm of Lemma 6 to obtain a set C of matrices and the integer ∆. The algorithm then computes the set C−1 of matrices, defined as C−1 = {C −1 : C ∈ C}. Next the algorithm constructs the set V of vectors as follows. For every right ∈ C−1, we have that C −1 matrix C −1 right = C T (CC T )−1 for some C ∈ C. For every integer vector v0 with v0∞ ≤ n2 ∆4α, and every rational vector v1 with v11 ≤ ∆2· n and denominator det(CC T ) in every entry, the algorithm adds C −1 rightv0 + v1 to V. It remains to prove that C−1 and V satisfy the statement of the lemma. Let b be an m-dimensional integer vector such that the IQP (1) defined by Q, A and b is feasible and bounded. By Lemma 6 we have that there exists C ∈ C, a vector d0 ∈ D(b, n), and a vector d at ℓ∞ distance at most n2 ∆4α from d0 such that the following is satisfied. For any x0 such that Cx0 = d, there exists an integer vector x∗ at ℓ1 distance at most ∆2 · n from x0 such that x∗ is an optimal solution to the IQP (1). Let C ∈ C, d0 ∈ D(b, n), and d be as guaranteed by Lemma 6, and set v0 = d − d0. We have that v0∞ ≤ n2 ∆4α. Let C −1 rightd = rightd0 + C −1 C −1 Thus, there exists an integer vector x∗ at ℓ1 distance at most ∆2 · n from x0 such that x∗ is an optimal solution to the IQP (1). Let v1 = x∗ − x0, we have that v11 ≤ ∆2 · n. Further, x∗ is an integer vector, while x0 = C −1 rightd is a rational vector whose entries all have right be the right inverse of C in C−1, and let x0 = C −1 right rightv0. We have that Cx0 = d. 9 denominator det(CC T ). v = C −1 proof. rightv0 + v1 ∈ V and C −1 It follows that all entries of v1 have denominator det(CC T ). Thus rightd0 + v is an optimal solution to the IQP (1), completing the Armed with Lemma 7 we are ready to prove the main result of this section. Theorem 2. There exists an algorithm that given an instance of Integer Quadratic Pro- gramming, runs in time f (n, α)LO(1), and determines whether the instance is infeasible, feasi- ble and unbounded, or feasible and bounded. If the instance is feasible and bounded the algorithm outputs an optimal solution. Proof. The algorithm of Theorem 1 is sufficient to determine whether the input instance is feasible, and to find an optimal solution if the instance is feasible and bounded. Thus, to complete the proof it is sufficient to give an algorithm that determines whether the input IQP is unbounded. We will assume that the input IQP is given on the form (1). Suppose now that the input IQP is unbounded. For a positive integer λ, consider adding the linear constraints Ix ≤ λ1, and −Ix ≤ λ1 to the IQP. Here 1 is the n-dimensional all-ones vector. In other words, we consider the IQP where the goal is to minimize xT Qx, subject to A′x ≤ b′ where A′ is obtained from A by adding 2n new rows containing I and −I, and b′ is obtained from b by adding 2n new entries with value λ. There exists a λ0 such that for every λ ≥ λ0 this IQP is feasible. Further, for every λ the resulting IQP is bounded. Note that the matrix A′ does not depend on λ. We now apply Lemma 7 on Q and A′, and obtain a set C−1 of rational matrices, and a set V of rational vectors. We have that for every λ ≥ λ0, there exists a matrix C −1 right ∈ C a v ∈ V and a d0 ∈ D(b′, n), such that x∗ = C −1 rightd0 + v is an optimal solution to the IQP defined by Q, A′ and b′. Furthermore, the entries of b′ are either entries of b, 0 or equal to λ. Hence d0 = db + λd1 for db ∈ D(b, n) and d1 ∈ D(1, n). We can conclude that there exists a matrix C −1 right ∈ C a vector v ∈ V, a vector db ∈ D(b, n) and a vector d1 ∈ D(1, n), such that rightdb + v) rightd1) + (C −1 C −1 right(db + λd1) + v = λ · (C −1 is an optimal solution to the IQP defined by Q, A′ and b′. Thus, the input IQP is unbounded if and only if there exists a choice for C −1 right ∈ C, v ∈ V, db ∈ D(b, n) and d1 ∈ D(1, n), such that following univariate quadratic program with integer variable λ is unbounded. x = λ · (C −1 rightd1) + (C −1 Minimize xT Qx subject to: Ax ≤ b rightdb + v) λ ∈ Z. Hence, to determine whether the input IQP is unbounded, it is sufficient to iterate over all choices of C −1 right ∈ C, v ∈ V, db ∈ D(b, n) and d1 ∈ D(1, n), and determine whether the resulting univariate quadratic program is unbounded. Since the number of such choices is upper bounded by a function of Q and A, and univariate (both integer and rational) quadratic programming is trivially decidable, the theorem follows. 3 Optimal Linear Arrangement Parameterized by Vertex Cover We assume that a vertex cover C of G of size at most k is given as input. The remaining set of vertices I = V (G) − C forms an independent set. Furthermore, I can be partitioned into at most 2k sets as follows: for each subset S of C we define IS = {v ∈ I : N (v) = S}. For every vertex v ∈ I we will refer to N (v) as the type of v, clearly there are at most 2k different types. 10 Let C = {c1, c2, . . . , ck}. By trying all k! permutations of C we may assume that the optimal solution σ satisfies σ(ci) < σ(ci+1) for every 1 ≤ i ≤ k − 1. For every i between 1 and k − 1 we define the i'th gap of σ to be the set Bi of vertices appearing between ci and ci+1 according to σ. The 0'th gap B0 is the set of all vertices appearing before c1, and the k'th gap Bk is the set of vertices appearing after ck. We will also refer to Bi as "gap i" or "gap number i". For every gap Bi and type S ⊆ C of vertices we denote by I i S the set Bi ∩ IS of vertices of type S appearing in gap i. We say that an ordering σ is homogenous if, for every gap Bi and every type S ⊆ C the vertices of I i S appear consecutively in σ. Informally this means that inside the same gap the vertices from different sets IS and IS ′ "don't mix". Fellows et al. [8] show that there always exists an optimal solution that is homegenous. Lemma 8. [8] There exists a homogenous optimal linear arrangement of G. For every vertex v we define the force of v with respect to σ to be δ(v) = {u ∈ N (v) : σ(u) > σ(v)} − {u ∈ N (v) : σ(u) < σ(v)}. Notice that two vertices of the same type in the same gap have the same force. Fellows et al. [8] in the proof of Lemma 8 show that there exists an optimal solution that is homogenous, and where inside every gap, the vertices are ordered from left to right in non-decreasing order by their force. We will call such an ordering solution super-homogenous. As already noted, the existence of a super-homogenous optimal linear arrangement σ follows from the proof of Lemma 8 by Fellows et al. [8]. Lemma 9. [8] There exists a super-homogenous optimal linear arrangement of G. Notice that a super-homogenous linear arrangement σ is completely defined (up to swapping positions of vertices of the same type) by specifying for each i and each type S the size I i S. For each gap i and each type S we introduce a variable xi S. Clearly the variables xi S ∈ Z representing I i S need to satisfy and ∀i ≤ k,∀S ⊆ C xi S ≥ 0 ∀S ⊆ C k Xi=0 xi S = IS. (3) (4) On the other hand, every assignment to the variables satisfying these (linear) constraints corre- sponds to a super-homogenous linear arrangement σ of G with I i S for every type S and gap i. S = xi We now analyze the cost of σ as a function of the variables. The goal is to show that val(σ, G) is a quadratic function of the variables with coefficients that are bounded from above by a function of k. The coefficients of this quadratic function are not integral, but half-integral, namely integer multiples of 1 2 . The analysis below is somewhat tedious, but quite straightfor- ward. For the analysis it is helpful to re-write val(σ, G). For a fixed ordering σ of the vertices we say that an edge uv flies over the vertex w if min(σ(u), σ(v)) < σ(w) < max(σ(u), σ(v)). We define the "fly over" relation ∼ for edges and vertices, i.e uv ∼ w means that uv flies over w. Since an edge uv with σ(u) < σ(v) flies over the σ(v) − σ(u) − 1 vertices appearing between σ(u) and σ(v) it follows that val(σ, G) = E(G) + Xuv∈E(G) Xw∈V (G) uv∼w 1. 11 We partition the set of edges of G into several subsets as follows. The set EC is the set of all edges with both endpoints in C. For every gap i with i ∈ {0, . . . , k}, every j ∈ {1, . . . , k} and every S ⊆ C we denote by ES S and the other is cj. Notice that ES S or to 0 depending on whether vertices of type S are adjacent to cj or not. We have that i,j the set of edges whose one endpoint is in I i i,j is either equal to xi val(σ, G) = E(G) + Xcicj ∈EC Xw∈V (G) cicj ∼w 1 + Xi,j,S Xucj ∈ES i,j 1. Xw∈V (G) ucj ∼w (5) Further, for each edge cicj ∈ EC (with i < j) we have that Xp=i XS⊆C 1 = j − i − 1 + Xw∈V (G) j−1 cicj ∼w xp S. In other words, the first double sum of Equation 5 is a linear function of the variables. Since EC ≤ (cid:0)k 2(cid:1) the coefficients of this linear function are integers upper bounded by (cid:0)k 2(cid:1). We now turn to analyzing the second part of Equation 5. We split the triple sum in three parts as follows. Xi,j,S Xucj ∈ES i,j 1 ucj ∼w Xw∈V (G) 1  Xw∈I−I i S ucj ∼w = Xi,j,S   Xucj ∈ES i,j Xw∈C ucj ∼w 1 + Xucj ∈ES i,j Xw∈I i S ucj ∼w 1 + Xucj ∈ES i,j (6) For any fixed i, j and S, any edge ucj ∈ ES depends solely on i and j. It follows that i,j the number of vertices w ∈ C such that ucj ∼ w Xucj ∈ES i,j Xw∈C ucj ∼w 1 = f (i, j) · xi S Consider a pair of vertices u, w in I i for some function f , which is upper bounded by k (since C = k). S and a vertex cj ∈ C such that vertices of u's and w's type are adjacent to cj. Either the edge ucj flies over w or the edge wcj flies over u, but both of these events never happen simulataneously. Therefore, Xucj ∈ES i,j Xw∈I i S ucj ∼w 1 = (cid:18)xi 2 (cid:19) = S (xi S)2 2 − xi S 2 For the last double sum in Equation 6 consider an edge ucj ∈ ES In other words, this sum is a quadratic function of the variables with coefficients 1 Further, if vertices in IS are not adjacent to cj this sum is 0. 2 and − 1 2 . S ′ such i,j fly over all the vertices in I i′ that S′ 6= S or i′ 6= i. If ucj flies over v then all the edges in ES S ′. Let g(i, j, S, i′, S′) be a function that returns 1 if vertices in IS are adjacent to cj and all the edges in ES S ′. Otherwise g(i, j, S, i′, S′) returns 0. It follows that S · X(i′,S ′)6=(i,S) i,j fly over all the vertices in I i′ i,j and vertex v ∈ I i′ g(i, j, S, i′, S′)xi′ Xw∈I−I i Xucj ∈ES 1 = xi S ′ . i,j S ucj ∼w 12 In other words, this sum is a quadratic function of the variables with 0 and 1 as coefficients. The outer sum of Equation 6 goes over all 2k choices for S, k + 1 choices for i and k choices for j. Since the sum of quadratic functions is a quadratic function, this concludes the analysis and proves the following lemma. Lemma 10. val(σ, G) is a quadratic function of the variables {xi S} with half-integral coefficients between −2kk2 and 2kk2. Furthermore, there is a a polynomial time algorithm that given G computes the coefficients. For each permutation c1, . . . , ck of C we can make an integer quadratic program for finding the best super-homegenous solution to Optimal Linear Arrangement which places the vertices of C in the order c1, . . . , ck from left to right. The quadratic program has variable set {xi S} and constraints as in Equations 3 and 4. The objective function is the one given by Lemma 10, but with every coefficient multiplied by 2. This does not change the set of optimal solutions and makes all the coefficients integral. This quadratic program has at most 2k·(k +1) variables, 2k·(k +2) constraints, and all coefficients are between −2k+1k2 and 2k+2k2. Furthermore, since the domain of all variables is bounded the IQP is bounded as well. Thus we can apply Theorem 1 to solve each such IQP in time f (k) · n. This proves the main result of this section. Theorem 3. Optimal Linear Arrangement parameterized by vertex cover is fixed param- eter tractable. 4 Conclusions We have shown that Integer Quadratic Programming is fixed parameter tractable when parameterized by the number n of variables in the IQP and the maximum absolute value α of the coefficients of the objective function and the constraints. We used the algorithm for Integer Quadratic Programming to give the first FPT algorithm for Optimal Linear Arrangement parameterized by the size of the smallest vertex cover of the input graph. We hope that this work opens the gates for further research on the parameterized com- plexity of non-linear and non-convex optimization problems. There are open problems abound. For example, is Integer Quadratic Programming fixed parameter tractable when param- eterized just by the number of variables? What about the parameterization by n + m, the number of variables plus the number of constraints? It is also interesting to investigate the parameterized complexity of Quadratic Programming, i.e. with real-valued variables rather than integer variables. Finally, there is no reason to stop at quadratic functions. In particular, investigating the parameterized complexity of special cases of (integer) mathematical program- ming with degree-bounded polynomials in the objective function and constraints looks like an exciting research direction. Of course, many of these problems are undecidable [17], but for the questions that are decidable, parameterized complexity might well be the right framework to study efficient algorithms. References [1] C. Ambuhl, M. Mastrolilli, and O. Svensson, Inapproximability results for maxi- mum edge biclique, minimum linear arrangement, and sparsest cut, SIAM J. Comput., 40 (2011), pp. 567–596. [2] M. Charikar, M. T. Hajiaghayi, H. J. Karloff, and S. Rao, l2 for vertex ordering problems, Algorithmica, 56 (2010), pp. 577–604. 2 spreading metrics 13 [3] J. Chen, I. A. Kanj, and G. Xia, Improved upper bounds for vertex cover, Theor. Comput. Sci., 411 (2010), pp. 3736–3756. [4] K. L. Clarkson, Las vegas algorithms for linear and integer programming when the di- mension is small, J. ACM, 42 (1995), pp. 488–499. [5] M. Cygan, F. V. Fomin, L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh, Parameterized Algorithms, Springer, 2015. [6] R. G. Downey and M. R. Fellows, Fundamentals of Parameterized Complexity, Texts in Computer Science, Springer, 2013. [7] U. Feige and J. R. Lee, An improved approximation ratio for the minimum linear arrangement problem, Inf. Process. Lett., 101 (2007), pp. 26–29. [8] M. R. Fellows, D. Hermelin, F. A. Rosamond, and H. Shachnai, Tractable param- eterizations for the minimum linear arrangement problem, in Algorithms - ESA 2013 - 21st Annual European Symposium, Sophia Antipolis, France, September 2-4, 2013. Proceedings, 2013, pp. 457–468. [9] M. R. Fellows, D. Lokshtanov, N. Misra, F. A. Rosamond, and S. Saurabh, Graph layout problems parameterized by vertex cover, in Algorithms and Computation, 19th International Symposium, ISAAC 2008, Gold Coast, Australia, December 15-17, 2008. Proceedings, 2008, pp. 294–305. [10] A. Frank and ´E. Tardos, An application of simultaneous diophantine approximation in combinatorial optimization, Combinatorica, 7 (1987), pp. 49–65. [11] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, Series of Books in the Mathematical Sciences, W. H. Freeman and Co., 1979. [12] S. Heinz, Complexity of integer quasiconvex polynomial optimization, J. Complexity, 21 (2005), pp. 543–556. [13] R. Hemmecke, S. Onn, and L. Romanchuk, n-fold integer programming in cubic time, Math. Program., 137 (2013), pp. 325–341. [14] R. Kannan, Minkowski's convex body theorem and integer programming, Mathematics of Operations Research, 12 (1987), pp. 415–440. [15] L. Khachiyan and L. Porkolab, Integer optimization on convex semialgebraic sets, Discrete & Computational Geometry, 23 (2000), pp. 207–224. [16] L. G. Khachiyan, Polynomial algorithms in linear programming, USSR Comput. Math. and Math. Phys., 20 (1980), pp. 53–72. [17] M. Koppe, On the complexity of nonlinear mixed-integer optimization, in Mixed Integer Nonlinear Programming, Springer, 2012, pp. 533–557. [18] D. C. Lay, Linear Algebra and its Applications., Addison-Wesley, 2000. [19] H. W. Lenstra Jr., Integer programming with a fixed number of variables, Math. of Operations Research, 8 (1983), pp. 538–548. [20] S. Onn, Nonlinear discrete optimization, Zurich Lectures in Advanced Mathematics, Eu- ropean Mathematical Society, (2010). 14 [21] A. D. Pia, S. S. Dey, and M. Molinaro, Mixed-integer quadratic programming is in NP, Math. Programming Series A, to appear. (2016). [22] A. D. Pia and R. Weismantel, Integer quadratic programming in the plane, in Proceed- ings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, 2014, pp. 840–846. 15
1707.09545
1
1707
2017-07-29T17:58:35
Balanced Stable Marriage: How Close is Close Enough?
[ "cs.DS" ]
The Balanced Stable Marriage problem is a central optimization version of the classic Stable Marriage problem. Here, the output cannot be an arbitrary stable matching, but one that balances between the dissatisfaction of the two parties, men and women. We study Balanced Stable Marriage from the viewpoint of Parameterized Complexity. Our "above guarantee parameterizations" are arguably the most natural parameterizations of the problem at hand. Indeed, our parameterizations precisely fit the scenario where there exists a stable marriage that both parties would accept, that is, where the satisfaction of each party is "close" to the best it can hope for. Furthermore, our parameterizations accurately draw the line between tractability and intractability with respect to the target value.
cs.DS
cs
Balanced Stable Marriage: How Close is Close Enough?∗ Sushmita Gupta† Sanjukta Roy‡ Saket Saurabh† ‡ Meirav Zehavi† Abstract The Balanced Stable Marriage problem is a central optimization version of the classic Stable Marriage problem. Here, the output cannot be an arbitrary stable match- ing, but one that balances between the dissatisfaction of the two parties, men and women. We study Balanced Stable Marriage from the viewpoint of Parameterized Complexity. Our "above guarantee parameterizations" are arguably the most natural parameterizations of the problem at hand. Indeed, our parameterizations precisely fit the scenario where there exists a stable marriage that both parties would accept, that is, where the satisfaction of each party is close to the best it can hope for. Furthermore, our parameterizations accurately draw the line between tractability and intractability with respect to the target value. 1 Introduction Matching under preferences is a rich topic central to both economics and computer science, which has been consistently and intensively studied for over several decades. One of the main reasons for interest in this topic stems from the observation that it is extremely relevant to a wide variety of practical applications modeling situations where the objective is to match agents to other agents (or to resources). In the most general setting, a matching is defined as an allocation (or assignment) of agents to resources that satisfies some predefined criterion of compatibility/acceptability. Here, the (arguably) best known model is the two-sided model, where the agents on one side are referred to as men, and the agents on the other side are referred to as women. A few illustrative examples of real life situations where this model is employed in practice include matching hospitals to residents, students to colleges, kidney patients to donors and users to servers in a distributed Internet service. At the heart of all of these applications lies the fundamental Stable Marriage problem. In particular, the Nobel Prize in Economics was awarded to Shapley and Roth in 2012 "for the theory of stable allocations and the practice of market design." Moreover, several books have been dedicated to the study of Stable Marriage as well as optimization variants of this classical problem such as the Egalitarian Stable Marriage, Sex-Equal Stable Marriage and Balanced Stable Marriage problems [11, 14, 16]. The input of the Stable Marriage problem consists of a set of men, M , and a set of women, W , each person ranking a subset of people of the opposite gender. That is, each person a has a set of acceptable partners, A(a), whom this person subjectively ranks. Consequently, each person a has a so-called preference list, where pa(b) denotes the position of b ∈ A(a) in a's preference list. Without loss of generality, it is assumed that if a person a ranks a person b, then the person b ranks the person a as well. The sets of preference lists of the men and the women are denoted by LM and LW , respectively. In this context, we say that a pair of a man and a woman, (m, a), is an acceptable pair if both m ∈ A(w) and w ∈ A(m). Accordingly, the notion of a matching refers to a matching between men and women, where two people that are matched ∗The research leading to these results received funding from the European Research Council under the Euro- pean Unions Seventh Framework Programme (FP/2007-2013) / ERC Grant Agreement no. 306992. †University of Bergen, Norway; Emails: {Sushmita.Gupta, Meirav.Zehavi}@uib.no ‡Institute of Mathematical Sciences, India; Emails: {sanjukta, saket}@imsc.res.in to one another form an acceptable pair. Roughly speaking, the goal of the Stable Marriage problem is to find a matching that is stable in the following sense: there should not exist two people who prefer being matched to one another over their current "status". More precisely, a matching µ is said to be stable if it does not have a blocking pair, which is an acceptable pair (m, w) such that (i) either m is unmatched by µ or pm(w) < pm(µ(m)), and (ii) either w is unmatched by µ or pw(m) < pw(µ(w)). Here, the notation µ(a) indicates the person to whom µ matches the person a. Note that a person always prefers being matched to an acceptable partner over being unmatched. The seminal paper [7] by Gale and Shapely on stable matchings shows that given an instance of Stable Marriage, a stable matching necessarily exists, but it is not necessarily unique. In fact, for a given instance of Stable Marriage, there can be an exponential number of stable matchings, and they should be viewed as a spectrum where the two extremes are known as the man-optimal stable matching and the woman-optimal stable matching. Formally, the man- optimal stable matching, denoted by µM , is a stable matching such that every stable matching µ satisfies the following condition: every man m is either unmatched by both µM and µ or pm(µM (m)) ≤ pm(µ(m)). The woman-optimal stable matching, denoted by µW , is defined analogously. These two extremes, which give the best possible solution for one party at the expense of the other party, always exist and can be computed in polynomial time [7]. Naturally, it is desirable to analyze matchings that lie somewhere in the middle, being globally desirable, fair towards both sides or desirable by both sides. Each notion above of what constitutes a desirable stable matching leads to a natural, dif- ferent optimization problem. The determination of which notion best describes an appropriate outcome depends on the specific situation at hand. Here, the quantity pa(µ(a)) is viewed as the "satisfaction" of a in a matching µ, where a smaller value signifies a greater amount of satisfac- tion. Under this interpretation, the egalitarian stable matching attempts to be globally desirable by minimizing e(µ) = P(m,w)∈µ(pm(µ(m)) + pw(µ(w))) over the set of all stable matchings, which we denote by SM. The problem of finding an egalitarian stable matching, called Egali- tarian Stable Marriage, is known be solvable in polynomial time due to Irving et al. [12]. Roughly speaking, this problem does not distinguish between men and women, and therefore it does not fit scenarios where it is necessary to differentiate between the individual satisfaction of each party. In such scenarios, the Sex-Equal Stable Marriage and Balanced Stable Marriage problems come into play. Before we define each of these two problems, we would like to remark that a survey of results related to Egalitarian Stable Marriage and Sex- Equal Stable Marriage is outside the scope of this paper, and we refer interested readers to the books [11, 14, 16]. Here, we consider these two problems only to understand the context of Balanced Stable Marriage. In the Sex-Equal Stable Marriage problem, the objective is to find a stable match- ing that minimizes the absolute value of δ(µ) over SM, where δ(µ) = P(m,w)∈µ pm(µ(m)) −P(m,w)∈µ pw(µ(w)). It is thus clear that Sex-Equal Stable Marriage seeks a stable matching that is fair towards both sides by minimizing the difference between their individ- ual amounts of satisfaction. Unlike the Egalitarian Stable Marriage, the Sex-Equal Stable Marriage problem is known to be NP-hard [13]. On the other hand, in Balanced Stable Marriage, the objective is to find a stable matching that minimizes balance(µ) = max{P(m,w)∈µ pm(w),P(m,w)∈µ pw(m)} over SM. At first sight, this measure might seem con- ceptually similar to the previous one, but in fact, the two measures are quite different. Indeed, Balanced Stable Marriage does not attempt to find a stable matching that is fair, but one that is desirable by both sides. In other words, Balanced Stable Marriage examines the amount of dissatisfaction of each party individually, and attempts to minimize the worse one among the two. This problem fits the common scenario in economics where each party is selfish in the sense that it desires a matching where its own dissatisfaction is minimized, irrespective of the dissatisfaction of the other party, and our goal is to find a matching desirable by both 2 parties by ensuring that each individual amount of dissatisfaction does not exceed some thresh- old. In some situations, the minimization of balance(µ) may indirectly also minimize δ(µ), but in other situations, this may not be the case. Indeed, McDermid [17] constructed a family of instances where there does not exist any matching that is both a sex-equal stable matching and a balanced stable matching (the construction is also available in the book [16]). The Balanced Stable Marriage problem was introduced in the influential work of Feder [6] on stable matchings. Feder [6] proved that this problem is NP-hard and that it admits a 2-approximation algorithm. Later, it was shown that this problem also admits a (2 − 1/ℓ)-approximation algorithm where ℓ is the maximum size of a set of acceptable partners [16]. O'Malley [19] phrased the Balanced Stable Marriage problem in terms of constraint programming. Recently, McDermid and Irving [18] expressed interest in the design of fast exact exponential-time algorithms for Balanced Stable Marriage. In this paper, we study this problem in the realm of fast exact exponential-time algorithms as defined by the field of Parameterized Complexity (see Section 2). Recall that SM is the set of all stable matchings. In this context, we would like to remark that Egalitarian Stable Roommates problem is NP-complete [6]. Recently, Chen et al. [1] showed that it is FPT parameterized by the egalitarian cost. McDermid and Irving [18] showed that Sex-Equal Stable Marriage is NP-hard even if it is only necessary to decide whether the target ∆ = minµ∈SM δ(µ) is 0 or not [18]. In particular, this means that Sex-Equal Stable Marriage is not only W[1]-hard with respect to ∆, but it is even paraNP-hard with respect to this parameter.1 In the case of Balanced Stable Marriage, however, fixed-parameter tractability with respect to the target Bal = minµ∈SM balance(µ) trivially follows from the fact that this value is lower bounded by max{M , W }.2 Our Contribution. We introduce two "above-guarantee parameterizations" of Balanced Stable Marriage. To this end, we consider the minimum value OM of the total dissat- isfaction of men that can be realized by a stable matching, and the minimum value OW of the total dissatisfaction of women that can be realized by a stable matching. Formally, OM = P(m,w)∈µM pw(m), where µM and µW are the man- optimal and woman-optimal stable matchings, respectively. An input integer k would indicate that our objective is to decide whether Bal ≤ k. In our first parameterization, the parameter is k − min{OM , OW }, and in the second one, it is k − max{OM , OW }. In other words, we would like to answer the following questions (recall that Bal = minµ∈SM balance(µ)). pm(w), and OW = P(m,w)∈µW Above-Min Balanced Stable Marriage (Above-Min BSM) Input: An instance (M, W, LM , LW ) of Balanced Stable Marriage, and a non-negative integer k. Question: Is Bal ≤ k? Parameter: t = k − min{OM , OW } Above-Max Balanced Stable Marriage (Above-Max BSM) Input: An instance (M, W, LM , LW ) of Balanced Stable Marriage, and a non-negative integer k. Question: Is Bal ≤ k? Parameter: t = k − max{OM , OW } Before stating our results, let us explain the choice of these parameterizations. Here, note that the best satisfaction the party of men can hope for is OM , and the best satisfaction the party of women can hope for is OW . First, consider the parameter t = k − min{OM , OW }. 1If a parameterized problem cannot be solved in polynomial time even when the value of the parameter is a fixed constant (that is, independent of the input), then the problem is said to be paraNP-hard. 2We assume that any stable matching µ is perfect. We justify this assumption later. 3 Whenever we have a solution such that the amounts of satisfaction of both parties are close enough to the best they can hope for, this parameter is small. Indeed, the closer the satisfaction of both parties to the best they can hope for (which is exactly the case where both parties would find the solution desirable), the smaller the parameter is, and the smaller the parameter is, the faster a parameterized algorithm is. In other words, if there exists a solution that is desirable by both parties, our parameter is small. In the parameterization above, as we take the min of {OM , OW }, we need the satisfaction of both parties to be close to optimal in order to have a small parameter. As we are able to show that Balanced Stable Marriage is FPT with respect to this parameter, it is very natural to next examine the case where we take the max of {OM , OW }. In this case, the closer the satisfaction of at least one party to the best it can hope for, the smaller the parameter is. In other words, now the demand from a solution-while not changing the definition of a solution in any way, that is, a solution is still a stable matching µ minimizing balance(µ)-in order to have a small parameter is weaker. In the jargon of Parameterized Complexity, it is said that the parameterization by t = k − max{OM , OW } is "above a higher guarantee" than the parameterization by t = k − min{OM , OW }, since it is always the case that max{OM , OW } ≥ min{OM , OW }. Unfortunately, as we show in this paper, the parameterization by k − max{OM , OW } results in a problem that is W[1]-hard. Hence, the complexities of the two parameterizations behave very differently. We remark that in Parameterized Complexity, it is not at all the rule that when one takes an "above a higher guarantee" parameterization, the problem would suddenly become W[1]-hard, as can be evidenced by the most classical above guarantee parameterizations in this field, which are of the Vertex Cover problem. For that problem, three above guarantee parameterizations were considered in [3, 10, 15, 20], each above a higher guarantee than the previous one that was studied, and each led to a problem that is FPT. In that context, unlike our case, it is still not clear whether the bar can be raised higher. Overall, our results accurately draw the line between tractability and intractability with respect to the target value in the context of two very natural, useful parameterizations. Finally, to be more precise, we note that our work proves three main theorems: • First, we prove (in Section 3) that Above-Min BSM admits a kernel where the number of people is linear in t. For this purpose, we introduce notions that might be of independent interest in the context of a "functional" variant of Above-Min BSM. Our kernelization algorithm consists of several phases, each simplifying a different aspect of Above-Min BSM, and shedding light on structural properties of the Yes-instances of this problem. Note that this result already implies that Above-Min BSM is FPT. • Second, we prove (in Section 4) that Above-Min BSM admits a parameterized algorithm whose running time is single exponential in the parameter t. This algorithm first builds upon our kernel, and then incorporates the method of bounded search trees. • Third, we prove (in Section 5) that Above-Max BSM is W[1]-hard. This reduction is quite technical, and its importance lies in the fact that it rules out (under plausible complexity-theoretic assumptions) the existence of a parameterized algorithm for Above- Max BSM. Thus, we show that although Above-Max BSM seems quite similar to Above-Min BSM, in the realm of Parameterized Complexity, these two problems are completely different. 2 Preliminaries Let f be a function f : A → B. For a subset A′ ⊆ A, we let f A′ denote the restriction of f to A′. That is, f A′ : A′ → B, and f A′(a) = f (a) for all a ∈ A′. Throughout the paper, whenever the instance I of Balanced Stable Marriage under discussion is not clear from context or we would like to put emphasis on I, we add "(I)" to the 4 appropriate notation. For example, we use the notation t(I) rather than t. When we would like to refer to the balance of a stable matching µ in a specific instance I, we would use the notation balanceI(µ). A matching is called a perfect matching if it matches every person (to some other person). While designing our kernelization algorithm (see "Parameterized Complexity"), we might be able to determine whether the input instance is a Yes-instance or a No-instance. For the sake of clarity, in the first case, we simply return Yes, and in second case, we simply return No. To properly comply with the definition of a kernel, the return of Yes and No should be interpreted as the return of a trivial Yes-instance and a trivial No-instance, respectively. Here, a trivial Yes-instance can be the one in which M = W = ∅ and k = 0, where the only stable matching is the one that is empty and whose balance is 0, and a trivial No-instance can be the one where M = {m}, W = {w}, A(m) = {w}, A(w) = {m} and k = 0. Parameterized Complexity. A parameterization of a problem is the association of an integer k with each input instance, which results in a parameterized problem. For our purposes, we need to recall three central notions that define the parameterized complexity of a parameterized problem. The first one is the notion of a kernel. Here, a parameterized problem is said to admit a kernel of size f (k) for some function f that depends only on k if there exists a polynomial- time algorithm, called a kernelization algorithm, that translates any input instance into an equivalent instance of the same problem whose size is bounded by f (k) and such that the value of the parameter does not increase. In case the function f is polynomial in k, the problem is said to admit a polynomial kernel. Hence, kernelization is a mathematical concept that aims to analyze the power of preprocessing procedures in a formal, rigorous manner. The second notion that we use is the one of fixed-parameter tractability ( FPT). Here, a parameterized problem Π is said to be FPT if there is an algorithm that solves it in time f (k) · IO(1), where I is the size of the input and f is a function that depends only on k. Such an algorithm is called a parameterized algorithm. In other words, the notion of FPT signifies that it is not necessary for the combinatorial explosion in the running time of an algorithm for Π to depend on the input size, but it can be confined to the parameter k. Finally, we recall that Parameterized Complexity also provides tools to refute the existence of polynomial kernels and parameterized algorithms for certain problems (under plausible complexity-theoretic assumptions), in which context the notion of W[1]-hard is a central one. It is widely believed that a problem that is W[1]-hard is unlikely to be FPT, and we refer the reader to the books [2,5] for more information on this notion in particular, and on Parameterized Complexity in general. The notation O∗ is used to hide factors polynomial in the input size. Reduction Rule. To design our kernelization algorithm, we rely on the notion of a reduction rule. A reduction rule is a polynomial-time procedure that replaces an instance (I, k) of a parameterized problem Π by a new instance (I ′, k′) of Π. Roughly speaking, a reduction rule is useful when the instance I ′ is in some sense "simpler" than the instance I. In particular, it is desirable to ensure that k′ ≤ k. The rule is said to be safe if (I, k) is a Yes-instance if and only if (I ′, k′) is a Yes-instance. A Functional Variant of Stable Marriage. To obtain our kernelization algorithm for Above-Min BSM, it will be convenient to work with a "functional" definition of preferences, resulting in a "functional" variant of this problem which we call Above-Min FBSM. Here, instead of the sets of preferences lists LM and LW , the input consists of sets of preference functions FM and FW , where FM replaces LM and FW replaces LW . Specifically, every person a ∈ M ∪ W has an injective (one-to-one) function fa : A(a) → N, called a preference function. Intuitively, a lower function value corresponds to a higher preference. Since every preference function is injective, it defines a total order over a set of acceptable partners. Note that all of the definitions presented in the introduction extend to our functional variant in the natural way. 5 For the sake of formality, we specify the required adaptations below. The input of the Functional Stable Marriage problem consists of a set of men, M , and a set of women, W . Each person a has a set of acceptable partners, denoted by A(a), and an injective function fa : A(a) → N called a preference function. Without loss of generality, it is assumed that if a person a belongs to the set of acceptable partners of a person b, then the person b belongs to the set of acceptable partners of the person a. The set of preference functions of the men and the women are denoted by FM and FW , respectively. A pair of a man and a woman, (m, a), is an acceptable pair if both m ∈ A(w) and w ∈ A(m). Accordingly, the notion of a matching refers to a matching between men and women, where two people that are matched to one another form an acceptable pair. A matching µ stable if it does not have a blocking pair, which is an acceptable pair (m, w) such that (i) either m is unmatched by µ or fm(w) < fm(µ(m)), and (ii) either w is unmatched by µ or fw(m) < fw(µ(w)). The goal of the Functional Stable Marriage problem is to find a stable matching. The man-optimal stable matching, denoted by µM , is a stable matching such that every stable matching µ satisfies the following condition: every man m is either unmatched by both µM and µ or fm(µM (m)) ≤ fm(µ(m)). The woman-optimal stable matching, denoted by µW , is defined analogously. Given a stable matching µ, define balance(µ) = max{ X fm(w), X fw(m)}. (m,w)∈µ (m,w)∈µ Moreover, Bal = minµ∈SM balance(µ), where SM is the set of all stable matchings, OM = P(m,w)∈µM fw(m). Finally, Above-Min FBSM is defined as fm(w), and OW = P(m,w)∈µW follows. Above-Min Functional Balanced Stable Marriage (Above-Min FBSM) Input: An instance (M, W, FM , FW ) of Functional Balanced Stable Marriage, and a non-negative integer k. Question: Is Bal ≤ k? Parameter: t = k − min{OM , OW } From the above discussions it is straightforward to turn an instance of Above-Min BSM into an equivalent instance of Above-Min FBSM as stated in the following observation. Observation 1. Let I = (M, W, LM , LW , k) be an instance of Above-Min BSM. For each a ∈ M ∪ W , define fa : A(a) → N by setting fa(b) = pa(b) for all b ∈ A(a). Then, I is a Yes-instance of Above-Min BSM if and only if (M, W, FM = {fm}m∈M , FW = {fw}w∈W , k) is a Yes-instance of Above-Min FBSM. Known Results. Finally, we state several classical results, which were originally presented in the context of Stable Marriage. By their original proofs, these results also hold in the context of Functional Stable Marriage. To be more precise, given an instance of Functional Stable Marriage, we can construct an equivalent instance of Stable Marriage, by ranking the acceptable partners in the order of their function values, where a smaller value implies a higher preference. The instances are equivalent in the sense that they give rise to the exact same set of stable matchings. Hence, all the structural results about stable matchings in the usual setting (modeled by strict preference lists) apply to the generalized setting, modeled by injective functions. Proposition 1 ( [8]). For any instance of Stable Marriage (or Functional Stable Mar- riage), there exist a man-optimal stable matching, µM , and a woman-optimal stable matching, µW , and both µM and µW can be computed in polynomial time. The following powerful proposition is known as the Rural-Hospital Theorem. 6 Proposition 2 ( [9]). Given an instance of Stable Marriage (or Above-Min FBSM), the set of men and women that are matched is the same for all stable matchings. We further need a proposition regarding the man-optimal and woman-optimal stable match- ings that implies Proposition 2 [9]. Proposition 3 ( [11]). For any instance of Stable Marriage (or Functional Stable Marriage), every stable matching µ satisfies the following conditions: every woman w is either unmatched by both µM and µ or pw(µM (w)) ≥ pw(µ(w)), and every man m is either unmatched by both µW and µ or pm(µW (m)) ≥ pm(µ(m)). 3 Kernel In this section, we design a kernelization algorithm for Above-Min BSM. More precisely, we prove the following theorem. Theorem 3.1. Above-Min BSM admits a kernel that has at most 3t men, at most 3t women, and such that each person has at most 2t + 1 acceptable partners. 3.1 Functional Balanced Stable Marriage To prove Theorem 3.1, we first prove the following result for the Above-Min FBSM problem. Lemma 3.1. Above-Min FBSM admits a kernel with at most 2t men, at most 2t women, and such that the image of the preference function of each person is a subset of {1, 2, . . . , t + 1}. To obtain the desired kernelization algorithm, we execute the following plan. 1. Cleaning Prefixes and Suffixes. Simplify the preference functions by "cleaning" suf- fixes and thereby also "cleaning" prefixes. 2. Perfect Matching. Zoom into the set of people matched by every stable matching. 3. Overcoming Sadness. Bound the number of "sad" people. Roughly speaking, a "sad" person a is one whose best attainable partner, b, does not reciprocate by considering a as the best attainable partner. 4. Marrying Happy People. Remove "happy" people from the instance. 5. Truncating High-Values. Obtain "compact" preference functions by truncating "high- values". 6. Shrinking Gaps. Shrink some of the gaps created by previous steps. Each of the following subsections captures one of the steps above. In what follows, we let I denote our current instance of Above-Min FBSM. Initially, this instance is the input instance, but as the execution of our algorithm progresses, the instance is modified. The reduction rules that we present are applied exhaustively in the order of their presentation. In other words, at each point of time, the first rule whose condition is true is the one that we apply next. In particular, the execution terminates once the value of t drops below 0, as implied by the following rule. Reduction Rule 1. If k < max{OM , OW }, then return No. Lemma 3.3. Reduction Rule 1 is safe. Proof. For every µ ∈ SM, it holds that balance(µ) ≥ max{OM , OW }. Thus, if k < max{OM , OW }, then every µ ∈ SM satisfies balance(µ) > k. In this case, we conclude that Bal > k, and therefore I is a No-instance. Note that if k < 0, then it also holds that t < 0, and that if t < 0, then k < min{OM , OW }. We remark that by Proposition 1, it would be clear that each of our reduction rules can indeed be implemented in polynomial time. 7 Cleaning Prefixes and Suffixes. We begin by modifying the images of the preference func- tions. We remark that it is necessary to perform this step first as otherwise the following steps would not be correct. To clean prefixes while ensuring both safeness and that the parameter t does not increase, we would actually need to clean suffixes first. Formally, we define suffixes as follows. Definition 3.1. Let (m, w) denote an acceptable pair. If m is matched by µW and fm(w) > fm(µW (m)), then we say that w belongs to the suffix of m. Similarly, if w is matched by µM and fw(m) > fw(µM (w)), then we say that m belongs to the suffix of w. By Proposition 3, we have the following observation. Observation 2. Let (m, w) denote an acceptable pair such that one of its members belongs to the suffix of the other member. Then, there is no µ ∈ SM(I) that matches m with w. For every person a, let worst(a) be the person in A(a) to whom fa assigns its worst preference value. More precisely, worst(a) = argmaxb∈A(a)fa(b). We will now clean suffixes. Reduction Rule 2. If there exists a person a such that worst(a) belongs to the suffix of a, then define the preference functions as follows. • f ′ a = faA(a)\{worst(a)}. • f ′ worst(a) = fworst(a)A(worst(a))\{a}. • For all b ∈ M ∪ W \ {a, worst(a)}: f ′ The new instance is J = (M, W, {f ′ b = fb. m′ }m′∈M , {f ′ w′}w′∈W , k). Lemma 3.4. Reduction Rule 2 is safe, and t(I) = t(J ). Proof. By the definition of the new preference functions, we have that for every µ ∈ SM(I) ∩ SM(J ), it holds that P(m,w)∈µ fm(w) = P(m,w)∈µ f ′ In particular, this means that to conclude that Bal(I) = Bal(J ) (which implies safeness) as well as that OM (I) = OM (J ) and OW (I) = OW (J ) (which implies that t(I) = t(J )), it is suf- ficient to show that SM(I) = SM(J ). For this purpose, first consider some µ ∈ SM(I). By Observation 2, it holds that (a, worst(a)) /∈ µ. Hence, µ is a matching in J . Moreover, if µ has a blocking pair in J , then by the definition of the new preference functions, it is also a blocking pair in I. Since µ is stable in I, we have that µ ∈ SM(J ). m(w) and P(m,w)∈µ fw(m) = P(m,w)∈µ f ′ w(m). In the second direction, consider some µ ∈ SM(J ). Then, it is clear that µ is a matching in I. Moreover, if µ has a blocking pair (m, w) in I that is not (a, worst(a)), then (m, w) is an acceptable pair in J , and therefore by the definition of the new preference functions, we have that (m, w) is also a blocking pair in J . Hence, since µ is stable in J , the only pair that can block µ in I is (a, worst(a)). Thus, to show that µ ∈ SM(I), it remains to prove that (a, worst(a)) cannot block µ in I. Suppose, by way of contradiction, that (a, worst(a)) blocks µ in I. In particular, this means that fa(worst(a)) < fa(µ(a)). However, this contradicts the definition of worst(a). By cleaning suffixes, we actually also accomplish the objective of cleaning prefixes, which are defined as follows. Definition 3.2. Let (m, w) denote an acceptable pair. If m is matched by µM and fm(w) < fm(µM (m)), then we say that w belongs to the prefix of m. Similarly, if w is matched by µW and fw(m) < fw(µW (w)), then we say that m belongs to the prefix of w. Let us now claim that we have indeed succeeded in cleaning prefixes. 8 Lemma 3.5. Let I be an instance of Above-Min FBSM on which Reduction Rules 1 to 2 have been exhaustively applied. Then, there does not exist an acceptable pair (m, w) such that one of it members belongs to the prefix of the other one. Proof. Suppose, by way of contradiction, that there exists an acceptable pair (m, w) such that one of its members belongs to the prefix of the other one. Without loss of generality, assume that w belongs to the prefix of m. Then, fm(w) < fm(µM (m)). Since µM is a stable matching, it cannot be blocked by (m, w), which means that w is matched by µM and fw(µM (w)) < fw(m). Thus, we have that m belongs to the suffix of w, which contradicts the assumption that Reduction Rule 2 was applied exhaustively. As a direct result of this lemma, we have the following corollary. Corollary 3.1. Let I be an instance of Above-Min FBSM on which Reduction Rules 1 to 2 have been exhaustively applied. Then, for every acceptable pair (m, w) in I where m and w are matched (not necessarily to each other) by both µM and µW , it holds that fm(µM (m)) ≤ fm(w) ≤ fm(µW (m)) and fw(µW (w)) ≤ fw(m) ≤ fw(µM (w)). Perfect Matching. Having Corollary 3.1 at hand, we are able to provide a simple rule that allows us to assume that every solution matches all people. Reduction Rule 3. If there exists a person unmatched by µM , then let M ′ and W ′ denote the subsets of men and women, respectively, who are matched by µM . For each a ∈ M ′ ∪ W ′, denote A′(a) = A(a) ∩ (M ′ ∪ W ′), and define f ′ v = fvA′(v). The new instance is J = (M ′, W ′, {f ′ m}m∈M ′ , {f ′ w}w∈W ′, k). To prove the safeness of this rule, we first prove the following lemma. Lemma 3.6. Let I be an instance of Above-Min FBSM on which Reduction Rules 1 to 2 have been exhaustively applied. Then, for every person a not matched by µM , it holds that A(a) = ∅. Proof. Let a be a person not matched by µM . Then, by Proposition 2, it holds that a is not matched by any stable matching. Hence, we can assume w.l.o.g. that a is man m. First, note that A(m) cannot contain any woman w that is not matched by some stable matching, else (m, w) would have formed a blocking pair for that stable matching. Second, we claim that A(m) cannot contain a woman w that is matched by some stable matching. Suppose, by way of contradiction, that this claim is false. Then, by Proposition 2, it holds that A(m) contains a woman w that is matched by µM . We have that w prefers µM (w) over m, else (m, w) would have formed a blocking pair for µM , which is impossible as µM is a stable matching. However, this implies that m belongs to the suffix of w, which contradicts the supposition that Reduction Rule 2 has been exhaustively applied. We thus conclude that A(a) = ∅. Lemma 3.7. Reduction Rule 3 is safe, and t(I) = t(J ). Proof. By the definition of the new preference functions, we have that for every µ ∈ SM(I) ∩ SM(J ), it holds that P(m,w)∈µ fm(w) = P(m,w)∈µ f ′ m(w) and P(m,w)∈µ fw(m) = P(m,w)∈µ f ′ w(m). To conclude that the lemma is correct, it is thus sufficient to argue that SM(I) = SM(J ). For this purpose, first consider some µ ∈ SM(I). By Proposition 2, we have that µ is also a match- ing in J . Moreover, if µ has a blocking pair in J , then by the definition of the new preference functions, it is also a blocking pair in I. Since µ is stable in I, we have that µ ∈ SM(J ). In the second direction, consider some µ ∈ SM(J ). Then, it is clear that µ is a matching in I. By Lemma 3.6, if µ has a blocking pair (m, w) in I, then both m ∈ M ′ and w ∈ W ′. However, for such a blocking pair (m, w), we have that (m, w) is an acceptable pair in J , and therefore by the definition of the new preference functions, we have that (m, w) is also a blocking pair in J . Hence, since µ is stable in J , we conclude that µ is also stable in I. 9 By Proposition 2, from now onwards, we have that for the given instance, any stable match- ing is a perfect matching. Due to this observation, we can denote n = M = W , and for any stable matching µ, we have the following equalities. X fm(w) = X (m,w)∈µ m∈M fm(µ(m)); X fw(m) = X (m,w)∈µ w∈W fw(µ(w)). (I) Overcoming Sadness. As every stable matching is a perfect matching, every person is matched by every stable matching, including the man-optimal and woman-optimal stable match- ings. Thus, it is well defined to classify the people who do not have the same partner in the man-optimal and woman-optimal stable matchings as "sad". That is, Definition 3.3. A person a ∈ M ∪ W is sad if µM (a) 6= µW (a). We let MS and WS denote the sets of sad men and sad women, respectively. People who are not sad are termed happy. Accordingly, we let MH and WH denote the sets of happy men and happy women, respectively. Note that MS = ∅ if and only if WS = ∅. Moreover, note that by the definition of µM and µW , for a happy person a it holds that a and µM (a) = µW (a) are matched to one another by every stable matching. Let us now bound the number of sad people in a Yes-instance. Reduction Rule 4. If MS > 2t or WS > 2t, then return No. Lemma 3.8. Reduction Rule 4 is safe. Proof. We only prove that if MS > 2t, then I is a No-instance, as the proof of the other case is symmetric to this one. Let us assume that MS > 2t. Suppose, by way of contradiction, that I is a Yes-instance. Then, there exists a stable matching µ such that balance(µ) ≤ k. Partition S ⊎ M ′′ MS = M ′ S to be the set of all m in MS such that m is not the partner of µ(m) in µW . S as follows. Set M ′ Accordingly, set M ′′ larger than t. Let us first handle the case where M ′ S = MS \M ′ M ′ S = {m ∈ MS fµ(m)(m) > fµ(m)(µW (µ(m)))}. S. Since MS > 2t, at least one among M ′ S > t. Then, S and M ′′ S is (strictly) X w∈W {w µ(w)∈M ′ S } fw(µ(w)) = X ≥ X = X fw(µ(w)) + X [fw(µW (w)) + 1] + X {w µ(w) /∈M ′ S} fw(µ(w)) fw(µW (w)) {w µ(w)∈M ′ S } fw(µW (w)) + X S } {w µ(w) /∈M ′ 1 = OW + M ′ S w∈W {w µ(w)∈M ′ S } > OW + t ≥ k. Here, the first inequality followed directly from the definition of M ′ S > t. However, we now have that S. As we have reached a X contradiction, it must hold that M ′′ fm(µ(m)) = X ≥ X = X m∈M m∈M ′′ S m∈M ′′ S fm(µ(m)) m /∈M ′′ S fm(µ(m)) + X [fm(µM (m)) + 1] + X fm(µM (m)) + X m /∈M ′′ S fm(µM (m)) 1 = OM + M ′′ S m∈M {m µ(m)∈M ′′ S } 10 > OM + t ≥ k. Here, the first inequality followed from the definition of M ′′ S , we have that fµ(m)(m) ≤ fµ(m)(µW (µ(m))), else m would have belonged to M ′ S. However, in this case we deduce that m = µW (µ(m)), and since m ∈ MS, we have that µ(m) 6= µM (m), which implies that fm(µ(m)) ≥ fm(µM (m)) + 1. As we have again reached a contradiction, we conclude the proof. S . Indeed, for all m ∈ M ′′ Marrying Happy People. Towards the removal of happy people, we first need to handle the special case where there are no sad people. In this case, there is exactly one stable matching, which is the man-optimal stable matching (that is equal, in this case, to the woman-optimal stable matching). This immediately implies the safeness of the following rule. Reduction Rule 5. If MS = WS = ∅, then return Yes if balance(µM ) ≤ k and No otherwise. Observation 3. Reduction Rule 5 is safe. We now turn to discard happy people. When we perform this operation, we need to ensure that the balance of the instance is preserved. More precisely, we need to ensure that Bal(I) = Bal(J ), where J denotes the new instance resulting from the removal of some happy people. Towards this, we let (mh, wh) denote a happy pair, which is simply a pair of a happy man and happy woman who are matched to each other in every stable matching. Then, we redefine the preference functions in a manner that allows us to transfer the "contributions" of mh and wh from Bal(I) to Bal(J ) via some sad man and woman. We remark that these sad people exist because Reduction Rule 5 does not apply. The details are as follows. Reduction Rule 6. If there exists a happy pair (mh, wh), then proceed as follows. Select an arbitrary sad man ms and an arbitrary sad woman ws. Denote M ′ = M \ {mh} and W ′ = W \ {wh}. For each person a ∈ M ′ ∪ W ′, the new preference function f ′ a : A(a) \ {mh, wh} → N is defined as follows. • The preference function of ms. For each w ∈ A(ms) \ {wh}: f ′ ms(w) = fms(w) + fmh(wh). • The preference function of ws. For each m ∈ A(ws) \ {mh}: f ′ ws(m) = fws(m) + fwh(mh). • For each w ∈ W ′ \ {ws}: f ′ w = fwM ′. • For each m ∈ M ′ \ {ms}: f ′ m = fmW ′. The new instance is J = (M ′, W ′, {f ′ m}m∈M ′, {f ′ w}w∈W ′, k). Let us first state a lemma concerning the proof of the forward direction of the safeness of Reduction Rule 6. Lemma 3.9. Let µ ∈ SM(I). Then, µ′ = µ \ {(mh, wh)} is a stable matching in J such that balanceJ (µ′) = balanceI (µ). Proof. We first show that µ′ ∈ SM(J ). By Reduction Rule 3, it holds that µ is a perfect matching in I. Since (mh, wh) is a happy pair, it is clear that (mh, wh) ∈ µ, and therefore µ′ is a perfect matching in J . Let (m, w) /∈ µ′ be some acceptable pair in J . Since µ ∈ SM(I) and it is a perfect matching, it holds that fm(w) > fm(µ(m)) or fw(m) > fw(µ(w)). Let us consider these two possibilities separately. • Suppose that fm(w) > fm(µ(m)). If m 6= ms, then f ′ m(µ′(m)). Else, f ′ fm(µ(m)), and therefore f ′ m(µ′(m)) = fm(µ(m)) + fmh(wh), and therefore again f ′ f ′ m(w) > f ′ m(w) = fm(w) and f ′ m(µ′(m)) = m(w) = fm(w) + fmh(wh) and m(w) > f ′ m(µ′(m)). 11 • Suppose that fw(m) > fw(µ(w)). Analogously to the previous case, we get that f ′ w(m) > w(µ′(w)). f ′ Since the choice of (m, w) was arbitrary, we conclude that µ′ does not have a blocking pair in J , and therefore µ′ ∈ SM(J ). To show that balanceJ (µ′) = balanceI (µ), note that balanceJ (µ′) = max{ X m(µ′(m)), X f ′ f ′ w(µ′(w))} = max{f ′ m∈M \{mh} ms(µ′(ms)) + X w∈W \{wh} f ′ m(µ′(m)), m∈M \{mh,ms} ws(µ′(ws)) + X f ′ = max{fms(µ(ms)) + fmh(wh) + X w∈W \{wh,ws} f ′ w(µ′(w))} fm(µ(m)), fws(µ(ws)) + fwh(mh) + X m∈M \{mh,ms} fw(µ(w))} = max{ X fm(µ(m)), X m∈M w∈W w∈W \{wh,ws} fw(µ(w))} = balanceI (µ). This concludes the proof. To prove a lemma addressing the reverse direction, we first state the following observation, whose correctness follows directly from Corollary 3.1. Observation 4. Let I be an instance of Above-Min FBSM on which Reduction Rules 1 to 2 have been exhaustively applied. Then, for every happy pair (mh, wh), it holds that A(mh) = {wh} and A(wh) = {mh}. Lemma 3.10. Let µ′ ∈ SM(J ). Then, µ = µ′ ∪ {(mh, wh)} is a stable matching in I such that balanceI(µ) = balanceJ (µ′). Proof. We first show that µ ∈ SM(I). By Reduction Rule 3, it holds that µ′ is a perfect matching in J . Since (mh, wh) is a happy pair and by Observation 4, we have that µ is a perfect matching in I such that neither mh nor wh participate in any pair that blocks µ (if such a pair exists). Let (m, w) /∈ µ′ be some acceptable pair in I such that m 6= mh and w 6= wh. Since µ′ ∈ SM(J ) and it is a perfect matching, it holds that f ′ m(µ′(m)) or f ′ w(m) > f ′ w(µ′(w)). Let us consider these two possibilities separately. m(w) > f ′ • Suppose that f ′ m(w) > f ′ m(µ(m)). If m 6= ms, then fm(w) = f ′ m(µ′(m)), and therefore fm(w) > fm(µ(m)). Else, fm(w) = f ′ f ′ fm(µ(m)) = f ′ m(µ′(m)) − fmh(wh), and therefore again fm(w) > fm(µ(m)). m(w) and fm(µ(m)) = m(w) − fmh(wh) and • Suppose that f ′ w(m) > f ′ w(µ′(w)). Analogously to the previous case, we get that fw(m) > fw(µ(w)). Since the choice of (m, w) was arbitrary, we conclude that µ does not have a blocking pair in I, and therefore µ ∈ SM(I). To show that balanceI(µ) = balanceJ (µ′), we follow the exact same argument as the one present in the proof of Lemma 3.9. We now turn to justify the use of Reduction Rule 6. Lemma 3.11. Reduction Rule 6 is safe, and t(I) = t(J ). 12 Proof. By Lemmata 3.9 and 3.10, it holds that Bal(I) = Bal(J ), and that both balanceI(µM (I)) = balanceJ (µM (J )) and balanceI (µW (I)) = balanceJ (µW (J )). As the argument k remained un- touched, we have that Reduction Rule 6 is safe as well as that t(I) = t(J ). Before we proceed to examine preference functions more closely, let us take a step back and prove the following result. Lemma 3.12. Given an instance I of Above-Min FBSM, one can exhaustively apply Reduc- tion Rules 1 to 6 in polynomial time to obtain an instance J such that t(J ) ≤ t(I). All people in J are sad and matched by every stable matching, and there exist at most 2t men and at most 2t women. Proof. Notice that each rule among Reduction Rules 1 to 6 can be applied in polynomial time, and it either terminates the execution of the algorithm or shrinks the size of the instance. Hence, it is clear that the instance J is obtained in polynomial time, and the claim that t(J ) ≤ t(I) follows from Lemmata 3.7 and 3.11. Due to Reduction Rules 3 and 6, we have that all people in J are sad and matched by every stable matching. Thus, due to Reduction Rule 4, we also have that there exist at most 2t men and at most 2t women. Truncating High-Values. Up until now, we have bounded the number of people. However, the images of the preference functions can contain integers that are not bounded by a function polynomial in the parameter. Thus, even though the number of people is upper bounded by 4t, the total size of the instance can be huge. Accordingly, in what follows, we need to process the images of the preference functions. Recall that we have already modified preference functions so that they would not contain irrelevant information in their prefixes and suffixes. Our current goal is to truncate "high-values"' of preference functions. To understand the intuition behind the rule we present next, suppose that there exists a stable matching µ and a man m such that fm(µ(m)) > t + fm(µM (m)). That is, µ matches m to a woman whose position is larger than the position of the woman with whom m is matched by µM by at least t units. Then, balance(µ) ≥ Pm′∈M fm′(µ(m′)) > OM + t ≥ k. Hence, irrespective of whether or not the current instance is a Yes-instance, we know that µ is not a yes-certificate. We thus observe that we should delete all those acceptable pairs whose presence in any stable matching prevents its balance from being upper bounded by k. Formally, Reduction Rule 7. If there exists an acceptable pair (m, w) such that fm(w) > (k − OM ) + fm(µM (m)) or fw(m) > (k − OW ) + fw(µW (w)), then define the preference functions as follows: • f ′ m = fmA(m)\{w}. • f ′ w = fwA(w)\{m}. • For all a ∈ M ∪ W \ {m, w}: f ′ a = fa. The new instance is J = (M, W, {f ′ m′ }m′∈M , {f ′ w′}w′∈W , k). Lemma 3.13. Reduction Rule 7 is safe, and t(I) ≥ t(J ). Proof. Without loss of generality, suppose that fm(w) > (k − OM (I)) + fm(µM (m)). Due to Reduction Rule 1, we have that k − OM (I) ≥ 0, and therefore fm(w) > fm(µM (m)), which implies that w 6= µM (m). We thus have that µM (I) is also a matching in J , and due to Corollary 3.1, we deduce that µM (I) = µM (J ). First, we would like to show that t(I) ≥ t(J ). For this purpose, it is sufficient to show that OM (I) ≤ OM (J ) and OW (I) ≤ OW (J ). Since µM (I) = µM (J ), it is clear that OM (I) = OM (J ). By Reduction Rule 3, µM (I) matches all people in I. Thus, by Proposition 2 and since µM (I) = µM (J ), we have that µW (J ) matches all people in J , and hence all people in I. By Corollary 3.1, for any woman w and the man m 13 most preferred by w in J , it holds that w does not prefer m over µW (w) in I. Thus, by the definition of the preference functions, we have that OW (I) ≤ OW (J ). To show that the rule is safe, we need to show that Bal(I) ≤ k if and only if Bal(J ) ≤ k. For this purpose, let us first suppose that Bal(I) ≤ k. Then, there exists µ ∈ SM(I) such that balanceI(µ) ≤ k. Notice that if µ(m) = w, then since fm(w) > (k − OM ) + fm(µM (m)) and by the equations in "Perfect Matching", we have that k ≥ balanceI(µ) fm′(µ(m′)) ≥ X ≥ (k − OM (I)) + X m′∈M fm′(µM (m′)) > (k − OM (I)) + OM (I), m′∈M which is a contradiction. Hence, (m, w) /∈ µ. Therefore, µ is a matching in J . By the definition of the new preference functions, if µ has a blocking pair in J , then this pair also blocks µ in I. Since µ is stable in I, we have that µ is also stable in J . Now, by our definition of the new preference functions, we have that balanceI (µ) = balanceJ (µ). Since balanceI (µ) ≤ k, we thus conclude that Bal(J ) ≤ k. In the second direction, suppose that Bal(J ) ≤ k. Then, there exists µ ∈ SM(J ) such that balanceJ (µ) ≤ k. Clearly, µ is also a matching in I. Moreover, by the definition of the preference functions, every acceptable pair in I that is also present in J cannot block µ in I, else it would have also blocked µ in J . Thus, if µ has a blocking pair in I, then this pair must be (m, w). We claim that (m, w) cannot block µ in I, which would imply that µ ∈ SM(I). Suppose, by way of contradiction, that this claim is not true. Recall that we have already proved that µM (I) = µM (J ). Let us denote µM = µM (I). We have that µ matches m, which implies that fm(µ(m)) > fm(w). Since fm(w) > (k−OM (I))+fm(µM (m)), we deduce that fm(µ(m)) > (k− OM (I)) + fm(µM (m)). Furthermore, since f ′ m(µM (m)) = fm(µM (m)) and OM (I) = OM (J ), we get that f ′ m(µM (m)). However, we then have that m(µ(m)) > (k − OM (J )) + f ′ m(µ(m)) = fm(µ(m)), f ′ k ≥ balanceJ (µ) f ′ m′(µ(m′)) ≥ X ≥ (k − OM (J )) + X m′∈M m′(µM (m′)) > (k − OM (J )) + OM (J ), f ′ m′∈M which is a contradiction. Therefore, µ ∈ SM(I). The definition of the new preference functions imply that balanceI (µ) = balanceJ (µ). Since balanceJ (µ) ≤ k, we conclude that Bal(I) ≤ k. Shrinking Gaps. Currently, there might still exist a man m or a woman w such that fm(µM (m)) > 1 or fw(µW (w)) > 1, respectively. In the following rule, we would like to decrease some values assigned by the preference functions of such men and women in a manner that preserves equivalence. Reduction Rule 8. If there exist m ∈ M and w ∈ W such that fm(µM (m)) > 1 and fw(µW (w)) > 1, then define the preference functions as follows. • The preference function of m. For all w′ ∈ A(m): f ′ m(w′) = fm(w′) − 1. • The preference function of w. For all m′ ∈ A(w): f ′ w(m′) = fw(m′) − 1. • For all a ∈ M ∪ W \ {m, w}: f ′ a = fa. The new instance is J = (M, W, {f ′ m′ }m′∈M , {f ′ w′}w′∈W , k − 1). 14 Lemma 3.14. Reduction Rule 8 is safe, and t(I) = t(J ). Proof. Let us first observe that the set of acceptable pairs in I is equal to the set of acceptable pairs of J . Furthermore, for every person a, including the cases where this person is either m or w, any two acceptable partners b and b′ of a that satisfy fa(b) < fa(b′) also satisfy f ′ a(b′), and vice versa. Indeed, this observation follows directly from our definition of the new preference functions. In other words, if a person prefers some person over another in I, then this person also has the same preference order in J , and vice versa. We thus deduce that SM(I) = SM(J ). We proceed by claiming that for all µ ∈ SM(I), we have that balanceI(µ) = balanceJ (µ) + Indeed, by the definition of the new preference functions and the equations in "Perfect a(b) < f ′ 1. Matching", we have that balanceI (µ) = max{ X fm′(µ(m′)), X m′∈M = max{fm(µ(m)) + X w′∈W fw′(µ(w′))} fm′(µ(m′)), fw(µ(w)) + X fw′(µ(w′))} m′∈M \{m} = max{f ′ = max{ X m(µ(m)) + 1 + X m′(µ(m′)), X f ′ m′(µ(m′)), f ′ f ′ w′∈W \{w} w(µ(w)) + 1 + X w′(µ(w′))} f ′ m′∈M \{m} w′(µ(w′))} + 1 = balanceJ (µ) + 1. f ′ w′∈W \{w} m′∈M w′∈W Furthermore, the arguments above also show that OM (I) = OM (J ) + 1 and OW (I) = OW (J ) + 1. Hence, we have that Bal(I) = Bal(J ) + 1. Since k was decreased by 1, we conclude that the rule is safe and that t(I) = t(J ). The usefulness of Reduction Rule 8 lies in the observation that after the exhaustive appli- cation of this rule, at least one of the two parties does not have any member without a person assigned 1 by his/her preference function. More precisely, Observation 5. Let I be an instance of Above-Min FBSM that is reduced with respect to Reduction Rules 1 to 8. Then, either (i) for every m ∈ M , we have that fm(µM (m)) = 1, or (ii) for every w ∈ W , we have that fw(µW (w)) = 1. In particular, either (i) OM = M or (ii) OW = W . This concludes the description of our reduction rules. We are now ready to prove Lemma 3.1. Proof of Lemma 3.1. Given an instance I of Above-Min FBSM, our kernelization algorithm exhaustively applies Reduction Rules 1 to 8, after which it outputs the resulting instance, J , as the kernel. Notice that each rule among Reduction Rules 1 to 8 can be applied in polynomial time, and it either terminates the execution of the algorithm or shrinks the size of the instance. Hence, it is clear that the instance J is obtained in polynomial time. The claims that J and I are equivalent and that t(J ) ≤ t(I) follow directly from the lemmata that prove the safeness of each rule as well as argue with respect to the parameter. By Lemma 3.12, we also have that the instance contains at most 2t (sad) men and at most 2t (sad) women. It remains to show that the image of the preference function of each person is a subset of {1, 2, . . . , t + 1}. By Reduction Rule 7, every acceptable pair (m, w) satisfies fm(w) ≤ (k − OM ) + fm(µM (m)) and fw(m) ≤ (k − OW ) + fw(µW (w)). Moreover, for every acceptable pair (m, w), it holds that fm(µM (m)) ≤ OM −(M −1) and fw(µW (w)) ≤ OW −(W −1). Thus, every acceptable pair (m, w) satisfies fm(w) ≤ k − (M − 1) and fw(m) ≤ k − (W − 1). By Reduction Rule 3 and Observation 5, we have that t = k − min{OM , OW } = k − M = k − W . Hence, we further conclude that every acceptable pair (m, w) satisfies fm(w) ≤ t + 1 and fw(m) ≤ t + 1. 15 3.2 Balanced Stable Marriage Having proved Lemma 3.1, we have a kernel for Above-Min FBSM. We would like to employ this kernelization algorithm to design one for Above-Min BSM. For this purpose, we need to remove gaps from preference functions. Once we do this, we can view preference functions as preference lists and obtain the desired kernel. In what follows, we describe our kernelization algorithm for Above-Min BSM. Let K = (M ′, W ′, LM ′, LW ′, k′) be the input instance, which is an instance of Above-Min BSM. Our algorithm begins by applying the reduction given by Observation 1 to translate K into an instance I ′ = (M ′, W ′, FM ′, FW ′, k′) of Above-Min FBSM. Then, our algorithm applies the kernelization algorithm given by Lemma 3.1 to I ′, obtaining a reduced instance I = (M, W, FM , FW , k) of Above-Min FBSM. By Lemma 3.1, this instance has at most 2t men, at most 2t women, and the image of the preference function of each person is a subset of {1, 2, . . . , t + 1}. To eliminate "gaps" in the preference functions, the algorithm proceeds as described below. Note that we no longer apply any reduction rule from Section 3.1 (even if its condition is satisfied), as we currently give a new kernelization procedure rather than an extension of the previous one. Let us first formally define the notion of a gap. Definition 3.4. Let a ∈ M ∪ W , and i be positive integer outside the image of f . If there exists an integer j > i that belongs to the image of f , then fa is said to have a gap at i. Inserting Dummies. We have ensured that the largest number in the image of any preference function is at most t + 1. As every person is sad, it has at least two acceptable partners, and hence it has at most t − 1 ≤ t gaps. To handle the gaps of all people, we create a set of t dummy men and t dummy women. Our objective is to introduce these dummy people as acceptable partners for people who have gaps in their preference functions, such that the function values of the dummy people would fill the gaps. In the context of the following rule, note that currently there are no happy people, and hence this rule would be applied (only once). Reduction Rule 9. If there do not exist happy people, then let X = {x1, x2, . . . , xt} denote a set of new (dummy) men, and Y = {y1, y2, . . . , yt} denote a set of new (dummy) women. For each i ∈ {1, 2, . . . , t}, initialize A(xi) = {yi}, A(yi) = {xi} and fxi(yi) = fyi(xi) = 1. The new instance is J = (M ∪ X, W ∪ Y, {fm}m∈M ∪X , {fw}w∈W ∪Y , k + t). We note that for all i ∈ {1, 2, . . . , t}, it holds that (xi, yi) is a happy pair. Lemma 3.15. Reduction Rule 9 is safe, and t(I) = t(J ). Proof. For all i ∈ {1, 2, . . . , t}, it holds that (xi, yi) is a happy pair, and therefore it is present in every stable matching in J . By our definition of the new preference functions, it is clear that if µ is a stable matching in I, then µ′ = µ ∪ {(x1, y1), . . . , (xt, yt)} is a stable matching in J . Moreover, if µ′ is a stable matching in J , then µ = µ′\{(x1, y1), . . . , (xt, yt)} is a stable matching in I. Hence, since for all i ∈ {1, 2, . . . , t}, it holds that fxi(yi) = fyi(xi) = 1, our definition of the new preference functions directly implies that Bal(I) + t = Bal(J ), OM (I) + t = OM (J ) and OW (I) + t = OW (J ). Hence, t(I) = t(J ), which concludes the proof. Reduction Rule 10. [Male version] If there exists m ∈ M such that fm has a gap at some j, then select some yi ∈ Y \ A(m), and set A′(m) = A(m) ∪ {yi} and A′(yi) = A(yi) ∪ {m}. The preference functions are defined as follows. • The preference function of m. f ′ m(yi) = j, and for all a ∈ A(m), f ′ m(a) = fm(a). • The preference function of yi. f ′ yi(m) = max m′∈A(yi) (fyi(m′) + 1), and for all a ∈ A(yi), f ′ yi(a) = fyi(a). 16 • For all a ∈ (M ∪ W ) \ {m, yi}: f ′ a = fa. The new instance is J = (M, W, {f ′ w′}w′∈W , k). Lemma 3.16. Reduction Rule 10 is safe, and t(I) = t(J ). m′ }m′∈M , {f ′ Proof. The only modifications that are performed are the insertion of m intro the set of ac- ceptable partners of yi as the least preferred person, and the insertion of yi into the set of acceptable partners of m in a location that previosuly contained a gap. Let us first observe that since fxi(yi) = fyi(xi) = 1 and f ′ yi(xi) = 1, it holds that (xi, yi) is a happy pair in both I and J . Hence, it is clear that SM(I) = SM(J ), OM (I) = OM (J ), OW (I) = OW (J ), and that the balance of any stable matching in I is equal to its balance in J . We thus conclude that the rule is safe and that t(I) = t(J ). xi(yi) = f ′ Analogously, we have a female version of Reduction Rule 10 where we fill a gap in the preference function of some woman w ∈ W . We do not repeat our arguments again, and straightaway state the following result, which follows directly from the safeness of Reduction Rule 9 and the male and female versions of Reduction Rule 10. Lemma 3.17. Above-Min FBSM admits a kernel that has at most 3t men among whom at most 2t are sad, at most 3t women among whom at most 2t are sad, and such that each happy person has at most 2t + 1 acceptable partners and each sad person has at most t + 1 acceptable partners. Finally, we translate the kernel for Above-Min FBSM to an instance of Above-Min BSM as follows. For all a ∈ M ∪ W and b ∈ A(a), we set pa(b) = fa(b). The new instance is J = (M, W, {pm}m∈M , {fw}w∈W , k). Clearly, we thus obtain an equivalent instance, which leads us to the following somewhat stronger version of Theorem 3.1, relevant to Appendix 4. Lemma 3.18. Above-Min BSM admits a kernel that has at most 3t men among whom at 2t are sad, at most 3t women among whom at most 2t are sad, and such that each happy person has at most 2t + 1 acceptable partners and each sad person has at most t + 1 acceptable partners. Moreover, every stable matching in the kernel is a perfect matching. This concludes the proof of Theorem 3.1. 4 Parameterized Algorithm In this section, we design a parameterized algorithm for Above-Min BSM. More precisely, we prove the following theorem. Theorem 4.1. Above-Min BSM can be solved in time O∗(8t). As our algorithm is based on the method of bounded search trees, we first give a brief description of this technique. 4.1 Bounded Search Tree The running time of an algorithm that uses bounded search trees can be analyzed as follows (see, e.g., [2]). Suppose that the algorithm executes a branching rule which has ℓ branching options (each leading to a recursive call with the corresponding parameter value), such that, in the ith branch option, the current value of the parameter decreases by bi. Then, (b1, b2, . . . , bℓ) is called the branching vector of this rule. We say that α is the root of (b1, b2, . . . , bℓ) if it is the (unique) = xb∗−b1 + xb∗−b2 + · · · + xb∗−bℓ, where b∗ = max{b1, b2, . . . , bℓ}. If r > 0 positive real root of xb∗ is the initial value of the parameter, and the algorithm (a) returns a result when (or before) the parameter is negative, and (b) only executes branching rules whose roots are bounded by a constant c > 0, then its running time is bounded by O∗(cr). 17 4.2 Description of the Algorithm Given an instance bI = (cM ,cW , bLM , bLW ,bk) of Above-Min BSM, we begin by using the pro- cedure given by Lemma 3.18 to obtain (in polynomial time) a kernel I = (M, W, LM , LW , k) of Above-Min BSM such that I has at most 3t men among whom at most 2t are sad, at most 3t women among whom at most 2t are sad. Let us denote the happy pairs in I by (x1, y1), (x2, y2), . . . , (xh, yh) for the appropriate h ≤ t, and the set of sad men by MS. Note that MS ≤ 2t. We proceed by executing a loop where each iteration corresponds to a different subset M ′ ⊆ MS. For a specific iteration, our goal is to determine whether there exists a stable matching µ such that the following conditions are satisfied: • balance(µ) ≤ k. • For all m ∈ M ′: µ(m) 6= µM (m). • For all m ∈ MS \ M ′: µ(m) = µM (m). A stable matching satisfying the conditions above (in the context of the current iteration) is said to be valid. We denote r = k − OM , and observe that r ≤ t. Let us now consider some specific iteration. To determine whether there exists a valid stable matching, our plan is to execute a branching procedure, called Branch, which outputs every set S of pairs of a man in M ′ and a woman, such that the following conditions are satisfied. 1. Every man m in M ′ participates in exactly one pair (m, w) of S, and for that unique pair, it holds that w ∈ A(m) and pm(w) > pm(µM (m)). 2. X m∈M ′ (pm(µ(m)) − pm(µM (m))) ≤ r. The description of this procedure is given in the following subsection. Here, let us argue that by having this procedure, we can conclude the proof of the correctness of the algorithm. In the current iteration, we examine each set S in the outputted family of sets. Then, we check whether the pairs in S, together with (x1, y1), (x2, y2), . . . , (xh, yh) and every pair in {(m, µM (m)) : m ∈ M ′} form a stable matching whose balance is at most k. If the answer is positive, then we terminate the execution and accept, which is clearly correct. At the end, if we did not accept in any iteration, we reject. To see why this decision is correct, suppose that there exists a stable matching µ whose balance is at most k. In this case, due to our exhaustive search, there exists some iteration in which µ is also valid. In that iteration, associated with some M ′ ⊆ M −S, observe that the set of pairs {(m, µ(m)) : m ∈ M ′} is one of the outputted sets of pairs. Indeed, the satisfaction of Condition 1 follows from the fact that µ is a stable matching satisfying the last two conditions of validity, and Condition 2 follows from the fact that µ satisfies the first condition of validity. Let us denote by T the running of the procedure Branch. Then, the total running time of our algorithm is bounded by O∗(2MS · T ) = O∗(4t · T ), and therefore to derive the running time in Theorem 4.1, we will need to ensure that T = O∗(2t). For this purpose, it is sufficient to ensure that T = O∗(2r). 4.3 The Branching Procedure We now present the description of the procedure Branch in the context of some set M ′ ⊆ MS. Let us denote M ′ = {m1, m2, . . . , mp} for the appropriate p. Each call to our procedure is of the form Branch(i, S) where i ∈ {0, 1, . . . , p + 1} and S is a set of pairs of a man in {m1, m2, . . . , mi} and a woman, such that the following conditions are satisfied. 18 1. Every man m in {m1, m2, . . . , mi} participates in exactly one pair (m, w) of S, and for that unique pair, it holds that w ∈ A(m) and pm(w) > pm(µM (m)). We define µS as the function whose domain is {m1, m2, . . . , mi} and which assigns to each man m in its domain the unique woman w such that (m, w) ∈ S. 2. Define balance(S) = X (pm(µS(m)) − pm(µM (m))). Then, balance(S) ≤ r. m∈{m1,m2,...,mi} Note that in case i = 0, we have that S = ∅. The call to Branch that is performed by the algorithm given in Section 4.2 is precisely with these arguments, that is, Branch(0, ∅). The objective of a call Branch(i, S) is to return a family F of sets, where each set F ∈ F is a set of pairs of a man in {mi+1, mi+2, . . . , mp} and a woman, such that the following conditions are satisfied. 1. Every man m in {mi+1, mi+2, . . . , mp} participates in exactly one pair (m, w) of F , and for that unique pair, it holds that w ∈ A(m) and pm(w) > pm(µM (m)). We define µF as the function whose domain is {mi+1, mi+2, . . . , mp} and which assigns to each man m in its domain the unique woman w such that (m, w) ∈ F . 2. balance(S) + X m∈{mi+1,mi+2,...,mp} (pm(µF (m)) − pm(µM (m))) ≤ r. Clearly, by accomplishing this goal, we also achieve the objective posed in Section 4.2. The measure that we employ to analyze our procedure is (r − balance(S)) (recall that balance(S) is defined in Condition 2 of the specification of a call), which is initially equal to r. Hence, according to the method of bounded search trees (see Section 4.1), to derive the running time O∗(2r), it is sufficient to ensure that Branch (a) returns a result when (or before) the measure r is negative, and (b) only executes branching rules whose roots are bounded by 2. When the measure r is negative, we should simply return F = ∅, as there does not exist a set F satisfying the conditions above. Otherwise, when i = p + 1, we can simply return F = {∅}. Let us now consider a call Branch(i, S) where r ≥ 0 and i ≤ p. Denote fW = {w ∈ A(mi+1) : pmi+1(w) > pmi+1(µM (mi+1))}. We further refine fW be letting W ∗ denote the set of those r women in fW who are the most preferred by mi+1. In case there are no such r women since fW < r, we simply denote W ∗ = fW . Let us also denote W ∗ = {w1, w2, . . . , wq} for the appropriate q ≤ r. Then, our procedure executes r branches. At the jth branch, Branch calls itself recursively with (i + 1, S ∪ {(mi+1, wj)}). Eventually, Branch returns Sq j=1{{(mi+1, wj)} ∪ Fj : F ∈ Fj} where for all j ∈ {1, 2 . . . , q}, we set Fj to be the family of sets of pairs that was returned by the recursive call of the jth branch. The correctness follows from the observation that the process that we execute is an exhaustive search. More precisely, if there exists a set F satisfying Conditions 1 and 2, then it must include exactly one of the pairs in {(mi+1, wj) : j ∈ {1, 2, . . . , q}}. Now, let us observe that at the jth branch, the measure changes from r−balance(S) to r−balance(S ∪{(mi+1, wj)}). By our definition of wj, we have that pmi+1(wj)− pmi+1(µM (mi+1))) = j. Hence, at the worst case, the branching vector is (1, 2, . . . , r). Since the root of such a branching vector upper bounded by 2, our proof is complete. 5 Hardness In this section, we prove the following theorem. Theorem 5.1. Above-Max BSM is W[1]-hard. For this purpose, we consider the Clique problem, which is defined as follows. 19 Clique Input: A graph G = (V, E), and a positive integer k. Question: Does G contain a clique on k vertices? Parameter: k. The Clique problem is known to be W[1]-hard [4]. Thus, to prove Theorem 5.1, it is sufficient to prove the following result. Lemma 5.1. Given an instance I = (G = (V, E), k) of Clique, an equivalent instance bI = (M, W, LM , LW ,bk) of Above-Max BSM such that t = 6(k + time O(f (k) · IO(1)) for some function f . ) can be constructed in k(k − 1) 2 The rest of this section focuses on the proof of Lemma 5.1. To this end, we let I = (G = (V, E), k) be some instance of Clique. In Section 5.1, we construct (in "FPT time") an explanation of the intuition underlying the construction. Then, in Section 5.2, we verify that instance bI = (M, W, LM , LW ,bk) of Above-Max BSM. This section also contains an informal the parameter t associated with bI is equal to 6(k + prove that the input instance I of Clique and our instance bI of Above-Max BSM are equivalent. denote V = {v1, v2, . . . , vV } and E = {e1, e2, . . . , eE}. In what follows, we select arbitrary orders on V and E, according to which we ). Finally, in Section 5.3, we k(k − 1) 2 5.1 Reduction First, to construct the sets M and W , we define three pairwise-disjoint subsets of M , called MV , ME and fM , and three pairwise-disjoint subsets of W , called WV , WE and fW . Then, we set M = MV ∪ ME ∪ fM ∪ {m∗} and W = WV ∪ WE ∪fW ∪ {w∗}, where m∗ and w∗ denote a new man and a new woman (which do not belong to the six sets defined previously), respectively. • MV = {mi v : v ∈ V, i ∈ {1, 2}}; WV = {wi v : v ∈ V, i ∈ {1, 2}}. • ME = {mi e : e ∈ E, i ∈ {1, 2}}; WE = {wi e : e ∈ E, i ∈ {1, 2}}. • Let δ = 2(V + E + V E + V E2) − k(4 + 4k + 2E + (k − 1)V E). Then, fM = {emi : i ∈ {1, 2, . . . , δ}} and fW = {ewi : i ∈ {1, 2, . . . , δ}}. Note that M = W . We remark that in what follows, we assume w.l.o.g. that δ ≥ 0 and k(k − 1) V > k + k and can therefore, by using brute-force, be solved in FPT time. , else the size of the input instance I of Clique is bounded by a function of 2 v and m2 Before we proceed, let us discuss the intuition behind the definition of the subsets of men and women above, and the definitions of the preference lists that will follow. Roughly speaking, each pair of men, m1 v, represents a vertex, and we aim to ensure that either both men will be matched to their best partners (in the man-optimal stable matching) or both men will be matched to other partners (where there would be only one choice for these other partners that preserves stability). Accordingly, we will guarantee that the choice of matching these two men to their best partners translates to not choosing the vertex they represent into the clique, and the other choice translates to choosing this vertex into the clique. Now, having just the set MV , we can encode selection of vertices into the clique, but we cannot ensure that the vertices we select indeed form a clique. For this purpose, we also have the set ME which, in a manner similar to MV , encodes selection of edges into the clique. By designing the instance in a way that the situation of the men in the man-optimal stable matching is significantly worse than that of the women in the women-optimal stable matching, we are able 20 k(k − 1) 2 to ensure that at most 2(k + ) men in MV ∪ ME will not be assigned their best partners (here, we exploit the condition that balance(µ) ≤ bk for a solution µ). We remark that here the man m∗ plays a crucial role-by using dummy men and women (in the sets fM and fW ) that prefer each other over all other people, we ensure that the situation of m∗ is always "extremely bad" (from his viewpoint), while the situation of his partner, w∗, is always "excellent" (from her viewpoint). At this point, we first need to ensure that the edges that we select indeed connect the vertices that we select. For this purpose, we carefully design our reduction so that when a pair of men representing some edge e obtain partners worse than those they have in the man-optimal stable matching, it must be that the men representing the endpoints of e have also obtained partners worse than those they have in the man-optimal stable matching, else stability will not be preserved-the partners of the men represting the endpoints of e will form blocking pairs together with the men representing e. k(k − 1) 2 ) distinguished Finally we observe that we still need to ensure that among our 2(k + men in MV ∪ME, which are associated with k + selected elements (vertices and edges), there will be exactly 2k distinguished men from MV and exactly k(k − 1) distinguished men 2 k(k − 1) k(k − 1) edges. For this purpose, from ME, which would mean we have chosen k vertices and we construct an instance where for the women, it is only somewhat "beneficial" that the men in MV will not be matched to their best partners, but it is extremely beneficial that the men in ME will not be matched to their best partners. This objective is achieved by carefully placing dummy men (from cM ) in the preference lists of women in WE. By again exploiting the condition that balance(µ) ≤ bk for a solution µ, we are able to ensure that there would be at least k(k − 1) distinguished men from ME. Next, we proceed with the formal presentation of our reduction by defining pm for every 2 man m ∈ M , and thus constructing LM . • For all m1 v ∈ MV : A(m1 – pm1 v (w1 v) = 1; pm1 v v, ew1, ew2, w2 v}. (ew2) = 3; pm1 v (w2 v) = 4. • For all m2 v ∈ MV : A(m2 v, w1, w2, w1 v}. v v) = {w1 (ew1) = 2; pm1 v) = {w2 (ew1) = 2; pm2 v – pm2 v (w2 v) = 1; pm2 v (w1 v) = 4. v (ew2) = 3; pm2 {u,v}) = {w1 • For all m1 {u,v} ∈ ME where u < v:3 A(m1 {u,v}, w1 u, w1 v, w2 {u,v}}. – pm1 {u,v} (w1 {u,v}) = 1; pm1 {u,v} (w1 u) = 2; pm1 {u,v} (w1 v) = 3; pm1 {u,v} (w2 {u,v}) = 4. • For all m2 {u,v} ∈ ME where u < v: A(m2 {u,v}) = {w2 {u,v}, w2 u, w2 v, w1 {u,v}}. – pm2 {u,v} (w2 {u,v}) = 1; pm2 {u,v} (w2 u) = 2; pm2 {u,v} (w2 v) = 3; pm2 {u,v} (w1 {u,v}) = 4. • For all emi ∈ fM such that i ≤ V E: A(emi) = {ewi} ∪ WE ∪ {wi v ∈ WV , the set A(wi v) is determined later. v ∈ MV : emi ∈ A(wi v)}, where for all wi – p emi(ewi) = 1. 3Recall that we have defined an order on V . 21 – For all j ∈ {1, 2, . . . , E}: p emi(w1 – Denote X = {wi bijection. Then, for all wi v ∈ MV : emi ∈ A(wi v ∈ X: p emi(wi ej ) = j + 1; p emi(w2 ej ) = E + j + 1. v)}. Let f : X → X be an arbitrarily chosen v) = 2E + f (wi v) + 1. • For all emi ∈ fM such that i > V E: A(emi) = {ewi}. – p emi(ewi) = 1. • For m∗: A(m∗) = fW ∪ {w∗}. – For all i ∈ {1, 2, . . . , δ}: pm∗(ewi) = i. – pm∗ (w∗) = δ + 1. Accordingly, we define pw for every woman w ∈ W , and thus construct LW . • For all w1 v ∈ WV : A(w1 v) = {m1 e ∈ ME : v ∈ e} ∪ {m2 v, m1 v} ∪ {emi ∈ fM : i ≤ E − degreeG(v)}. (m2 v v) = 1 – pw1 – For all i ∈ {1, 2, . . . , E}: pw1 – pw1 v) = E + 2. (m1 v v (m1 ei) = i + 1. • For all w2 v ∈ WV : A(w2 v) = {m2 e ∈ ME : v ∈ e} ∪ {m1 v, m2 v} ∪ {emi ∈ fM : i ≤ E − degreeG(v)}. (m1 v v) = 1. – pw2 – For all i ∈ {1, 2, . . . , E}: pw2 – pw2 v) = E + 2. (m2 v v (m2 ei) = i + 1. • For all w1 e ∈ WE: A(w1 e ) = {emi ∈ fM : i ∈ {1, 2, . . . , V E}} ∪ {m2 e, m1 e}. (m2 e e) = 1. – pw1 – For all i ∈ {1, 2, . . . , V E}: pw1 – pw1 e) = V E + 2. (m1 e e (emi) = i + 1. • For all w2 e ∈ WE: A(w2 e ) = {emi ∈ fM : i ∈ {1, 2, . . . , V E}} ∪ {m1 e, m2 e}. (m1 e e) = 1. – pw2 – For all i ∈ {1, 2, . . . , V E}: pw2 – pw2 e) = V E + 2. (m2 e e (emi) = i + 1. • For all ewi ∈ fW such that i ∈ {1, 2}: A(ewi) = {emi} ∪ {m∗} ∪ MV . – p ewi(emi) = 1; p ewi(m∗) = 2. – For all j ∈ {1, 2, . . . , V }: p ewi(m1 vj ) = j + 2; p ewi(m2 • For all ewi ∈ fW such that i > 2: A(ewi) = {emi} ∪ {m∗}. vj ) = V + j + 2. – p ewi(emi) = 1; p ewi(m∗) = 2. 22 • For w∗: A(w∗) = {m∗}. – pw∗(m∗) = 1. Finally, we define bk = M + δ + 6(k + (under the assumptions that δ ≥ 0 and V > k + time. 5.2 The Parameter 2 k(k − 1) 2 ). It is clear that the entire construction k(k − 1) ) can be performed in polynomial Our current objective is to verify that t is indeed bounded by a function of k. For this purpose, we first observe that for all i ∈ {1, 2, . . . , δ}, it holds that p emi(ewi) = p ewi(emi) = 1. Therefore, for all µ ∈ SM(bI) and i ∈ {1, 2, . . . , δ}, we have that µ(emi) = ewi, else (emi, ewi) would have formed a blocking pair for µ in bI. Observation 6. For all µ ∈ SM (bI) and i ∈ {1, 2, . . . , δ}, it holds that µ(emi) = ewi. Now, note that A(m∗) = fW ∪{w∗}. Thus, by Observation 6, we have that for all µ ∈ SM (bI), either m∗ is unmatched or µ(m∗) = w∗. However, A(w∗) = {m∗}, which implies that in the former case, (m∗, w∗) forms a blocking pair. Thus, we also have the following observation. Observation 7. For all µ ∈ SM (bI), it holds that µ(m∗) = w∗. Let us proceed by identifying the man-optimal µM and the woman-optimal µW stable match- ings. For this purpose, we first define a matching µ′ M as follows. • For all mi • For all mi v ∈ MV : µ′ e ∈ ME: µ′ • For all emi ∈ fM : µ′ M (mi v) = wi v. e) = wi M (mi e. M (emi) = ewi. • µ′ M (m∗) = w∗. Lemma 5.2. µM = µ′ M . M (emi) = ewi and p emi(ewi) = p ewi(emi) = 1, we Proof. Since for all i ∈ {1, 2, . . . , δ}, it holds that µ′ have that there cannot exist a blocking pair with at least one person from fM ∪fW . Now, notice that for every m ∈ M , including m∗, the woman most preferred by m who is outside fW is also the one with whom it is matched. Therefore, there cannot exist any blocking pair for µ′ M , and by Observation 6, we further conclude that indeed µM = µ′ M . Now, we define a matching µ′ W as follows. • For all wi • For all wi v ∈ WV : µ′ e ∈ WE: µ′ • For all ewi ∈ fW : µ′ W (wi W (wi W (ewi) = emi. v) = m3−i e) = m3−i . v e • µ′ W (w∗) = m∗. . Lemma 5.3. µW = µ′ W . Proof. In the matching µ′ it is immediate that µW = µ′ W . W , every woman is matched with the man she prefers the most. Thus, As a corollary to Lemmata 5.2 and 5.3, we obtain the following result. Corollary 5.1. OM = M + δ and OW = W . 23 Proof. First, note that OM = X pm(w) (m,w)∈µM = pm∗ (µM (m∗)) + X m∈M \{m∗} Second, note that pm(µM (m)) = (δ + 1) + (M − 1) = M + δ. OW = X pw(m) = X (m,w)∈µW w∈W pw(µW (w)) = W . We are now ready to bound t. Lemma 5.4. The parameter t associated with bI is equal to 6(k + k(k − 1) 2 ). Proof. By the definition of t, we have that t = bk − max{OM , OW } = M + δ + 6(k + k(k − 1) 2 ) − max{M + δ, W } = 6(k + k(k − 1) 2 ). 5.3 Correctness First, from Lemma 5.2 and Proposition 2 we derive the following useful observation. Observation 8. Every µ ∈ SM (bI) matches all people in M ∪ W . Next, we proceed to state the first direction necessary to conclude that the input instance I of Clique and our instance bI of Above-Max BSM are equivalent. Lemma 5.5. If I is a Yes-instance, then bI is a Yes-instance. Proof. Suppose that I is a Yes-instance, and let U be the vertex-set of a clique on k vertices in G. We denote M U {u,v} ∈ ME : u, v ∈ U }. Then, we define a matching µ as follows. v ∈ MV : v ∈ U } and M U V = {mi E = {mi • For all mi v ∈ MV : – If mi v ∈ M U – Else: µ(mi V : µ(mi v) = w3−i v) = wi v. v . • For all mi e ∈ ME: e ∈ M U – If mi – Else: µ(mi e) = w3−i E : µ(mi e) = wi e. e • For all emi ∈ fM : µ(emi) = ewi. • µ(m∗) = w∗. . 24 On the one hand, notice that for every m ∈ (MV \ M U We claim that µ ∈ SM (bI) and balance(µ) ≤ bk, which would imply that bI is a Yes-instance. To this end, we first show that µ ∈ SM (bI). Since for all i ∈ {1, 2, . . . , δ}, it holds that µ(emi) = ewi and p emi(ewi) = p ewi(emi) = 1, we have that there cannot exist a blocking pair with at least one person from fM ∪ fW . Thus, there can also not be a blocking pair with any person from {m∗, w∗}. E ) ∪ {m∗}, the woman most preferred by m who is outside fW is also the one with whom it is matched. Thus, no man in (MV \M U E )∪{m∗} can belong to a blocking pair. Moreover, the set of acceptable E is a subset of fM ∪ (ME \ M U partners of any woman in WE matched to a man in ME \ M U E ), and therefore such a woman cannot belong to a blocking pair. On the other hand, let W ′ denote the set of every woman that is matched to a man m ∈ M U E . Then, for every w ∈ W ′, the man most preferred by w is also the one with whom she is matched. Therefore, no woman in W ′ can belong to a blocking pair. Hence, we also conclude that no woman in WE can belong to a blocking pair. V ) ∪ (ME \ M U V )∪(ME \M U V ∪ M U v ∈ M U V ∪ M U Thus, if there exists a blocking pair, it must consist of a man m ∈ M U E and a woman w ∈ WV \ W ′. Suppose, by way of contradiction, that there exists such a blocking pair (m, w). v, all women in A(mi First, let us assume that m = mi v) belong to fW ∪ {µ(mi v, and thus we reach a contradiction. Next, we assume that m = mi E . In this case, it must hold that w is either wi v. However, since mi over mi u. Without loss of generality, we assume that w = wi E , we have that v ∈ U . Therefore, µ(wi V . In this case, since apart from wi v)}, we deduce that w = wi {u,v}, we reach a contradiction. It remains to prove that balance(µ) ≤ bk. To this end, we need to show that v prefers m3−i {u,v} ∈ M U v. However, wi v prefers µ(wi v) over mi {u,v} ∈ M U v) = m3−i v . Since wi v or wi v max{ X pm(w), X pw(m)} ≤ M + δ + 6(k + k(k − 1) ). 2 (m,w)∈µ (m,w)∈µ First, note that X pm(w) = X pm(µ(m)) + X pm(µ(m)) + X pm(µ(m)) (m,w)∈µ m∈M U V + X m∈MV \M U V pm(µ(m)) + X m∈M U E pm(µ(m)) + pm∗ (µ(m∗)) m∈ME \M U E = 4M U V + MV \ M U E + ME \ M U m∈ fM V + 4M U = M + δ + 3(M U V + M U E ) = M + δ + 6(k + E + fM + δ + 1 k(k − 1) ). 2 Second, note that X pw(m) = X pµ(m)(m) + X pµ(m)(m) + X pµ(m)(m) (m,w)∈µ m∈M U V + X m∈MV \M U V pµ(m)(m) + X m∈M U E pµ(m)(m) + pµ(m∗)(m∗) m∈ME\M U E V + MV \ M U = M U V (E + 2) + M U = M + 2(V − k)(E + 1) + 2(E − m∈ fM E + ME \ M U k(k − 1) E (V E + 2) + fM + 1 )(V E + 1) 2 = M + δ + 6(k + k(k − 1) 2 ). This concludes the proof of the lemma. We now turn to prove the second direction. 25 Lemma 5.6. If bI is a Yes-instance, then I is a Yes-instance. Proof. Suppose that bI is a Yes-instance, and let µ be a stable matching such that balance(µ) ≤ bk. By Observations 6 and 7, it holds that • For all i ∈ {1, 2, . . . , δ}: µ(emi) = ewi. • µ(m∗) = w∗. Thus, since Observation 8 implies that all vertices in MV should be matched by µ, we deduce that • For all v ∈ V : Either both µ(m1 v) = w1 v and µ(m2 v) = w2 v or both µ(m2 v) = w1 v and µ(m1 v) = w2 v. Let U denote the set of every v ∈ V such that µ(m2 v. Moreover, v ∈ MV : v ∈ U }. By the item above, and since all vertices in ME should also v and µ(m1 v) = w1 v) = w2 denote M U be matched by µ, we further deduce that V = {mi • For all e ∈ E: Either both µ(m1 e) = w1 e and µ(m2 e) = w2 e or both µ(m2 e) = w1 e and µ(m1 e) = w2 e . Let S denote the set of every e ∈ E such that µ(m2 e . Moreover, denote M S {u,v}, w1 u) would have formed a blocking pair, which contradicts the fact that µ is a stable matching. Thus, we have that the set of endpoints of the edges in S is a subset of U . e ∈ ME : e ∈ S}. If there existed {u, v} ∈ S such that u /∈ U , then (m1 e and µ(m1 E = {mi e) = w2 e) = w1 We claim that U = k and that U is the vertex-set of a clique in G, which would imply that I is a Yes-instance. Since we have argued that the set of endpoints of the edges in S is a subset of U , it is sufficient to show that U ≤ k and S ≥ implies that U ≥ k), as this would imply that U is indeed the vertex-set of a clique on k vertices in (note that S ≥ 2 2 k(k − 1) k(k − 1) G. First, since balance(µ) ≤ bk, we have that X (m,w)∈µ pm(w) ≤ M + δ + 6(k + k(k − 1) 2 ). Now, note that X pm(w) = X pm(µ(m)) + X pm(µ(m)) + X pm(µ(m)) (m,w)∈µ m∈M U V + X m∈MV \M U V pm(µ(m)) + X m∈M S E pm(µ(m)) + pm∗(µ(m∗)) m∈ME \M S E = 4M U = M + δ + 6(U + S). V + MV \ M U m∈ fM V + 4M S E + ME \ M S E + fM + δ + 1 Thus, we deduce that U + S ≤ k + k(k − 1) . Now, observe that since balance(µ) ≤ bk, we 2 also have that X (m,w)∈µ pw(m) ≤ M + δ + 6(k + ). Here, on the one hand we note that k(k − 1) 2 X pw(m) = X pµ(m)(m) + X pµ(m)(m) + X pµ(m)(m) (m,w)∈µ m∈M U V + X m∈MV \M U V pµ(m)(m) + X m∈M S E pµ(m)(m) + pµ(m∗)(m∗) m∈ME\M S E V + MV \ M U m∈ fM E(V E + 2) + fM + 1 = M U = M + 2(V − U )(E + 1) + 2(E − S)(V E + 1) = M + 2(V + E + V E + V E2) − 2U (E + 1) − 2S(V E + 1). V (E + 2) + M S E + ME \ M S 26 On the other hand, we note that bk = M + δ + 6(k + k(k − 1) 2 ) = M + 2(V + E + V E + V E2) − k(4 + 4k + 2E + (k − 1)V E) + 6(k + = M + 2(V + E + V E + V E2) − 2k(E + 1) − k(k − 1)(V E + 1). Thus, we have that U (E + 1) + S(V E + 1) ≥ k(E + 1) + k(k − 1) 2 (V E + 1) k(k − 1) 2 ) Recall that we have also shown that U +S ≤ k + k(k − 1) 2 . Thus, since U ≤ k + V , to satisfy the above equation it must hold that S ≥ . Since U + S ≤ k(k − 1) 2 < k(k − 1) 2 k + k(k − 1) 2 , we deduce that U ≤ k. This, as we have argued earlier, finished the proof. This concludes the proof of Theorem 5.1. References [1] J. Chen, D. Hermelin, M. Sorge, and H. Yedidsion, How hard is it to satisfy (almost) all roommates?, arXiv preprint arXiv:1707.04316, (2017). [2] M. Cygan, F. V. Fomin, L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh, Parameterized Algorithms, Springer, 2015. [3] M. Cygan, M. Pilipczuk, M. Pilipczuk, and J. O. Wojtaszczyk, On multiway cut parameterized above lower bounds, TOCT, 5 (2013), pp. 3:1–3:11. [4] R. G. Downey and M. R. Fellows, Fixed-parameter tractability and completeness II: On completeness for W[1], Theoretical Computer Science, 141 (1995), pp. 109–131. [5] , Fundamentals of parameterized complexity, Springer, 2013. [6] T. Feder, Stable networks and product graphs, PhD thesis, Stanford University, 1990. [7] D. Gale and L. S. Shapley, College admissions and the stability of marriage, The American Mathematical Monthly, 69 (1962), pp. 9–15. [8] , College admissions and the stability of marriage, American Mathematical Monthly, 69 (1962), pp. 9–15. [9] D. Gale and M. Sotomayor, Some remarks on the stable matching problem, Discrete Applied Mathematics, 11 (1985), pp. 223–232. [10] S. Garg and G. Philip, Raising the bar for vertex cover: Fixed-parameter tractability above A higher guarantee, in Proceedings of the Twenty-Seventh Annual ACM-SIAM Sym- posium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, 2016, pp. 1152–1166. [11] D. Gusfield and R. W. Irving, The Stable marriage problem - structure and algorithms, Foundations of computing series, MIT Press, 1989. [12] R. W. Irving, P. Leather, and D. Gusfield, An efficient algorithm for the "optimal" stable marriage, Journal of ACM, 34 (1987), pp. 532–543. 27 [13] A. Kato, Complexity of the sex-equal stable marriage problem, Japan Journal of Industrial and Applied Mathematics, 10 (1993), p. 1. [14] D. E. Knuth, Stable marriage and its relation to other combinatorial problems : an introduction to the mathematical analysis of algorithms, CRM proceedings & lecture notes, Providence, R.I. American Mathematical Society, 1997. [15] D. Lokshtanov, N. S. Narayanaswamy, V. Raman, M. S. Ramanujan, and S. Saurabh, Faster parameterized algorithms using linear programming, ACM Trans. Al- gorithms, 11 (2014), pp. 15:1–15:31. [16] D. F. Manlove, Algorithmics of Matching Under Preferences, vol. 2 of Series on Theo- retical Computer Science, WorldScientific, 2013. [17] E. McDermid, in Personal communications between McDermid and Manlove, 2010. [18] E. McDermid and R. W. Irving, Sex-equal stable matchings: Complexity and exact algorithms, Algorithmica, 68 (2014), pp. 545–570. [19] G. O'Malley, Algorithmic aspects of stable matching problems, PhD thesis, University of Glasgow, 2007. [20] V. Raman, M. S. Ramanujan, and S. Saurabh, Paths, flowers and vertex cover, in Al- gorithms - ESA 2011 - 19th Annual European Symposium, Saarbrucken, Germany, Septem- ber 5-9, 2011. Proceedings, 2011, pp. 382–393. 28
1608.06325
1
1608
2016-08-22T21:50:07
A PTAS for the Steiner Forest Problem in Doubling Metrics
[ "cs.DS" ]
We achieve a (randomized) polynomial-time approximation scheme (PTAS) for the Steiner Forest Problem in doubling metrics. Before our work, a PTAS is given only for the Euclidean plane in [FOCS 2008: Borradaile, Klein and Mathieu]. Our PTAS also shares similarities with the dynamic programming for sparse instances used in [STOC 2012: Bartal, Gottlieb and Krauthgamer] and [SODA 2016: Chan and Jiang]. However, extending previous approaches requires overcoming several non-trivial hurdles, and we make the following technical contributions. (1) We prove a technical lemma showing that Steiner points have to be "near" the terminals in an optimal Steiner tree. This enables us to define a heuristic to estimate the local behavior of the optimal solution, even though the Steiner points are unknown in advance. This lemma also generalizes previous results in the Euclidean plane, and may be of independent interest for related problems involving Steiner points. (2) We develop a novel algorithmic technique known as "adaptive cells" to overcome the difficulty of keeping track of multiple components in a solution. Our idea is based on but significantly different from the previously proposed "uniform cells" in the FOCS 2008 paper, whose techniques cannot be readily applied to doubling metrics.
cs.DS
cs
A PTAS for the Steiner Forest Problem in Doubling Metrics T-H. Hubert Chan∗ Shuguang Hu∗ Shaofeng H.-C. Jiang∗ Abstract We achieve a (randomized) polynomial-time approximation scheme (PTAS) for the Steiner Forest Problem in doubling metrics. Before our work, a PTAS is given only for the Euclidean plane in [FOCS 2008: Borradaile, Klein and Mathieu]. Our PTAS also shares similarities with the dynamic programming for sparse instances used in [STOC 2012: Bartal, Gottlieb and Krauthgamer] and [SODA 2016: Chan and Jiang]. However, extending previous approaches requires overcoming several non-trivial hurdles, and we make the following technical contribu- tions. (1) We prove a technical lemma showing that Steiner points have to be "near" the terminals in an optimal Steiner tree. This enables us to define a heuristic to estimate the local behavior of the optimal solution, even though the Steiner points are unknown in advance. This lemma also generalizes previous results in the Euclidean plane, and may be of independent interest for related problems involving Steiner points. (2) We develop a novel algorithmic technique known as "adaptive cells" to overcome the difficulty of keeping track of multiple components in a solution. Our idea is based on but significantly different from the previously proposed "uniform cells" in the FOCS 2008 paper, whose techniques cannot be readily applied to doubling metrics. 6 1 0 2 g u A 2 2 ] S D . s c [ 1 v 5 2 3 6 0 . 8 0 6 1 : v i X r a ∗Department of Computer Science, the University of Hong Kong. {hubert,sghu,sfjiang}@cs.hku.hk 1 Introduction We consider the Steiner Forest Problem (SFP) in a metric space (X, d). An instance of the problem is given by a collection W of n terminal pairs {(ai, bi) : i ∈ [n]} in X, and the objective is to find a minimum weight graph F = (V, E) (where V is a subset of X and the edge weights are induced by the metric space) such that every pair in W is connected in F . 1.1 Problem Background The problem is well-known in the computer science community. In general metrics, Chleb´ık and Chleb´ıkov´a [CC08] showed that SFP is NP-hard to approximate with ratio better than 96 95 . The best known approximation ratio achievable in polynomial time is 2 [GW95, AKR95]. Recently, Gupta and Kumar [GK15] gave a purely combinatorial greedy-based algorithm that also achieves constant ratio. However, it is still an open problem to break the 2-approximation barrier in general metrics for SFP. In light of the aforementioned hardness re- SFP in Euclidean Plane and Planar Graphs. sult [CC08], restrictions are placed on the metric space to achieve (1 + ǫ) approximation in polyno- mial time. In the Euclidean plane, a randomized polynomial-time approximation scheme (PTAS) was obtained in [BKM08], using the dynamic programming framework proposed by Arora [Aro98]. Later on, a simpler analysis was presented in [BH12], in which a new structural property is proved and additional information is incorporated in the dynamic programming algorithm. It was only suggested that similar techniques might be applicable to higher-dimensional Euclidean space. Going beyond the Euclidean plane, a PTAS for planar graphs is obtained in [BHM11] and more generally, on bounded genus graphs. As a building block, they also obtained a PTAS for graphs with bounded treewidth. Steiner Tree Problems. A notable special case of SFP is the Steiner Tree Problem (STP), in which all terminals are required to be connected. In general metrics, the MST on the terminal points simply gives a 2-approximation. There is a long line of research to improve the 2-approximation, and the state-of-the-art approximation ratio 1.39 was presented in [BGRS10] via an LP rounding approach. On the other hand, it is NP-hard to approximate STP better than the ratio 96 95 [CC08]. For the group STP in general metrics, it is NP-hard to approximate within log2−ǫ n [HK03] unless NP ⊆ ZTIME(npolylog(n)). On the other hand, it is possible to approximate within O(log3 n) as shown in [GKR00]. Restricting to planar graphs, the group STP can be approximated within O(log n poly log log n) [DHK14], and very recently, this result is improved to a PTAS [BDHM16]. For more related works, we refer the reader to a survey by Hauptmann and Karpi´nski [HK13], who gave a comprehensive literature review of STP and its variations. PTAS's for Other Problems in Doubling Metrics. Doubling dimension captures the local growth rate of a metric space. A k-dimensional Euclidean dimension has doubling dimension O(k). A challenge in extending algorithms for low-dimensional Euclidean space to doubling metrics is the lack of geometric properties in doubling metrics. Although QPTAS's for various approximation problems in doubling metrics, such as the Traveling Salesman Problem (TSP) and STP, were presented in [Tal04], a PTAS was only recently achieved for TSP [BGK12]. Subsequently, a PTAS is also achieved for group TSP in doubling metrics [CJ16]. Before this work, the existence of a PTAS for SFP (or even the special case STP) in doubling metrics remains an open problem. 1.2 Our Contribution and Techniques Although PTAS's for TSP (and its group variant) are known, as we shall explain later, the nature of SFP and TSP-related problems are quite different. Hence, it is interesting to investigate what 1 new techniques are required for SFP. Fundamentally, it is an important question that whether the notion of doubling dimension captures sufficient properties of a metric space to design a PTAS for SFP, even without the geometric properties that are crucially used in obtaining approximation schemes for SFP in the Euclidean plane [BKM08]. In this paper, we settle this open problem by giving a (randomized) PTAS for SFP in doubling metrics. We remark that previously even a PTAS for SFP in higher-dimensional Euclidean space is not totally certain. Theorem 1.1 (PTAS for SFP in Doubling Metrics). For any 0 < ǫ < 1, there is a (randomized) algorithm that takes an instance of SFP with n terminal pairs in a metric space with doubling dimension at most k, and returns a (1 + ǫ)-approximate solution with constant probability, running in time O(nO(1)k ) · exp(√log n · O( k ǫ )O(k)). We next give an overview of our techniques. On a high level, we use the divide and conquer framework that was originally used by Arora [Aro98] to achieve a PTAS for TSP in Euclidean space, and was extended recently to doubling metrics [BGK12]. However, we shall explain that it is non-trivial to adapt this framework to SFP, and how we overcome the difficulties encountered. Moreover, we shall provide some insights regarding the relationship between Euclidean and doubling metrics, and discuss the implications of our technical lemmas. Summary of Framework. As in [BGK12], a PTAS is designed for a class of special instances known as sparse instances. Then, it can be shown that the general instances can be decomposed into sparse instances. Roughly speaking, an instance is sparse, if there is an optimal solution such that for any ball B with radius r, the portion of the solution in B has weight that is small with respect to r. The PTAS for the sparse instances is usually based on a dynamic program, which is based on a randomized hierarchical decomposition as in [Tal04, BGK12]. This framework has also been suc- cessfully applied to achieve a PTAS for group TSP in doubling metrics [CJ16]. Intuitively, sparsity is used to establish the property that with high enough probability, a cluster in the randomized decomposition cuts a (near) optimal tour only a small number of times [BGK12, Lemma 3.1]. How- ever, SFP brings new significant challenges when such a framework is applied. We next describe the difficulties and give an overview of our technical contributions. Challenge 1: It is difficult to detect a sparse instance because which Steiner points are used by the optimal solution are unknown. Let us first consider STP, which is a special case of SFP in which all (pairs of) terminals are required to be connected. In other words, the optimal Steiner tree is the minimum weight graph that connects all terminals. Unlike TSP in which the points visited by a tour are clearly known in advance, it is not known which points will be included in the optimal Steiner tree. In [BGK12], a crucial step is to estimate the sparsity of a ball B, which measures the weight of the portion of the optimal solution restricted to B. For TSP tour, this can be estimated from the points inside B that have to be visited. However, for solution involving Steiner points, it is difficult to analyze the solution inside some ball B, because it is possible that there are few (or even no) terminals inside B, but the optimal solution could potentially have lots of Steiner points and a large weight inside B. Our Solution: Analyzing the Distribution of Steiner Points in an Optimal Steiner Tree in Doubling Metrics. We resolve this issue by showing a technical characterization of Steiner points in an optimal Steiner tree for doubling metrics. This technical lemma is used crucially in 2 our proofs, and we remark that it could be of interest for other problems involving Steiner points in doubling metrics. Lemma 1.1 (Formal version in Lemma 3.1). For a terminal set S with diameter D, if an optimal Steiner tree spanning S has no edge longer than γD, then every Steiner point in the solution is within O(√γ) · D distance to some terminal in S, where the big O hides the dependence on the doubling dimension. We observe that variants of Lemma 1.1 have been considered on the Euclidean plane. In [DHC85, DHW87], it is shown that if the terminal set consists of n evenly distributed points on a unit circle, then for large enough n, there is no Steiner points in an optimal Steiner tree. To see how this relates to our lemma, when n is sufficiently large, it follows that adjacent points in the circle are very close to each other. Hence, any long edge in a Steiner tree could be replaced by some short edge between adjacent terminals in the circle. Our lemma then implies that all Steiner points must be near the terminals, which is a weaker statement than the conclusion in [DHC85], but is enough for our purposes. We emphasize that the results in [DHC85, DHW87] rely on the geometric properties of the Euclidean plane. However, in our lemma, we only use that the doubling dimension is bounded. Implication of Lemma 1.1 on Sparsity Heuristic. We next demonstrate an example of how we use this technical lemma. In Lemma 3.3, we argue that our sparsity heuristic provides an upper bound on the weight of the portion of an optimal solution F within some ball B. The idea is that we remove the edges in F within B and add back some edges of small total weight to maintain connectivity. We first add a minimum spanning tree H on some net-points N within B of an appropriate scale γ · D. Using the property of doubling dimension, we argue that the number of points in H is bounded and so is its weight. In one of our case analysis, there are two sets S and T of terminals that are far apart d(S, T ) ≥ D, and we wish to argue that in the optimal Steiner tree F connecting S and T , there is an edge {u, v} of length at least Ω(γ) · D. If this is the case, we could remove this edge and connect u and v to their corresponding net-points directly. For contradiction's sake, we assume there is no such edge, but Lemma 1.1 implies that every Steiner point must be close to either S and T . Since S and T are far apart, this means that there is a long edge after all. Conversely, in Lemma 3.4, we also use this technical lemma to show that if the sparsity heuristic for some ball B is large, then the portion of the optimal solution F inside B is also large. Challenge 2: In doubling metrics, the number of cells for keeping track of connectivity in each cluster could be too large. Unlike the case for TSP variants [BGK12, CJ16], the solution for SFP need not be connected. Hence, in the dynamic programming algorithm for SFP, in addition to keeping track of what portals are used to connect a cluster to points outside, we need to keep information on which portals the terminals inside a cluster are connected to. In previous works [BKM08], the notion of cells is used for this purpose. Previous Technique: Cell Property. The idea of cell property was first introduced in [BKM08], which gave a PTAS for SFP in the Euclidean plane using dynamic programming. Since there would have been an exponential number of dynamic program entries if we keep information on which portal is used by every terminal to connect to its partner outside the cluster, the high level idea is to partition a cluster into smaller clusters (already provided by the hierarchical decomposition) known as cells. Loosely speaking, the cell property ensures that every terminal inside the same cell must be connected to points outside the cluster in the same way. More precisely, a solution F satisfies the cell property if for every cluster C and every cell e inside C, there is only one component in the portion of F restricted to C that connects e to points outside C. 3 A great amount of work was actually needed in [BKM08] and subsequent work [BH12] to show that it is enough to consider cells whose diameters are constant times smaller than that of its cluster. This allows the number of dynamic program entries to be bounded, which is necessary for a PTAS. Difficulty Encountered for Doubling Metrics. When the notion of cell is applied to the dynamic program for SFP in doubling metrics, an important issue is that the diameters of cells need to be about Θ(log n) times smaller than that of its cluster, because there are around Θ(log n) levels in the hierarchical decomposition. Hence, the number of cells in a cluster is Ω(poly log n), which would eventually lead to a QPTAS only. A similar situation is observed when dynamic programming was first used for TSP on doubling metrics [Tal04]. However, the idea of using sparsity as in [BGK12] does not seem to immediately provide a solution. Our Solution: Adaptive Cells. Since there are around Θ(log n) levels in the hierarchical decom- position, it seems very difficult to increase the diameter of cells in a cluster. Our key observation is that the cells are needed only for covering the portion of a solution inside a cluster that touches the cluster boundary. Hence, we use the idea of adaptive cells. Specifically, for each connected component A in the solution crossing a cluster C, we define the corresponding basic cells such that if the component A has larger weight, then its corresponding basic cells (with respect to cluster C) will have larger diameters. Combining with the notion of sparsity and bounded doubling dimension, we can show that we only need to pay attention to a small number of cells. Further Cells for Refinement. Since the dynamic program entries are defined in terms of the hierarchical decomposition and the entries for a cluster are filled recursively with respect to those of its child clusters, we would like the cells to have a refinement property, i.e., if a cluster C has some cell e (which itself is some descendant cluster of C), then the child C ′ containing e has either e or all children of e as its cells. At first glance, a quick fix may be to push down each basic cell in C to its child clusters. Although we could still bound the number of relevant cells, it would be difficult to bound the cost to achieve the cell property. The reason is that the basic cells from higher levels are too large for the descendant clusters. When more than one relevant component intersects such a large cell, we need to add edges to connect the components. However, if the diameter of the cell is too large compared to the cluster, these extra edges would be too costly. We resolve this issue by introducing non-basic cells for a cluster: promoted cells and virtual cells. These cells are introduced to ensure that every sibling of a basic cell is present. Moreover, only non-basic cells of a cluster will be passed to its children. We show in Lemma 5.5 that the total number of effective cells for a cluster is not too large. Moreover, Lemma 5.3 shows that the refinement property still holds even if we only pass the non-basic cells down to the child clusters. More importantly, we show that as long as we enforce the cell property for the basic cells, the cell property for all cells are automatically ensured. This means that it is sufficient to bound the cost to achieve the cell property with respect to only the basic cells. Further Techniques: Global Cell Property. We note that the cell property in [BKM08] is localized. In particular, for each cluster C, we restrict the solution inside C, which could have com- ponents disconnected within C but are actually connected globally. In order to enforce the localized cell property as in [BKM08], extra edges would need to be added for these locally disconnected components. Instead, we enforce a global cell property, in which for every cell e in a cluster C, there is only one (global) connected component in the solution that intersects e and crosses the boundary of cluster C. A consequence of this is that if there are m components in the solution, then at most m − 1 extra edges are needed to maintain the global cell property. This implication is crucially used in our charging argument to bound the cost for enforcing the cell property for the basic cells. However, this would imply that in the dynamic program entries, we need to keep 4 additional information on how the portals of a cluster are connected outside the cluster. Combining the Ideas: A More Sophisticated Dynamic Program. Even though our ap- proaches to tackle the encountered issues are intuitive, it is a non-trivial task to balance between different tradeoffs and keep just enough information in the dynamic program entries, but still ensure that the entries can be filled in polynomial time. 2 Preliminaries We consider a metric space M = (X, d) (see [DL97, Mat02] for more details on metric spaces). For x ∈ X and ρ ≥ 0, a ball B(x, ρ) is the set {y ∈ X d(x, y) ≤ ρ}. The diameter Diam(Z) of a set Z ⊂ X is the maximum distance between points in Z. For S, T ⊂ X, we denote d(S, T ) := min{d(x, y) : x ∈ S, y ∈ T}, and for u ∈ X, d(u, T ) := d({u}, T ). Given a positive integer m, we denote [m] := {1, 2, . . . , m}. A set S ⊂ X is a ρ-packing, if any two distinct points in S are at a distance more than ρ away from each other. A set S is a ρ-cover for Z ⊆ V , if for any z ∈ Z, there exists x ∈ S such that d(x, z) ≤ ρ. A set S is a ρ-net for Z, if S is a ρ-packing and a ρ-cover for Z. We assume that a ρ-net for any ball in X can be constructed efficiently. We consider metric spaces with doubling dimension [Ass83, GKL03] at most k; this means that for all x ∈ X, for all ρ > 0, every ball B(x, 2ρ) can be covered by the union of at most 2k balls of the form B(z, ρ), where z ∈ X. The following fact captures a standard property of doubling metrics. Fact 2.1 (Packing in Doubling Metrics [GKL03]). Suppose in a metric space with doubling dimen- sion at most k, a ρ-packing S has diameter at most R. Then, S ≤ ( 2R ρ )k. Given an undirected graph G = (V, E), where V V ⊂ X, E ⊆ (cid:0)V 2(cid:1), and an edge e = {x, y} ∈ E receives weight d(x, y) from the metric space M . The weight w(G) or cost of a graph is the sum of its edge weights. Let V (G) denote the vertex set of a graph G. We consider the Steiner Forest Problem (SFP). Given a collection W = {(ai, bi) i ∈ [n]} of terminal pairs in X, the goal is to find an undirected graph F (having vertex set in X) with minimum cost such that each pair of terminals are connected in F . The non-terminal vertices in V (F ) are called Steiner points. Rescaling Instance. Fix constant ǫ > 0. Since we consider asymptotic running time to obtain (1+ǫ)-approximation, we consider sufficiently large n > 1 ǫ . Suppose R > 0 is the maximum distance between a pair of terminals. Then R is a lower bound on the cost of an optimal solution. Moreover, the optimal solution F has cost at most nR, and hence, we do not need to consider distances larger than nR. Since F contains at most 4n vertices, if we consider an ǫR 32n2 -net S for X and replace every point in F with its closest net-point in S, the cost increases by at most ǫ · OPT. Hence, after rescaling, we can assume that inter-point distance is at least 1 and we consider distances up to O( n3 ǫ ) = poly(n). By the property of doubling dimension (Fact 2.1), we can hence assume X ≤ O( n ǫ )O(k) ≤ O(n)O(k). k ≥ 4, where 0 < c < 1 Hierarchical Nets. As in [BGK12], we consider some parameter s = (log n) is a universal constant that is sufficiently small (as required in Lemma 5.11). Set L := O(logs n) = O( k log n log log n ). A greedy algorithm can construct NL ⊆ NL−1 ⊆ ··· ⊆ N1 ⊆ N0 = N−1 = ··· = X such that for each i, Ni is an si-net for X, where we say distance scale si is of height i. Net-Respecting Solution. As defined in [BGK12], a graph F is net-respecting with respect to {Ni}i∈[L] and ǫ > 0 if for every edge {x, y} in F , both x and y belong to Ni, where si ≤ ǫ· d(x, y) < si+1. c 5 Given an instance W of a problem, let OPT(W ) be an optimal solution; when the context is clear, we also use OPT(W ) to denote the cost w(OPT(W )) as well; similarly, OPTnr(W ) refers to an optimal net-respecting solution. 2.1 Overview As in [BGK12, CJ16], we achieve a PTAS for SFP by the framework of sparse instance decompo- sition. Sparse Solution and Dynamic Program. Given a graph F and a subset S ⊆ X, FX is the subgraph induced by the vertices in V (F ) ∩ X. A graph F is called q-sparse, if for all i ∈ [L] and all u ∈ Ni, w(FB(u,3si)) ≤ q · si. We show that for SFP (in Section 5) there is a dynamic program DP that runs in polynomial time such that if an instance W has an optimal net-respecting solution that is q-sparse for some small enough q, DP(W ) returns a (1 + ǫ)-approximation with high probability (at least 1− 1 poly(n) ). Sparsity Heuristic. Since one does not know the optimal solution in advance, we estimate the local sparsity with a heuristic. For i ∈ [L] and u ∈ Ni, given an instance W , the heuristic H(i) u (W ) is supposed to estimate the sparsity of an optimal net-respecting solution in the ball B′ := B(u, O(si)). We shall see in Section 3 that the heuristic actually gives a constant approximation to some appropriately defined sub-instance W ′ in the ball B′. Generic Algorithm. We describe a generic framework that applies to SFP. Similar framework is also used in [CJ16, BGK12] to obtain PTAS's for TSP related problems. Given an instance W , we describe the recursive algorithm ALG(W ) as follows. force, recalling that X ≤ O( n ǫ )O(k). 2. Sparse Instance. 1. Base Case. If W = n is smaller than some constant threshold, solve the problem by brute u (W ) is at most q0 · si, for some 3. Identify Critical Instance. Otherwise, let i be the smallest height such that there exists u (W ) is appropriate threshold q0, call the subroutine DP(W ) to return a solution, and terminate. If for all i ∈ [L], for all u ∈ Ni, H(i) u ∈ Ni with critical H(i) u (W ) > q0 · si; in this case, choose u ∈ Ni such that H(i) maximized. 4. Decomposition into Sparse Instances. Decompose the instance W into appropriate sub- instances W1 and W2 (possibly using randomness). Loosely speaking, W1 is a sparse enough sub-instance induced in the region around u at distance scale si, and W2 captures the rest. We note that H(i) u (W2) ≤ q0 · si such that the recursion will terminate. The union of the solutions to the sub-instances will be a solution to W . Moreover, the following property holds. E[OPT(W1)] ≤ 1 − ǫ · (OPTnr(W ) − E[OPTnr(W2)]), 1 where the expectation is over the randomness of the decomposition. (1) 5. Recursion. Call the subroutine F1 := DP(W1), and solve F2 := ALG(W2) recursively; return the union F1 ∪ F2. Analysis of Approximation Ratio. We follow the inductive proof as in [BGK12] to show that with constant probability (where the randomness comes from DP), ALG(W ) returns a tour with expected length at most 1+ǫ 1−ǫ·OPTnr(W ), where expectation is over the randomness of decomposition into sparse instances in Step 4. As we shall see, in ALG(W ), the subroutine DP is called at most poly(n) times (either explicitly in the recursion or the heuristic H(i)). Hence, with constant probability, all solutions returned by all instances of DP have appropriate approximation guarantees. 6 1−ǫ · OPTnr(W2). In Step 4, equation (1) guarantees that E[OPT(W1)] ≤ 1 Suppose F1 and F2 are solutions returned by DP(W1) and ALG(W2), respectively. Since we assume that W1 is sparse enough and DP behaves correctly, w(F1) ≤ (1 + ǫ) · OPT(W1). The induction hypothesis states that E[w(F2)W2] ≤ 1+ǫ 1−ǫ · (OPTnr(W ) − E[OPTnr(W2)]). Hence, it follows that E[w(F1) + w(F2)] ≤ 1+ǫ 1−ǫ · OPTnr(W ) = (1 + O(ǫ)) · OPT(W ), achieving the desired ratio. Analysis of Running Time. As mentioned above, if H(i) u (W ) is found to be critical, then in the decomposed sub-instances W1 and W2, H(i) u (W2) should be small. Hence, it follows that there will be at most X · L = poly(n) recursive calls to ALG. Therefore, as far as obtaining polynomial running times, it suffices to analyze the running time of the dynamic program DP. The details are in Section 5.3. 2.2 Paper Organization In order to apply the above framework to obtain a PTAS for SFP, we shall describe in details the following components. 1. (Section 3.) Design a heuristic H such that for each i ∈ [L] and u ∈ Ni, the heuristic H(i) 2. (Section 4.) When a critical H(i) gives an upper bound for OPTnr(W )B(u,3si). u (W ) is found, decompose W into instances W1 and W2 such u (W ) that equation (1) holds. 3. (Section 5.) Design a dynamic program DP that gives (1+ǫ)-approximation to sparse instances in polynomial time. 3 Sparsity Heuristic for SFP u u Suppose a collection W of terminal pairs is an instance of SFP. For i ∈ [L] and u ∈ Ni, recall that we wish to estimate OPTnr(W )B(u,3si) with some heuristic H(i) u (W ). We consider a more general heuristic T(i,t) associated with the ball B(u, tsi), for t ≥ 1. The following auxiliary sub-instance deals with terminal pairs that are separated by the ball. Auxiliary Sub-Instance. Fix δ := Θ( ǫ k ), where the constant depends on the proof of Lemma 4.2. For i ∈ [L], u ∈ Ni and t ≥ 1, the sub-instance W (i,t) is induced by each pair {a, b} ∈ W as follows. (a) If both a, b ∈ B(u, tsi), or if exactly one of them is in B(u, tsi) and the other in B(u, (t + δ)si), (b) Suppose j is the index such that sj < δsi ≤ sj+1. If a ∈ B(u, tsi) and b /∈ B(u, (t + δ)si), (c) If both a and b are not in B(u, tsi), then the pair is excluded. then {a, b} is also included in W (i,t) then {a, a′} is included in W (i,t) Defining Heuristic. We define H(i) (W ) in terms of a more general heuristic, where (W ) is the cost of a constant approximate net-respecting solution of SFP on the instance W (i,t) T(i,t) . For example, we can first apply the primal-dual algorithm in [GW95] that gives a 2-approximation of SFP, and then make it net-respecting and we have T(i,t) , where a′ is the nearest point to a in Nj. u (W ) := T(i,4) ). u u u . u (W ) ≤ 2(1 + Θ(ǫ)) · OPT(W (i,t) u One potential issue is that OPTnr(W ) might use Steiner points in B(u, tsi), even if W (i,t) is empty. We shall prove a structural property of Steiner tree in Lemma 3.1, and Lemma 3.1 implies Lemma 3.2 which helps us to resolve this issue. Recall that the Steiner tree problem is a special case of SFP where the goal is to return a minimum cost tree that connects all terminals. u u u 7 Lemma 3.1 (Distribution of Steiner Points in The Optimal Steiner Tree). Suppose S is a terminal set with Diam(S) ≤ D, and suppose F is an optimal Steiner tree with terminal set S. If the longest edge in F has weight at most γD (0 < γ ≤ 1), then for any Steiner point r in F , d(r, S) ≤ 4kγ log2 4 γ · D. Proof. Since F is an optimal solution, all Steiner points in F have degree at least 3. Fix any Steiner point r in F . Denote K := ⌈log2(γD)⌉. Suppose we consider r as the root of the tree F . We shall show that there is a path of small weight from r to some terminal. Without loss of generality, we can assume that all terminals are leaves, because once we reach a terminal, there is no need to visit its descendants. For simplicity, we can assume that each internal node (Steiner point) has exactly two children, because we can ignore extra branches if an internal has more than two children. u = M (i) u1 + M (i) For i ≤ K, let Ei be the set of edges in F that have weights in the range (2i−1, 2i], and we say that such an edge is of type i. For each node u in F , denote Fu as the subtree rooted at u. Suppose we consider Fu and remove all edges in ∪j≥iEj from Fu; in the resulting forest, let M (i) u be the number of connected components that contain at least one terminal. We shall prove the following statement by structural induction on the tree bF . For each node u ∈ F , there exists a leaf x ∈ Fu such that d(x, u) ≤ Pi≤K 2i log2 M (i) u . u2 . Then, we can pick x1 to be the desired leaf, because the extra distance for j 6= i. More precisely, u1 ≤ Pj≤K 2j log2 M (j) u , Base Case. If u is a leaf, then the statement is true. Inductive Step. Suppose u has children u1 and u2 such that {u, u1} ∈ Ei and {u, u2} ∈ Ei′, where i ≥ i′. Suppose x1 and x2 are the leaves in Fu1 and Fu2, respectively, from the induction hypothesis. Observe that M (i) (1) Suppose M (i) d(u1, u) ≤ 2i can be accounted for, as 2M (i) u1 ≤ M (j) u1 ≤ M (i) d(x1, u) ≤ d(x1, u1) + d(u1, u) ≤ 2i · (1 + log2 M (i) where the second inequality follows from the induction hypothesis for u1. (2) Suppose M (i) distance is d(u2, u) ≤ 2i′ ≤ 2i. This completes the inductive step. Next, it suffices to give an upper bound for each M (i) := M (i) for root r. Suppose after removing r all tree edges in ∪j≥iEj, P and Q are two clusters each containing at least one terminal. Then, observe that the path in F connecting P and Q must contain an edge e with weight at least 2i−1. It follows that d(P, Q) ≥ 2i−1; otherwise, we can replace e in F with another edge of length less than 2i−1 to obtain a Steiner tree with strictly less weight. It follows that each cluster has a terminal representative that form a 2i−1-packing. Hence, we have M (i) ≤ ( 4D 2i )k, by the packing property of doubling metrics (Fact 2.1). u , and M (j) u1 ) +Pj≤K:j6=i 2j log2 M (j) u1 . Then, similarly we pick x2 to be the desired leaf, because the extra u2 . We consider two cases. u1 ≤ M (i) u2 < M (i) u Therefore, every Steiner point r in bF has a terminal within distance Pi≤K k · 2i log2 4D 2i ≤ 4kγD log2 4 γ . Given a graph F , a chain in F is specified by a sequence of points (p1, p2, . . . , pl) such that there is an edge {pi, pi+1} in F between adjacent points, and the degree of an internal point pi (where 2 ≤ i ≤ l − 1) in F is exactly 2. Lemma 3.2 (Steiner Tree of Well-Separated Terminals Contains A Long Chain). Suppose S and T are terminal sets in a metric space with doubling dimension at most k such that Diam(S ∪ T ) ≤ D, and d(S, T ) ≥ τ D, where 0 < τ < 1. Suppose F is an optimal net-respecting Steiner tree connecting 4096k2 ·D such that any internal the points in S∪ T . Then, there is a chain in F with weight at least point in the chain is a Steiner point. τ 2 8 8 distance at most 4kγ log2 defined to be the weight of the corresponding chain. use the optimality of the solutions. Specifically, in Lemma 3.1 we use the fact that when an edge e connects point sets P and Q that both contain at least one terminal (i.e. removing e results in Proof. Denote γ := τ 2 4096k2 . Suppose for contradiction's sake that all chains in F have weight less than γD. We consider a minor bF that is obtained from F by merging Steiner points of degree 2 with adjacent points. Hence, the vertex set of bF are the terminals together with Steiner points in F with degree at least 3. Moreover, an edge in bF corresponds to a chain in F , and its weight is Then by using the argument in Lemma 3.1, We can prove that every point u in bF is within γ · D to a terminal. Precisely, we shall replace the F in the argument of Lemma 3.1 with bF . We observe that the only difference caused by this replacement is when we the dis-connectivity of P and Q), it has to be d(P, Q) ≥ w(e), while the corresponding fact for bF is d(P, Q) ≥ w(e) Obtaining Contradiction. Recall that the terminal sets S and T are well-separated d(S, T ) ≥ τ D. Since all Steiner points in bF are at distance at most 4kγ log2 γ ·D from the terminals, it follows γ ·D > τ D−32k√γD > γD. that there must be an edge in bF with length at least τ D−8kγ log2 any i and u ∈ Ni and t ≥ 1, w(FB(u,tsi)) ≤ T(i,t+1) Lemma 3.3. Suppose F is an optimal net-respecting solution for an SFP instance W . Then, for 2 because of the net-respecting property. 1+Θ(ǫ) ≥ w(e) (W ) + O( skt ǫ )O(k)si. Proof. Given an optimal net-respecting solution F , we shall construct another net-respecting solu- tion in the following steps. u 8 8 1. Remove edges in FB(u,tsi). 2. Add edges corresponding to the heuristic T(i,t+1) 3. Add edges in a minimum spanning tree H of Nj ∩ B(u, (t + 2)si), where sj ≤ Θ( (t+1)k2 )· si < sj+1, where the constant in Theta depends on Lemma 3.2; convert each added edge into a net-respecting path if necessary. Observe that the weight of edges added in this step is O( stk (W ). u ǫ ǫ )O(k) · si. 4. To ensure feasibility, replace some edges without increasing the weight. If we can show that the resulting solution is feasible for W , then the optimality of F implies u and Feasibility. (W ). If a ∈ bB and b /∈ bB, then edges for the heuristic T(i,t+1) the result. We denote B := B(u, tsi) and bB := B(u, (t + 1)si). Define bV1 := {x : x ∈ B ∃{x, y} ∈ F s.t. y /∈ B and y is connected in FX\B to some point outside bB}, bV2 := {x : x ∈ bB \ B x is connected in F bB to some point in bV1,∃{x, y} ∈ F s.t. y /∈ bB}. In Step 4, we will ensure that all points in bV1 ∪ bV2 are connected to the MST H. If a pair {a, b} ∈ W has both terminals in bB, then they will be connected by the edges corre- sponding to T(i,t+1) (W ) ensures that a is connected to H; moreover, in the original tree F , if the path from a to b does not meet any node in bV2, then this path is preserved, otherwise there is a portion of the path from a point in bV2 to b that is still preserved. If both a and b are outside bB, then they might be connected in F via points in bV2; however, since all points in bV2 are connected to H, feasibility is ensured. We next elaborate how Step 4 is performed. Consider a connected component U in FbV1∪( bB\B) that contains a point in bV1. Let S1 := U ∩ bV1 and S2 := U ∩ bV2. If S2 = ∅, then there is an edge connecting S1 directly to a point outside bB. This means that both its end-points are in Nj by the Next, if there is a point z /∈ bB connected directly to some point y ∈ S2 such that d(y, z) ≥ si 2 , then by the net-respecting property, y ∈ Nj and so again U is connected to H. Otherwise, we net-respecting property, and hence S1 is already connected to H. u 9 have d(S1, S2) ≥ si S1 ∪ S2. Since U itself is net-respecting, this does not increase the cost. a chain in bU from some point u to v such that its length is at least Θ( 2 . We next replace U with an optimal net-respecting Steiner tree bU connecting Observing that Diam(S1 ∪ S2) ≤ 2(t + 1)si, we can use Lemma 3.2 to conclude that there exists k2(t+1) ) · si. Hence, we can remove this chain, and use its weight to add a net-respecting path from each of u and v to its nearest point in Nj. This does not increase the cost, and ensures that both S1 and S2 are connected to H. 1 Therefore, we have shown that Step 4 ensures that all points in cV1 and cV2 are connected to It is because of Lemma 3.3 that we choose H(i) (W ) to be the heuristic. u (W ) := T(i,4) u H. Corollary 3.1 (Threshold for Critical Instance). Suppose F is an optimal net-respecting solution for an SFP instance W , and q ≥ Θ( sk u (W ) ≤ qsi, then F is 2q-sparse. Lemma 3.4. Suppose W is an SFP instance. Consider i ∈ [L], u ∈ Ni, and t ≥ t′ ≥ 1. Suppose F is a net-respecting solution for W (i,t) ǫ )Θ(k). If for all i ∈ [L] and u ∈ Ni, H(i) . Then, T(i,t′) (W ) ≤ 4(1 + ǫ) · w(F ) + O( skt′ ǫ )O(k)si. u u u u u u u ǫ )O(k) · si. t′k2 ) · si < sj+1. ǫ )O(k)si. Then, the heuristic T(i,t′) ǫ )O(k)si. We first include F in the solution. It suffices to handle the terminal pairs in W (i,t′) with weight at most 2 · w(F ) + (W ) gives the weight of a net-respecting solution with cost Proof. We first show that there is a feasible solution for W (i,t′) O( skt′ at most 4(1 + ǫ) · w(F ) + O( skt′ \ W (i,t) . Such a pair {a, a′} must be induced from {a, b} ∈ W (i,t) such that a ∈ B(u, t′si) and b ∈ B(u, (t + δ)si) \ B(u, (t′ + δ)si). We next add more edges such that a is connected to a′, which lies in Nj, where sj ≤ Θ( δ2 We add a minimum spanning tree H on the points in Nj ∩ B(u, (t′ + δ)si). This has cost at most O( skt′ Consider a connected component U of F . Consider the terminal pairs {a, b} ∈ W (i,t) connected by U such that a ∈ B(u, t′si) and b ∈ B(u, (t + δ)si); let S1 be those terminals a's, and S2 be those terminal b's. Suppose bU is an optimal net-respecting Steiner tree connecting S1 ∪ S2. Since U is also net-respecting, it follows that the weight of bU is at most that of U . Since d(S1, S2) ≥ δsi and Diam(S1 ∪ S2) ≤ Θ(t′)si, it follows from Lemma 3.2 that there exists a chain from p to q in bU with weight at least Θ( δ2 t′k2 )· si. Hence, we can remove this chain, and use this weight to connect p and q to each of their closest points in Nj. This ensures that each point a ∈ S1 is connected to its closest point in Nj via the minimum spanning tree H. is at most w(F ). Hence, we have shown that there is a feasible solution to W (i,t′) 2 · w(F ) + O( skt′ If we perform this operation on each connected component U of F , the weight of edges added with cost at most ǫ )O(k)si, as required. u u 4 Decomposition into Sparse Instances In Section 3, we define a heuristic H(i) u (W ) to detect a critical instance around some point u ∈ Ni at distance scale si. We next describe how the instance W can be decomposed into W1 and W2 such that equation (1) in Section 2.1 is satisfied. Since the ball centered at u with radius around si could potentially separate terminal pairs in W , we use the idea in Section 3 for defining the heuristic to decompose the instance. 10 ǫ )Θ(k) according to Corol- Decomposing a Critical Instance. We define a threshold q0 := Θ( sk lary 3.1. As stated in Section 2.1, a critical instance is detected by the heuristic when a smallest i ∈ [L] is found for which there exists some u ∈ Ni such that H(i) (W ) > q0si. More- over, in this case, u ∈ Ni is chosen to maximize H(i) u (W ). To achieve a running time with an exp(O(1)k log(k)) dependence on the doubling dimension k, we also apply the technique in [CJ16] to choose the cutting radius carefully. u (W ) = T(i,4) u Claim 4.1 (Choosing Radius of Cutting Ball). Denote T(λ) := T(i,4+2λ) 0 ≤ λ < k such that T(λ + 1) ≤ 30k · T(λ). Proof. Suppose the contrary is true. Then, it follows that T(k) > (30k)k · T(0). We shall obtain a contradiction by showing that there is a solution for the instance W (i,4+2k) corresponding to T(k) = T(i,4+2k) (W ). Then, there exists (W ) with small weight. u u u Define N ′ i to be the set of points in Ni that cover B(u, (2k + 5)si), and similarly define N ′ j, u v over v ∈ N ′ j · 2(2k + 5) · si + N ′ Define edge set F to be the union of a minimum spanning tree on N ′ i. It follows that F is a feasible solution for the instance W (i,4+2k) j together with the union of . By i · T(0) ≤ q0si + (4k + 10)k · T(0) ≤ Hence, we have an upper bound for the heuristic T(k) ≤ 2(1 + Θ(ǫ))· w(F ) ≤ (30)k · T(0), which where sj ≤ δ · si ≤ sj+1. the edge sets H(i) the choice of u and q0, we have w(F ) ≤ N ′ (15k)k · T(0). gives us the desired contradiction. Cutting Ball and Sub-Instances. Suppose λ ≥ 0 is picked as in Claim 4.1, and sample h ∈ [0, 1 2 ] k ). Define B := B(u, (4 + 2λ + h)si) and bB := B(u, (4 + uniformly at random. Recall that δ := Θ( ǫ 2λ + h + δ)si). The instances W1 and W2 are induced by each pair {a, b} ∈ W as follows. (a) If a ∈ B and b ∈ bB, then include {a, b} in W1. (b) If a ∈ B and b /∈ bB, then include {a, a′} in W1 and {a′, b} in W2, where a′ is the closest point (c) If both a and b are not in B, then include {a, b} in W2. Lemma 4.1 (Sub-Instances Are Sparse). The sub-instances W1 and W2 satisfy the following. in Nj to a and sj ≤ δ · si < sj+1. (i) If F1 is feasible for W1 and F2 is feasible for W2, then the union F1 ∪ F2 is feasible for W . (ii) The sub-instance W2 does not have a critical instance with height less than i, and H(i) u (W2) = (iii) H(i) 0. u (W1) ≤ O(s)O(k) · q0 · si. Proof. The first two statements follow immediately from the construction. For the third statement, we use the fact that there is no critical instance at height i − 1 to show that there is a solution to W1 with small cost. Specifically, we consider a minimum spanning tree H on Nj∩B(u, 5si), where sj ≤ δ·si−1 < sj+1. Moreover, we consider the union of solutions corresponding to H(i−1) (W ), over v ∈ Ni−1 ∩ v Then, we have w(H) ≤ q0 · si. B(u, 5si). The cost is O(s)O(k) · q0 · si. implies that H(i) u (W1) ≤ O(s)O(k) · q0 · si. Hence, the union of H together with the edges for the H(i−1) v (W )'s is feasible for W1, and this Lemma 4.2 (Combining Costs of Sub-Instances). Suppose F is an optimal net-respecting solution for W . Then, for any realization of the decomposed sub-instances W1 and W2 as described above, 11 there exist net-respecting solutions F1 and F2 for W1 and W2, respectively, such that (1 − ǫ) · E[w(F1)] + E[w(F2)] ≤ w(F ), where the expectation is over the randomness to generate W1 and W2. Proof. Let B and bB be defined as above, and denote B := B(u, (4+2λ+1)·si). Hence, B ⊂ bB ⊂ B. We start by including FB in T1, and including the remaining edges in F in F2. We will then show how to add extra edges with expected weight at most ǫ· E[w(F1)] to make F1 and F2 feasible. This will imply the lemma. Define N to be the subset of Nj that cover the points in B, where sj < δsi ≤ sj+1. We include a copy of a minimum spanning tree H of N in each of F1 and F2, and make it net-respecting. This costs at most N · O(k) · si ≤ O( ks cost at most δ · w(FB). Connecting Crossing Points. To ensure the feasibility of F1, we connect the following sets of points to N . We denote: We next include the edges of F in the annulus bB \ B (of width δ) into F1. This has expected ǫ )O(k) · si. is incident to some edge in F with weight at least si V1 := {x ∈ B ∃y ∈ bB \ B,{x, y} ∈ F}, V2 := {y ∈ bB \ B ∃x ∈ B,{x, y} ∈ F}, and V3 := {x ∈ bB ∃y /∈ bB,{x, y} ∈ F}. We shall connect each point in V1 ∪ V2 ∪ V3 to its closest point in N . Note that if such a point x 4 , then the net-respecting property of F implies that x is already in N . Otherwise, this is because some edge {x, y} in F is cut by either B or bB, which happens with probability at most O( d(x,y) ). Hence, each edge {x, y} ∈ FB has an expected contribution of δsi · O( d(x,y) to N . Denote cV1 := {x ∈ B ∃y /∈ B,{x, y} ∈ F}. By the same argument, the expected cost to connect each point to N is also at most O(δ) · w(FB). Charging the Extra Costs to F1. Apart from using edges in F , the extra edges come from two copies of the minimum spanning tree H, and other edges with cost O(δ)· w(FB ). We charge these extra costs to F1. , by Lemma 3.4, Similarly, to ensure the feasibility of F2, we ensure each point in the following set is connected ) = O(δ) · d(x, y). (W ) > q0 · si and F1 is a net-respecting solution for W (i,4+2λ+h) 8 · si, by choosing large enough q0. ǫ )O(k) · si) > q0 4(1+ǫ) (T (i)(u, 4) − O( sk w(F1) ≥ 1 Since T (i,4) si si u u ǫ 2 · w(F1). Therefore, the cost for the two copies of the minimum spanning tree H is at most O( ks We next give an upper bound on w(FB), which is at most T(i,4+2(λ+1)) ǫ )O(k)·si ≤ ǫ )O(k) · si, (W ) ≤ 30k · T(i,4+2λ+1) by Lemma 3.3. By the choice of λ, we have T(i,4+2(λ+1)) (W ). Moreover, by Lemma 3.4, T(i,4+2λ+1) ǫ )O(k) · si. Hence, we can conclude that (W ) ≤ 4(1 + ǫ) · w(F1) + O( sk w(FB) ≤ O(k) · w(F1). k ), we can conclude that the extra costs O(δ)·w(FB ) ≤ 2 · w(F1). Therefore, we have shown that E[w(F1)] + E[w(F2)] ≤ w(F ) + ǫ · w(F1), where the right hand side is a random variable. Taking expectation on both sides and rearranging gives the required result. Hence, by choosing small enough δ = Θ( ǫ (W ) + O( sk u u u u ǫ 5 A PTAS for Sparse SFP Instances Our dynamic program follows the divide and conquer strategy as in previous works on TSP [Aro98, Tal04, BGK12] that are based on hierarchical decomposition. However, to apply the framework to 12 SFP, we need a version of the cell property that is more sophisticated than previous works [BKM08, BH12]. We shall first give a review of the hierarchical decomposition techniques in Section 5.1. Then in Section 5.2, we shall define our cell property precisely, and also prove that there exist good solutions that satisfy the cell property (in Lemma 5.6). Finally, we shall define DP in Section 5.3, and conclude a PTAS for sparse SFP instances (in Corollary 5.2). 5.1 Review on Hierarchical Decomposition Definition 5.1 (Single-Scale Decomposition [ABN06]). At height i, an arbitrary ordering πi is imposed on the net Ni. Each net-point u ∈ Ni corresponds to a cluster center and samples random χ−1 · ln χ hu from a truncated exponential distribution Expi having density function t 7→ χ for t ∈ [0, si], where χ = O(1)k. Then, the cluster at u has random radius ru := si + hu. The clusters induced by Ni and the random radii form a decomposition Πi, where a point p ∈ V belongs to the cluster with center u ∈ Ni such that u is the first point in πi to satisfy p ∈ B(u, ru). We say that the partition Πi cuts a set P if P is not totally contained within a single cluster. The results in [ABN06] imply that the probability that a set P is cut by Πi is at most β·Diam(P ) , · e− t ln χ si si si where β = O(k). Definition 5.2 (Hierarchical Decomposition). Given a configuration of random radii for {Ni}i∈[L], decompositions {Πi}i∈[L] are induced as in Definition 5.1. At the top height L − 1, the whole space is partitioned by ΠL−1 to form height-(L − 1) clusters. Inductively, each cluster at height i + 1 is partitioned by Πi to form height-i clusters, until height 0 is reached. Observe that a cluster has K := O(s)k child clusters. Hence, a set P is cut at height i iff the set P is cut by some partition Πj such that j ≥ i; this happens with probability at most Pj≥i β·Diam(P ) si = O(k)·Diam(P ) si . Portals. As in [Aro02, Tal04, BGK12], each height-i cluster U is equipped with portals such that a solution F is portal-respecting, if for every edge {x, y} in F between a point x in U and some point y outside U , at least one of x and y must be a portal of cluster U . As mentioned in [BGK12], the portals of a cluster need not be points of the cluster itself, but are just used as connection points. For a height-i cluster C, its portals is the subset of net-points in Ni′ that cover C, where i′ is the maximum index such that si′ ≤ max{1, 4βL · si}. As noted in [Tal04, BGK12, CJ16], any solution can be made to be portal-respecting with a multiplicative factor of 1 + O(ǫ) in cost. ǫ )k Since a height-i cluster has diameter O(si), by Fact 2.1, the cluster has at most m := O( βLs portals. (m, r)-Light Solution. A solution F is called (m, r)-light, if it is portal-respecting for a hierarchical decomposition in which each cluster has at most m portals, and for each cluster, at most r of its portals are used in F to connect points in the cluster to the points outside. ǫ 5.2 Structural Property In this section, we shall define the cell property (Definition 5.13) with respect to the effective cells (Definition 5.9), where the effective cells are carefully chosen to implement our adaptive cells idea which is discussed in Section 1. Specifically, the effective cells are defined by the union of the basic cells (Definition 5.5) and the non-basic cells (Definition 5.8). Moreover, the virtual cells and the promoted cells (Definition 5.7) are introduced in order to define the non-basic cells. Finally, we shall prove the structural property in Lemma 5.6. Notations and Parameters. Let ht(C) denote the height of a cluster C, des(C) denote the collection of all descendant clusters of C (including C), and par(C) denote the parent cluster of C. 13 For x ∈ R+, let ⌊x⌋s denote the largest power of s that is at most x, and ⌈x⌉s denote the smallest s2 ). Define γ0 such that power of s that is at least x. Define γ0 := Θ( 1 := ⌊ 1 γ0 γ0⌉s, and define γ1 such that 1 γ1⌋s. We note that γ0 < γ1. ks2L ), and define γ1 := Θ( ǫ := ⌈ 1 γ1 ǫ Definition 5.3 (Cell). Suppose C is a cluster of height i. A p-cell of C is a height-logs p sub-cluster of C. Definition 5.4 (Crossing Component). Suppose C is some cluster, and F is a solution for SFP. We say that a subset A crosses C, if there exists points x, y ∈ A such that x ∈ C and y /∈ C. A component A in F is called a crossing component of C if A crosses C. In the following, we shall introduce the notions of the basic cells, owner of basic cells, promoted cells, virtual cells, non-basic cells, and effective cells. All of these are defined with respect to some feasible solution to SFP. We assume there is an underlying feasible solution F when talking about these definitions. Adaptive Cells. For each cluster C, we shall define its basic cells whose heights depend on the weights l of the crossing components of C in the solution F . We consider three cases. si ≤ ⌊l⌋s < si} and I3(l) := {i i ≤ L,⌊l⌋s < γ0 γ1 si}. γ1 Define I1(l) := {i ⌊l⌋s ≥ si}, I2(l) := {i γ0 Define a function h : [L] × R+ → R+, such that  γ1si, γ1⌊l⌋s,  γ0si, ≤ h(i, l) ≤ h(i + 1, l). Lemma 5.1. h(i+1,l) h(i, l) = s for i ∈ I1(l) for i ∈ I2(l) for i ∈ I3(l) Proof. If both i and i + 1 lie in the same Ij(l) (j ∈ {1, 2, 3}), then it holds immediately. Otherwise, it is either i ∈ I2(l) but i + 1 ∈ I3(l), or i ∈ I1(l) but i + 1 ∈ I2(l). • If i ∈ I1(l) and i+1 ∈ I2(l). This implies si = ⌊l⌋s. Hence, h(i, l) = γ1si = γ1⌊l⌋s = h(i+1, l). • If i ∈ I2(l) and i + 1 ∈ I3(l). This implies si = γ1 γ0⌊l⌋s. Hence, s· h(i, l) = s· γ1⌊l⌋s = γ0si+1 = h(i + 1, l). This implies the inequality. Definition 5.5 (Basic Cell). Suppose C is a cluster of height i, and A is a crossing component of C. Define l := w(A). Define the basic cells of A in C, BasA(C), to be the collection of the h(i, l)-cells of C that intersect A. Define the basic cells of C, Bas(C), to be the union of BasA(C) for all crossing components A of C. Definition 5.6 (Owner of a Basic Cell). For some cluster C, define the owner of e ∈ Bas(C) to be the minimum weight crossing component A such that e ∈ BasA(C). Definition 5.7 (Promoted Cell and Virtual Cell). Suppose C is a cluster of height i. Let S be the set of sub-clusters of C that is not in Bas(C) but has a sibling in Bas(C). Consider each e ∈ S. • If there exists a sub-cluster C ′ of C such that e ∈ Bas(C ′), then define Proe(C) := des(e) ∩ Bas(C ′), and define Vire(C) := ∅, where C ′ ⊂ C is any one that satisfies e ∈ Bas(C ′). • Otherwise, define Proe(C) := ∅, and define Vire(C) := e. Finally, Pro(C) := Se∈S Proe(C), and Vir(C) := Se∈S Vire(C), and elements in Pro(C) and Vir(C) are called promoted cells and virtual cells respectively. 14 Lemma 5.2. For any cluster C, if e ∈ Vir(C), then for any cluster C ′ ⊂ C (C ′ may equal C), e\{e′ ∈ Bas(C ′) e′ ( e} has no intersection with any crossing component of C ′. Proof. Suppose not. Then, there exists a cluster C ′ ⊂ C, and a crossing component A of C ′, such that A intersects u := e\{e′ ∈ Bas(C ′) e′ ( e}. This implies that there exists u′ ∈ BasA(C ′), such that e ⊂ u′. By Lemma 5.1, and the fact that h(ht(C ′), w(A)) ≥ sht(e) and that h(0, w(A)) < sht(e), we know that there exists a cluster C ′′ ⊂ C ′ ⊂ C, such that e ∈ BasA(C ′′). This contradicts with the definition of virtual cells. Definition 5.8 (Non-basic Cell). We define the non-basic cells NBas(C) for a cluster C. If C is the root cluster, then NBas(C) = Pro(C) ∪ Vir(C)\Bas(C). For any other cluster C, define NBas(C) := {e ∩ C e ∈ Pro(C) ∪ Vir(C) ∪ NBas(par(C))\Bas(C)}. Definition 5.9 (Effective Cell). For a cluster C, define the effective cells of C as Eff(C) := Bas(C) ∪ NBas(C). Definition 5.10 (Refinement). Suppose S1 and S2 are collections of clusters. We say S1 is a refinement of S2, if for any e ∈ S2, either e ∈ S1, or all child clusters of e are in S1. Lemma 5.3. Suppose C is a cluster that is not a leaf. Define {Ci}i to be the collection of all the child clusters of C. Then Si Eff(Ci) is a refinement of Eff(C). Proof. Define S := Si Eff(Ci). It is sufficient to prove that for any e ∈ Eff(C), either e ∈ S, or all child clusters of e are in S. If e ∈ NBas(C) and e 6= C, then e ∈ S follows from Definition 5.8 and Definition 5.9. If e ∈ NBas(C) but e = C, then also by Definition 5.8 and Definition 5.9, C ∩ Ci = Ci ⊂ Eff(Ci), and this implies that all child clusters of e are in S. Otherwise, e ∈ Bas(C), then by Lemma 5.1, we know that either e ∈ S, or there exists e′ ⊂ e such that ht(e′) = ht(e)−1 and e′ ∈ S. Then all siblings of e′ are in S, by the definition of promoted cells and virtual cells. This implies that all child clusters of e are in S. Definition 5.11 (Candidate Center). Suppose C is a cluster of height i. The set of candidate 0 si Nj that may become a center of C's centers of C, denoted as Can(C), is the subset of Si j=logs γ2 child cluster in the hierarchical decomposition. Lemma 5.4. For any cluster C, the centers of clusters in Eff(C) are chosen from Can(C), and Can(C) ≤ κ, where κ := O( 1 Proof. We first prove that centers of cluster in Eff(C) are chosen from Can(C). )O(k). γ0 • For e ∈ Bas(C), by the definition of the basic cells, we have ht(e) ≥ logs γ0si. • For e ∈ Pro(C), we have that e is a basic cell of some cluster C ′, and hence ht(e) ≥ logs γ2 • For e ∈ Vir(C), since it is a sibling of a basic cell, so ht(e) ≥ logs γ0si. • For e ∈ NBas(C), there is a cluster C ′′ such that C ⊂ C ′′ and e ∈ Pro(C ′′) ∪ Vir(C ′′). Hence ht(e) ≥ logs γ2 We then bound Can(C). Suppose i := ht(C). Observe that a center of height j ≤ i that may become a center of a child cluster of C are contained in a ball of diameter O(si). Moreover, Nj is an sj packing. Hence, by packing property, Can(C) ≤ O( 1 Lemma 5.5. Suppose Eff is defined in terms of a solution that is (m, r)-light. Then for each cluster C, Eff(C) ≤ ρ, where ρ := O(logs 0si. Therefore, centers of clusters in Eff(C) are in Can(C). ) · r2 · O( s )O(k). 0 si. )O(k). γ0 1 γ0 γ1 15 Pro(C), Proof. Suppose C is of height i. We give upper bounds for Bas(C), Vir(C) and NBas(C) respectively. Bounding Bas(C). Fix a crossing component A of C, and suppose l := w(A). We upper bound BasA(C). • If i ∈ I1(l), then BasA(C) is a subset of γ1si-cells of C. By packing property, BasA(C) ≤ O( 1 γ1 • If i ∈ I2(l), then BasA(C) is a subset of γ1⌊l⌋s-cells of C. Since all the γ1⌊l⌋s-cells that )O(k). • If i ∈ I3(l), then BasA(C) is a subset of γ0si-cells of C. Since all the γ0si-cells that intersect intersect A are inside a ball of diameter O(l), by packing property, BasA(C) ≤ O( s A are inside a ball of diameter O( γ0 γ1 si), by packing property, BasA(C) ≤ O( 1 Since the solution is r-light, there are at most r crossing components. Therefore, )k. )k. γ1 γ1 Bas(C) ≤ r · O( s γ1 )O(k). Bounding Pro(C) and Vir(C). Recall that for e ∈ Bas(C), and for e′ /∈ Bas(C) that is a sibling of e, we either include e to Vir(C), or include des(e)∩ Bas(C ′) to Pro(C), for some sub-cluster C ′ of C. In either cases, the number of added elements is at most r · O( s )O(k), and we charge this to e. We observe that for each e ∈ Bas(C), it has at most O(s)k siblings, by packing property. Therefore, each e is charged at most O(s)k times. We conclude that γ1 Pro(C) ∪ Vir(C) ≤ O(s)k · r2 · O( s γ1 )O(k). We shall first prove that if ht(p) − ht(C) > 2 logs Bounding NBas(C). Suppose P is the set consisting of C and all its ancestor clusters. By definition, NBas(C) is a subset of the inside C clusters of Sp∈P (Pro(p) ∪ Vir(p)). , then there is no element in Pro(p) ∪ Vir(p) that can appear in NBas(C), for any p ∈ P . Suppose not. Then there exists some p such that . Let j := ht(p). We observe that all elements in Pro(p)∪ Vir(p) have height ht(p)− ht(C) > 2 logs at least logs γ2 , by Definition 5.7 and Definition 5.5. However, if some element in Pro(p)∪ Vir(p) appears in C, then it has height less than j − 2 logs . This is a contradiction. Therefore, , by ht(C) < ht(p)− 2 logs 0 sj = j − 2 logs 1 γ0 1 γ0 1 γ0 1 γ0 1 γ0 NBas(C) ≤ O(logs Hence Eff(C) ≤ Bas(C) + NBas(C) ≤ O(logs Definition 5.12 (Disjointification). For any collection of clusters S, define Dis(S) := {e\Se′∈S:e′(e e′}e∈S. We say e is induced by u in S, if u ∈ S and e = u\Se′∈S:e′(u e′, and the height of e is defined as 1 s ) · r2 · O( γ1 γ0 1 ) · r2 · O( s )O(k). γ0 )O(k). γ1 the height of u. Definition 5.13 (Cell Property). Suppose F is an SFP solution, and suppose f maps a cluster C to a collection of sub-clusters of C. We say that f satisfies the cell property in terms of F if for all clusters C, for all e ∈ Dis(f (C)), there is at most one crossing component of C in F that intersects e. Lemma 5.6 (Structural Property). Suppose an instance has a q-sparse optimal net-respecting solution F . Moreover, for each i ∈ [L], for each u ∈ Ni, point u samples O(k log n) independent random radii as in Definition 5.1. Then, with constant probability, there exists a configuration from the sampled radii that defines a hierarchical decomposition, under which there exists an (m, r)-light solution F ′ that includes all the points in F , and Eff defined in terms of F ′ satisfies the cell property, where 16 ǫ )k and r := O(1)k · q logs log n + O( k • E[w(F ′)] ≤ (1 + O(ǫ)) · w(F ), • m := O( skL bF with the desired m and r, and also satisfies Ehw(bF )i ≤ (1 + ǫ) · w(F ). ǫ )k + O( s ǫ )k. Proof. We observe that the argument in [BGK12, Lemma 3.1] readily gives an (m, r)-light solution We shall first show additional steps with additional cost at most ǫw(F ) in expectation, so that Bas defined in terms of the resultant solution satisfies the cell property. And then, we shall show that this implies Eff defined in terms of the resultant solution also satisfies the cell property (hence no more additional cost caused). Maintaining Cell Property: Basic Cells. For i := L, L−1, L−2, . . . , 0, for each height-i cluster C, we examine e ∈ Dis(Bas(C)) in the non-decreasing order of its height. If there are at least two crossing components that intersect e, we add edges in e to connect all crossing components that intersect e. We note that each added edge connects two components in F , and edges added are of length at most Diam(e). At the end of the procedure, we define the solution as F ′. We observe that Bas defined in terms of F ′ satisfies the cell property. Recall that each added edge connects two components. We charge the cost of the edge to one of the components that it connects to. Moreover, after a rearrangement (at the end of the procedure), we can make sure each edge is charged to one of the components it connects to and each component is charged at most once. Bounding The Cost. We shall show that for a fixed component A, the expected cost it takes charge of is at most ǫ · w(A). Define l := w(A). The expected cost that A takes is at most the following (up to contant) LX i=1 Pr[A takes an edge in a cell of height i] · si+1. Define pi := Pr[A takes an edge in a cell of height i]. Then, LX i=0 pi · si+1 ≤ X si+1 + X pisi+1 i:si>2γ1l pisi+1 i:si≤2γ1l ≤ O(γ1s)l + X ≤ O(ǫ)l + X i:si>2γ1l i:si>2γ1l pisi+1. Fix an i such that si > 2γ1l, and we shall upper bound pi. Suppose in the event corresponding to pi, A takes charge of an edge inside a cell e that is a basic cell of some height-h cluster. Note that h and e are random and recall that the edge is inside a cell of height i. We shall give a lower bound of h. Claim 5.1. sh ≥ si Proof. Define the weight of the owner of e to be l′. We first show that h must be in I3(l′). By the procedure of maintaining cell property, we know that l′ ≤ l. If h ∈ I1(l′), then ⌊l′⌋s ≥ sh, and si ≤ 2γ1sh by e is of height i and the choice of radius in the single-scale decomposition. This implies that si ≤ 2γ1sh ≤ 2γ1l, which cannot happen since we assume si > 2γ1l. 2γ0 . 17 If h ∈ I2(l′), then si ≤ 2γ1⌊l′⌋s. This implies that si ≤ 2γ1l, which cannot happen as well. Therefore, h ∈ I3(l′). This implies that 2γ0sh ≥ si. Since the event that the edge is taken by A automatically implies that A is cut by a height-h sj for j ∈ [L], we cluster, and the probability that A is cut at a height-j cluster is at most O(k) · conclude that l pi ≤ X j:sj≥ si 2γ0 Pr[A is cut at height j] ≤ O(k) · X j:sj≥ si 2γ0 l sj ≤ O(γ0k) · l si . Hence Pi:si>2γ1l pisi+1 ≤ O(γ0ksL) · l ≤ O(ǫ)l. Maintaining Cell Property: Effective Cells. Next we show that Bas defined in terms of F ′ satisfies the cell property implies that Eff defined in terms of F ′ also satisfies the cell property. component of C that intersects e in F ′. Suppose e is induced by u in Eff(C). Fix a cluster C and fix e ∈ Dis(Eff(C)). We shall prove that there is at most one crossing Lemma 5.7. If there is no cluster bC such that C ⊂ bC and u ∈ Vir(bC), then there exists cluster C ′ such that u ∈ Bas(C ′), ht(C ′) ≤ ht(C) and Eff(C) is a refinement of des(u) ∩ Bas(C ′). Proof. If u ∈ Bas(C), then we define C ′ = C, and the Lemma follows. If u ∈ NBas(C), then there exists C ′′ such that C ⊂ C ′′ and u ∈ Pro(C ′′). This is by the definition of non-basic cells, and by the assumption that there is not cluster bC such that C ⊂ bC and u ∈ Vir(bC). Then by the definition of the promoted cells, there exists cluster C ′ such that u ∈ Bas(C ′), ht(C ′) < ht(C ′′), and des(u) ∩ Bas(C ′) ⊂ Eff(C ′′). Since u ∈ NBas(C) ⊂ Eff(C) and by Lemma 5.3, we know that Eff(C) is a refinement of des(u)∩ Bas(C ′). Hence, it remains to show ht(C ′) ≤ ht(C). Suppose for contradiction that ht(C ′) > ht(C), so ht(C) < ht(C ′) < ht(C ′′). By the definition of non-basic cells, we have that NBas(C ′) ∩ Bas(C ′) = ∅. Since u ∈ Bas(C ′), we know that u /∈ NBas(C ′). However, this implies that u /∈ NBas(C), which contradicts with the assumption that u ∈ NBas(C). crossing component of C in F ′ that intersects e. If there exists cluster bC such that u ∈ Vir(bC) and C ⊂ bC, then by Lemma 5.2, there is no Otherwise, there is no cluster bC such that u ∈ Vir(bC) and C ⊂ bC. By Lemma 5.7, there exists a cluster C ′ such that u ∈ Bas(C ′), ht(C ′) ≤ ht(C) and Eff(C) is a refinement of des(u) ∩ Bas(C ′). We pick any one of such C ′. Define e′ ∈ Dis(Bas(C ′)) as the one induced by u in Bas(C ′). Since Bas defined in terms of F ′ satisfies the cell property, there is at most one crossing component of C ′ that intersects e′. Lemma 5.8. e ⊂ e′. Proof. Recall that e ∈ Dis(Eff(C)) is induced by u in Eff(C), and e′ ∈ Dis(Bas(C ′)) is induced by u in Bas(C ′). Then we can write e = u\P and e′ = u\P ′ such that P ⊂ Eff(C) and P ′ ⊂ Bas(C ′). Since P ′ = des(u) ∩ Bas(C ′), and Eff(C) is a refinement of des(u) ∩ Bas(C ′), we know that P ′ ⊂ P . This implies that e ⊂ e′. Since ht(C) ≥ ht(C ′), any crossing component of C is also a crossing component of C ′. Moreover, Lemma 5.8 implies that e ⊂ e′. Hence, if there are two crossing components A1, A2 of C that intersect e, then A1 and A2 are also crossing components of C ′ and both of them intersect e′. However, this cannot happen since Bas satisfies the cell property, and there is at most one crossing 18 component in C ′ that intersects e′. Therefore, there is at most one crossing component of C that intersects e. 5.3 Dynamic Program Recall that the input of DP is an instance that has a q-sparse optimal net-respecting solution, where q ≤ O(s)O(k) · q0, by Lemma 4.1 and Corollary 3.1. In the DP algorithm, O(k log n) random radii are independently sampled for each u ∈ Ni, i ∈ [L], and then a dynamic programming based algorithm is used to find a near optimal SFP solution over all hierarchical decompositions defined by the radii. In this section, we shall describe in detail the dynamic program and an algorithm that solves the dynamic program efficiently. For completeness, we shall also analyze the correctness of the dynamic program. We first describe the information needed to identify each cluster at each height. Information to Identify a Cluster. Each cluster is identified by the following information. O(nk). 1. Height i and cluster center u ∈ Ni. This has L · O(nk) combinations, recalling that Ni ≤ 2. For each j ≥ i, and v ∈ Nj such that d(u, v) ≤ O(sj), the random radius chosen by (v, j). Observe that the space around B(u, O(si)) can be cut by net-points in the same or higher heights that are nearby with respect to their distance scales. As argued in [BGK12], the = nO(1)k number of configurations that are relevant to (u, i) is at most O(k log n)L·O(1)k , where L = O(logs n) and s = (log n)Θ( 1 k ). 3. For each j > i, which cluster at height j (specified by the cluster center vj ∈ Nj) contains the current cluster at height i. This has O(1)kL = nO( log log n ) combinations. k2 To define the dynamic program, we start by defining the entries. Entries of DP. We define entries as (C, (R, Y ), (BAS, NBAS), (g, P )). Define U := Dis(BAS ∪ NBAS). We define the following internal constraints for entries, where the parameters m, r are as defined in Lemma 5.6, and ρ is as defined in Lemma 5.5. connected inside C. • C is a cluster. • R is a subset of the m pre-defined portals, such that R ≤ r. This intends to denote the active portals. • Y ⊂ 2R is a partition of R. We intend to use it to record the subsets of portals that are • BAS and NBAS are collections of sub-clusters of C such that BAS ∩ NBAS = ∅ and BAS ∪ NBAS ≤ ρ, and the centers of the clusters in BAS∪ NBAS are chosen from Can(C). Moreover, e ∈ BAS implies that any sibling cluster of e is in BAS ∪ NBAS. We intend to use this to record the basic cells and non-basic cells. • g is a mapping from U to 2Y . For some e ∈ U , we intend to use g(e) to denote the portals • P ⊂ 2Y is a partition of Y , such that ∀e ∈ U , g(e) = Q implies that Q is a subset of a part We only consider the entries that satisfy the internal constraints. We capture the intended use of an entry formally as follows. in P . The intended use of P is to denote the portals that are to be connected outside C. that e connects to inside C. Definition 5.14 (Compatibility). Suppose F is a graph on the metric space, and E is an entry. Let E := (C, (R, Y ), (BAS, NBAS), (g, P )). Define F ′ := FC∪R. We say F is compatible to E, if F ′ satisfies the following. 1. A part y is in Y , if and only if F ′ connects all the portals in y. 2. BAS covers all components of F ′ that intersect R. 19 3. For e ∈ U , g(e) is exactly the collection of subsets of Y that e is connected to by F ′. 4. Every terminal in C is visited by F ′. 5. Every isolated terminal of C is connected to at least one portal in R by F ′. 6. Every terminal pair that both lie in C is either in the same component of F ′, or they are connected to y1 and y2 in Y by F ′ and {y1, y2} is a subset of a part in P . We bound the number of entries in the following lemma. ) · O(κmr)O(k)k·ρr number of en- Lemma 5.9 (Number of Entries). There are at most O(nO(1)k tries. Moreover, for any fixed cluster C, the number of entries with C as the cluster is at most O(κmr)O(k)k·ρr. (κ is defined as in Lemma 5.4.) Proof. Since R is a set of at most r portals chosen from m pre-defined portals, there are at most O(mr) possibilities of R. Then after R is fixed, there are O(rr) possibilities of Y , since Y is a partition of Y and R ≤ r. To count the number of BAS and NBAS, we count the union S := BAS ∪ NBAS of them, and then for any fixed S we count the number of ways to assign elements in S to BAS and NBAS. Since it is required that the centers of clusters in S are chosen from Can(C), to form S, we first choose at most ρ centers from Can(C). There are at most O(κρ) possibilities for this, by Lemma 5.4. For each chosen center u that is of height iu, we count the number of configurations of the cluster Cu centered at u. Since C is already fixed, we only need to consider relevant radii for clusters of height less than ht(C) and at least iu. Since u ∈ Can(C), and for j ≥ iu there are O(1)k clusters of height-j can configurations affect u, we conclude that there are at most O(k log n) for Cu. Since S ≤ ρ, there are at most O(k log n)O(k)k·ρ configurations for all clusters in S, for any given the centers. Therefore, there are O(κ)O(k)k·ρ possibilities for S in total. Then we assign elements in S to one of BAS, NBAS, and there are at most 2S ≤ 2ρ number of them. In conclusion, the number of possibilities for BAS and NBAS is at most O(κ)O(k)k·ρ. With S fixed, we count the number of possibilities of g. Since g is a mapping from U to 2Y , the number of such a mapping is at most O((2Y )U ) ≤ O(2ρ·r). Finally, observe that P is a partition of Y , and Y ≤ r. This implies that P has at most O(rr) possibilities. ≤ O(k log n)O(k)k O(1)k·logs ( 1 γ2 0 ) Therefore, after fixing C, there are at most O(κmr)O(k)k·ρr possibilities for ((R, Y ), (BAS, NBAS), (g, P )). We then count the number of possibilities of C. Observe that there are O(n)O(k) centers for C. For a fixed center, since the number of configurations is at most nO(1)k , we conclude that there are at most O(nO(1)k ) · O(κmr)O(k)k·ρr entries in total. After we define the entries, we shall (recursively) define the value that is associated with each entry. The intended value of an entry E is the weight of the minimum graph that is recursively compatible to E (see definition 5.18). Definition 5.15 (Child Entry Collection). Suppose E := (C, (R, Y ), (BAS, NBAS), (g, P )) is an en- try. We say a collection of entries {(Ci, (Ri, Yi), (BASi, NBASi), (gi, Pi))}i is a child entry collection of E, if {Ci}i is a partition of C with ht(Ci) = ht(C) − 1 for all i. Definition 5.16 (Portal Graph). We say a graph G is a portal graph of a collection of entries I := {(Ci, (Ri, Yi), (BASi, NBASi), (gi, Pi))}i, if the vertex set of G is Si Ri. Definition 5.17 (Consistency Checking). Suppose E := (C, (R, Y ), (BAS, NBAS), (g, P )) is an entry, and I := {(Ci, (Ri, Yi), (BASi, NBASi), (gi, Pi))}i is a child entry collection of E and G is a portal graph of I. We say G and I are consistent with E, if all checks in the following procedure are passed. 20 cluster of e. i to be a mapping from Ui to 2Y , where g′ 1. Check if Si (Ci ∪ Ri) = C ∪ R. 2. We shall define Y ′ to be a partition of R′ := Si Ri. Initialize Y ′ := Si Yi, and whenever there are y1, y2 ∈ Y ′ connected by G or y1 ∩ y2 6= ∅, replace them by the union of them. Check if Y ′ restricted to R is exactly Y . 3. For each e ∈ BAS, check if there exists i and e′ ∈ BASi, such that e′ = e or e′ is a child 4. For each e ∈ NBAS, check if either there exists i and e′ ∈ BASi ∪ NBASi such that e = e′, or all child clusters of e are in Si (BASi ∪ NBASi). i(e) := {y ∩ R y ∈ Y ′ ∧ ∃y′ : (y′ ∈ 5. Define g′ gi(e) ∧ y ∩ y′ 6= ∅)}, for e ∈ Ui. Here g′ i(e) intends to mean the parts in Y that e connects to, which is defined by "extending" gi(e) with respect to G. For each i and u ∈ BASi, if there i(e) 6= ∅, then check if there exists u′ ∈ BAS such that exists e ∈ Ui such that e ⊂ u and g′ u = u′ or u is a child cluster of u′. i(e′), for e ∈ U . Check if g′ is exactly g. We observe that here we consider e′ ⊂ e only, and we shall see later why this is sufficient. 7. For each i, for each y1, y2 ∈ Yi (y1 6= y2) such that y1, y2 are in the same part of Pi, check if 1 6= y′ either there exists y ∈ Y ′ such that y1 ∪ y2 ⊂ y, or there exists y′ 2, y1 ⊂ y′ 2 ∩ R} is a subset of a part in P . This intends to check if the parts in Pi are connected by G, or the information in Pi's is passed to P . 6. Define a mapping g′ from U to 2Y , where g′(e) := SiSe′∈Ui:e′⊂e g′ 2 ∈ Y ′ such that y′ 1, y2 ⊂ y′ 2, y′ 1 ∩ R 6= ∅, y′ 2 ∩ R 6= ∅, and {y′ 1 ∩ R, y′ 1, y′ 8. For each terminal pair (a, b) such that a ∈ Ci and b ∈ Cj for i 6= j, suppose a ∈ ei and i(ei) 6= ∅, j(ej) is a subset of a part in P . This intends to check if (a, b) are already b ∈ ej for ei ∈ Ui and ej ∈ Uj. Check if gi(ei) is connected by G to gj(ej), or if g′ g′ j(ej) 6= ∅, g′ connected by G, or otherwise they will be connected outside C. i(ei)∪ g′ 9. For each isolated terminal a in C, check if there exists i and e ∈ Ui, such that a ∈ e and g′ i(e) is non-empty. Definition 5.18 (Recursive Compatibility). Suppose E := (C, (R, Y ), (BAS, NBAS), (g, P )) is an entry, and F is some graph on the metric space. F is recursively compatible with E, if there exists a set S of entries with E ∈ S and with a unique entry in S that corresponds to each descendant cluster of C, such that the following requirements hold. • For each E′ := (C ′, (R′, Y ′), (BAS′, NBAS′), (g′, P ′)) in S, we require F ′ := FC ′∪R′ be com- • For each E′ := (C ′, (R′, Y ′), (BAS′, NBAS′), (g′, P ′)) in S, suppose the child entry collection that consisting of elements in S is I ′, and define I ′ := {(Ct, (Rt, Yt), (BASt, NBASt), (gt, Pt))}t. Define G′ := FSt Rt. (Note that G′ is a portal graph of I ′.) We require I ′ and G′ be consistent with E′. patible to E′. Value of Entries. For any entry E := (C, (R, Y ), (BAS, NBAS), (g, P )), we shall define its value val(E). The height-0 clusters are corresponding to the base cases. In particular, for any C := {x} that is a height-0 cluster, we define entries with such C and with BAS := {C}, NBAS := ∅, R := C, Y := {R}, g(C) := Y , P := {Y } to be the base entries. All base entries have value 0. All other (non-base) entries with height-0 clusters have value ∞. We then define val(E) when ht(C) 6= 0. Define IE to be the set of tuples (I, G), such that I is a child entry collection of E and G is a portal graph of I, and I, G are consistent. The value of E is defined as val(E) := min(I,G)∈IE{w(G) + val(I)}, where val(I) = PE ′∈I val(E′). As we shall see in Lemma 5.12, for any entry E, if val(E) 6= ∞, then there actually exists a graph that is recursively compatible to E with weight val(E). 21 , where κ is defined as in Lemma 5.4. Lemma 5.10 (Counting IE). For any entry E, the number of possibilities of IE is at most O(k log n)O(s)k · O(κmr)O(sk)O(k)·ρr2 Proof. Define E := (C, (R, Y ), (BAS, NBAS), (g, P )). We first bound the number of possibilities of child entry collections I := {(Ci, (Ri, Yi), (BASi, NBASi), (gi, Pi))}i of C. To define I, we start by defining {Ci}i. By packing property, there are at most O(s)k centers for the child clusters of C. For each center u of the child cluster, there are at most O(k log n) possible radii. Hence, there are at most O(k log n)O(s)k By Lemma 5.9, there are at most Z possibilities for ((Ri, Yi), (BASi, NBASi), (gi, Pi)) for any possibil- fixed Ci, where Z := O(κmr)O(k)k·ρr. Therefore, there are at most O(k log n)O(s)k · Z O(s)k ities of I. possibilities for {Ci}i. For a fixed I, the vertex set of the portal graph G of I is fixed, and there are at most O(s)k · r vertices in G. Then the number of possibilities of G for a fixed I is at most the number of edge sets, and it is at most 2O(s)O(k)·r2 since there are at most (O(s)k · r)2 edges. In conclusion, there are at most O(k log n)O(s)k · Z O(s)k · 2O(s)O(k)·r2 . at most O(k log n)O(s)k · O(κmr)O(sk)O(k)·ρr2 Final Entry. The final entry is the entry with C being the root cluster, R, BAS, NBAS to be ∅, and Y, g, P being uniquely defined from R, BAS, NBAS = ∅. We use the value of the final entry as the output of DP. Evaluating The Final Entry Although we only care about the value of the final entry, it may be necessary to evaluate the value of other entries. We shall define a (recursive) algorithm in Definition 5.19 that takes an entry and returns the value of the input. To get the value of the final entry which is the output of DP, we invoke the algorithm with the final entry as the input. possibilities of IE, which is We note that the counting argument in Lemma 5.9 and Lemma 5.10 can both be naturally implemented as algorithms, with additional O(nO(k)) factors in the running time compared with the corresponding counting bounds. We will make use of these implementations as subroutines in Definition 5.19. Moreover, the natural implementation of the consistency checking procedure in Definition 5.17 runs in time O(nO(k)). Definition 5.19 (Algorithm for Evaluating Value of Entries). We define a recursive procedure that evaluates the value of an input entry E := (C, (R, Y ), (BAS, NBAS), (g, P )). • If ht(C) = 0, then the value of it is already defined, and we return its value. • If ht(C) > 0 and val(E) is already calculated, then we return the calculated value. • Otherwise, ht(C) > 0 and val(E) has not yet calculated. The following procedure is executed. 1. Set the default value for val(E) := ∞. 2. Calculate IE. 3. For each element (I, G) ∈ IE, use the consistency checking procedure defined in Defini- tion 5.17 to check if I and G are consistent with E. If they are consistent, then recur- sively use this procedure to calculate val(I) + w(G), and update val(E) if val(E) + w(G) is smaller than val(E). 4. Finally, return val(E) as the output. Lemma 5.11 (Running Time). The running time for the algorithm defined in Definition 5.19 is at most O(nO(1)k ) · exp(√log n · O( k ǫ )O(k)). Proof. Suppose the input is E := (C, (R, Y ), (BAS, NBAS), (g, P )). We observe that once the value for some entry is calculated, it would not be calculated again, and recalling the value takes constant time. Then we shall bound the time when val(E) is not yet calculated and ht(C) 6= 0. 22 Observe that for any given I with val(E′) for all E′ ∈ I known and a graph G such that (I, G) ∈ IE, evaluating val(I) + w(G) takes O(n)O(k) time. Therefore, combining with Lemma 5.9 and Lemma 5.10, there are at most O(nO(1)k ) · Z entries, and it takes O(n)O(k) · O(k log n)O(s)k · O(κmr)O(sk)O(k)·ρr2 In conclusion, the time for evaluating all the entries is at most O(nO(1)k Substituting Parameters. Recall that we consider q ≤ O(s)O(k) · q0. Observe that γ0⌉s ≤ O( ks3L ⌈ 1 ρ ≤ O( sk ) · O(k log n)O(s)k · O(κmr)O(sk)O(k)·ρr2 ), and 1 γ1 ǫ )O(k). Moreover, ǫ ). Substituting γ0 and γ1, we have κ ≤ O( ksL := ǫ )O(k) and γ1⌋s ≤ O( s2 to evaluate each. := ⌊ 1 1 γ0 . ǫ r := O(1)k · q logs log n + O( k ǫ )k + O( s ǫ )k ≤ O( sk ǫ )O(k), m ≤ O( skL ǫ )k. By definition, s := (log n) c k , L := O(logs n) = O( k log n c log log n ). Therefore, the running time is at most O(nO(1)k ≤ O(nO(1)k ≤ O(nO(1)k ≤ O(nO(1)k · O(κmr)O(sk)O(k)·ρr2 ) · O(k log n)O(s)k ǫ )O(k) ) · O(k log n)O(s)k · O( k ) · exp(O(s)O(k) · O( ǫ ) · exp(O( ǫ )O(k) · log )O(k) · O(log n)O(c) · log log n). )O( sk k log n ksL k ǫ ǫ ) By choosing constant c to be sufficiently small so that O(log n)O(c) · log log n ≤ O(√log n), we conclude that the running time is at most O(nO(1)k ) · exp(√log n · O( k ǫ )O(k)). Lemma 5.12 (Characterizing the Value of Entries). For each entry E := (C, (R, Y ), (BAS, NBAS), (g, P )) with val(E) 6= ∞, val(E) is the weight of the minimum weight graph that is recursively compatible to the entry and uses points in C ∪ R only. Proof. For the clusters of height 0, the Lemma holds trivially. Assuming the Lemma holds for all entries with the clusters of height i− 1, we prove the Lemma for an entry E with C of height i centered at u ∈ Ni, where i ≥ 1. We shall first show that val(E) is the weight of some graph that is recursively compatible to the entry and uses points in C ∪ R only. Then we shall show that the value is minimum. Feasibility. Suppose (I, G) := arg min(I ′,G′)∈IE{val(I ′) + w(G′)}. Define I = {Ej}j, where Ej := (Cj, (Rj, Yj), (BASj, NBASj), (gj , Pj )). Since val(E) 6= ∞, we have val(I ′) 6= ∞. For Ej ∈ I, by assumption, there exists a graph that is recursively compatible to Ej and uses points in Cj ∪ Rj only, and we denote it as Fj. We define a graph F that is the union of Fj for all j, and G. Then w(F ) = val(I) + w(G). We shall show that F is recursively compatible to E. Since (I, G) ∈ IE, I and G are consistent with E. Since Fj is recursively compatible to Ej for all j, it remains to verify F is compatible to E. When we say "consistency checking procedure", we refer to Definition 5.17. • F uses points in C ∩ R only. This is by definition. • A part y is in Y , if and only if F connects all the portals in the part y. This is by the step 2 • BAS covers all components of F that intersect R. This is by step 5 of the consistency checking of the consistency checking procedure. procedure. 23 • For e ∈ U , the collection of subsets of Y that e is connected to by F is exactly g(e). We note that step 3, 4 of the consistency checking procedure, together with the internal constraint that e′ ∈ BASj implies any sibling cluster of e′ is in BASj ∪ NBASj for all j. This implies that Sj (BASj ∪ NBASj) is a refinement of BAS ∪ NBAS. Then, for each j, for each e′ ∈ Uj, and for each e ∈ U , either e′ ⊂ e or e′ ∩ e = ∅. Therefore, step 6 is sufficient to ensure this item. (If e′ is not a subset of e but e′ ∩ e 6= ∅, then the gj mappings in the sub-entries have not sufficient information to determine the portals that e′ ∩ e is connected to.) • Every terminal in C ∪ R is visited by F . This is by the construction of F , and by Fj is recursively compatible to Ej for all j. • Every isolated terminal of C is connected to at least one portal in R by F . This is by step 9 • Every terminal pair that both lie in C is either in the same component of F , or they are connected to y1 and y2 in Y by F and {y1, y2} is a subset of a part in P . This is by step 7, 8 of the consistency checking procedure, and by Fj is recursively compatible to Ej for all j. of the consistency checking procedure. This implies that F is recursively compatible to E. Optimality. Then we shall show that val(E) is minimum. Suppose not. Define l as the weight of the minimum weight graph that is recursively compatible to E and uses points in C ∪ R only. Define F ′ to be the corresponding graph recursively compatible to E with weight l. Since F ′ is recursively compatible to E, there exists I ′ := {Et := (Ct, (Rt, Yt), (BASt, NBASt), (gt, Pt))}t and a portal graph G′ of I ′ that are consistent with E. Moreover, there exists a graph Ft that is recursively compatible to Et, for all t. We note that (I ′, G′) ⊂ IE. Therefore, Pt w(Ft) + w(G′) = l < val(E) ≤ val(I ′) + w(G′). This implies that Pt w(Ft) < PE ′∈I ′ val(E′), and hence there exists t such that w(Ft) < val(Et). However, we know that Ft is recursively compatible to Et, and by assumption, val(Et) ≤ w(Ft). This is a contradiction. Corollary 5.1. There exists a feasible solution to SFP whose weight is the value of the final entry. Lemma 5.13 (Good Solution is Recursively Compatible). Suppose for each i ∈ [L] and u ∈ Ni, O(k log n) radii are fixed. Suppose F is an (m, r)-light solution such that Eff satisfies the cell property in terms of F under one of the hierarchical decompositions defined by the radii. Then the value of the final entry is at most w(F ). Proof. We shall show that F is recursively compatible to the final entry, and then Lemma 5.12 implies that the value of the final entry is at most w(F ). Suppose we fix a hierarchical decomposition induced from the given radii, such that F is (m, r)- light and Eff satisfies the cell property in terms of F . For each cluster C in the decomposition, we define FC := FC∪R, define an entry EC := (C, (RC , YC ), (BASC , NBASC), (gC , PC )) as follows, where R is the set of active portals for C. • RC := R. • YC contains a part y, if and only if portals in y is connected by FC. • BASC := Bas(C), NBASC := NBas(C). • For each e ∈ UC, let gC(e) := Q, where Q is the collection of parts in YC that e is connected • Define PC to be any one that satisfies 1. for each e ∈ UC , gC (e) = Q implies Q is a subset of PC ; 2. for each terminal pair (a, b) that both lie in C, if they are not connected by FC then the to by FC. subsets of portals that a and b are connected by FC are in a same part of PC . 24 The internal constraints for an entry is satisfied, from the definition of the cells, the fact that Eff satisfies the cell property, Lemma 5.4 and Lemma 5.5. Then we (uniquely) define IC := {(Ci, (Ri, Yi), (BASi, NBASi), (gi, Pi))}i as the child collection of EC, and define GC := FSi Ri as the portal graph of IC. We then check that IC and GC are consistent with EC . Step 1, 2, 7, 8, 9 are immediate. Step 3, 4, 5 follow from the definition of the basic cells and non-basic cells. Inside step 6, we observe that g′(e) is evaluated by looking at e′ ⊂ e only (instead of considering all e′ ∈ Ui), for e′ ∈ Ui for some i, and e ∈ U . However, this is indeed sufficient, since Lemma 5.3 asserts that for any e ∈ U , e′ ∈ Ui for any i, either e′ ⊂ e′ or e ∩ e′ = ∅. is by definition. It remains to check the following for EC , for each cluster C. • A part y ∈ YC, if and only if FC connects all the portals in the part y. This is by definition. • BAS covers all components of FC that intersect RC . This is by definition. • For e ∈ UC, the collection of subsets of YC that e is connected to by FC is exactly gC (e). This • Every terminal in C ∪ RC is visited by FC . This is by the feasibility of F . • Every isolated terminal of C is connected to at least one portal in RC by FC . This is by the • Every terminal pair that both lie in C is either in the same component of FC , or they are connected to y1 and y2 in YC by FC and {y1, y2} is a subset of a part in PC . This is by definition. feasibility of F . This finishes the proof. Combining Lemma 5.6, Lemma 5.13, Corollary 5.1 and Lemma 5.11, we conclude a PTAS for sparse SFP instances. Corollary 5.2 (PTAS for Sparse SFP Instances). For an instance of SFP that has a q-sparse optimal net-respecting solution, algorithm DP returns a (1 + ǫ) solution with constant probability, running in time O(nO(1)k ) · exp(√log n · O( k ǫ )O(k)), for q ≤ O(s)O(k) · q0. References [ABN06] Ittai Abraham, Yair Bartal, and Ofer Neiman. Advances in metric embedding theory. In STOC, pages 271 -- 286. ACM, 2006. [AKR95] Ajit Agrawal, Philip N. Klein, and R. Ravi. When trees collide: An approximation al- gorithm for the generalized steiner problem on networks. SIAM J. Comput., 24(3):440 -- 456, 1995. [Aro98] [Aro02] Sanjeev Arora. Polynomial time approximation schemes for euclidean traveling sales- man and other geometric problems. J. ACM, 45(5):753 -- 782, 1998. S. Arora. Approximation algorithms for geometric TSP. In The traveling salesman problem and its variations, volume 12 of Comb. Optim., pages 207 -- 221. Kluwer Acad. Publ., Dordrecht, 2002. [Ass83] P. Assouad. Plongements lipschitziens dans Rn. Bull. Soc. Math. France, 111(4):429 -- 448, 1983. [BDHM16] MohammadHossein Bateni, Erik D. Demaine, MohammadTaghi Hajiaghayi, and D´aniel Marx. A PTAS for planar group steiner tree via spanner bootstrapping and prize collecting. In STOC, pages 570 -- 583. ACM, 2016. 25 [BGK12] Yair Bartal, Lee-Ad Gottlieb, and Robert Krauthgamer. The traveling salesman prob- lem: low-dimensionality implies a polynomial time approximation scheme. In STOC, pages 663 -- 672. ACM, 2012. [BGRS10] Jaroslaw Byrka, Fabrizio Grandoni, Thomas Rothvoss, and Laura Sanit`a. An improved lp-based approximation for steiner tree. In STOC, pages 583 -- 592. ACM, 2010. [BH12] MohammadHossein Bateni and MohammadTaghi Hajiaghayi. collecting steiner forest. Algorithmica, 62(3-4):906 -- 929, 2012. Euclidean prize- [BHM11] MohammadHossein Bateni, Mohammad Taghi Hajiaghayi, and D´aniel Marx. Approx- imation schemes for steiner forest on planar graphs and graphs of bounded treewidth. J. ACM, 58(5):21, 2011. [BKM08] Glencora Borradaile, Philip N. Klein, and Claire Mathieu. A polynomial-time approx- imation scheme for euclidean steiner forest. In FOCS, pages 115 -- 124. IEEE Computer Society, 2008. [CC08] [CJ16] Miroslav Chleb´ık and Janka Chleb´ıkov´a. The steiner tree problem on graphs: Inap- proximability results. Theor. Comput. Sci., 406(3):207 -- 214, 2008. T.-H. Hubert Chan and Shaofeng H.-C. Jiang. Reducing curse of dimensionality: Im- proved PTAS for TSP (with neighborhoods) in doubling metrics. In SODA, pages 754 -- 765. SIAM, 2016. [DHC85] DZ Du, FK Hwang, and SC Chao. Steiner minimal tree for points on a circle. Proceed- ings of the American Mathematical Society, 95(4):613 -- 618, 1985. [DHK14] Erik D. Demaine, Mohammad Taghi Hajiaghayi, and Philip N. Klein. Node-weighted steiner tree and group steiner tree in planar graphs. ACM Trans. Algorithms, 10(3):13:1 -- 13:20, 2014. [DHW87] Ding-Zhu Du, Frank K. Hwang, and JF Weng. Steiner minimal trees for regular poly- gons. Discrete & Computational Geometry, 2(1):65 -- 84, 1987. [DL97] [GK15] M. M. Deza and M. Laurent. Geometry of cuts and metrics, volume 15 of Algorithms and Combinatorics. Springer-Verlag, Berlin, 1997. Anupam Gupta and Amit Kumar. Greedy algorithms for steiner forest. pages 871 -- 878. ACM, 2015. In STOC, [GKL03] Anupam Gupta, Robert Krauthgamer, and James R. Lee. Bounded geometries, fractals, In FOCS, pages 534 -- 543. IEEE Computer Society, and low-distortion embeddings. 2003. [GKR00] Naveen Garg, Goran Konjevod, and R. Ravi. A polylogarithmic approximation algo- rithm for the group steiner tree problem. J. Algorithms, 37(1):66 -- 84, 2000. [GW95] [HK03] Michel X. Goemans and David P. Williamson. A general approximation technique for constrained forest problems. SIAM J. Comput., 24(2):296 -- 317, 1995. Eran Halperin and Robert Krauthgamer. Polylogarithmic inapproximability. In STOC, pages 585 -- 594. ACM, 2003. 26 [HK13] [Mat02] [Tal04] Mathias Hauptmann and Marek Karpi´nski. A compendium on steiner tree problems. Inst. fur Informatik, 2013. J. Matousek. Lectures on discrete geometry, volume 212 of Graduate Texts in Mathe- matics. Springer-Verlag, New York, 2002. Kunal Talwar. Bypassing the embedding: algorithms for low dimensional metrics. In STOC, pages 281 -- 290. ACM, 2004. 27
1706.02202
1
1706
2017-06-07T14:14:50
Isomorphic coupled-task scheduling problem with compatibility constraints on a single processor
[ "cs.DS", "cs.CC" ]
The problem presented in this paper is a generalization of the usual coupled-tasks scheduling problem in presence of compatibility constraints. The reason behind this study is the data acquisition problem for a submarine torpedo. We investigate a particular configuration for coupled tasks (any task is divided into two sub-tasks separated by an idle time), in which the idle time of a coupled task is equal to the sum of durations of its two sub-tasks. We prove -completeness of the minimization of the schedule length, we show that finding a solution to our problem amounts to solving a graph problem, which in itself is close to the minimum-disjoint-path cover (min-DCP) problem. We design a (3a+2b)/(2a+2b)-approximation, where a and b (the processing time of the two sub-tasks) are two input data such as a>b>0, and that leads to a ratio between 3/2 and 5/4. Using a polynomial-time algorithm developed for some class of graph of min-DCP, we show that the ratio decreases to 1.37 .
cs.DS
cs
Noname manuscript No. (will be inserted by the editor) Isomorphic coupled-task scheduling problem with compatibility constraints on a single processor G. Simonin · B. Darties · R. Giroudeau · J.-C. König Received: date / Accepted: date Abstract The problem presented in this paper is a generalization of the usual coupled-tasks scheduling pro- blem in presence of compatibility constraints. The rea- son behind this study is the data acquisition problem for a submarine torpedo. We investigate a particular configuration for coupled-tasks (any task is divided into two sub-tasks separated by an idle time), in which the idle time of a coupled-task is equal to the sum of dura- tions of its two sub-tasks. We prove NP-completeness of the minimization of the schedule length, we show that finding a solution to our problem amounts to solving a graph problem, which in itself is close to the minimum- disjoint path cover (min-DCP) problem. We design a 2a+2b(cid:17)- approximation, where a and b (the process- (cid:16) 3a+2b ing time of the two sub-tasks) are two input data such as a > b > 0, and that leads to a ratio between 3 2 and 5 4 . Using a polynomial-time algorithm developed for some class of graph of min-DCP, we show that the ratio de- creases to 1+√3 Keywords coupled-tasks · complexity · compatibility graph · polynomial-time approximation 2 ≈ 1.37. 1 Introduction In this paper, we present a scheduling problem of coupled- tasks subject to compatibility constraints, which is a G. Simonin · R. Giroudeau · J.-C. König LIRMM UMR 5506, rue Ada, 34392 Montpellier Cedex 5 - France E-mail: {simonin,rgirou,konig}@lirmm.fr B. Darties LE2I UMR 5158 9 Rue Alain Savary 21000 Dijon - France E-mail: [email protected] generalization of the scheduling problem of coupled- tasks first introduced by Shapiro [19]. This problem is motivated by the problem of data acquisition in a sub- marine torpedo. The aim amounts to treating various environmental data coming from sensors located on the torpedo, that collect information which must be pro- cessed on a single processor. A single acquisition task can be described as follows: a sensor of the torpedo emits a wave at a certain frequency (according to the data that must be collected) which propagates in the water and reflects back to the sensor. This acquisition task is divided into two sub-tasks: the first task con- sists in sending an ultrasound pulse while the second receives returning echo. Between them, there is an in- compressible idle time which represents the spread of the echo under the water. Thus acquisition tasks may be assigned to coupled-tasks. In order to use idle time, other sensors can send more echoes. However, the proximity of the waves causes disruptions and interferences. In order to handle infor- mation error-free, a compatibility graph between acqui- sition tasks is created. In this graph, which describes the set of tasks, we have an edge between two compat- ible tasks. A task is compatible with another if at least one of its sub-tasks can be executed during the idle time of another task. Given a set of coupled-tasks and such a compatibility graph, the aim is to schedule the coupled-tasks in order to minimize the time required for the completion of all the tasks. 1.1 Notations First we present some common notations: -- Let G be an undirected graph. We note V (G) the set of its vertices and E(G) the set of its edges; 7 1 0 2 n u J 7 ] S D . s c [ 1 v 2 0 2 2 0 . 6 0 7 1 : v i X r a PSfrag replacements 2 -- we note n (resp. m) the cardinality of set V (G) (resp. E(G)); -- a path is a non-empty graph C with V (C) = {x0, x1, . . . , xk} and E(C) ={x0x1, . . . , xk−1, xk}, where all the xi are distinct; -- the length of a path is the number of edges that the path uses. Then, we introduce the notations relative to coupled- tasks we will use in the rest of the paper: we note A = {A1, A2, . . . , An} the set of n coupled-tasks. Us- ing the notation proposed by Shapiro [19], each task Ai ∈ A is composed of two sub-tasks ai and bi. For clar- ity we use the same notations for the processing time of these tasks: ai and bi have processing time ai ∈ N and bi ∈ N), and separated by a fixed idle time Li ∈ N (see Figure 1(a)). For each i the second sub-task bi must start its execution exactly Li time units after the com- pletion time of ai. According to the torpedo problem, a task may be started during the idle time of a running task if it uses another frequency, is not dependant on the execution of the running task (and reciprocally), or does not re- quire to access the resources used by the running tasks. Formally, we say that two tasks Ai and Aj are compat- ible if and only if we can execute at least a sub-task of Ai during the idle time of Aj (see Figure 1(b)). On the other side, some tasks cannot be compatible due to previously cited reasons. PSfrag replacements PSfrag replacements aj bj ai Li bi (a) . ai aj bi bj Li (b) Fig. 1 A single coupled-task and two compatible coupled-tasks. 1.2 Main problem formulation We aim at scheduling a set of coupled-tasks with com- patibility constraints on a monoprocessor. The input of the general problem is described with the set A = {A1, A2, . . . , An} of coupled-tasks and a compatibility graph Gc, with V (Gc) = A and E(Gc) the edges which represent all pairs of compatible tasks, ie an edge exists between Ai and Aj if and if only aj can be scheduled between ai and bi (Fig. 1(b)). Note that compatibility is symmetrical, thus here ai could be scheduled between aj and bj. A2 A1 A3 Compatibility graph L2 L3 L1 a2 a1 b2 a3 b1 b3 Fig. 2 Link between the compatibility graph and the scheduling The solution of an instance consists in determin- ing the starting time of each sub-task ai of each task Ai ∈ A. The tasks have to be processed on a single processor while preserving the constraints given by the compatibility graph (see Figure 2). Formally, we need to find a valid schedule σ : A → N where the notation σ(Ai) denotes the starting time of the task Ai. We use the following abuse of notation: σ(ai) = σ(Ai) (resp. σ(bi) = σ(Ai) + ai + Li) denotes the starting time of the first sub-task ai (resp. the second sub-task bi). Let Cmax = maxAi∈A(σ(Ai) + ai + Li + bi) be the required time to complete all the tasks. Then the ob- jective is to find a feasible schedule which minimizes Cmax. We use the notation scheme αβγ proposed by Graham and al. [10], where α denotes the environment processors, β the characteristics of the jobs and γ the criteria. The main problem denoted as Π will be defined by: Π = 1coupled − task, (ai, bi, Li), GcCmax 1.3 Related work The problem of coupled-tasks has been studied in re- gard to different conditions on the values of ai, bi, Li for 1 ≤ i ≤ n, and precedence constraints [4,1,14,17]. Note that, in the previous works, all tasks are compati- ble by considering a complete graph [4,1,14,17]. More- over, in presence of any compatibility graph, we find several complexity results [20,21,22], which are sum- marized in Table 1. The notation ai = a implies that for all 1 ≤ i ≤ n, ai is equal to a constant a ∈ N. This notation can be extended to bi and Li with the constants b, L and p ∈ N. Problem 1coupled−task, (ai = bi = Li), GcCmax Complexity N P-complete 1coupled−task, (ai = a, bi = b, Li = L), GcCmax N P-complete N P-complete 1coupled−task, (ai = bi = p, Li = L), GcCmax O(n2m) O(n2m) 1coupled−task, (ai = Li = p, bi), GcCmax 1coupled−task, (ai, bi = Li = p), GcCmax Table 1 Complexity for scheduling problems with coupled-tasks and compatibility constraints ref [20] [20] [22] [20] [20] 1.4 Contribution and organization of this paper 2 Computational complexity 3 Our work consists in measuring the impact of the com- patibility graph on the complexity and approximation of scheduling problems with coupled-tasks on a mono- processor. In this way, we focus our work on establishing the limits between polynomiality and NP-completeness of these problems according to some parameters, when the compatibility constraints is introduced. In [21,22], we have studied the impact of the parameter L, and have shown that the problem 1coupled − task, (ai = bi = p, Li = L), GcCmax was NP-complete as soon as L ≥ 2, and polynomial otherwise. In this work, we complete complexity results with the study of other special cases according to the value of ai and bi, and we propose several approximation algo- rithms for them. We restrict our study to a special case, by adding new hypotheses to the processing time and idle time of the tasks. For any task Ai, i ∈ {1, . . . , n}, the processing time ai (resp. bi) of sub-task ai (resp. bi) is equal to a constant a (resp. b), and the length of the idle time between ai and bi is L. Considering ho- mogeneous tasks is a realistic hypothesis according to the tasks that the torpedo has to execute. Let Π1 be this new problem. Formally: Π1 = 1coupled−task, (ai = a, bi = b, Li = L), GcCmax PSfrag replacements This paper is organized as follows: in section 2, we establish the complexity of Π1 according to the val- ues of a, b and L, and we show that the problem is polynomial for any L < a + b; then we consider in the rest of the paper that L = a + b. In that case, the problem can be considered as a new graph problem we call Minimum Schedule-Linked Disjoint-Path Cover (Min-SLDPC). We present the proof of NP- completeness of Min-SLDPC and we conclude this sec- tion by the study of a specific sub-case with a = b = L/2. In Section 3, we show that Min-SLDPC is imme- diately 2-approximated by a simple approach: we design a polynomial-time approximation algorithm with per- formance guarantee lower than 3 2 . In fact, we show that the approximation ratio obtained by this algorithm is between 3 4 , according to the values of a and b. The last section is devoted to the study of Π1 for some particular topology of the graph Gc. First we present a well-known graph problem, Minimum Disjoint-Path Cover, (Min-DPC). Then we show the relation be- tween Min-DPC and Min-SLDPC and evaluate how results from the first one can be applied to solve the second problem on specific topologies. This implies the reduction of the performance ratio we can obtain on some restricted instances from 3 2 and 5 2 to ≈ 1.37. First, we prove that Π1 is polynomial when L < a + b: it is obvious that a maximum matching in the graph Gc gives an optimal solution. Indeed, during the idle time L of a coupled-task Ai, we can process at most one sub-task aj or bk. Since the idle time L is identical, so it is obvious that finding an optimal solution consists in computing a maximum matching. Thus, the problem 1coupled− task, (ai = a, bi = b, Li = L < a+ b), GcCmax admits a polynomial-time algorithm with complexity O(mp(n)) where n is the number of tasks and m the number of edges of Gc (see [18]). The rest of the paper is devoted to the case L = a + b. Without loss of generality, we consider the case1 of b < a. The particular case b = a will be discussed in subsection 2.2. 2.1 From a scheduling problem to a graph problem Let us consider a valid schedule σ of an instance (A, Gc) of Π1 with b < a, composed of a set of coupled-tasks A and a compatibility graph Gc. For a given task Ai, at most two sub-tasks may be scheduled between the completion time of ai and the starting time of bi, and in this case the only available schedule consists in exe- cuting a sub-task bj and a sub-task ak during the idle time Li with i 6= j 6= k such that σ(bj ) = σ(ai) + a and σ(ak) = σ(ai) + a + b. Figure 3 shows a such configura- tion. a aj a ai b bj a ak b bi Li b b bk a Fig. 3 At most 2 sub-tasks may be scheduled between ai and bi We can conclude that any valid schedule σ can be viewed as a partition {T1, T2, . . . , Tk} of A, such that for any Ti the subgraph Pi = Gc[Ti] of Gc induced by vertices Ti is a path (here, isolated vertices are con- sidered as paths of length 0). Clearly, {P1, P2 . . . Pk} is a partition of Gc into vertex-disjoint paths. Figure 4 shows an instance of Π1 (Figure 4(a)), a valid schedule (Figure 4(c)) - not necessarily an optimal one -, and the corresponding partition of Gc into vertex-disjoint paths (Figure 4(b)). For a given feasible schedule σ, let us analyse the relation between the length of the schedule Cmax and 1 The results we present here can be symmetrically extended to instances with b > a. ak bk a a + b Ak Li Ai Aj b a − b ai aj bi bj idle time idle time (a) Chains of length 1 increase tidle by a Aj Ai Ak PSfrag replacements a − b a + b b a aj ai bj ak bi bk Li idle time idle time (b) Chains of length > 2 increase tidle by a + b A7 A3 A4 A5 A6 (a) An input graph Gc with 7 tasks A1 A2 A7 A3 A4 A5 A6 b3 a4 b4 PSfrag replacements a5 a1 b5 b1 a6 a2 b6 b2 a7 a3 b7 b3 4 PSfrag replacements A1 a4 b4 a5 b5 A2 a6 b6 a7 b7 A1 A2 A3 A4 A5 A6 A7 (b) A vertex-disjoint partition Fig. 5 Impact of the length of the paths on the idle time a1 a2 b1 a3 b2 a4 b3 b4 a5 a6 b5 b6 a7 b7 (c) A schedule on a monoprocessor Fig. 4 Relation between a schedule and a partition into vertex- disjoint paths the corresponding partition {P1, P2, . . . Pk} into vertex- disjoint paths. Clearly, we have Cmax = tseq + tidle where tseq = n(a + b) and tidle is the inactivity time of the processor. Since tseq is fixed for a given instance, tidle obviously depends on the partition. We propose the following lemma: Lemma 1 Let {P1, P2, . . . Pk} be the partition of vertex- disjoint paths corresponding to a schedule σ. 1. A path of length 0 corresponds to a single task sched- uled in σ, tidle is incremented by L = a + b; 2. for any path of length 1, tidle is increased by a; 3. for any path of length strictly greater than 1, tidle is incremented by (a + b). Proof Point 1 is obvious. Fig. 5 illustrates points 2 and 3: a path of length 1 represents 2 tasks that may be imbricated as on Figure 5(a). Paths of length strictly greater than 1 represent more than two tasks. These tasks can be scheduled in order to get an idle time of length b at the beginning of the schedule and one of length a at the end of it (as on Figure 5(b)). The reader could check there is no other way to imbricate tasks in order to reduce the idle time for paths of any length. Thus, there exists a link between finding an op- timal schedule and a graph problem which is called Minimum Schedule-Linked Disjoint-Path Cover (Min-SLDPC) defined in Table 2: Clearly, Min-SLDPC is equivalent to Π1 with b < a and L = a+b, and can be viewed as the graph problem formulation of a schedul- ing problem. In any solution, each path increments the Instance: a graph G = (V, E) of order n, two natural integers a and b, b < a. Result: a partition P of G into vertex-disjoint paths (can be of length 0) Objective: Minimize n(a+ b)+Pp∈P w(p) where w : P → N is a cost function with w(p) = a if and only if E(p) = 1, and w(p) = a + b otherwise. Table 2 Minimum Schedule-Linked Disjoint-Path Cover (Min-SLDPC) cost of idle time by at least a (when the path has a length 1), and at most a + b < 2a. So, we can deduce that an optimal solution to Min-SLDPC consists in finding a partition P with a particular cardinality k∗, and a maximal number of paths of length 1 among all possible k∗-partitions. The following immediate theo- rem establishes the complexity of Min-SLDPC: Theorem 1 Min-SLDPC is an NP-hard problem. Proof We consider the decision problem associated to Min-SLDPC. We will prove that the the problem of deciding whether an instance of SLDPC has a schedule of length at most (n + 1)(a + b) is NP-complete. Our proof is based on the polynomial-time transformation Hamiltonian Path ∝ SLDPC. We keep the graph and the vertices is the task to schedule. Let us consider a graph G. This transformation can be clearly computed in poly- nomial time. • Assume that the length of the optimal schedule is C opt max = (n + 1)(a + b). We will prove that the graph G possess a Hamiltonian path i.e. k = 1. Recall first that k is the number of partition and that b < a. We know, from the previous discussion, that tseq = n(a + b) and that a chain of length one increase tidle by a (see illustration given by Figures 5(b) and 5(a)). It is clear that the graph G must be covered by paths of different lengths. Suppose that the graph G is covered by k paths with k1 paths of length one (the set of these paths is denoted by P1), and k2 paths of lenght greater than one (resp. by P≥2). So the length of schedule given by this covering is: processing times idle time for P1 idle time for P≥2 C h max = n(a + b) + z } { a × k1 + = (n + k2)(a + b) + k1a > C∗max { z } { if (k16= 0 and k2≥ 1) or (k1 > 1 and k2 = 0) (a + b)k2 } z Thus, the only schedule requiring exactly (n+1)(a+ b) units of time implies that the graph possess a Hamiltonian path i.e. k1 = 0 and k2 = 1. • Reciprocally, we suppose that the graph G possess a Hamiltonian path, we will prove the existence of a schedule of length Cmax = (n + 1)(a + b). G contains an Hamiltonian path, we can deduce a schedule with Cmax = (n + 1)(a + b): as tseq = n(a + b), tidle must be equal to (a + b), which is possible if and only if the schedule is represented with only one chain. 2.2 A particular case Π2 : 1coupled − task, (ai = bi = p, Li = L = 2p), GcCmax In this subsection only, we suppose that both sub-tasks are equal to a constant p and that the inactivity time is equal to a constant L = 2p. The previous proof cannot be used for this case. Indeed the structure of these tasks allows to schedule three compatible tasks together without idle time (see Figure 6). Another solution consists in covering vertices of Gc by triangles and paths (length 0 allowed), where we minimize the number of paths and then maximize the number of path of length 1. PSfrag replacements This problem is a generalization of Triangle Pack- ing [8] since an optimal solution without idle time con- sists in partitioning into triangles the vertices of Gc. This problem is well known to be NP-complete, and leads to the NP-completeness of problem Π2. 5 a covering of the graph Gc by triangles and paths, which minimize the idle time. In the following section, we will develop an efficient polynomial-time approximation al- gorithm for the general problem Min-SLDPC. 3 Approximation algorithm for Min-SLDPC Notice that the following algorithm, executing sequen- tially the tasks, admits a ratio equal to two. We also develop a polynomial-time 3 2 -approximation algorithm based on a maximum matching in the graph Gc. In fact, we show that this algorithm has an approx- imation ratio of at most 3a+2b 2a+2b , which leads to a ratio between 3 4 according to the values of a and b (with b < a). This result, which depends on the values a and b, will be discussed in Section 4, in order to pro- pose a better ratio on some class of graphs. 2 and 5 max = tseq +topt ule has a length C opt For any instance of Min-SLDPC, an optimal sched- idle where tseq = n(a+b). Remark 1 For any solution of length Cmax, we neces- sarily have2 tidle ≥ (a + b) and also3 tidle ≤ n(a + b). Then, for any solution h of Min-SLDPC we have a performance ratio ρ(h) such that: ρ(h) ≤ C h max max ≤ C opt 2n(a + b) (n + 1)(a + b) < 2. (1) Indeed, we have C opt max ≥ Tseq = n(a + b) + (a + b) In the following, we develop a polynomial-time ap- proximation algorithm based on a maximum matching in the graph Gc, with performance guaranty in [ 5 4 , 3 2 ] according to the values of a and b. Let I be an instance of our problem. An optimal solution is a disjoint-paths cover. The n vertices are partitioned in three disjoint sets: n1 uncovered vertices, n2 vertices covered by α2 = n2 2 paths of length 1, and n3 vertices covered by exactly α3 paths of length strictly greater than 1 (see illustration Figure 7). The cost of an optimal solution is equal to the sum of sequential time and idle time: processing times idle time for matched vertices n(a + b) + z } { z } { (a + b)n1 + 2 a z}{n2 z + (a + b)α3 } { A1 2p C opt max = A2 A3 a1 a2 a3 b1 b2 b3 Fig. 6 Illustration of a schedule without idle time A correct approximation algorithm for this problem is an algorithm close to the general case. Indeed, finding an optimal solution to this problem amounts to finding idle time for isolated vertices idle time for path of length > 1 2 The equality is obtained when the graph Gc possesses an hamiltonian path, otherwise we need at least two paths to cover Gc (where Gc is not only an edge), which leads to increase tidle by at least 2a ≥ a + b units of time. 3 The worst case consists in executing tasks sequentially with- out scheduling any sub-task aj or bj of task Aj during the idle time of a task Ai. 6 α3 paths n2 vertices n1 vertices PSfrag replacements . . . . . . . . . n3 vertices . . . Fig. 7 Illustration of the optimal solution on an instance I Now, we propose a polynomial-time approximation algorithm with non trivial ratio on an instance I. This algorithm is based on a maximum matching in Gc in order to process two coupled-tasks at a time. For two coupled-tasks Ai and Aj connected by an edge of the matching, we obtain an idle time of length a (see Figure 5(a)). Let M∗ be the cardinality of a maximum matching. In the worst case, the α3 paths are all odd and a match- ing of the paths leaves α3 isolated vertices. So, we have by hypothesis: M∗ ≥ n2 2 + ( n3 2 − α3) = Γ (worst case) (2) Indeed, based on the decomposition given by the Figure 7, we may deduce a matching within this cardi- nality: the α2 paths of length one are contained in the matching; for any path of length greater than one, we include odd edges to the matching. In the worst case, all α3 paths have odd length and the number of uncovered nodes is α3. If the tasks of the matching are processed first and the isolated vertices in second, the length of schedule is4: processing times idle time 1 idle time 2 C h max ≤ n(a + b) + z } { z } { a × Γ + z (a + b)(α3 + n1) } { Since a optimal length is C opt max = n(a + b) +n1(a + 2 a+ α3(a+ b), we obtain, with the last equation max, the following ratio of the polynomial- b)+ n2 involved C h time approximation algorithm: max + ( n3 − α3 2 )a C h max ≤ C opt ρ(h) ≤ 1 + ρ(h) ≤ 1 + ρ(h) ≤ 1 + ρ(h) ≤ 1 + )a n(a+b)+n1(a+b)+ n2 2 a +α3(a+b) ( n3−α3 2 ( n3−α3 )a 2 (n + n1 + α3)(a+b)+ n2 2 a n3 2 a (n + n1)(a+b)+ n2 2 a n 2 a n3 2 a n(a + b) ≤ 1 + n(a + b) , max obtained for α3 = 0 , since n3 ≤ n ρ(h) ≤ 1 + a 2(a + b) = 3a + 2b 2a + 2b 4 Instances with particular topologies We conclude this work by a study of Min-SLDPC when Gc admits a particular topology. First we present a related problem: Minimum Disjoint Path Cover problem (Min-DPC). This problem has some inter- esting results on restricted topologies. We establish a link between Min-DPC and Min-SLDPC and we show that finding a ρdpc-approximation for Min-DPC on Gc allows to find a strategy with performance ratio ρsldpc ≤ min{ρdpc × ( a+b 2a+2b}. This leads to pro- pose, independently from the values a and b, a 1+√3 - approximation for Min-SLDPC when Min-DPC can be polynomially solved on Gc. a ), 3a+2b 2 4.1 A related problem: Min-DPC The graph problem Min-SLDPC is very close to the well-known problem Minimum Disjoint Path Cover (Min-DPC) which consists in covering the vertices of a graph with a minimum number of vertex-disjoint paths5. This problem has been studied in depth in several graph classes: it is known that this problem is polynomial on cographs [16], blocks graphs and bipartite permutation graphs [23], distance-hereditary graph [12], and on in- terval graphs [2]. In [5] and [9], the authors have pro- posed (independently) a polynomial-time algorithm in the case where the graph is a tree. Few years later, in [13] the authors showed that this algorithm can be implemented in linear time. Among the other results, there is a polynomial-time algorithm for the cacti [15], and another for the line graphs of a cactus [7]. In circular- arc graphs the authors [11] have proposed an approxi- mation algorithm of complexity O(n), which returns an 4 Idle time 1 (resp. 2) represents the idle time for matched vertices (resp. isolated vertices). 5 Sometimes referenced as the Path-Partition problem (PP). and let us evaluate it cost. Since each path of a Min- SLDPC solution increments the cost of the solution by at most a + b, then we have: 7 1 a (5) OP Tsldpc according to (3) b a a + b OP Tsldpc + OP Tsldpc according to (4) w(p) + n(a + b) ≤ (a + b)P∗1 + n(a + b) Pp∈P ∗ ≤ (a + b)P∗2 + n(a + b) ≤ bP∗2 + OP Tsldpc ≤ ≤ The same proof may be applied if there exists a ρdpc-approximation for Min-DPC, and then there ex- ists a ρdpc×( a+b a )-approximation for Min-SLDPC. Let us suppose that we know a constant ρdpc such that there exists a ρdpc-approximation for Min-DPC on Gc. Let S1 be the strategy, which consists in determining a ρdpc×( a+b a )-approximation for Min-SLDPC from ρdpc, and S2 the strategy, which consists in using the algo- rithm introduced in section 3. Clearly, S1 is particu- larly relevant when b is very small in comparison with a. Whereas S2 gives better ratio when b is close to a. Both strategies are complementary along the value of b, which varies from 0 to a. Choosing the best result be- tween the execution of S1 and S2, gives a performance ratio ρsldpc such that: a (cid:19) , ρsldpc ≤ min(cid:8)ρdpc ×(cid:18) a + b 3a + 2b 2a + 2b(cid:9). (6) optimal number of paths to a nearly constant additive equal to 1. The problem Min-DPC is directly linked to Hamil- tonian Completion [8], which consists in finding the minimum number of edges, noted HC(G), that must be added to a given graph G, in order to make it hamilto- nian (to guarantee the existence of a Hamiltonian cy- cle). It is known that if G is not hamiltonian, then the cardinality of a minimum disjoint path cover is clearly equal to HC(G). The dual of Min-DPC is Maximum Disjoint-Path Cover [8]. It consists in finding in G a collection of vertex-disjoint paths of length at least 1, which max- imises the edges covered in G. This problem is known to be 7 6 -approximable [3]. 4.2 Relation between Min-DPC and Min-SLDPC From the literature, we know that Min-DPC is polyno- mial on trees [9,13,5], distance-hereditary graphs [12], bipartite permutation graphs [23], cactis [15] and many others classes. There are currently no result about the complexity of Min-SLDPC on such graphs: since the values of of a and b have a high impact, techniques used to prove the polynomiality of Min-DPC cannot be adapted to prove the polynomiality of Min-SLDPC. Despite all our effort, the complexity of Min-SLDPC remains an open problem. However using known results on Min-DPC, we show how the approximation ratio can be decreased for these class of graphs. We propose the following lemma: Lemma 2 If Min-DPC can be solved polynomial com- putation time, then there exists a polynomial-time (a+b) - approximation for Min-SLDPC. a Proof Let I1 = (G) be an instance of Min-DPC, and I2 = (G, a, b) an instance of Min-SLDPC. Let P∗1 be an optimal solution of Min-DPC of cost P∗1 , and P∗2 an optimal solution of Min-SLDPC of cost OP Tsldpc. According to the definition of Min-SLDPC, we have P∗2 ≥ P∗16. Since each path of a Min-SLDPC solu- tion increments the cost of the solution by at least a, then we have: OP Tsldpc = Xp∈P ∗ 2 w(p)+n(a+b) ≥ aP∗2+n(a+b)≥ aP∗2 ⇒ ≥ P∗2 OP Tsldpc (4) Let us consider the partition P∗1 as a solution (not necessarily optimal) to the instance I2 of Min-SLDPC, a Compared to executing S1 only, this new strategy increases the obtained results if and only if ρdpc is lower PSfrag replacements than 3 2 (see Figure 8). approximation ratio 3 2 bound 5 4 ρdpc 1 0 S1 S2 a 4 a 2 3a 4 a value of b Fig. 8 Finding a good ρdcp-approximation helps to increase the results of Section 3 (3) We propose the following remark, which is not good news: 6 The best solution for Min-SLDPC is not necessarily a solu- tion with a minimum cardinality of k. Remark 2 There is no ρdpc-approximation for Min-DPC in general graphs for some ρdpc < 2 8 This result is a consequence of the Impossibility Theorem [6]. It can be checked by considering an ins- tance of Min-DPC which has an hamiltonian path: the optimal solution of Min-DPC has cost 1, thus any polynomial-time ρdpc - approximation algorithm with ρdpc < 2 will return a solution of cost 1, which is not allowed under the assumption that P 6= NP. This re- sult also implies that constant-factor approximation al- gorithms for max-DPC do not necessarily give the same performance guarantees on min-DCP, since the best ap- proximation ratio for max-DCP is 7 6 , which is lower than the inapproximability bound for min-DCP. It is good news that Min-DPC is polynomial for some compatibility graphs such as trees [9,13,5], distance- hereditary graphs [12], bipartite permutation graphs [23], cactis [15] and many others classes; thus ρdpc = 1. For all these graphs we obtain an approximation ratio of min{ (a+b) a = a 3a+2b 2a+2b , i.e.: 2a+2b} which is maximal when (a+b) , 3a+2b (a + b) = 3a + 2b 2a + 2b ⇔ −a2 + 2ab + 2b2 = 0. (7) a The only solution of this equation with a and b ≥ 0 is a = b(1 + √3). By replacing a by this new value on 2a+2b , we show that in the worst case the 2 ≈ approximation ratio is reduced from 3 1.37. 2 down to 1+√3 or on 3a+2b (a+b) a 5 Conclusion We investigate a particular coupled-tasks scheduling problem Π1 in presence of a compatibility graph. We have shown how this scheduling problem can be reduced to a graph problem. We have proved that adding the compatibility graph leads to the NP-completeness of Π1, whereas the problem is obviously polynomial when there is a complete compatibility graph (each task is compatible with each other). We have proposed a ρ- approximation of Π1 where ρ is between 3 4 ac- cording to value of a and b. We have also decreased the upper bound of 3 2 down to ≈ 1.37 on instances where Minimum Disjoint Path Cover can be polynomially solved on the compatibility graph. 2 and 5 As perspectives of this work, we plan to test the pertinence of our polynomial-time approximation algo- rithm through simulations in order to determine the av- erage gap between the optimal solution and the results obtained with our strategy on significant instances. We also aim to classify the complexity of other configura- tions, especially Π1 : 1coupled − task, (ai = a, bi = b, Li = L)Cmax with a complete compatibility graph. 6 Acknowledgements Thanks to our reviewers for the thorough review of this paper and many helpful comments and suggestions. References 1. D. Ahr, J. Békési, G. Galambos, M. Oswald, and G. Reinelt. An exact algorithm for scheduling identical coupled-tasks. Mathematical Methods of Operations Research, 59:193 -- 203(11), June 2004. 2. S. Rao Arikati and C. Pandu Rangan. Linear algorithm for optimal path cover problem on interval graphs. Information Processing Letters, 35(3):149 -- 153, 1990. 3. P. Berman and M. Karpinski. 8/7-approximation algorithm for (1,2)-TSP. In SODA '06: Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 641 -- 648, New York, NY, USA, 2006. ACM. 4. J. Blażewicz, K. Ecker, T. Kis, C.N. Potts, M. Tanas, and J. Whitehead. Scheduling of coupled tasks with unit process- ing times. Technical report, Poznan University of Technol- ogy, 2009. 5. F. T. Boesch S. Chen and B. McHugh. On covering the points of a graph with point-disjoint paths. Graphs and Combina- torics, 406:201 -- 212, 1974. 6. Ph. Chrétienne and C. Picouleau. Scheduling with commu- nication delays: a survey. In Scheduling theory and its appli- cations, pages 641 -- 648. John Wiley & Sons, 1995. 7. P. Detti and C. Meloni. A linear algorithm for the hamilto- nian completion number of the line graph of a cactus. Dis- crete Applied Mathematics, 136(2-3):197 -- 215, 2004. 8. M. R. Garey and D. S. Johnson. Computers and Intractabil- ity: A guide to the theory of NP-completeness. Freeman, 1979. 9. S. E. Goodman, S. T. Hedetniemi, and P. J. Slater. Ad- vances on the hamiltonian completion problem. Journal of the ACM, 22(3):352 -- 360, 1975. 10. R.L. Graham, E.L. Lawler, J.K. Lenstra, and A.H.G. Rin- nooy Kan. Optimization and approximation in determinis- tic sequencing and scheduling: a survey. Annals of Discrete Mathematics, 5:287 -- 326, 1979. 11. R.-W. Hung and M.-S. Chang. Solving the path cover prob- lem on circular-arc graphs by using an approximation algo- rithm. Discrete Applied Mathematics, 154(1):76 -- 105, 2006. 12. R.-W. Hung and M.-S. Chang. Finding a minimum path cover of a distance-hereditary graph in polynomial time. Dis- crete Applied Mathematics, 155(17):2242 -- 2256, 2007. 13. S. Kundu. A linear algorithm for the hamiltonian completion number of a tree. Information Processing Letters, 5:55 -- 57, 1976. 14. V. Lehoux-Lebacque, N. Brauner, and G. Finke. Identical coupled task scheduling: polynomial complexity of the cyclic case. Les Cahiers Leibniz, 179, 2009. 15. S. Moran and Y. Wolfstahl. Optimal covering of cacti by vertex-disjoint paths. Theoretical Computer Science, 84:179 -- 197, 1988. 16. K. Nakano, S. Olariu, and A. Y. Zomaya. A time-optimal solution for the path cover problem on cographs. Theoretical Computer Science, 290(3):1541 -- 1556, 2003. 17. A.J. Orman and C.N. Potts. On the complexity of coupled- task scheduling. Discrete Applied Mathematics, 72:141 -- 154, 1997. 18. A. Schrijver. Combinatorial Optimization : Polyhedra and Efficiency (Algorithms and Combinatorics). Springer, July 2004. 9 19. R.D. Shapiro. Scheduling coupled tasks. Naval Research Logistics Quarterly, 27:477 -- 481, 1980. 20. G. Simonin. Impact du graphe de compatibilité sur la com- plexité et l'approximation des problèmes d'ordonnancement en présence de tâches-couplées. Ph.D thesis, LIRMM, De- cember 2009. 21. G. Simonin, R.Giroudeau, and J.-C. König. Complexity and approximation for scheduling problem for a torpedo. CIE'39 : The 39th International Conference on Computers and In- dustrial Engineering, IEEE, Troyes, France, pages 300 -- 304, 2009. 22. G. Simonin, R.Giroudeau, and J.-C. König. Extended matching problem for a coupled-tasks scheduling problem. TMFCS'09 : International Conference on Theoretical and Mathematical Foundations of Computer Science, Orlando, Florida, pages 082 -- 089, 2009. 23. R. Srikant, R. Sundaram, K. Sher Singh, and C. Pandu Ran- gan. Optimal path cover problem on block graphs and bi- partite permutation graphs. Theoretical Computer Science, 115(2):351 -- 357, 1993.
1211.6195
1
1211
2012-11-27T02:37:21
Time-Darts: A Data Structure for Verification of Closed Timed Automata
[ "cs.DS", "cs.LO" ]
Symbolic data structures for model checking timed systems have been subject to a significant research, with Difference Bound Matrices (DBMs) still being the preferred data structure in several mature verification tools. In comparison, discretization offers an easy alternative, with all operations having linear-time complexity in the number of clocks, and yet valid for a large class of closed systems. Unfortunately, fine-grained discretization causes itself a state-space explosion. We introduce a new data structure called time-darts for the symbolic representation of state-spaces of timed automata. Compared with the complete discretization, a single time-dart allows to represent an arbitrary large set of states, yet the time complexity of operations on time-darts remain linear in the number of clocks. We prove the correctness of the suggested reachability algorithm and perform several experiments in order to compare the performance of time-darts and the complete discretization. The main conclusion is that in all our experiments the time-dart method outperforms the complete discretization and it scales significantly better for models with larger constants.
cs.DS
cs
Time-Darts: A Data Structure for Veri fication of Closed Timed Automata∗ Kenneth Y. Jørgensen Ji r´ı Srba Kim G. Larsen Department of Computer Science, Aalborg University Selma Lagerl ofs Vej 300, 9220 Aalborg East, Denmark {kyrke,kgl,srba}@cs.aau.dk Symbolic data structures for model checking timed systems have been subject to a significant re- search, with Difference Bound Matrices (DBMs) still being the preferred data structure in several mature verification tools. In comparison, discretization o ffers an easy alternative, with all opera- tions having linear-time complexity in the number of clocks, and yet valid for a large class of closed systems. Unfortunately, fine-grained discretization caus es itself a state-space explosion. We intro- duce a new data structure called time-darts for the symbolic representation of state-spaces of timed automata. Compared with the complete discretization, a single time-dart allows to represent an ar- bitrary large set of states, yet the time complexity of operations on time-darts remain linear in the number of clocks. We prove the correctness of the suggested reachability algorithm and perform sev- eral experiments in order to compare the performance of time-darts and the complete discretization. The main conclusion is that in all our experiments the time-dart method outperforms the complete discretization and it scales significantly better for model s with larger constants. 1 Introduction Timed automata [2] are a well studied formalism for modelling and verification of real-time systems. Over the years extensive research effort has been made towards the design of data structures and algo- rithms allowing for efficient model checking of this modelin g formalism. These techniques have by now been implemented in a number of mature tools (e.g. U PPAA L [4], IF [9], Kronos [14], PAT [21], Rabbit [6], RED [16]), with zone-based analysis [15, 5] still being predominant, stemming from that fact that Difference Bound Matrices (DBMs) offer a very compact data structure for efficient implementation of the various operations required for the state-space exploration. Still the DBM data structure suffers from the fact that all operations have at least quadratic—and the crucial closure operation even cubic—time complexity in the number of clocks (though for diagonal-free constraints the operations can be imple- mented in quadratic time [23]). In contrast, as advocated in [10, 19], the use of discretization offers an easy alternative, with all operations having linear complexity in the number of clocks, and yet valid for the large—and in practice often sufficient—class of closed s ystems that contain only nonstrict guards; moreover for reachability checking the continuous and discrete semantics coincide on this subclass. As an example consider the timed automaton shown in Figure 1, containing n clocks and n self-loops where the i’th loop has the guard xi = i and resets the clock xi . We are interested in whether or not we can reach the Goal location. For this to happen, all clocks x1 , . . . , xn must simultaneously have the value zero, corresponding effectively to calculating the least common multiple of the numbers from 1 to n. In Figure 1 we compare the verification times of the zone-based r eachability performed in U PPAA L with that of a simple Python based implementation of discrete time reachability checker for timed automata. ∗The paper was supported by VKR Center of Excellence MT-LAB. F. Cassez, R. Huuck, G. Klein and B. Schlich (eds.): Systems Software Veri fication Conference 2012 (SSV 2012) EPTCS 102, 2012, pp. 141–155 , doi:10.4204/EPTCS.102.13 c(cid:13) K.Y. Jørgensen, K.G. Larsen & J. Srba This work is licensed under the Creative Commons Attribution License. 142 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata x2 = 2, x2 := 0 · · · x1 = 1, x1 := 0 xn = n, xn := 0 x1 = x2 = · · · = xn = 0 ∧ y ≥ 1 Goal Size 4 5 6 7 8 Discrete Uppaal <0.1 0.2 1.1 2.2 27.5 5.5 >300 97 out of memory - Figure 1: Discrete vs. zone-based reachability algorithm (time in seconds) Opposite to what one might expect, it turns out that in this case the naive discrete implementation without any speed optimizations outperforms a state-of-the-art model checking tool. On the other hand, the disadvantage of discretization is that the number of states to be considered ex- plodes when the size of the constants appearing in the constraints of the timed automaton are increased. In fact, the experimental results of Lamport [19] show that the zone-based methods outperform discreter- ized methods when the maximum constant in the timed automaton exceeds 10. Also in [19] the BDD- based model checker SMV was applied to symbolically represent the discreterized state-space. This representation is less sensitive to the maximum constant of the model, yet in experimental results [7, 3] it appears that the zone-based method is still superior for constants larger than 16. Inspired by the success of discretization reported in Figure 1, we revisit the problem of finding effi- cient data structures for the analysis of timed automata. In particular, we introduce a new data structure called time-darts for the symbolic representation of the state-spaces of timed automata. Compared with the complete discretization, a single time-dart allows us to represent an arbitrary large set of states, yet the time complexity of operations remain linear in the number of clocks, providing a potential advantage compared to DBMs. We propose a symbolic reachability algorithm based on a forward search. To ensure the termination of the forward search the so-called extrapolation of time darts with respect to the maximum constant appearing in the model is required. Given the subtleties of extrapolation,1 we prove the termination and correctness of the proposed algorithm. We perform several experiments in order to compare the performance of time-darts versus the complete discretization representation. The main conclusion is that the time-dart method consistently outperforms the complete discretization and it is particularly well suited for scaling up the constants used in the model. Given the simplicity of implementing discrete- time algorithms compared to the DBM-based ones, our method can be in practice well suited for the verification of closed time systems with moderately large co nstants. 2 Timed Automata ¥ = N ∪ {¥}. The comparison and addition operators Let N be the set of nonnegative integers and let N are defined as expected, in particular n < ¥ and n + ¥ = ¥ for n ∈ N. A Discrete Timed Transition System (DTTS) is a pair T = (S, −→) where S is a set of states, and −→⊆ S × (N ∪ {t}) × S is a transition relation written s d −→ s′ if (s, d , s′ ) ∈−→ where d ∈ N for delay 1Despite several earlier claims, it was not before [8] that a complete—and a quite non-trivial —proof of correctness of zone-based forward reachability was given. K.Y. Jørgensen, K.G.Larsen& J.Srba 143 t −→ s′ if (s, t, s′ ) ∈−→ for switch actions. By −→∗ we denote the reflexive and transitive actions, and s t def d closure of the relation −→ −→. = −→ ∪ Sd∈N Let C be a finite set of clocks. A (discrete) clock valuation of clocks from C is a function v : C → N. The set of all clock valuations is denoted by V . Let v ∈ V . We define the valuation v + d after a delay def = v(x) + d for every x ∈ C . For a subset R ⊆ C of clocks we define of d ∈ N time units by (v + d )(x) def the valuation v[R := 0] where all clocks from R are reset to zero by v[R := 0](x) = v(x) for x ∈ C \ R and def v[R := 0](x) = 0 for x ∈ R. A nonstrict (or closed) time interval I is of the form [a, b] or [a, ¥) where a, b ∈ N and a ≤ b. The set of all time intervals is denoted by I . We use the functions ub, lb : I −→ N to return the upper resp. lower bound of a given interval. A clock guard over the set of clocks C is a function g : C −→ I that assigns a time interval to each clock. We denote the set of all clock guards over C by G (C). We write v = g for a valuation v ∈ V and a guard g ∈ G (C) whenever v(x) ∈ g(x) for all x ∈ C . Timed Automaton A timed automaton (TA) is a tuple A = (L,C, −→, ℓ0 ) where L is a finite set of g,R locations, C is a finite set of clocks, −→⊆ L × G (C) × 2C × L is a finite transition relation written ℓ −→ ℓ′ for (ℓ, g, R, ℓ′ ) ∈−→, and ℓ0 ∈ L is an initial location. Note that we do not consider clock invariants as they can be substituted by adding corresponding clock guards to the outgoing transitions while preserving the answers to location-reachability checking. A configuration of a timed automaton A is a pair (ℓ, v) where ℓ ∈ L and v ∈ V . We denote the set def of all configurations of A by Conf (A). The initial configuration of A is (ℓ0 , v0 ) where v0 (x) = 0 for all x ∈ C . (ℓ, v) (ℓ, v) def = (Conf (A), −→DS ) where Discrete Semantics A TA A = (L,C, −→, ℓ0 ) generates a DTTS TDS (A) states are configurations of A and the transitions are given by t g,R −→DS (ℓ′ , v[R := 0]) −→ ℓ′ such that v = g if ℓ d if d ∈ N. −→DS (ℓ, v + d ) The discrete semantics clearly yields an infinite state spac e due to unbounded time delays. We will now recall that the reachability problem for a TA A can be solved by looking only at a finite prefix of the state space up to some constant determining the largest possible delay. Let MC be the largest integer that appears in any guard of A. Two valuations v, v′ ∈ V are equivalent up to the maximal constant MC, written v ≡MC v′ , if ∀x ∈ C. v(x) = v′ (x) ∨ (v(x) > MC ∧ v′ (x) > MC). Observe that the equivalence relation ≡MC has only finitely many equivalence classes as there are finitely many clocks and each of them is bounded by the constan t MC. Lemma 2.1 Let v, v′ ∈ V s.t. v ≡MC v′ and let g ∈ G (C) be a guard where 0 ≤ lb(g(x)) ≤ MC, and ub(g(x)) = ¥ or 0 ≤ ub(g(x)) ≤ MC for all x ∈ C . Then v = g iff v′ = g. Moreover, any two configurations with the same location and e quivalent valuations are timed bisim- ilar (for the definition of timed bisimilarity see e.g [20]). Lemma 2.2 The relation B = {((ℓ, v), (ℓ, v′ ) v ≡MC v′ } is a timed bisimulation for any timed automaton with its maximum constant MC . Proof Let ((ℓ, v), (ℓ, v′ )) ∈ B. We analyse only the switch and delay actions from (ℓ, v); the situation for the transitions from (ℓ, v′ ) is symmetric. 144 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata t g,R −→DS (ℓ′ , v[R := 0]) via a transition ℓ −→ ℓ′ . Due to Lemma 2.1 and the fact • Assume that (ℓ, v) t −→DS (ℓ′ , v′ [R := 0]) and it is easy to verify that that v = g, we get v′ = g. Hence also (ℓ, v′ ) v[R := 0] ≡MC v′ [R := 0]. d d −→DS (ℓ, v + d ). We want to argue that also (ℓ, v′ ) −→DS (ℓ, v′ + d ) such that • Assume that (ℓ, v) v + d ≡MC v′ + d , however, this is easy to see from that facts that (i) if v(x), v′ (x) > MC then also (v + d )(x), (v′ + d )(x) > MC and (ii) if v(x) = v′ (x) ≤ MC then (v + d )(x) = (v′ + d )(x). We now define an alternative discrete semantics of TA with onl y finitely many reachable configura- tions. First, for the maximum constant MC, we define a bounded addition operator = (MC + 1 if n + m > MC , n ⊕MC m def otherwise. n + m The operation ⊕MC is in a natural way extended to functions and tuples. Bounded Discrete Semantics A TA A = (L,C, −→, ℓ0 ) with the maximal constant MC generates a def = (Conf (A), −→BDS ) where states are configurations of A and the transition relation DTTS TBDS (A) −→ is defined by (ℓ, v) (ℓ, v) t −→BDS (ℓ′ , v[R := 0]) d −→BDS (ℓ, v ⊕MC d ) g,R −→ ℓ′ such that v = g if ℓ if d ∈ N. We say that a location ℓg is reachable in TDS (A) resp. valuation v where −→ is −→DS resp. −→BDS . We conclude that the bounded semantics preserves reachability of locations, the main problem we are interested in. This fact follows from Lemma 2.2. in TBDS (A) if (ℓ0 , v0 ) −→∗ (ℓg , v) for some Theorem 2.3 A location ℓ is reachable in TDS (A) iff ℓ is reachable in TBDS (A). 3 Naive Reachability Algorithm We can now describe the naive search algorithm that explores in a standard way, point by point, the finite state-space of the bounded semantics and provides the answer to the location reachability prob- lem. Algorithm 1 searches through all reachable states, starting from the initial location, until a goal configuration is found (returning true) or all configuration s are visited (returning false). Notice that the algorithm is nondeterministic as it is not specified what ele ment should be removed from Waiting at line 5 (such choice depends on the concrete search strategy like DFS or BFS). The next theorem states that Algorithm 1 is correct. Theorem 3.1 Let A be a timed automaton and let ℓg be a location. Algorithm 1 terminates, and it returns true iff ℓg is reachable in the discrete semantics TDS (A). Proof First notice that the algorithm terminates because there is only a finite number of configurations that can be possibly added to Waiting: the number of locations is finite and due to the bounded addit ion at line 9 the total number of configurations is finite too. When ever a configuration is removed from the set Waiting, it is added to Passed (line 6) and can never be inserted into Waiting again due to the test at line 12. As we remove one element from Waiting each time the body of the while-loop is executed, K.Y. Jørgensen, K.G.Larsen& J.Srba 145 Algorithm 1: Naive reachability algorithm Input: A timed automaton A = (L,C, −→, ℓ0 ) and a location ℓg ∈ L Output: true if ℓg is reachable in TDS (A), false otherwise 1 begin Passed := /0; Waiting := /0; 2 AddToPW(ℓ0, v0 ) 3 while Waiting 6= /0 do 4 remove some (ℓ, v) from Waiting 5 Passed := Passed ∪ {(ℓ, v)} 6 forall the (ℓ′ , v′ ) such that (ℓ, v) AddToPW(ℓ′, v′ ) AddToPW(ℓ, (v ⊕MC 1)) return false t −→BDS (ℓ′ , v′ ) do 7 8 9 10 11 AddToPW(ℓ, v) 12 if (ℓ, v) /∈ Passed ∪ Waiting then if ℓ = ℓg then 13 return true 14 else 15 Waiting := Waiting ∪ {(ℓ, v)} 16 /* and terminate the whole algorithm */ the algorithm necessarily terminates either at line 10 or even earlier at line 14 if the goal location is reachable. Now we prove the correctness part. By Theorem 2.3 we can equivalently argue that the algorithm returns true iff ℓg is reachable in TBDS (A). “ ⇒ ”: Assume that Algorithm 1 returns true. We want to show that t he location ℓg is reachable in TBDS (A). This can be established by the following invariant: any call of AddToPW with the argument (ℓ, v) implies that the configuration (ℓ, v) is reachable in TBDS (A). For the initialisation at line 3 this clearly holds. In the while-loop the calls to AddToPW are at lines 8 and 9. At line 8 we know by the t −→BDS (ℓ′ , v′ ), invariant that (ℓ, v) is reachable and we call AddToPW only with (ℓ′ , v′ ) such that (ℓ, v) so the invariant is preserved. Similarly at line 9 for the argument (ℓ, (v ⊕MC 1)) of AddToPW holds that 1 −→BDS (ℓ, (v ⊕MC 1)), so it is reachable as well. (ℓ, v) (ℓ′ , v′ ) is reachable via n transitions in TBDS (A), formally “ ⇐ ”: Assume that a configuration (ℓ0 , v0 ) −→n BDS (ℓ′ , v′ ), where (without loss of generality) all delay transitions in the sequence are of the form 1 −→BDS , in other words they add exactly one-unit time delay. By induction on n we will estab- lish that during any execution of the algorithm there is eventually a call of AddToPW with the argument (ℓ′ , v′ ), unless the algorithm already returned true. If n = 0 then the claim is trivial due to the call at t line 3. If n > 0 then either (i) (ℓ0 , v0 ) −→n−1 −→BDS (ℓ′ , v′ ) with the last switch action or (ii) BDS (ℓ, v) 1 (ℓ0 , v0 ) −→n−1 −→BDS (ℓ′ , v′ ) with the last one-unit delay action. By induction hypothesis, unless BDS (ℓ, v) the algorithm already returned true, there will be eventually a call of AddToPW with the argument (ℓ, v) and this element is added to the set Waiting. Because the algorithm terminates, the element (ℓ, v) will be eventually removed from Waiting at line 5 and its switch successors and the one-unit delay successor will become arguments of the call to AddToPW at lines 8 and 9. Hence the induction hypothesis for the 146 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata y k c o l c time-dart ((2, 0), 2, 5) p w g clock x Figure 2: A time-dart (g, w, p) where g(x) = 2, g(y) = 0, w = 2 and p = 5 cases (i) and (ii) is established. 4 Time-Dart Data Structure We shall now present a novel symbolic representation of the discrete state space. The symbolic structure, we call it a time-dart, allows us to represent a number of concrete configurations i n a more compact way so that time successors of a configuration are stored without being explicitly enumerated. We start with the definition of an anchor point, denoting the beginning of a time-dart. An anchor point over a set of clocks C is a clock valuation g : C −→ N where g(x) = 0 for at least one x ∈ C . We denote the set of all anchor points over a set of clocks C by Anchors(C). Now we are ready to define time-darts. Time-Dart A time-dart over a set of clocks C is a triple (g, w, p) where g ∈ Anchors(C) is an anchor ¥ is a passed distance such that w ≤ p. point, w ∈ N is a waiting distance, and p ∈ N The intuition is that a time-dart describes the corresponding passed and waiting sets in a given lo- cation. Figure 2 shows a dart example with two clocks x and y, anchor point (2, 0), waiting distance 2 and passed distance 5. The empty circles represent the points in the waiting set and the filled circles represent the points in the passed set, formally defined by: Waiting(g, w, p) = {(g+ d ) w ≤ d < p} and Passed (g, w, p) = {(g+ d ) d ≥ p}. The passed-waiting list is represented as a function from locations and anchor points to the corre- sponding waiting and passed distances (here ⊥ represents the undefined value): PW : L × Anchors −→ (N × N ¥ ) ∪ {⊥} . Such a structure can be conveniently implemented as a hash map. A given passed-waiting list PW defines the sets of passed and waiting configurations. Waiting(PW ) = {(ℓ, v) ∃g.PW (ℓ, g) = (w, p) 6= ⊥ and v ∈ Waiting(g, w, p)} Passed (PW ) = {(ℓ, v) ∃g.PW (ℓ, g) = (w, p) 6= ⊥ and v ∈ Passed (g, w, p)} K.Y. Jørgensen, K.G.Larsen& J.Srba 147 Algorithm 2: Time-dart reachability algorithm Input: A timed automaton A = (L,C, −→, ℓ0 ) and a location ℓg ∈ L Output: true if ℓg is reachable in TDS (A), false otherwise 1 begin PW (ℓ, g) := ⊥ for all (ℓ, g) /* default value */ 2 AddToPW(ℓ0, g0 , 0, ¥) where g0 (x) := 0 for all x ∈ C 3 while ∃(ℓ, g). PW (ℓ, g) = (w, p) and w < p do 4 PW (ℓ, g) := (w, w) 5 foreach (ℓ, g, R, ℓ′ ) ∈−→ do 6 start := max(w, max({lb(g(x)) − g(x) x ∈ C})) 7 end := min({ub(g(x)) − g(x) x ∈ C}) 8 if (start < p ∧ start ≤ end ) then 9 if R = /0 then 10 AddToPW(ℓ′, (g⊕MC start ) − start, start , ¥) 11 else stop := max{start , MC + 1 − minx∈CrR g(x)} for n := start to min(end , p − 1, stop) do AddToPW(ℓ′ , (g⊕MC n)[R := 0], 0, ¥) 12 13 14 15 16 return false 17 AddToPW(ℓ, g, w, p) 18 if ℓ = ℓg then return true /* and terminate the whole algorithm */ 19 20 if PW (ℓ, g) = ⊥ then PW (ℓ, g) := (w, p) 21 22 else (w′ , p′ ) := PW (ℓ, g) 23 PW (ℓ, g) := (min(w, w′ ), min( p, p′ )) 24 5 Reachability Algorithm Based on Time-Darts We can now present Algorithm 2 showing us how time-darts can be used to compute the set of reachable states of a timed automaton in a compact and efficient way. The algorithm repeatedly selects from the waiting list a location ℓ with a time-dart (g, w, p) that still contains some unexplored points (w < p). g,R −→ ℓ′ in the timed automaton it computes the start and end delays from the anchor Then for each edge ℓ point such that start is the minimum delay where the guard g gets first enabled and end is the maximum possible delay so that g is still enabled. Depending on the concrete situation it will add a new time-dart (or a set of darts) with location ℓ′ to the waiting list by calling AddToPW. A switch transition is always followed by a delay transition that is computed symbolically (including in a single step all possible delays). There are several cases that determine what kinds of new time-darts are generated. Figure 3 gives a graphical overview of the different situations. In Figure 3a we illustrate the produced time-dart that serves as the argument for the call to AddToPW at line 11 of the algorithm (no clocks are reset). Here the anchor point g is not modified because ((g⊕MC start) − start ) = g. Figure 3b shows another example 148 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata y ((2, 0), 2, 5) MC ((2, 0), 4, ¥) y MC 4 ℓ y MC 4 3 ≤ x ≤ 7 ∧ y ≥ 4 x MC 7 g 3 start = 4, end = 5 g⊕MC start = (6, 4) g⊕MC end = (7, 5) ℓ′ g 6 MC x (a) Unchanged anchor point ((3, 0), 2, 5) y ((2, 0), 4, ¥) MC x ≥ 4 ∧ y ≥ 4 x ℓ′ gg′ MC x g ℓ MC = 5 start = 4, end = ¥ g+ start = (7, 4) g⊕MC start = (6, 4) (g⊕MC start) − start = (2, 0) = g′ ((2, 0), 2, 5) MC y 6 (b) Shift of anchor point ((4, 0), 0, ¥) ((5, 0), 0, ¥) ((6, 0), 0, ¥) y MC y ≤ 6, y:=0 ℓ g 4 5 6 start = 2, end = 6 x MC ℓ′ 4 5 6 x MC (c) Reset of a clock Figure 3: Successor generation for a selected time-dart K.Y. Jørgensen, K.G.Larsen& J.Srba 149 x := 0 x ≥ 2, y ≥ 2 x := y := 0 x ≥ 2 ℓ0 ℓ1 x ≥ 1 ℓ2 x ≤ 1, y ≥ 2 ℓ3 Location Anchor (0, 0) ℓ0 (0, 0) ℓ1 (0, 1) ℓ1 (0, 2) ℓ1 (0, 3) ℓ1 (0, 0) ℓ2 2 1 0 (0, ¥) (0, 0) (0, 0) ⊥ (2, ¥) (2, 2) ⊥ ⊥ ⊥ ⊥ (0, ¥) ⊥ ⊥ (0, ¥) ⊥ ⊥ (0, ¥) ⊥ 3 (0, 0) (2, 2) ⊥ (0, 0) (0, ¥) (0, ¥) 4 (0, 0) (2, 2) ⊥ (0, 0) (0, 0) (0, ¥) 6 5 (0, 0) (0, 0) (1, 2) (1, 1) ⊥ (0, ¥) (0, 0) (0, 0) (0, 0) (0, 0) (0, 0) (0, 0) 7 (0, 0) (1, 1) (0, 0) (0, 0) (0, 0) (0, 0) Figure 4: Example of an execution of the algorithm (columns represent the number of iterations of the main while-loop; all unlisted pairs of locations and anchor points are constantly having the value ⊥) of a call at line 11 where the anchor point changes. Finally, Figure 3c explains the case where some clocks are reset and several new darts are added in the body of the for-loop at line 15 of the algorithm (the for-loop starts from start and stops as soon as either end , the beginning of the passed list, or the number stop —used for performance optimization–is reached). We note th at the figures show the time- darts that the function AddToPW is called with; inside the function the information already stored in the passed-waiting list for the concrete anchor point and location is updated so that we take the minimum of the current and new waiting and passed distances (line 24 of the algorithm). Let us now demonstrate the execution of Algorithm 2 on the automaton depicted in Figure 4, where we ask if the goal location ℓ3 is reachable from the initial state (ℓ0 , v0 ) where v0 (x) = v0 (y) = 0. The values stored in the passed-waiting list after each iteration of the while-loop are shown in the table such that a column labelled with a number i is the status of the passed-waiting list after the i’th execution of the body of the while-loop; all values for anchor points not listed in the table are constantly ⊥. Initially we set PW (ℓ0 , (0, 0)) = (0, ¥), meaning that all points reachable from the initial valuation after an arbitrary delay action belong to the waiting list and should be explored. As ℓ0 is not the goal state, the algorithm continues with the execution of the main while-loop. In the first iteration of the loop we pick the only element in the waiting list so that ℓ = ℓ0 , g = (0, 0), w = 0 and p = ¥. Then we update PW (ℓ0 , (0, 0)) to (0, 0)2 according to line 5 of the algorithm, meaning that all points on the dart are now in the passed list. After this we consider the transition from ℓ0 to ℓ1 with the guard x ∈ [2, ¥) (and the implicit guard y ∈ [0, ¥)) and calculate the values of start (minimum delay from the anchor point to satisfy the guard and at the same time having at least the delay w where the waiting list starts) and end (maximum delay from the anchor point so that the guard is still satisfied). In our example we have start = max(0, (2 − 0), (0 − 0)) = 2 and end = min((¥ − 2), (¥ − 0)) = ¥. Next we consider the test at line 9 that requires that the minimum delay start to enable all guards is not in the region of already passed points (start < p) and at the same time that it is below the maximum delay after which the guard become disabled (start ≤ end). If this test fails, there is no need to do 2 In each column we mark by bold font the element that is picked in the next iteration of the while-loop. 150 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata anything with the currently picked element from the waiting list. As the values in our example satisfy the condition at line 9 and no clocks are reset, we update according to line 11 of the algorithm the value of (ℓ1 , (0, 0)) to (2, ¥). This means that in the future iterations we have to explore in location ℓ1 all points (2, 2), (3, 3), (4, 4), . . . . Note that the addition and subtraction of start at line 11 had no effect as none of the clocks after the minimum delay exceeded the maximum constant 2; should this happen the values exceeding the maximum constant get truncated to MC + 1. In the second iteration of the while-loop we select the location and anchor point (ℓ1 , (0, 0)), with w = 2 and p = ¥, set it to (2, 2) in the table and mark it in bold as the selected point in the previous column. This time we have to explore two edges. First, we select the self-loop that resets the clock x and we get start = 2 and end = ¥. Now we execute the lines 10 to 15 as the edge contains a reset. The for-loop will be run for the value of n from 2 to 3. The upper-bound of 3 for the for-loop follows from the fact that MC = 2 and the maximum value of a clock that is not reset in the anchor point is 0. In the for-loop we add two successors (line 15) at the location ℓ1 with the anchor points (0, 2) and (0, 3). Second, if we consider the edge from ℓ1 to ℓ2 we can see that in location ℓ2 the anchor point (0, 0) is set to (0, ¥). The remaining values stored in the passed-waiting list are computed in the outlined way. We can notice that after the 7th iteration of the while-loop the set Waiting(PW ) is empty and the algorithm terminates. As the location ℓ3 has not been discovered during the search, the algorithm returns false. The correctness theorem requires a detailed technical treatment and its complete proof is given in the full version of this paper. Termination follows from the fact that newly added anchor points are computed as (g⊕MC start) − start or (g⊕MC n)[R := 0] which ensures a finite size of the passed-waiting list and tha t every time-dart (g, w, p) on the list satisfies 0 ≤ w ≤ MC, w < p, and p ≤ MC or p = ¥. Soundness proof is by a case analysis establishing a loop-invariant that every call to AddToPW only adds time-darts that represent reachable configurations in the bounded semantic s. Finally, the completeness proof is done by induction on the length of the computation leading to a reachable configuration, taking into account the nondeterministic nature of the algorithm, the fact that ≡MC is a timed bisimulation, and it makes a full analysis of the different cases for adding new time-darts present in the algorithm for its performance optimization. Theorem 5.1 Let A be a timed automaton and let ℓg be a location. Algorithm 2 terminates, and it returns true iff ℓg is reachable in the discrete semantics TDS (A). 6 Experiments We have conducted a number of experiments in order to test the performance of the time-dart state-space representation. The experiments were done within the project opaal [12], a model-checking framework designed explicitly for fast prototyping and testing of verification algorithms using the programming lan- guage Python. The tool implements the pseudocode of both the fully discrete (called naive in the tables) as well as the time-dart reachability algorithms based on passed-waiting list presented in Section 4. The experiments were conducted on Intel Core 2 Duo [email protected] running Ubuntu linux. The verification was interrupted after five minutes or when th e memory limit of 2GB RAM was ex- ceeded (marked in the tables as OOM). The number of discovered symbolic states corresponds to the total number of calls to the function AddToPW (including duplicates) and the number of stored states is the size of the passed-waiting list at the termination of the algorithm. Verification times (in seconds) are highlighted in the bold font. The examples and tool implementation are available at http://people.cs.aau.dk/~kyrke/download/timedart/timedart.tar.gz. K.Y. Jørgensen, K.G.Larsen& J.Srba 151 Model T55 T55 T55 T55 T55 T55 T55 T125 T125 T125 T125 T125 T125 T125 T125 T155 T155 T155 T155 T155 T155 T155 T155 T155 T155 T155 T155 T155 # Naive Discovered 3.8 81,062 4 13.0 254,969 5 43.8 6 727,712 95.7 1,431,665 7 8 OOM - 9 - 10 0.3 4 1.6 5 5.5 6 20.3 7 93.4 8 9 OOM - 10 - 11 0.4 4 1.1 5 19.9 6 28.5 7 32.3 8 34.1 9 60.8 10 11 OOM - 12 - 13 - 14 - 15 - 16 - - 2,609 18,394 61,242 205,808 82,4630 - - - 5,796 23,454 433,674 577,179 620,138 626,100 1,035,226 - - - - - Stored Darts Discovered 1.9 34,012 38,906 5.9 111,543 110,907 17.6 336,527 297,026 32.0 524,270 607,483 91.8 1,740,066 255.7 4,700,607 - - >300 - 0.2 2,050 198 0.2 713 14,772 0.5 48,600 2,916 1.4 10,337 161,394 4.7 529,032 39,242 13.7 111,438 - 34.5 274,939 - - OOM - 0.3 3,048 1,532 0.4 4,572 9,740 3.6 62,771 14,2861 4.5 74,105 18,7857 4.8 203,178 78,093 4.9 79,111 205,646 7.5 241,44 329,193 31.2 514,959 - 37.7 - 608,974 105.7 1,684,525 - 158.3 2,316,474 - 164.5 2,409,417 - - OOM - Stored 3,654 10,739 29,378 51,730 136,639 347,136 - 139 503 1,769 6,102 20,392 56,191 126,895 - 467 1,195 8,859 10,725 11,508 11,753 18,574 67,592 80,634 205,087 284,859 298,288 - Figure 5: Results for three different TGS scaled by the number of tasks 6.1 Task Graph Scheduling The task graph scheduling problem (TGS) is the problem of find ing a feasible schedule for a number of parallel tasks with given precedence constraints and processing times on a fixed number of homogeneous processors [17]. The chosen task graphs for two processors were taken from the benchmark [22] such that several scheduling problems with different degree of concurrency are included. The models are scaled by the number of tasks in the order given by the benchmark and the verification query performed a full state-space search. The experimental results are displayed in Figure 5. The data confirm that the time- dart verification technique saves both the number of stored/ discovered states and noticeably improves the verification speed, in particular in the model T155. 6.2 Bridge Crossing Vikings The bridge crossing Vikings is a slightly modified version of the standard planning problem available in the official distribution of U PPAA L; we only eliminated the used integer variables that are not supported in our opaal implementation and are simulated by new locations. The query searched the whole state- 152 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata # Naive Discovered 0.2 295 2 0.2 2,614 3 0.8 16,114 4 4.9 5 90,743 33.2 501,958 6 7 OOM - - 8 - Stored Darts Discovered 0.1 87 152 0.2 754 1,263 0.5 4,902 7,588 2.5 42,294 29,144 13.4 165,535 235,635 74.8 900,439 - - >300 - Stored 46 336 1,759 8,308 38,367 177,807 - Figure 6: Results for bridge crossing scaled by the number of Vikings # Naive Discovered 0.2 1 173 1.5 16684 2 3 OOM - - 4 - Stored Darts Discovered 0.2 139 21 0.3 1140 11042 4.6 40671 - - OOM - Stored 15 647 21721 - Figure 7: Results for train level crossing scaled by the number of trains space. Verification results are given in Figure 6. The perfor mance of the time-dart algorithm is again better than the full discretization, even though in this case the constants in the model are relatively small (proportional to the number of Vikings), meaning that the potential of time-darts is not fully exploited. 6.3 Train Level Crossing In train level crossing we consider auto-generated timed automata templates constructed via automatic translation [11] from timed-arc Petri net model of a train level-crossing example. The auto-generated timed automata were produced by the tool TAPAAL [13] and have a rather complex structure that human modelers normally never design and hence we can test the potential of the discrete-time engine also for the models translated from other time-dependent formalisms. The query we asked searches the whole state-space. We list the results in Figures 7 and the experiment demonstrates again the advantage of the time-dart verification method. 6.4 Fischer’s Protocol The discrete-time techniques are sensitive to the size of the constants present in the model. We have therefore scaled our next experiment by the size of the maximal constant (MC) that appears in the model in order to demonstrate the main advantage of the time-dart algorithm. For this we use the well known Fischer’s protocol for ensuring a mutual exclusion between two or more parallel processes [18]. It is a standard model for testing the performance of verification tools; we replaced one open interval in the model with a closed one such that mutual exclusion is still guaranteed. The concrete version of the protocol we verified was created by a translation from tim ed-arc Petri net model of the protocol [1] available as a demo example in the tool TAPAAL [13]. We searched the whole state-space and the results are summarized in Figure 8. It is clear that time-darts are superior w.r.t. the scaling of the constants in the model, allowing us to verify (within the given limit of 300 seconds) models where the maximum constant is 66, opposed to only 18 when the full discretization is used. K.Y. Jørgensen, K.G.Larsen& J.Srba 153 MC Naive Discovered 3.1 36,774 3 4.5 53,655 4 6.2 74,415 5 17.8 9 202,965 64.5 569,280 15 111.8 850,164 18 OOM - 19 - 25 - - - 38 - - 50 - 66 - Stored Darts Discovered 1.1 9,464 25,882 1.4 14,341 38,570 1.8 20,226 54,513 3.8 157,555 53,846 10.4 133,796 466,888 14.2 187,595 710,857 15.7 207,544 - 26.1 - 348,406 61.3 778,095 - 114.7 1,325,931 - 217.2 - 2,214,846 Stored 6,238 8,725 11,548 26,200 58,258 78,823 86,350 138,568 293,203 486,343 795,808 Figure 8: Experimental results for Fischer’s mutual exclusion protocol 7 Conclusion We have introduced a new data structure of time-darts in order to represent the reachable state-space of closed timed automata models. We showed on a number of experiments that our time-dart reachability algorithm achieves a consistently better performance than the explicit search algorithm, improving both the speed and memory requirements. This is obvious in particular on models with larger constants (as demonstrated in the Fischer’s experiment or T155 task graph) where time-darts provide a compact representation of the delay successors and considerably improve both time and memory. The algorithms were implemented in the interpreted language Python without any further optimiza- tions techniques like partial order and symmetry reductions and advanced extrapolation techniques and with only one global maximum constant. This does not allow us to compare its performance directly with the state-of-the-art optimized tools for real-time systems. An advantage of time-darts and explicit state-space methods in general is that it is relatively easy to extend them with additional modelling features like clock invariants and diagonal guards. In our future work we will implement the time-dart algorithm in C++ with additional optimizations (e.g. considering local constants instead of the global ones) and we shall also consider the verification of liveness proper- ties. It is clear that for large enough constants the DBM-search engine will always combat the explicit methods (see [19]); our technique can be so seen as a practical alternative to the DBM-engines on the subset of models that for example use counting features (like in our introductory example) and where DBM state-space representation explodes even for models with small constants. Another line of research will focus on further optimizations of the time-dart technique by considering federations of time-darts so that the data structure becomes even less sensitive to the scaling of the constants. Acknowledgements. We would like to thank the anonymous reviewers for their comments. References [1] P.A. Abdulla & A. Nyl ´en (2001): Timed Petri Nets and BQOs. In: Proceedings of the 22nd International ConferenceonApplicationandTheoryofPetriNets(ICATPN’01), LNCS 2075, Springer-Verlag, pp. 53 –70, doi:10.1007/3-540-45740-2 5. 154 Time-Darts: ADataStructure forVerification ofClosedTime dAutomata [2] R. Alur & D. Dill (1994): A Theory of Timed Automata. Theoretical Computer Science (TCS) 126(2), pp. 183 –235, doi:10.1016/0304-3975(94)90010-8. [3] E. Asarin, M. Bozga, A. Kerbrat, O. Maler, A. Pnueli & A. Rasse (1997): Data-Structures for the In Oded Maler, editor: HART, LNCS 1201, Springer, pp. 346 –360, Verification of Timed Automata . doi:10.1007/BFb0014737. [4] G. Behrmann, A. David & K.G. Larsen (2004): A Tutorial on U P PAAL . In: Formal Methods for the Design of Real-Time Systems: 4th International School on Formal Methods for the Design of Com- puter, Communication, and Software Systems (SFM-RT’04), LNCS 3185, Springer-Verlag, pp. 200 –236, doi:10.1007/978-3-540-30080-9 7. [5] B. Berthomieu & M. Menasche (1983): An Enumerative Approach for Analyzing Time Petri Nets. In: IFIP Congress, pp. 41 –46. [6] D. Beyer, C. Lewerentz & A. Noack (2003): Rabbit: A Tool for BDD-Based Verification of Real-Time Systems. In Warren A. Hunt Jr. & Fabio Somenzi, editors: CAV, LNCS 2725, Springer, pp. 122 –125, doi:10.1007/978-3-540-45069-6 13. [7] D. Beyer & A. Noack (2003): Can Decision Diagrams Overcome State Space Explosion in Real-Time Ver- In Hartmut K onig, Monika Heiner & Adam Wolisz, editors: FORTE, LNCS 2767, Springer, pp. ification? 193 –208, doi:10.1007/978-3-540-39979-7 13. [8] P. Bouyer (2003): Untameable Timed Automata! In Helmut Alt & Michel Habib, editors: STACS, LNCS 2607, Springer, pp. 620 –631, doi:10.1007/3-540-36494-3 54. [9] M. Bozga, S. Graf & L. Mounier (2002): IF-2.0: A Validation Environment for Component-Based Real-Time Systems. In Ed Brinksma & Kim Guldstrand Larsen, editors: CAV, LNCS 2404, Springer, pp. 343 –348, doi:10.1007/3-540-45657-0 26. [10] M. Bozga, O. Maler & S. Tripakis (1999): Efficient Verification of Timed Automata Using Dense and Disc rete Time Semantics. In: Proceedings of Correct Hardware Design and Verification Met hods (CHARME’99), LNCS 1703, Springer, pp. 125 –141, doi:10.1007/3-540-48153-2 11. [11] J. Byg, K.Y. Jørgensen & J. Srba (2009): An Efficient Translation of Timed-Arc Petri Nets to Networks of Timed Automata. In: Proc. of the 11th International Conf. on Formal Engineering Methods (ICFEM’09), LNCS 5885, Springer-Verlag, pp. 698 –716, doi:10.1007/978-3-6 42-10373-5 36. [12] A.E. Dalsgaard, R.R. Hansen, K.Y. Jørgensen, K.G. Lars en, M.Chr. Olesen, P. Olsen & J. Srba (2011): opaal: A Lattice Model Checker. In: Proceedingsof the3rdNASAFormalMethodsSymposium(NFM’11), LNCS 6617, Springer-Verlag, pp. 487 –493, doi:10.1007/978-3-6 42-20398-5 37. [13] A. David, L. Jacobsen, M. Jacobsen, K.Y. Jørgensen, M.H . Møller & J. Srba (2012): TAPAAL 2.0: Integrated Development Environment for Timed-Arc Petri Nets. In: Proceedings of the 18th International Conference onToolsandAlgorithmsfor theConstructionandAnalysisofSystems (TACAS’12), LNCS 7214, Springer- Verlag, pp. 492 –497, doi:10.1007/978-3-642-28756-5 36. [14] C. Daws, A. Olivero, S. Tripakis & S. Yovine (1996): The Tool KRONO S. In: Proc. Hybrid Systems III: VerificationandControl(1995) , LNCS 1066, Springer-Verlag, pp. 208 –219, doi:10.1007/BFb0020 947. [15] D.L. Dill (1989): Timing Assumptions and Verification of Finite-State Concur rent Systems. In Joseph Sifakis, editor: AutomaticVerificationMethodsforFiniteStateSystems , LNCS 407, Springer, pp. 197 –212, doi:10.1007/3-540-52148-8 17. [16] P.-A. Hsiung, F. Wang & R.-Ch. Chen (2000): On the verification of Wireless Transaction Protocol using SGM and RED. In: RTCSA, IEEE Computer Society, pp. 379 –383, doi:10.1109/RTCSA.2 000.896414. [17] Y.-K. Kwok & I. Ahmad (1999): Benchmarking and Comparison of the Task Graph Scheduling Algorithms. JournalofParallelandDistributedComputing 59(3), pp. 381 – 422, doi:10.1006/jpdc.1999.1578. [18] L. Lamport (1987): A Fast Mutual Exclusion Algorithm. ACMTransactionsonComputerSystems 5(1), pp. 1 –11, doi:10.1145/7351.7352. K.Y. Jørgensen, K.G.Larsen& J.Srba 155 [19] L. Lamport (2005): Real-Time Model Checking Is Really Simple. In: CHARME, LNCS 3725, Springer, pp. 162 –175, doi:10.1007/11560548 14. [20] K.G. Larsen & Y. Wang (1997): Time-Abstracted Bisimulation: Implicit Specifications an d Decidability. InformationandComputation 134(2), pp. 75 – 101, doi:10.1006/inco.1997.2623. [21] Y. Liu, J. Sun & J.S. Dong (2008): An Analyzer for Extended Compositional Process Algebras. In: ICSE Companion, ACM, pp. 919 –920, doi:10.1145/1370175.1370187. [22] Kasahara Laboratory at Waseda University: Http://www.kasahara.elec.waseda.ac.jp/schedule/. [23] J. Zhao, X. Li & G. Zheng (2005): A quadratic-time DBM-based successor algorithm for checking timed automata. InformationProcessingLetters 96(3), pp. 101 –105, doi:10.1016/j.ipl.2005.05.027. Standard Set. Task Graph
1806.02207
1
1806
2018-06-06T14:19:52
Online Makespan Minimization: The Power of Restart
[ "cs.DS" ]
We consider the online makespan minimization problem on identical machines. Chen and Vestjens (ORL 1997) show that the largest processing time first (LPT) algorithm is 1.5-competitive. For the special case of two machines, Noga and Seiden (TCS 2001) introduce the SLEEPY algorithm that achieves a competitive ratio of $(5 - \sqrt{5})/2 \approx 1.382$, matching the lower bound by Chen and Vestjens (ORL 1997). Furthermore, Noga and Seiden note that in many applications one can kill a job and restart it later, and they leave an open problem whether algorithms with restart can obtain better competitive ratios. We resolve this long-standing open problem on the positive end. Our algorithm has a natural rule for killing a processing job: a newly-arrived job replaces the smallest processing job if 1) the new job is larger than other pending jobs, 2) the new job is much larger than the processing one, and 3) the processed portion is small relative to the size of the new job. With appropriate choice of parameters, we show that our algorithm improves the 1.5 competitive ratio for the general case, and the 1.382 competitive ratio for the two-machine case.
cs.DS
cs
Online Makespan Minimization: The Power of Restart∗ Zhiyi Huang† Ning Kang‡ Zhihao Gavin Tang§ Xiaowei Wu¶ Yuhao Zhang(cid:107) Abstract We consider the online makespan minimization problem on identical machines. Chen and gorithm that achieves a competitive ratio of (5 − √ Vestjens (ORL 1997) show that the largest processing time first (LPT) algorithm is 1.5-competitive. For the special case of two machines, Noga and Seiden (TCS 2001) introduce the SLEEPY al- 5)/2 ≈ 1.382, matching the lower bound by Chen and Vestjens (ORL 1997). Furthermore, Noga and Seiden note that in many applications one can kill a job and restart it later, and they leave an open problem whether algorithms with restart can obtain better competitive ratios. We resolve this long-standing open problem on the positive end. Our algorithm has a natural rule for killing a processing job: a newly-arrived job replaces the smallest processing job if 1) the new job is larger than other pending jobs, 2) the new job is much larger than the processing one, and 3) the processed portion is small relative to the size of the new job. With appropriate choice of parameters, we show that our algorithm improves the 1.5 competitive ratio for the general case, and the 1.382 competitive ratio for the two-machine case. 8 1 0 2 n u J 6 ] S D . s c [ 1 v 7 0 2 2 0 . 6 0 8 1 : v i X r a Hong Kong RGC under the grant HKU17202115E. ∗A preliminary version of the paper to appear in APPROX 2018. †Department of Computer Science, The University of Hong Kong. [email protected]. Partially supported by the ‡Department of Computer Science, The University of Hong Kong. [email protected]. §Department of Computer Science, The University of Hong Kong. [email protected]. ¶Department of Computing, The Hong Kong Polytechnic University. [email protected]. Part of the work was done when the author was a postdoc at the University of Hong Kong. (cid:107)Department of Computer Science, The University of Hong Kong. [email protected]. 1 1 Introduction We study in this paper the classic online scheduling problem on identical machines. Let there be m identical machines, and a set of jobs that arrive over time. For each job j, let rj denote its release time (arrival time), and pj denote its processing time (size). We assume without loss of generality that all rj's and pj's are distinct. We seek to schedule each job on one of the m machines such that the makespan (the completion time of the job that completes last) is minimized. We adopt the standard assumption that there is a pending pool such that jobs released but not scheduled are in the pending pool. That is, the algorithm does not need to assign a job to one of the machines at its arrival; it can decide later when a machine becomes idle. Alternatively, the immediate-dispatching model has also been considered in some papers (e.g., Avrahami and Azar [2007]). We consider the standard competitive analysis of online algorithms. An algorithm is (1 + γ)- competitive if for any online sequence of jobs, the makespan of the schedule made by the algorithm is at most (1+γ) times the minimum makespan in hindsight. Without loss of generality, (by scaling the job sizes) we assume the minimum makespan OPT = 1 (for analysis purpose only). Chen and Vestjens [1997] consider a greedy algorithm called largest processing time first (LPT): whenever there is an idle machine, schedule the largest job in the pending pool. They prove that the LPT algorithm is 1.5-competitive and provide a matching lower bound (consider m jobs of size 0.5 followed by a job of size 1). They also show that no online algorithm can achieve a competitive ratio better than 1.3473. For the special case when there are only two machines, Noga and Seiden 5)/2 ≈ 1.382 competitive ratio, [2001] introduce the SLEEPY algorithm that achieves a tight (5−√ due to a previous lower bound given by Chen and Vestjens [1997]. The 1.382 lower bound (for two machines) holds under the assumption that whenever a job is scheduled, it must be processed all the way until its completion. However, as noted in Noga and Seiden [2001], many applications allow restart: a job being processed can be killed (put into pending) and restarted later to make place for a newly-arrived job; a job is considered completed only if it has been continuously processed on some machine for a period of time that equals to its size. In other words, whenever a job gets killed, all previous processing of this job is wasted. Note that the restart setting is different from the preemptive setting, in which the processed portion is not wasted. Noga and Seiden [2001] leave the following open problem: Is it possible to beat the 1.382 barrier with restart? In this paper, we bring an affirmative answer to this long-standing open problem. We propose a variant of the LPT algorithm (with restart) that improves the 1.5 competitive ratio for the general case, and the 1.382 competitive ratio for the two-machine case. Our Replacement Rule. A naıve attempt for the replacement rule would be to replace a job whenever the newly-arrived job has a larger size. However, it is easy to observe that the naıve attempt fails even on one machine: the worst case competitive ratio is 2 if we keep replacing jobs that are almost completed (with jobs of slightly larger size). Hence we should prevent a job from being replaced if a large portion has been processed. Moreover, we allow a newly-arrived job to replace a processing job only if it has a much larger size, in order to avoid a long chain of replacements. As we will show by an example in Section 7, the worst case competitive ratio is 1.5 if a job of size 1 is replaced by a job of size 1 + , which is in turn replaced by a job of size 1 + 2, etc. We hence propose the following algorithm that applies the above rules. 1 LPT with Restart. As in the LPT algorithm, our algorithm schedules the largest pending job whenever there is an idle machine. The main difference is that our algorithm may kill a processing job to make place for a newly-arrived job according to the following rule. Upon the arrival of a job j, we kill a processing job k (i.e., put k into pending) and schedule j if: 1. j is the largest pending job and k is the smallest among the m processing jobs; 2. the processed portion of k is less than αpj; 3. the size of j is more than 1 + β times larger than k, i.e., pj > (1 + β)pk, 2 are parameters of the algorithm. We call such an operation a replacement (i.e. where 0 < α, β < 1 j replaces k). Intuitively, the parameter α provides a bound on the total amount of wasted processing (in terms of the total processing time); while the parameter β guarantees an exponential growth in the processing time of jobs if there is a chain of replacements. With appropriate choice of parameters, we show the following results. Theorem 1.1 LPT with Restart, with parameters α = 1 200 and β = competitive for the Online Makespan Minimization problem with restart. √ 2 − 1, is (1.5 − 1 20000 )- Theorem 1.2 LPT with Restart, with parameters α = β = 0.2, is 1.38-competitive for the Online Makespan Minimization problem with restart on two machines. There are many other natural candidate replacement rules. We list some candidate algorithms that we have considered and their counter examples in Sec 7. Our Techniques. The main focus of our paper is the general case, i.e., on m machines. The analysis for the two-machine case is built on the general case by refining some of the arguments. We adopt an idea from Chen and Vestjens [1997] to look at the last completed job in our schedule. Intuitively, only jobs with size comparable to that of the last job matter. We develop two kinds of arguments, namely the bin-packing argument and the efficiency argument. 2 − 1 Assume for contrary that the algorithm has a makespan strictly larger than 1 + γ, where γ := 1 20000 , we use the bin-packing argument to give an upper bound on the size of the last completed job. Assume that the last job is large, we will find a number of large jobs that cannot be packed into m bins of size 1 (recall that we assume OPT = 1). In other words, to schedule this set of jobs, one of the m machines must get a total workload strictly greater than 1. For example, finding 2m + 1 jobs of size strictly greater than 1 3 would suffice. We refer to such a set of large jobs as an infeasible set of jobs. We then develop an efficiency argument to handle the case when the last job is of small size. The central of the argument is a Leftover Lemma that upper bounds the difference of total processing done by the algorithm and by OPT. As our main technical contribution, the lemma is general enough to be applied to all schedules. Fix any schedule (produced by some algorithm ALG) and a time t. Let M denote the set of machines. For each machine M ∈ M, let W(M, x) ∈ {0, 1} be the indicator function of the event that "at time x, machine M is not processing while there are pending jobs". Define Wt = 0 W(M, x)dx to be the total waste (of processing power) before time t. We show (in (cid:80) Section 3) the following lemma that upper bounds the leftover workload. (cid:82) t M∈M Lemma 1.1 (Leftover Lemma) For all time t, let ∆t be the difference in total processing time before time t between ALG and OPT. We have ∆t ≤ 1 4 tm + Wt. 2 Observe that the total processing power (of m machines) before time t is tm. The Leftover Lemma says that compared to any schedule (produced by algorithm ALG), the extra processing the optimal schedule can finish before time t, is upper bounded by the processing power wasted by the schedule (e.g., due to replacements), plus a quarter of the total processing power, which comes from the sub-optimal schedule of jobs. Consider applying the lemma to the final schedule1 produced by our algorithm. Since our algorithm schedules a job whenever a machine becomes idle, the waste Wt comes only from the processing (before time t) of jobs that are replaced. Thus (by our replacement) we can upper bound Wt by α fraction of the total size of jobs that replace other jobs. We remark that the above bound on the leftover workload is tight for LPT (for which Wt = 0). Consider m jobs of size 0.5 arriving at time 0, followed by m/2 jobs of size 1 −  arriving at time . The optimal schedule uses m 2 machines to process the size 0.5 jobs (two per machine), finishing all jobs at time 1. LPT would schedule all the size 0.5 2 size (1− ) jobs have half of their workload unprocessed at time 1. Therefore, jobs first; all of the m the amount of leftover workload at time t = 1 is m 4 . 2 machines to process the size (1 − ) jobs and m Other Work. The online scheduling model with restart has been investigated in the problem of scheduling jobs on a single machine to maximize the number of jobs completed before their deadlines. Hoogeveen et al. [2000] study the general case and propose a 2-competitive algorithm with restart. Subsequently, Chrobak et al. [2007] consider the special case when jobs have equal lengths. They propose an improved 3 2 -competitive algorithm with restart for this special case, and prove that this is optimal for deterministic algorithms. However, the restart rule and its analysis in our paper do not bear any obvious connections to those in Hoogeveen et al. [2000] and Chrobak et al. [2007] due to the different objectives. Other settings of the online makespan minimization problem have been studied in the literature. A classic setting is when all machines are identical and all jobs have release time 0, but the algorithm must immediately assign each job to one of the machines at its arrival (immediate dispatching). This is the same as online load balancing problem. Graham [1969] proves that the natural greedy algorithm that assigns jobs to the machine with the smallest workload is (2 − 1 m )-competitive in this setting, which is optimal for m ≤ 3 (due to folklore examples). A series of research efforts have then been devoted to improving the competitive ratio when m is large (e.g., Albers [1999], Bartal et al. [1995], Karger et al. [1996]). For m = 4, the best upper bound is 1.7333 Chen et al. [1994a], while the best lower bound stands at 1.7321 RudinIII and Chandrasekaran [2003]. For m that tends to infinity, the best upper bound is 1.9201 Fleischer and Wahl [2000], while the best lower bound is 1.880 RudinIII [2001]. A variant of the above setting is that a buffer is provided for temporarily storing a number of jobs; when the buffer is full, one of the jobs must be removed from the buffer and allocated to a machine (e.g., Li et al. [2007], D´osa and Epstein [2010]). Kellerer et al. [1997] and Zhang [1997] use algorithms with a buffer of size one to achieve an improved 4/3 competitive ratio for two machines. Englert et al. [2014] characterize the best ratio achievable with a buffer of size Θ(m), where the ratio is between 4/3 and 1.4659 depending on the number of machines m. When both preemption and migration are allowed, Chen et al. [1995] give a 1.58-competitive algorithm without buffer, matching the previous lower bound by Chen et al. [1994b]. D´osa and Epstein [2011] achieve a ratio of 4/3 with a buffer of size Θ(m). Finally, if the machines are related instead of identical, the best known algorithm is 4.311- competitive by Berman et al. [2000], while the best lower bound is 2 by Epstein and Sgall [2000]. 1Since a job can be scheduled and replaced multiple times, its start time is finalized only when it is completed. 3 When preemption is allowed, Ebenlendr et al. [2009] show that the upper bound can be improved to e. For the special case of two related machines, the current best competitive ratio is 1.53 by Epstein et al. [1999] without preemption, and 4/3 with preemption by Ebenlendr et al. [2009] and Wen and Du [1998]. Organization. We first provide some necessary definitions in Section 2. Then we prove the most crucial structural property (Lemma 1.1, the Leftover Lemma) in Section 3, which essentially gives a lower bound on the efficiency of all schedules. We present the details of the bin-packing argument and efficiency argument in Section 4, where our main result Theorem 1.1 is proved. The special case of two machines is considered in Section 6, where Theorem 1.2 is proved. Finally, we prove in Section 8 that no deterministic algorithm, even with restart, can get a competitive ratio better than √ 1.5 ≈ 1.225. 2 Preliminaries Consider the online makespan minimization with m identical machines and jobs arriving over time. Recall that for each job j, rj denotes its release time and pj denotes its size. Let OPT and ALG be the makespan of the optimal schedule and our schedule, respectively. Recall that we assume without loss of generality that OPT = 1 (for analysis purpose only). Hence we have rj +pj ≤ 1 for all jobs j. Further, let sj and cj := sj + pj denote the start and completion time of job j, respectively, in the final schedule produced by our online algorithm. Note that a job can be scheduled and replaced multiple times. We use sj(t) to denote the last start time of j before time t. We use n to denote the job that completes last, i.e., we have ALG = cn = sn + pn. We consider the time horizon as continuous, and starts from t = 0. Without loss of generality (by perturbing the variables slightly), we assume that all ri's, pi's and si's are different. Definition 2.1 (Processing Jobs) For any t ≤ ALG, we denote by J(t) the set of jobs that are being processed at time t, including the jobs that are completed or replaced at t but excluding the jobs that start at t. Note that J(t) is defined based on the schedule produced by the algorithm at time t. It is possible that jobs in J(t) are replaced at or after time t. Idle and Waste. We say that a machine is idle in time period (a, b), if for all t ∈ (a, b), the machine is not processing any job according to our algorithm, and there is no pending job. We call time t idle if there exists at least one idle machine at time t. Whenever a job k is replaced by a job j (at rj), we say that a waste is created at time rj. The size of the waste is the portion of k that is (partially) processed before it is replaced. We can also interpret the waste as a time period on the machine. We say that the waste comes from k, and call j the replacer. Definition 2.2 (Total Idle and Total Waste) For any t ∈ [0, 1], define It as the total idle time before time t, i.e., the summation of total idle time before time t on each machine. Similarly, define Wt as the total waste before time t in the final schedule, i.e., the total size of wastes located before time t, where if a waste crosses t, then we only count its fractional size in [0, t]. 4 3 Bounding Leftover: Idle and Waste (recall from Section 1) Wt is defined as(cid:80) In this section, we prove Lemma 1.1, the most crucial structural property. Recall that we define Wt as the total waste located before time t. For applying the lemma to general scheduling algorithms, 0 W(M, x)dx, the total time during which machines are not processing while there are pending jobs. It is easy to check that the proofs hold under both definitions. We first give a formal definition of the leftover ∆t at time t. M∈M (cid:82) t Definition 3.1 (Leftover) Consider the final schedule and a fixed optimal schedule OPT. For any t ∈ [0, 1], let ∆t be the total processing OPT does before time t, minus the total processing our algorithm does before time t. Since the optimal schedule can process a total processing at most m(1− t) after time t, we have the following useful observation. Observation 3.1 The total processing our algorithm does after time t is at most m(1 − t) + ∆t. We call time t a marginal idle time if t is idle and the time immediately after t is not. We first define At, which is designated to be an upper bound on the total processing that could have been done before time t, i.e., the leftover workload due to sub-optimal schedule. Definition 3.2 (At) For all t ∈ [0, 1], if there is no idle time before t, then define At = 0, otherwise j∈J(t(cid:48)) min{δj, pj}, where δj := Tj = {θ ∈ [rj, t(cid:48)] : job j is pending at time θ} is the total pending time of job j ∈ J(t(cid:48)) before time t(cid:48). let t(cid:48) ≤ t be the last idle time before t. Define At =(cid:80) (while dAt dt = dIt dt We show the following claim, which (roughly) says that the extra processing OPT does (com- pared to ALG) before time t, is not only upper bounded by total idle and waste (It + Wt), but also by the total size or pending time of jobs currently being processed (At + Wt). Claim 3.1 We have ∆t ≤ min{At, It} + Wt for all t ∈ [0, 1]. Proof: First observe that we only need to prove the claim for marginal idle times, as we have d∆t dt ≤ dWt which the algorithm is not processing (in the final schedule). Next we show that ∆t ≤ At + Wt. Let ∆t(t), At(t) and Wt(t) be the corresponding variables when the algorithm is run until time t. Observe that for a job j ∈ J(t), if it is replaced after time t, then it contributes a waste to Wt but not to Wt(t). Moreover, it has the same contribution to ∆t − ∆t(t) and to Wt. Thus we have Wt − Wt(t) = ∆t − ∆t(t). By definition we have At = At(t). It is easy to see that ∆t is at most It + Wt, the total length of time periods before t during dt = 0) for non-idle time t. Now suppose t is a marginal idle time. Hence it suffices to show that ∆t(t) ≤ At + Wt(t). Since t is idle, there is no pending job at time t. Thus the difference in total processing at time t, i.e., ∆t, must come from the difference (between ALG and OPT) in processing of jobs in J(t) that has been completed. For each j ∈ J(t), the extra processing OPT can possibly do on j (compared to ALG) is at most min{sj(t) − rj, pj}. Hence we have ∆t(t) ≤(cid:80) Thus at every time t ∈ [rj, sj(t))\Tj, j is being processed (and replaced later). Hence(cid:12)(cid:12)[rj, sj(t))\ (cid:12)(cid:12) is at most the total wastes from j that are created before sj(t) < t, which implies Recall by Definition 3.2, we have Tj ⊂ [rj, sj(t)) is the periods during which j is pending. j∈J(t) min{sj(t) − rj, pj}. Tj min{δj, pj} + Wt(t) = At + Wt(t), ∆t(t) ≤ (cid:88) min{sj(t) − rj, pj} ≤ (cid:88) j∈J(t) j∈J(t) 5 as desired. We prove the following technical claim. Claim 3.2 For any integer k ≥ 1, given any three sequences of positive reals {ai}i∈[k], {bi}i∈[k] and {hi}i∈[k] satisfying conditions (1) 0 ≤ h1 ≤ h2 ≤ . . . ≤ hk ≤ 1; (2) for all j ∈ [k], we have(cid:80) we have(cid:80) (cid:80) i∈[j] aihi ≥ 1 4 i∈[k](ai + bi). i∈[k] bi(1 − hi) ≤ 1 4 (cid:80) i∈[j](ai + bi), Proof: We prove the claim by induction on k. We first show that the claim holds true when k = 1. Note that we have a1h1 · b1(1 − h1) ≤ ( a1+b1 . Combine with property (2) we know that b1(1 − h1) ≤ 1 )2 · ( h1+(1−h1) )2 = (a1+b1)2 16 2 2 4 (a1 + b1). Figure 1: graph representation of Claim 3.2 for k = 4 aihi. Now suppose the claim is true for all values smaller than k. Using induction hypothesis on {ai}i∈[k−1],{bi}i∈[k−1] and {hi}i∈[k−1], we have bi(1 − hi) ≤ 1 4 (cid:88) (cid:88) (ai + bi) ≤ (cid:88) i∈[k−1] i∈[k−1] k−1 = bk−1 + φ. k = bk − φ and b(cid:48) i∈[k−1] i∈[k−1](4ai · hi − ai − bi)}. Let b(cid:48) Define φ = min{bk,(cid:80) Note that {ai}i∈[k],{bi}i∈[k−2]∪{b(cid:48) (cid:88) k−1 + b(cid:48) k−1) ≤ 1 4 i∈[k−2] Applying the induction hypothesis on {ai}i∈[k−1],{bi}i∈[k−2] ∪ {b(cid:48) k} and {hi}i∈[k] (and their prefixes) satisfy the conditions k−1, b(cid:48) k−1 ≥ bk−1 > 0; second, since {ai}i∈[k] and k > 0 and b(cid:48) of the claim: first, by definition we have b(cid:48) k = bk−1 + bk, if suffices to check condition (2) for j = k − 1: {hi}i∈[k] are not changed, and b(cid:48) (cid:88) (cid:88) (ai · hi). (ak−1 + b(cid:48) 1 4 (ai + bi) + φ) ≤ (cid:88) (cid:88) i∈[k−1] k−1} and {hi}i∈[k−1], bi(1 − hi) + φ(1 − hk−1) ≤ 1 4 (ai · hi − ai + bi (cid:88) (cid:88) (cid:88) (cid:88) (ai + bi) + (ai + bi) + i∈[k−1] i∈[k−1] i∈[k−1] i∈[k−1] i∈[k−1] ) = 4 aihi. 1 4 ( If φ = bk, then immediately we have bi(1 − hi) ≤ (cid:88) (cid:88) as desired. Otherwise we have φ =(cid:80) i∈[k−1] i∈[k] (ai + bi), i∈[k] bi(1 − hi) + bk(1 − hk−1) ≤ 1 4 ( i∈[k−1] (ai + bi) + bk) < 1 4 i∈[k−1](4ai · hi − ai − bi), and hence we have (ak + b(cid:48) (ak + bk + φ) = ai · hi = (ai + bi) − (cid:88) (cid:88) k), 1 4 1 4 i∈[k−1] ak · hk ≥ 1 4 i∈[k] 6 h3b4b3b2b1a4a3a2a11h4h2h1 which implies b(cid:48) (cid:88) k(1 − hk) ≤ 1 bi(1 − hi) = (cid:88) i∈[k] (ai + bi) + (cid:88) 4 (ak + b(cid:48) i∈[k−2] ≤ 1 4 i∈[k−2] k). Hence we have bi(1 − hi) + b(cid:48) k−1(1 − hk−1) + b(cid:48) k(1 − hk) + φ(hk−1 − hk) ak−1 + b(cid:48) k−1 4 ak + b(cid:48) k 4 = 1 4 + (ai + bi), (cid:88) i∈[k] which completes the induction. Given Claim 3.2, we are now ready to proof the Leftover Lemma. dt d( 1 (while Proof of Lemma 1.1: As before, it suffices to prove the lemma for marginal idle times, as we 4 tm) have d∆t dt > 0) for non-idle time t. Now suppose t is a marginal idle time. As before, let ∆t(t) and Wt(t) be the values of variables when the algorithm is run until time t. dt ≤ dWt We prove a stronger statement that ∆t(t) ≤ 1 4 tm + Wt(t), by induction on the number k of marginal idle times at or before time t. Note that the stronger statement implies the lemma, as we have ∆t − ∆t(t) = Wt − Wt(t). In the following, we use a weaker version of Claim 3.1: we only need At ≤(cid:80) processed from time g to t. By definition we have It ≤ (t− g)(m−J). Recall that At ≤(cid:80) Base Case: k = 1. Since t is the first marginal idle time, let g be the first idle time, we know that [g, t] is the only idle period. Define J := {j ∈ J(t) : sj(t) ≤ g} to be the set of jobs that are j∈J(t) δj, where δj is the total pending time of job j before time t. Hence we have δj ≤ g if j ∈ J, and δj = 0 otherwise. By Claim 3.1 we have j∈J(t) δj. ∆t(t) ≤ min{At, It} + Wt(t) ≤ min{gJ, (t − g)(m − J)} + Wt(t) ≤ 1 4 Induction. Now suppose the statement holds for all marginal idle times 0 < t1 < t2 < . . . < tk−1, and consider the next marginal idle time tk. We show that ∆tk (tk) ≤ 1 4 tkm + Wtk (tk). First of all, observe that the difference in ∆tk (tk) and ∆tj (tj) must come from the idle periods in [tj, tk] and wastes created in [tj, tk]. Hence for all j < k we have tm + Wt(t). ∆tk (tk) − ∆tj (tj) ≤ (Itk − Itj ) + Wtk (tk) − Wtj (tj). Hence, if there exists some j such that Itk − Itj ≤ 1 4 (tk − tj)m, then by induction hypothesis, ∆tk (tk) ≤ ∆tj (tj) + 1 4 (tk − tj)m + Wtk (tk) − Wtj (tj) ≤ 1 4 tkm + Wtk (tk), Note that for all j ∈ Ji, we have δj ≤(cid:80)k and we are done. Now suppose otherwise. For all i ≤ k, let gi ∈ (ti−1, ti) be the first idle time after ti−1 (assume g0 = t0 = 0), i.e., [g1, t1], [g2, t2], . . . , [gk, tk] are the disjoint idle periods. Define Ji := {j ∈ J(tk) : rj ∈ [ti−1, gi)}. x=i(gx − tx−1), as j is not pending during idle periods; for j ∈ J(rk) \ ∪i≤kJi, we have δi = 0. For all i ∈ [k], define ai := tk−i+1 − gk−i+1, bi := gk−i+1 − tk−i, hi := 1 − 1 We show that the three sequences of positive reals {ai}i∈[k], {bi}i∈[k],{hi}i∈[k] satisfy the con- ditions of Claim 3.2, which implies ∆tk (tk) ≤ Atk + Wtk (tk) ≤ 1 (cid:88) (cid:32) k(cid:88) (cid:33) δj ≤ (cid:88) (gx − tx−1) x∈[k−i+1] Jx. m (cid:80) (gi − ti−1) ·(cid:88) 4 tkm + Wtk (tk) as Jx  Ji = (cid:88) i∈[k] i∈[k] x∈[i] (ai + bi) = 1 4 tkm. Atk ≤ (cid:88) (cid:88) j∈J(rk) = m i∈[k] i∈[k] x=i (bk−i+1 · (1 − hk−i+1)) ≤ 1 4 m 7 observe that Iti − Iti−1 ≤ (ti − gi) · (m −(cid:80) Finally, we check the conditions of Claim 3.2. Condition (1) trivially holds. For condition (2), x∈[i] Jx) = ak−i+1 · hk−i+1 · m. Hence we have (cid:88) i∈[j] (cid:88) i∈[j] (cid:88) i∈[j] (ai · hi) ≥ 1 m (Itk−i+1 − Ik−i) = (Itk − Itk−j ) > 1 m 1 4 (tk − tk−j) = 1 4 (ai + bi), as required. 4 Breaking 1.5 on Identical Machines In this section, we prove Theorem 1.1. We will prove by contradiction: assume for contrary that ALG > 1 + γ, we seek to derive a contradiction, e.g., no schedule could complete all jobs before time 1 (Recall that we assume OPT = 1). To do so, we introduce two types of arguments: we use a bin-packing argument to show that the last job must be of small size, as otherwise there exists a set of infeasible large jobs; then we use an efficiency argument (built on the Leftover Lemma) to show that the total processing (excluding idle and waste periods) our algorithm completes exceed m, the maximum possible processing OPT does. For convenience of presentation, in the rest of the paper, we adopt the minimum counter-example assumption Noga and Seiden [2001], i.e., we consider the instance with the minimum number of jobs such that ALG > 1 + γ and OPT = 1. As an immediate consequence of the assumption, we get that no job arrives after sn. This is because such jobs do not affect the start time of n and therefore could be removed to obtain a smaller counter example. Recall that in our algorithm, we set α = 1 20000 . We first provide some additional structural properties of our algorithm, which will be the building blocks of our later analysis. 200 and β = 2− 1. Define γ := 1 2 − , where  = 1 √ 4.1 Structural Properties Observe that if a job is replaced, then it must be the minimum job among the m jobs that are currently being processed. Hence immediately we have the following lemma, since otherwise we can find m + 1 jobs (including the replacer) of size larger than 1 2 . Fact 4.1 (Irreplaceable Jobs) Any job with size at least 1 2 cannot be replaced. Next, we show that if a job i is pending for a long time, then each of the jobs processed at time si must be of (relatively) large size. Lemma 4.1 For any job i, we have pj > min{si − ri, pi} for all j ∈ J(si). It suffices to consider the non-trivial case when si > ri. Consider any j ∈ J(si). If pj > pi Proof: 2, then we have pj > min{si − ri, pi}. Otherwise, we consider time sj(si), at which or sj(si) < ri job j is scheduled. Since pj < pi and sj(si) > ri (i is already released), we know that pi must be processed at sj(si). Hence we know that i is replaced during (sj(si), si), which is impossible since j (which is of smaller size than i) is being processed during this period. Specifically, since ALG = sn +pn > 1+γ and rn +pn ≤ OPT = 1, we have sn−rn > γ. Applying Lemma 4.1 to job n gives the following. 2Note that we use sj(si) here instead of sj as j can possibly be replaced after time si. 8 Corollary 4.1 (Jobs Processed at Time sn) We have pj > min{γ, pn} for all j ∈ J(sn). In the following, we show two lemmas, one showing that if a job released very early is not scheduled, then all jobs processed at that time are (relatively) large; the other showing that if a job is replaced, then the next time it is scheduled must be the completion time of a larger job. 1+β for all j ∈ J(rk). Lemma 4.2 (Irreplaceable Jobs at Arrival) If a job k is not scheduled at rk and rk < αpk, then pj ≥ pk Proof: By our replacement rule, k is not scheduled at rk either because k is not the largest pending job at rk, or k is the largest pending job, but the minimum job in J(rk) is not replaceable. For the second case, since the minimum job i in J(rk) is processed at most rk < αpk, job i must violate our third replacement rule, that is pi ≥ pk 1+β . For the first case, let k(cid:48) be the first job of size at least pk that is not scheduled at its release time. Then we have rk(cid:48) < rk < αpk < αpk(cid:48). Hence pk by the above argument every job in J(rk(cid:48)) is of size at least 1+β > rk. Thus every job in J(rk) is also of size at least pk 1+β . Lemma 4.3 (Reschedule Rule) Suppose some job k is replaced, then the next time k is scheduled must be the completion time of a job j such that pk < pj ≤ sk. Suppose k is replaced at time t and rescheduled at time t(cid:48). Since k can only replace Proof: other jobs at rk, the next time k is scheduled must be when some machine becomes idle. And this happens only if the job j processed before t(cid:48) on this machine is completed. Moreover, since k is pending from t to t(cid:48), if sj ≥ t, i.e., k is pending when j is scheduled, then (by greedy scheduling rule) we have pj > pk; otherwise j is being processed at time t, and we also have pj > pk as k is the smallest job among all jobs in J(t) by the replacement rule. Hence, we have sk ≥ cj ≥ pj > pk. We present the central lemma for our bin-packing argument as follows. Intuitively, our bin- packing argument applies if there exists time t1 and t2 that are far apart, and the jobs in J(t1) and 3 ): if J(t1) ∩ J(t2) = ∅, then together with job n, we have found J(t2) are large (e.g. larger than 1 an infeasible set of 2m + 1 large jobs; otherwise (since t1 and t2 are far apart) we show that the jobs in J(t1) ∩ J(t2) must be even larger, e.g. larger than 2 3 . Lemma 4.4 (Bin-Packing Constraints) Given non-idle times t1, t2 such that t1 < t2 and n /∈ J(t1)∪J(t2), let a = minj∈J(t1){pj} and b = minj∈J(t2){pj}, none of the following cases can happen: (1) a > 1 (2) min{a, b, pn} > 1 2+β , and t2 − t1 > 1 − min{a, b, pn}. 3(1+β) , t2 − t1 > 2 3 and pn > 1 3 ; 3 , b > 2 Proof: We show that if any of the cases happens, then we have the contradiction that OPT > 1. We first consider case (1). We show that we can associate jobs to machines such that every machine is associated with either a job of size larger than 2 3 , or two jobs of size larger than 1 3 . Moreover, we show that every job is associated once, while n is not associated. Note that since pn > 1 done with this machine; otherwise (when pj ≤ 2 associate another job of size larger than 1 3 , such an association would imply the contradiction that OPT > 1. First, we associate every j ∈ J(t2) to the machine that it is processed on. If pj > 2 3 then we are 3 ), we have sj(t2) > t1 and we show that we can • If the job i ∈ J(t1) processed on this machine is not replaced, or pi ≤ 2 3 to this machine. 3(1+β) , then we associate i with this machine (it is easy to check that i has not been associated before); 9 • otherwise the first job that completes after t1 must be of size larger than (1 + β)pi > 2 3 , which In both cases we are able to do the association, as claimed. association argument similar as before: let M be the machine that job i is processed on. also has not been associated before. Thus we associate it to this machine. Next we consider case (2). Consider any job i ∈ J(t1), we have pi > 1 2+β . We apply an • If i is replaced, then we associate the first job that completes on this machine after i is • otherwise if pi > 1 − min{a, b, pn} then we associate i to M ; • otherwise we know that i completes before t2, and we can further associate to M the job in 2+β > 1 − min{a, b, pn}, to machine M ; replaced, which is of size larger than 1+β J(t2) processed on M . It is easy to check that every job is associated at most once. Hence every machine is associated with either a job of size larger than 1 − min{a, b, pn}, or two jobs of size larger than min{a, b, pn}, which (together with pn > 1 2+β ) gives OPT > 1, a contradiction. 4.2 Upper Bounding pn: Bin-Packing Argument We show in this section how to apply the structural properties from Section 4.1 to provide an upper bound 1 2+α , then Lemma 4.4 leads us to a contradiction. We first prove the following lemma (which will be further used in Section 4.4), under a weaker assumption, i.e., pn > 1 2+α on pn. Recall that we assume ALG > 1 + γ. We show that if pn > 1 2+β . Lemma 4.5 If pn > 1 2+β , then job n is never replaced. Proof: Assume the contrary and consider the last time when n is replaced. Note that by Fact 4.1, we have pn < 1 2 . Suppose n is replaced by job l at time rl. Then by our replacement rule, we have pl ≥ (1 + β)pn. As rl + pl ≤ 1 and sn + pn > 1 + γ, we have sn − rl > (1 + γ − pn) − (1 − pl) > γ + βpn > 1 − pn > pn, 2+β and pn > 1 where the second last inequality holds since γ > 1 2+β . Since rn < rl, by Lemma 4.1, we have minj∈J(sn){pj} > min{sn − rn, pn} = pn. Thus we can apply Lemma 4.4(2), with t1 = rl, t2 = sn, a = minj∈J(t1){pj} = pn and b = minj∈J(t2){pj} > pn, and derive a contradiction. Lemma 4.6 (Upper Bound on Last Job) We have pn ≤ 1 Proof: We first show a weaker upper bound: pn ≤ 1+β 2 > 1 2 . 2 > 1 − γ; As shown in the proof of Lemma 4.1, for all j ∈ J(sn), if sj > rn, we have pj > pn > 1+β otherwise sj < rn and we have pj > sn − rn ≥ (1 + γ − pn) − (1 − pn) = γ. Among the m + 1 jobs J(sn) ∪ {n}, there exist two jobs, say k and j, that are scheduled on the same machine in OPT. Moreover, we have sk, sj < rn, since otherwise one of them is larger than 1 − γ and they cannot be completed in the same machine within makespan 1. Let k be the one with a smaller release time, i.e., rk < rj. Then we have rk ≤ 1 − pk − pj < 1 − 2γ < αpk. 2 . Assume the contrary that pn > 1+β 2+α . Observe that k is never replaced, as otherwise (by Lemma 4.3, the reschedule rule) we have sk > pk, which implies rn + pn > sk + pn > pk + pn > γ + 1+β 2 > 1, a contradiction. By Lemma 4.2, we know that sk = rk (k is scheduled at its arrival time rk), as otherwise the 1+β , which is also a contradiction 1+β . Thus we have sk ≥ γ γ minimum job in J(rk) is of size at least as rn + pn > sk + pn > γ 1+β + 1+β 2 > 1 (recall that γ = 1 2 −  and β = √ 2 − 1). 10 By rk + pk + pj ≤ 1 and rk + pk + pn > 1 + γ, we have pn > 2γ. Hence rn < 1 − 2γ < αpn. By 2 . Hence we have Lemma 4.2, we know that the minimum job in J(rn) is of size at least the contradiction that there are m + 1 jobs, namely J(rn) ∪ {n}, of size larger than 1 2 . Hence we have that pn ≤ 1+β 2 . Now assume that pn > 1 By Lemma 4.5, we know that n is never replaced. By Corollary 4.1, all jobs in J(sn) ∪ {n} are of size at least min{γ, pn} ≥ 1 2+α . Let k, j ∈ J(sn)∪{n} be scheduled on the same machine in OPT such that rk ≤ 1 − pk − pj < 1 − 2 2+α ≤ αpk. Note that different from the previous analysis (when pn > 1+β 1+β ≥ 3 . Then we can apply Lemma 4.4(1) with t1 = rk and t2 = sn to derive a contradiction By Lemma 4.2, if k is not scheduled at rk, then each job i ∈ J(rk) has size pi ≥ pk 2 ), it is possible that n ∈ {k, j}. pn 1+β > 1 2+α . 1 (2+α)·(1+β) > 1 (observe that t2 − t1 = sn − rk > (1 + γ − pn) − (1 − pk − pj) > 3 2 ≥ 2 3 ). Hence we know that k is scheduled at time rk (thus we conclude that k (cid:54)= n). We show that k must be replaced (say, by job l at time rl) , as otherwise by rk + pk + pn > 1 + γ 2+α , as otherwise rn ≤ By Lemma 4.3, we have sk > pk ≥ 1 2+α > 1 2 , and rk + pk + pj ≤ 1, we have pn > γ + pj > γ + 1 1− pn < 1 contradicting Fact 4.1 (jobs larger than 1 2+α < sk (k is scheduled at sk, when n is pending), which implies pk > pn > 1− 1 2 cannot be replaced). Since pl > (1 + β)pk, we have 2+α . We also have that pn ≤ 1 − 1 2 , which is a contradiction. 2+α − 1+β 2+α > 1+β sn − rl > (1 + γ − pn) − (1 − (1 + β)pk) = (1 + β)pk + γ − pn > 1 + β 2 + α + γ − 1 + α 2 + α > 1 + α 2 + α . Then we can apply Lemma 4.4(2), with t1 = rl, t2 = sn, a = pk, b ≥ 1 contradiction. 2+α > 1 2+β , to derive a Given the upper bound 1 any job of size larger than 1 2+α on pn, we show the following stronger version of Lemma 4.5 that 2+β cannot be replaced. Corollary 4.2 (Irreplaceable Threshold) Any job of size larger than 1 2+β cannot be replaced. Proof: Assume the contrary that some job j of size larger than 1 at rk). Then we have pk > (1 + β)pj and mini∈J(rk){pi} = pj > 1 Corollary 4.1, we have mini∈J(sn){pi} > min{pn, γ} > 1 2+β is replaced (say, by job k 2+β . On the other hand, by 2+α < γ, we have sn − rk > (1 + γ − pn) − (1 − 1 + β 2 + β 2+β . Since pn < 1 ) = γ − pn + 1 + β 2 + β > 1 + β 2 + β . Hence we can apply the bin-packing argument to derive a contradiction: by Lemma 4.4(2), with t1 = rk, t2 = sn, a = pj and b > 1 2+β , we have a contradiction. 4.3 Lower Bounding pn: Efficiency Argument Next we establish a lower bound on pn, applying the Leftover Lemma. First, observe that if n is never replaced, then n is pending from rn to sn, where rn ≤ 1 − pn; if n is replaced, then n is pending from rl to sn, where rl is the last time n is replaced. Since rl ≤ 1 − (1 + β) · pn < 1 − pn, in both cases n is pending during time period [1 − pn, sn). Hence we have the following fact. Fact 4.2 (Non-idle Period) Every t ∈ [1 − pn, sn) is non-idle. 11 As a warm-up, we show the following simple lower bound on pn using the Leftover Lemma. Lemma 4.7 (Simple Lower Bound) We have pn > 1 Proof: Let t = 1− pn. Since there is no waste after time 1, the total waste located after time t is W1 − Wt. Since no machine is idle during time [1− pn, sn), the total processing our algorithm does after time t is at least m(sn− t)− (W1− Wt). On the other hand, the total processing our algorithm does after time t is upper bounded by m(1 − t) + ∆t (Observation 3.1). Applying Lemma 1.1 (the Leftover Lemma) on ∆t, we have 3 − 2α. m(sn − t) < m(1 − t) + (W1 − Wt) + ∆t ≤ m(1 − t) + W1 + tm ≤ m(1 − t) + αm + 1 4 1 4 tm. Note that the last inequality follows since (by our replacement rule) each job j can only create a waste of size at most α · pj, and the total size of jobs is at most m. Thus we have ALG = sn + pn ≤ 1 + α + 1−pn which implies that (recall that we assume ALG > 1 + γ = 3 pn ≥ 4 3 · (ALG − 5 4 − α) > 4 3 · ( 3 2 −  − 5 where the last inequality holds by our choices of parameter, i.e.,  = 1 4 + α + 3 4 pn, 4 + pn = 5 2 − ) 4 − α) = 1 3 − 4 3 ( + α) > 1 3 − 2α, 20000 and α = 1 200 . Observe that the Leftover Lemma provides tighter upper bounds for smaller values of t. Thus in the above proof, if we can find a smaller t such that there is no (or very little) idle time from t to sn, then we can obtain a stronger lower bound on pn. Lemma 4.8 (Lower Bound on Last Job) We have pn > 1 2+β . Then by Corollary 4.1, we have pj > min{γ, pn} = pn Proof: Assume for contrary that pn ≤ 1 for all job j ∈ J(sn). Hence at least two jobs k, j ∈ J(sn)∪{n} are scheduled on the same machine in OPT, such that rk < 1 − 2pn. We prove the following claim3, which enables us to use a refined efficiency argument, i.e., apply the Leftover Lemma on a earlier time t = rk. For continuity of presentation, we defer its proof to the end of this subsection. Claim 4.1 The total idle time Isn − Irk during time period [rk, sn] is at most 3α · m. 2+β . By the above claim, the total processing ALG does after time t = rk is at least m(sn − t) − (W1 − Wt) − 3αm. On the other hand, by Observation 3.1 and Lemma 1.1 we have 4 tm + Wt. m(sn − t) − (W1 − Wt) − 3αm ≤ m(1 − t) + ∆t ≤ m(1 − t) + 1 Rearranging the inequality, we have (recall that t = rk < 1 − 2pn) 1 + γ < ALG = sn + pn ≤ 1 + 1−2pn which is a contradiction by our choice of parameters. 4 + 4α + pn ≤ 5 4 + 4α + β 2(2+β) , It remains to prove Claim 4.1. Proof of Claim 4.1: Recall that we assume 1 2+β , and there exist two jobs k, j ∈ J(sn) ∪ {n} (of size at least pn) scheduled on the same machine in OPT, such that rk < rj. Observe that sk − rk > (1 + γ − pn − pk)− (1− pk − pj) > γ. We first upper bound the total idle time in [rk, sk) by 3α · m, and then show that there is no idle time after time sk (until time sn). 3We remark that the proof of Claim 4.1 relies on the fact that pn is not too small. Hence Lemma 4.7 (the warm-up 3 − 2α < pn ≤ 1 lower bound) is necessary for achieving the improved lower bound (Lemma 4.8). 12 Lemma 4.9 The total idle time in [rk, sk] is at most 3α · m. Proof: As k is released at rk while (eventually) scheduled at sk, we know that if there is an idle period [a, b] ⊆ [rk, sk), then k must be processed during time period [a, b] and replaced after time b. Since k cannot be replaced if it is processed α, immediately we have b − a < α. Now consider any fixed machine M . Suppose a1 ≥ rk is the first time machine M becomes idle. We know that k is being processed on some other machine at time a1 (as no job is pending), and replaced at some rl < a1 + α. Then the job processed on M at time rl must be of size larger than pk, which implies that there is no idle period in [rl, a1 + pk]. By Fact 4.2, there is no idle time after 1 − pn < 2 machine M during time period [rk, sk) is at most (cid:100) 2 time in [rk, sk) (on all m machines) is at most 3α · m. pk 3 + 2α. Hence the number of idle periods on (cid:101) ≤ 3, which implies that the total idle 3 +2α Next we show that every time t ∈ (sk, sn) is non-idle. Suppose otherwise, let t ∈ (sk, sn) be the last idle time before sn. Since there is no pending job at time t, we know that n is either being processed at time t, or is not released. For the first case, since t < sn, we know that n is replaced after time t. Let rl be the last time n is replaced, we have rl ≤ 1 − pl < 1 − (1 + β)pn. Note that n is pending from rl to sn, which is of length sn − rl > (1 + γ − pn) − (1 − (1 + β)pn) > γ + β · pn. Since sk < t < rl, the total processing our algorithm does after time rk is m(sn − rl) + m(sk − rk) − 4α · m > m, contradicting OPT = 1. never replaced, i.e., n is pending from rn to sn, which is of length larger than γ. Now we consider the second case, i.e., sk < t < rn. By the same reasoning, we know that n is Recall that we have sk − rk > γ, and since k ∈ J(sn), we have pk > sn − rn > γ. Claim 4.2 We have rn − sk > 6α + 2 (by the efficiency argument). Proof: Assume the contrary that sn − rk ≤ 1 + 6α, we know that the total idle time after sk is at most rn − sk ≤ 1 + 6α − 2γ = 6α + 2. Then we have (by Observation 3.1, Lemma 1.1: ALG = sn + pn ≤ 1 + α + 1 4 ≤ 1 + 10α + 2 + ≤ 1 + (10α + rk + 3α + 6α + 2 + pn (1 − pn − γ) + pn 1 8 4(2 + β)  + 1 4 9 4 + 3 ) ≤ 1 + γ, contradicting our assumption that ALG > 1 + γ. On the other hand, we have the following contradicting claim. Claim 4.3 We have rn − sk < 6α + 2 (mainly by the bin-packing argument). Proof: Observe that k is processed from sk to sn. Hence we have pk ≥ sn − sk. If pk < 1 then we are done as rn − sk ≤ pk − (sn − rn) < 1 2 + 6α − γ = 6α + . argument similar to Lemma 4.4 to show that on every machine M , we can find Assume for contrary that rn − sk ≥ 6α + 2, we have pk ≥ 1 • either a job of size larger than 2 • a job a /∈ J(sn) of size pa > 1 3 + 2α, or 3 + 4α, and a job b ∈ J(sn) (of size pb > 1 3 − 2α), 2 + 6α. We apply an association 2 + 6α, 13 that are completed on M , and none of them is n. Let x ∈ J(sk) and y ∈ J(sn) be processed on M . By Lemma 4.1 we have px > γ > 1 3 + 4α and 3 − 2α. If x (cid:54)= y, then we are done with this machine, i.e., a is the first job completed py > pn > 1 after sk on M and b = y. Note that we have a (cid:54)= b as either a = x or a is a replacer, which cannot be processed at sn > 1. If x = y, then we are also done if px > 2 Now suppose px ≤ 2 3 + 2α. Since x is processed at sn > 1, we know that the job z processed 3 + 2α. 2 ) is pending during [rk, sk], we have before sx must be completed. Moreover, since k (of size > 1 pz ≥ (sn − rk) − px > 2γ + 6α + 2 − 2 3 − 2α = 1 3 + 4α. Hence we have found a = z and b = x completed on M and the association is completed. Thus in OPT (which completes all jobs before time 1), three jobs of size in ( 1 3 , as mini∈J(sn){pi} > pn. 3 + 4α) from J(sn) are scheduled on the same machine, which means that at least one of them, say x, is released before 6α < sk. Observe that we also have pn ≤ 1 Recall that t ∈ (sk, rn) is the last idle time before rn. As there is no pending jobs at time t, x must be processed at time t, but replaced later (as otherwise px > sn − rn > γ). Hence we know 3 − 2α), which implies that total idle time in [rk, sn] can be that t ≤ 1 − (1 + β)px < 1 − (1 + β)( 1 upper bounded by 3 − 2α, 1 (t − sk)m < 1 − (1 + β)( − 2α) − γ. 1 3 Hence we have the following contradiction: rk + (1 − (1 + β)( + (1 − (1 + β)( 1 3 where the second inequality holds since rk ≤ 1 − pk − pj ≤ 1 ALG = sn + pn ≤ 1 + α + 3 4 ≤ 1 + α + 2 − pn, and pn ≤ 1 3 . As the two claims are contradicting, there is no idle time during (sk, sn). − 2α) − γ) + pn 1 3 − 2α) − γ) ≤ 1 + γ, 1 4 · 1 3 + 1 4 · 1 2 4.4 A Hybrid Argument 1 We have shown that assuming ALG > 1 + γ, the size of the last job n can be bounded as 2+β < pn ≤ 1 2+α . In the remaining part of this section, we use a hybrid argument to show that we can either use the bin-packing argument to find a set of infeasible large jobs; or derive a contradiction using the efficiency argument. 1 2+β < pn ≤ 1 2+α < γ, we have sn = ALG − pn > 1. Thus we General Framework. Given that have sj (cid:54)= rj for all j ∈ J(sn) (as they are processed at time sn > 1). Moreover, by Corollary 4.1, 2+β . In other words, there exists a set J(sn)∪{n} of large we have minj∈J(sn){pj} > min{γ, pn} > 1 jobs, each of which is never replaced (by Corollary 4.2), and none of them is scheduled at its release time. We know that at least two of them, say k and j (assume k is released earlier), are scheduled on the same machine in OPT. Since sk − rk > (1 + γ − pn − pk) − (1 − pk − pj) ≥ γ, we know that k is pending from rk to sk, which is a period of length γ. Thus either our algorithm finishes a lot of processing during this period (then we can use the efficiency argument), or there are many idle and waste periods during this period (then we can use the bin-packing argument to find another m large jobs, e.g., larger than 1 3 ) . We first show that rk and sn cannot be too far apart. 14 Lemma 4.10 We have sn − rk ≤ 1. Proof: Assume for contrary that sn − rk > 1. We show that can apply the bin-packing argument to find a set of infeasible large jobs. We apply an association argument as in the proof of Lemma 4.4 to show that every machine is associated with either a job of size larger than 1+β 2+β , or two jobs of size larger than 1 2+β ) is not associated, which implies a contradiction. 2+β . Moreover, every job is associated at most once, while n (recall that pn > 1 Fix any machine M . Consider i ∈ J(rk) and x ∈ J(sn) processed on M . • If pi > 1 • if pi ≤ 1 since sn − rk > 1, we have i (cid:54)= x. 2+β , then we associate i and x (both of them cannot be replaced) to M . Observe that 2+β , we consider the job l processed on M after i. Since rk + pi < sk, we know that l 2+β and is completed on M . If l (cid:54)= x then we associate starts during (rk, sk), hence pl > pk > 1 l and x to M ; otherwise px > (sn − rk) − pi > 1+β 2+β and we can associate x to M . In both cases we can associate jobs to machines as claimed, which gives a contradiction. Lemma 4.10 immediately implies that the following stronger lower bound on pn. Note that the 3 (thus more convenient new lower bound 1 to use the bin-packing argument), while for the previous lower bound we have 2 − 3α is crucial in the sense that we have 2 − 3α) > 1 1+β ( 1 1 1 (2+β)(1+β) < 1 3 . Corollary 4.3 We have pn > 1 2 − 3α. Proof: If sk > rn, then we know that there is no idle time between rk and sn, as during this period, either k or n is pending. Hence by Observation 3.1, we have m(sn − rk) < m(1 − rk) + ∆rk + (W1 − Wrk ), which implies sn < 1 + 1 4 rk + α by the Leftover Lemma. Therefore, we have (recall that we have rk < 1 − pk − pn < 1 − 2pn) 1 4 − 3α) = 1 + ( ALG = sn + pn < 1 + α + (1 − 2pn) + pn ≤ 1 + α + ) ≤ 1 + γ, + ( 1 4 1 2 1 2 1 2 − α 2 contradicting our assumption that ALG > 1 + γ. If sk < rn, then we have pk > sn − rn > γ (recall that pk is processed at time sn). By Lemma 4.10, the total idle time between sk and rn is at most (1 − 2γ)m = 2m. Then by the Leftover Lemma, ALG = sn + pn < 1 + α + 1 4 (1 − γ − pn) + pn + 2 ≤ 3 2 − 1 4 (5α − 9) ≤ 1 + γ, which is also a contradiction. 2 − 3α is still less than 1 1 Unfortunately, 1 2 − 3α < pn ≤ 1 and [rn, sn], both of length at least γ, and contain no idle time. 2+α . Hence it remains to consider the subtle case when 2+α . Note that so far we have proved that there exists two periods, namely [rk, sk] From the proof of Corollary 4.3, we observe that depending on whether the two intervals overlap, the analysis can be quite different. Hence we divide the discussion into two parts. As we will show later, the central of the analysis is to give strong upper bounds on W1. 4.4.1 Overlapping Case: when sk ≥ rn Note that in this case, from rk to sn, the largest pending job is always at least pn. Hence there is no idle time in [rk, sn]. Moreover, every job that starts in [rk, sn] must be larger than pn (and hence cannot be replaced). First we show that rk ≥ αpk. 15 Suppose otherwise, then by Lemma 4.2, we have pi > 1 we can apply Lemma 4.4(1) with t1 = rk, t2 = sn, a > 1 1+β ( 1 2 − 3α) > 1 3 and b > pn > 1 3 for all i ∈ J(rk). Hence 2 − 3α > 2 3(1+β) , for which t2 − t1 = sn − rk > (1 + γ − pn) − (1 − pk − pj) > γ + pn > 2 3 , to derive a contradiction. Lemma 4.11 There exists a time r ≤ rk, at which the minimum job processed has been processed at least α · pk; moreover, from r to sn, the largest pending job is always at least pn. If k is the largest pending job at rk, then let x be the job of minimum size processed at Proof: time rk, i.e., x = arg minj∈J(rk){pj}. For the same reason as argued above, we have px ≤ 1 1+β . Since k does not replace x, we conclude that x must be processed at least αpk. Hence the corollary holds with r = rk. Otherwise we consider the earliest time r before rk such that from r to rk, the largest pending job is always at least pk. Note that we must have r = rk(cid:48) for some job k(cid:48) of size pk(cid:48) > pk. Moreover, k(cid:48) is the largest pending job at rk(cid:48), but not scheduled. Let x = arg minj∈J(rk(cid:48) ){pj}. We have px ≤ 1 3 > 1− pk − pj is a contradiction. Hence by a similar argument as above, the corollary holds with r = rk(cid:48). 3 , as otherwise rk > 1 3 < pk By the above lemma, every job that starts in [r, sn] must be larger than pn > 1 2+β , which cannot be replaced. Thus, from r to sn, there is no idle time, and if there is any waste, then it must come from the jobs in J(r). the following upper bound on W − P. Let P be the total processing our algorithm does after time sn, and let W = W1. We show that Lemma 4.12 (Total Waste) We have W − P ≤ 2α · rm + 1 2 + β (rm − Ar − Ir). We first show how to use Lemma 4.12 to prove the desired competitive ratio, and defer the proof of lemma (which is long and contains many cases) to Section 5. Corollary 4.4 When sk ≥ rn, we have ALG ≤ 1 + γ. Proof: First by Observation 3.1, we have (since there is no idle time after r) m(sn − r) + P − (W − Wr) ≤ m(1 − r) + ∆r, which (by Lemma 4.12) implies sn ≤ 1 + (W − P + ∆r − Wr) ≤ 1 + 2α · r + 1 m r 2 + β + 1 m (∆r − Wr − Ar + Ir 2 + β ). (Leftover Lemma) and ∆r − Wr ≤ min{Ar, Ir} (Claim 3.1), we have Since ∆r − Wr ≤ rm 4 sn ≤ 1 + 2αr + r 2 + β Given α = 1 200 and β = 2 min{Ar, Ir} − (Ar + Ir) 1 + ( m √ 2 − 1, it is easy to check that 2α + 4+β 2 + β 2 + β + β ) ≤ 1 + (2α + 4 + β 4(2 + β) )r. 2.14 . Hence we have rm 4 4(2+β) < 1 0.14 ALG = sn + pn ≤ 1 + 1 + where in the second inequality we use the fact that r ≤ rk < 1 − 2pn. (r + 2pn) + 2.14 2.14 pn ≤ 1 + 1 0.14 2.14 ≤ 1 + γ, 2.14(2 + α) 16 4.4.2 Disjoint Case: when sk < rn Note that in this case we have two disjoint time periods, namely [rk, sk] and [rn, sn], both of length at least γ, and during which there is a pending job of size at least pn. Moreover, by Lemma 4.10, we have rn − sk ≤ 1 − 2γ = 2. Lemma 4.13 We have minj∈J(rn){pj} > 1 3 . Proof: Let x be the minimum job in J(rn). Suppose px ≤ 1 1+β . Then we have sx(rn) > sk, which means that x is processed at most rn − sk < αpn. Hence we know that n is not the largest pending job at rn, as otherwise x would be replaced. 3 < pn Then we consider the first job i of size pi > pn that is released in [sx(rn), rn] and not scheduled. Since x is the largest pending job at sx(rn), we know that i must be the largest pending job at ri. We also know that minj∈J(ri){pi} ≤ px < pi 1+β , and the minimum job y has been processed less than αpi, which is impossible as i should have replaced y. Let P be the total processing our algorithm does after time rn + γ, and let W = W1. We show the following lemma, which is an analogy (weaker) version of Lemma 4.12 in previous section. Lemma 4.14 (Total Waste) We have W − (Wrn − Wsk ) − P ≤ ( 1 2 + α) · rk · m + 8α2m. For continuity of presentation, we defer its proof to Section 5. Lemma 4.15 When sk < rn, we have ALG ≤ 1 + γ. Proof: Since there is no idle time in [rk, sk] ∪ [rn, sn], by Observation 3.1, we have m(1 − rk) ≥ 2γm + P − (W − (Wrn − Wsk )) ≥ (1 − 2)m − ( + α) · rk · m + 8α2m, 1 2 which implies rk ≤ 2+8α2 2−α 1 < αpk, contradicting the assumption rk ≥ αpk. 5 Bounding Total Waste In this section, we prove Lemma 4.12 and 4.14, which give upper bounds on the total waste W. Proof of Lemma 4.12: We upper bound the total waste by partitioning it into four parts. only be scheduled after sn. Hence this part of wastes can be upper bounded by(cid:80) If any job i ∈ J(r) is replaced, then pi ≤ 1 Part-1: wastes created after r. 2+β and hence can i∈J(r):si>sn pi. Part-2: wastes created by jobs never processed from r to sn. As sn − r > 1− r, the total processing time of jobs that are never processed in [r, sn] is at most r · m. Hence the total waste created by these jobs is at most α · r · m. Note that excluding Part-1 and Part-2, the wastes created by jobs that are ever scheduled 2+β and will not be from r to sn can only be created by jobs in J(r), as other jobs are larger than 1 replaced (hence cannot be a replacer before r). 17 Part-3: wastes created by i ∈ J(r) at ri < si(r). As i is processed at r, we know that i is replaced during [ri, si(r)], and rescheduled at si(r). Note that the waste is at most α · pi, since it is replaced by i. Consider the job completed at si(r), by Lemma 4.3 we know that it is larger than pi. Thus we can construct a one to one mapping from this kind of wastes to jobs completed before r. Moreover, each waste is bounded by α fraction of its image. Hence the total waste of this part is at most α · r · m. Part-4: wastes created by i ∈ J(r) at ri = si(r). We will show that this part of wastes can 2+β (rm− Ar − Ir). Let t be the last idle time before r. We be upper bounded by(cid:80) have Ar = At =(cid:80) i /∈J(r):si>sn pi + 1 u∈J(t) min{δu, pu}, where δu is the total pending time of u before time t. Consider any waste (of size) w created by i ∈ J(r) at time ri = si(r) on machine M . We interpret the waste as the time period [ri − w, ri] on M . In the following, we charge the waste to a job of size at least w that is not in J(r) and starts after sn, or to a set of time periods of total length at least (2 + β)w located before r. We show that (over all wastes) every job and time period will be charged at most once, and none of them overlaps with the idle periods. Moreover, we show that on every machine M(cid:48), we can find a non-idle time period before r of length at least min{δu, pu} that is not charged, where u ∈ J(t) is the job processed on M(cid:48). (It is easy to check whether the charged time period overlap with the idle periods. However, it is more involved to check the disjointness with pending periods, which is the main focus of our charging argument.) Note that such a charging argument gives an upper bound(cid:80) 2+β (rm − Ar − Ir) on l /∈J(r):sl>sn pl + 1 the total wasted in this part. px ≤ 1 argument. Let x be the minimum job in J(r), and y be the job where w comes from. Recall that we have 3 and x is processed at least α · pk, i.e., rx = sx(r) ≤ r − α · pk. Now we present our charging 1. If r − ri ≥ (1 + β)w, then we can charge w to itself, together with the time period [ri, r] on machine M . It is easy to see that the charged periods are of total length at least (2 + β)w, and disjoint from the idle periods. Define u(M ) ∈ J(t) as the job processed on M at the last marginal idle time before time r. If u = i, then since su(t) = ru, we have δu = 0; otherwise su(t) ≤ ri − w and δu is at most the total length of non-idle periods before ri − w. In both cases we find a non-idle time period, namely Tu(M(cid:48)), of length at least δu that is not charged. 2. If py < px (which implies y /∈ J(r)) and sy > sn, then let w(cid:48) be the first waste from y that has not been charged. We charge w(cid:48) to py > w(cid:48) (processed after sn), and charge the remaining wastes from y, which is of total size at most (1 + β)w(cid:48), to themselves, w(cid:48), and the processing (before r) of the job that creates w(cid:48). Note that the charged periods are of total length at least (3 + 2β)w(cid:48) > (2 + β)(1 + β)w(cid:48), and disjoint from the idle periods. Since every charged period is either processing of jobs in J(r), or the wastes they create, applying the same argument as above, on every machine M(cid:48) that has a charged waste, we can find a non-idle time period of length at least δu(M(cid:48)) that is not charged. 18 sypysnw'r 3. If py < px and sy < sn, then we know that y is rescheduled (say, on machine M(cid:48)) after ri, and completed before r. Hence we have r − ri > py > w. Moreover, by Lemma 4.3, the job z completed at sy on M(cid:48) must be larger than py. We charge w to w, [ri, r] on machine M , and [sy, cy] on machine M(cid:48). The total length of charged periods is at least w + 2py > 3w. As before, a non-charged non-idle time period of length δu(M ) can be found on M . Now consider u(M(cid:48)). • If pz > pu(M(cid:48)), then [sz, cz] is the desired non-charged non-idle time on M(cid:48); • otherwise we know that u(M(cid:48)) is not pending during [sy, cy], as y is smaller than u(M(cid:48)) but is scheduled and completed. Hence Tu(M(cid:48)) is the desired period on M(cid:48). 4. If py > px, then we know that ri < sx(r) ≤ r − αpk, as otherwise x would be replaced instead of y. Moreover, the next time y is scheduled (say, on machine M(cid:48)) must be before sx(r), as x cannot be scheduled while y is pending, and we have pz > py for the job z completed before y on M(cid:48). We charge w to w, [ri, r] on M , and [sz, ri] on M(cid:48). The charged periods are of total length w + r − sz > w + pz + αpk > (2 + β)w, and are disjoint from idle periods. As before, a size δu(M ) non-charged non-idle time period can be found on M . Now consider u(M(cid:48)). • If [sz, ri] ∩ Tu(M(cid:48)) = ∅, then Tu(M(cid:48)) is the desired period; • otherwise we know that u(M(cid:48)) (cid:54)= z. Moreover, u(M(cid:48)) (cid:54)= y, as y is not pending during [sz, ri], which means that u(M(cid:48)) is a job processed after y. First observe that y cannot be replaced after cz, as otherwise the replacer l must be of size larger than (1 + β)py > (1 + β)w > r − ri, which implies δu(M(cid:48)) = 0: either uM(cid:48) is the replacer, or the replacer of the replacer, etc. Hence [cz, cy] is the desired non-charged non-idle period on M(cid:48): we have py > pu(M(cid:48)) (if uM(cid:48) is ever replaced, then we use Lemma 4.3, otherwise we use the fact that uM(cid:48) is pending at cz). Combing the four cases above, we have W ≤ (cid:88) i:si>sn pi + 2α · rm + 1 2 + β (rm − Ar − Ir) < P + 2α · rm + 1 2 + β (rm − Ar − Ir), 19 M'Mcyszsyripipzpywr≥αpkpxsx(r)M'Mszczripipzpywr j /∈J(rk):sj >sn Define P(cid:48) =(cid:80) as claimed. Proof of Lemma 4.14: Note that W− (Wrn − Wsk ) is the total wastes located at [0, sk]∪ [rn, sn]. pj to be the total processing of jobs not processed at rk that start after sn. We show that Wrk (rk) − P(cid:48) ≤ ( 1 2 + 2α) · rk · m and (W − Wrn) + (Wsk − Wrk (rk)) ≤ P − P(cid:48), combing the two upper bounds we have the lemma. We first show that (W− Wrn) + (Wsk − Wrk (rk)) ≤ P− P(cid:48). Note that by definition (W− Wrn) + (Wsk − Wrk (rk)) is at most the total size of wastes created in [rk, sk] ∪ [rn, sn]. Moreover, any such waste w must come from jobs in J(rk)∪ J(rn)\(J(sk)∪ J(sn)), as otherwise the job is irreplaceable. Consider any i ∈ J(rn)\(J(sk)∪J(sn)) processed on machine M . Let x ∈ J(sn) be processed on 3 . Hence we have cx−(rn +γ) > 3 −  − 3α > 2α, i.e., the contribution of i to P − P(cid:48) is larger than to Moreover, we have J(rn)\(J(sk) ∪ J(sn)) ≤ 4αm, as otherwise the total processing after rk is 3 − − 3α)m− αm > m, contradicting OPT = 1. This fact will be used later. Now consider any i ∈ J(rk)\(J(rn) ∪ J(sk) ∪ J(sn)). Then we have si > sn. Hence the 2 + α) · rk · m + 9α2m. The strategy is similar to the proof of Next we show that Wrk − P(cid:48) ≤ ( 1 M , then we know that the job completed at sx must be larger than 1 (sk + 1 (W − Wrn) + (Wsk − Wrk (rk)) (note that i can be replaced at most twice). larger than 2γm + 4α( 1 contribution of i to P − P(cid:48) is larger than to (W − Wrn) + (Wsk − Wrk (rk)). 3 + px) − (rn + γ) > 1 job at ri. We show that(cid:80) Lemma 4.12 (but simpler). We partition Wrk into three parts. Part-1: wastes created by J(rk). Let R be the set of jobs i /∈ J(rk) that replaced some other i∈R pj ≤ 4αm, which implies that the total wastes created by jobs not in J(rk) is at most 4α2m. It suffices to show that on every machine M , we can find a set of jobs completed on M that are of total size at least 1 − 4α and not in R. Fix any machine M and consider j1 ∈ J(sk) and j2 ∈ J(sn) processed on M . Note that we have pj1 > γ, pj2 > pn, and both jobs cannot be replaced. If j1 (cid:54)= j2, then we find two jobs completed on M of total size larger than γ + pn > 1 − 4α that are not in R; otherwise we know that j1 did not replace any job (as it is processed at sn > 1). Then we know that the total size of j1 and the job completed at sj1 is larger than (sn − sk) + min{sk − rk, γ} > 1 − 4α, which completes the analysis. Part-2: wastes created by i ∈ J(rk) at ri < si(rk). Applying a similar argument as in the proof of Lemma 4.12 (Part-3), the total waste of this part can be upper bounded by α · rk · m. Part-3: wastes created by i ∈ J(rk) at ri = si(rk). Note that there is at most one waste on every machine. Consider any waste of size w created at ri on machine M . Suppose w comes from job x. 2 , then we can charge w to machine M ; • If w ≤ rk • if x ∈ J(rk), then we can charge w to M and the machine that processes x at rk; • if sx > sn, then the contribution of x to Wrk − P(cid:48) is non-positive; • otherwise we have x ∈ J(rn)\(J(sk) ∪ J(sn)). As J(rn)\(J(sk) ∪ J(sn)) ≤ 4αm, the total waste of this part is at most 4α2m. Hence in total we have as claimed. Wrk − P(cid:48) ≤ 4α2m + α · rk · m + · rk · m + 4α2m, 1 2 20 6 Breaking 5−√ 2 5 on Two machines with Restart We prove Theorem 1.2 in this section, that is, we show that running our algorithm with β = α = 0.2 on two machines, i.e., m = 2, achieves a competitive ratio at most 1.38, strictly better than the 5) ≈ 1.382 for the problem without restart on two machines best possible competitive ratio 1 (for deterministic algorithms) Noga and Seiden [2001]. 2 (5−√ As before, we adopt the minimum counter-example assumption Noga and Seiden [2001], i.e., we consider the instance with the minimum number of jobs such that ALG > 1.38 and OPT = 1, and proceed to derive a contradiction. 6.1 Overview of Techniques Our analysis for the two-machine case follows the same framework as the general case: we use a bin-packing argument to upper bound the size of last job, and use an efficiency argument to lower bound the size of last job, and finally use a hybrid argument to handle the boundary case. In this section, we will overview two technical ingredients that are specifically developed for the two- machine case, namely, a structural result that upper bounds the number of times that large jobs are replaced, and a refined efficiency argument. Similar to the general case, most of the difficulties arise when the last job has medium size. For concreteness, readers may consider the size of the last job n as slightly larger than γ = 0.38, say, pn = 0.4. Recall that for the two-machine case we fix the parameters β = α = 0.2. 6.1.1 Bounding Major Replacements We are interested in jobs that have size at least pn. We call such jobs major jobs and refer to the replacements of major jobs as major replacements. In the case that there are only two machines, the number of major jobs is at most 4 by a simple bin-packing argument. (Recall that we focus on medium size last job, say pn = 0.4.) Further, only major jobs can replace major jobs. Hence, we can show sharp bound on the number of major replacements. In particular, we show that when the last job is of medium size, there is either no major replacement, or at most one major replacement, depending on the size of the last job. This is formulated as the following lemmas. Lemma 6.1 If ALG > 1.38 and pn > 1 2+α , then there is no major replacement. Proof: Recall that for the two machines case, we set β = α. First we show that job n cannot be replaced given pn > 1 2+α , which cannot be scheduled on the same machine with n in the optimal schedule. Suppose n is replaced (which can happen at most once) by l. Then we know that n is pending from rl to sn, where 2+α . Observe that the replacer of n must be of size (1 + α)pn > 1− 1 sn − rl > (1.38 − pn) − (1 − (1 + α)pn) = 0.38 + αpn > 1 2 + α . Hence by Lemma 4.1, we have pk, pj > 1 2+α , where {k, j} = J(sn) are the two jobs processed If l /∈ {k, j}, then none of k, j, n can be scheduled on the same machine with l in at time sn. OPT, which yields a contradiction; otherwise suppose l = k. Then we must have J(rl) = {n, j} as otherwise we also have the same contradiction as just argued. Then n and j must be scheduled on the same machine in OPT. If rn < rj, then rn < 1 − pn − pj < 1 − 2 2+α < αpn. Hence n must be scheduled at rn, as otherwise by Lemma 4.2 the two jobs in J(rn) are of size larger than pn 1+α > 1 3 . Since rl − rn > sj − rn > (1.38 − pn − pj) − (1 − pn − pj) = 0.38 > α, 21 it is impossible for l to replace n as n has been processed a portion larger than α. If rj < rn, then for the same reasoning j is scheduled at rj. As sj − rj > (1.38 − pn − pj) − (1 − pn − pj) = 0.38, we know that j is replaced, which is impossible as by Lemma 4.3, the job completed at sj is a job of size larger than 1 Hence we know that n is never replaced. Now suppose some other job of size larger than 1 2+α , apart from l, j and n. 2+α is replaced at time rx. Then we have px > 1− 1 2+α , while the two jobs in J(rx) are of size larger than 1 2+α . Note that since n is never replaced, it is not scheduled before sn. Further by our assumption that no job arrives after sn, we have rx < sn. Thus n /∈ J(rx), which implies a contradiction. Lemma 6.2 If ALG > 1.38 and pn ∈ (0.38, 1 2+α ], then there is at most one major replacement. The proof of the lemma is deferred to Section 6.3. The main idea is that, when there are two or more major replacements, then we can find at least four major jobs. Hence as long as we can find a job of size "not too small", then the bin-packing argument yields a contradiction. Why is bounding the number of major replacements useful? Recall that in the efficiency argument, we upper bound the total waste by αm = 2α using the fact that each job can only create waste once at its release time if it replaces some other job, and the amount of waste created is at most α times the size of the replacer. Suppose we can find one major job that does not replace any other job at its arrival. Then, the upper bound of the total waste will significantly decrease by αpn. (Recall that we focus on medium size last job, say pn = 0.4.) How do we find major jobs that do not replace other jobs at their arrival? It turns out we can argue that in order to have ALG > 1 + γ, there must exists some major jobs whose final start times do not equal their release times. For example, the last job n's final start time definitely does not equal its release time. For each of these jobs, if it replaces some other job at its arrival, it must be replaced later on in order to get rescheduled at its final start time. Hence, a major replacement must occur for each of these jobs. By bounding the number of major replacements, we get that some of these major jobs must not replace other jobs at their arrivals. 6.1.2 Refined Efficiency Argument The second technical ingredient is a more careful efficiency argument. Let t be the last idle time before sn. The total amount of work done in the optimal schedule after time t is at most 2(1 − t). (Recall that OPT = 1 and there are m = 2 machines.) How much work does the algorithm process after time t? The algorithm is fully occupied from time t to time sn. Further, let P be the total processing our algorithm does after sn. Then, the total amount of processing power after time t by the algorithm is 2(sn − t) + P. However, some of the processing power is wasted (due to replacements) and some of the workload could have been done before time t in OPT (the leftover). Recall that Wt is the amount of waste before time t. Hence, the amount of waste located after time t is W1 − Wt. Also recall that the amount of leftover is denoted as ∆t. So we have: (the first inequality comes from Observation 3.1) 2(1 − t) ≥ 2(sn − t) + P − ∆t − (W1 − Wt) ≥ 2(sn − t) + P − t 2 − W1, where the second inequality follows by the leftover lemma. Rearranging terms, the above implies: ALG = sn + pn ≤ 1 + pn − P 2 + t 4 + W1 2 . 22 Then, we will bound each of the terms P, t, and W1: P is trivially lower bounded by pn; t is trivially upper bounded by 1, while a more careful argument shows that t ≤ 1 − pn (Fact 4.2); and W1 is trivially upper bounded by 2α. If we plug in the trivial bounds, we get: ALG ≤ 1.25 + α + pn 2 . Hence, we recover the efficiency argument similar to what we have used in Section 4.1 (except that m pn ≤ pn in the general case). However, if we can obtain improved bounds on we further relax m−1 P, t, or W1, we would have a better efficiency argument for upper bounding ALG. It is usually impossible to get better bounds for all of these three quantities. Nonetheless, we manage to do so for at least one of them in all cases. We have already provided an argument for getting a better upper bound of W1 by bounding the number of major replacements. Next, we present some intuitions why it is possible to get improved bounds for P and t. Since the jobs are scheduled greedily, if a replaced job x is of size smaller than pn, then it often happens that job x is rescheduled after sn. Hence while we suffer a loss in the total waste W1 due to the waste that comes from x, we have an extra gain of px in P. In general, we will develop a unified upper bound on W1 − P (using the same spirit as in the proof of Lemma 4.12 and 4.14), which measures the net waste due to replacements. Apart from the trivial upper bound 1 − pn on t (by Fact 4.2), we can often derive better upper bounds on t if we do not have a good upper bound on W1 − P. In the case when the total net waste is large, we can usually find many major jobs processed at the end of the schedule. As we have only m = 2 machines, during idle periods, only one job can be processed while no job is pending. Suppose we find four major jobs processed at the end of the schedule, then at least three of them must be released after the last idle time t. Since OPT = 1, we must have t ≤ 1 − 2pn, which gives a better upper bound on t. 6.2 Some Basic Facts for Scheduling on Two Machines As before, let n be the job completed last and we assume all release times, processing times, start times and completion times are distinct. By the minimum counter-example assumption, no job arrives after time sn. Since ALG = sn + pn > 1.38, we have sn − rn > (1.38− pn)− (1− pn) = 0.38. Let J(sn) = {k, j} be the two jobs processed before n is scheduled. By Lemma 4.1, we have pk, pj > min{0.38, pn}. Let t be the last idle time before sn. By Fact 4.2, we have t ≤ 1 − pn. Let P be the total processing our algorithm does after sn. By Observation 3.1, we have (note that m = 2) 2(1 − t) ≥ 2(sn − t) + P − ∆t − (W1 − Wt) ≥ 2(sn − t) + P − t 2 − W1, which implies ALG = sn + pn ≤ 1 + pn − P 2 + t 4 + W1 2 . (1) Definition 6.1 (Uncharged Jobs) We call a job j uncharged, if j does not replace any job at rj, or the job it replaces is rescheduled strictly after sn. Note that if a job j is uncharged, then its contribution to the RHS of (1) is non-positive. Let Q be the total size of uncharged jobs, and define d := 1 − pn − t ≥ 0, we have ALG = sn + pn ≤ 1 + 3pn 4 − (cid:101)P 2 1 − d 4 + α 2 + (2 − Q) = 1.45 − ( Q 10 + 23 2(cid:101)P + d − 3pn 4 ), (2) j:sj∈[sn−pj sn] max{cj − sn, 0} is the total processing our algorithm does after sn, ≥ 0.07, 10 + 2(cid:101)P+d−3pn excluding the jobs start strictly after sn. Hence as long as we can show that Q we have ALG ≤ 1.45 − 0.07 = 1.38, contradicting our initial assumption. 4 where (cid:101)P = (cid:80) Observe that since (cid:101)P ≥ pn, we always have 2(cid:101)P + d − 3pn Q 10 + ≥ Q 10 + d − pn 4 . 4 Observation 6.1 (Bin-packing Constraint) It is impossible to find a set of jobs whose sizes cannot be packed into two bins of size 1. For example, if we can find five jobs or size larger than 1 3 , or three jobs of size larger than 1 2 , then we have the contradiction that OPT > 1. Similarly, it is impossible to have three jobs of size at least p > 1 3 , and another job of size larger than 1 − p. 2+α in this section. As it will be convenient for future analysis, we first rule 6.3 Upper Bounding Last Job We show that pn ≤ 1 out the case when pn > 1+α 2 . Lemma 6.3 We have pn ≤ 1+α 2 . Proof: Assume the contrary that pn > 1+α OPT = 1 (Observation 6.1). 2 . We show that min{pk, pj, pn} > 1 Suppose pk = min{pk, pj, pn} ≤ 1 2 , which contradicts 2 , then we have sk ≤ rn. We show that sj > rn, which implies pj > pn. Suppose otherwise, then k is the minimum job processed at time rn. As pk < pn 1+α and rn − sk ≤ 0.5 − 0.38 = 0.12 < αpn, k should have been replaced by n (note that n must be the largest pending job at rn, if sj ≤ rn). Hence we know that at sk, both n and j are not released, which gives rk ≤ sk < min{rn, rj}. As k must be scheduled with one of j, n on the same machine in OPT, we have sk − rk > (1.38 − pn − pk) − (1 − pk − pn) = 0.38. Hence by Lemma 4.1, the two jobs in J(sk) are of size larger than min{sk − rk, pk} ≥ 0.38, which by Observation 6.1 also contradicts OPT = 1. Lemma 6.4 We have pn ≤ 1+α 2 . Proof: Assume for contrary that pn > 1 2+α . Recall from Lemma 6.1 that under this assumption, any job of size larger than 1 2+α (including n) cannot be replaced. Hence n is pending from rn to sn, and is uncharged. Recall that we have pk, pj > 0.38 for k, j ∈ J(sn). We first show that if n is scheduled with one of k, j on the same machine in OPT, then n is not the one released earlier. Suppose otherwise, then we have sn − rn ≥ (1.38 − pn) − (1 − pn − 0.38) = 0.76, which implies min{pk, pj} > min{sn − rn, pn} > pn. Hence both k and j cannot be replaced. Moreover, we have rn < 1 − 2pn, which gives d > pn. Suppose sk > sj, then k is not charged: either sk (cid:54)= rk, or the 4 ≥ 0.2pn ≥ 0.09, which implies job replaced by k is rescheduled after sn. Then we have Q ALG ≤ 1.38, a contradiction. 10 + d−pn We show that min{pk, pj} < 1 2+α . Suppose otherwise, then k, j, n are all of size lager than 1 2+α . Hence one of them, suppose k, is scheduled before one of j, n on the same machine in OPT, which 2+α ≤ αpk. Since sk (cid:54)= rk, by Lemma 4.2, the two jobs in J(rk) are both of size implies rk < 1 − 2 larger than 1 3 . Hence there exist five jobs of size larger than 1 2+α . Hence we have rj ≤ sj < min{rk, rn}, which implies sj − rj > (1.38− pn− pj)− (1− pj − pn) = 0.38. Next we show that sk ≤ rn and sj ≤ rn. Suppose sk > rn, then we have pk > pn and pj < 1 3 . Moreover, we have j /∈ J(rk), as otherwise pj > sn − rk > 2 3 , contradicting OPT = 1. 24 Thus the two jobs in J(sj) (note that k, j, n /∈ J(sn)) are both of size larger than 0.38, which contradicts OPT = 1. Hence we know that both k and j starts before rn. Moreover, we know that n is the largest pending job at time rn, which implies min{pk, pj} ≥ min{0.38 + αpn, pn 1+α} = pn 1+α . We proceed to show that k, j are never replaced. Observe that by Lemma 4.3 at most one of k, j is ever replaced. Suppose k is replaced and x is the job completed at sk. Then as we already have four jobs (x, k, j, n) of size larger than 0.38, k can only be replaced by one of x and j, while the other job is being processed while k is replaced. Hence k can only be replaced by j, as otherwise j is of size pj > sn− rx > (sn− rn) + (cx− rx) > 0.38 + (1 + α)pn, which cannot be scheduled on the same machine with any of x, k, n in OPT. However, if j replaces k (at rj = sj), then we have pj > (1 + α)pk > pn. First observe that j cannot be schedule with n on the same machine in OPT, as sj = rj < rn, and sj + pj + pn > 1.38. Hence j must be scheduled with one of k and x on the same machine in OPT. Figure 2: Case when j replaces k, when x is being processed. Note that as we already have px > pk > 0.38, and pj > pn > 1 2+α , any other job must have size strictly smaller than 1 − 0.38 − 1 2+α = 0.166. If j is scheduled with k, then we have pn 1 + α sk(rj) − rk > sj − αpj − rk > (1.38 − pn − pj) − αpj − (1 − pk − pj) ≥0.38 − pn − αpj + ≥ 0.38 − 0.2 × (1 − 0.38) − (1 − 0.2 1.2 × 0.6) = 0.156, which implies that the job completed at sk(rj) is of size at least min{0.156 + αpk, pk k is the largest pending job at rk, but not scheduled. Then we have a contradiction. k is released before n), we have rk ≤ 1 − pk − pn. 1+α} > 0.2, as If j is scheduled with x in OPT, then we have rx ≤ 1 − px − pj. As k is scheduled with n (and • If sx (cid:54)= rx, then x is uncharged. As sk(rj) − rk > (1.38 − pn − pj) − αpj − (1 − pk − pn) > 0.38 + pk − (1 + α)pn > 0, we know that k is uncharged. Moreover, there is no idle time after max{rx, rk} < 1 − pn − 0.38, as at most one job is processed at idle time. Hence d > 0.38, which implies Q • If sx = rx (refer to Figure 2), then we have pk+pn ≥ (sn−cx)+pn > 1.38−((1−px−pj)+px) = 10 + d−pn 1+α ) − 1 4 ≥ ( 1 4 )pn + 0.38 4 > 0.095. 10 (1 + 2 0.38 + pj. Hence we have sk(rj) − rk > (1.38 − pj − pn) − αpj − (1 − 0.38 − pj) ≥ 0.76 − pn − αpj ≥ 0.76 − pn − α(1 − pn 1 + α ≥ 0.76 − (1 − α 1 + α − α > 0.1, 1 + α 2 + α ) ) where we use pn ≤ 1+α larger than min{0.1 + αpk, pk 2+α as otherwise pk > 1 2+α . Hence the job completed at sk(rj) is of size 1+α} > 0.176, which is also a contradiction. 25 sj = rjkpxpjpksx = rxsksnpnALG > 1.38 1+α . Hence we have d = 1 − pn − t ≥ 1−α Hence we conclude that none of k, j is ever replaced. Assume sk < sj. If j is scheduled on the same machine before one of k, n in OPT, then j is uncharged, and there is no idle time after rj ≤ 1 − 2pn 1+α pn. We show that k is also uncharged: if k is charged, for the job x replaced by k must be rescheduled before sj. Let y be the job completed at sx. Then we have py > px > pj > 0.38, contradicting OPT = 1. Hence we have 10 + d−pn Q Otherwise k is scheduled before one of j, n in OPT, and k is pending from rk to sk. Let J(sk) = {x, y}. Note that k, j, n /∈ J(sk). If k is scheduled on the same machine with n in OPT, then sk−rk > (1.38−pn−pk)−(1−pk−pn) > 0.38, which (by Lemma 4.1) implies px, py > 0.38 and contradicts OPT = 1; if k is scheduled with j, then sk−rk > (1.38−pn−pk)−(1−pk− pn 1+α ) > 0.28. Hence px, py > 0.28 > max{1 − 2 × 0.38, 1 1+α − 1)pn ≥ 0.083, which implies ALG < 1.38. 4 ( 1−α 2 (1 − pn)}, which also contradicts OPT = 1. 4 ≥ 1 10 (1 + 2 1+α )pn + 1 6.4 Medium Last Job In this section, we show that if pn > 0.38, then jobs of size larger than 0.38 are "almost irreplaceable" (Lemma 6.5). We prove the following lemma, which is stronger than the one claimed in Section 6.1. Different from Section 6.1, here we call a replacement major if the job replaced is of size larger than 0.38. Lemma 6.5 If pn ∈ (0.38, Proof: Suppose there are two major replacements. 1 2+α ], then there is at most one major replacement. Consider the first major replacement. Let z be the replacer, J(rz) = {x, y} and x be the job replaced. Then we have py > px > 0.38, and pz > (1 + α)0.38 = 0.456. Let l be the replacer in the second major replacement. Then we know that the job replaced by l must be one of x, y, z. Observe that n ∈ {x, y}, since we have min{pz, pl} > 0.456 > 1 2+α , and it is impossible to have five jobs of size larger than 0.38. We first show that l and z cannot be scheduled on the same machine in OPT. Suppose otherwise, then we have rz + pz + pl ≤ 1 (as rz < rl). Hence the job replaced by l is not z, as otherwise pz + pl > ((1 + α)2 + (1 + α))0.38 > 1; the job replaced by l is not x, as otherwise y is completed at sx(rl) and n = x, which gives rz + pz + pl > rz + pz + px ≥ ALG > 1.38. Thus y is replaced by l, which gives pl ≥ (1 + α)py. However, since rz + pz + px + py > 1.38, we have rz + pz + pl > (rz + pz + px + py) + αpy − px > 1.38 + α · 0.38 − 1 − (1 + α) · 0.38 1 + α > 1, which is also a contradiction. and l, any other job must be of size less than 1 − (2 + α) · 0.38 = 0.164 < 0.38 y are released before z and l, we have rx ≤ 1 − px − min{pz, pl} and ry ≤ 1 − py − min{pz, pl}. As l and z cannot be scheduled on the same machine in OPT, we know that apart from x, y, z 1+α . Moreover, as x and Depending on which job is replaced by l, we divide our analysis into three cases. Case-1: x is replaced. n = x, which is scheduled after z or l. As rz − sn(rz) ≤ αpz, we have sn(rz) − rn > (1.38 − pn − pz) − αpz − (1 − pn − min{pz, pl}) If x is replaced by l, then we know that y is completed at sx(rl). Hence = 0.38 + min{pz, pl} − (1 + α)pz > 2.2 × 0.38 − 1.2 × 0.62 = 0.092. 26 Figure 3: Case when n = x is replaced by l. Hence we know that n is pending from rn to sn(rz), which means that the job completed at sn(rz) is of size at least min{0.092 + αpn, pn Case-2: y is replaced. First note that n (cid:54)= y, as otherwise (similar to Case-1) we have 1+α} ≥ 0.168, contradicting OPT = 1. sn(rl) − rn > 0.38 + min{pz, pl} − (1 + α) max{pz, pl} > 2.2 × 0.38 − 1.2 × 0.62 = 0.092, which implies a contradiction. Thus we have n = x. Consider which job is completed at sn: • if it is z, then by Case-1 we have sn(rz) − rn > 0.092; • if it is l, then sy(rl) − ry > (1.38 − px − pl) − αpl − (1 − py − min{pz, pl}) > 0.092; • if it is y, then we know that the job processed on the other machine at sn is either z or l. If it is z, then we have sn(rz) > 1.38−pn−(1+α)pz; otherwise we have sy(rl) > 1.38−pn−(1+α)pl. Thus we go to one of the above two cases. Hence in all cases, we can find a job completed at either sn(rz) or sy(rl) that is of size larger than 0.168, which contradicts OPT = 1. Case-3: z is replaced. If z is replaced, then we know that y is not replaced (thus n = x). Moreover, y must be processed at rl, which gives py > pz. Observe that pl ≥ (1 + α)pz > 1 − pz > 1 − py. Hence in OPT, l cannot be scheduled with z or y. Then we have py ≤ 1 − pz < pl, which implies cy < cl. Hence we know that z is rescheduled at cy. Then again, we have sn(rz) − rn > (1.38 − pn − pl) − α(pl + pz) − (1 − pn − pl) = 0.38 − α(pl + pz) ≤ 0.38 − 0.2 × (0.62 + 0.5) = 0.156, which implies that the job completed at sn(rz) is of size at least 0.232, contradicting OPT = 1. Now with the help of Lemma 6.5, we show that we can push the upper bound of pn from 1 2+α 2+α and n is never replaced, then ALG ≤ 1.38. to 0.38. Depending on whether n is ever replaced, we use different proof strategies. Lemma 6.6 If 0.38 < pn ≤ 1 Proof: Note that in this case n is uncharged. Recall that we have pk > 0.38 and pj > 0.38. If n is scheduled before one of k, j in OPT, then we have rn ≤ 1 − pn − 0.38, which implies sn − rn > 0.76. Hence we have pk > pn, pj > pn and last idle time t < rn < 1 − 2pn. Suppose sk > sj. As it is impossible to have pk > 0.76 and pj > 0.76, we have sk > rn. We show that k is uncharged: if the job replaced by k (at rk) is of size less than pn, then it cannot be rescheduled before sn; otherwise it is a major replacement, which (by Lemma 6.5) implies that k is not replaced. Hence we have rk = sk, and the job replaced by k is rescheduled before sn, which is impossible, as j is processed from sk to sn. 27 rnsl = rlnpyplnpzsysz = rzsn(rz)snpnALG > 1.38 10 + d−pn 4 > 0.2pn > 0.076, which gives ALG ≤ 1.38. Then we have Q Hence two of k, j, n are scheduled together in OPT, while n is not the one released earlier. As before, we show that none of k, j is ever replaced. Suppose k is replaced. Let x be the job completed at sk. We have px > pk, and we know that k must be replaced by one of x and j, while the other job is being processed when k is replaced. If k is replaced by x, then either k is uncharged (if sk(rx) > sj), or j is uncharged (if sk(rx) < sj), because the job replaced must be rescheduled after sn. Moreover, we have ck − sn > px + pk − pj > (2 + α)0.38 − 0.62 > 0.216, which gives ≥ 1 10 (pn + 0.38) + 1 4 (2 × 0.216 − pn) ≥ 0.38 10 + 0.216 2 − 0.15 2.2 > 0.0778. after max{rk, rx} < 1 − 0.38 − pn, which gives d > 0.38. If k is replaced by j, then we have pj > (1 + α)pk > 0.456 > pn. Note that there is no idle time If sk(rj) < sx, then x is uncharged, and ck − sn > px + pk − (1 + α)pj > 0.016, which implies 2(cid:101)P − 3pn 4 Q 10 + 2(cid:101)P + d − 3pn 4 Q 10 + ≥ 1 10 ≥ 0.38 10 (pn + 0.38) + (2 × 0.016 + 0.38 − pn) 1 4 + 0.412 4 − 0.15 2.2 > 0.0728. Hence we have sk(rj) > sx, which means that k is uncharged. Observe that if x is also uncharged then we are done as d − pn Q 10 + 4 ≥ 1 10 (pn + 0.38 + 0.38) + 1 4 (0.38 − pn) ≥ 0.38 5 + 0.38 4 − 0.15 2.2 > 0.1. Hence we have rx = sx < sk(rj), and the job replaced by x is completed during (sx, sk(rj)). Observe that we have px > pk > 0.38 and pj > pn > 0.38, hence any other job must be of size less than 0.24. Hence we have rk > sx, as otherwise the job replaced by x (which is of size less than 0.24) will be rescheduled after sn. Since rk < 1 − pk − pn, we have sk(rj) − rk > (1.38 − pn − pj)αpj − (1 − pk − pn) = 0.38 + pk − (1 + α)pj > 0, which means that k is not scheduled at rk. Hence the job y (apart from x) processed at rk is processed at least αpk (as 0.24 < pk 1+α ). Moreover, we have sy(rk) > sx, as otherwise x is uncharged. Hence we have t < sy(rk) < rk − αpk < 1 − pn − 0.456, which gives − 0.15 2.2 (0.456 − pn) ≥ 0.38 10 (pn + 0.38) + ≥ 1 10 d − pn > 0.083. 0.456 Q 10 + 1 4 + 4 4 Hence we can assume that none of k, j has been replaced. Assume sk < sj (j is uncharged). If j is scheduled before one of k, n on the same machine in OPT, then there is no idle time after rj ≤ 1 − 2 × 0.38 = 0.24, and k is also not charged: if k is charged, then for the job x replaced by k and the job y completed at sx we have py > px > pj > 0.38, contradicting OPT = 1. Hence Q 10 + d − pn 4 ≥ 1 10 (pn + 0.76) + 1 4 (0.76 − 2pn) ≥ 0.76 10 + 0.76 4 − 0.4 2.2 > 0.084. Otherwise k is scheduled before one of j, n in OPT. Observe that sk−rk > 0. Let J(sk) = {x, y}. Note that k, j, n /∈ J(sk). If k is scheduled with n, then sk−rk > (1.38−pn−pk)−(1−pk−pn) > 0.38, which (by Lemma 4.1) implies min{px, py} > 0.38 and contradicts OPT = 1; if k is scheduled with j, then sk − rk > (1.38 − pn − pk) − (1 − pk − 0.38) = 0.76 − pn. Hence min{px, py} > min{1 − 2 × 0.38, 1 2 (1 − pn)}, which also contradicts OPT = 1. 28 2+α and n is ever replaced, then ALG ≤ 1.38. Lemma 6.7 If 0.38 < pn ≤ 1 Proof: Observe that since pn > 0.38 and n is ever replaced, by Lemma 6.5 we know that n is replaced exactly once, and any other job of size larger than 0.38 is never replaced. Suppose n is replaced by l. Let J(rl) = {n, x}. Then we must have either l ∈ J(sn) or x ∈ J(sn), We first consider the case when J(sn) = {l, x}. Note that l, x are never replaced. as otherwise we have five jobs of size larger than 0.38. 1. If sx > sn(rl), then we have rx > sn(rl), as x cannot be pending at sn(rl). Consider the instance with jobs released after sn(rl) removed. Let OPT(cid:48) be the new optimal makespan and ALG(cid:48) be the makespan of our algorithm on the new instance. We have OPT(cid:48) ≤ 1− min{px, pl} (as x, l are released after sn(rl) and cannot be scheduled on the same machine in OPT), while ALG(cid:48) = sn(rl) + pn = ALG − (sn − sn(rl)) ≥ ALG − 1.38 · min{px, pl}, which gives a smaller counter-example (the inequality holds since sn − rl ≤ min{px, pl} and rl − sn(rl) ≤ αpl ≤ α(px + pn − 0.38) < 0.38px). 2. If rx ≤ sx < sn(rl), then we compare the release times of n and x. Observe that rl > If rn < rx, then t < rn < 1 − 2pn. We show that x is uncharged: any job max{rn, rx}. y replaced by x at rx < rn cannot be scheduled before sn, as there is at most one major 4 > 0.2 × 0.38 = replacement. As sn(rl) > sx > rn, n is uncharged, which implies Q 0.076. If rx < rn, then n is uncharged, as any job replaced by n can only be scheduled after one of x, n is completed. 10 + d−pn • If x is scheduled together with one of n, l in OPT, we have sx − rx > (1.38 − px − pn) − (1 − px − pn) = 0.38, which means that the two jobs processed at sx (note that n, x, l /∈ J(sx)) are of size larger than 0.38, contradicting OPT = 1; • otherwise we have rx < rn < 1− pn − pl, which implies d > pl. If x is uncharged then we 4 > 0.095; otherwise we have px > 1.38 − pn − rx > 0.38 + pl. Moreover, have Q we have sn(rl) − rn > (1.38 − pn − pl) − αpl − (1 − pn − pl) > 0.092, which means that the job completed at sn(rl) is of size larger than 0.168. Then we have a contradiction as min{0.168 + px, 0.168 + pn + pl} > 0.168 + (2 + α)0.38 > 1. 10 + d−pn Hence we have J(sn) (cid:54)= {l, x}, which means that at least three of the four jobs in {n, x, l}∪J(sn) We first consider the case when l /∈ J(sn) and x ∈ J(sn). Suppose x = j, then we have are released after t (as t < rl), which implies t < 1 − 2pn and d > pn. ck − sn > pl + pk − px > (2 + α)0.38 − 0.62 > 0.216. Hence we have 2(cid:101)P + d − 3pn 4 Q 10 + ≥ pn 10 + 2 × 0.216 4 > 0.146. Next we consider the case when l ∈ J(sn) and x /∈ J(sn). Suppose l = k. Observe that at any time from max{sn(rl), sx} to sn, the minimum job being processed is of size at least pn. Hence any job replaced at or after max{sn(rl), sx} must be rescheduled after sn. Thus job j and one of n, x are uncharged. Then we have Q 5 > 0.2 × 0.38 = 0.076. 10 + d−pn 4 ≥ pn 6.5 Refined Efficiency Argument Observe that the upper bound (2) on ALG is quite loose when pn and d are very small. Actually, since there are only two machines, if time t is idle, then there is one job being processed (it is impossible to have two idle machines in the minimum counter-example). Hence we should have a better upper bound on ∆t, compared to Lemma 1.1 (The Leftover Lemma). 29 Let t be the last idle time before sn, and let J(t) = {i}. Let OPTt be the makespan of the optimal schedule of the jobs released before t. Then we have ci(t) := si(t) + pi ≤ 1.38 · OPTt, as otherwise we can remove all jobs released after t, and obtain a smaller counter-example. Define p := max{OPTt−t, 0}. Then we have p ≤ OPTt ≤ t+p. Note that by optimality of OPTt, the total j:rj≥t pj. Hence the total size of jobs released processing OPT does after time t is at least p +(cid:80) after time t is(cid:80) j:rj≥t pj ≤ 2(1 − t) − p. Claim 6.1 There exists a job of size at least pn released after t that does not replace other jobs at its release time. Proof: Suppose otherwise, then every job of size at least pn released after t must be scheduled immediately (but can possibly be replaced later). If there is any job of size px < pn released after t, then we argue that the instance with x removed is a smaller counter-example: the schedule produced by our algorithm on the new instance is identical to the original scheduled (projected on jobs of size at least pn), as the behavior of every job of size at least pn is unchanged. Hence in the minimum counter-example, all jobs released after t are of size at least pn. Then the first job released after t does not replace any job, as there is an idle machine. By Observation 3.1 we have (recall that P is the total processing our algorithm does after sn) 2(1 − t) ≥ 2(sn − t) + P − ∆t(t) − (W1 − Wt(t)). (3) Note that W1 − Wt(t) is the total waste created by jobs released after time t, which is at most α(2 − 2t − p − pn). Rearranging the inequality and by P ≥ pn, we have ALG = sn + pn ≤ 1.2 + 0.4pn + 0.5∆t(t) − 0.2t − 0.1p. Note that we have ∆t(t) ≤ ci(t) − t − p ≤ 0.38 · OPTt ≤ 0.38(t + p). Applying the upper bound on ∆t(t), we have ALG = sn + pn ≤ 1.2 + 0.4pn + 0.09(t + p) − 0.1t. (4) Observe that we have t + p ≤ 1 and the following lower bound on t (from (1)): which implies t > 4(0.38 − pn 2 (2 − pn)) = 0.72 − 1.6pn. Hence we have 1.38 < ALG ≤ 1 + 2 − α pn 2 + t 4 + α 2 (2 − pn), ALG = sn + pn ≤ 1.2 + 0.4pn + 0.09 − 0.1(0.72 − 1.6pn) = 1.218 + 0.56pn. Thus immediately we can show that pn cannot be too small, as otherwise we have the contra- diction that ALG ≤ 1.218 + 0.56 × 0.28 = 1.3748. Lemma 6.8 (Lower Bound on pn) We have pn > 0.28. We show the following lemma, which will be the main framework towards deriving a contradic- tion, given that 0.28 < pn ≤ 0.38. Lemma 6.9 Given that pn ≤ 0.38, if we have W1 − Wt(t) − (P − pn) ≤ α(2 − 2t − p − 2pn), then we can show that ALG ≤ 1.38. 30 Proof: Applying the upper bounds on W1 − Wt(t) − (P − pn) and ∆t(t) to (3), we obtain the following stronger version of (4). ALG = sn + pn ≤ 1 2 (2 − pn + 0.38(t + p) + α(2 − 2t − p − 2pn)) + pn = 1.2 + 0.3pn + 0.09(t + p) − 0.1t. Since t + p ≤ 1 (we do not use the upper bound given by Lemma 6.10), we have ALG = sn + pn ≤ 1.2 + 0.3pn + 0.09 − 0.1(0.72 − 1.2pn) = 1.218 + 0.42pn ≤ 1.218 + 0.42 × 0.38 ≤ 1.3776, where in the first inequality we use a stronger lower bound on t: t > 4(0.38 − pn 0.72 − 1.2pn, which holds only when W1 − Wt(t) − (P − pn) ≤ α(2 − 2t − p − 2pn). 2 − α 2 (2 − 2pn)) = Notice that the "if" condition of Lemma 6.9 holds if there exists two jobs of size at least pn Next we show an upper bound on OPTt. Note that if p (cid:54)= 0, then we have t + p = OPTt. Hence released after t that are uncharged. the upper bound holds for t + p when p (cid:54)= 0. Lemma 6.10 We have OPTt ≤ 1 − pn. Suppose OPTt > 1 − pn, then we know that any job of size at least pn released after Proof: time t must be scheduled on the same machine in OPT (otherwise OPTt is not optimal). Also by optimality of OPTt, we have ci(t) ≥ OPTt. Recall that we have min{pk, pj, pn} ≥ pn. Since only one job is processed at time t, we know that at least two of k, j, n are released after n. Suppose l (cid:54)= n is the largest job released after time t, then we have pi > ci(t)− t > (1− pn)− (1− pn− pl) = pl, which means that pi cannot be replaced after t, and ci(t) = ci. Observe that if there are two jobs of size at least pn released after t that are uncharged, then by Lemma 6.9 we have ALG ≤ 1.38. Next we prove the existence of uncharged jobs. If i ∈ J(sn), suppose i = k, then we have ci = ck > sn > 1. Note that n is uncharged: any job replaced by n must be rescheduled after sn. We show that j is also uncharged. Suppose otherwise, then the job replaced by j must be n, and j must also be replaced, as cj > 1. Hence we have pj ≥ (1 + α)pn and the replacer of j is of size at least (1 + α)2pn, which is impossible, as pn + (1 + α)pn + (1 + α)2pn > 0.28 × (1 + 1.2 + 1.44) > 1. If i /∈ J(sn), then k, j, n are all released after time t. Note that it is impossible to have four jobs of size at least pn released after t, as 4pn > 1. Observe that none of k, j or n can be replaced. Suppose otherwise, let l be the replacer and M be the machine where the replacement happens. Then the first job completed on M after rl is a job of size at least (1 + α)pn that is not k, j or n. Hence all of k, j and n are never replaced, thus uncharged (as sn > 1). Lemma 6.10 helps us to improve the lower bound on pn. Corollary 6.1 (Improved Lower Bound) We have pn > 1 3 . Proof: Assume for contrary that pn ≤ 1 otherwise by Lemma 6.10 we have t + p = OPTt ≤ 1 − pn. Hence we have 3 . If p = 0, then by (4), we have ALG ≤ 1.2 + 0.4pn ≤ 1.34; ALG = sn + pn ≤ 1.2 + 0.4pn + 0.09(1 − pn) − 0.1(0.72 − 1.6pn) = 1.218 + 0.47pn ≤ 1.218 + 0.47 × 1 3 ≤ 1.3747, 31 where in the first inequality we use t > 0.72 − 1.6pn. It remains to prove the following lemma. Recall that so far we have shown that pn ∈ ( 1 3 , 0.38]. 3 , 0.38]. Lemma 6.11 We have W1 − Wt(t) − (P − pn) ≤ α(2 − 2t − p − 2pn), given that pn ∈ ( 1 Proof: If n is never replaced, i.e., is pending from rn to sn, then n is uncharged. Note that n (cid:54)= i. Hence n is released after t. We show that at least one of k, j is uncharged. Note that it is impossible that both k, j are replaced. Hence one of them, suppose k, is not replaced, thus uncharged. Moreover, k must be released after t: otherwise k = i, and we have the contradiction that ci(t) ≥ sn = ALG − pn > 1.38(1 − pn) ≥ 1.38 · OPTt. Otherwise let rl be the last time n is replaced, and J(rl) = {n, x}. Then we have px > pn. We show that both k, j are never replaced. Suppose the contrary that k is replaced. Then k cannot be replaced by n, l or j (otherwise j must also be replaced). As there cannot exist five jobs of size larger than 1 3 , we must have k = l and x = j, i.e., k replaces n while j is being processed, and then k is replaced by some job y. If ck − sn ≥ 2αpn, then we already have W1 − Wt(t)− (P− pn) ≤ α(2 − 2t − p − 2pn); otherwise pj > py + pk − (ck − sn) ≥ (2 + α)(1 + α)pn − 2αpn > 2 3 , which also contradicts OPT = 1. Hence both k, j are not charged. Moreover, for the same reason argued above, both k, j are released after t. 7 Other Candidate Algorithms All the candidate algorithms are based on LPT. That is, whenever there is an idle machine, we always schedule the largest job. The only difference is the replacement rule. We will show that none of the them can beat the ratio of 1.5. Candidate Algorithm 1. Fix any constant 0 < ρ < 1. Upon the arrival of a job j, job k can be replaced by job j if k is the smallest processing job, pk < pj and job k has been processed no larger than ρ fraction. Counter example. At t = 0, m identical jobs come with p1 = p2 = ··· = pm = 1. Each of them is scheduled on a machine. At t = ρ, job (m + 1) comes with pm+1 = 1 + ξ (ξ is an infinitesimal amount). Then one of jobs 1 to m is replaced by job (m + 1). At t = 2ρ, job (m + 2) comes with pm+2 = 1 + 2ξ, then job (m + 1) is replaced by job (m + 2). The same thing goes on and on, and at time t = 1, job (m − 1 + (cid:100) 1 ρ(cid:101)) jobs ρ(cid:101)) is replaced by job (m + (cid:100) 1 ρ(cid:101)+2 = ··· = p2m = 1. Then there are m pending jobs but only (m− 1) come with pm+(cid:100) 1 ρ(cid:101)+1 = pm+(cid:100) 1 idle machines, so ALG = 3. In the optimal solution, no replacement happens, and OPT = 2 +(cid:100) 1 ρ(cid:101)ξ. ρ(cid:101)). After then, at t = 1, (m − (cid:100) 1 Candidate Algorithm 2. Fix 0 < ρ < 1 and 1 < µ < 2. Upon the arrival of a job j, job k can be replaced by job j if µpk < pj and job k has been processed no larger than ρ fraction. We show a counter example using µ = 3/2 and ρ = 1/2. This counter example can be generalized to any µ and ρ such that µ + ρ ≤ 2. Counter example. At t = 0, m jobs come, with p1 = m + 1, p2 = m + 2,··· , pm = 2m. At time t = m, job (m + 1) comes with pm+1 = 3m. Then, as job m is the only job that is processed at most half, job m is replaced by job (m + 1). After the replacement, (m − 1) jobs come with pm+2 = 2m + 1, pm+3 = 2m + 2,··· , p2m = 3m− 1. Then ALG = 6m, while in the optimal solution, no replacement happens, thus OPT = 4m + 1. 32 Candidate Algorithm 3. Fix a target performance ratio 1 + γ. When a job j comes, schedule it virtually to ALG, and calculate the current optimal solution with all the jobs that have been released. If the ratio can still be bounded in 1 + γ, do not replace any jobs; otherwise choose one job to replace. Counter example. At t = 0, m jobs comes first, with p1 = 2m, p2 = 2m + 1,··· , pm = 3m − 1. After each of them has been scheduled on a machine, at t = 0, another m jobs come, with pm+1 = 3m, pm+2 = 3m + 1,··· , p2m = 4m− 1. At this time, since the local ALG and local OPT are exactly the same, no replacement happens. Then at t = 3m − 1, another job comes with p2m+1 = 3m. So for this instance, ALG = 6m− 1; while in the optimal solution, three smallest jobs (jobs 1, 2, 3) are scheduled on the same machine, while all other jobs are paired up with the smallest with largest, and OPT = 4m + 3. For our algorithm LPT with Restart, some may wonder what happens if α or β is not in (0, 1/2). we know that if α = 0, it is exactly the same with LPT, which cannot beat 1.5; if β = 0, a counter example can be given that is similar to that of Candidate Algorithm 1. Next we show that when β ≥ 1/2 or α ≥ 1/2, LPT with Restart could not beat 1.5, no matter what the value of the other parameter is. Candidate Algorithm 4 In LPT with Restart, set β ≥ 1/2, and α to be any constant. Counter example. At t = 0, m(m ≥ 4) jobs come first, with p1 = p2 = ··· = pm = 1. After all these jobs are scheduled, still at time 0, another m jobs come, with pm+1 = pm+2 = ··· = p2m = 3/2+ξ. Then at t = 1, another job comes with p2m+1 = 2. Since β ≥ 1/2, no replacement happens, and ALG = 9/2 + ξ, while in optimal schedule, all jobs could be completed at or before time 3 + ξ. Candidate Algorithm 5 In LPT with Restart, set α ≥ 1/2, and β to be any constant such that 0 < β < 1/2. Counter example. We consider the special case with only one machine. At t = 0, job 1 comes with p1 = 1. At t = 1− ξ (again, ξ is an infinitesimal amount), job 2 comes with p2 = 2, then job 1 is replaced by job 2. At t = 3 − 2ξ, job 3 comes with p3 = 4, job 2 is replaced by job 3. The same thing goes on and on. Each time a new job comes, ALG would replace the previous job, while OPT would wait for the previous job to end. The final ratio would be arbitrarily close to 1.5. 8 Hardness for deterministic algorithms with restart 1.5 ≈ 1.225 for any deterministic algorithms In this section, we present a simple lower bound of with restart. Given any deterministic algorithm, consider the following instance with two machines. 6, another job comes with At t = 0, two jobs come with size p1 = p2 = 1. Then, at t = 3 − √ √ √ 6 − 1. size p3 = 1. If the algorithm starts processing job 3 after time 1, i.e., after completing the two jobs of size √ 1, no more jobs arrive in the instance. We have OPT = 2 as we could have scheduled job 1 and job 2 on the same machine and job 3 on the other one. On the other hand, ALG ≥ 1+p3 = 6. √ 2. If the algorithm starts processing job 3 before time 1, e.g., it restarts one of the size-1 jobs, 6 let there be a fourth job that arrives at time 1 with size p4 = by scheduling job 1 and 3 on one machine, and 2 and 4 on the other. On the other hand, we have ALG ≥ 3 since at time 1 at least one of jobs 1 and 2 is pending, and job 3 does not complete until time 2. 6 − 1. We have OPT = √ 33 References Susanne Albers. Better bounds for online scheduling. SIAM Journal on Computing, 29(2):459–473, 1999. Nir Avrahami and Yossi Azar. Minimizing total flow time and total completion time with immediate dispatching. Algorithmica, 47(3):253–268, 2007. Y. Bartal, A. Fiat, H. Karloff, and R. Vohra. New algorithms for an ancient scheduling problem. Journal of Computer and System Sciences, 51(3):359 – 366, 1995. Piotr Berman, Moses Charikar, and Marek Karpinski. On-line load balancing for related machines. Journal of Algorithms, 35(1):108–121, 2000. Bo Chen and Arjen P. A. Vestjens. Scheduling on identical machines: How good is LPT in an on-line setting? Operations Research Letters, 21(4):165–169, 1997. Bo Chen, Andr van Vliet, and Gerhard J. Woeginger. New lower and upper bounds for on-line scheduling. Operations Research Letters, 16(4):221 – 230, 1994a. Bo Chen, Andr´e van Vliet, and Gerhard J. Woeginger. A lower bound for randomized on-line scheduling algorithms. Information Processing Letters, 51(5):219–222, 1994b. Bo Chen, Andr´e van Vliet, and Gerhard J. Woeginger. An optimal algorithm for preemptive on-line scheduling. Operations Research Letters, 18(3):127–131, 1995. Marek Chrobak, Wojciech Jawor, Jir´ı Sgall, and Tom´as Tich´y. Online scheduling of equal-length jobs: Randomization and restarts help. SIAM Journal on Computing, 36(6):1709–1728, 2007. Gyorgy D´osa and Leah Epstein. Online scheduling with a buffer on related machines. Journal of Combinatorial Optimization, 20(2):161–179, 2010. Gyorgy D´osa and Leah Epstein. Preemptive online scheduling with reordering. SIAM Journal on Discrete Mathematics, 25(1):21–49, 2011. Tom´as Ebenlendr, Wojciech Jawor, and Jir´ı Sgall. Preemptive online scheduling: Optimal algo- rithms for all speeds. Algorithmica, 53(4):504–522, 2009. Matthias Englert, Deniz Ozmen, and Matthias Westermann. The power of reordering for online minimum makespan scheduling. SIAM Journal on Computing, 43(3):1220–1237, 2014. Leah Epstein and Jir´ı Sgall. A lower bound for on-line scheduling on uniformly related machines. Operations Research Letters, 26(1):17–22, 2000. Leah Epstein, John Noga, Steven S. Seiden, Jir´ı Sgall, and Gerhard J. Woeginger. Randomized online scheduling on two uniform machines. In SODA, pages 317–326. ACM/SIAM, 1999. Rudolf Fleischer and Michaela Wahl. On-line scheduling revisited. Journal of Scheduling, 3(6): 343–353, 2000. Ronald L. Graham. Bounds on multiprocessing timing anomalies. SIAM Journal of Applied Math- ematics, 17(2):416–429, 1969. 34 Han Hoogeveen, Chris N Potts, and Gerhard J Woeginger. On-line scheduling on a single machine: maximizing the number of early jobs. Operations Research Letters, 27(5):193–197, 2000. David R. Karger, Steven J. Phillips, and Eric Torng. A better algorithm for an ancient scheduling problem. Journal of Algorithms, 20(2):400 – 430, 1996. Hans Kellerer, Vladimir Kotov, Maria Grazia Speranza, and Zsolt Tuza. Semi on-line algorithms for the partition problem. Operations Research Letters, 21(5):235 – 242, 1997. Shisheng Li, Yinghua Zhou, Guangzhong Sun, and Guoliang Chen. Study on parallel machine scheduling problem with buffer. In IMSCCS, pages 278–273. IEEE Computer Society, 2007. John Noga and Steven S. Seiden. An optimal online algorithm for scheduling two machines with release times. Theoretical Computer Science, 268(1):133–143, 2001. J. F. RudinIII. Improved Bound for the Online Scheduling Problem. PhD thesis, University of Texas at Dallas, 2001. J. F. RudinIII and R. Chandrasekaran. Improved bounds for the online scheduling problem. SIAM Journal on Computing, 32(3):717–735, 2003. Jianjun Wen and Donglei Du. Preemptive on-line scheduling for two uniform processors. Operations Research Letters, 23(3-5):113–116, 1998. Guochuan Zhang. A simple semi on-line algorithm for p2//c {max} with a buffer. Information Processing Letters, 61(3):145–148, 1997. 35
1104.2230
1
1104
2011-04-12T14:39:13
Subexponential Parameterized Algorithm for Minimum Fill-in
[ "cs.DS" ]
The Minimum Fill-in problem is to decide if a graph can be triangulated by adding at most k edges. Kaplan, Shamir, and Tarjan [FOCS 1994] have shown that the problem is solvable in time O(2^(O(k)) + k2 * nm) on graphs with n vertices and m edges and thus is fixed parameter tractable. Here, we give the first subexponential parameterized algorithm solving Minimum Fill-in in time O(2^(O(\sqrt{k} log k)) + k2 * nm). This substantially lower the complexity of the problem. Techniques developed for Minimum Fill-in can be used to obtain subexponential parameterized algorithms for several related problems including Minimum Chain Completion, Chordal Graph Sandwich, and Triangulating Colored Graph.
cs.DS
cs
Subexponential Parameterized Algorithm for Minimum Fill-in ∗ Fedor V. Fomin † Yngve Villanger † Abstract The Minimum Fill-in problem is to decide if a graph can be triangu- lated by adding at most k edges. Kaplan, Shamir, and Tarjan [FOCS 1994] have shown that the problem is solvable in time O(2O(k)+k2nm) on graphs with n vertices and m edges and thus is fixed parameter tractable. Here, we give the first subexponential parameterized algorithm solving Mini- mum Fill-in in time O(2O(√k log k) + k2nm). This substantially lower the complexity of the problem. Techniques developed for Minimum Fill-in can be used to obtain subexponential parameterized algorithms for sev- eral related problems including Minimum Chain Completion, Chordal Graph Sandwich, and Triangulating Colored Graph. 1 Introduction A graph is chordal (or triangulated) if every cycle of length at least four con- tains a chord, i.e. an edge between nonadjacent vertices of the cycle. The Minimum Fill-in problem (also known as Minimum Triangulation and Chordal Graph Completion) is Minimum Fill-in Input: A graph G = (V, E) and a non-negative integer k. Question: Is there F ⊆ [V ]2, F ≤ k, such that graph H = (V, E ∪ F ) is chordal? The name fill-in is due to the fundamental problem arising in sparse matrix computations which was studied intensively in the past. During Gaussian elim- inations of large sparse matrices new non-zero elements called fill can replace original zeros thus increasing storage requirements and running time needed to solve the system. The problem of finding the right elimination ordering mini- mizing the amount of fill elements can be expressed as the Minimum Fill-in problem on graphs [45, 47]. See also [15, Chapter 7] for a more recent overview ∗This research was partially supported by the Research Council of Norway. †Department Informatics, Bergen, University of of Bergen, Norway, {fedor.fomin,yngve.villanger}@ii.uib.no 1 of related problems and techniques. Besides sparse matrix computations, appli- cations of Minimum Fill-in can be found in database management [2], artificial intelligence, and the theory of Bayesian statistics [13, 27, 40, 51]. The survey of Heggernes [30] gives an overview of techniques and applications of minimum and minimal triangulations. Minimum Fill-in (under the name Chordal Graph Completion) was one of the 12 open problems presented at the end of the first edition of Garey and Johnson's book [26] and it was proved to be NP-complete by Yannakakis [52]. Kaplan et al. proved that Minimum Fill-in is fixed parameter tractable by giving an algorithm of running time O(m16k) in [36] and improved the running time to O(k616k + k2mn) in [37], where m is the number of edges and n is the number of vertices of the input graph. There were several algorithmic improvements resulting in decreasing the constant in the base of the exponents. In 1996, Cai [11], reduced the running time to O((n + m) 4k k+1 ). The fastest parameterized algorithm known prior to our work is the recent algorithm of Bodlaender et al. with running time O(2.36k + k2mn) [4]. In this paper we give the first subexponential parameterized algorithm for Minimum Fill-in. The last chapter of Flum and Grohe's book [21, Chap- ter 16] concerns subexponential fixed parameter tractability, the complexity class SUBEPT, which, loosely speaking -- we skip here some technical conditions -- is the class of problems solvable in time 2o(k)nO(1), where n is the input length and k is the parameter. Subexponential fixed parameter tractability is inti- mately linked with the theory of exact exponential algorithms for hard prob- lems, which are better than the trivial exhaustive search, though still exponen- tial [22]. Based on the fundamental results of Impagliazzo et al. [33], Flum and Grohe established that most of the natural parameterized problems are not in SUBEPT unless Exponential Time Hypothesis (ETH) fails. Until recently, the only notable exceptions of problems in SUBEPT were the problems on planar graphs, and more generally, on graphs excluding some fixed graph as a minor [16]. In 2009, Alon et al. [1] used a novel application of color coding to show that parameterized Feedback Arc Set in Tournaments is in SUPEPT. Minimum Fill-in is the first problem on general graphs which appeared to be in SUBEPT. General overview of our approach. Our main tool in obtaining subexpo- nential algorithms is the theory of minimal triangulations and potential maximal cliques of Bouchitt´e and Todinca [8]. This theory was developed in contest of computing the treewidth of special graph classes and was used later in exact exponential algorithms [23, 24]. A set of vertices Ω of a graph G is a potential maximal clique if there is a minimal triangulation such that Ω is a maximal clique in this triangulation. Let Π be the set of all potential maximal cliques in graph G. The importance of potential maximal cliques is that if we are given the set Π, then by using the machinery from [8, 23], it is possible compute an optimum triangulation in time up to polynomial factor proportional to Π. If (G, k) is a YES instance of the Minimum Fill-in problem, then every maximal clique of every Let G be an n-vertex graph and k be the parameter. 2 optimum triangulation is obtained from some potential maximal clique of G by adding at most k fill edges. We call such potential maximal clique vital. To give a general overview of our algorithm, we start with the approach that does not work directly, and then explain what has to be changed to suceed. The algorithm consists of three main steps. Step A. Apply a kernelization algorithm that in time nO(1) reduces the problem an instance to instance of size polynomial in k; Step B. Enumerate all vital potential maximal cliques of an n-vertex graph in time no(k/ log k). By Step A, n = kO(1), and thus the running time of enumeration algorithm and the number of vital potential maximal cliques is 2o(k); Step C. Apply the theory of potential maximal clique to solve the problem in time proportional to the number of vital potential maximal cliques, which is 2o(k). Step A, kernelization for Minimum Fill-in, was known prior to our work. In 1994, Kaplan et al. gave a kernel with O(k5) vertices. Later the kernelization was improved to O(k3) in[37] and then to 2k2 + 4k in [43]. Step C, with some modifications, is similar to the algorithm from [8, 23]. This is Step B which does not work and instead of enumerating vital potential maximal cliques we make a "detour". We use branching (recursive) algorithm that in subexponential time outputs subexponential number of graphs avoiding a specific combinato- rial structure, non-reducible graphs. In non-reducible graphs we are able to enumerate vital potential maximal cliques. Thus Step B is replaced with Step B1. Apply branching algorithm to generate nO(√k) non-reducible instances such that the original instance is a YES instance if and only if at least one of the generated non-reducible instances is a YES instance; Step B2. Show that if G is non-reducible, then all vital potential maximal cliques of G can be enumerated in time nO(√k). Putting together Steps A, B1, B2, and C, we obtain the subexponential algo- rithm. It follows from our results that several other problems belong to SUBEPT. We show that within time O(2O(√k log k) +k2nm) it is possible to solve Minimum Chain Completion, and Triangulating Colored Graph. For Chordal Graph Sandwich, and we show that deciding if a sandwiched chordal graph G can be obtained from G1 by adding at most k fill edges, is possible in time O(2O(√k log k) + k2nm). A chain graph is a bipartite graph where the sets of neighbors of vertices form an inclusion chain. In the Minimum Chain Completion problem, we are asked if a bipartite graph can be turned into a chain graph by adding at most k edges. The problem was introduced by Golumbic [28] and Yannakakis 3 [52]. The concept of chain graph has surprising applications in ecology [41, 46]. Feder et al. in [20] gave approximation algorithms for this problem. The Triangulating Colored Graph problem is a generalization of Min- imum Fill-in. The instance is a graph with some of its vertices colored; the task is to add at most k fill edges such that the resulting graph is chordal and no fill edge is monochromatic. We postpone the formal definition of the problem till Section 7. The problem was studied intensively because of its close relation to Perfect Phylogeny Problem -- fundamental and long-standing problem for numerical taxonomists [7, 10, 35]. The Triangulating Colored Graph problem is N P -complete [6] and W [t]-hard for any t, when parametrized by the number of colours [5]. However, the problem is fixed parameter tractable when parameterized by the number of fill edges. In Chordal Graph Sandwich we are given two graphs G1 and G2 on the same vertex set, and the question is if there is a chordal graph G which is a supergraph of G1 and a subgraph of G2. The problem is a generalization of Triangulating Colored Graph. We refer to the paper of Golumbic et al. [29] for a general overview of graph sandwich problems. The remaining part of the paper is organized as follows. Section 2 contains definitions and preliminary results. In Section 3, we give branching algorithm, Step B1. Section 4 provides algorithm enumerating vital potential maximal cliques in non-reducible graphs, Step B2. This is the most important part of our algorithm. It is based on a new insight into the combinatorial structure of potential maximal cliques. In Section 5, we show how to adapt the algorithm from [8, 23] to implement Step C. The main algorithm is given in Section 6. In Section 7, we show how the ideas used for Minimum Fill-in can be used to obtain subexponential algorithms for other problems. To implement our strategy for Chordal Graph Sandwich, we have to provide a polynomial kernel for this problem. We conclude with open problems in Section 8. 2 Preliminaries We denote by G = (V, E) a finite, undirected and simple graph with vertex set V (G) = V and edges set E(G) = E. We also use n to denote the number of vertices and m the number of edges in G. For a nonempty subset W ⊆ V , the subgraph of G induced by W is denoted by G[W ]. We say that a vertex set W ⊆ V is connected if G[W ] is connected. The open neighborhood of a vertex v is N (v) = {u ∈ V : uv ∈ E} and the closed neighborhood is N [v] = N (v)∪{v}. For a vertex set W ⊆ V we put N (W ) = Sv∈W N (v) \ W and N [W ] = N (W )∪ W . Also for W ⊂ V we define fillG(W ), or simple fill(W ), to be the number of non-edges of W , i.e. the number of pairs u 6= v ∈ W such that uv 6∈ E(G). We use GW to denote the graph obtained from graph G by completing its vertex subset W into a clique. We refer to Diestel's book [17] for basic definitions from Graph Theory. Chordal graphs and minimal triangulations. Chordal or triangulated 4 graphs is the class of graphs containing no induced cycles of length more than three. In other words, every cycle of length at least four in a chordal graph con- tains a chord. Graph H = (V, E ∪ F ) is said to be a triangulation of G = (V, E) if H is chordal. The triangulation H is called minimal if H′ = (V, E ∪ F ′) is not chordal for every edge subset F ′ ⊂ F and H is a minimum triangulation if H′ = (V, E ∪ F ′) is not chordal for every edge set F ′ such that F ′ < F. The edge set F for the chordal graph H is called the fill of H, and if H is a minimum triangulation of G, then F is the minimum fill-in for G. Minimal triangulations can be described in terms of vertex eliminations (also known as Elimination Game) [45, 25]. Vertex elimination procedure takes as input a vertex ordering π : {1, 2, . . . , n} → V (G) of graph G and outputs a chordal graph H = Hn. We put H0 = G and define Hi to be the graph obtained from Hi−1 by completing all neighbours v of π(i) in Hi−1 with π−1(v) > i into a clique. An elimination ordering π is called minimal if the corresponding vertex elimination procedure outputs a minimal triangulation of G. Proposition 2.1 ([44]). Graph H is a minimal triangulation of G if and only if there exists a minimal elimination ordering π of G such that the corresponding procedure outputs H. We will also need the following description of the fill edges introduced by vertex eleminations. Proposition 2.2 ([48]). Let H be the chordal graph produced by vertex elim- ination of graph G according to ordering π. Then uv 6∈ E(G) is a fill edge of H if and only if there exists a path P = uw1w2 . . . wℓv such that π−1(wi) < min(π−1(u), π−1(v)) for each 1 ≤ i ≤ ℓ. Minimal separators. Let u and v be two non adjacent vertices of a graph G. A set of vertices S ⊆ V is an u, v-separator if u and v are in different connected components of the graph G[V \ S]. We say that S is a minimal u, v-separator of G if no proper subset of S is an u, v-separator and that S is a minimal separator of G if there are two vertices u and v such that S is a minimal u, v-separator. Notice that a minimal separator can be contained in another one. If a minimal separator is a clique, we refer to it as to a clique minimal separator. A connected component C of G[V \ S] is a full component associated to S if N (C) = S. The following proposition is an exercise in [28]. Proposition 2.3 (Folklore). A set S of vertices of G is a minimal a, b-separator if and only if a and b are in different full components associated to S. In particular, S is a minimal separator if and only if there are at least two distinct full components associated to S. Potential Maximal Cliques are combinatorial objects which properties are crucial for our algorithm. A vertex set Ω is defined as a potential maximal clique in graph G if there is some minimal triangulation H of G such that Ω is a maximal clique of H. Potential maximal cliques were defined by Bouchitt´e and Todinca in [8, 9]. 5 The following proposition was proved by Kloks et al. for minimal separators [38] and by Bouchitt´e and Todinca for potential maximal cliques [8]. Proposition 2.4 ([8, 38]). Let X be either a potential maximal clique or a minimal separator of G, and let GX be the graph obtained from G by completing X into a clique. Let C1, C2, . . . , Cr be the connected components of G \ X. Then graph H obtained from GX by adding a set of fill edges F is a minimal triangulation of G if and only if F = Sr i=1 Fi, where Fi is the set of fill edges in a minimal triangulation of GX [N [Ci]]. The following result about the structure of potential maximal cliques is due to Bouchitt´e and Todinca. Proposition 2.5 ([8]). Let Ω ⊆ V be a set of vertices of the graph G. Let {C1, C2, . . . , Cp} be the set of the connected components of G\Ω and {S1, S2, . . . , Sp}, where Si = N (Ci) for i ∈ {1, 2, . . . , p}. Then Ω is a potential maximal clique of G if and only if: 1. G \ Ω has no full component associated to Ω, and 2. the graph on the vertex set Ω obtained from G[Ω] by completing each Si, i ∈ {1, 2, . . . , p}, into a clique, is a complete graph. Moreover, if Ω is a potential maximal clique, then {S1, S2, . . . , Sp} is the set of minimal separators of G contained in Ω. We will need also the following proposition from [23]. Proposition 2.6 ([23]). Let Ω be a potential maximal clique of G. Then for every y ∈ Ω, Ω = NG(Y )∪{y}, where Y is the connected component of G\ (Ω\ {y}) containing y. A naive approach of deciding if a given vertex subset is a potential maximal clique would be to try all possible minimal triangulations. There is a much faster approach of recognizing potential maximal cliques due to Bouchitt´e and Todinca based on Proposition 2.5. Proposition 2.7 ([8]). There is an algorithm that, given a graph G = (V, E) and a set of vertices Ω ⊆ V , verifies if Ω is a potential maximal clique of G in time O(nm). Parameterized complexity. A parameterized problem Π is a subset of Γ∗× N for some finite alphabet Γ. An instance of a parameterized problem consists of (x, k), where k is called the parameter. A central notion in parameterized com- plexity is fixed parameter tractability (FPT) which means, for a given instance (x, k), solvability in time f (k) · p(x), where f is an arbitrary function of k and p is a polynomial in the input size. We refer to the book of Downey and Fellows [19] for further reading on Parameterized Complexity. Kernelization. A kernelization algorithm for a parameterized problem Π ⊆ Γ∗ × N is an algorithm that given (x, k) ∈ Γ∗ × N outputs in time polynomial 6 in x + k a pair (x′, k′) ∈ Γ∗ × N, called kernel such that (x, k) ∈ Π if and only if (x′, k′) ∈ Π, x′ ≤ g(k), and k′ ≤ k, where g is some computable function. The function g is referred to as the size of the kernel. If g(k) = kO(1) then we say that Π admits a polynomial kernel. There are several known polynomial kernels for the Minimum Fill-in prob- lem [36, 37]. The best known kernelization algorithm is due to Natanzon et al. [42, 43], which for a given instance (G, k) outputs in time O(k2nm) an instance (G′, k′) such that k′ ≤ k, V (G′) ≤ 2k2 + 4k, and (G, k) is a YES instance if and only if (G′, k′) is. Proposition 2.8 ([42, 43]). Minimum Fill-in has a kernel with vertex set of size O(k2). The running time of the kernelization algorithm is O(k2nm). 3 Branching In our algorithm we apply branching procedure (Rule 1) whenever it is possible. To describe this rule, we need some definitions. Let u, v be two nonadjacent vertices of G, and let X = N (u) ∩ N (v) be the common neighborhood of u and v. Let also P = uw1w2 . . . wℓv be a chordless uv-path. In other words, any two vertices of P are adjacent if and only if they are consecutive vertices in P . We say that visibility of X from P is obscured if X \ N (wi) ≥ √k for every i ∈ {1, . . . , ℓ}. Thus every internal vertex of P is nonadjacent to at least √k vertices of X. The idea behind branching is based on the observation that every fill-in of G with at most k edges should either contain fill edge uv, or should make at least one internal vertex of the path to be adjacent to all vertices of X. Rule 1 (Branching Rule). If instance (G = (V, E), k) of Minimum Fill-in contains a pair of nonadjacent vertices u, v ∈ V and a chordless uv-path P = uw1w2 . . . wℓv such that visibility of X = N (u) ∩ N (v) from P is obscure, then branch into ℓ + 1 instances (G0, k0), (G1, k1), . . . , (Gℓ, kℓ). Here • G0 = (V, E ∪ {uv}), k0 = k − 1; • For i ∈ {1, . . . , ℓ}, Gi = (V, E ∪ Fi), ki = k − Fi, where Fi = {wixx ∈ X ∧ wix 6∈ E}. (G, k) is a YES instance if and only if Lemma 3.1. Rule 1 is sound, i.e. (Gi, ki) is a YES instance for some i ∈ {0, . . . , ℓ}. Proof. If for some i ∈ {0, . . . , ℓ}, (Gi, ki) is a YES instance, then G can be turned into a chordal graph by adding at most ki + Fi = k edges, and thus (G, k) is a YES instance. Let (G, k) be a YES instance, and let F ⊆ [V ]2 be such that graph H = (V, E ∪ F ) is chordal and F ≤ k. By Proposition 2.1, there exists an ordering π of V , such that the Elimination Game algorithm on G and π outputs H. Without loss of generality, we can assume that π−1(u) < π−1(v). If for some 7 x ∈ X, π−1(x) < π−1(u), then by Proposition 2.2, we have that uv ∈ F . Also by Proposition 2.2, if π−1(wi) < π−1(u) for each i ∈ {1, . . . , ℓ}, then again uv ∈ F . In both cases (G0, k0) is a YES instance. The only remaining case is when π−1(u) < π−1(x) for all x ∈ X, and there is at least one vertex of P placed after u in ordering π. Let i ≥ 1 be the smallest index such that π−1(u) < π−1(wi). Thus for every x ∈ X, in the path xuw1, w2, . . . , wi all internal vertices are ordered by π before x and wi. By Proposition 2.2, this imply that wi is adjacent to all vertices of X, and hence (Gi, ki) is a YES instance. The following lemma shows that every branching step of Rule 1 can be performed in polynomial time. Lemma 3.2. Let (G, k) be an instance of Minimum Fill-in. It can be identified in time O(n4) if there is a pair u, v ∈ V (G) satisfying conditions of Rule 1. Moreover, if conditions of Rule 1 hold, then a pair u, v of two nonadjacent vertices and a chordless uv-path P such that visibility of N (u) ∩ N (v) from P is obscured, can be found in time O(n4). Proof. For each pair of nonadjacent vertices u, v, we compute X = N (u)∩N (v). We compute the set of all vertices W ⊆ V (G) \ {u, v}, such that every vertex of W is nonadjacent to at least √k vertices of X. Then conditions of Rule 1 do not hold for u and v if in the subgraph Guv induced by W ∪ {u, v}, u and v are in different connected components. If u and v are in the same connected component of Guv, then a shortest (in Guv) uv-path P is a chordless path and the visibility of X from P is obscured. Clearly, all these procedures can be performed in time O(n4). We say that instance (G, k) is non-reducible if conditions of Rule 1 do not hold. Thus for each pair of vertices u, v of non-reducible graph G, there is no uv-path with obscure visibility of N (u) ∩ N (v). Lemma 3.3. Let t(n, k) be the maximum number of non-reducible problem in- stances resulting from recursive application of Rule 1 starting from instance (G, k) with V (G) = n. Then t(n, k) = nO(√k) and all generated non-reducible instances can be enumerated within the same time bound. Proof. Let us assume that we branch on the instances corresponding to a pair u, v and path P = uw1w2 . . . wℓv such that the visibility of N (u) ∩ N (w) is obscure from P . Then the value of t(n, k) is at most Pℓ i=0 t(n, ki). Here k0 = 1 and for all i ≥ 1, ki = k−Fi ≤ k−√k. Since the number of vertices in P does not exceed n, we have that t(n, k) ≤ t(n, k − 1) + n · t(n, k − √k). By making use of standard arguments on the amount of leaves in branching trees (see, for example [34, Theorem 8.1]) it follows that t(n, k) = nO(√k). By Lemma 3.2, every recursive call of the branching algorithm can be done in time O(n4), and thus all non-reducible instances are generated in time O(nO(√k) · n4) = nO(√k). 8 4 Listing vital potential maximal cliques Let (G, k) be a YES instance of Minimum Fill-in. It means that G can be turned into a chordal graph H by adding at most k edges. Every maximal clique in H corresponds to a potential maximal clique of G. The observation here is that if a potential maximal clique Ω needs more than k edges to be added to become a clique, then no solution H can contain Ω as a maximal clique. In Section 5 we prove that the only potential maximal cliques that are essential for a fill-in with at most k edges are the ones that miss at most k edges from a clique. A potential maximal clique Ω is vital if the number of edges in G[Ω] is at least Ω(Ω− 1)/2− k. In other words, the subgraph induced by vital potential maximal clique can be turned into a complete graph by adding at most k edges. In this section we show that all vital potential maximal cliques of an n-vertex non-reducible graph can be enumerated in time nO(√k). We will first show how to enumerate potential maximal cliques which are, in some sense, almost cliques. This enumeration algorithm will be used as a subroutine to enumerate vital potential maximal cliques. A potential maximal clique Ω is quasi-clique, if there is a set Z ⊆ Ω of size at most 5√k such that Ω \ Z is a clique. In particular, if Ω ≤ 5√k, then Ω is also a quasi-clique. The following lemma gives an algorithm enumerating all quasi-cliqes. Proof. We will prove that while a quasi-clique can be very large, it can be Lemma 4.1. Let (G, k) be a problem instance on n vertices. Then all quasi- cliques in G can be enumerated within time nO(√k). reconstructed in polynomial time from a small set of O(√k) vertices. Hence all quasi-cliques can be generated by enumerating vertex subsets of size O(√k). Because the amount of vertex subsets of size O(√k) is nO(√k), this will prove Let Ω be a potential maximal clique which is a quasi-clique, and let Z ⊆ Ω be the set of size at most 5√k such that X = Ω \ Z is a clique. Depending on the amount of full components associated to X in G\ (Z∪ X), we consider three cases: There are at least two full components, there is exactly one, and there is no full component. the lemma. Consider first the case when X has at least two full components, say C1 and C2. In this case, by Proposition 2.3, X is a minimal clique separator of G \ Z. Let H be some minimal triangulation of G \ Z. By Proposition 2.4, clique minimal separators remain clique minimal separators in every minimal triangulation. Therefore, X is a minimal separator in H. It is well known that every chordal graph has at most n − 1 minimal separators and that they can be enumerated in linear time [12]. To enumerate quasi-cliques we implement the following algorithm. We construct a minimal triangulation H of G \ Z. A minimal triangulation can be constructed in time O(nm) or O(nω log n), where ω < 2.37 is the exponent of matrix multiplication and m is the number of edges in G [32, 48]. For every minimal separator S of H, where G[S] is a clique, we 9 check if S ∪ Z is a potential maximal clique in G. This can be done in O(km) time by Proposition 2.7. Therefore, in this case, the time required to enumerate all quasi-cliques of the form X ∪ Z, up to polynomial multiplicative factor is proportional to the amount of sets Z of size at most 5√k. The total running time to enumerate quasi-cliques of this type is nO(√k). Now we consider the case when no full component in G\ (Z ∪ X) associated to X. It means that for every connected component C of G \ (Z ∪ X), there is x ∈ X\N (C). By Proposition 2.5, X is also a potential maximal clique in G\Z. We construct a minimal triangulation H of G\ Z. By Proposition 2.4, X is also a potential maximal clique in H. By the classical result of Dirac [18] chordal graph H contains at most n maximal cliques and all the maximal cliques of H can be enumerated in linear time [3]. For every maximal clique K of H such that K is also a clique in G, we check if K ∪ Z is a potential maximal clique in G, which can be done in O(nm) time by Proposition 2.7. As in the previous case, the enumeration of all such quasi-cliques boils down to enumerating sets Z, which takes time nO(√k). Last case, vertex set X has unique full component Cr in G\(Z∪X) associated to X. Since Ω = Z ∪ X, we have that each of the connected components C1, C2, . . . , Cr of G \ (Z ∪ X) is also a connected component of G \ Ω. Then for every i ∈ {1, . . . , r − 1}, Si = NG\Z(Ci) is a clique minimal separator in G \ Z because Si ⊆ X is a clique, and Ci together with the component of G \ (Z ∪ Si) containing X \ Si, are full components associated to Si. Let H be a minimal triangulation of G \ Z. Vertex set X is a clique in G \ Z and thus is a clique in H. Let K be a maximal clique of H containing X. By Proposition 2.4, for every i ∈ {1, . . . , r − 1}, Si is a minimal separator in H. By Proposition 2.4, G \ Z has no fill edges between vertices separated by Si and thus Ci is a connected component of H \ K. Because Ω is a potential maximal clique in G, by Proposition 2.5, there is y ∈ Ω such that y 6∈ NG(Cr). Since Cr is a full component for X, we have that y ∈ Z. Moreover, every connected component C 6= Cr of G \ (Z ∪ X) is also a connected component of H \ K. Thus every connected component of H \ K containing a neighbor of y in G is also a connected component of G \ Ω containing a neighbor of y. Let B1, B2, . . . , Bℓ be the set of connected components in G \ (K ∪ Z) with y ∈ NG(Bi). We define Y = [ 1≤i≤ℓ Bi ∪ {y}. By Proposition 2.6, Ω = NG(Y ) ∪ {y} and in this case potential maximal clique is characterized by y and Y . To summarize, to enumerate all quasi-cliques corresponding to the last case, we do the following. For every set Z of size at most 5√k, we construct a minimal triangulation H of G \ Z. The amount of maximal cliques in a chordal graph H is at most n, and for every maximal clique K of H and for every y ∈ Z, we compute the set Y . We use Propositions 2.7 to check if NG(Y ) ∪ {y} is a 10 u Y Nv Nuv v Nu 1: Figure N u, N v, Nuv,{u},{v}, and Y . Partitioning of potential maximal clique Ω into sets potential maximal clique. The total running time to enumerate quasi-cliques in this case is bounded, up to polynomial factor, by the amount of subsets of size O(√k) in G which is nO(√k). Now we are ready to prove the result about vital potential maximal cliques in non-reducible graphs. Lemma 4.2. Let (G, k) be a non-reducible instance of the problem. All vital potential maximal cliques in G can be enumerated within time nO(√k), where n is the number of vertices in G. Proof. We start by enumerating all vertex subsets of G of size at most 5√k + 2 and apply Proposition 2.7 to check if each such set is a vital potential maximal clique or not. Let Ω be a vital potential maximal clique with at least 5√k + 3 vertices and let Y ⊆ Ω be the set of vertices of Ω such that each vertex of Y is adjacent in G to at most Ω − 1 − √k vertices of Ω. To turn Ω into a complete graph, for each vertex v ∈ Y , we have to add at least √k fill edges incident to v. Hence Y ≤ 2√k. If Ω \ Y is a clique, then Ω is a quasi-clique. By Lemma 4.1, all quasi-cliques can be enumerated in time nO(√k). If Ω \ Y is not a clique, there is at least one pair of non-adjacent vertices u, v ∈ Ω \ Y . By Proposition 2.5, there is a connected component C of G \ Ω such that u, v ∈ N (C). Claim 1. There is w ∈ C such that Ω \ N (w) ≤ 5√k + 2. Proof. Targeting towards a contradiction, we assume that the claim does not hold. We define the following subsets of Ω \ Y . • N u ⊆ Ω \ Y is the set of vertices which are not adjacent to u, • N v ⊆ Ω \ Y is the set of vertices which are not adjacent to v, and • Nuv = Ω \ (Y ∪ N u ∪ N v) is the set of vertices adjacent to u and to v. 11 See Fig. 1 for an illustration. Let us note that Ω = N u ∪ N v ∪ Nuv ∪ {u} ∪ {v} ∪ Y. Since u, v 6∈ Y , we have that max{N u,N v} ≤ √k. We claim that Nuv ≤ √k. Targeting towards a contradiction, let us assume that Nuv > √k. By our assumption, every vertex w ∈ C is not adjacent to at least 5√k+2 vertices of Ω. Since Y ∪N u∪N v∪{u}∪{v} ≤ 2√k+√k+√k+2 = 4√k + 2, we have that each vertex of C is nonadjacent to at least √k vertices of Nuv. We take a shortest uv-path P with all internal vertices in C. Because C is a connected component and u, v ∈ N (C), such a path exists. Every internal vertex of P is nonadjacent to at least √k vertices of Nuv ⊆ N (u) ∩ N (v), and thus the visibility of Nuv from P is obscured. But this is a contradiction to the assumption that (G, k) is non-reducible. Hence Nuv ≤ √k. Thus if the claim does not hold, we have that Ω = N u ∪ N v ∪ Nuv ∪ {u} ∪ {v} ∪ Y ≤ 5√k + 2, but this contradicts to the assumption that Ω ≥ 5√k + 3. This concludes the proof of the claim. We have shown that for every vital potential maximal clique Ω of size at least 5√k + 3, there is a connected component C and w ∈ C such that Ω \ N (w) ≤ 5√k + 2. Let H be the graph obtained from G by completing N (w) into a clique. The graph H[Ω] consist of a clique plus at most 5√k + 2 vertices. We want to show that Ω is a quasi-clique in H, by arguing that Ω is a potential maximal clique in H. Vertex set Ω is a potential maximal clique in G, and thus by Proposition 2.5, there is no full component associated to Ω in G\ Ω. Because N (w) ∩ Ω ⊆ N (C) ⊂ Ω, there is no full component associated to Ω in H. We use Proposition 2.5 to show that Ω is a potential maximal clique in H as well. Hence Ω is a quasi-clique in H. To conclude, we use the following strategy to enumerate all vital potential maximal cliques. We enumerate first all quasi-cliques in G in time nO(√k) by making use of Lemma 4.1, and for each quasi-clique we use Proposition 2.7 to check if it is a vital potential maximal clique. We also try all vertex subsets of size at most 5√k + 2 and check if each of such sets is a vital potential maximal clique. All vital potential maximal cliques which are not enumerated prior to this moment should satisfy the condition of the claim. As we have shown, each such vital potential maximal clique is a quasi-clique in the graph H obtained from G by selecting some vertex w and turning NG(w) into clique. Thus for every vertex w of G, we construct graph H and then use Lemma 4.1 to enumerate all quasi-cliques in H. For each quasi-clique of H, we use Proposition 2.7 to check if it is a vital potential maximal clique in G. The total running time of this procedure is nO(√k). 12 5 Exploring remaining solution space For an instance (G, k) of Minimum Fill-in, let Πk be the set of all vital po- tential maximal cliques. In this section, we give an algorithm of running time O(nmΠk), where n is the number of vertices and m the number of edges in G. The algorithm receives (G, k) and Πk as an input, and decides if (G, k) is a YES instance. The algorithm is a modification of the algorithm from [23]. The only difference is that the algorithm from [23] computes an optimum triangulation from the set of all potential maximal cliques while here we have to work only with vital potential maximal cliques. For reader's convenience we provide the full proof, but first we need the following lemma. Lemma 5.1. Let S be a minimal separator in G and let C be a full connected component of G\ S associated to S. Then every minimal triangulation H of GS contains a maximal clique K such that S ⊂ K ⊆ S ∪ C. Proof. By Proposition 2.4, H is a minimal triangulation of GS if and only if H[S ∪ C] is a minimal triangulation of GS[S ∪ C]. Because S is a clique GS[S] in, S is a subset of some maximal clique K of H[S ∪ C]. By definition K is a potential maximal clique in GS[S ∪ C], and by Proposition 2.5 K is a potential maximal clique in G. Since GS[S ∪ C]\ S has a full component associated to S, we have that by Proposition 2.5, S is not a potential maximal clique in GS[S∪C] and thus S ⊂ K. Lemma 5.2. Given a set of all vital potential maximal cliques Πk of G, it can be decided in time O(nmΠk) if (G, k) is a YES instance of Minimum Fill-in. Proof. Let mfi(G) be the minimum number of fill edges needed to triangulate G. Let us remind that by fillG(Ω) we denote the number of non-edges in G[Ω] and by GΩ the graph obtained from G by completing Ω into a clique. If mfi(G) ≤ k, then by Proposition 2.4, we have that mfi(G) = min Ω∈Πk [fillG(Ω) + X C is a component of G\Ω mfi(GΩ[C ∪ NG(C)])]. (1) Formula (1) can be used to compute mfi(G), however by making use of this formula we are not able to obtained the claimed running time. To implement the algorithm in time O(nmΠk), we compute mfi(GΩ[C∪NG(C)])] by dynamic programming. By Proposition 2.5, for every connected component C of G\Ω, where Ω ∈ Πk, S = NG(C) ⊂ Ω is a minimal separator. We define the set ∆k as the set of all minimal separators S, such that S = N (C) for some connected component C in G \ Ω for some Ω ∈ Πk. Since for every Ω ∈ Πk the number of components in G \ Ω is at most n, we have that ∆k ≤ nΠk. For S ∈ ∆k and a full connected component C of G\ S associated to S. We define ΠS,C as the set of potential maximal cliques Ω ∈ Πk such that S ⊂ Ω ⊆ S ∪ C. The triple (S, C, Ω) was called a good triple in [23]. 13 For every Ω ∈ Πk, connected component C of G \ Ω, and S = N (C), we compute mfi(F ), where F = GΩ[C ∪ S]. We start dynamic programming by computing the values for all sets (S, C) such that Ω = C ∪ S is an inclusion- minimal potential maximal clique. In this case we put mfi(F ) = fill(C ∪ S). Observe that GS[C ∪ S] = GΩ[C ∪ S]. Hence by Lemma 5.1, for every minimal triangulation H of GS, there exists a potential maximal clique Ω in G such that Ω is a maximal clique in H and S ⊂ Ω ⊆ S ∪ C. Thus Ω ∈ ΠS,C. Using this observation, we write the following formula for dynamic programming. mfi(F ) = min Ω′∈ΠS,C [fillF (Ω′) + X C ′ is a component of F\Ω′ mfi(FΩ′ [C′ ∪ N (C′)])]. (2) The fact S ⊂ Ω′ ensures that the solution in (2) can be reconstructed from instances with S ∪ C of smaller sizes. By (1) and (2) we can decide if there exists a triangulation of G using at most k fill edges, and to construct such a triangulation. It remains to argue for the running time. Finding connected components in G \ Ω and computing fill(Ω) can easily been done in O(n + m) time. Furthermore, (1) is applied Πk times in total. The running time of dynamic programming using (2) is proportional to the amount of states of dynamic programming, which is X S∈∆k X C∈G\S ΠS,C The graph G \ Ω contains at most n connected components and thus for every minimal separator, each potential maximal clique is counted at most n times, and thus the amount of the elements in the sum does not exceed nΠk. The total running time is O(nmΠk). 6 Putting things together Now we are in the position to prove the main result of this paper. Theorem 6.1. The Minimum Fill-in problem is solvable in time O(2O(√k log k)+ k2nm). Proof. Step A. Given instance (G, k) of the Minimum Fill-in problem, we use Proposition 2.8 to obtain a kernel (G′, k′) on O(k2) vertices and with k′ ≤ k. Let us note that (G, k) is a YES instance if and only if (G′, k′) is a YES instance. This step is performed in time O(k2nm). Step B1. We use Branching Rule 1 on instance (G′, k′). Since the number of vertices in G′ is O(k2), we have that by Lemma 3.3, the result of this procedure is the set of (k2)O(√k) = 2O(√k log k) non-reducible instances (G1, k1), . . . , (Gp, kp). For each i ∈ {1, 2, . . . , p}, graph Gi has O(k2) vertices and ki ≤ k. Moreover, by Lemma 3.1, (G′, k′), and thus (G, k), is a YES instance if and only if at least 14 one (Gi, ki) is a YES instance. By Lemma 3.3, the running time of this step is 2O(√k log k). Step B2. For each i ∈ {1, 2, . . . , p}, we list all vital potential maximal cliques of graph Gi. By Lemma 4.2, the amount of all vital potential maximal cliques in non-reducible graph Gi is 2O(√k log k) and they can be listed within the same running time. Step C. At this step for each i ∈ {1, 2, . . . , p}, we are given instance (Gi, ki) together with the set Πki of vital potential maximal cliques of Gi computed in Step B2. We use Lemma 5.2 to solve the Minimum Fill-in problem for instance (Gi, ki) in time O(k6Πki) = 2O(√k log k). If at least one of the instances (Gi, ki) is a YES instance, then by Lemma 3.1, (G, k) is a YES instance. If all instances (Gi, ki) are NO instances, we conclude that (G, k) is a NO instance. Since p = 2O(√k log k), we have that Step C can be performed in time 2O(√k log k). The total running time required to perform all steps of the algorithm is O(2O(√k log k) + k2nm). Let us remark that our decision algorithm can be easily adapted to output the optimum fill-in of size at most k. 7 Applications to other problems The algorithm described in the previous section can be modified to solve several related problems. Problems considered in this section are Minimum Chain Completion, Chordal Graph Sandwich, and Triangulating Colored Graph. Minimum Chain Completion. Bipartite graph G = (V1, V2, E) is a chain graph if the neighbourhoods of the nodes in V1 forms a chain, that is there is an ordering v1, v2, . . . , vV1 of the vertices in V1, such that N (v1) ⊆ N (v2) ⊆ . . . ⊆ N (vV1). Minimum Chain Completion Input: A bipartite graph G = (V1, V2, E) and integer k ≥ 0. Question: Is there F ⊆ V1 × V2, F ≤ k, such that graph H = (V1, V2, E ∪ F ) a chain graph? Yannakakis in his famous NP-completeness proof of Minimum Fill-in [52] used the following observation. Let G be a bipartite graph with bipartitions V1 and V2, and let G′ be cobipartite (the complement of bipartite) graph formed by turning V1 and V2 into cliques. Then G can be transformed into a chain graph by adding k edges if and only if G′ can be triangulated with k edges. By Theorem 6.1, we have that Minimum Chain Completion is solvable in O(2O(√k log k) + k2nm) time. 15 In the chordal graph sandwich problem we are Chordal graph sandwich. given two graphs G1 = (V, E1) and G2 = (V, E2) on the same vertex set V , and with E1 ⊂ E2. The Chordal Graph Sandwich problem asks if there exists a chordal graph H = (V, E1 ∪ F ) sandwiched in between G1 and G2, that is E1 ∪ F ⊆ E2. Chordal Graph Sandwich Input: Two graphs G1 = (V, E1) and G2 = (V, E2) such that E1 ⊂ E2, and k = E2 \ E1. Question: Is there F ⊆ E2 \ E1, F ≤ k, such that graph H = (V, E1 ∪ F ) is a triangulation of G1? Let us remark that the Chordal Graph Sandwich problem is equivalent to asking if there is a minimal triangulation of G1 sandwiched between G1 and G2. To solve Chordal Graph Sandwich we cannot use the algorithm from Section 6.1 directly. The reason is that we are only allowed to add edges from E2 as fill edges. We need a kernelization algorithm for this problem as well. Lemma 7.1. Chordal Graph Sandwich has a kernel with vertex set of size O(k3). The running time of kernelization algorithm is O(k2nm). Proof. To simplify notations, we denote an instance of the Chordal Graph Sandwich problem by (G, E′, k), where G1 = G = (V, E), E′∩E = ∅, k ≤ E′, and G2 = (V, E ∪ E′). We first define two reduction rules and prove their correctness. No-cycle-vertex Rule. If instance (G, E′, k) has u ∈ V such that for each connected component C of G[V \ N [u]], N (C) is a clique, then replace instance (G, E′, k) with instance (G \ {u}, E′′, k′), where E′′ ⊆ E′ are the edges not incident to u and k′ = k − E′ \ E′′. Claim 2. No-cycle-vertex Rule is sound, i.e. (G \ {u}, E′′, k′) is an YES in- stance of the chordal sandwich problem if and only if (G, E′, k) is an YES in- stance. Proof. Let Gu be the graph G[V \ {u}]. Chordallity is a hereditary property so if H = (V, E ∪ F ) is a triangulation of G where F ≤ k, then H[V \ {u}] is a triangulation of Gu where the set of fill edges are the edges of F not incident to u. For the opposite direction assume that Hu = (V (Gu), E(Gu) ∪ Fu) is a minimal triangulation of Gu where Fu ≤ k. Our objective now is to argue that H = (V, E ∪ Fu) is a triangulation of G. Targeting towards a contradiction, let us assume that W = uaw1w2 . . . wℓbu is a chordless cycle of length at least four in H. Then notice that u is a vertex of W as Hu = H[V \{u}] is a chordal graph by our assumption. Vertices a and b of W are not adjacent by definition, and let vertices w1w2 . . . wℓ be contained in the connected component C of G[V \ N [u]. 16 Nonadjacent vertices a, b are now contained in N (C) which is a contradiction to the condition of applying No-cycle-vertex Rule. For each pair of nonadjacent vertices x, y ∈ V , we define Ax,y as the set of vertices such that w ∈ Ax,y if x, y ∈ NG(w) and vertices x, y are contained in the same connected component of G[(V \ N [w]) ∪ {x, y}]. Safe-edge Rule. instance (G, E′, k) then If 2k < Ax,y for some pair of vertices x, y in a problem • replace instance (G, E′, k) with a trivial NO instance if xy 6∈ E′, and • otherwise with instance (G = (V, E ∪ {xy}), E′ \ {xy}, k − 1). the instance outputted by the rule is Claim 3. Safe-edge Rule is sound, i.e. a YES instance of the chordal sandwich problem if and only if (G, E′, k) is an YES instance. Proof. By the definition of Ax,y, it is not hard to see that there exists an induced cycle of length at least four consisting of x, w, y and a shortest induced path from x to y in G[(V \ N [w])∪{x, y}]. A trivial observation is that every triangulation of G either has xy as a fill edge, or there exists a fill edge incident to w. Since 2k < Axy, we have that every minimal triangulation not using xy as a fill edge has at least one fill edge incident to each vertices in Auv, and thus (G, E′, k) is a NO instance if xy 6∈ E′ and xy ∈ F for every edge set F ⊆ E′ such that H = (V, E ∪ F ) is chordal. It is possible to show that exhausting application of both No-cycle-vertex and Safe-edge rules either results in a polynomial kernel or a trivial recognizable NO instance. However, the running time of the algorithm would be O(kn2m). In what follow, we show that with much more careful implementation of rules, it is possible to obtain a kernel of size O(k3) in time O(k2nm). The algorithm uses the same approach as the kernel algorithms given in [37] and [43] for Minimum Fill-in. Let (G, E′, k) be an instance of the problem. We give an algorithm with running time O(k2nm) that outputs an instance (G′, E′′, k′) such that V (G′) ≤ 32k3 + 4k and (G′, E′′, k′) is a YES instance if and only if (G, E′, k) is a YES instance. Let us remark that we put no efforts to optimize the size of the kernel. Let A, B be a partitioning of the vertices of graph G in the given instance (G, E′, k). Initially we put A = ∅ and B = V (G). There is a sequence of procedures. To avoid a confusing nesting of if-then-else statements, we use the following convention: The first case which applies is used first in the procedure. Thus, inside a given procedure, the hypotheses of all previous procedures are assumed false. P1: If 4k < A then return a trivial NO instance, else if G[B] contains a chordless cycle W of length at least four, move V (W ) from B to A. 17 P2: If 4k < A then return a trivial NO instance, else if G[B] contains a chordless path P of at least two vertices which is also an induced subgraph of a chordless cycle W of G of length at least four, move V (P ) from B to A. P3: Compute Ax,y for each pair of vertices in A. P4: If Ax,y ≤ 2k then move Ax,y from B to A, else if xy 6∈ E′ return a trivial NO instance, else add edge xy to F . P5: Delete every vertex of B. Now we argue on the correctness and running time required to implement the procedures. P1: Every cordless cycle of length 4 ≤ ℓ requires at least ℓ − 3 fill edges to be triangulated [37]. Thus, at least one fill edge has to be added for each 4 vertices moved to A, and we have a NO instance if 4k < A. A chordless cycle of a non chordal graph can be obtained in O(n + m) time [49]. Total running time is O(k(n + m)). P2: Let P be an induced path which is an induced subgraph of a chordless cycle W in a graph G. Then any triangulation of G will add at least V (P )−1 fill edges incident to vertices in P [37]. Thus, 2 end points of a fill edge(equivalently to one fill edge) has to be added for each 4 vertices moved to A, and we have a NO instance if 4k < A. A path P can be obtained as follows: Let u be an end vertex of P and let x be the unique neighbour of u in A on the cycle W . We have a chordless cycle W satisfying the conditions if there is a path from (N (u)∩ B)\ N (x) to a vertex in N (x)\ N (u) not using vertices of N (x)∩ N (u). Such a path can trivially be found in O(m) time. Thus the time required to this step is O(knm). P3: Let x, y be nonadjacent vertices of A. For each vertex w ∈ N (x)∩N (y)∩ B check if there is a path from x to y avoiding N [w], if so there is a chordless cycle containing xwy as consecutive vertices. Running time is O(k2nm) because A is O(k). P4: If Ax,y > 2k then by the Safe-edge Rule, it is safe to add edge xy if xy ∈ E′, and to return a trivial NO instance if xy 6∈ E′. Running time for this step is O(k2n). P5: For every remaining vertex u ∈ B, No-cycle-vertex Rule can be applied, and vertex u can safely be deleted from the graph M = (V, E∪F ). Let us on the contrary assume that this is not the case. Then one can find two nonadjacent vertices a, b ∈ NM (u) and connected component C of M \ NM [w] such that a, b ∈ NM (C). Let W be the chordless cycle of length at least four, obtained by yux and a shortest chordless path from x to y in M [C ∪ {x, y}]. By P1, at least one vertex of W is contained in A and by P2, no two consecutive vertices of W are contained in B. By our assumption u ∈ B, so x, y ∈ A by P2. Vertex u is contained in N (x) ∩ N (y) because during P3 we add edges only between vertices in A. Furthermore, u ∈ Ax,y because otherwise by [37, Theorem 2.10], u would already have been moved to A by P2. Since xy 6∈ F and u ∈ Ax,y ∩ B, we have a contradiction to P4. 18 Let G′ = (A, E(G[A] ∪ F ) and let E′′ be the edges in E′ \ F where both endpoints are incident to vertices of A. Since (G′, E′′, k − F) is obtained by applying Safe-edge Rule on each edge in F and No-cycle-vertex Rule on each vertex in B, we have that instance (G′, E′′, k − F) is a YES instance if and only if (G, E′, k) is a YES instance, Finally, A ≤ 32k3 + 4k because during P1 and P2 we move in total at most 4k vertices from B to A, and during P3 at most 2k · (4k)2 vertices to A. Theorem 7.2. Chordal Sandwich Problem is solvable in time O(2O(√k log k)+ k2nm). Proof. Let (G1, G2, k) be an instance of the problem. We sketch the proof by following the steps of the proof of Theorem 6.1 and commenting on the differences. Step A: We use Lemma 7.1, to obtain in time O(k2nm) kernel (G′1, G′2, k′) such that V (G′1) = O(k3) and k′ ≤ k. Step B1: On kernel we use Branching Rule 1 exhaustively, with the adaptation that every instance defined by fill edge set Fi where Fi 6⊆ E2 is discarded. Thus we obtain 2O(√k log k) non-reducible instances. Step B2: For each non-reducible instance (Gi 2, ki), we enumerate vital potential maximal cliques of Gi 1 but discard all potential maximal cliques that are not cliques in Gi 2. Step C: Solve the remaining problem in time proportional to the number of vital potential maximal cliques in G′1 that are also cliques in Gi 2. This step is almost identical to Step C of Theorem 6.1. 1, Gi Triangulating Colored Graph. In the Triangulating Colored Graph problem we are given a graph G = (V, E) with a partitioning of V into sets V1, V2, . . . , Vc, a colouring of the vertices. Let us remark that this coloring is not necessarily a proper coloring of G. The question is if G can be triangulated without adding edges between vertices in the same set (colour). Triangulating Colored Graph Input: A graph G = (V, E), a partitioning of V into sets V1, V2, . . . , Vc, and an integer k. Question: Is there F ⊆ [V ]2, F ≤ k, and such that for each uv ∈ F , u, v 6∈ Vi, 1 ≤ i ≤ c, and graph H = (V, E1 ∪ F ) is a triangulation of G? Triangulating Colored Graph can be trivially reduced to Chordal Graph Sandwich by defining G1 = G, and the edge set of graph G2 as the edge set of G1 plus the set of all vertex pairs of different colors. Thus by Theorem 7.2, Triangulating Colored Graph is solvable in time O(2O(√k log k) + k2nm). 8 Conclusions and open problems In this paper we gave the first parameterized subexponential time algorithm solving Minimum Fill-in in time O(2O(√k log k) + k2nm). It would be interest- ing to find out how tight is the exponential dependence, up to some complexity 19 assumption, in the running time of our algorithm. We would be surprised to hear about time 2o(√k)nO(1) algorithm solving Minimum Fill-in. For example, such an algorithm would be able to solve the problem in time 2o(n). However, the only results we are aware in this direction is that Minimum Fill-in can- not be solved in time 2o(k1/6)nO(1) unless the ETH fails [14]. See [33] for more information on ETH. Similar uncertainty occurs with a number of other graph problems expressible in terms of vertex orderings. Is it possible to prove that unless ETH fails, there are no 2o(n) algorithms for Treewidth, Minimum In- terval Completion, and Optimum Linear Arrangement? Here the big gap between what we suspect and what we know is frustrating. On the other hand, for the Triangulated Colored Graph problem, which we are able to solve in time O(2O(√k log k) + k2nm), Bodlaender et al. [6] gave a polynomial time reduction that from a 3-SAT formula on p variables and q clauses constructs an instance of Triangulated Colored Graph. This instance has 2 + 2p + 6q vertices and a triangulation of the instance respecting its colouring can be obtained by adding of at most (p + 3q) + (p + 3q)2 + 3pq edges. Thus up to ETH, Triangulated Colored Graph and Chordal Graph Sandwich cannot be solved in time 2o(√k)nO(1). The possibility of improving the nm factor in the running time O(2O(√k log k)+ k2nm) of the algorithm is another interesting open question. The factor nm appears from the running time required by the kernelization algorithm to iden- tify simplicial vertices. Identification of simplicial vertices can be done in time O(min{mn, nω log n}), where ω < 2.37 is the exponent of matrix multiplication [32, 39]. Is the running time required to obtain a polynomial kernel for Min- imum Fill-in is at least the time required to identify a simplicial vertex in a graph and can search of a simplicial vertex be done faster than finding a triangle in a graph? Finally, there are various problems in graph algorithms, where the task is to find a minimum number of edges or vertices to be changed such that the resulting graph belongs to some graph class. For example, the problems of completion to interval and proper interval graphs are fixed parameter tractable [31, 36, 37, 50]. Can these problems be solved by subexponential parameterized algorithms? Are there any generic arguments explaining why some FPT graph modification problems can be solved in subexponential time and some can't? Acknowledgement We are grateful to Marek Cygan and Saket Saurabh for discussions and useful suggestions. References [1] N. Alon, D. Lokshtanov, and S. Saurabh, Fast FAST, in ICALP, vol. 5555 of LNCS, Springer, 2009, pp. 49 -- 58. [2] C. Beeri, R. Fagin, D. Maier, and M. Yannakakis, On the desirability of acyclic database schemes, J. ACM, 30 (1983), pp. 479 -- 513. 20 [3] J. R. S. Blair and B. W. Peyton, An introduction to chordal graphs and clique trees, in Graph Theory and Sparse Matrix Computations, Springer, 1993, pp. 1 -- 30. IMA Volumes in Mathematics and its Applications, Vol. 56. [4] H. Bodlaender, P. Heggernes, and Y. Villanger, Faster parameterized algorithms for minimum fill-in, Algorithmica, (to appear). [5] H. L. Bodlaender, M. R. Fellows, M. T. Hallett, T. Wareham, and T. Warnow, The hardness of perfect phylogeny, feasible register assignment and other problems on thin colored graphs, Theor. Comput. Sci., 244 (2000), pp. 167 -- 188. [6] H. L. Bodlaender, M. R. Fellows, and T. Warnow, Two strikes against perfect phylogeny, in ICALP, vol. 623 of LNCS, Springer, 1992, pp. 273 -- 283. [7] M. L. Bonet, C. A. Phillips, T. Warnow, and S. Yooseph, Constructing evolutionary trees in the presence of polymorphic characters, in STOC, ACM, 1996, pp. 220 -- 229. [8] V. Bouchitt´e and I. Todinca, Treewidth and minimum fill-in: Grouping the minimal separators, SIAM J. Comput., 31 (2001), pp. 212 -- 232. [9] , Listing all potential maximal cliques of a graph, Theor. Comput. Sci., 276 (2002), pp. 17 -- 32. [10] P. Buneman, A characterisation of rigid circuit graphs, Discrete Math., 9 (1974), pp. 205 -- 212. [11] L. Cai, Fixed-parameter tractability of graph modification problems for hereditary properties, Inf. Process. Lett., 58 (1996), pp. 171 -- 176. [12] L. S. Chandran and F. Grandoni, A linear time algorithm to list the minimal separators of chordal graphs, Discrete Mathematics, 306 (2006), pp. 351 -- 358. [13] F. R. K. Chung and D. Mumford, Chordal completions of planar graphs, J. Comb. Theory, Ser. B, 62 (1994), pp. 96 -- 106. [14] M. Cygan, Private communication. 2011. [15] T. A. Davis, Direct methods for sparse linear systems, vol. 2 of Fundamentals of Algorithms, Society for Industrial and Applied Mathematics (SIAM), Philadel- phia, PA, 2006. [16] E. D. Demaine, F. V. Fomin, M. Hajiaghayi, and D. M. Thilikos, Subex- ponential parameterized algorithms on graphs of bounded genus and H-minor-free graphs, J. Assoc. Comput. Mach., 52 (2005), pp. 866 -- 893. [17] R. Diestel, Graph theory, vol. 173 of Graduate Texts in Mathematics, Springer- Verlag, Berlin, third ed., 2005. [18] G. A. Dirac, On rigid circuit graphs, Abh. Math. Sem. Univ. Hamburg, 25 (1961), pp. 71 -- 76. [19] R. G. Downey and M. R. Fellows, Parameterized complexity, Springer-Verlag, New York, 1999. [20] T. Feder, H. Mannila, and E. Terzi, Approximating the minimum chain completion problem, Inf. Process. Lett., 109 (2009), pp. 980 -- 985. [21] J. Flum and M. Grohe, Parameterized Complexity Theory, Texts in Theoretical Computer Science. An EATCS Series, Springer-Verlag, Berlin, 2006. 21 [22] F. V. Fomin and D. Kratsch, Exact Exponential Algorithms, An EATCS Series: Texts in Theoretical Computer Science, Springer, 2010. [23] F. V. Fomin, D. Kratsch, I. Todinca, and Y. Villanger, Exact algorithms for treewidth and minimum fill-in, SIAM J. Comput., 38 (2008), pp. 1058 -- 1079. [24] F. V. Fomin and Y. Villanger, Finding induced subgraphs via minimal trian- gulations, in STACS, vol. 5 of LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2010, pp. 383 -- 394. [25] D. R. Fulkerson and O. A. Gross, Incidence matrices and interval graphs, Pacific J. Math., 15 (1965), pp. 835 -- 855. [26] M. R. Garey and D. S. Johnson, Computers and Intractability, A Guide to the Theory of NP-Completeness, W.H. Freeman and Company, New York, 1979. [27] D. Geman, Random fields and inverse problems in imaging, in ´Ecole d'´et´e de Probabilit´es de Saint-Flour XVIII -- 1988, vol. 1427 of Lecture Notes in Math., Springer, Berlin, 1990, pp. 113 -- 193. [28] M. C. Golumbic, Algorithmic Graph Theory and Perfect Graphs, Academic Press, New York, 1980. [29] M. C. Golumbic, H. Kaplan, and R. Shamir, Graph sandwich problems, J. Algorithms, 19 (1995), pp. 449 -- 473. [30] P. Heggernes, Minimal triangulations of graphs: A survey, Discrete Mathemat- ics, 306 (2006), pp. 297 -- 317. [31] P. Heggernes, C. Paul, J. A. Telle, and Y. Villanger, Interval completion with few edges, in STOC, 2007, pp. 374 -- 381. [32] P. Heggernes, J. A. Telle, and Y. Villanger, Computing minimal trian- gulations in time O(nα log n) = o(n2.376), SIAM J. Discrete Math., 19 (2005), pp. 900 -- 913. [33] R. Impagliazzo, R. Paturi, and F. Zane, Which problems have strongly expo- nential complexity?, J. Comput. Syst. Sci., 63 (2001), pp. 512 -- 530. [34] M. Jurdzinski, M. Paterson, and U. Zwick, A deterministic subexponential algorithm for solving parity games, SIAM J. Comput., 38 (2008), pp. 1519 -- 1532. [35] S. Kannan and T. Warnow, Triangulating 3-colored graphs, SIAM J. Discrete Math., 5 (1992), pp. 249 -- 258. [36] H. Kaplan, R. Shamir, and R. E. Tarjan, Tractability of parameterized com- pletion problems on chordal and interval graphs: Minimum fill-in and physical mapping, in FOCS, IEEE, 1994, pp. 780 -- 791. [37] H. Kaplan, R. Shamir, and R. E. Tarjan, Tractability of parameterized com- pletion problems on chordal, strongly chordal, and proper interval graphs, SIAM J. Comput., 28 (1999), pp. 1906 -- 1922. [38] T. Kloks, D. Kratsch, and J. Spinrad, On treewidth and minimum fill-in of asteroidal triple-free graphs, Theor. Comput. Sci., 175 (1997), pp. 309 -- 335. [39] D. Kratsch and J. Spinrad, Between O(nm) and O(nα), SIAM J. Comput., 36 (2006), pp. 310 -- 325. [40] S. L. Lauritzen and D. J. Spiegelhalter, Local computations with proba- bilities on graphical structures and their application to expert systems, J. Royal Statist. Soc. B, 50 (1988), pp. 157 -- 224. 22 [41] H. Mannila and E. Terzi, Nestedness and segmented nestedness, in KDD '07, New York, NY, USA, 2007, ACM, pp. 480 -- 489. [42] A. Natanzon, R. Shamir, and R. Sharan, A polynomial approximation algo- rithm for the minimum fill-in problem, in STOC, 1998, pp. 41 -- 47. [43] A. Natanzon, R. Shamir, and R. Sharan, A polynomial approximation algo- rithm for the minimum fill-in problem, SIAM J. Comput., 30 (2000), pp. 1067 -- 1079. [44] T. Ohtsuki, L. K. Cheung, and T. Fujisawa, Minimal triangulation of a graph and optimal pivoting ordering in a sparse matrix, J. Math. Anal. Appl., 54 (1976), pp. 622 -- 633. [45] S. Parter, The use of linear graphs in Gauss elimination, SIAM Review, 3 (1961), pp. 119 -- 130. [46] B. Patterson and W. Atmar, Nested subsets and the structure of insular mam- malian faunas and archipelagos, Biological Journal of the Linnean Society, 28 (1986). [47] D. J. Rose, A graph-theoretic study of the numerical solution of sparse positive definite systems of linear equations, in Graph Theory and Computing, R. C. Read, ed., Academic Press, New York, 1972, pp. 183 -- 217. [48] D. J. Rose, R. E. Tarjan, and G. S. Lueker, Algorithmic aspects of vertex elimination on graphs, SIAM J. Comput., 5 (1976), pp. 266 -- 283. [49] R. E. Tarjan and M. Yannakakis, Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs, SIAM J. Comput., 13 (1984), pp. 566 -- 579. [50] Y. Villanger, P. Heggernes, C. Paul, and J. A. Telle, Interval completion is fixed parameter tractable, SIAM J. Comput., 38 (2009), pp. 2007 -- 2020. [51] S. Wong, D. Wu, and C. Butz, Triangulation of bayesian networks: A re- lational database perspective, in Rough Sets and Current Trends in Computing, vol. 2475 of LNCS, Springer, 2002, pp. 950 -- 950. [52] M. Yannakakis, Computing the minimum fill-in is NP-complete, SIAM J. Alg. Disc. Meth., 2 (1981), pp. 77 -- 79. 23
1904.12804
1
1904
2019-04-29T16:39:50
The I/O complexity of hybrid algorithms for square matrix multiplication
[ "cs.DS" ]
Asymptotically tight lower bounds are derived for the I/O complexity of a general class of hybrid algorithms computing the product of $n \times n$ square matrices combining ``\emph{Strassen-like}'' fast matrix multiplication approach with computational complexity $\Theta{n^{\log_2 7}}$, and ``\emph{standard}'' matrix multiplication algorithms with computational complexity $\Omega\left(n^3\right)$. We present a novel and tight $\Omega\left(\left(\frac{n}{\max\{\sqrt{M},n_0\}}\right)^{\log_2 7}\left(\max\{1,\frac{n_0}{M}\}\right)^3M\right)$ lower bound for the I/O complexity a class of ``\emph{uniform, non-stationary}'' hybrid algorithms when executed in a two-level storage hierarchy with $M$ words of fast memory, where $n_0$ denotes the threshold size of sub-problems which are computed using standard algorithms with algebraic complexity $\Omega\left(n^3\right)$. The lower bound is actually derived for the more general class of ``\emph{non-uniform, non-stationary}'' hybrid algorithms which allow recursive calls to have a different structure, even when they refer to the multiplication of matrices of the same size and in the same recursive level, although the quantitative expressions become more involved. Our results are the first I/O lower bounds for these classes of hybrid algorithms. All presented lower bounds apply even if the recomputation of partial results is allowed and are asymptotically tight. The proof technique combines the analysis of the Grigoriev's flow of the matrix multiplication function, combinatorial properties of the encoding functions used by fast Strassen-like algorithms, and an application of the Loomis-Whitney geometric theorem for the analysis of standard matrix multiplication algorithms. Extensions of the lower bounds for a parallel model with $P$ processors are also discussed.
cs.DS
cs
The I/O complexity of hybrid algorithms for square matrix multiplication Lorenzo De Stefani∗ Department of Computer Science, Brown University April 30, 2019 Abstract Asymptotically tight lower bounds are derived for the I/O complexity of a general class of hybrid algorithms computing the product of n × n square matrices combin- ing "Strassen-like" fast matrix multiplication approach with computational complexity Θ(cid:0)nlog2 7(cid:1), and "standard " matrix multiplication algorithms with computational com- M(cid:19) plexity Ω(cid:0)n3(cid:1). We present a novel and tight Ω(cid:18)(cid:16) lower bound for the I/O complexity a class of "uniform, non-stationary" hybrid algo- rithms when executed in a two-level storage hierarchy with M words of fast memory, where n0 denotes the threshold size of sub-problems which are computed using standard M }(cid:1)3 (cid:0)max{1, n0 n max{√M ,n0}(cid:17)log2 7 algorithms with algebraic complexity Ω(cid:0)n3(cid:1). The lower bound is actually derived for the more general class of "non-uniform, non- stationary" hybrid algorithms which allow recursive calls to have a different structure, even when they refer to the multiplication of matrices of the same size and in the same recursive level, although the quantitative expressions become more involved. Our results are the first I/O lower bounds for these classes of hybrid algorithms. All presented lower bounds apply even if the recomputation of partial results is allowed and are asymptotically tight. The proof technique combines the analysis of the Grigoriev's flow of the matrix multiplication function, combinatorial properties of the encoding functions used by fast Strassen-like algorithms, and an application of the Loomis-Whitney geometric theorem for the analysis of standard matrix multiplication algorithms. Extensions of the lower bounds for a parallel model with P processors are also discussed. ∗[email protected] 1 Introduction Data movement plays a critical role in the performance of computing systems, in terms of both time and energy. This technological trend [28] appears destined to continue, as physical limitations on minimum device size and on maximum message speed lead to inherent costs when moving data, whether across the levels of a hierarchical memory system or between processing elements of a parallel system [10]. While the communication requirements of algorithms have been widely investigated in literature, obtaining significant and tight lower bounds based on such requirements remains an important and challenging task. In this paper, we focus on the I/O complexity of a general class of hybrid algorithms for the computing the product of square matrices which combine. Such algorithms combine fast algorithms with base case 2 × 2 similar to Strassen's matrix multiplication algorithm [35] with algebraic (or computational) complexity O(cid:0)nlog2 7(cid:1) with standard (or classic) matrix multiplication algorithms with algebraic complexity Ω(cid:0)n3(cid:1). Further, these algorithms allow recursive calls to have a different structure, even when they refer to the multiplication of matrices in the same recursive level and of the same input size. These algorithms are referred in literature as "non-uniform, non-stationary". This class includes, for example, algorithms that optimize for input sizes [15, 16, 20]. Matrix multiplication is a pervasive primitive utilized in many applications. While of actual practical importance, to the best of our knowledge, no characterization of the I/O complexity of such algorithms has presented before this work. This is likely due to the the fact that the irregular nature of hybrid algorithms and, hence, the irregular structure of the corresponding Computational Directed Acyclic Graphs (CDAGs), complicates the analysis of the combinatorial properties of the CDAG which is the foundation of many of I/O lower bound technique presented in literature (e.g., [8, 18, 29]). The technique used in this work overcomes such challenges and yields asymptotically tight I/O lower bounds which hold even if recomputation of intermediate values is allowed. Previous and Related Work: Strassen [35] showed that two n × n matrices can be multiplied with O(nω) operations, where ω = log2 7 ≈ 2.8074, hence with asymptotically fewer than the n3 arithmetic operations required by the straightforward implementation of the definition of matrix multiplication. This result has motivated a number of efforts which have lead to increasingly faster algorithms, at least asymptotically, with the current record being at ω < 2.3728639 [24]. I/O complexity has been introduced in the seminal work by Hong and Kung [18]; it is essentially the number of data transfers between the two levels of a memory hierarchy with a fast memory of M words and a slow memory with an unbounded number of words. Hong and Kung presented techniques to develop lower bounds to the I/O complexity of computations modeled by computational directed acyclic graphs (CDAGs). The resulting lower bounds apply to all the schedules of the given CDAG, including those with recomputation, that is, where some vertices of the CDAG are evaluated multiple times. Among other results, they established a Ω(cid:16)n3/√M(cid:17) lower bound to the I/O complexity of standard, definition- based matrix multiplication algorithms, which matched a known upper bound [13]. The techniques of [18] have also been extended to obtain tight communication bounds for the definition-based matrix multiplication in some parallel settings [4, 21, 33] and for the special 1 case of "sparse matrix multiplication" [27]. Ballard et al. generalized the results on matrix multiplication of Hong and Kung [18] in [7, 6] by using the approach proposed in [21] based on the Loomis-Whitney geometric theorem [25, 36]. In an important contribution, Ballard et al. [8], obtained an Ω((n/√M )log2 7M ) I/O lower bound for Strassen's algorithm, using the "edge expansion approach". The authors extend their technique to a class of "Strassen-like" fast multiplication algorithms and to fast recursive multiplication algorithms for rectangular matrices [5]. This result was later generalized to increasingly broader classes of "Strassen-like" algorithms by Scott et. al [31] using the "path routing" technique, and De Stefani [14] using a combination the concept of Grigoriev's flow of a function and the "dichotomy width" technique [9]. While the pre- viously mentioned results hold only under the restrictive assumption that no intermediate result may be more than once (i.e., the no-recomputation assumption), in [11] Bilardi and De Stefani introduced the first asymptotically tight I/O lower bound which holds if re- computation is allowed. Their technique was later extended to the analysis of Strassen-like algorithms with base case 2×2 [26], and to the analysis of Toom-Cook integer multiplication algorithms [12]. A parallel, "communication avoiding" implementation of Strassen's algorithm whose performance matches the known lower bound [8, 31], was proposed by Ballard et al. [3]. A communication efficient algorithm for the special case of sparse matrices based on Strassen's algorithm was presented in [22]. In [32], Scott derived a lower bound for the I/O complexity of a class of uniform, non- stationary algorithms combining Strassen-like algorithm with recursive standard algorithms. This result holds only under the restrictive no-recomputation assumption. To the best of our knowledge, ours is the first work presenting asymptotically tight I/O lower bounds for non-uniform, non-stationary hybrid algorithms for matrix multiplication that hold when recomputation is allowed. Our results: We present the first I/O lower bound for a class H of non-uniform, non- stationary hybrid matrix multiplication algorithms when executed in a two-level storage hierarchy with M words of fast memory. Algorithms in H combine fast Strassen-like algo- rithms with base case 2 × 2 with algebraic complexity Θ(cid:0)nlog2 7(cid:1), and standard algorithms based on the definition with algebraic complexity Ω(cid:0)n3(cid:1). These algorithms allow recursive calls to have a different structure, even when they refer to the multiplication of matrices in the same recursive level and of the same input size. The result in Theorem 7 relates the I/O complexity of algorithms in H to the number and the input size of an opportunely selected set of the sub-problems generated by the algorithms themselves. n max{√M,n0}(cid:17)log2 7 M }(cid:1)3 M(cid:19) lower bound for the I/O complexity of algorithms in a subclass UH (n0) of H composed by uniform non-stationary hybrid algorithms where n0 denotes the threshold size of sub-problems which We also present, in Theorem 9, a novel Ω(cid:18)(cid:16) (cid:0)max{1, n0 are computed using standard algorithms with algebraic complexity Ω(cid:0)n3(cid:1). The previous result by Scott [32] covers only a sub-class of UH (n0) composed by uniform, non-stationary algorithms combining Strassen-like algorithms with the recursive standard algorithm, and holds only assuming that no intermediate value is recomputed. Instead, all our bounds allow for recomputation of intermediate values and are asymptotically tight. 2 As the matching upper bounds do not recompute any intermediate value, we conclude that using recomputation may reduce the I/O complexity of the considered classes of hybrid algorithms by at most a constant factor. Our proof technique is of independent interest since it exploits to a significant extent the "divide and conquer " nature exhibited by many algorithms. Our approach combines elements from the "G-flow " I/O lower bound technique originally introduced by Bilardi and De Stefani, with an application of the Loomis-Whitney geometric theorem, which has been used by Irony et al. to study the I/O complexity of standard matrix multiplication algorithms [21], to recover an information which relates to the concept of Minimum set introduced in Hong and Kung's method. We follow the dominator set approach pioneered by Hong and Kung in [18]. However, we focus the dominator analysis only on a select set of target vertices, which, depending on the algorithm structure, correspond either to the outputs of the sub-CDAGs that correspond to sub-problems of a suitable size (i.e., chosen as a function of the fast memory capacity M ) computed using a fast Strassen-like algorithm, or to the the vertices corresponding to the elementary products evaluated by a standard (definition) matrix multiplication algorithm. We derive our main results for the hierarchical memory model (or external memory model). Our results generalize to parallel models with P processors. For these parallel models, we derive lower bounds for the "bandwith cost", that is for the number of messages (and, hence, the number of memory) that must be either sent or received by at least one processor during the CDAG evaluation. Paper organization: In Section 2 we outline the notation and the computational models used in the rest of the presentation. In Section 3 we rigorously define the class of hybrid ma- trix multiplication algorithms H being considered. In Section 4 we discuss the construction and important properties of the CDAGs corresponding to algorithms in H. In Section 5 we introduce the concept of Maximal Sup-Problem (MSP) and describe their properties which lead to the I/O lower bounds for algorithms in H in Section 6. 2 Preliminaries We consider algorithms that compute the product of two square matrices A × B = C with entries from a ring R. We use A to denote the set variables each corresponding to an entry of matrix A. We refer to the number of entries of a matrix A as its "size" and we denote it as A. We denote the entry on the i-th row of the j-th column of matrix A as A[i][j]. In this work we focus on algorithms whose execution can be modeled as a computational directed acyclic graph (CDAG) G = (V, E). Each vertex v ∈ V represents either an input value or the result of a unit-time operation (i.e., an intermediate result or one of the output values) which is stored using a single memory word. For example, each of the input (resp., output) vertices of G corresponds to one of the 2n2 entries of the factor matrices A and B (resp., to the n2 entries of the product matrix C). The directed edges in E represent data dependencies. That is, a pair of vertices u, v ∈ V are connected by an edge (u, v) directed from u to v if and only if the value corresponding to u is an operand of the unit time operation which computes the value corresponding to v. A directed path connecting 3 vertices u, v ∈ V is an ordered sequence of vertices starting with u and ending with v, such that there is an edge in E directed from each vertex in the sequence to its successor. We say that G′ = (V ′, E′) is a sub-CDAG of G = (V, E) if V ′ ⊆ V and E′ ⊆ E∩(V ′×V ′). Note that, according to this definition, every CDAG is a sub-CDAG of itself. We say that two sub-CDAGs G′ = (V ′, E′) and G′′ = (V ′′, E′′) of G are vertex disjoint if V ′ ∩ V ′′ = ∅. Analogously, two directed paths in G are vertex disjoint if they do not share any vertex. When analyzing the properties of CDAGs we make use of the concept of dominator set originally introduced in [18]. We use the following -- slightly different -- definition: Definition 1 (Dominator set). Given a CDAG G = (V, E), let I ⊂ V denote the set of its input vertices. A set D ⊆ V is a dominator set for V ′ ⊆ V with respect to I′ ⊆ I if every path from a vertex in I′ to a vertex in V ′ contains at least a vertex of D. When I′ = I, D is simply referred as "a dominator set for V ′". I/O model and machine models: We assume that sequential computations are exe- cuted on a system with a two-level memory hierarchy, consisting of a fast memory or cache of size M (measured in memory words) and a slow memory of unlimited size. An operation can be executed only if all its operands are in cache. We assume that each entry of the input and intermediate results matrices (including entries of the output matrix) is maintained in a single memory word (the results trivially generalize if multiple memory words are used). Data can be moved from the slow memory to the cache by read operations and, in the other direction, by write operations. These operations are also called I/O operations. We assume the input data to be stored in slow memory at the beginning of the computation. The evaluation of a CDAG in this model can be analyzed by means of the "red-blue pebble game" [18]. The number of I/O operations executed when evaluating a CDAG depends on the "computational schedule", that is, it depends on the order in which vertices are evaluated and on which values are kept in/discarded from cache. The I/O complexity IOG(M ) of a CDAG G is defined as the minimum number of I/O operations over all possible computational schedules. We further consider a generalization of this model known as the "External Memory Model" by Aggarwal and Vitter [2], where B ≥ 1 values can be moved between cache and consecutive slow memory locations with a single I/O operation. For B = 1, this model clearly reduces to the red-blue pebble game. Given an algorithm A, we only consider "parsimonious execution schedules", that is schedules such that: (i) each time an intermediate result (excluding the output entries of C) is computed, such value is then used to computed to compute at least one of the values of which it is an operand before being removed from the memory (either the cache or slow memory); and (ii) any time an intermediate result is read from slow to cache memory, such value is then used to computed to compute at least one of the values of which it is an operand before being removed from the memory or moved back to slow memory using a write I/O operation. Clearly, any non-parsimonious schedule C can be reduced to a parsimonious schedule C′ by removing all the steps which violate the definition of parsimonious computation. C′ has therefore less computational and I/O operations than C. Hence, restricting the analysis to parsimonious computations leads to no loss of generality. We also consider a parallel model where P processors, each with a local memory of size 2n2/P ≤ M < n2, are connected by a network. We do not, however, make any assumption 4 on the initial distribution of the input data nor regarding the balance of the computational load among the P processors. Processors can exchange point-to-point messages, with every message containing up to Bm memory words. For this parallel model, we derive lower bounds for the number of messages that must be either sent or received by at least one processor during the CDAG evaluation. The notion of "parsimonious execution schedules" straightforwardly extends to this parallel model. 3 Hybrid matrix multiplication algorithms In this work, we consider a family of hybrid matrix multiplication algorithms obtained by hybridizing the two following classes of algorithms: Standard matrix multiplication algorithms: This class includes all the square matrix multiplication algorithms which, given the input factor matrices A, B ∈ Rn×n, satisfy the following properties: • The n3 elementary products A[i][j]B[j][i], for i, j = 0, . . . , n−1, are directly computed; • Each of the C[i][j] is computed by summing the values of the n elementary prod- ucts A[i][z]B[z][j], for z = 0, . . . , n − 1, through a summation tree by additions and subtractions only; • The evaluations of the C[i][j]'s are independent of each other. That is, internal vertex sets of the summation trees of all the C[i][j]'s are disjoint from each other. This class, also referred in literature as classic, naive or conventional algorithms, correspond to that studied for the by Hong and Kung [18] (for the sequential setting) and by Irony et al. [21] (for the parallel setting). Algorithms in this class have computational complexity Ω(cid:0)n3(cid:1). This class includes, among others, the sequential iterative definition algorithm, the sequential recursive divide and conquer algorithm based on block partitioning, and parallel algorithms such as Cannon's "2D " algorithm [13], the "2.5D " algorithm by Solomonik and Demmel [34], and "3D " algorithms [1, 23]. Fast Strassen-like matrix multiplication algorithms with base case 2×2: This class includes algorithms following a structure similar to that of Strassen's [35] (see Appendix B) and Winograd's variation [37] (which reduces the leading coefficient of the arithmetic com- plexity reduced from 7 to 6). Algorithms in this class generally follow three steps: 1. Encoding: Generate the inputs, of size n/2 × n/2 of seven sub-problems, as linear sums of the input matrices; 2. Recursive multiplications: Compute (recursively) the seven generated matrix mul- tiplication sub-products; 3. Decoding: Computing the entries of the product matrix C via linear combinations of the output of the seven sub-problems. 5 Algorithms in this class have algebraic complexity O(cid:0)nlog2 7(cid:1), which is optimal for algo- rithms with base case 2 × 2 [37]. Remarkably, the only properties of relevance for the analysis of the I/O complexity of algorithms in these classes are those used in the characterization of the classes themselves. In this work we consider a general class of non-uniform, non-stationary hybrid square matrix multiplication algorithms, which allow mixing of schemes from the fast Strassen- like class with algorithms from the standard class. Given an algorithm A let P denote the problem corresponding to the computation of the product of the input matrices A and B. Consider an "instruction function" fA(P ), which, given as input P returns either (a) indication regarding the algorithm from the standard class which is to be used to compute P , or (b) indication regarding the fast Strassen-like algorithm to be used to recursively generate seven sub-problems P1, P2, . . . , P7 and the instruction functions fA(Pi) for each of the seven sub-problems. We refer to the class of non-uniform, non-stationary algorithms which can be characterized by means of such instruction functions as H. Algorithms in H allow recursive calls to have a different structure, even when they refer to the multiplication of matrices in the same recursive level. E.g., some of the sub-problems with the same size may be computed using algorithms form the standard class while others may be computed using recursive algorithms from the fast class. This class includes, for example, algorithms that optimize for input sizes, (for sizes that are not an integer power of a constant integer). We also consider a sub-class UH (n0) of H constituted by uniform, non-stationary hybrid algorithms which allow mixing of schemes from the fast Strassen-like class for the initial ℓ recursion levels, and then cut the recursion off once the size the generated sub-problems is smaller or equal to a set threshold n0 × n0, and switch to using algorithm form the standard class. Algorithms in this class are uniform, i.e., sub-problems of the same size are all either recursively computed using a scheme form the fast class, or are all computed using algorithms from the standard class. This corresponds to actual practical scenarios, as the use of Strassen-like algorithms is mostly beneficial for large input size. As the size of the input of the recursively generated sub-problems decreases, the asymptotic benefit of fast algorithms is lost due to the increasing relative impact of the constant multiplicative factor, and algorithms in the standard class exhibit lower actual algebraic complexity. For a discussion on such hybrid algorithms and their implementation issues we refer the reader to [16, 20] (sequential model) and [15] (parallel model). 4 The CDAG of algorithms in H Let GA = (VA, EA) denote the CDAG that corresponds to an algorithm A ∈ H used to multiply input matrices A, B ∈ Rn×n. The challenge in the characterization of GA comes from the fact that rather than considering to a single algorithm, we want to characterize the CDAG corresponding to the class H. Further, the class H is composed by a rich variety of vastly different and irregular algorithm. Despite such variety, we show a general template for the construction of GA and we identify some of it properties which crucially hold regardless of the implementation details of A and, hence, of GA. 6 C[0][0] C[0][1] C[1][0] C[1][1] C1,1 C1,2 C2,1 C2,2 Dec M7 M5 M4 M1 M3 M2 M6 n2 × Dec GAP7 GAP5 GAP4 GAP1 GAP3 GAP2 GAP6 EncA EncB n2 × EncA n2 × EncB A[0][0] A[0][1] A[1][0] A[1][1] B[0][0] B[0][1] B[1][0] B[1][1] A1,1 A1,2 A2,1 A2,2 B1,1 B1,2 B2,1 B2,2 (a) GA CDAG for base case n = 2, using Strassen's algorithm [35] (see Appendix B). (b) Recursive construction of GA. Ai,j, Bi,j and Ci,j denote the block-partition of A, B and C. Figure 1: Blue vertices represent combinations of the input values from the factor matrices A and B used as input values for the seven sub-problems; red vertices represent the output of the seven sub-problems which are used to compute the values of the output matrix C. Construction: GA can be obtained by using a recursive construction that mirrors the recursive structure of the algorithm itself. Let P denote the entire matrix multiplication problem computed by A. Consider the case for which, according to the instruction function fA(P ), P is to be computed using an algorithm from the standard class. As we do not fix a specific algorithm, we do not correspondingly have a fixed CDAG. The only feature of interest for the analysis is that, in this case, the CDAG GA corresponds to the execution of an algorithm from the standard class for input matrices of size n × n. Consider instead the case for which, according to fA(P ), P is to be computed using an algorithm from the fast class. In the base case for n = 2 the problem P is computed without generating any further sub-problems. As an example, we present in Figure 1a the base case for Strassen's original algorithm [35]. If n > 2, then fA(P ) specifies the divide and conquer scheme to be used to generate the seven sub-problems P1, P2, . . . , P7, and the instruction function for each of them. The sub-CDAGs of GA corresponding to each of the seven sub-problems Pi, denoted as GAPi are constructed according to fA(Pi), following recursively the steps discussed previously. GA can then be constructed by composing the seven sub-CDAGs GAPi . n2 disjoint copies of an encoder sub-CDAG EncA (resp., EncB) are used to connect the input vertices of G2n×2n, which correspond to the values of the input matrix A (resp., B) to the appropriate input vertices of the seven sub-CDAGs GAPi ; the output vertices of the sub-CDAGs GAPi (which correspond to the outputs of the seven sub-products) are connected to the appropriate output vertices of the entire GA CDAG using n2 copies of the decoder sub-CDAG Dec. We present an example of such recursive construction in Figure 1b. Properties of GA: While the actual internal structure GA, and, in particular, the struc- ture of encoder and decoder sub-CDAGs depends on the specific Strassen-like algorithm being used by A, all versions share some properties of great importance. Let G(X, Y, E) de- note an encoder CDAG for a fast multiplication algorithm 2×2 base case, with X (resp., Y ) denoting the set of input (resp., output) vertices, and E denoting the set of edges directed from X to Y . 7 Lemma 1 (Lemma 3.3 [26]). Let G = (X, Y, E) denote an encoder graph for a fast matrix multiplication algorithm with base case 2 × 2. There are no two vertices in Y with identical neighbors sets. While the correctness of this Lemma can be simply verified by inspection in the case of Strassen's algorithm [35], Lemma 1 generalizes the statement to all encoders corresponding to fast matrix multiplication algorithms with base case 2 × 2. From Lemma 1 we have: Lemma 2. Let A ∈ H and let P1 and P2 be any two sub-problems generated by A with input size greater than n0 × n0, such that P2 is not recursively generated while computing P1 and vice versa. Then, the sub-CDAGs of GA corresponding, respectively, to P1 and to P2 are vertex disjoint. The following lemma, originally introduced for Strassen's algorithm in [11] and then generalized for Strassen-like algorithms with base case 2×2 in in [26], captures a connectivity property of encoder sub-CDAGs. Lemma 3 (Lemma 3.1 [26]). Given an encoder CDAG for any Strassen-like algorithm with base case 2 × 2, for any subset Y of its output vertices, there exists a subset X of its input vertices, with min{Y , 1 + ⌈(Y − 1) /2⌉} ≤ X ≤ Y , such that there exist X vertex-disjoint paths connecting the vertices in X to vertices in Y . The proofs of Lemma 1 and Lemma 3 are based on an argument originally presented by Hopcroft and Kerr [19]. We refer the reader to [26] for the proofs. 5 Maximal sub-problems and their properties For an algorithm A ∈ H, let P ′ denote a sub-problem generated by A. In our presentation we consider the entire matrix multiplication problem an improper sup-problem generated by A. We refer as the ancestor sub-problems of P ′ as the sequence of sub-problems P ′0, P ′2, . . . , P ′i generated by A such that P ′j+1 was recursively generated to compute P ′j for j = 0, 1, . . . , i−1, and such that P was recursively generated to compute P ′i . Clearly, if P ′ is the entire problem, then P ′ has no ancestors. Towards studying the I/O complexity of algorithms in H we focus on the analysis of a particular set of sub-problems. Definition 2 (Maximal Sub-Problems (MSP)). Let A ∈ H be an algorithm used to multiply matrices A, B ∈ Rn×n. If n ≤ 2√M we say that A does not generate any Maximal Sub- Problem (MSP). Let Pi be a sub-problem generated by A with input size ni × ni, with ni ≥ 2M , and such that all its ancestors sub-problems are computed, according to A using algorithms from the fast class. We say that: • Pi is a Type 1 MSP of A if, according to A, is computed using an algorithm from the standard class. If the entire problem is to be solved using an algorithm for the standard class, we say that the entire problem is the unique (improper) Type 1 MSP generated by A. 8 • Pi is a Type 2 MSP of A if, according to A, is computed by generating 7 sub- problems according to the recursive scheme corresponding to an algorithm from the fast (Strassen-like) class, and if the generated sub-problems have input size strictly smaller than 2√M × 2√M . If the entire problem uses a recursive algorithm from the fast class to generate 7 sub-problems with input size smaller than 2√M × 2√M , we say that the entire problem is the unique, improper, Type 2 MSP generated by A. In the following we denote as ν1 (resp., ν2) the number of Type 1 (resp., Type 2) MSPs generated by A. Let Pi denote the i-th MSP generated by A and let GAPi denote the corresponding sub-CDAG of GA. We denote as Ai and Bi (resp., Ci) the input factor matrices (resp., the output product matrix) of Pi. Properties of MSPs and their corresponding sub-CDAGs: By Definition 2, we have that for each pair of distinct MMSPs P1 and P2, P2 is not recursively generated by A in order to compute P1 or vice versa. Hence, by Lemma 2, the sub-CDAGs of GA that correspond each to one of the MSPs generated by A are vertex, disjoint. In order to obtain our I/O lower bound for algorithms in H, we characterize properties regarding the minimum dominator size of an arbitrary subset of Y and Z. Lemma 4 (Proof in Appendix A.1). Let GA be the CDAG corresponding to an algorithm A ∈ H which admits n1 Type 1 MSPs. For each Type 1 MSP Pi let Y i denote the set of input vertices of the associated sub-CDAG GAPi which correspond each to an entry of the input matrices Ai and Bi. Further, we define Y = ∪ν1 Let Y ⊆ Y in GA such that Y ∩ Y i = ai/√bi, with ai, bi ∈ N, ai ≥ bi for i = 1, 2, . . . , ν1, and such that bi = 0 if and only if ai = 0.1 Any dominator set D of Y satisfies D ≥ min{2M,Pν1 Lemma 5 (Proof in Appendix A.2). Let GA be the CDAG corresponding to an algorithm A ∈ H which admits n2 Type 2 MSPs. Further let Z denote the set of vertices corresponding to the entries of the output matrices of the n2 Type 2 MSPs. Given any subset Z ⊆ Z in GA with Z ≤ 4M , any dominator set D of Z satisfies D ≥ Z/2. i=1 ai/pPν1 i=1Y i. i=1 bi}. For each Type 1 MSP Pi generated by A, with input size2 ni × ni, we denote as Ti the set of variables whose value correspond to the n3 i elementary products Ai[j][k]Bi[k][j] for j, k = 0, 1, . . . , ni − 1. Further, we denote as Ti the set of vertices corresponding to the variables in Ti, and we define T = ∪ν1 Lemma 6 (Proof in Appendix A.3). For any Type 1 MSPs generated by A consider T ′i ⊆ Ti. Let Y (A) i ⊆ Y i) denote a subset of the vertices corresponding to entries of Ai (resp., Bi) which are multiplied in at least one of the elementary products in T ′i . Then any dominator D of the vertices corresponding to T ′i with respect to the the vertices in Y i is such that i ⊆ Y i (resp., Y (B) i=1Ti. 1Here we use as convention that 0/0 = 0. 2In general, different Type 1 MSP may have different input sizes D ≥ max{Y′i ∩ Ai,Y′i ∩ Bi}. 9 6 I/O lower bounds for algorithm in H and UH (n0) Theorem 7. Let A ∈ H be an algorithm to multiply two square matrices A, B ∈ Rn×n. If run on a sequential machine with cache of size M and such that up to B memory words stored in consecutive memory locations can be moved from cache to slow memory and vice versa using a single memory operation, A's I/O complexity satisfies: IOA (n, M, B) ≥ max{2n2, cT M−1/2, ν2M}B−1 (1) for c = 0.38988157484, where T denotes the total number of internal elementary products computed by the Type 1 MSPs generated by A and ν2 denotes the total number of Type 2 MSPs generated by A. If run on P processors each equipped with a local memory of size M < n2 and where for each I/O operation it is possible to move up to Bm words, A's I/O complexity satisfies: IOA (n, M, Bm, P ) ≥ max{cT M−1/2, ν2M} (P Bm)−1 (2) Proof. We prove the result in (1) (resp., (2)) for the case B = 1 (resp., Bm = 1). The result then trivially generalizes for a generic B (resp., Bm). We first prove the result for the sequential case in in (1). The bound for the parallel case in (2) will be obtained as a simple generalization. i=1 Ti. The fact that IOA(n, M, 1) ≥ 2n2 follows trivially from the fact that as in our model the input matrices A and B are initially stored in slow memory, it will necessary to move the entire input to the cache at least once using at least 2n2 I/O operations. If A does not generate any MSPs the statement in (1) is trivially verified. In the following, we assume ν1 + ν2 ≥ 1. Let GA denote the CDAG associated with algorithm A according to the construction in Section 4. By definition, and from Lemma 2, the ν1 + ν2 sub-CDAGs of GA corresponding each to one of the MSPs generated by A are vertex-disjoint. Hence, the Ti's are a partition of T and T =Pν1 By Definition 2, the MSP generated by A have input (resp., output) matrices of size greater or equal to 2√M × 2√M . Recall that we denote as Z the set of vertices which correspond to the outputs of the ν2 Type 2 MSPs, we have Z ≥ 4M νl. Let C be any computation schedule for the sequential execution of A using a cache of size M . We partition C into non-overlapping segments C1,C2, . . . such that during each Cj either (a) exactly M 3/2 distinct values 3 corresponding to vertices in T , denoted as T (j), are explicitly computed (i.e., not loaded from slow memory), or (b) 4M distinct values corresponding to vertices in Z (denoted as Z j) are evaluated for the first time. Clearly there are at least max{T /M 3/2, ν2} such segments. Below we show that the number gj of I/O operations executed during each Cj satisfies gj ≥ cM for case (a) and gj ≥ M for case (b), from which the theorem follows. Case (a): For each Type 1 MSP Pi let T (j) i = T (j) ∩ Ti. As the ν1 sub-CDAGs corresponding each to one of the Type 1 MSPs are vertex-disjoint, so are the sets Ti. Hence, the T (j) 's constitute a partition of T (j). Let Ai and Bi (resp., Ci) denote the i 3For simplicity of presentation, we assume M 3/2 ∈ N+. 10 input matrices (resp., output matrix) of Pi with Ai, Bi, Ci ∈ Rni×ni, and let Ai and Bi (resp., Ci) denote the set of the variables corresponding to the entries of Ai and Bi (resp., Ci). Further, we denote as Ti the set of values corresponding to the vertices in Ti. For r, s = 0, 1, . . . , ni − 1, we say that Ci[r][s] is "active during Cj" if any of the elementary multiplications Ai[r][k]Bi[k][s], for k = 0, 1, . . . , ni − 1, correspond to any of the vertices in T (j) . Further we say that a Ai[r][s] (resp., Bi[r][s]) is "accessed during Cj" if any of the elementary multiplications Ai[r][s]Bi[s][k] (resp., Ai[k][r]Bi[r][s]), for k = 0, 1, . . . , ni − 1, correspond to any of the vertices in T (j) Our analysis makes use of the following property of standard matrix multiplication . i i algorithms: Lemma 8 (Loomis-Whitney inequality [21, Lemma 2.2]). Let Y′i,A (resp., Y′i,B) denote the set of vertices corresponding to the entries of Ai (resp., Bi) which are accessed during Cj, and let Z′i denote the set of vertices corresponding to the entries of Ci which are active during Cj. Then T (j) i ≤qY′i,AY′i,BZ′i. (3) Lemma 8 is a reworked version of a property originally presented by Irony et al. [21, Lemma 2.2], which itself is a consequence of the Loomis-Whitney geometric theorem [25]. Let Ci[r][s] be active during Cj. In order to compute Ci[r][s] entirely during Cj (i.e., without using partial accumulation of the summation Pni−1 it will be necessary to evaluate all the ni elementary products Ai[r][k]Bi[k][s], for k = 0, 1, . . . , ni− 1, during Cj itself. Thus, at most ⌊T (j) /ni⌋ entries of Ci[r][s] can be entirely computed during Cj. Let Ci[r][s] denote an entry of Ci which is active but not entirely computed during Cj. There are two possible scenarios: k=0 Ai[r][k]B[k][s]), i • Ci[r][s] is computed during Cj: The computation thus requires for a partial accumu- lation of Pni−1 k=0 Ai[r][k]B[k][s] to have been previously computed and either held in the cache at the beginning of Cj, or to moved to cache using a read I/O operation during Cj; • Ci[r][s] is not computed during Cj: As C is a parsimonious computation, the partial accumulation of Pni−1 k=0 Ai[r][k]B[k][s] obtained from the elementary products com- puted during Cj must either remain in the cache at the end of Cj, or be moved to slow memory using a write I/O operation during Cj; Let GAPi denote the sub-CDAG of GA corresponding to the Type 1 MSP Pi. In both cases, any partial accumulation either held in memory at the beginning (resp., end) of Cj or read from slow memory to cache (resp., written from cache to slow memory) during Cj is, by definition, not shared between multiple entries in Ci. In the following, we refer as D′i to the set of vertices of GAPi corresponding to the values of such partial accumulators. For each of the least D′i = max{0,Z′i − T (j) /ni} entries of Ci which are active but not entirely computed during Cj, either one of the entries of the cache must be occupied at the beginning of Cj, or one I/O operation is executed during Cj. Let i 11 i ν1 ν1 Xi=1 Xi=1 D′ = D′i = i=1D′i. As, by Lemma 2, the sub-CDAGs corresponding to the ν1 Type 1 MSPs are D′ = ∪ν1 vertex disjoint, so are the the sets D′i. Let Z′ =Pνl max{0,Z′i − T (j) i=1 Z′i. We have: /ni} ≥ Z − T (j)/2√M , where the last passage follows from the fact that, by Definition 2, ni ≥ 2M . From Lemma 8, the set of vertices Y′i,A (resp., Y′i,B) which correspond to entries of Ai (resp., Bi) which are accessed during Cj satisfies Y′i,AY′i,B ≥ T (j) 2/Z′i. Hence, at least Y′i,A +Y′i,B ≥ 2T (j) /pZ′i entries from the input matrices of Pi are accessed during Cj. Let Y denote the set of vertices corresponding to the entries of the input matrices Ai, Bi of Pi. From Lemma 6 we have that there exists a set Y′i ⊆ Y i, withY′i ≥ max{Y′i,A,Y′i,B} ≥ T (j) /pZ′i, such that the vertices in Y′i are connected by vertex disjoint pats to the vertices in T (j) . Let Y = ∪ν1 i=1Y′i. As, by Lemma 2, the sub-CDAGs corresponding to the νl Type 1 MSPs are vertex disjoint, so are the the sets Y′i for i = 1, 2, . . . , ν1. Hence (4) i i i i From Lemma 4 any dominator DY of Y , must be such that ν1 ν1 i T (j) pZ′i . Y = Xi=1 Y′i ≥ Xi=1 i=1 T (j) DY ≥ min(cid:8)2M, Pν1 i=1pZ′i(cid:9) = min(cid:8)2M, T (j) pZ′(cid:9). Pν1 i Hence, we can conclude that any dominator D′′ of T (j) must be such that D′′ ≥ min(cid:8)2M,T (j)/pZ′(cid:9). (5) Consider the set D of vertices of GA corresponding to the at most M values stored in the cache at the beginning of Cj and to the at most gj values loaded into the cache form the slow memory (resp., written into the slow memory from the cache) during Cj by means of a read (resp., write) I/O operation. Clearly, D ≤ M + gj. In order for the M 3/2 values from T (j) to be computed during Cj there must be no path connecting any vertex in T (j), and, hence, Y , to any input vertex of GA which does not have at least one vertex in D, that is D has to admit a subset D′′ ⊆ D such that D′′ is a dominator set of T (j). Note that, as the values corresponding to vertices in T (j) are actually computed during CJ (i.e., not loaded from memory using a read I/O operation), D′′ does not include vertices in T (j) itself. Further, as motivated in the previous discussion, D must include all the vertices in the set D′ corresponding to values of partial accumulators of the active output values of Type 1 MSPs during Cj. By construction, D′ and D′′ are vertex disjoint. Hence, from (4) and (5) we have: D ≥ D′ + D′′ ≥ Z′ − T (j)/2√M + min(cid:8)2M,T (j)/pZ′(cid:9). As, by construction, T (j) = M 3/2, we have: D > Z′ − M/2 + min(cid:8)2M, M 3/2/pZ′(cid:9). 12 (6) By studying its derivative after opportunely accounting for the minimum, we have that (6) is minimized for Z′ = 2−2/3M . Hence we have: D > 2−2/3M + 21/3M 3/2 − M/2 = 1.38988157484M . Whence D ≤ M + gj, which implies gj ≥ D − M > 0.38988157484M , as stated above. Case (b): In order for the 4M values from Z j to be computed during Cj there must be no path connecting any vertex in Z j to any input vertex of GA which does not have at least one vertex in Dj, that is Dj has to be a dominator set of Z j. From Lemma 5, any dominator set D of any subset Z ⊆ Z with Z ≤ 4M satisfies D ≥ Z/2, whence M + gi ≥ Di ≥ Z j/2 = 2M , which implies gj ≥ M as stated above. This concludes the proof for the sequential case in (1). The proof for the bound for the parallel model in (2), follows from the observation that at least one of the P processors, denoted as P ∗, must compute at least T /P values corresponding to vertices in T or Z/P values corresponding to vertices in Z (or both). The bound follows by applying the same argument discussed for the sequential case to the computation executed by P ∗. Note that if A is such that the product is entirely computed using an algorithm from the standard class (resp., a fast matrix multiplication algorithm), the bounds of Theorem 7 corresponds asymptotically to the results of [18] for the sequential case and [21] for the parallel case (resp., the results in [11]). The bound in (2) can be further generalized to a slightly different model in which each of the P processors is equipped with a cache memory of size M and a slow memory of unbounded size. In such case, the I/O complexity of the algorithms in H corresponds to the total number of both messages received and the number of I/O operations used to move data from cache to slow memory and vice versa (i.e., read and write) executed by at least one of the P processors. I/O lower bound for uniform, non stationary algorithms in UH (n0) : For the sub- class of uniform, non stationary algorithms UH (n0) , given the values of n, M and n0 is possible to compute a closed form expression for the values of ν1, ν2 and T .4 Then, by applying Theorem 7 we have: Theorem 9. Let A ∈ UH (n0) be an algorithm to multiply two square matrices A, B ∈ Rn×n. If run on a sequential machine with cache of size M and such that up to B memory words stored in consecutive memory locations can be moved from cache to slow memory and vice versa using a single memory operation, A's I/O complexity satisfies: IOA (n, M, B) ≥ max{2n2,(cid:18) n max{n0, 2√M}(cid:19)log2 7(cid:18)max(cid:8)1, 4The constants terms in Theorem 9 assume that n, n0 and M are powers of two. If that not the case the n0 2√M(cid:9)(cid:19)3 M}B−1 (7) statement holds with minor adjustments. 13 If run on P processors each equipped with a local memory of size M < n2 and where for each I/O operation it is possible to move up to Bm memory words, A's I/O complexity satisfies: IOA (n, M, Bm, P ) ≥(cid:18) n max{n0, 2√M}(cid:19)log2 7(cid:18)maxn1, n0 2√Mo(cid:19)3 M P Bm . (8) Proof. The statement follows by bounding the values ν1,ν2 and T for A ∈ UH (n0) , and by applying the general result from Theorem 7. In order to simplify the presentation, in the following we assume that the values n, n0, M are powers of two. If that is not the case, the theorem holds with some minor adjustments to the constant multiplicative factor. H, at each of the i recursive levels A generates 7i sub-problems of size n/2i. Let let i be the smallest value in N such that n/2i = max{n0, 2√M}. By definition of • If n0 > 2√M , A generates ν1 = 7i = 7log2 n/n0 =(cid:18) n n0(cid:19)log2 7 Type 1 MSP each with input size n0 × n0. As, by Definition 2, the Type 1 MSP are input dijoint we have: T = ν1n0 • Otherwise, if n0 ≤ 2√M , A generates 3 =(cid:18) n n0(cid:19)log2 7 n0 3. ν2 = 7i = 7log2 n/2√M =(cid:18) n 2√M(cid:19)log2 7 Type 2 MSP each with input size 2√M × 2√M . The statement then follows by applying the result in Theorem 7. Theorem 9 extends the result by Scott [32] by expanding the class of hybrid matrix multiplication algorithms being considered (e.g., it does not limit the class of standard matrix multiplication to the divide and conquer algorithm based on block-partitioning), and by removing the assumption that no intermediate value may be recomputed. On the tightness of the bound: An opportune composition of the cache-optimal version of the Strassen's algorithm [35] (as discussed in [3]) with the standard cache-optimal divide and conquer algorithm for square matrix multiplication based on block-partitioning [13] leads to a sequential hybrid algorithms in H (resp., UH (n0) ) whose I/O cost asymptotically matches the I/O complexity lower bounds in Theorem 7 (1) (resp., Theorem 9 (7)). Parallel algorithms in H (resp., UH (n0) ) asymptotically matching the I/O lower bounds in for the parallel case in Theorem 7 (2) (resp., Theorem 9 (8)) can be obtained by composing the communication avoiding version of Strassen's algorithm by Ballard et al. [3] with the communication avoiding "2.5 " standard algorithm by Solomonik and Demmel [34]. 14 Hence, the lower bounds in Theorem 7 and Theorem 9 are asymptotically tight and the mentioned algorithms form H and UH (n0) whose I/O cost asymptotically match the lower bounds are indeed I/O optimal. Further, as the mentioned I/O optimal algorithms from H and UH (n0) do not recompute any intermediate value 5, we can conclude that using recomputation may lead to at most a constant factor reduction of the I/O cost of hybrid algorithms in H and UH (n0) . Generalization to fast matrix multiplication model with base other than 2 × 2: The general statement of Theorem 7 can be extended to by enriching H to include any fast Strassen-like algorithm with base case other than 2 × 2 provided that the associated encoder CDAG satisfies properties equivalent to those expressed by Lemma 2(i.e., the input disjointedness of the sub-problems generated at each recursive step) and Lemma 3 (i.e., the connectivity between input and output of the encoder CDAGs via vertex disjoint paths) for the 2 × 2 base. If these properties hold, so does the general structure of Theorem 7, given an opportune adjustment of the definition of maximal sub-problem. 7 Conclusion This work introduced the first characterization of the I/O complexity of hybrid matrix mul- tiplication algorithms combining fast Strassen-like algorithms with standard algorithms. We established asymptotically tight lower bounds that hold even when recomputation is allowed. The generality of the technique used the analysis makes it promising for the analysis of other hybrid recursive algorithms, e.g., for hybrid algorithms for integer multi- plication [12]. Our results contribute to the study of the effect of recomputation with respect to the I/O complexity of CDAG algorithms. While we are far from a characterization of those CDAGs for which recomputation is effective, this broad goal remains a fundamental challenge for any attempt toward a general theory of the communication requirements of computations. Acknowledgments The author would like to thank Gianfranco Bilardi at the University of Padova for the helpful suggestions and discussions. References [1] A. Aggarwal, B. Alpern, A. Chandra, and M Snir. A model for hierarchical memory. In Proc. ACM STOC, pages 305 -- 314. ACM, 1987. [2] Alok Aggarwal and S. Vitter, Jeffrey. The input/output complexity of sorting and related problems. Commun. ACM, 31(9):1116 -- 1127, September 1988. 5We do not consider replication of the input used by the mentioned parallel algorithms as recomputation, but rather as a repeated access to the input values. 15 [3] G. Ballard, J. Demmel, Olga H., B. Lipshitz, and O. Schwartz. Communication-optimal parallel algorithm for Strassen's matrix multiplication. In Proc. ACM SPAA, pages 193 -- 204, 2012. [4] G. Ballard, J. Demmel, O. Holtz, B. Lipshitz, and O. Schwartz. Brief announcement: strong scaling of matrix multiplication algorithms and memory-independent commu- nication lower bounds. In Proc. ACM SPAA, pages 77 -- 79. ACM, 2012. [5] G. Ballard, J. Demmel, O. Holtz, B. Lipshitz, and O. Schwartz. Graph expansion analysis for communication costs of fast rectangular matrix multiplication. In Design and Analysis of Algorithms, pages 13 -- 36. Springer, 2012. [6] G. Ballard, J. Demmel, O. Holtz, and O. Schwartz. Communication-optimal paral- lel and sequential Cholesky decomposition. SIAM Journal on Scientific Computing, 32(6):3495 -- 3523, 2010. [7] G. Ballard, J. Demmel, O. Holtz, and O. Schwartz. Minimizing communication in nu- merical linear algebra. SIAM Journal on Matrix Analysis and Applications, 32(3):866 -- 901, 2011. [8] G. Ballard, J. Demmel, O. Holtz, and O. Schwartz. Graph expansion and communica- tion costs of fast matrix multiplication. JACM, 59(6):32, 2012. [9] G. Bilardi and F. Preparata. Processor-time trade offs under bounded speed message propagation. Part 2: Lower Bounds. Theory of Computing Systems, 32(5):531 -- 559, 1999. [10] G. Bilardi and F. P. Preparata. Horizons of parallel computation. Journal of Parallel and Distributed Computing, 27(2):172 -- 182, 1995. [11] Gianfranco Bilardi and Lorenzo De Stefani. The i/o complexity of strassen's matrix multiplication with recomputation. In Workshop on Algorithms and Data Structures, pages 181 -- 192. Springer, 2017. [12] Gianfranco Bilardi and Lorenzo De Stefani. The I/O complexity of toom-cook integer multiplication. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 2034 -- 2052, 2019. [13] L. E. Cannon. A cellular computer to implement the Kalman filter algorithm. Technical report, DTIC Document, 1969. [14] Lorenzo De Stefani. On space constrained computations. PhD thesis, University of Padova, 2016. [15] Fr´ed´eric Desprez and Fr´ed´eric Suter. Impact of mixed-parallelism on parallel implemen- tations of the strassen and winograd matrix multiplication algorithms. Concurrency and Computation: practice and experience, 16(8):771 -- 797, 2004. 16 [16] C. Douglas, M. Heroux, G. Slishman, and R. M. Smith. GEMMW: a portable level 3 BLAS Winograd variant of Strassen's matrix-matrix multiply algorithm. Journal of Computational Physics, 110(1):1 -- 10, 1994. [17] D. Y. Grigor'ev. Application of separability and independence notions for proving lower bounds of circuit complexity. Zapiski Nauchnykh Seminarov POMI, 60:38 -- 48, 1976. [18] J. Hong and H. Kung. I/o complexity: The red-blue pebble game. In Proc. ACM STOC, pages 326 -- 333. ACM, 1981. [19] John E Hopcroft and Leslie R Kerr. On minimizing the number of multiplications necessary for matrix multiplication. SIAM Journal on Applied Mathematics, 20(1):30 -- 36, 1971. [20] Steven Huss-Lederman, Elaine M Jacobson, Jeremy R Johnson, Anna Tsao, and Thomas Turnbull. Implementation of strassen's algorithm for matrix multiplication. In Supercomputing'96: Proceedings of the 1996 ACM/IEEE Conference on Supercom- puting, pages 32 -- 32. IEEE, 1996. [21] D. Irony, S. Toledo, and A. Tiskin. Communication lower bounds for distributed- Journal of Parallel and Distributed Computing, memory matrix multiplication. 64(9):1017 -- 1026, 2004. [22] R. Jacob and M. St´ockel. Fast output-sensitive matrix multiplication. In Proc. ESA, pages 766 -- 778. Springer, 2015. [23] S Lennart Johnsson. Minimizing the communication time for matrix multiplication on multiprocessors. Parallel Computing, 19(11):1235 -- 1257, 1993. [24] F. Le Gall. Powers of tensors and fast matrix multiplication. In Proc. ACM ISSAC, pages 296 -- 303. ACM, 2014. [25] L. H. Loomis and H. Whitney. An inequality related to the isoperimetric inequality. Bull. Amer. Math. Soc., 55(10):961 -- 962, 10 1949. [26] Roy Nissim and Oded Schwartz. Revisiting the i/o-complexity of fast matrix multi- plication with recomputations. In Proceedings of the 33rd IEEE International Parallel and Distributed Processing Symposium, pages 714 -- 716, 2019. [27] R. Pagh and M. Stockel. The input/output complexity of sparse matrix multiplication. In Proc. ESA, pages 750 -- 761. Springer, 2014. [28] C. A. Patterson, M. Snir, and S. L. Graham. Getting Up to Speed:: The Future of Supercomputing. National Academies Press, 2005. [29] J. E. Savage. Extending the Hong-Kung model to memory hierarchies. In Computing and Combinatorics, pages 270 -- 281. Springer, 1995. [30] J. E. Savage. Models of Computation: Exploring the Power of Computing. Addison- Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1st edition, 1997. 17 [31] J. Scott, O. Holtz, and O. Schwartz. Matrix multiplication I/O complexity by Path Routing. In Proc. ACM SPAA, pages 35 -- 45, 2015. [32] Jacob N Scott. An I/O-Complexity Lower Bound for All Recursive Matrix Multiplica- tion Algorithms by Path-Routing. PhD thesis, UC Berkeley, 2015. [33] M. Scquizzato and F. Silvestri. Communication lower bounds for distributed-memory computations. arXiv preprint arXiv:1307.1805, 2013. [34] Edgar Solomonik and James Demmel. Communication-optimal parallel 2.5 D matrix multiplication and LU factorization algorithms. In European Conference on Parallel Processing, pages 90 -- 109. Springer, 2011. [35] V. Strassen. Gaussian elimination is not optimal. Numerische Mathematik, 13(4):354 -- 356, 1969. [36] Y. D. Burago V. A. Zalgaller, A. B. Sossinsky. The American Mathematical Monthly, 96(6):544 -- 546, 1989. [37] Shmuel Winograd. On multiplication of 2× 2 matrices. Linear algebra and its appli- cations, 4(4):381 -- 388, 1971. 18 A Proofs of technical lemmas A.1 Proof of Lemma 4 The proof of Lemma 4 uses an analysis similar to that in [11](Lemma 6), albeit with several important variations. Before delving into the details of the proof of Lemma 4 we introduce the following technical lemma: Lemma 10. Let ai, a2, . . . ai ∈ N (resp., bi, b2, . . . bi ∈ N) such that bj = 0 if and only if ai = 0 and such that: a1√b1 ≥ a2√b2 ≥ .... ≥ ai√bi using the convention that 0/0 = 0. Then we have: a1√b1 + 1 2 i Xj=2 aj pbj ≥ Pi qPj j=1 ai j=1 bj (9) Proof. The proof is by induction on the value of i. In the base case case i = 1, hence a = a1 and b = b1. Thus the statement is trivially verified. We assume inductively that the statement holds for i ≥ 1 and we show that it holds also for i + 1. Let a1√b1 ≥ a2√b2 ≥ .... ≥ ai + 1 √bi + 1 be can therefore apply the inductive hypothesis to the first i elements and obtain: 1 2 i+1 Xj=2 aj pbj ≥ Pi qPi j=1 aj j=1 bj + 1 2 . ai+1 pbi+1 (10) Let a′ = Pi following we consider the case for which ai+1 > 0 and, by assumption, bi+1 > 0. From (10), we have that the lemma is guaranteed to be verified if the following holds: j=1 bj. If ai+1 = 0 the statement is trivially verified. In the + a1√b1 j=1 aj and b′ = Pi a′ √b′ + 1 2 ai+1 pbi+1 ≥ a′ + ai+1 pb′ + bi+1 = a′ pb′ + bi+1 + ai+1 pb′ + bi+1 Clearly (11) is verified for b′ ≥ bi+1. Since, by assumption, b = b′ + bi+1, we can therefore conclude that the statement is verified for b′ ≥ 3b/4. In the following we consider the case for b′ < 3b/4. Let a′ = ax (resp., b′ = by), with x ∈ (0, 1]. By assumption x, y 6= 0. Further, as we are considering the case such that b′ < 3b/4, we have that y ∈ (0, 3/4). Since, by assumption, a = a′ + ai+1 and b = b′ + bi+1, we have: (11) a′ √b′ + 1 2 ai+1 pbi+1 = = + 1 2 ax √by √b(cid:18) x a √y a(1 − x) pb(1 − y) 2√1 − y(cid:19) 1 − x + 19 Therefore, the Lemma is clearly verified if the following holds: x √y + 1 − x √1 − y = 2x√1 − y + (1 − x)√y 2√y√1 − y ≥ 1. (12) By multiplying both sides of the previous inequality by 2√y√y − 1 (which is clearly greater than 0), we have that (12) holds if: which in turn holds if: 2xp1 − y + (1 − x)√y ≥ 2√yp1 − y, 2p1 − y (x − √y) ≥ √y (x − 1) , (13) (14) Lemma follows. As y ∈ (0, 3/4) we have 2√1 − y > 1 > √y and (cid:0)x − √y(cid:1) (x − 1). Hence (14) holds ant the Recall that given an algorithm A ∈ H used to multiply input squared matrices A, B ∈ Rn×n, we denote as GA the corresponding CDAG constructed according to the description in Section 4. Further, we denote as X the set of input vertices of GA. That is the set of vertices corresponding each to the entries in the input matrices A and B. We now present the proof of Lemma 4. Proof of Lemma 4. The proof proceeds by induction on the number of Type 1 MSPs ν1 generated by A. In the base case ν1 = 1 and, by Definition 2 the entire problem is the only, improper Type 1 MSP generated by A. Hence, the sets Y and X coincide and the statement is trivially verified. Assuming now inductively that the statement holds ν1 = k ≥ 1, we shall show it also As ν1 > 1, we have that the algorithm executes at least one recursive step. Let P (j) denote the 7 sub-problems generated at the first recursion step. We distinguish two cases: (a) at least two of of the seven sub-problems P (j) generate each at least one Type 1 MSP; (b) only one of the seven sub-problems generates all ν1 Type 1 MSPs. We first address case (a), as case (b) will follow from a simple extension. holds for ν1 = k + 1. For case (a), let G(j), for j = 1, 2, . . . , 7 denote the seven sub-CDAGs of GA, each corresponding to one of the seven sub-problems generated in the first recursive step of A according to the chosen Strassen-like scheme as discussed in Section 3. By Definition 2 and as, by assumption, A generates Type 1 MSPs, we have that each of these seven sub-problems has input size greater or equal to 2√M × 2√M . Further, each of the seven sub-problems P (j) generates at most ν1 − 1 Type 1 MSPs. Let Y (j) (resp., Y (j)) denote the subsets of Y (resp., Y) in G(j), for j = 1, 2, . . . , 7. That is Y (j) = Y ∩ Y (j), By Lemma 2 the G(j)'s have distinct input values and, hence, are pairwise vertex-disjoint sub-CDAGs of GA. Thus, the Y (1), Y (2), . . . , Y (7) partition Y (resp., Y (1),Y (2), . . . ,Y (7) partition Y) and P7 j=1 Y (j) = Y). Let Y (j) = aj/pbj, we have Y =P7 j=1 aj/pbj. By the inductive hypothesis, any dominator set D(j) of Y (j) with respect to the set K(j) composed by the input vertices of G(j) must be such that D(j) ≥ min{2M, aj /√bj}. By Definition 1 this implies that vertices in Y (j) can be connected to a subset K (j) ⊆ K(j) j=1 Y (j) = Y (resp., P7 20 disjoint. j=1 aj/qP7 of the input vertices of G(j) such that K (j) ≥ aj/√bj, using vertex-disjoint paths. Since the sub-CDAGs G(j) are vertex disjoint, so are the paths connecting vertices in Y (j) to vertices in K (j). In the following we show that it is indeed possible to extended at least min{2M,P7 j=1 bj} of these paths to vertices in X while maintaining them vertex According to the construction of GA as discussed in Section 4, vertices in X correspond- ing to the entries of input matrix A (resp., B) are connected to vertices in K(1),K(2), . . . ,K(7) (and, hence, K (1), K (2), . . . , K (7)) by means of n2 encoding sub-CDAGs EncA (resp., EncB). None of these 2n2 encoding sub-CDAGs share any input or output vertices. No two output vertices of the same encoder sub-CDAG belong to the same sub-CDAG G(j), for j = 1, 2, . . . , 7. This fact ensures that for a single sub-CDAG G(j), for j = 1, 2, . . . , 7, it is possible to connect all the vertices in K(j) (and, hence, K (j)) to a subset of the vertices in X via vertex disjoint paths. For each of the 2n2 encoder sub-CDAGs, let us consider the vector yl ∈ {0, 1}7 such that yl[j] = 1 iff the corresponding j-th output vertex of the encoder, which is an input of G(j), is in K (j). Therefore yl equals the number of output vertices of the l-th encoder sub-CDAG which are in K. From Lemma 3, for each encoder sub-CDAG there exists a subset Xl ∈ X of the input vertices of the l-th encoder sub-CDAG for which it is possible to connect each vertex in Xl to a distinct output vertex of the l-th encoder sub-CDAG using vertex disjoint paths, each constituted by a singular edge with min{yl, 1 + ⌈(yl − 1) /2⌉} ≤ Xl ≤ yl. The number of vertex disjoint paths connecting vertices in X , to vertices in ∪7 j=1K (j) is l=1 min{yl, 1 +⌈(yl − 1) /2⌉}, under the constraint that P2n2 therefore at least P2n2 l=1 yl[j] = aj/pbj, for j = 1, 2, . . . , 7. Let us assume w.l.o.g. that a1/√b1 ≥ a2/√b2 ≥ . . . ≥ a7/√b7. As previously stated, it is possible to connect all vertices in K1 to vertices in X through vertex disjoint paths. Consider now all possible dispositions of the vertices in ∪7 j=2K (j) over the outputs of the 2n2 encoder sub-CDAGs. Hence, if a1/√b1 ≥ 2M we have that there are therefore at least M vertex disjoint paths connecting vertices in X to vertices in K1, and, thus, to vertices in Y as desired. In the following we assume a1/√b1 < M . Recall that the output vertices of an encoder sub-CDAG belong each to a different sub-CDAG G(j). From Lemma 3 we have that for each encoder there exists a subset Xl ⊂ X of the input vertices of the l-th encoder sub-CDAG, with Xl ≥ minnyl, 1 + ⌈(yl − 1) /2⌉o ≥ yl[1] +(cid:16)P7 j=2 yl[j](cid:17) /2, for which is possible to connect all vertices in j=1K (j) Xl to Xl distinct output vertices of the l-th encoder sub-CDAG which are in ∪7 using Xl vertex disjoint paths. As all the Enc sub-CDAGs are vertex-disjoint, we can add their contributions so that the number of vertex-disjoint paths connecting vertices in X to 21 2  7 Xj=2 aj pbj  j=1 aj , j=1 bj K (j) = 1 a1√b1 ≥ P7 qP7 vertices in ∪7 j=1K (j) is at least K (1) + 1 2 7 Xj=2 where the last passage follows by applying Lemma 10. There are therefore at least a/√b vertex disjoint paths connecting vertices in X to vertices in ∪7 j=1K (j), and, thus, to vertices in Y as desired. This concludes the proof for case (a). For case (b), only one of the seven sub-problems P (j) generates all ν1 Type 1 MSPs. Without loss of generality, let P (1) denote such sub-problem and let GAP (1) be the corre- sponding sub-CDAG. According to the construction of GA as discussed in Section 4, vertices in X corresponding to the entries of input matrix A (resp., B) are connected to the input vertices of GAP (1) , by means of n2 encoding sub-CDAGs EncA (resp., EncB). None of these 2n2 encoding sub-CDAGs share any input or output vertices. No two output vertices of the same encoder sub-CDAG belong to the same sub-CDAG G(j), for j = 1, 2, . . . , 7. This fact ensures that it is possible to connect all the input vertices of GAP (1) to a subset of the vertices in X via vertex disjoint paths. The proof for case (b) then follows by recursively applying the arguments in the Proof of Lemma 4 to GAP (1) . A.2 Proof of Lemma 5 Given an algorithm A ∈ H used to multiply input squared matrices A, B ∈ Rn×n, let GA denote the corresponding CDAG constructed according to the description in Section 4. In the following we denote as X the set of input vertices of GA. That is the set of vertices corresponding each to the entries in the input matrices A and B. Further, for each Type 2 MSP Pi we denote as Y i the set of input vertices of the sub-CDAG GAPi associated with Pi. That is the set of vertices corresponding each to the entries in the input matrices Ai and Bi of Pi. Also, we define Y = ∪ν2 which is a heavily modified version of a result previously introduced in [11, Lemma 6]. Lemma 11. Consider an algorithm A ∈ H with input matrices A, B ∈ Rn×n which gener- ates ν2 Type 2 MSPs. Given the corresponding CDAG GA, let Q be a set of internal (i.e., not input) vertices of its ν2 sub-CDAGs corresponding each to one of the generated Type 2 In order to simplify the presentation of the proof of Lemma 5 we first introduce Lemma 11 i=1Y i. MSPs. For any Z ⊆ Z with Z ≥ 2Q there exist X ⊆ X with X ≥ 2pM (Z − 2Q) such that each vertex in X is connected to some vertex in Z by a directed path with no vertex in Q. Proof. The proof proceeds by induction on the number ν2 of Type 2 MSPs generated by A. In the base case ν2 = 1 and, by Definition 2 the entire problem is the only, improper, Type 2 MSP generated by A and, thus, the sets Y and X coincide. Consider now the following lemma: 22 Lemma 12 ([11, Lemma 5]). Let Gn×n denote the CDAG corresponding to the execution of an unspecified algorithm for the square matrix multiplication function with input matrices of size n × n. Let O′ ⊆ O be a subset of its output vertices O. For any subset D of the vertices of Gn×n with O′ ≥ 2D, there exists a set I′ ⊆ I of the input vertices I of Gn×n with cardinality I′ ≥ 2npO′ − 2D, such that all vertices in I′ are connected to some vertex in O′ by directed paths with no vertex in D. As, by Definition 2, GA is a Gn×n CDAG, with n ≥ 2√M , we can conclude that the statement of Lemma 11 is verified in the base case as a consequence of Lemma 12 and of the fact that, as previously mentioned, Y and X coincide, Lemma 12 was originally introduced in [11, Lemma 5] and is based on the analysis of the Grigoriev's flow of the matrix multiplication function. For the sake of completeness we present the proof in Appendix A.4. Assuming now inductively that the statement holds for ν2 = k > 1, we shall show it also holds for ν2 = k + 1. As ν2 > 1, we have that the algorithm executes at least one recursive step. Let P (j) denote the 7 sub-problems generated at the first recursion step. We distinguish two cases: (a) at least two of of the seven sub-problems P (j) generate each at least one Type 2 MSP; (b) only one of the seven sub-problems generates all ν2 Type 2 MSPs. We first address case (a), as case (b) will follow from a simple extension. j=1 Z (j) = Z and P7 j=1 δ(j) ≥ Z − 2Q. For case (a), let G(j), for j = 1, 2, . . . , 7 denote the seven sub-CDAGs of GA, each corresponding to one of the seven sub-problems generated in the first recursive step of A according to the chosen Strassen-like scheme as discussed in Section 4. By Definition 2 and as, by assumption, A generates Type 2 MSPs, we have that n/2 ≥ 2√M . Further, each of the seven sub-problems P (j) generates at most ν2 − 1 Type 2 MSPs. Let Z (j), Y (j) and Q(j) respectively denote the subsets of Z, Y and Q in G(j), for j = 1, 2, . . . , 7. By Lemma 2 the G(j)'s have distinct input values and, hence, are pairwise vertex- disjoint sub-CDAGs of GA. Thus, Z1, Z2, . . . , Z7 partition Z, Y 1,Y 2, . . . ,Y 7 partition Y and Q1, Q2, . . . , Q7 partition Q. This implies P7 j=1 Q(j) = Q. Let δ(j) = max{0,Z (j) − 2Q(j)}, we have δ =P7 Applying the inductive hypothesis to each G(j), we have that there is a subset Y (j) ⊆ Y (j) with Y (j) ≥ 4√M δ(j) such that vertices of Y (j) are connected to vertices in Z (j) via paths with no vertex in Q(j). In the sequel the set Y referred to in the statement will be identified as a suitable subset of ∪7 i=jY (j) so that property (b) will be automatically satisfied. Towards property (a), we observe by the inductive hypothesis that vertices in Y (j) can be connected to a subset K (j) of the input vertices of G(j) with K (j) = Y (j), using vertex-disjoint paths. Since the sub-CDAGs G(j) are vertex disjoint, so are the paths connecting vertices in Y (j) to vertices in K (j). It remains to show that at least 4pM (Z − 2Q) of these paths can be extended to X while maintaining them vertex-disjoint. According to the construction of GA as discussed in Section 4, vertices in X correspond- ing to the entries of input matrix A (resp., B) are connected to vertices in K1, K2, . . . , K7 by means of n2 encoding sub-CDAGs EncA (resp., EncB). None of these 2n2 encoding sub-CDAGs share any input or output vertices. No two output vertices of the same encoder sub-CDAG belong to the same sub-CDAG G(j), for j = 1, 2, . . . , 7. This fact ensures that for a single sub-CDAG G(j), for j = 1, 2, . . . , 7, it is possible to connect all the vertices in 23 Ki to a subset of the vertices in X via vertex disjoint paths. For each of the 2n2 encoder sub-CDAGs, let us consider the vector yl ∈ {0, 1}7 such that yl[j] = 1 iff the corresponding j-th output vertex of the encoder, which is an input of G(j), is in K (j). Therefore yl equals the number of output vertices of the l-th encoder sub-CDAG which are in K. From Lemma 3, for each encoder sub-CDAG there exists a subset Xl ∈ X of the input vertices of the l-th encoder sub-CDAG for which it is possible to connect each vertex in Xl to a distinct output vertex of the l-th encoder sub-CDAG using vertex disjoint paths, each constituted by a singular edge with min{yl, 1 + ⌈(yl − 1) /2⌉} ≤ Xl ≤ yl. j=1K (j) is The number of vertex disjoint paths connecting vertices in X , to vertices in ∪7 therefore at least P2n2 l=1 min{yl, 1 +⌈(yl − 1) /2⌉}, under the constraint that P2n2 l=1 yl[j] = 4√M δ(j), for j = 1, 2, . . . , 7. Let us assume w.l.o.g. that δ(1) ≥ δ(20 ≥ . . . ≥ δ(7). As previously stated, it is possible to connect all vertices in K1 to vertices in X through vertex disjoint paths. Consider now all possible dispositions of the vertices in ∪7 j=2K (j) over the outputs of the 2n2 encoder sub-CDAGs. Recall that the output vertices of an encoder sub-CDAG belong each to a different sub-CDAG G(j). From Lemma 3 we have that for each encoder there exists a subset Xl ⊂ X of the input vertices of the l-th encoder sub- CDAG, with Xl ≥ minnyl, 1 + ⌈(yl − 1) /2⌉o ≥ yl[1] +(cid:16)P7 j=2 yl[j](cid:17) /2, for which is possible to connect all vertices in Xl to Xl distinct output vertices of the l-th encoder j=1K (j) using Xl vertex disjoint paths. As all the Enc sub- sub-CDAG which are in ∪7 CDAGs are vertex disjoint, we can add their contributions so that the number of vertex Pj=2K (j) = disjoint paths connecting vertices in X to vertices in ∪7 4√M √δ(1) + 1 Pj=2 2 Xj=2pδ(j)  4√M pδ(1) +  .  As, by assumption, δ(1) ≥ . . . δ(7), we have: √δ(1)√δ(j) ≥ δ(j) for j = 2, . . . , 7. Thus:  4√M δ(j) ≥(cid:16)4pM (Z − 2Q)(cid:17)2 √δ(j)!. Squaring this quantity leads to: Xj=2pδ(j)  Xj=2pδ(j) +  δ(1) +pδ(1) 7 Xj=2pδ(j)    j=1K (j) is at least K1+ 1 2 pδ(1) + = 16M 2   7 Xj=1 7 1 2 2 ≥ 16M 7 7 1 2 7 . There are therefore at least 4pM (Z − 2Q) vertex disjoint paths connecting vertices in X to vertices in ∪7 j=2K (j) as desired. This concludes the proof for case (a). For case (b), only one of the seven sub-problems P (j) generates all ν1 Type 1 MSPs. Without loss of generality, let P (1) denote such sub-problem and let GAP (1) be the corre- sponding sub-CDAG. According to the construction of GA as discussed in Section 4, vertices in X corresponding to the entries of input matrix A (resp., B) are connected to the input vertices of GAP (1) , by means of n2 encoding sub-CDAGs EncA (resp., EncB). None of these 2n2 encoding sub-CDAGs share any input or output vertices. No two output vertices of 24 7 2 1 2 the same encoder sub-CDAG belong to the same sub-CDAG G(j), for j = 1, 2, . . . , 7. This fact ensures that it is possible to connect all the input vertices of GAP (1) to a subset of the vertices in X via vertex disjoint paths. The proof for case (b) then follows by recursively applying the arguments in the Proof of Lemma 11 to GAP (1) . Lemma 11, provides the base for the proof of Lemma 5, which is itself a reworked version a result from [11] (Lemma 7) modified in order to account for the hybrid nature of algorithms being considered in this work. Proof of Lemma 5. Suppose for contradiction that D is a dominator set for Z in GA such that D ≤ 2M − 1. Let D′ ⊆ D be the subset of the vertices of D composed by vertices which are not internal to the sub-CDAGs corresponding to the Type 2 MSPs generated, by assumption, by A. From Lemma 11, with Q = D \ D′, there exist X ⊆ X and Y ⊆ Y with X = Y ≥ 4pM (Z − 2 (D − D′)) such that vertices in X are connected to vertices in Y by vertex-disjoint paths. Hence, each vertex in D′ can be on at most one of these paths. Thus, there exists X′ ⊆ X and Y ′ ⊆ Y with X′ = Y ′ ≥ φ = 4pM (Z − 2 (D − D′))− D′ paths from X′ to Y ′ with no vertex in D′. From Lemma 11, we also have that all vertices in Y , and, hence, in Y ′, are connected to some vertex in Z by a path with no vertex in D \ D′. Thus, there are at least φ paths connecting vertices in X′ ⊆ X to vertices in Z with no vertex in D. We shall now show that the contradiction assumption D ≤ 2M − 1 implies φ > 0: (cid:16)4pM (Z − 2 (D − D′))(cid:17)2 = 16M(cid:0)Z − 2(cid:0)D − D′(cid:1)(cid:1) , = 16M (Z − 2D) + 32MD′. By D ≤ 2M − 1, we have Z − 2D > 4M − 2(M − 1) > 0. Furthermore, from D′ ⊆ D, we have 32M > 2M − 1 > D ≥ D′. Therefore: (cid:0)φ + D′(cid:1)2 =(cid:16)4pM (Z − 2 (D − D′))(cid:17)2 > D′2. (15) Again, D ≤ 2M − 1 implies M (Z − 2 (D − D′)) > 0. Hence, we can take the square root on both sides of (15) and conclude that φ > 0. Therefore, for D ≤ 2M − 1 there are at least φ > 0 paths connecting a global input vertex to a vertex in Z with no vertex in D, contradicting the assumption that D is a dominator of Z. i i . The proof for follows an analogous argument. Let D be a dominator set for the i i < Y (B) A.3 Proof of Lemma 6 Proof of Lemma 6. Without loss of generality, let us assume Y (A) the case Y (A) set of vertices corresponding to T ′i with respect to Y (A) to vertices in Y (B) corresponding to a vertex in Y (A) value a. The lemma follows combining statements (i) and (ii): (i) There exists an assignment of the input variables of Pi corresponding to vertices in Consider a possible assignment to the values of Bi such that all the values corresponding are assigned value 1. Under such assignment, for every variable a ∈ Ai at least one of the elementary products in T ′i assumes ≥ Y (B) . i i i 25 i such that the output variables in T ′i assume at least RY (A) Y i \Y (A) all possible assignments of the variables corresponding to vertices in Y (A) (ii) Since all paths form Y (A) to the vertices corresponding to the variables in T ′i intercept D, the values of the elementary products in T ′i are determined by the inputs in Y i \ Y (A) , which are fixed, and by the values of the vertices in D; hence the elementary products in T ′i can take at most RD distinct values. A.4 Proof of Lemma 12 distinct values under . i i i i Before presenting the proof of Lemma 12, we present the concept of "flow of a function" which was originally introduced by Grigoriev [17] and then revised by Savage [30]. In this work, we use the following version: Definition 3 (Grigoriev's flow). A function f : Rp → Rq has a w (u, v) Grigoriev's flow if for all subsets X1 (resp., Y1), of its p input (resp., q output) variables, with X1 ≥ u and Y1 ≥ v, there is a sub-function h of f obtained by making some assignment to variables of f not in X1 and discarding output variables not in Y1, such that h has at least Rw(u,v) points in the image of its domain. Grigoriev's flow is an inherent property of a function, agnostic to the algorithm used to compute the function. It provides a lower bound to the amount of information that suitable sub-sets of outputs encode about suitable sub-sets of inputs. Since any information about inputs that is encoded by outputs must be also be encoded by any dominator of those outputs, we have the following lower bound on the size of dominator sets. Lemma 13 ([11, Lemma 4]). Let G = (V, E) be a CDAG computing a function f : Rp → Rq, defined on the ring R, with p input and q output variables. Let I (resp., O) denote the set of input (resp., output) vertices of G. Further let IX (resp., OY ) denote the subset of I (resp., O) which correspond to a subset X (resp., Y ) of the p input (resp., q output) variables of f . For any O′ ⊆ OY and any I′ ⊆ IX , any dominator of O′ with respect to I′ satisfies D ≥ wfX,Y (I′,O′). A lower bound on the Grigoriev's flow for the square matrix multiplication function over the ring R was presented in [30, Theorem 10.5.1]. fn×n : R2n2 → Rn2 Lemma 14 (Grigoriev's flow of fn×n : R2n2 → Rn2 wn×n (u, v) Grigoriev's flow, where: [30]). fn×n : R2n2 → Rn2 has a wn×n (u, v) ≥ 1 2 v − (cid:0)2n2 − u(cid:1)2 4n2 ! , for 0 ≤ u ≤ 2n2, 0 ≤ v ≤ n2. (16) We can now state the proof of Lemma 12. Recall that we denote as Gn×n the CDAG cor- responding to the execution of a unspecified algorithm for the square matrix multiplication function with input matrices of size n × n. Proof of Lemma 12. The statement follows by applying the results in Lemma 13 and Lemma 14 to the CDAG Gn×n. Let I′′ ⊆ I denote the set of all input vertices of Gn×n, such that all 26 paths connecting these vertices to the output vertices in O′ include at least a vertex in D (i.e., I′′ is the largest subset of I with respect to whom D is a dominator set for O′). From Lemmas 14 and 13 the following must hold: D ≥ wn×n ≥ 1 2 O′ − (cid:0)2n2 − I′′(cid:1)2 4n2 ! . (17) Let I′ = I\I′′. By the definition of I′′, the vertices in I′ are exactly those that are connected to vertices in O′ by directed paths with no vertex in D. Since I = 2n2, from (17) we have I′2 ≥ 4n2 (O′ − 2D). 27 7 5 4 1 3 2 6 7 5 4 1 3 2 6 C1,1 C1,2 C2,1 C2,2 A1,1 A1,2 A2,1 A2,2 B1,1 B1,2 B2,1 B2,2 M7 M5 M4 M1 M3 M2 M6 (a) EncA (b) EncB (c) Dec Figure 2: Encoder and Decoder sub-CDAGs corresponding to Strassen's original algorithm. B Strassen's fast multiplication algorithm Algorithm 1 Strassen's Matrix Multiplication Input: matrices A, B Output: matrix C 1: procedure StrassenMM(A,B) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: if n = 1 then C = A · B Decompose A and B into four equally sized block matrices as follows: else A =(cid:20) A1,1 A1,2 B2,1 B2,2 (cid:21) A2,1 A2,2 (cid:21) , B =(cid:20) B1,1 B1,2 M1 = StrassenMM (A1,1 + A2,2, B1,1 + B2,2) M2 = StrassenMM (A2,1 + A2,2, B1,1) M3 = StrassenMM (A1,1, B1,2 − B2,2) M4 = StrassenMM (A2,2, B2,1 − B1,1) M5 = StrassenMM (A1,1 + A1,2, B2,2) M6 = StrassenMM (A2,1 − A1,1, B1,1 + B1,2) M7 = StrassenMM (A1,2 − A2,2, B2,1 + B2,2) C1,1 = M1 + M4 − M5 + M7 C1,2 = M3 + M5 C2,1 = M2 + M4 C2,2 = M1 − M2 + M3 + M6 return C The original version of Strassen's fast matrix multiplication [35] is reported in Algo- rithm 1. We refer the reader to [37] for Winograd's variant, which reduces the number of additions. 28
1904.09958
3
1904
2019-11-07T12:13:37
Almost Optimal Testers for Concise Representations
[ "cs.DS" ]
We give improved and almost optimal testers for several classes of Boolean functions on $n$ inputs that have concise representation in the uniform and distribution-free model. Classes, such as $k$-junta, $k$-linear functions, $s$-term DNF, $s$-term monotone DNF, $r$-DNF, decision list, $r$-decision list, size-$s$ decision tree, size-$s$ Boolean formula, size-$s$ branching programs, $s$-sparse polynomials over the binary field and function with Fourier degree at most $d$. The method can be extended to several other classes of functions over any domain that can be approximated by functions that have a small number of relevant variables.
cs.DS
cs
Almost Optimal Testers for Concise Representations Nader H. Bshouty Dept. of Computer Science Technion, Haifa, 32000 November 11, 2019 Abstract We give improved and almost optimal testers for several classes of Boolean functions on n inputs that have concise representation in the uniform and distribution-free model. Classes, such as k-Junta, k-Linear Function, s-Term DNF, s-Term Monotone DNF, r-DNF, Decision List, r-Decision List, size-s Decision Tree, size-s Boolean Formula, size-s Branching Program, s-Sparse Polynomial over the binary field and functions with Fourier Degree at most d. The approach is new and combines ideas from Diakonikolas et al. [30], Bshouty [15], Goldreich et al. [38], and learning theory. The method can be extended to several other classes of functions over any domain that can be approximated by functions that have a small number of relevant variables. 9 1 0 2 v o N 7 ] S D . s c [ 3 v 8 5 9 9 0 . 4 0 9 1 : v i X r a 1 Contents 1 Inroduction 1.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 The Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Our Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.1 Testing Subclasses of k-Junta . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.2 Testing Classes that are Close to k-Junta . . . . . . . . . . . . . . . . . . . . 4 4 4 6 7 7 9 2 Preparing the Target for Accessing the Relevant Variables 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.1 Preliminaries 2.2 Approximating the Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 Testing the Relevant Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.4 Determining the Values of the Relevant Variables . . . . . . . . . . . . . . . . . . . . 15 3 Testing Subclasses of k-Junta 18 3.1 Testing the Closeness of f (xX ◦ 0X ) to F . . . . . . . . . . . . . . . . . . . . . . . . 19 3.2 Testing the Closeness of F to C(Γ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.3 Testing the Closeness of F to C(Γ) via Learning C(Γ) . . . . . . . . . . . . . . . . . 21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.4 The First Tester 4 Results 26 4.1 Testing k-Junta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.2 Testing k-Linear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.3 Testing k-Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.4 Testing s-Term Monotone r-DNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.5 Testing Size-s Decision Tree and Size s Branching Program . . . . . . . . . . . . . . 30 4.6 Functions with Fourier Degree at most d . . . . . . . . . . . . . . . . . . . . . . . . . 30 4.7 Testing Length k Decision List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.8 Testing s-Sparse Polynomial of Degree d . . . . . . . . . . . . . . . . . . . . . . . . . 31 5 Testing Classes that are Close to k-Junta 34 5.1 Removing Variables that only Appears in Large Size Terms . . . . . . . . . . . . . . 34 5.2 Testing s-term DNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6 Results 37 6.1 Testing s-Term Monotone DNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.2 Testing Size-s Boolean Formula and Size-s Boolean Circuit . . . . . . . . . . . . . . 38 6.3 Testing s-Sparse Polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 7 A General Method for Other Testers 41 7.1 Testing Decision List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 . . . . . . . . . . . . . . . . . . . 44 7.2 Testing r-DNF and r-Decision List for Constant r 2 8 Improvements and Further Results 45 8.1 Improved ApproxTarget Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 8.2 A General TestSets Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 8.3 A General RelVarValue Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 8.4 Improved Closef F Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8.5 A Weaker ExQD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 8.6 An Improved Query Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 8.7 Some Improved Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 9 Appendix A 57 3 1 Inroduction Property testing of Boolean function was first considered in the seminal works of Blum, Luby and Rubinfeld [13] and Rubinfeld and Sudan [54] and has recently become a very active research area. See for example, [2, 4, 5, 6, 9, 10, 15, 19, 20, 21, 22, 23, 25, 26, 30, 33, 37, 39, 42, 43, 47, 46, 50, 55] and other works referenced in the surveys [36, 52, 53]. A Boolean function f : {0, 1}n → {0, 1} is said to be k-junta if it depends on at most k coordinates. The class k-Junta is the class of all k-juntas. The class k-Junta has been of particular interest to the computational learning theory community [11, 12, 17, 29, 40, 44, 48]. A problem closely related to learning k-Junta is the problem of learning and testing subclasses C of k-Junta and classes C of Boolean functions that can be approximated by k-juntas [10, 12, 31, 21, 30, 38, 39, 50]: Given black-box query access to a Boolean function f . In learning, for f ∈ C, we need to learn, with high probability, a hypothesis h that is ǫ-close to f . In testing, for any Boolean function f , we need to distinguish, with high probability, the case that f is in C versus the case that f is ǫ-far from every function in C. In the uniform-distribution property testing (and learning) the distance between Boolean func- tions is measured with respect to the uniform distribution. In the distribution-free property test- ing, [38], (and learning [56]) the distance between Boolean functions is measured with respect to an arbitrary and unknown distribution D over {0, 1}n. In the distribution-free model, the testing (and learning) algorithm is allowed (in addition to making black-box queries) to draw random x ∈ {0, 1}n according to the distribution D. This model is studied in [15, 27, 32, 34, 41, 45]. 1.1 Results We give improved and almost optimal testers for several classes of Boolean functions on n inputs that have concise representation in the uniform and distribution-free models. The classes studied here are k-Junta, k-Linear Functions, k-Term, s-Term DNF, s-Term Monotone DNF, s-Term Monotone r-DNF, r-DNF, Decision List, Length-k Decision List, r-Decision List, size-s Decision Tree, size-s Branching Programs, size-s Boolean Formula, size-s-Boolean Circuit, s-Sparse Polynomials over the binary field, s-Sparse Polynomials of Degree d and functions with Fourier Degree at most d. In Table 1, we list all the previous results and our results in this paper. In the table, O(T ) stands for O(T · poly(log T )), U and D stand for uniform and distribution-free model, and Exp and Poly stand for exponential and polynomial time. It follows from the lower bounds of Saglam, [55], that our query complexity is almost optimal (with log-factor) for the classes k-Junta, k-Linear, k-Term, s-Term DNF, s-Term Monotone DNF, r- DNF (r constant), Decision List, r-Decision List (r constant), size-s Decision Tree, size-s Branching Programs and size-s Boolean Formula. For more details on the previous results and the results in this paper see Table 1 and Sections 4, 6 and 7. 1.2 Notations In this subsection, we give some notations that we use throughout the paper. Denote [n] = {1, 2, . . . , n}. For S ⊆ [n] and x = (x1, . . . , xn) we denote x(S) = {xii ∈ S}. For X ⊂ [n] we denote by {0, 1}X the set of all binary strings of length X with coordinates indexed by i ∈ X. For x ∈ {0, 1}n and X ⊆ [n] we write xX ∈ {0, 1}X to denote the projection of x over coordinates in X. We denote by 1X and 0X the all-one and all-zero strings in {0, 1}X , 4 Class of Functions Model #Queries Time Reference s-Term Monotone DNF s-Term Unate DNF s-Term Monotone r-DNF s-Term Unate r-DNF s-Term DNF r-DNF (Constant r) Decision List Length-k Decision List r-DL (Constant r) k-Linear k-Term size-s Decision Trees and size-s Branching Programs size-s Boolean Formulas size-s Boolean Circuit Functions with Fourier Degree ≤ d s-Sparse Polynomial over F2 of Degree d s-Sparse Polynomial over F2 U U U U U D U U U U U U D U U D U U D U U D U U U U U D U U U D U U U O(s2/ǫ) O(s/ǫ2) O(s/ǫ) O(s/ǫ2) O(s/ǫ) O(s2r/ǫ) O(s2/ǫ) O(s/ǫ2) O(s/ǫ) O(1/ǫ) O(1/ǫ2) O(1/ǫ) O(k2/ǫ) O(1/ǫ) O(k/ǫ) O(k/ǫ) O(1/ǫ) O(1/ǫ) O(k/ǫ) O(s/ǫ2) O(s/ǫ) O(s2/ǫ) O(s/ǫ2) O(s/ǫ) O(s2/ǫ2) O(s2/ǫ) O(22d/ǫ2) Poly. Exp. Poly. Exp. Poly. Poly. Exp. Exp. Exp. Poly. Poly. Poly. Poly. Poly. Poly. Poly. Poly. Poly. Poly. Exp. Exp. Exp. Exp. Exp. Exp. Exp. Exp. Poly. poly(s/ǫ) + O(22d) Poly. O(2d/ǫ + 22d) [50] [21] This Paper [21] This Paper This Paper [30] [21] This Paper This Paper [30] This Paper This Paper This Paper [8, 13] This Paper [50] This Paper This Paper [21] This Paper This Paper [21] This Paper [21] This Paper [21] This Paper [1, 31] O(s2/ǫ + 22d) O(s/ǫ + s2d) O(s2/ǫ + s2d) O(s/ǫ2) P oly(s/ǫ) O(s2/ǫ) This Paper This Paper Poly. This Paper+[1] Poly. Poly. Exp. Poly. Poly. [21] [31] This Paper Figure 1: A table of the results. In the table, O(T ) stands for O(T · poly(log T )), U and D stand for uniform and distribution-free model, and Exp and Poly stand for exponential and polynomial time. respectively. When we write xI = 0 we mean xI = 0I . For X1, X2 ⊆ [n] where X1 ∩ X2 = ∅ and 5 x ∈ {0, 1}X1 , y ∈ {0, 1}X2 we write x◦y to denote their concatenation, i.e., the string in {0, 1}X1∪X2 that agrees with x over coordinates in X1 and agrees with y over coordinates in X2. Notice that x ◦ y = y ◦ x. When we write u = ◦w∈W w we mean that u is the concatenation of all the strings in W . For X ⊆ [n] we denote X = [n]\X = {x ∈ [n]x 6∈ X}. We say that two strings x and y are equal on I if xI = yI. Given f, g : {0, 1}n → {0, 1} and a probability distribution D over {0, 1}n, we say that f is ǫ-close to g with respect to D if Prx∈D[f (x) 6= g(x)] ≤ ǫ, where x ∈ D means x is chosen from {0, 1}n according to the distribution D. We say that f is ǫ-far from g with respect to D if Prx∈D[f (x) 6= g(x)] ≥ ǫ. For a class of Boolean functions C, we say that f is ǫ-far from every function in C with respect to D if for every g ∈ C, f is ǫ-far from g with respect to D. We will use U to denote the uniform distribution over {0, 1}n or over {0, 1}X when X in clear from the context. For a Boolean function f and X ⊂ [n], we say that X is a relevant set of f if there are a, b ∈ {0, 1}n such that f (a) 6= f (bX ◦ aX). We call the pair (a, b) (or just a when b = 0) a witness of f for the relevant set X. When X = {i} then we say that xi is a relevant variable of f and a is a witness of f for xi. Obviously, if X is relevant set of f then x(X) contains at least one relevant variable of f . where x is the negation of x. We say that the Boolean function f : {0, 1}n → {0, 1} is a literal if f ∈ {x1, . . . , xn, x1, . . . , xn} Let C be a class of Boolean functions f : {0, 1}n → {0, 1}. We say that C is closed under variable projection if for every projection π : [n] → [n] and every f ∈ C, we have f (x(π)) ∈ C where x(π) := (xπ(1),··· , xπ(n)). We say that C is closed under zero projection (resp. closed under one projection) if for every f ∈ C and every i ∈ [n], f (0{i} ◦ x{i}) (resp. f (1{i} ◦ x{i}) ∈ C). We say it is closed under zero-one projection if is closed under zero and one projection. Throughout the paper, we assume that the class C is closed under variable and zero projection. After section 3, we assume that it is also closed under one projection. 1.3 The Model In this subsection, we define the testing and learning models. In the testing model, we consider the problem of testing a class of Boolean function C in the uniform and distribution-free testing models. In the distribution-free testing model (resp. uniform model), the algorithm has access to a Boolean function f via a black-box that returns f (x) when a string x is queried. We call this query membership query (MQf or just MQ). The algorithm also has access to unknown distribution D (resp. uniform distribution) via an oracle that returns x ∈ {0, 1}n chosen randomly according to the distribution D (resp. according to the uniform distribution). We call this query example query (ExQD (resp. ExQ)). testing algorithm) A for C is an algorithm A distribution-free testing algorithm, [38], (resp. that, given as input a distance parameter ǫ and the above two oracles to a Boolean function f , 1. if f ∈ C then A outputs "accept" with probability at least 2/3. 2. if f is ǫ-far from every g ∈ C with respect to the distribution D (resp. uniform distribution) then A outputs "reject" with probability at least 2/3. We will also call A a tester (or ǫ-tester) for the class C and an algorithm for ǫ-testing C. We say that A is one-sided if it always accepts when f ∈ C; otherwise, it is called two-sided algorithm. The query complexity of A is the maximum number of queries A makes on any Boolean function f . 6 In the learning models, C is a class of representations of Boolean functions rather than a class of Boolean functions. Therefore, we may have two different representations in C that are logically equivalent. In this paper, we assume that this representation is verifiable, that is, given a representation g, one can decide in polynomial time on the length of this representation if g ∈ C. A distribution-free proper learning algorithm (resp. proper learning algorithm under the uniform distribution) A for C is an algorithm that, given as input an accuracy parameter ǫ, a confidence parameter δ and an access to both MQf for the target function f ∈ C and ExQD, with unknown D, (resp. ExQ or ExQU ), with probability at least 1 − δ, A returns h ∈ C that is ǫ-close to f with respect to D (resp. with respect to the uniform distribution). This model is also called proper PAC-learning with membership queries under any distribution (resp. under the uniform distribution) [3, 56]. A proper exact learning algorithm [3] for C is an algorithm that given as input a confidence parameter δ and an access to MQf for f ∈ C, with probability at least 1 − δ, returns h ∈ C that is equivalent to f . The query complexity of A is the maximum number of queries A makes on any Boolean function f ∈ C. 1.4 Our Techniques In this section, we give a detailed overview of our techniques. 1.4.1 Testing Subclasses of k-Junta For testing a subclass C of k-Junta that is closed under variable and zero projections, we use TesterC in Figure 8. We first note that TesterC rejects if any procedure that it calls rejects. First, TesterC calls the procedure ApproxTarget, in Figure 2. ApproxTarget partitions the (indices of the) variables [n] into r = O(k2) disjoint sets X1, . . . , Xr. Since C ⊆ k−Junta it follows that, with high probability (whp), if f ∈ C then different relevant variables of f fall into different sets. Therefore, if f ∈ C, whp, every Xi contains at most one relevant variable of f . The procedure then binary searches for enough relevant sets {Xi}i∈I such that, whp, for X = ∪i∈IXi, h = f (xX ◦ 0X ) is (ǫ/3)-close to f with respect to D. If the procedure finds more than k relevant If f ∈ C then the sets of f then there are more than k relevant variables in f and it rejects. procedure does not reject and, since C is closed under zero projection, h ∈ C. Since, whp, h is (ǫ/3)-close to f with respect to D, it is enough to distinguish whether h is in C or (2ǫ/3)-far from every function in C with respect to D. ApproxTarget also finds, for each relevant set Xi, i ∈ I, a witness v(i) ∈ {0, 1}n of h for Xi. That is, for every i ∈ I, h(v(i)) 6= h(0Xi ◦ v(i) ). If f ∈ C, then h ∈ C and, whp, for each i ∈ I, h(xXi ◦ v(i) In the second stage, the tester calls the procedure TestSets, in Figure 4. TestSets verifies, whp, that for every i ∈ I, h(xXi ◦ v(i) ) is (1/30)-close to some literal in {xτ (i), xτ (i)} for some τ (i) ∈ Xi, with respect to the uniform distribution. If f ∈ C, then h ∈ C and, whp, for each i ∈ I, h(xXi ◦ v(i) ) is a literal and therefore TestSets does not reject. Notice that if f ∈ C, then, whp, Γ := {xτ (i)}i∈I are the relevant variables of h. This test does not give τ (i) but the fact that h(xXi ◦ v(i) ) is close to xτ (i) or xτ (i) can be used to find the value of uτ (i) in every assignment u ∈ {0, 1}n without knowing τ (i). The latter is done, whp, by the procedure RelVarValues. See Figure 5. Both procedures make O(k) queries. Recall that for ξ ∈ {0, 1}, ξX is the all ξ vector in {0, 1}X . Then the tester defines the Boolean function F = h(0X ◦ ◦i∈I (xτ (i))Xi) on the variables {xτ (j)}j∈I , that is, the function F is obtained ) is a literal. ApproxTarget makes O(k/ǫ) queries. Xi Xi Xi Xi Xi 7 by substituting in h for every i ∈ I and every xj ∈ x(Xi) the variable xτ (i). Since C ⊆ k-Junta and C is closed under variable and zero projections, τ (i) ∈ Xi and, whp, Γ = {xτ (i)}i∈I are the relevant variables of h we have: • If the function f is in C then, whp, F = h ∈ C and F depends on all the variables in Γ = {xτ (j)}j∈I . If h is (2ǫ/3)-far from every function in C with respect to D then either h is (ǫ/3)-far from F with respect to D or F is (ǫ/3)-far from every function in C(Γ) with respect to D where C(Γ) is the set of all functions in C that depends on all the variables in Γ. Therefore, • If the function f is ǫ-far from every function in C then, whp, either 1. h is (ǫ/3)-far from F with respect to D or 2. F is (ǫ/3)-far from every function in C(Γ) with respect to D. Therefore, it remains to do two tests. The first is testing whether h = F given that h is either (ǫ/3)-far from F with respect to D or h = F . The second is testing whether F ∈ C given that F is either (ǫ/3)-far from every function in C(Γ) with respect to D or f ∈ C(Γ). The former test, h = F , can be done, whp, by choosing O(1/ǫ) strings u ∈ {0, 1}n according to the distribution D and testing whether F (u) = h(u). To compute F (u) we need to find {uτ (i)}i∈I , which can be done by the procedure RelVarValues. Therefore, each query to F requires one call to the procedure RelVarValues that uses O(k) queries to f . Thus, the first test can be done using O(k/ǫ) queries. This is done in the procedure Closef F in Figure 6. Notice that, thus far, all the above procedures run in polynomial time and make O(k/ǫ) queries. Testing whether F ∈ C can be done, whp, by choosing O((log C(Γ))/ǫ) strings u ∈ {0, 1}n according to the distribution D and testing whether F (u) = g(u) for every g ∈ C(Γ). Notice here that the time complexity is poly(C(Γ)) which is polynomial only when C(Γ) contains polynomial number of functions. If the distribution is uniform, we do not need to use RelVarValues to find {uτ (i)}i∈I because when the distribution of u is uniform the distribution of {uτ (i)}i∈I is also uniform. Therefore we can just test whether F (u) = g(u) for every g ∈ C(Γ) for uniform {uτ (i)}i∈I . Then computing F (u) for random uniform string u can be done in one query to h. Thus, for the uniform distribution, the algorithm makes O((log C(Γ))/ǫ) queries to f . This is the procedure CloseF CU in Figure 7. If the distribution is unknown then each computation of F (u) for a random string u according to the distribution D requires choosing u according to the distribution D, then extracting {uτ (i)}i∈I from u and then substituting the values {uτ (i)}i∈I in F . This can be done by the procedure RelVarValues using O(k) queries to h. Therefore, for unknown distribution the algorithm makes O((k log C(Γ))/ǫ) queries to f . This is the procedures CloseF CD in Figure 7. As we mentioned before the time complexity of CloseF CU and CloseF CD is polynomial only if C(Γ) is polynomial. When C(Γ) is exponential, we solve the problem via learning theory. We find a proper learning algorithm A for C(Γ). We run A to learn F . If the algorithm fails, runs more time than it should, asks more queries than it should or outputs a hypothesis g 6∈ C then we know that, whp, F 6∈ C(Γ). Otherwise, it outputs a function g ∈ C(Γ) and then, as above, we test whether g = F given that g is (ǫ/3)-far from F or g = F . Therefore, for the uniform distribution, if the proper learning algorithm for C makes m MQs and q ExQs then the tester makes m + q + O(1/ǫ) queries. If the distribution is unknown, then the tester makes m + O(kq + k/ǫ) queries. 8 1.4.2 Testing Classes that are Close to k-Junta To understand the intuition behind the second technique, we demonstrate it for testing s-term DNF. The tester first runs the procedure ApproxC in Figure 11. This procedure is similar to the pro- cedure ApproxTarget. It randomly uniformly partitions the variables to r = 4c2(c + 1)s log(s/ǫ) disjoint sets X1, . . . , Xr and finds relevant sets {Xi}i∈I . Here c is a large constant. To find a new relevant set, it chooses two random uniform strings u, v ∈ {0, 1}n and verifies if f (uX ◦ vX) 6= f (u) where X is the union of the relevant sets that it has found thus far. If f (uX ◦ vX ) 6= f (u) then the binary search finds a new relevant set. In the binary search for a new relevant set, the procedure defines a set X ′ that is equal to the union of half of the sets in {Xi}i6∈I . Then either f (uX∪X ′ ◦ vX ′) 6= f (u) or f (uX∪X ′ ◦ vX ′) 6= f (uX ◦ vX). Then it recursively does the above until it finds a new relevant set Xℓ. It is easy to show that if f is s-term DNF then, whp, for all the terms T in f of size at least c2 log(s/ǫ), for all the random uniform strings u, v chosen in the algorithm and for all the strings w generated in the binary search, T (uX ◦ vX ) = T (u) = T (w) = 0. Therefore, when f is s-term DNF, the procedure, whp, runs as if there are no terms of size greater than c2 log(s/ǫ) in f . This shows that, whp, each relevant set that the procedure finds contains at least one variable that belongs to a term of size at most c2 log(s/ǫ) in f . Therefore, if f is s-term DNF, the procedure, whp, does not generate more than c2s log(s/ǫ) relevant sets. If the procedure finds more than c2s log(s/ǫ) relevant sets then, whp, f is not s-term DNF and therefore it rejects. Let R be the set of all the variables that belong to the terms in f of size at most c2 log(s/ǫ). The procedure returns h = f (xX ◦ wX) for random uniform w where X is the union of the relevant sets X = ∪i∈IXi that is found by the procedure. If f is s-term DNF then since r = 4c2(c + 1)s log(s/ǫ) and the number of relevant sets is at most c2s log(s/ǫ), whp, at least (1/2)c log(s/ǫ) variables in each term of f that contains at least c log(s/ǫ) variables not in R falls outside X in the partition of [n]. Therefore, for random uniform w, whp, terms T in f that contains at least c log(s/ǫ) variables not in R satisfies T (xX ◦ wX ) = 0 and therefore, whp, are vanished in h = f (xX ◦ wX). Thus, whp, h contains all the terms that contains variables in R and at most cs log(s/ǫ) variables not in R. Therefore, whp, h contains at most c(c + 1)s log(s/ǫ) relevant variables. From this, and using similar arguments as for the procedure ApproxTarget in the previous subsection, we prove that, ApproxC makes at most O(s/ǫ) queries and 1. If f is s-term DNF then, whp, the procedure outputs X and w such that • h = f (xX ◦ wX) is s-term DNF. • The number of relevant variables in h = f (xX ◦ wX) is at most O(s log(s/ǫ)). 2. If f is ǫ-far from every s-term DNF then the procedure either rejects or outputs X and w such that, whp, h = f (xX ◦ wX ) is (3ǫ/4)-far from every s-term DNF. We can now run TesterC (with 3ǫ/4) on h from the previous subsection for testing C ∗ where C ∗ is the set of s-term DNF with k = O(s log(s/ǫ)) relevant variables. All the procedures makes O(s/ǫ) queries except CloseF CU that makes O(s2/ǫ) queries. This is because that the size of the class C ∗(Γ) is 2 O(s2) and therefore CloseF CU makes O(s2/ǫ) queries. This gives a tester that makes O(s2/ǫ) queries which is not optimal. Instead, we consider the class C ′ of s-term DNF with O(s log(s/ǫ)) variables and terms of size at most c log(s/ǫ) and show that, in CloseF CU , whp, all the terms T of size greater than c log(s/ǫ) 9 and all the random strings u chosen in the procedure satisfies T (u) = 0 and therefore it runs as if the target function h has only terms of size at most c log(s/ǫ). This gives a tester that makes O(s/ǫ) queries. As in the previous section, all the procedures run in polynomial time except CloseF CU . For some classes, we replace CloseF CU with polynomial time learning algorithms and obtains poly- nomial time testers. 2 Preparing the Target for Accessing the Relevant Variables In this Section we give the three procedures ApproxTarget, TestSets and RelVarValues. 2.1 Preliminaries In this subsection, we give some known results that will be used in the sequel. The following lemma is straightforward Lemma 1. If {Xi}i∈[r] is a partition of [n] then for any Boolean function f the number of relevant sets Xi of f is at most the number of relevant variables of f . We will use the following folklore result that is formally proved in [45]. Lemma 2. Let {Xi}i∈[r] be a partition of [n]. Let f be a Boolean function and u, w ∈ {0, 1}n. If f (u) 6= f (w) then a relevant set Xℓ of f with a string v ∈ {0, 1}n that satisfies f (v) 6= f (wXℓ ◦ vXℓ ) can be found using ⌈log2 r⌉ queries. The following is from [8] Lemma 3. There exists a one-sided adaptive algorithm, UniformJunta(f, k, ǫ, δ), for ǫ-testing k-junta that makes O(((k/ǫ) + k log k) log(1/δ)) queries and rejects f with probability at least 1 − δ when it is ǫ-far from every k-junta with respect to the uniform distribution. Moreover, it rejects only when it has found k + 1 pairwise disjoint relevant sets and a witness of f for each one. 2.2 Approximating the Target In this subsection we give the procedure ApproxTarget that returns (X = ∪i∈IXi, V = {v(i)}i∈I , I), X ⊆ [n], V ⊆ {0, 1}n and I ⊆ [r] where, whp, each x(Xi), i ∈ I, contains at least one relevant variable of h := f (xX ◦ 0X ) and exactly one if f is k-junta. Each v(i), i ∈ I, is a witness of f (xX ◦ 0X ) for the relevant set Xi. Also, whp, f (xX ◦ 0X) is (ǫ/c)-close to the target with respect to the distribution D. Consider the procedure ApproxTarget in Figure 2. In steps 1-2 the procedure partitions the set [n] into r = 2k2 disjoint sets X1, X2, . . . , Xr. In step 3 it defines the variables X, I, V and t(X). At each iteration of the procedure, I contains the indices of some relevant sets of f (xX ◦ 0X ) where X = ∪i∈IXi, i.e., each Xi, i ∈ I is relevant set of f (xX ◦ 0X ). The set V contains, for each i ∈ I, a string v(i) ∈ {0, 1}n that satisfies f (v(i) X\Xi ◦ 0Xi ◦ 0X ). That is, a witness of f (xX ◦ 0X ) for the relevant set Xi, i ∈ I. The procedure in steps 4-19 tests if f (uX ◦ 0X ) = f (u) for at least c ln(15/k)/ǫ, independently and at random, chosen u according to the distribution D. The variable t(X) counts the number X ◦ 0X ) 6= f (v(i) 10 ApproxTarget(f,D, ǫ, c) Input: Oracle that accesses a Boolean function f and an oracle that draws x ∈ {0, 1}n according to the distribution D. Output: Either "reject" or (X, V, I) Partition [n] into r sets 1. 2. Choose uniformly at random a partition X1, X2, . . . , Xr of [n] Set r = 2k2. Choose u ∈ D. t(X) ← t(X) + 1 If f (uX ◦ 0X ) 6= f (u) then W ← ∅. Binary Search to find a new relevant set from (u, uX ◦ 0X ) → ℓ; Xℓ ◦ 0Xℓ ); and a string w(ℓ) ∈ {0, 1}n such that f (w(ℓ)) 6= f (w(ℓ) Set X = ∅; I = ∅; V = ∅; t(X) = 0. Find a close function and relevant sets 3. 4. Repeat M = ck ln(15k)/ǫ times 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. X ← X ∪ Xℓ; I ← I ∪ {ℓ}. If I > k then Output("reject"). W = W ∪ {w(ℓ)}. Choose w(r) ∈ W . If f (w(r) ) then X ◦ 0X ) 6= f (w(r) X\Xr ◦ 0X∪Xr W ← W\{w(r)}; v(r) ← w(r) If W 6= ∅ then Goto 14 X ◦ 0X ; V ← V ∪ {v(r)}; X ◦ 0X ) 6= f (w(r)) then u ← w(r); Goto 9 Xr ◦ 0Xr ; Goto 9 Else If f (w(r) Else u ← w(r) 16. 17. 18. 19. t(X) = 0. If t(X) = c ln(15k)/ǫ then Output(X, V, I). Figure 2: A procedure that finds relevant sets {Xi}i∈I of f and a witness v(i) for each relevant set Xi for h := f (xX ◦ 0X) where X = ∪i∈IXi. Also, whp, h is (ǫ/c)-close to the target. of such u. If this happens then, whp, f (xX ◦ 0X ) is (ǫ/c)-close to f with respect to D and the procedure returns (X, V, I). If not then f (uX ◦ 0X ) 6= f (u) for some u and then a new relevant set is found. If the number of relevant sets is greater than k, it rejects. This is done in steps 8-18. In steps 9-10, the procedure uses Lemma 2 to (binary) searches for a new relevant set. The search gives an index ℓ of the new relevant set Xℓ and a witness w(ℓ) that satisfies f (w(ℓ)) 6= f (0Xℓ ◦ w(ℓ) ). Then ℓ is added to I and X is extended to X ∪ Xℓ. The binary search gives a witness that Xℓ is relevant set of f , but not a witness that it is relevant set of f (xX ◦ 0X ). This is why we need steps 14-17. In those steps the procedure adds w(ℓ) to W . Then for each w(r) ∈ W (at the beginning r = ℓ) it checks if w(r) is a witness of f (xX ◦ 0X ) for Xr. If it is then it adds it to V . If it isn't Xℓ 11 then we show in the discussion below that a new relevant set can be found. The procedure rejects when it finds more than k relevant sets. If the procedure does not reject then it outputs (X, V, I) where I contains the indices of some relevant sets of f (xX ◦ 0X ), X = ∪i∈IXi and the set V contains for each i ∈ I a string v(i) ∈ {0, 1}n that is a witness of f (xX ◦ 0X ) for Xi, i.e., f (v(i) X\Xi ◦ 0Xi ◦ 0X). We will also show in Lemma 9 that, whp, PrD[f (xX ◦ 0X ) 6= f (x)] ≤ ǫ/c. X ◦ 0X) 6= f (v(i) We first prove Lemma 4. Consider steps 1-2 in the ApproxTarget. If f is a k-junta then, with probability at least 2/3, for each i ∈ [r], the set x(Xi) = {xjj ∈ Xi} contains at most one relevant variable of f . Proof. Let xi1 and xi2 be two relevant variables in f . The probability that xi1 and xi2 are in the same set is equal to 1/r. By the union bound, it follows that the probability that some relevant variables xi1 and xi2, i1 6= i2, in f are in the same set is at most(cid:0)k Sq i=1 Xℓi Xr 2(cid:1)/r ≤ 1/3. X (j) X (j) =Sj X (j)\Xr *********** *********** *********** i=j+1 Xℓi 00000000000 *********** 00000000000 X (q) 000000 ****** 000000 ***** ***** ***** v(r) w(r) w(r) X (j) ◦ 0 w(r) Xr ◦ 0Xr w(r) X (j)\Xr ◦ 0 X (j) = v(r) X (j)∪Xr *********** 00000 *********** ****** *********** 00000 00000000000 000000 Figure 3: The value of v(r), w(r), w(r) any value. X (j) ◦ 0 X (j) , w(r) Xr ◦ 0Xr and w(r) X (j)\Xr ◦ 0 X (j)∪Xr where * indicates Recall that after the binary search in step 9 the procedure has a witness w(ℓ) that satisfies f (w(ℓ)) 6= f (w(ℓ) Xℓ ◦ 0Xℓ ) that is not necessarily a witness of f (xX ◦ 0X) for Xℓ, i.e., does not necessarily satisfies f (w(ℓ) X\Xℓ ◦ 0Xℓ ◦ 0X ). This is why we first add w(ℓ) to W and not to V . We next will show that an element w(r) in W is either a witness of f (xX ◦ 0X ) for Xℓ, in which case we add it to V and remove it from W , or, this element generates another new relevant set and then another witness of f is added to W . X ◦ 0X ) 6= f (w(ℓ) Suppose the variable ℓ in the procedure takes the values ℓ1, . . . , ℓq. Then Xℓ takes the values Xℓ1, . . . , Xℓq and X takes the values X (i) where X (i) = X (i−1) ∪ Xℓi and X (0) = ∅. Notice that X (0) ⊂ X (1) ⊂ ··· ⊂ X (q). Suppose, at some iteration, the procedure chooses, in step 14, w(r) ∈ W where r = ℓi. By step 10, f (w(r)) 6= f (w(r) Xr ◦ 0Xr ). Suppose at this iteration X = X (j). Then r ≤ j, Xℓ1, . . . , Xℓj are the relevant sets that are discovered so far and Xℓj+1, . . . , Xℓq ⊆ X (j). Since w(r) ∈ W , by step 11, Xr ⊆ X (j). See the table in Figure 3. ) then v(r) = w(r) X (j)∪Xr X (j) is added to the set V . This is the only step that adds an element to V . X (j)) 6= f (w(r) If in step 15, f (w(r) X (j)\Xr ◦ 0 X (j) ◦ 0 X (j) ◦ 0 12 Since v(r) = w(r) f (w(r) X (j)\Xr ◦ 0 Therefore X (j)∪Xr X (j) ◦ 0 X (j) and X (j) ⊆ X (q) we have v(r) ) = f (v(r) Xr ◦ 0Xr ). X (q) = 0 and f (v(r)) = f (w(r) X (j) ◦ 0 X (j)) 6= Lemma 5. If the procedure outputs (X (q), V, I) then for every v(ℓ) ∈ V we have v(ℓ) f (v(ℓ)) 6= f (v(ℓ) Xℓ ◦ 0Xℓ ). That is, v(ℓ) ∈ V is a witness of f (xX (q) ◦ 0 X (q)) for Xℓ. X (q) = 0 and We now show that if, in step 15, f (w(r) X ◦ 0X ) = f (w(r) X\Xr ◦ 0X∪Xr new relevant set. ) then the procedure finds a Lemma 6. Consider step 15 in the procedure in the iteration where X = X (j). If w(r) is not a witness of f (xX (j) ◦0 ), then a new relevant set is found. X (j) ) for Xr, i.e., f (w(r) X (j)) = f (w(r) X (j)\Xr ◦0 X (j) ◦0 X (j)∪Xr X (j) ◦ 0 X (j) ◦ 0 X (j)) or f (w(r) Proof. See the table in Figure 3 throughout the proof. Since by step 10, f (w(r)) 6= f (w(r) then either f (w(r)) 6= f (w(r) f (w(r) set in X (j). Step 9 finds a new relevant set because w(r) and w(r) f (w(r) Xr ◦ 0Xr ) then the procedure in step 17 assign u = w(r) to step 9 to find a relevant set in X (j). Step 9 finds a new relevant set because w(r) and w(r) Xr ◦ 0Xr ), If f (w(r)) 6= X (j)) then the procedure in step 16 assign u = w(r) and goes to step 9 to find a relevant X (j) are equal on X (j). If Xr ◦ 0Xr and goes X (j)\Xr ◦ 0 ) 6= f (w(r) ) 6= f (w(r) X (j)\Xr ◦ 0 Xr ◦ 0Xr ). X (j)\Xr ◦ 0 X (j) ◦ 0 X (j)∪Xr X (j)∪Xr X (j)∪Xr Xr ◦ 0Xr are equal on X (j). Therefore, for every w(r) ∈ W the procedure either finds v(r) that satisfies the condition in Lemma 5 or finds a new relevant set. If the number of relevant sets is greater than k, then the procedure rejects. This is because each relevant set contains a relevant variable, and the relevant sets are disjoint. So the function, in this case, is not k-junta and therefore not in C. If the number of relevant sets is less than or equal to k, then the algorithm eventually finds, for each ℓ ∈ I, a witness v(ℓ) of f (xX ◦ 0X ) for Xiℓ. This implies Lemma 7. If ApproxTarget does not reject then it outputs (X = X (q), V = {v(ℓ1), . . . , v(ℓq)}, I = {ℓ1, . . . , ℓq}) that satisfies 1. q = I ≤ k. 2. For every ℓ ∈ I, v(ℓ) f (xX ◦ 0X ) for Xℓ . X = 0 and f (v(ℓ)) 6= f (0Xℓ ◦ v(ℓ) Xℓ ). That is, v(ℓ) ∈ V is a witness of 3. Each x(Xℓ), ℓ ∈ I, contains at least one relevant variable of f (xX ◦ 0X ). Lemma 8. If f is k-junta and each x(Xi) contains at most one relevant variable of f then 1. ApproxTarget outputs (X, V, I). 2. Each x(Xℓ), ℓ ∈ I, contains exactly one relevant variable in f (xX ◦ 0X ). 3. For every ℓ ∈ I, f (xXℓ ◦ v(ℓ) ) is a literal. Xℓ 13 Proof. By 3 in Lemma 7, x(Xℓ), ℓ ∈ I, contains exactly one relevant variable. Thus, for every ℓ ∈ I, f (xXℓ ◦ v(ℓ) Since f contains at most k relevant variables, by Lemma 1, the number of relevant sets I is at ) is a literal. most k. Therefore, ApproxTarget does not halt in step 12. Xℓ The following lemma shows that Lemma 9. If ApproxTarget outputs (X, V, I) then I ≤ k and with probability at least 14/15 Pru∈D[f (uX ◦ 0X ) 6= f (u)] ≤ ǫ/c. Proof. If I > k then, from step 12, ApproxTarget outputs "reject". Therefore, the probabil- ity that ApproxTarget fails to output (X, V, I) with Pru∈D[f (uX ◦ 0X ) 6= f (u)] ≤ ǫ/c is the probability that for some X (ℓ), Pru∈D[f (xX (ℓ) ◦ 0 X (ℓ)) = f (u) for c ln(15k)/ǫ strings u chosen independently at random according to the distribution D. This probability is at most X (ℓ)) 6= f (x)] > ǫ/c and f (uX (ℓ) ◦ 0 k(cid:16)1 − c ǫ(cid:17)c ln(15k)/ǫ 1 15 . ≤ We now give the query complexity Lemma 10. The procedure ApproxTarget makes O((k log k)/ǫ) queries. Proof. The condition in step 7 requires two queries and is executed at most M = ck ln(15k)/ǫ times. This is 2M = O((k log k)/ǫ) queries. Steps 9-17 are executed at most k + 1 times. This is because each time it is executed, the value of I is increased by one, and when I = k + 1 the procedure rejects. By Lemma 2, to find a new relevant set the procedure makes O(log r) = O(log k) queries. This gives another O(k log k) queries. Therefore, the query complexity is O((k log k)/ǫ). 2.3 Testing the Relevant Sets In this subsection we give the procedure TestSets that takes as an input (X, V = {v(ℓ1), . . . , v(ℓq)}, I = {ℓ1, . . . , ℓq}) and tests if for all ℓ ∈ I, f (xXℓ ◦ v(ℓ) ) is (1/30)-close to some literal with respect to Xℓ the uniform distribution. We first prove Lemma 11. If f is k-junta and each x(Xi) contains at most one relevant variable of f then TestSets returns "OK". Proof. By Lemma 8, for every ℓ ∈ I, f (xXℓ ◦ v(ℓ) Xℓ ) is a literal. If TestSets rejects in step 3 then, by Lemma 3, for some Xℓ, ℓ ∈ I, f (xXℓ ◦ v(ℓ) Xℓ (literal or constant function) and therefore x(Xℓ) contains at least two relevant variables. rejects in step 5, then f (bXℓ ◦ v(ℓ) ) and then f (xXℓ ◦ v(ℓ) ) = f (bXℓ ◦ v(ℓ) Xℓ Xℓ Xℓ ) is not 1-Junta If it ) is not a literal. In all cases we get a contradiction. In the following lemma we show that if TestSets returns "OK" then, whp, each f (xXℓ ◦ v(ℓ) Xℓ is close to a literal with respect to the uniform distribution. ) 14 TestSets(X, V, I) Input: Oracle that accesses a Boolean function f and (X, V, I). Output: Either "reject" or "OK" 1. For every ℓ ∈ I do 2. 3. 4. 5. 6. Return "OK" If UniformJunta(f (xXℓ ◦ v(ℓ) Choose b ∈ U If f (bXℓ ◦ v(ℓ) ) = f (bXℓ ◦ v(ℓ) then Output("reject") Xℓ Xℓ Xℓ ), 1, 1/30, 1/15)="reject" ) then Output("reject") Figure 4: A procedure that tests if for all ℓ ∈ I, f (xXℓ ◦ v(ℓ) Xℓ respect to the uniform distribution. ) is (1/30)-close to some literal with Xℓ Xℓ ) is (1/30)-far from every literal with respect to the Lemma 12. If for some ℓ ∈ I, f (xXℓ ◦ v(ℓ) uniform distribution then, with probability at least 1 − (1/15), TestSets rejects. Proof. If f (xXℓ◦v(ℓ) ) is (1/30)-far from every literal with respect to the uniform distribution then it is either (case 1) (1/30)-far from every 1-Junta (literal or constant) or (case 2) (1/30)-far from every literal and (1/30)-close to 0-Junta. In case 1, by Lemma 3, with probability at least 1 − (1/15), UniformJunta (f (xXℓ ◦ v(ℓ) ), 1, 1/30, 1/15) = "reject" and then the procedure rejects. In case 2, if f (xXℓ ◦ v(ℓ) is random uniform and for g(x) = f (xXℓ ◦ v(ℓ) to 1. Suppose it is (1/30)-close to 0. Let b be a random uniform string chosen in steps 4. Then b ) is (1/30)-close to some 0-Junta then it is either (1/30)-close to 0 or (1/30)-close ) we have Xℓ Xℓ Xℓ Pr[The procedure does not reject] = Pr(cid:2)g(b) 6= g(b)(cid:3) = Pr[g(b) = 1 ∧ g(b) = 0] + Pr[g(b) = 0 ∧ g(b) = 1] ≤ Pr[g(b) = 1] + Pr[g(b) = 1] ≤ 1 15 . Lemma 13. The procedure TestSets makes O(k) queries. Proof. Steps 2 and 5 are executed I ≤ k times, and by Lemma 3, the total number of queries made is O(1/(1/30) log(15))k + 2k = O(k). 2.4 Determining the Values of the Relevant Variables In this subsection we give a procedure RelVarValue that for an input (w ∈ {0, 1}n, X, V, I, δ) where (X, V, I) satisfies all the properties in the previous two subsections, the procedure, with 15 RelVarValues(w, X, V, I, δ) Input: Oracle that accesses a Boolean function f , (X, V, I) and w ∈ {0, 1}n. Output: Either "reject" or for every ℓ ∈ I, the value, zℓ = wτ (ℓ) where xτ (ℓ) is one of the relevant variables of f (xX ◦ 0X ) in x(Xℓ) For ξ ∈ {0, 1} set Yℓ,ξ = {j ∈ Xℓwj = ξ}. Set Gℓ,0 = Gℓ,1 = 0; Repeat h = ln(k/δ)/ ln(4/3) times Choose b ∈ U ; 1. For every ℓ ∈ I do 2. 3. 4. 5. 6. 7. 8. 9. 10. Output("{zℓ}ℓ∈I ") If f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) If f (bYℓ,1 ◦ bYℓ,0 ◦ v(ℓ) Xℓ Xℓ ) 6= f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) 6= f (bYℓ,1 ◦ bYℓ,0 ◦ v(ℓ) Xℓ Xℓ ) then Gℓ,0 ← Gℓ,0 + 1 ) then Gℓ,1 ← Gℓ,1 + 1 If ({Gℓ,0, Gℓ,1} 6= {0, h}) then Output("reject") If Gℓ,0 = h then zℓ ← 0 else zℓ ← 1 Figure 5: A procedure that takes as input (X, V, I) and a string w ∈ {0, 1}n and, with probability at least 1 − δ, returns the values of wτ (i), i ∈ I, where f (xXi ◦ v(i) ) is (1/30)-close to one of the literals in {xτ (i), xτ (i)} with respect to the uniform distribution. Xi probability at least 1 − δ, returns the values of wτ (i), i ∈ I, where f (xXi ◦ v(i) ) is (1/30)-close to one of the literals in {xτ (i), xτ (i)} with respect to the uniform distribution. When f is k-junta and each x(Xi) contains at most one relevant variable then {xτ (i)}i∈I is the set of the relevant variables of f (xX ◦ 0X ) and wτ (i), i ∈ I are the values of the relevant variables. The procedure is in Figure 5. Xi We first prove Lemma 14. If f is k-Junta and each x(Xi) contains at most one relevant variable of f then RelVarValues outputs z such that zℓ = wτ (ℓ) where f (xXℓ ◦ 0Xℓ Proof. Since Yℓ,0, Yℓ,1 is a partition of Xℓ, ℓ ∈ I and, by Lemma 8, x(Xℓ) contains exactly one relevant variable xτ (ℓ) of f (xX ◦ 0X ), this variable is either in x(Yℓ,0) or in x(Yℓ,1) but not in both. Suppose w.l.o.g. it is in x(Yℓ,0) and not in x(Yℓ,1). Then wτ (ℓ) = 0, f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) is a literal and f (xYℓ,1 ◦ bYℓ,0 ◦ v(ℓ) ) 6= f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ). Therefore, by steps 6-7 in the procedure, Gℓ,0 = h and Gℓ,1 = 0 and the procedure does not output reject in step 8. Thus, by step 9, zℓ = wτ (ℓ). ) is a constant function. This implies that for any b, f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) and f (bYℓ,1 ◦ bYℓ,0 ◦ v(ℓ) ) = f (bYℓ,1 ◦ bYℓ,0 ◦ v(ℓ) ) ∈ {xτ (ℓ), xτ (ℓ)}. Xℓ Xℓ Xℓ Xℓ Xℓ Xℓ We now prove Lemma 15. If for every ℓ ∈ I the function f (xXℓ ◦ v(ℓ) ) is (1/30)-close to a literal in {xτ (ℓ), ¯xτ (ℓ)} with respect to the uniform distribution, where τ (ℓ) ∈ Xℓ, and in RelVarValues, for every ℓ ∈ I, {Gℓ,0, Gℓ,1} = {0, h} then, with probability at least 1 − δ, we have: For every ℓ ∈ I, zℓ = wτ (ℓ). Xℓ 16 Proof. Fix some ℓ. Suppose f (xXℓ ◦ v(ℓ) ) is (1/30)-close to xτ (ℓ) with respect to the uniform distribution. The case when it is (1/30)-close to xτ (ℓ) is similar. Since Xℓ = Yℓ,0 ∪ Yℓ,1 and Yℓ,0 ∩ Yℓ,1 = ∅ we have that τ (ℓ) ∈ Yℓ,0 or τ (ℓ) ∈ Yℓ,1, but not both. Suppose τ (ℓ) ∈ Yℓ,0. The case where τ (ℓ) ∈ Yℓ,1 is similar. Define the random variable Z(xXℓ) = 1 if f (xXℓ ◦ v(ℓ) ) 6= xτ (ℓ) and Z(xXℓ) = 0 otherwise. Then Xℓ Xℓ ExXℓ ∈U [Z(xXℓ)] ≤ 1 30 . Therefore and by Markov's bound ExYℓ,1 ∈U ExYℓ,0 ∈U [Z(xYℓ,0 ◦ xYℓ,1)] ≤ 1 30 PrxYℓ,1 ∈U(cid:20)ExYℓ,0 ∈U [Z(xYℓ,0 ◦ xYℓ,1)] ≥ 2 15(cid:21) ≤ 1 4 . That is, for a random uniform string b ∈ {0, 1}n, with probability at least 3/4, f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) is (2/15)-close to xτ (ℓ) with respect to the uniform distribution. Now, given that f (xYℓ,0 ◦bYℓ,1 ◦v(ℓ) ) Xℓ is (2/15)-close to xτ (ℓ) with respect to the uniform distribution the probability that Gℓ,0 = 0 is the probability that f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) for h random uniform strings b ∈ {0, 1}n. Let b(1), . . . , b(h) be h random uniform strings in {0, 1}n, V (b) be the event f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) = ) and A the event that f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) to the uniform distribution. Let g(xYℓ,0) = f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) = f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) is (2/15)-close to xτ (ℓ) with respect ). Then Xℓ Xℓ Xℓ Xℓ Xℓ Xℓ Xℓ ) Pr[V (b)A] = Pr[g(bYℓ,0) = g(bYℓ,0)A] = Pr[(g(bYℓ,0 ) = bτ (ℓ) ∧ g(bYℓ,0) = bτ (ℓ)) ∨ (g(bYℓ,0 ) = bτ (ℓ) ∧ g(bYℓ,0 ) = bτ (ℓ))A] ≤ Pr[g(bYℓ,0) 6= bτ (ℓ) ∨ g(bYℓ,0) 6= bτ (ℓ))A] ≤ Pr[g(bYℓ,0) 6= bτ (ℓ)A] + Pr[g(bYℓ,0 ) 6= bτ (ℓ))A] ≤ 4 15 . Since τ (ℓ) ∈ Yℓ,0, we have wτ (ℓ) = 0. Therefore, by step 9 and since τ (ℓ) ∈ Xℓ, Pr[zℓ 6= wτ (ℓ)] = Pr[zℓ = 1] = Pr[Gℓ,0 = 0 ∧ Gℓ,1 = h] ≤ Pr[Gℓ,0 = 0] = Pr[(∀j ∈ [h])V (b(j))] = (Pr[V (b)])h ≤(cid:0)Pr[V (b)A] + Pr[A](cid:1)h ≤ (4/15 + 1/4)h ≤ (3/4)h Therefore, the probability that zℓ 6= wτ (ℓ) for some ℓ ∈ I is at most k(3/4)h ≤ δ. The following is obvious Lemma 16. The procedure RelVarValues makes O(k log(k/δ)) queries. 17 3 Testing Subclasses of k-Junta In this section, we give testers for subclasses of k-Junta that are closed under variable and zero projections. Our tester will start by running the two procedures ApproxTarget and TestSets and there- fore, by Lemmas 4, 8 and 11, if f ∈ C (and therefore is k-junta) then, with probability at least 2/3, both procedures do not reject and item 1 in the following Assumption happens. By Lemmas 7, 9, and 12, if f is ǫ-far from every function in C and both procedures do not reject then, with probability at least 13/15, item 2 in the following Assumption happens. Obviously, the above two probabilities can be changed to 1 − δ for any constant δ without changing the asymptotic query complexity. Assumption 17. Throughout this section we assume that there are X, q ≤ k, I = {ℓ1, . . . , ℓq} and V = {v(ℓ1), . . . , v(ℓq)} such that: For every ℓ ∈ I, v(ℓ) ). That is, v(ℓ) ∈ V is a witness of f (xX ◦ 0X) for Xℓ and = 0 and f (v(ℓ)) 6= f (0Xℓ ◦ v(ℓ) Xℓ X 1. If f ∈ C (and therefore is k-junta) • f (xX ◦ 0X ) ∈ C. • Each x(Xℓ), ℓ ∈ I contains exactly one relevant variable. • For every ℓ ∈ I, f (xXℓ ◦ v(ℓ) ) is a literal in {xτ (ℓ), xτ (ℓ)}. Xℓ 2. If f is ǫ-far from every function in C then • f (xX ◦ 0X) is (ǫ/3)-close to f with respect to D and therefore f (xX ◦ 0X ) is (2ǫ/3)-far from every function in C with respect to D. • For every ℓ ∈ I, f (xXℓ ◦ v(ℓ) ) is (1/30)-close to a literal in {xτ (ℓ), ¯xτ (ℓ)} with respect to Xℓ the uniform distribution. We will also use the set of indices Γ := {τ (ℓ1), . . . , τ (ℓq)}. Notice that if f is k-junta then x(Γ) are the relevant variables of f . We remind the reader that for a projection π : X → X the string x(π) is defined as x(π)j = xπ(j) for every j ∈ X. Define the projection πf,I : X → X that satisfies: For every ℓ ∈ I and every j ∈ Xℓ, πf,I(j) = τ (ℓ). Define the function F (xΓ) = F (xτ (ℓ1), . . . , xτ (ℓq)) := f (x(πf,I) ◦ 0X ). That is, F is the function that results from substituting in f (xX ◦ 0X) for every ℓ ∈ I and every xi, i ∈ Xℓ, the variable xτ (ℓ). Note here that the tester does not know τ (ℓ1), . . . , τ (ℓq). We now show how to query F by querying f Lemma 18. For the function F we have 1. Given (y1, . . . , yq), computing F (y1, . . . , yq) can be done with one query to f . 2. Given x ∈ {0, 1}n and δ, there is an algorithm that makes O(k log(k/δ)) queries and, with probability at least 1 − δ, either discovers that some Xi, i ∈ I contains at least two rel- evant variables in f (and therefore, whp, f is not k-junta) and then rejects or computes z = (xτ (ℓ1), . . . , xτ (ℓq)) and F (z). 18 Proof. 1 is immediate. To prove 2 we use Lemma 15. We run RelVarValues(x, X, V, I, δ). If it rejects then {Gℓ,0, Gℓ,1} 6= {0, h} for some ℓ ∈ I and therefore Gℓ,0, Gℓ,1 > 0. This implies that for some b, b′ ∈ {0, 1}n, f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) 6= f (b′ ). Since Xℓ = Yℓ,0 ∪ Yℓ,1 and Yℓ,0 ∩ Yℓ,1 = ∅, the set x(Xℓ) contains at least two relevant variables in f . Yℓ,1 ◦ b′ If for every ℓ we have {Gℓ,0, Gℓ,1} = {0, h} then, by Lemma 15, with probability at least 1 − δ, the procedure outputs z where for every ℓ, zℓ = xτ (ℓ). Then using 1 we compute F (z). Since by Lemma 16, RelVarValue makes O(k log(k/δ)) queries, the result follows. ) 6= f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) Yℓ,0 ◦ v(ℓ) Xℓ Yℓ,0 ◦ v(ℓ) Xℓ Xℓ ) and f (b′ Yℓ,1 ◦ b′ Xℓ We now give the key lemma for the first tester Lemma 19. Let C ⊆ k−Junta be a class that is closed under variable and zero projections and f be any Boolean function. Let F (xΓ) = f (x(πf,I ) ◦ 0X ) where Γ = {τ (ℓ)ℓ ∈ I} and C(Γ) be the set of all functions in C that their relevant variables are x(Γ). If Assumption 17 is true, then 1. If f ∈ C then f (xX ◦ 0X ) = F ∈ C(Γ). 2. If f is ǫ-far from every function in C with respect to D then either (a) f (xX ◦ 0X ) is (ǫ/3)-far from F with respect to D, or (b) F is (ǫ/3)-far from every function in C(Γ) with respect to D. If f ∈ C, then since C is closed under variable and zero projection Proof. We first prove 1. f (xX ◦ 0X) ∈ C. We have f (xX ◦ 0X ) = f (◦ℓ∈I xXℓ ◦ 0X) and, by Assumption 17, every x(Xℓ), ℓ ∈ I, contains exactly one relevant variable xτ (ℓ) of f (xX ◦ 0X ). Therefore, f (xX ◦ 0X ) is a function that depends only on the variables xτ (ℓ), ℓ ∈ I. By the definition of x(πf,I ) and since τ (ℓ) ∈ Xℓ we have x(πf,I )τ (ℓ) = xτ (ℓ) and therefore f (xX ◦ 0X) = f (x(πf,I ) ◦ 0X ) = F . We now prove 2. Suppose, for the contrary, f (xX ◦ 0X) is (ǫ/3)-close to F with respect to D and F is (ǫ/3)-close to some function g ∈ C(Γ) with respect to D. Then f (xX ◦ 0X ) is (2ǫ/3)-close to g with respect to D. Since, by Assumption 17, f (xX ◦ 0X ) is (ǫ/3)-close to f with respect to D we get that f is ǫ-close to g ∈ C with respect to D. A contradiction. In the following two subsections we discuss how to test the closeness of f (xX ◦ 0X) to F and F to C(Γ). We will assume all the procedures in the following subsections have access to X, V, I that satisfies Assumption 17. 3.1 Testing the Closeness of f (xX ◦ 0X) to F We now give the procedure Closef F that tests whether f (xX ◦0X ) is (ǫ/3)-far from F with respect to D. See Figure 6. Lemma 20. For any ǫ, a constant δ, and (X, V, I) that satisfies Assumption 17, procedure Closef F makes O((k/ǫ) log(k/ǫ)) queries and 1. If f ∈ C then Closef F returns OK. 19 Closef F (f,D, ǫ, δ) Input: Oracle that accesses a Boolean function f and D. Output: Either "reject" or "OK" 1. Define F ≡ f (x(πf,I) ◦ 0X). 2. Repeat t = (3/ǫ) ln(2/δ) times 3. 4. 5. 6. Return "OK". Choose u ∈ D. z ←RelVarValue(u, X, V, I, δ/(2t)) . If f (uX ◦ 0X) 6= F (z) then Output("reject") Figure 6: A procedure that tests whether f (xX ◦ 0X ) is (ǫ/3)-far from F with respect to D. 2. If f (xX ◦ 0X ) is (ǫ/3)-far from F with respect to D then, with probability at least 1 − δ, Closef F rejects. Otherwise it rejects. Assumption 17, z(i) = u(i) Γ ) = f (u(i) Γ and if F (u(i) Γ ) = f (u(i) Proof. Closef F draws t = (3/ǫ) ln(2/δ) random u(i) ∈ {0, 1}n, i = 1, . . . , t according to the distribution D. It finds z(i) = u(i) X ◦ 0X ) for all i then it returns "OK". X ◦ 0X ) for every i. By Lemma 14 and If f ∈ C then, by 1 in Lemma 19, F (u(i) Suppose now f (xX◦0X ) is (ǫ/3)-far from F with respect to D. By 2 in Lemma 18, RelVarValue makes O(k log((kt)/δ)) queries and computes F (u(i) Γ ), i = 1, . . . , t, with failure probability at most δ/2. Then the probability that it fails to reject is at most (1 − ǫ/3)t ≤ δ/2. This gives the result. Γ for all i, and therefore Closef F returns OK. Therefore, Closef F makes O((k/ǫ) log(k/ǫ)) queries and satisfies 1 and 2. 3.2 Testing the Closeness of F to C(Γ) In this section, we give the procedures CloseF CD and CloseF CU that test whether F is (ǫ/3)-far from every function in C(Γ) with respect to D and the uniform distribution, respectively. We prove Lemma 21. For any ǫ and any constant δ and (X, V, I) that satisfies Assumption 17, the pro- cedures CloseF CD and CloseF CU make O((k log C(Γ))/ǫ) and O((log C(Γ))/ǫ) queries to f , respectively, and 1. If f ∈ C then CloseF CD and CloseF CU output OK. 2. If F is (ǫ/3)-far from every function in C(Γ) with respect to D then, with probability at least 1 − δ, CloseF CD rejects. 3. If F is (ǫ/3)-far from every function in C(Γ) with respect to the uniform distribution, then with probability at least 1 − δ, CloseF CU rejects. Both procedures run in time poly(n,C(Γ), 1/ǫ). 20 CloseF CD(f,D, ǫ, δ) Input: Oracles that access a Boolean function f and D. Output: Either "reject" or "OK" Choose u ∈ D. z ←RelVarValue(u, X, V, I, 1/2) . For every g ∈ C ∗ If C ∗ = ∅ then Output("Reject") 1. C ∗ ← C(Γ) 2. Repeat τ = (12/ǫ) ln(2C ∗/δ) times 3. 4. 5. 6. 7. 8. Return "OK" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - CloseF CU (f, ǫ, δ) Input: Oracle that accesses a Boolean function f . Output: Either "reject" or "OK" If g(z) 6= F (z) then C ∗ ← C ∗\{g}. 1. C ∗ ← C(Γ) 2. Repeat τ = (3/ǫ) ln(2C ∗/δ)) times 3. 4. 5. 6. 7. Return "OK" Choose (z1, . . . , zq) ∈ U . For every g ∈ C ∗ If C ∗ = ∅ then Output("Reject") If g(z) 6= F (z) then C ∗ ← C ∗\{g}. Figure 7: Two procedures that test whether F is (ǫ/3)-far from every function in C(Γ) with respect to D and the uniform distribution, respectively. Proof. The proof for CloseF CU is similar to the proof of Lemma 20 with union bound. For CloseF CD, notice that it calls RelVarValue(u, X, V, I, 1/2), and therefore at each itera- tion, with probability 1/2, z = uΓ. By Chernoff's bound ((9) in Lemma 69), with probability at least 1 − δ/2, (3/ǫ) ln(2C ∗/δ) of the chosen us in the procedures satisfy z = uΓ. Then again, by union bound, the result follows. 3.3 Testing the Closeness of F to C(Γ) via Learning C(Γ) In this subsection, we show how proper learning implies testing the closeness of F to C(Γ). The proofs are similar to the proof of Proposition 3.1.1 in [38]. Let (X, V, I) be as in Assumption 17 and q = I ≤ k. Let Y = {y1, . . . , yq} be a set of Boolean variables and C(Y ) be the set of all functions in C that depend on all the variables of Y . Notice that instead of using C(Y ) we could have used C({x1, . . . , xq}) but here we use the new Boolean variables yi to avoid confusion with the variables xi of f . Remark 22. In all the lemmas in this subsection and the following one, in addition to the fact 21 that F depends on all the variables of Y , the learning algorithms can also make use of (X, V, I) that satisfies Assumption 17. This may help for some classes. For example1, if the target function is a unate monotone function, then from the witnesses in V , we can know if F is positive or negative unate in yi, for each variable yi. The following is an immediate result that follows from the two procedures CloseF CD and CloseF CU in the previous subsection Lemma 23. If there is a polynomial time algorithm that given a set Y = {(y(1), ξ1), . . . , (y(t), ξt)} ⊆ {0, 1}q × {0, 1} decides whether there is a function F ∈ C(Y ) that is consistent with Y, i.e., F (y(i)) = ξi for all i = 1, . . . , t, then there is a polynomial time algorithm BD (resp. BU ) that makes O((k log C(Γ))/ǫ) queries (resp. O((log C(Γ))/ǫ) queries) to f and 1. If f ∈ C then BD and BU output OK. 2. If F is (ǫ/3)-far from every function in C(Γ) with respect to D then, with probability at least 1 − δ, BD rejects. 3. If F is (ǫ/3)-far from every function in C(Γ) with respect to the uniform distribution then, with probability at least 1 − δ, BU rejects. We now give the reduction from exact learning Lemma 24. If there is a polynomial time algorithm A that, given as an input any constant δ, properly exactly learns C(Y ) with confidence parameter δ and makes M (δ) membership queries to F then there is a polynomial time algorithm B that, given as an input ǫ, any constant δ, makes M (δ/3) + O((k/ǫ) log(1/ǫ)) (resp. M (δ/3) + O(1/ǫ)) queries to f and 1. If f ∈ C then, with probability at least 1 − δ, B outputs OK. 2. If F is (ǫ/3)-far from every function in C(Γ) with respect to D (resp. with respect to the uniform distribution) then, with probability at least 1 − δ, B rejects. Proof. Algorithm B runs A with confidence parameter δ/3 to learn F (y1, . . . , yq). By Lemma 18, each membership query to F can be simulated by one membership query to f . If algorithm A runs more than it should, asks more than M (δ/3) membership queries or outputs h 6∈ C(Y ) then B rejects. If A outputs h ∈ C(Y ) then the algorithm needs to distinguish whether h(xΓ) is equal to F (xΓ) or (ǫ/3)-far from F (xΓ) with respect to the distribution D (resp. uniform distribution). When the distribution is uniform, the algorithm chooses t = (3/ǫ) ln(3/δ) strings v(1), . . . , v(t) ∈ {0, 1}q and if F (v(i)) = h(v(i)) for all i then it outputs "OK"; otherwise it rejects. In the distribution-free model, B chooses t = (12/ǫ) ln(2/δ) strings u(i) ∈ {0, 1}n according to the distribution D. Then runs RelValValue(u(i), X, V, I, 1/2) to find, with probability 1/2 the value of u(i) Γ ) for all i, then it outputs "OK"; otherwise it rejects. The analysis and correctness of the algorithm are the same as in the above proofs and Propo- Γ , i = 1, . . . , t. If F (u(i) Γ ) = h(u(i) sition 3.1.1 in [38]. 1See the definition of unate in Subsection 4.4 22 We now give the reduction from learning from MQ and ExQD Lemma 25. If there is a polynomial time algorithm A that, given as an input a constant δ, any ǫ, learns C(Y ) with respect to the distribution D (resp. uniform distribution), with confident δ, accuracy ǫ, makes M (ǫ, δ) M Q to F and Q(ǫ, δ) ExQD (resp. ExQU ) queries to F then there is a polynomial time algorithm BD (resp. BU ) that asks queries (resp. O(cid:18)M (ǫ/12, δ/3) + kQ(ǫ/12, δ/3) log(kQ(ǫ/12, δ/3)) + ǫ(cid:19) O(cid:18)M (ǫ/12, δ/3) + Q(ǫ/12, δ/3) + 1 k ǫ log 1 ǫ(cid:19) queries) to f and 1. If f ∈ C then with probability at least 1 − δ, BD and BU output OK. 2. If F is (ǫ/3)-far from every function in C(Γ) with respect to D then, with probability at least 1 − δ, BD rejects. 3. If F is (ǫ/3)-far from every function in C(Γ) with respect to the uniform distribution then, with probability at least 1 − δ, BU rejects. Proof. Algorithm B runs A with confidence parameter δ/3 and accuracy ǫ/12. By Lemma 18, every membership query to F (y) can be simulated with one membership query to f . Every ExQD′ (resp. ExQ) for the induced distribution D′ of D on the coordinates Γ, can be simulated with one ExQD and k log(3kQ(ǫ/12, δ/3)/δ) membership queries (resp. one ExQ) with failure probability δ/(3Q(ǫ/12, δ/3)), and therefore, with failure probability δ/3 for all the ExQD′ queries asked in the learning algorithm. If algorithm A runs more than it should, asks more than Q(ǫ/12, δ/3) ExQD′, asks more than If A outputs h ∈ C(Y ) then, with M (ǫ/12, δ/3) MQ or outputs h 6∈ C(Y ) then BD rejects. probability at least 1 − (2δ/3), 1. If F ∈ C(Γ) then F is (ǫ/12)-close to h 2. If F is (ǫ/3)-far from every function in C(Γ) then F is (ǫ/4)-far from h. Now, using Chernoff's bound in Lemma 69, algorithm B, can estimate the distance between F and h with accuracy ǫ/24 and confidence δ/6 using O((log(1/δ))/ǫ) strings chosen according to the distribution D′. This can be done using O((log(1/δ))/ǫ) queries in the uniform model and O((k/ǫ)(log(1/δ) log(1/(ǫδ))) with confidence δ/6 in the distribution-free model. Define the oracle WExQD (Weak ExQD) that returns with probability 1/2 a x ∈ {0, 1}n ac- cording to the distribution D and with probability 1/2 an arbitrary x ∈ {0, 1}n. In some of the learning algorithms given in the sequel, the algorithms still work if we replace the oracle ExQD with WExQD. In that case, we can save the factor of log(3kQ(ǫ/12, δ/3)/δ) in the query complexity of Lemma 25 in the distribution-free setting. We will discuss this in Section 8. 23 3.4 The First Tester We are now ready to give the first tester. Consider the tester TesterC in Figure 8. Note that the tester rejects if any one of the procedures called by the tester rejects. We prove TesterC(f,D, ǫ) Input: Oracle that accesses a Boolean function f and D. Output: If any one of the procedures reject then "reject" or "accept" (X, V, I) ←ApproxTarget(f,D, ǫ, 1/3). 1. 2. TestSets(X, V, I). 3. Define F ≡ f (x(πf,I ) ◦ 0X ) 4. Closef F (f,D, ǫ, 1/15) For any distribution 5. CloseF CD(f,D, ǫ, 1/15) 6. Return "accept" For the uniform distribution 5. CloseF CU (f, ǫ, 1/15) 6. Return "accept" Figure 8: A tester for subclasses C of k-Junta Theorem 26. Let C ⊆ k−Junta that is closed under zero and variable projections. Then 1. There is a poly(C(Γ), n, 1/ǫ) time two-sided adaptive algorithm, TesterC, for ǫ-testing C that makes O((1/ǫ)(k + log C(Γ))) queries. That is (a) If f ∈ C then, with probability at least 2/3, TesterC accepts. (b) If f is ǫ-far from every function in C with respect to the uniform distribution then, with probability at least 2/3, TesterC rejects. 2. There is a poly(C(Γ), n, 1/ǫ) time two-sided distribution-free adaptive algorithm, TesterC, for ǫ-testing C that makes O((k/ǫ) log(2C(Γ))) queries. That is (a) If f ∈ C then, with probability at least 2/3, TesterC accepts. (b) If f is ǫ-far from every function in C with respect to the distribution D then, with probability at least 2/3, TesterC rejects. Proof. We prove 1a and 2a. Let f ∈ C. Consider step 1 in TesterC. By Lemma 4 and 8, with probability at least 2/3, ApproxTarget outputs (X, V, I) that satisfies Assumption 17. Now with this assumption we have: By Lemma 11, TestSets in step 2 does not reject. By Lemma 20, 24 Closef F in step 4 does not reject. By Lemma 21, CloseF CD and CloseF CU in step 5 do not reject. Therefore, with probability at least 2/3 the tester accepts. We now prove 1b and 2b. Suppose f is ǫ-far from every function in C with respect to D. The proof for the uniform distribution is similar. If in step 1 ApproxTarget outputs (X, V, I) then by Lemma 9, with probability at least 14/15, f (xX ◦ 0X ) is (ǫ/3)-close to f . If in step 2 TestSets does not reject then, by Lemma 12, with probability at least 14/15, for all ℓ ∈ I, f (xXℓ ◦ v(ℓ) ) is (1/30)-close to a literal {xτ (ℓ), xτ (ℓ)}. Therefore with probability at least 13/15, Assumption 17 is true. Then by Lemma 19, either f (xX ◦ 0X ) is (ǫ/3)-far from F with respect to D, or F is (ǫ/3)-far from every function in C(Γ) with respect to D. If f (xX ◦ 0X ) is (ǫ/3)-far from F with respect to D then by Lemma 20, with probability at least 14/15, Closef F rejects. If F is (ǫ/3)-far from every function in C(Γ) with respect to D then by Lemma 21, with probability at least 14/15, CloseF C rejects. By the union bound the probability that the tester rejects is at least 2/3. Xℓ The query complexity follows from Lemmas 10, 13, 20 and 21. If we replace CloseF CD and CloseF CU with the testers in Lemma 23, 24 and 25, we get the following results Theorem 27. If there is a polynomial time algorithm that given a set Y = {(y(1), ξ1), . . . , (y(t), ξt)} ⊆ {0, 1}q × {0, 1} decides whether there is a function F ∈ C(Y ) that is consistent with Y, then 1. There is a polynomial time two-sided adaptive algorithm for ǫ-testing C that makes O((1/ǫ)(k+ log C(Γ))) queries. 2. There is a polynomial time two-sided distribution-free adaptive algorithm for ǫ-testing C that makes O((k/ǫ) log(2C(Γ))) queries. Theorem 28. If there is a polynomial time algorithm A that, given as an input any constant δ, properly exactly learns C(Y ) with confidence parameter δ and makes M (δ) membership queries then 1. There is a polynomial time two-sided adaptive algorithm for ǫ-testing C that makes M (1/24)+ O(k/ǫ) queries. 2. There is a polynomial time two-sided distribution-free adaptive algorithm for ǫ-testing C that makes M (1/24) + O(k/ǫ) queries. Theorem 29. If there is a polynomial time algorithm A that, given as an input a constant δ and any ǫ, learns C(Y ), with confident δ, accuracy ǫ, makes M (ǫ, δ) M Q and Q(ǫ, δ) ExQU (resp. ExQD) then 1. There is a polynomial time two-sided adaptive algorithm for ǫ-testing C that makes O(cid:18)M (ǫ/12, 1/24) + Q(ǫ/12, δ/3) + k ǫ(cid:19) queries. 25 2. There is a polynomial time two-sided distribution-free adaptive algorithm for ǫ-testing C that makes queries. O(cid:18)M (ǫ/12, 1/24) + kQ(ǫ/12, 1/24) + k ǫ(cid:19) Finally, one trivial but useful result is Theorem 30. If there is a polynomial time algorithm A that, given as an input any constant δ and any ǫ makes M (ǫ, δ) MQs and Q(ǫ, δ) ExQU (resp. ExDD) and distinguish between F ∈ C(Y ) and F ǫ-far from every function in C(Y ) with respect to the uniform distribution (resp. with respect to the distribution D) then 1. There is a polynomial time two-sided adaptive algorithm for ǫ-testing C that makes O(cid:18)M (ǫ/12, 1/24) + Q(ǫ/12, 1/24) + k ǫ(cid:19) queries. 2. There is a polynomial time two-sided distribution-free adaptive algorithm for ǫ-testing C that makes queries. 4 Results O(cid:18)M (ǫ/12, 1/24) + kQ(ǫ/12, 1/24) + k ǫ(cid:19) In this section we define the classes and give the results for the classes k-Junta, k-Linear, k-Term, s-Term Monotone r-DNF, size-s Decision Tree, size-s Branching Program, Functions with Fourier Degree at most d, Length-k Decision List and s-Sparse Polynomial of Degree d. We will use words that are capitalized for classes and non-capitalized words for functions. For example, k-Junta is the class of all k-juntas. 4.1 Testing k-Junta For k-Junta in uniform distribution framework, Ficher et al. [33] introduced the junta testing problem and gave a non-adaptive algorithm that makes O(k2)/ǫ queries. Blais in [7] gave a non- adaptive algorithm that makes O(k3/2)/ǫ queries and in [8] an adaptive algorithm that makes O(k log k + k/ǫ) queries. On the lower bounds side, Fisher et al. [33] gave an Ω(√k) lower bound for non-adaptive testing. Chockler and Gutfreund [28] gave an Ω(k) lower bound for adaptive testing and, recently, Saglam in [55] improved this lower bound to Ω(k log k). For the non-adaptive testing Chen et al. [24] gave the lower bound Ω(k3/2)/ǫ. For testing k-junta in the distribution-free model, Chen et al. [45] gave a one-sided adaptive algorithm that makes O(k2)/ǫ queries and proved a lower bound Ω(2k/3) for any non-adaptive algorithm. The result of Halevy and Kushilevitz in [41] gives a one-sided non-adaptive algorithm that makes O(2k/ǫ) queries. The adaptive Ω(k log k) uniform-distribution lower bound from [55] 26 trivially extends to the distribution-free model. Bshouty [15] gave a two-sided adaptive algorithm that makes O(1/ǫ)k log k queries. Our algorithm in this paper gives Theorem 31. For any ǫ > 0, there is a polynomial time two-sided distribution-free adaptive algo- rithm for ǫ-testing k-Junta that makes O(k/ǫ) queries. Proof. We use Theorem 30. Since every F (Y ) is in k-Junta(Y ), the algorithm A always accepts. Therefore, we have M = Q = 0, and the algorithm makes O(k/ǫ) queries. 4.2 Testing k-Linear Blum et al. The function is linear if it is a sum (over the binary field F2) of variables. The class Linear is the class of all linear functions. The class k-Linear is Linear∩k-Junta. That is, the class of functions that are the sum of at most k variables. [13] showed that there is an algorithm for testing Linear under the uniform dis- tribution that makes O(1/ǫ) queries. For testing k-Linear under the uniform distribution, Fisher, et al. [33] gave a tester that makes O(k2/ǫ) queries. They also gave the lower bound Ω(√k) for non-adaptive algorithms. Goldreich [35], proved the lower bound Ω(k) for non-adaptive algorithms and Ω(√k) for adaptive algorithms. Then Blais et al. [9] proved the lower bound Ω(k) for adaptive algorithms. Blais and Kane, in [10], gave the lower bound k − o(k) for adaptive algorithms and 2k − o(k) for non-adaptive algorithms. Testing k-Linear can be done by first testing if the function is k-Junta and then testing if it is Linear. Therefore, there is an adaptive algorithm for ǫ-testing k-Linear under the uniform distribution that makes O(k/ǫ) queries. In this paper we prove Theorem 32. For any ǫ > 0, there is a polynomial time two-sided distribution-free adaptive algo- rithm for ǫ-testing k-Linear that makes O(k/ǫ) queries. Proof. We use Theorem 29. Here C(Y ) = {y1 + ··· + yq} contains one function and therefore the learning algorithm just outputs y1 + ··· + yq. Therefore M = Q = 0 and the result follows. 4.3 Testing k-Term A term (or monomial) is a conjunction of literals and Term is the class of all terms. A k-term is a term with at most k literals and k-Term is the class of all k-terms. In the uniform distribution model, Pernas et al. [50], gave a tester for k-terms that makes O(1/ǫ) queries in the uniform model. We give the same result in the next section. In this paper we prove the following result for the distribution-free model. When k = n, better results can be found in [34, 32]. Theorem 33. For any ǫ > 0, there is a polynomial time two-sided distribution-free adaptive algo- rithm for ǫ-testing k-Term that makes O(k/ǫ) queries. i = xi and x1 1 ∧ ··· ∧ yξq q ξ ∈ {0, 1}q} contains 2q Proof. Recall that x0 functions. We use Theorem 29 with Remark 22. Since V contains witnesses for each variable it follows that ξi are known. Just take any string a that satisfies F (a) = 1 and then ξi = ai. Therefore M = Q = 0 and the result follows. i = xi. Here C(Y ) = {yξ1 27 4.4 Testing s-Term Monotone r-DNF A DNF is a disjunction of terms. An r-DNF is a disjunction of r-terms. The class s-Term r-DNF is the class of all r-DNFs with at most s terms. The class s-Term Monotone r-DNF is the class of all r-DNFs with at most s terms with no negated variables. A DNF f is called unate DNF if there is ξ ∈ {0, 1}n such that f (xξ1 n ) is monotone DNF. If ξi = 0 then we say that f is positive unate in xi; otherwise we say that f is negative unate in xi. Similarly, one can define the classes Unate DNF, Unate s-DNF etc. 1 , . . . , xξn We first give a learning algorithm for s-Term Monotone r-DNF. The algorithm is in Figure 9. In the algorithm, we use P1/r for the probability distribution over the strings b ∈ {0, 1}n where each coordinate bi is chosen randomly and independently to be 1 with probability 1 − 1/r and 0 with probability 1/r. For two strings x, y ∈ {0, 1}n we denote x ∗ y = (x1y1, . . . , xnyn) where xiyi = xi ∧ yi. The procedure FindMinterm(f, a) flips bits that are one in a to zero as long as f (a) = 1. LearnMonotone(f,D, ǫ, δ, s, r) Input: Oracle that accesses a Boolean function f that is s-term monotone r-DNF and D. Output: h that is s-term monotone r-DNF Choose a ∈ D. If f (a) = 1 and h(a) = 0 then 1. h ← 0. 2. Repeat 4(s/ǫ) log(1/δ) times. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Output h h ← h ∨Qai=1 xi t ← 0 While t ≤ α := 4r ln(2ns/δ) and wt(a) > r do t ← t + 1; If t = α + 1 Output "fail" Choose y ∈ P1/r If f (a ∗ y) = 1 then a ← a ∗ y a ←FindMinterm(f, a) Figure 9: A learning algorithm for s-Term Monotone r-DNF We now show Lemma 34. If the target function f is s-term monotone r-DNF then for any constant δ, algorithm LearnMonotone asks O(s/ǫ) ExQD and O(sr log(ns)) MQ and, with probability at least 1 − δ, learns an s-term monotone r-DNF, h, that satisfies PrD[h 6= f ] ≤ ǫ. Proof. We first show that if in the mth iteration of the algorithm (steps 3-11) the function h contains ℓ terms of f and f (a) = 1 and h(a) = 0 then, with probability at least 1 − δ/(2s), steps 5 to 11 adds to h a new term of f . This implies that in the (m + 1)th iteration h contains ℓ + 1 terms of f . Then, since the number of terms of f is at most s, with probability at least 1− δ/2, all 28 the terms in h are terms in f . We then show that, with probability at least 1 − δ/2, the procedure outputs h that satisfies PrD[h 6= f ] ≤ ǫ. First notice that if f (a) = 1 and h(a) = 0 then for every y ∈ {0, 1}n, h(a ∗ y) = 0. This follows from the fact that h is monotone and a ∗ y ≤ a. Therefore if a receives the values a(1), . . . , a(τ ) in the While loop then f (a(i)) = 1 and h(a(i)) = 0 for all i = 1, . . . , τ . We also have a(i+1) = a(i) if f (a(i)∗y) = 0 and a(i+1) = a(i)∗y if f (a(i)∗y) = 1. Consider the random variable Wi = wt(a(i))− r. We will now compute E[Wi+1Wi]. Since f (a(i)) = 1 and h(a(i)) = 0, there is a term T in f that is not in h that satisfies T (a(i)) = 1. Suppose T = xj1xj2 ··· xjr′ , r′ ≤ r. Then a(i) jr′ = 1. = ··· = a(i) Consider another r − r′ entries in a(i) that are equal to 1, a(i) = 1. Such entries exist because of the condition wt(a) > r of the While command. Note that wt(a(i)) = Wi + r. Let jr+1, . . . , jr+Wi be the other entries of a(i) that are equal to 1. Let A be the event that, for the y ∈ P1/r chosen at this stage, yj1 = ··· = yjr = 1. Notice that if event A happens then T (a(i+1)) = f (a(i+1)) = 1 and a(i+1) = a(i) ∗ y. Then ≤ E[Wi+1Wi, A](cid:18)1 − = Wi(cid:18)1 − = Wi(cid:18)1 − E[Wi+1Wi] = E[Wi+1Wi, A]Pr[A] + E[Wi+1Wi, ¯A]Pr[ ¯A] + Wi(cid:18)1 −(cid:18)1 − 1 r(cid:19)r(cid:19) 4r(cid:19) . + Wi(cid:18)1 −(cid:18)1 − r(cid:19)r(cid:19) ≤ Wi(cid:18)1 − r(cid:19)r+1 r(cid:18)1 − = ··· = a(i) r(cid:19)r(cid:19) 1 r(cid:19)r j1 jr (1) (2) 1 1 jr′+1 1 1 1 The inequality in (1) follows from the fact that Wi+1 ≤ Wi and (2) follows from the fact that the expected number of ones in yjr+1ajr+1, . . . , yjr+Wi Therefore E[Wi] ≤ n(1 − 1/(4r))i. The probability that the algorithm fails is the probability is (1 − 1/r)Wi. that t = 4r ln(2ns/δ). By Markov's Bound, Lemma 67, this is bounded by ajr+Wi Pr[wt(a(t)) > r] = Pr[Wt > 1] ≤ E[Wt] ≤ n(cid:18)1 − 1 4r(cid:19)t δ 2s . ≤ This completes the first part of the proof. Now we show that, with probability at least 1 − δ/2, the procedure outputs h that satisfies PrD[f 6= h] ≤ ǫ. Let h(i) be the function h at iteration i = 1, 2, . . . , w. Since h(1) =⇒ h(2) =⇒ ··· =⇒ h(w) = h =⇒ f , if PrD[f 6= h] > ǫ then PrD[f 6= h(i)] > ǫ for all i. Therefore, the probability that PrD[f 6= h] > ǫ is less than the probability that for v = 4s log(1/δ)/ǫ strings a(1), . . . , a(v) chosen independently at random according to the distribution D, less than s of them satisfies gi(a(i)) 6= f (a(i)) for Boolean functions gi that satisfy PrD[gi 6= f ] ≥ ǫ. By Chernoff's bound, Lemma 69, this probability is less than δ/2. The algorithm asks at most 4s log(1/δ)/ǫ = O(s/ǫ) ExQD and at most s · 4r ln(2ns/δ) = O(sr log(ns)) MQ. Now we show Theorem 35. For any ǫ > 0, there is a polynomial time two-sided distribution-free adaptive algo- rithm for ǫ-testing s-Term Monotone r-DNF that makes O(rs2/ǫ) queries. 29 Proof. The number of relevant variables in any s-term monotone r-DNF is at most q ≤ k = sr. By Lemma 34, C(Y ) can be learned with constant confidence δ and accuracy ǫ in M = O(sr log(qs)) = O(sr) MQ and O(s/ǫ) ExQD. By Theorem 29, there is a distribution-free tester for s-Term Monotone r-DNF that makes O(s2r/ǫ) queries. Theorem 36. For any ǫ > 0, there is a polynomial time two-sided distribution-free adaptive algo- rithm for ǫ-testing s-Term Unate r-DNF that makes O(rs2/ǫ) queries. Proof. The set of witnesses tells us, for every variable xi, if f is positive unate in xi or negative ) = 0 then f is positive unate in xτ (ℓ) and if f (v(ℓ)) = 0, unate. ) = 1 then f is negative unate in xτ (ℓ). Then the result immediately follows from If f (v(ℓ)) = 1, f (0Xℓ ◦ v(ℓ) Xℓ f (0Xℓ ◦ v(ℓ) Xℓ Theorem 35. 4.5 Testing Size-s Decision Tree and Size s Branching Program A decision tree is a rooted binary tree in which each internal node is labeled with a variable xi and has two children. Each leaf is labeled with an output from {0, 1}. A decision tree computes a Boolean function in an obvious way: given an input x ∈ {0, 1}n, the value of the function on x is the output in the leaf reached by starting at the root and going left or right at each internal node according to whether the variable's value in x is 0 or 1, respectively. The size of a decision tree is the number of leaves of the tree. The class size-s Decision Tree is the class of all decision trees of size s. A branching program is a rooted directed acyclic graph with two sink nodes labeled 0 and 1. As in the decision tree, each internal node is labeled with a variable xi and has two children. The two edges to the children are labeled with 0 and 1. Given an input x, the value of the branching program on x is the label of the sink node that is reached as described above. The size of a branching program is the number of nodes in the graph. The class size-s Branching Program is the class of all Branching Program of size s. Diakonikolas et al. [30], gave a tester for size-s Decision Tree and size s Branching Program under the uniform distribution that makes O(s4/ǫ2) queries. Chakraborty et al. [21] improved the query complexity to O(s/ǫ2). In this paper we prove Theorem 37. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing size-s Decision Tree and size-s Branching Program that makes O(s/ǫ) queries. There is a two-sided distribution-free adaptive algorithm for ǫ-testing size-s Decision Tree and size s Branching Program that makes O(s2/ǫ) queries. Proof. For decision tree, C(Y ) contains the decision trees with q = Y ≤ k = s relevant variables. It is shown in [30] that C(Y ) ≤ (8s)s. For branching programs C(Y ) ≤ (s + 1)3s. Now by Theorem 26 the result follows. 4.6 Functions with Fourier Degree at most d For convenience here we take the Boolean functions to be f : {−1, 1}n → {−1, 1}. Then every Boolean function has a unique Fourier representation f (x) =PS⊆[n] fSQi∈S xi where fS are the Fourier coefficients of f . The Fourier degree of f is the largest d = S with fS 6= 0. 30 Let C be the class of all Boolean functions over {−1, 1}n with Fourier degree at most d. Nisan and Szegedy, [49], proved that any Boolean function with Fourier degree d must have at most k := d2d relevant variables. Diakinikolas et al. [30], show that every nonzero Fourier coefficient of f ∈ C is an integer multiple of 1/2d−1. Since PS⊆[n] f 2 S = 1, there are at most 22d−2 nonzero Fourier coefficients in f ∈ C. Diakonikolas et al. [30], gave an exponential time tester for Boolean functions with Fourier degree at most d under the uniform distribution that makes O(26d/ǫ2) queries. Chakraborty et al. [21] improved the query complexity to O(22d/ǫ2). In this paper we prove Theorem 38. For any ǫ > 0, there is a poly(2d, n) time two-sided distribution-free adaptive al- gorithm for ǫ-testing for the class of Boolean functions with Fourier degree at most d that makes O(22d + 2d/ǫ) queries. Proof. Bshouty gives in [16] an exact learning algorithm for such class2 that asks M = O(22d log n) membership queries for any constant confidence parameter δ. Now since q = Y ≤ k = d2d, by Theorem 28 the result follows. 4.7 Testing Length k Decision List A decision list is a sequence f = (xi1, ξ1, a1), . . . , (xis, ξs, as) for any s where ξi, ai ∈ {0, 1}. This sequence represents the following function: f (x) := If xi1 = ξ1 then output(a1) else if xi2 = ξ2 then output(a2) else if ··· else if xis = ξs then output(as). Length-k decision list is a decision list with s ≤ k. The class Decision List is the class of all decision lists and the class Length-k Decision List is the class of all length-k decision lists. It is known that this class is learnable under any distribution with O((k log n + log(1/δ))/ǫ) ExQD, [14, 51]. This implies Theorem 39. For any ǫ > 0, there is a polynomial time two-sided distribution-free adaptive algo- rithm for ǫ-testing Length-k Decision List that makes O(k2/ǫ) queries. Proof. The result follows from Theorem 29. 4.8 Testing s-Sparse Polynomial of Degree d A polynomial (over the field F2) is a sum (in the binary field F2) of monotone terms. An s-sparse polynomial is a sum of at most s monotone terms. We say that the polynomial f is of degree d if its terms are monotone d-terms. The class s-Sparse Polynomial of Degree d is the class of all s-sparse polynomials of degree d. The class Polynomial of Degree d is the class of all polynomials of degree d. In the uniform distribution model, Diakonikolas et al. [30], gave the first testing algorithm for the class s-Sparse Polynomial that runs in exponential time and makes O(s4/ǫ2) queries. Chakraborty et al. [21] improved the query complexity to O(s/ǫ2). Diakonikolas et al. gave in [31] the first polynomial time testing algorithm that makes poly(s, 1/ǫ) queries. In [1], Alon et al. gave a testing algorithm for Polynomial of Degree d that makes O(1/ǫ + d22d) queries. They also show the lower bound Ω(1/ǫ + 2d) for the number of queries. Combining those results we get a polynomial time 2The class in [16] is the class of decision trees of depth d but the analysis is the same for the class of functions with Fourier degree at most d 31 testing algorithm for s-Sparse Polynomial of Degree d that makes poly(s, 1/ǫ) + O(22d) queries. Just run the Alon et al. algorithm in [1] and then run Diakonikolas et al. algorithm in [31] and accept if both algorithms accept. Here we prove the following Theorem. Theorem 40. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing s-Sparse Poly- nomial of Degree d that makes O(s/ǫ + s2d) queries. For any ǫ > 0, there is a two-sided distribution-free adaptive algorithm for ǫ-testing s-Sparse Polynomial of Degree d that makes O(s2/ǫ + s2d) queries. We first give a learning algorithm LearnPolynomial for s-sparse polynomial of degree d. See Figure 10. LearnPolynomial(f,D, ǫ, δ, s, d) Input: Oracle that accesses an s-sparse polynomial f of degree d and D. Output: An s-sparse polynomial of degree d, h, or "fail" 1. h ← 0, t(h) ← 0. 2. Repeat (s/ǫ) ln(3s/δ) times. Choose a ∈ D. 3. t(h) ← t(h) + 1. 4. 5. If (f + h)(a) = 1 then 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. If wt(a) > d then "fail" M ← Find a monotone term in (f + h)(a ∗ x) h ← h + M t(h) ← 0. If t(h) = (1/ǫ) ln(3s/δ) then Output h m ← 0; While m ≤ α := 16 · 2d(2 ln(s/δ) + ln n) and wt(a) > d do m ← m + 1; Choose y ∈ U If (f + h)(a ∗ y) = 1 then a ← a ∗ y Figure 10: A learning algorithm for s-sparse polynomial of degree d Lemma 41. Let f be an s-sparse polynomial of degree d. For any constant δ, algorithm Learn- Polynomial asks O((s/ǫ) log s) ExQD and O(s2d log(ns)) MQ and, with probability at least 1 − δ, learns an s-sparse polynomial of degree d, h, that satisfies PrD[h 6= f ] ≤ ǫ. Proof. Suppose f =PM ∈F M , where F are the set of monotone d-terms of f and F = s′ ≤ s. Suppose, at some stage of the algorithm h =PM ∈F ′ M where F ′ ⊂ F . Then f + h =PM ∈F \F ′ M . Notice that F ′ is the set of terms of f that is found by the algorithm up to this stage and F\F ′ is the set of terms that is yet to be found. Since the number of terms of f is at most s, all we need to show is that: 32 1. Each time the algorithm executes steps 6-14, with probability at least 1 − δ/(2s), it finds a term of f + h, and therefore, a new term of f . 2. Assuming 1., the algorithm, with probability at least 1− δ/2, outputs an s-sparse polynomial of degree d, h that satisfies PrD[f 6= h] ≤ ǫ. Then, by the union bound, the success probability of the algorithm is at least 1 − δ and the result follows. We first prove 1. Let g = f + h. Suppose that the algorithm finds a string a such that g(a) = 1. Then a satisfies at least one term in g. Let M ′ ∈ F\F ′ be one of them and let d′ ≤ d be the degree of M ′ . Then g(a ∗ x) =PM ∈F \F ′,M (a)=1 M contains M ′ and therefore g(a ∗ x) is not zero. We first show that the probability that after α1 := 16 · 2d ln(sn/δ) iterations of steps 7-10, the weight of a does not drop below 24d is less than δ/(4s). Then we show that, if the weight of a is less than or equal to 24d then the probability that after α2 := α − α1 more iterations of steps 7-10 the weight of a does not drop below d + 1 is less than δ/(4s). If these two facts are true then after the algorithm finishes executing the While command, with probability at least 1 − δ/(2s), the weight of a is less than d + 1. It is known that for any non-zero polynomial H of degree at most d, PrU [H(x) = 1] ≥ 1/2d, [18]. Since g(a ∗ x) is of degree at most d, for a random uniform string y we get Pr[g(a ∗ y) = 1] ≥ 1/2d. Now suppose wt(a) ≥ 24d. By Chernoff's bound, Lemma 69, the probability that wt(a ∗ y) > (3/4)wt(a) is at most e−wt(a)/24 ≤ 2−d−1. Therefore, by the union bound, 1 Pr[g(a ∗ y) = 1 and wt(a ∗ y) ≤ (3/4)wt(a)] ≥ 1 −(cid:18)1 − 2d+1(cid:19) ≥ 1 2d+1 . 1 2d + (3) The probability that after α1 = 16 · 2d ln(sn/δ) iterations of steps 7-10, the weight of a does not drop below 24d is less than the probability that for α1 = 16· 2d ln(sn/δ) random uniform strings y, less than log(n)/ log(4/3) of them satisfies g(a ∗ y) = 1 and wt(a ∗ y) ≤ (3/4)wt(a) given that a satisfies wt(a) ≥ 24d and g(a ∗ x) 6= 0. By (3) and Chernoff's bound this probability is less than δ/(4s). We now show that if wt(a) < 24d, then after α2 = α − α1 = 16 · 2d ln(s/δ) iterations of steps 7- 10, with probability at least 1 − δ/(4s), the weight of a drops below d + 1. Take a that satisfies d + 1 ≤ wt(a) < 24d. Then Pr[g(a ∗ y) = 1 and wt(a ∗ y) < wt(a)] ≥ Pr[g(a ∗ y) = 1] − Pr[wt(a ∗ y) = wt(a)] 1 2d − 1 2d+1 = 1 2d+1 . ≥ Then as before, with an additional α2 iterations of steps 7-10, with probability at least 1 − δ/(4s), the weight of a drops below d + 1. Once the weight of a is less or equal to d, the algorithm finds in step 12 a monotone term in g(a ∗ x) by building a truth table of g(a ∗ x) using at most 2d queries and learning one of its terms. This term is in g because all the terms of g(a ∗ x) are terms of g(x). The proof that the algorithm, with probability at least 1 − δ/2, outputs h such that PrD[f 6= h] ≤ ǫ is identical to the proof in Lemma 9 for the output of ApproxTarget. We are now ready to prove Theorem 40. Proof. By Lemma 41, Theorem 29 and since n = Y = sd, Q = (s/ǫ) log s and M = s2d log(sd) the result follows. 33 5 Testing Classes that are Close to k-Junta In this section, we show the result for s-term DNF in the uniform distribution model. Then in the following section, we show how to extend it to other classes. The main idea is the following. We first run the procedure ApproxC in Figure 11 that finds X ⊂ [n] and w ∈ {0, 1}n such that, with high probability, 1. The projection xX ◦ wX removes variables from f that appear only in terms of f of size at least c log(s/ǫ) for some large constant c. 2. h = f (xX ◦ wX) is (ǫ/8)-close to f . From (1) we conclude that the terms of size at most c log(s/ǫ) in f contain all the variables of h. Since the number of terms in f is at most s the number of variables that remain in h is at most k := cs log(s/ǫ). From (2) we conclude that if f is ǫ-far from every s-term DNF then h is (7ǫ/8)- far from every s-term DNF and therefore h is (7ǫ/8)-far from every s-term DNF with at most k variables. Therefore, it is enough to distinguish whether h is an s-term DNF with at most k variables or (7ǫ/8)-far from every s-term DNF with at most k variables. This can be done by the algorithm TesterC in the previous section Note that removing variables that only appears in large size terms does not necessarily remove large terms in f . Therefore, h may still contain large terms even after running ApproxTarget in TesterC. To handle large terms, we can use any learning algorithm that learns h with accuracy ǫ/12 and use Theorem 29. This gives a tester for s-term DNF that makes O(s2/ǫ) queries, which is not optimal. This is because the number of s-term DNF with at most k variables is m := 2O(ks) (and therefore the number of queries in TesterC is at least O((log m)/ǫ) = O(s2/ǫ)). To get an optimal query tester, we do the following. We build a tester that uses only random uniform queries for the class s-term DNF with at most k variables and terms of size at most r = c′ log(s/ǫ) where c′ is a large constant and show that this tester, with high probability, works well for h. The reason for that is that when the algorithm uses random uniform queries, with high probability, all the terms of h that are of size greater than r are zero for every query. Since the number of s-term DNF with at most k variables and terms of size at most r is at most m = 2O(rs log k) the number of queries in TesterC is at most O(k/ǫ + (log m)/ǫ) = O(s/ǫ). In the next subsection, we give the procedure ApproxC that removes variables that only appear in large size terms, and in Subsection 5.2, we give the tester for s-Term DNF. Then in Section 6, we extend the above to other classes. 5.1 Removing Variables that only Appears in Large Size Terms We explain our technique by proving the result for s-term DNF. We remind the reader that for a term T , the size of T is the number of variables that are in it. For a variable x and ξ ∈ {0, 1}, xξ = x if ξ = 0 and xξ = x if ξ = 1. For a term T = xc1 i1 ∧ ··· ∧ xcv we denote by Va(T ) = {xi1, . . . , xiv}, the set of variables that appears in T . For a set of terms T we denote Va(T ) = ∪T ∈T Va(T ). Here λ > 1 is any constant and we use c = O(log λ) to denote a large constant. iv Consider the procedure ApproxC in Figure 11. We will prove the following two Lemmas 34 Algorithm ApproxC(f, ǫ, λ) Input: Oracle that accesses a Boolean function f and Output: Either "X ⊆ [n], w ∈ {0, 1}n" or "reject" Partition [n] into r sets 1. 2. Choose uniformly at random a partition X1, X2, . . . , Xr of [n] Set m = c log(s/ǫ); r = 8ms. Choose u, v ∈ U . t(X) ← t(X) + 1 If f (uX ◦ vX ) 6= f (u) then Find a close function and relevant sets Set X = ∅; I = ∅; t(X) = 0; k = 3ms 3. 4. Repeat M = 100λk ln(100k)/ǫ times 5. 6. 7. 8. 9. 10. 11. 12. 13. Binary Search to find a new relevant set Xℓ; X ← X ∪ Xℓ; I ← I ∪ {ℓ}. If I > k then output "reject" and halt. t(X) = 0. If t(X) = 100λ ln(100k)/ǫ then Choose a random uniform w; Output(X, w, f (xX ◦ wX )). Figure 11: A procedure that removes variables from f that only appears in large size terms. Lemma 42. Let f be an s-term DNF. ApproxC makes O(s/ǫ) queries and, with probability at least 9/10, outputs X and w such that 1. f (xX ◦ wX ) is s-term DNF. 2. The number of relevant variables in f (xX ◦ wX) is at most 3cs log(s/ǫ) = O(s log(s/ǫ)). Lemma 43. Let f be ǫ-far from every s-term DNF. ApproxC makes O(s/ǫ) queries and either rejects, or with probability at least 9/10, outputs X and w such that f (xX ◦ wX) is (1 − 1/λ)ǫ-far from every s-term DNF. We first prove Lemma 42 Proof. Consider an s-term DNF, f = T1 ∨ T2 ∨ ··· ∨ Ts′, where s′ ≤ s. Let T = {T1, . . . , Ts′}. Let T1 = {T ∈ T : Va(T ) ≤ m} be the set of terms in T of size at most m := c log(s/ǫ) and let R1 = Va(T1) be the set of variables that appear in the terms in T1. Let T2 = {T ∈ T : Va(T )\R1 ≤ m} be the set of terms T ∈ T that contain at most m variables not in R1. Let R2 = R1 ∪ Va(T2) be the variables in R1 and of the terms in T2. Let T3 = {T ∈ T : Va(T )\R1 > m} be the set terms T ∈ T that contain more than m variables that are not in R1. Let T4 = {T ∈ T : Va(T )\R2 ≥ m} be the set of terms in T ∈ T that contain at least m variables not in R2. Let R3 = R2 ∪ Va(T3\T4) be the set of variables in R2 and of the terms in T3\T4. Then R1 ≤ ms,R2 ≤ 2ms,R3 ≤ 3ms and T4 ⊆ T3. 35 In steps 1-2, procedure ApproxC uniformly at random partitions [n] into r = 8ms sets X1, . . . , Xr. Suppose that the variables in R2 are distributed to the sets Xj1, . . . , Xjq , q ≤ R2 ≤ 2ms. For each T ∈ T4, the expected number of variables in Va(T )\R2 that are not distributed to one of the sets Xj1, . . . , Xjq is greater or equal to (1 − q/r) m = (3/4)m. By Hoeffding's bound, Lemma 70, and the union bound, the probability that it is greater than m/2 in every term T ∈ T4 is at least 1 − s · exp(−m/8) ≥ 99/100. In steps 5-7 procedure ApproxC are repeated M times and it finds relevant sets using two random uniform strings u and v. If f (uX ◦ vX) 6= f (u) then a new relevant set is found. Consider any T ∈ T3. The size of T is at least m. Suppose T = xξ1 am′ , m′ ≥ m. For random uniform u, v ∈ {0, 1}n, the probability that there is no j ∈ [m′] such that uaj = (uX ◦ vX)aj = ξj is at most (3/4)m. The probability that this happens for at least one T ∈ T3 and at least one of the M randomly uniformly chosen u and v in the procedure is at most (3/4)msM ≤ 1/100. Notice that if uaj = (uX ◦ vX )aj = ξj then T (u) = T (uX ◦ vX) = 0 and T (w) = 0 for every string w in the binary search that is made to find a new relevant set. Therefore, with probability at least 99/100, the procedure runs as if f contains no terms in T3. Let f ′ = ∨T ∈T \T3T . With probability at least 99/100 the procedure runs as if f = f ′. The number of relevant variables in f ′ is at most R2 ≤ 2ms and all those variables are distributed to Xj1, . . . , Xjq . Therefore, with probability at least 99/100, the procedure generates at most 2ms < k relevant sets and therefore, by step 9, it does not reject and those relevant sets are from Xj1, . . . , Xjq . a1 ∧ ··· ∧ xξm′ The output of the procedure is X ⊆ Xj1 ∪ ··· ∪ Xjq and a random uniform w. We now show that with high probability f (xX ◦ wX) contains at most k = 3ms relevant variables. We have shown above that with probability at least 99/100 every term T ∈ T4 contains at least m/2 variables that are not distributed to Xj1, . . . , Xjq . Therefore, for a fixed term T ∈ T4 and for a random uniform w, the probability that T (xX ◦ wX) = 0 is at least 1− (1/2)m/2. The probability that T (xX ◦ wX) = 0 for every T ∈ T4 is at least 1 − s(1/2)m/2 ≥ 99/100. Therefore, when we randomly uniformly choose w ∈ {0, 1}n, with probability at least 99/100, the function f (xX ◦ wX ) does not contain terms from T4. Thus, with probability at least 99/100, f (xX ◦ wX) contains at most R3 ≤ 3ms variables. Now as in the proof of Lemma 10, the query complexity is 2M + k log r = O(s/ǫ). We now prove Lemma 43. Proof. As in the proof of Lemma 9, the probability that the algorithm fails to output X that satisfies Prx,y∈U [f (xX ◦ yX) = f (x)] ≤ ǫ/(100λ) is at most k(cid:16)1 − = 1 100 . ǫ 100λ(cid:17)(100λ ln(100/k))/ǫ If Prx,y∈U [f (xX ◦ yX) = f (x)] ≤ ǫ/(100λ) then, by Markov's inequality, Lemma 67, for a random uniform w, with probability at least 99/100, Prx∈U [f (xX ◦ wX) = f (x)] ≤ ǫ/λ. Now as in the proof of Lemma 10, the query complexity is 2M + k log r = O(s/ǫ). In the next subsection, we give the result for s-term DNF, and then we show how to use the above technique to other classes. 36 5.2 Testing s-term DNF We have shown in Lemma 42 and 43 that, using O(s/ǫ) queries, the problem of testing s-Term DNF can be reduced to the problem of testing s-Term DNF with k = O(s log(s/ǫ)) relevant variables. We then can use TesterC for the latter problem. This gives a tester for s-term DNF that makes O(s2/ǫ). This is because the number of s-term DNF with k = O(s log(s/ǫ)) relevant variables is 2 O(s2). We will now show how to slightly change the tester TesterC and get one that makes O(s/ǫ) queries. In TesterC the procedures ApproxTarget, TestSet and Closef F make O(k log k), O(k) and O((k/ǫ) log(k/ǫ)) queries, respectively. This is O(s/ǫ) queries. Therefore, the only procedure that makes O(s2/ǫ) queries in TesterC is CloseF CU . So we will change this procedure. Let h be an s-term DNF. Notice that in step 3 in CloseF CU , for a random uniform z = (z1, . . . , zq) ∈ {0, 1}q , the probability that z satisfies a term T in h of size at least c log(s/ǫ) (i.e., T (z) = 1), is at most (ǫ/s)c. Therefore, if in CloseF CU we define C ∗ to be the class of all s- term DNF with terms of size at most c log(s/ǫ), then the probability that for at least one of the τ = (3/ǫ) log(C ∗/δ) random uniform z = (z1, . . . , zq) and at least one of the terms T in h of size at least c log(s/ǫ), T satisfies z, is at most sτ (ǫ/s)c ≤ 1/100. Therefore, with probability at least 99/100 the algorithm runs as if h is s-term DNF with terms of size at most c log(s/ǫ) and then accept. Since log C ∗ = O(s) we get Theorem 44. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing s-Term DNF that makes O(s/ǫ) queries. For completeness we wrote the tester. See TesterApproxC in Figure 12. In the tester C({y1, . . . , yq}, c log(s/ǫ)) is the class of all s-term DNFs with terms of size at most c log(s/ǫ) over q variables. 6 Results In this section, we extend the technique used in the previous section to other classes. 6.1 Testing s-Term Monotone DNF We first use the algorithm LearnMonotone in Figure 9 to show Lemma 45. Let f : {0, 1}n → {0, 1} be an s-term Monotone DNF. For constant δ, algorithm LearnMonotone(f, U, ǫ/2, δ/2, s, 2(log(s/ǫ) + log(1/δ))) asks O(s/ǫ) ExQU and O(s(log n + log s)· log(s/ǫ)) MQ and, with probability at least 1 − δ, learns an s-term monotone DNF h that satisfies PrU [h 6= f ] ≤ ǫ. Proof. Let f be the function f without the terms of size greater than 2(log(s/ǫ) + log(1/δ)). Then PrU [f 6= f ] ≤ s2−2(log(s/ǫ)+log(1/δ))) ≤ ǫ 2 . In the algorithm LearnMonotone the probability that one of the assignments in step 3 (that is, a where a ∈ U ) satisfies one of the terms in f of size greater than 2(log(s/ǫ) + log(1/δ)) is less than (4s/ǫ)(log(1/δ))s2−2(log(s/ǫ)+log(1/δ)) ≤ 37 δ 2 . TesterApproxC(f,D, ǫ) Input: Oracle that access a Boolean function f and D. Output: Either "reject" or "accept" (X, w) ←ApproxC(f, ǫ, 1/6). (X, V, I) ←ApproxTarget(h, U, ǫ, 1/6). 1. 2. h := f (xX ◦ wX). 3. 4. TestSets(X, V, I). 5. Closef F (f, U, ǫ, 1/15) 6. C ∗ ← C({y1, . . . , yq}, c log(s/ǫ)) where q = V Test closeness to C ∗ 7. Repeat τ = (3/ǫ) log(30C ∗) times 8. 9. 10. 11. 12. Return "accept" Choose (z1, . . . , zq) ∈ U . For every g ∈ C ∗ If g(z) 6= F (z) then C ∗ ← C ∗\{g}. If C ∗ = ∅ then "reject" Figure 12: A procedure for testing s-Term DNF Also for a monotone term T , if T (a) = 0 then for any y, T (a ∗ y) = 0. Therefore, with probability at least 1− δ/2, the algorithm runs as if f is f (which is s-term monotone (2(log(s/ǫ) + log(1/δ)))- DNF). By Lemma 34, if the target is f then, with probability at least 1 − δ/2, LearnMonotone outputs h that is (ǫ/2)-close to f . Since f is (ǫ/2)-close to f and h is (ǫ/2)-close to f we have that h is ǫ-close to f . This happens with probability at least 1 − δ. The number of queries follows from Lemma 34. We now prove Theorem 46. For any ǫ > 0, there is a polynomial time two-sided adaptive algorithm for ǫ-testing s-Term Monotone DNF that makes O(s/ǫ) queries. Proof. We first run ApproxC and get an s-term monotone DNF h with O(s log(s/ǫ)) variables that is (ǫ/6)-close to f . We then use Theorem 29 with Lemma 45. We also have Theorem 47. For any ǫ > 0, there is a polynomial time two-sided adaptive algorithm for ǫ-testing s-Term Unate DNF that makes O(s/ǫ) queries. Proof. The proof is similar to the proof of Theorem 36. 6.2 Testing Size-s Boolean Formula and Size-s Boolean Circuit A Boolean formula is a rooted tree in which each internal node has arbitrarily many children and is labeled with AND or OR. Each leaf is labeled with a Boolean variable xi or its negation ¯xi. The 38 size of a Boolean formula is the number of AND/OR gates it contains. The class size-s Boolean Formula is the class of all Boolean formulas of size at most s. A Boolean circuit is a rooted directed acyclic graph with internal nodes labeled with an AND, OR or NOT gate. Each AND/OR gate is allowed to have arbitrarily many descendants. Each directed path from the root ends in one of the nodes x1, x2, . . . , xn, 0, 1. The same analysis that we did for s-term DNF also applies to size-s Boolean formulas and size-s Boolean circuit. Analogous to the size of terms, we take the number of distinct literals a gate has. If the gate is labeled with AND (respectively, OR) and the number of distinct literals it has is more than c log(s/ǫ), then we replace the gate with a node labeled with 0 (respectively, 1) and remove all the edges to its children. Therefore we have Lemma 48. Lemma 42 and 43 are also true for size-s Boolean formulas and size-s Boolean circuit. We now prove Theorem 49. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing size-s Boolean Formula that makes O(s/ǫ) queries. Proof. Similar to testing s-term DNF, we can ignore gates that have more than c log(s/ǫ) distinct literals. Just replace it with 0 if its label is AND and with 1 if it is OR. The number of Boolean formulas of size s that have at most c log(s/ǫ) distinct literal in each gate and at most k = O(s log(s/ǫ)) variables is 2 O(s), [30]. The rest of the proof goes along with the proof of testing s-term DNF. The number of Boolean circuits of size s that have at most c log(s/ǫ) distinct literals in each gate and at most k = O(s log(s/ǫ)) variables is 2 O(s2), [30]. Then similar to the above proof one can show Theorem 50. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing size-s Boolean Circuit that makes O(s2/ǫ) queries. 6.3 Testing s-Sparse Polynomial In the literature, the first testing algorithm for the class s-Sparse Polynomial runs in exponential time [30] and makes O(s4/ǫ2) queries. Chakraborty et al., [21], then gave another exponential time algorithm that makes O(s/ǫ2) queries. Diakonikolas et al. gave in [31] the first polynomial time testing algorithm that makes poly(s, 1/ǫ) queries. Here we prove Theorem 51. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing s-Sparse Poly- nomial that makes O(s2/ǫ) queries. We have shown in Lemma 42 and 43 that the problem of testing s-Term DNF can be reduced to the problem of testing s-Term DNF with k = O(s log(s/ǫ)) relevant variables. The same reduction and analysis show that the problem of testing s-sparse polynomials can be reduced to the problem of testing s-sparse polynomials with k = O(s log(s/ǫ)) relevant variables. The reduction makes O(s/ǫ) queries. Thus Lemma 52. Lemma 42 and 43 are also true for s-Sparse Polynomials. 39 LearnPolyUnif(f, ǫ, δ, s) Input: Oracle that accesses a Boolean function f that is s-sparse polynomial. Output: h that is s-sparse polynomial 1. h ← 0, t(h) ← 0, w ← 0. 2. Repeat (s/ǫ) ln(3s/δ) log(3s/δ) times. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. h ← h +Qai=1 xi If t(h) = (1/ǫ) ln(3s/δ) then Output h Choose a ∈ U . t(h) ← t(h) + 1. If (f + h)(a) = 1 then m ← 0, w ← w + 1 If w = log(3s/δ) then Output h While m ≤ α := 16 · (8s/ǫ)(2 ln(s/δ) + ln n) and wt(a) > log(s/ǫ) + 3 do m ← m + 1; Choose y ∈ U If (f + h)(a ∗ y) = 1 then a ← a ∗ y If wt(a) > log(s/ǫ) + 3 then Goto 16 w ← 0. a ← Find a monotone term in (f + h)(a ∗ x) t(h) ← 0. Figure 13: A learning algorithm for s-sparse polynomial under the uniform distribution We can then use TesterC for the latter problem. Therefore, all we need to do in this section is to find a learning algorithm for the class of s-sparse polynomials with k = O(s log(s/ǫ)) relevant variables. Consider the algorithm LearnPolyUnif in Figure 13. We prove Lemma 53. Let f be a s-sparse polynomial with n variables. For constant δ, algorithm Learn- PolyUnif asks O(s/ǫ) ExQU and O((s2/ǫ) log n) MQ and, with probability at least 1− δ, learns an s-sparse polynomial h that satisfies PrU [h 6= f ] ≤ ǫ. Proof. Let f = M1 + M2 + ··· + Ms′, s′ ≤ s, where deg(M1) ≤ ··· ≤ deg(Ms′′) ≤ log(s/ǫ) + 3 < deg(Ms′′+1) ≤ ··· ≤ deg(Ms′ ). Let f1 = M1 + ··· + Ms′′ and f2 = Ms′′+1 + ··· + Ms′. Then f = f1 + f2 and PrU [f2 = 1] ≤ s2− log(s/ǫ)−3 = ǫ/8. If f (a) 6= f1(a) then f2(a) = 1 and therefore PrU [f 6= f1] ≤ PrU [f2 = 1] ≤ ǫ/8 and PrU [f = f1] ≥ 1 − ǫ/8. In fact, if A(x) is the event that Ti(x) = 0 for all i > s′′ then PrU [A] ≥ 1 − ǫ/8. The algorithm LearnPolyUnif is similar to the algorithm LearnPolynomial with d = log(s/ǫ)+ 3 with the changes that is described below. First notice that in the algorithm the hypothesis h contains only terms from f1, that is, terms of size at most log(s/ǫ) + 3. This is because in step 12 the algorithm skips the command that adds a term to h when wt(a) ≥ log(s/ǫ) + 3. Suppose at some stage of the algorithm, h =Pi∈B⊆[s′′] Mi contains some terms of f1 and let g = f + h = Pi∈[s′]\B Mi. Suppose PrU [f 6= h] ≥ ǫ. Then PrU [g = 1] ≥ ǫ. We want to compute the probability that the algorithm finds a term in f1 + h = 40 Pi∈[s′′]\B Mi and not in f2. That is, the probability that it finds a term of f of degree at most log(s/ǫ) + 3. We first have Pra∈U [(f1 + h)(a) = 1 ∧ A(f + h)(a) = 1] = Pra∈U [g(a) = 1 ∧ Ag(a) = 1] = ≥ Pra∈U [g(a) = 1 ∧ A] Pra∈U [g(a) = 1] Pra∈U [g(a) = 1] − Pra∈U [A] Pra∈U [g(a) = 1] ≥ 1 − ǫ/8 ǫ ≥ 7 8 . That is, if PrU [f 6= h] ≥ ǫ and (f + h)(a) = 1 then with probability at least 7/8, (f1 + h)(a) = 1 and for every term T in f2, T (a) = 0. If the event A(a) happens then for any y and for every term T in f2, T (a ∗ y) = 0, and therefore, for such a, the algorithm runs as if the target is f1. have three cases: When the algorithm reaches step 5 and finds a string a ∈ {0, 1}n such that (f + h)(a) = 1, we 1. The event B ≡ [ ((f1 + h)(a) = 1 and A(a)] happens. 2. PrU [f 6= h] ≥ ǫ and B. 3. PrU [f 6= h] < ǫ and B. Case 1. Notice that steps 8-11 are identical to steps 7-10 in LearnPolynomial in Figure 10 with d = log(s/ǫ) + 3. Therefore, as in the proof of Lemma 41, with probability at least 1 − δ/3 every assignment a that satisfies B gives a term in f1 that is not in h. Case 2. This case can happen with probability at most 1/8. So the probability that it happens log(3s/δ) consecutive times is at most δ/(3s). The probability that it does happen for some of the at most s different hypothesis h generated in the algorithm is at most δ/3. Notice that w counts the number of consecutive times that this case happens and step 7 outputs h when it does happen log(3s/δ) consecutive times. Therefore, with probability at most δ/3 the algorithm halts in step 7 and output h that satisfies Pr[f 6= h] ≥ ǫ. This is also the reason that the algorithm repeats the search for a in step 2, (s/ǫ) ln(3s/δ) log(3s/δ) times which is log(3s/δ) times more than in algorithm LearnPolynomial. When this case happens, the algorithm either ends up with a string a of weight that is greater than ℓ := log(s/ǫ) + 3 and then it ignores this string, or, it ends up with a string of weight less than or equal to ℓ and then, Step 14 finds a new term in f1. This is because that a string of weight less than or equal to ℓ cannot satisfy a term of degree more than ℓ. Case 3. This case cannot happen more than log(3s/δ) consecutive times because if it does step 7 outputs h which is a good hypothesis. 7 A General Method for Other Testers In this section, we generalize the method we have used in the previous section and then prove some more results We define the distribution D[p] to be over Qn i=1{0, 1, xi} where each coordinate i is chosen to be xi with probability p, 0 with probability (1 − p)/2 and 1 with probability (1 − p)/2. We will denote by f the size of f in C which is the length of the representation of the function f in C. 41 Algorithm ApproxGeneralC(f, ǫ, δ) Input: Oracle that accesses a Boolean function f Output: Either "X ⊆ [n], w ∈ {0, 1}n" or "reject" Partition [n] into r sets 1. 2. Choose uniformly at random a partition X1, X2, . . . , Xr of [n] Set r = kc+1. Set X = ∅; I = ∅; t(X) = 0 Choose u, v ∈ U . t(X) ← t(X) + 1 If f (uX ◦ vX) 6= f (u) then Find a close function and relevant sets 3. 4. Repeat M = (4c1k/(δǫ)) ln(4k/δ) times 5. 6. 7. 8. 9. 10. 11. 12. 13. Find a new relevant set Xℓ; X ← X ∪ Xℓ; I ← I ∪ {ℓ}. If I > k then Output "reject" t(X) = 0. If t(X) = (4c1/(δǫ)) ln(4k/δ) then Choose a random uniform w; Output(X, w). Figure 14: An algorithm that removes variables from f that have a small influence. Consider the algorithm ApproxGeneralC in Figure 14. We start with the following result Lemma 54. Let δ < 1/2, c1 ≥ 1, λ > 1 and c ≥ 1 be any constants, k := k(ǫ, δ,f) be an integer and M = (4c1k/(δǫ)) ln(4k/δ). Let C be a class of functions where for every f ∈ C there is h ∈ (C ∩ k-Junta) with relevant variables x(Y ) = {xix ∈ Y }, Y ⊆ [n], and h′ ∈ (C ∩ (λk)-Junta) that satisfy the following: 1. Prz∈D[1/2][f (z) 6= h(z)] ≤ δ/(4M ). 2. Pry∈D[1/kc][f (xY ◦ yY ) 6= h′(y)] ≤ δ/4. The algorithm ApproxGeneralC makes O(k/ǫ) queries and, 1. If f ∈ C then, with probability at least 1− δ, the algorithm does not reject and outputs X and w such that f (xX ◦ wX) ∈ C has at most λk relevant variables. 2. For any f , if the algorithm does not reject then, with probability at least 1 − δ, Pr[f (x) 6= f (xX ◦ wX )] ≤ ǫ/c1. Proof. Let f ∈ C. Let h ∈ C ∩ k−Junta and h′ ∈ (C ∩ (λk)-Junta) be functions that satisfies 1 and 2. The algorithm in step 5 chooses two random uniform strings u and v. Define z = (z1, . . . , zn) such that zi = 0 if ui = vi = 0, zi = 1 if ui = vi = 1, and zi = xi if ui 6= vi. Since u and v are chosen uniformly at random we have that z ∈ D[1/2] and therefore, with probability at least 1 − δ/(4M ), 42 f (z) = h(z). If f (z) = h(z) then f (u) = h(u) and f (uX ◦ vX) = h(uX ◦ vX ) for any X ⊆ [n]. In Step 8 ApproxGeneral does a binary search to find a new relevant set. In the binary search it queries strings a that satisfy ai = zi = ui = vi for all i that satisfies zi ∈ {0, 1}. Therefore, f (a) = h(a) for all the strings a generated in the binary search for finding a relevant set. Therefore, with probability at least 1− δ/(4M ), f (a) = h(a) for all the queries used in one iteration and, with probability at least 1 − δ/4, f (a) = h(a) for all the queries used in the algorithm. That is, with probability at least 1 − δ/4, the algorithm runs as if the target is h. Therefore, if f ∈ C, then with probability at least 1−δ/4, each one of the relevant sets discovered in the algorithm contains at least one relevant variable of h. Then since h ∈ k-Junta, the algorithm does not reject in Step 9, that is, I ≤ k. Now we show that, if f ∈ C then with probability at least 1− δ/4, f (xX ◦ wX ) contains at most λk relevant variables. Consider the partition in steps 1-2 in the algorithm and let Xi1, . . . , Xik′ , k′ ≤ k, be the sets where the indices of the relevant variables x(Y ) of h are distributed. Let X ′ = Xi1 ∪ ··· ∪ Xik′ . Notice that for a random uniform w ∈ {0, 1}n, (xX ′ ◦ wX ′) = (xY ◦ yY ) where y ∈ D[k′/kc+1]. That is, given that the relevant variables of h are distributed to k′ different sets that their union is X ′, the probability distributions of (xX ′ ◦ wX ′) and of (xY ◦ yY ) are identical. Choosing a string in D[k′/kc+1] can be done by first choosing a string b in D[1/kc] and then substitute in each variable xi, i 6∈ Y , in b, 0, 1 or xi with probability 1/2 − k′/(2k), 1/2− k′/(2k) or k′/k, respectively. Therefore, since Pry∈D[1/kc][f (xY ◦ yY ) 6= h′(y)] ≤ δ/4, we have Pry∈D[k′/kc+1][f (xY ◦ yY ) 6= h′(y)] ≤ δ/4 and, thus, with probability at least 1 − δ/4, we have that f (xX ′ ◦ wX ′) = h′(x). In particular, with probability at least 1 − δ/4, f (xX ′ ◦ wX ′) has at most λk relevant variables. Since X ⊆ X ′ we also have with the same probability f (xX ◦ wX ) has at most λk relevant variables. This completes the proof of 1. Now let f be any boolean function. If the algorithm does not reject then I ≤ k. Since for the final X, f (uX ◦ vX) 6= f (u) for (4c1/(δǫ)) ln(4k/δ) random uniform u and v, we have that the probability that the algorithm fails to output X that satisfies Prx,y∈U [f (xX◦yX ) 6= f (x)] ≤ δǫ/(4c1) is at most δǫ 4c1(cid:19)(4c1/(δǫ)) ln(4k/δ) k(cid:18)1 − = δ 4 . If Prx,y∈U [f (xX ◦ yX) 6= f (x)] ≤ δǫ/(4c1) then, by Markov's inequality, for a random uniform w, with probability at least 1 − δ/4, Prx∈U [f (xX ◦ wX ) 6= f (x)] ≤ ǫ/c1. This completes the proof of 2. In the next subsections, we give some results that follow from Lemma 54. 7.1 Testing Decision List In [30], Diakonikolas et al. gave a polynomial time tester for Decision List that makes O(1/ǫ2) queries. In this paper, we give a polynomial time tester that makes O(1/ǫ) queries. We show Theorem 55. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing Decision List that makes O(1/ǫ) queries. Proof. Let f = (xi1, ξ1, a1), . . . , (xis, ξs, as) be any decision list. We first use Lemma 54. Define k = min(s, c′ log(1/(ǫδ))) for some large constant c′ and h = (xi1, ξ1, a1), . . . , (xik , ξk, ak). For the distribution D[1/2], the probability that f (z) = h(z) is 1 when k = s and at least 1 − 43 (3/4)k ≥ 1 − 1/(3M ) where M = (4c1k/(δǫ)) ln(4k/δ). For the distribution D[1/k2] and Y = {i1, . . . , ik}, the probability that f (xY ◦yY ) has more than 2k relevant variables is less than (3/4)k ≤ δ/3. The query complexity of ApproxGeneral is O(k/ǫ) = O(1/ǫ). Therefore all we need to do to get the result is to give a tester for decision list of size k = O(log(1/ǫ)) that makes O(1/ǫ) queries. The learnability of this class with O(1/ǫ) ExQs follows from [51, 14]. 7.2 Testing r-DNF and r-Decision List for Constant r An r-decision list is a sequence f = (T1, ξ1, a1), . . . , (Ts, ξs, as) for any s where ξi, ai ∈ {0, 1} and Ti are r-terms. This sequence represents the following function: f (x) :="If T1 = ξ1 then output(a1) else if T2 = ξ2 then output(a2) else if ··· else if Ts = ξs then output(as)". The class r-Decision List is the class of all r-decision lists and the class of Length-s r-Decision List is the class of all r-decision lists f = (T1, ξ1, a1), . . . , (Tm, ξm, am) with m ≤ s. In this subsection, we show Theorem 56. Let r be any constant. For any ǫ > 0, there is a two-sided adaptive algorithm for ǫ-testing r-Decision List and r-DNF that makes O(1/ǫ) queries. It is known that the class Length-s r-Decision List is learnable under any distribution in time O(nr) using O((sr log n + log(1/δ))/ǫ) ExQD, [14, 51]. Also we may assume that T1, . . . , Ts are distinct and therefore s is less thanPr constant r, it is enough to prove that r-Decision List and r-DNF satisfies 1 and 2 in Lemma 54 with k = poly(log(1/ǫ)). i(cid:1)2i , the number of terms of size at most r. Thus, for i=1(cid:0)n We now prove the result for r-Decision List when r is constant. The same analysis shows that the result is also true for r-DNF. Consider an r-decision list f = (T1, ξ1, a1)··· (Ts, ξs, as). If ξi = 0 then we change (Ti, 0, ai) to . Therefore we may , 1, ai) where Ti = xc1 i1 ··· xcℓ the equivalent expression (x assume that ξj = 1 for all j. In that case we just write f = (T1, a1)··· (Ts, as). (Tiℓ , aiℓ) such that 1 ≤ i1 < i2 < ··· < iℓ ≤ s. For an r-decision list f = (T1, a1)··· (Ts, as), a sublist of f is an r-decision list g = (Ti1, ai1)··· We first prove , 1, ai)··· (x 1−ci1 i1 1−ciℓ iℓ iℓ Lemma 57. Let r be a constant. For any r-decision list f there is a kr := O(logr(1/ǫ))-length r-decision list h that is a sublist of f and satisfies 1 and 2 in Lemma 54. Proof. We show that it satisfies 1 in Lemma 54. The proof that it also satisfies 2 is similar. We give a stronger result as long as r is constant. We prove by induction that for any r- decision list f there is a kr = O(logr(1/ǫ))-length r-decision list h that is a sublist of f and satisfies Prz∈D[1/2][f (z) 6= h(z)] ≤ poly(ǫ). The proof is by induction on r. For r = 1, the result follows from the proof of Theorem 55 in the previous subsection. Assume the result is true for r-decision list. We now show the result for (r + 1)-decision list. Let c be a large constant. Let f = (T1, a1)··· (Ts, as) be (r + 1)-decision list. Let s1 = 1 and Ts1, . . . , Tsw be a sequence of terms such that s1 < s2 < ··· < sw ≤ s and for every i, si is the minimal integer that is greater than si−1 such that the variables in Tsi do not appear in any one of 44 the terms Ts1, Ts2, . . . , Tsi−1. Define h0 = (T1, a1)(T2, a2)··· (Tsw′ , asw′ ) if w′ := c2r+1 ln(1/ǫ) ≤ w and h0 = f if w′ > w. Then Prz∈D[1/2][f (z) 6= h0(z)] ≤ Pr[T1(z) = 0 ∧ T2(z) = 0 ∧ ··· ∧ Tsw′ (z) = 0] ≤ Pr[Ts1(z) = 0 ∧ Ts2(z) = 0 ∧ ··· ∧ Tsw′ (z) = 0] ≤ (cid:18)1 − 1 2r+1(cid:19)w′ ≤ poly(ǫ). Let S = {xj1, . . . , xjt} be the set of the variables in Ts1, . . . , Tsw′ . Then t ≤ (r + 1)w′ = c(r + 1)2r+1 ln(1/ǫ) and every term Ti in h0 contains at least one variable in S. Consider all the terms that contains the variable xj1, Ti1 = xj1T ′ , i1 < i2 < ··· < iℓ. Consider the r-decision list g := (T ′ , aℓ). By the induction hypothesis there is an r- decision list g′ that is a sublist of g of length at most kr = O(logr(1/ǫ)) such that Prz∈D[1/2][g(z) 6= g′(z)] ≤ poly(ǫ). Let h1 be h0 without all the terms (Tiw , aiw ) that correspond to the terms (T ′ iw , aiw ) that do not occur in g′. It is easy to see that Prz∈D[1/2][h0(z) 6= h1(z)] ≤ poly(ǫ). We do the same for all the other variables xj2, . . . , xjt of S and get a sequence of r-decision lists h2, h3, . . . , ht that satisfies Prz∈D[1/2][hw(z) 6= hw+1(z)] ≤ poly(ǫ). Therefore Prz∈D[1/2][f (z) 6= ht(z)] ≤ t · poly(ǫ) = poly(ǫ) and the length of ht is at most tkr = O(logr+1(1/ǫ)) = kr+1. i1, Ti2 = xj1T ′ i2, a2)··· (T ′ i2, . . . , Tiℓ = xj1T ′ iℓ i1, a1)(T ′ iℓ 8 Improvements and Further Results In this section, we go over the previous results and show how some modifications can give improved results. The improvements are in the logarithmic part of the query complexity. We concentrate on the first tester that test subclasses of k-Junta. Similar improvements can also be made for the second and third testers. 8.1 Improved ApproxTarget Procedure The procedure ApproxTarget makes O((k log k)/ǫ) queries. We show that the number of queries can be reduced to O(k/ǫ + k log k). We call the new procedure IApproxTarget The procedure IApproxTarget repeats steps 5-18 in ApproxTarget M = 16ck/ǫ times and does not have step 19, and therefore does not need the variable t(X). It also saves all the values of X. Suppose it does not reject and X takes the values X (1), X (2), . . . , X (k′) where k′ ≤ k and let X (i)) for i ∈ [k′]. In the case where the procedure does not reject we add another h(i) = f (xX (i) ◦ 0 procedure that estimates Prx∈D[h(i)(x) 6= f (x)] for all i ∈ [k′], with constant multiplicative error and outputs h(i) with the least estimated value. This can be done with N = (96c/ǫ) ln(60k) queries to ExQD. We first prove that, with probability at least 29/30, there is i ∈ [k′] such that Prx∈D[h(i)(x) 6= f (x)] ≤ ǫ/(2c). For suppose there is no such i: Then all the functions h(i) are (ǫ/(2c))-far from f (x) and for M = 16ck/ǫ random u ∈ D only k′ ≤ k of them witness that h(i)(x) 6= f (x) for some i. By Chernoff's bound this can happen with probability at most e−(7/8)2·8k/2 ≤ e−3k ≤ 1/30. Now to distinguish between those that are (ǫ/(2c))-close to f and those that are (ǫ/c)-far from f , by Chernoff's bound, we need to estimate all Prx∈D[h(i)(x) 6= f (x)], i ∈ [k′], with confidence probability 29/30 and accuracy ǫ/(4c). For this we need N ≤ (96c/ǫ) ln(60k) queries to ExQD. 45 We've proved Lemma 58. The IApproxTarget makes O(k/ǫ + k log k) queries. Obviously, if the h(ℓ) gets the least estimated value then the procedure removes from V (and I) all the witnesses of X (i), i > ℓ and returns (X (ℓ), V, I). 8.2 A General TestSets Procedure In this subsection, we give a small change in the procedure TestSets and show in the sequel how this change improves the query complexity. The general TestSets GTestSet has another ), 1, β, 1/15) in step 2. The parameter β < 1/30 as an input and calls UniformJunta(f (xXℓ ◦ v(ℓ) other commands are the same. The value of β will depend on the class being learned. Xℓ The same proofs as for TestSet give Lemma 59. Let β < 1/30. The procedure GTestSet satisfies 1. If for some ℓ ∈ I, f (xXℓ ◦ v(ℓ) Xℓ bution then, with probability at least 14/15, GTestSet rejects. ) is β-far from every literal with respect to the uniform distri- 2. GTestSet makes O(k/β) queries. 8.3 A General RelVarValue Procedure In this, subsection we give a small change in the procedure RelVarValue and show in the sequel how this change improves the query complexity. The general RelVarValue GRelVarValue(w, X, V, I, δ, β), that has another parameter β < 1/30 as an input, repeats steps 5-7 times. The other commands are the same. The value of β will depend on the class being learned. h = max(1, (log(k/δ))/ log(1/(3pβ))) We give the proof of the following Lemma 60. If for every ℓ ∈ I the function f (xXℓ ◦ v(ℓ) ) is β-close to a literal in {xτ (ℓ), ¯xτ (ℓ)} with respect to the uniform distribution, where τ (ℓ) ∈ Xℓ, and {Gℓ,0, Gℓ,1} = {0, h} then, with probability at least 1 − δ, we have: For every ℓ ∈ I, zℓ = wτ (ℓ). Proof. We follow the proof of Lemma 15 with the same notations and the following changes in the proof. We have Xℓ Therefore and by Markov's bound ExXℓ ∈U [Z(xXℓ)] ≤ β. ExYℓ,1 ∈U ExYℓ,0 ∈U [Z(xYℓ,0 ◦ xYℓ,1)] ≤ β PrxYℓ,1 ∈UhExYℓ,0 ∈U [Z(xYℓ,0 ◦ xYℓ,1)] ≥pβi ≤pβ. That is, for a random uniform string b ∈ {0, 1}n, with probability at least 1−√β, f (xYℓ,0◦bYℓ,1◦v(ℓ) is √β-close to xτ (ℓ) with respect to the uniform distribution. Now, given that f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) Xℓ Xℓ ) ) 46 is √β-close to xτ (ℓ) with respect to the uniform distribution the probability that Gℓ,0 = 0 is the probability that f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) for h random uniform strings b ∈ {0, 1}n. Let b(1), . . . , b(h) be h random uniform strings in {0, 1}n, V (b) be the event f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ) = ) is √β-close to xτ (ℓ) with respect to ) and A the event that f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) Xℓ the uniform distribution. Let g(xYℓ,0) = f (xYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) ). Then ) = f (bYℓ,0 ◦ bYℓ,1 ◦ v(ℓ) Xℓ Xℓ Xℓ Xℓ Xℓ Pr[V (b)A] ≤ Pr[g(bYℓ,0) 6= bτ (ℓ)A] + Pr[g(bYℓ,0 ) 6= bτ (ℓ))A] ≤ 2pβ. Since τ (ℓ) ∈ Yℓ,0, we have wτ (ℓ) = 0. Therefore, by step 9 and since τ (ℓ) ∈ Xℓ, Pr[zℓ 6= wτ (ℓ)] ≤(cid:0)Pr[V (b)A] + Pr[A](cid:1)h ≤ (3pβ)h Therefore, the probability that zℓ 6= wτ (ℓ) for some ℓ ∈ I is at most k(3√β)h ≤ δ. The following is obvious Lemma 61. The procedure GRelVarValues makes O(k + k(log(k/δ))/ log(1/β))) queries. 8.4 Improved Closef F Procedure The procedure Closef F makes O((k/ǫ) log(k/ǫ)) queries. We show that the number of queries can be reduced to O((k/ǫ) + (k/ǫ) log(k/ǫ)/ log(1/β)) queries in the distribution-free model and O(k log(1/ǫ) + k log(1/ǫ) log(k log(1/ǫ))/ log(1/β) + 1/ǫ) queries in the uniform distribution model. We call the new procedures IClosef F and IUClosef F . Notice that if you choose β = ǫ, the query complexity of TestSets is O(k/ǫ) and the query complexity of Closef F is O((k/ǫ)(1 + (log k)/ log(1/ǫ))) queries in the distribution-free model and O(k log k + k log log(1/ǫ) + 1/ǫ) queries in the uniform distribution model. The former complexity is O(k/ǫ) when ǫ = 1/kΩ(1). For IClosef F we just take the procedure Closef F and instead of calling RelVarValue it calls GRelVarValues with the parameter β. Lemma 62. For any constant δ, procedure IClosef F makes O((k/ǫ) + (k/ǫ)(log(k/ǫ))/ log(1/β)) queries. When the distribution is uniform, rather than choosing random uniform and independent strings u we choose random uniform pairwise independent strings. We choose t = O(log(1/ǫ)) random uni- form and independent strings W = {w(1), . . . , w(t)} and generate random uniform pairwise inde- pendent strings from the linear space that are spanned by W . It is enough to run GRelVarValues for the strings in W to find w(1) i=1 ηiw(i) in the linear space we have uΓ =Pt i=1 ηiw(i) Γ because for any other string u =Pt Γ , . . . , w(t) Γ . The algorithm is in Figure 15. Lemma 63. For any constant δ and (X, V, I) that satisfies Assumption 17, procedure IUClosef F makes O(k log(1/ǫ) + (k log(1/ǫ) log(k log(1/ǫ))/ log(1/β) + 1/ǫ) queries and 1. If f ∈ C then IUClosef F outputs OK. 47 IUClosef F (f, ǫ, δ, β) Input: Oracle that accesses a Boolean function f . Output: Either "reject" or "OK" 1. Define F ≡ f (x(πf,I) ◦ 0X). 2. Choose t = log(12/(ǫδ)) i.i.d. strings w(1), . . . , w(t) ∈ U 3. For i = 1 to t. 4. 5. Choose arbitrary m = 6/(ǫδ) non-zero strings ξ(1), . . . , ξ(m) ∈ {0, 1}t 6. For i = 1 to m. 7. 8. 9. Return "OK" ζ (i) ←GRelVarValue(w(i), X, V, I, δ/(2t), β) . Set u ←Pt j=1 ξ(i) If f (uX ◦ 0X ) 6= F (z) then "reject" j w(j); z ←Pt j=1 ξ(i) j ζ (j); Figure 15: A procedure that tests whether f (xX ◦ 0X) is (ǫ/3)-far from F with respect to the uniform distribution. 2. If f (xX ◦ 0X) is (ǫ/3)-far from F then, with probability at least 1 − δ, IUClosef F rejects. j=1 ξ(i) j=1 ξ(i) Proof. The proof of 1 is the same as in the proof of Lemma 20. We now prove 2. j w(j) and z(i) = Pt Let u(i) = Pt j ζ (j) for i ∈ [m]. By Lemma 60 and 61, with probability at least 1 − δ/2, ζ (i) = w(i) Γ for all i ∈ [t] . The map x → xΓ is a linear map and therefore, with probability at least 1 − δ/2, u(i) Γ = z(i) for all i ∈ [m]. Define, for i ∈ [m], the event X ◦ 0X ) 6= F (z(i)) and 0 otherwise. Let A = Pi∈[m] Ai. Then ǫ′ := E[Ai] ≥ ǫ/3, Ai = 1 if f (u(i) µ := E[A] = Pi∈[m] ǫ′ = ǫ′m ≥ ǫm/3 = 2/δ and Var[Ai] = ǫ′ − ǫ′2. Since Ai are pairwise independent, Var[A] =Pi∈[m] Var[Ai] = µ(1 − ǫ′). By (7) in Lemma 68 we have Pr[Algorithm outputs "OK"] = Pr[A = 0] ≤ Pr[A − µ ≥ µ] ≤ Var[A] µ2 ≤ 1 µ ≤ δ 2 . Therefore, if f (xX ◦ 0X ) is (ǫ/3)-far from F then, with probability at least 1 − δ, IUClosef F rejects. The query complexity follows from Lemma 61. 8.5 A Weaker ExQD In this subsection, we define a weak ExQD, WExQD, and show that learning with WExQD and MQ gives a tester for F (y) using a better query complexity. We then show that in many of the learning algorithms in this paper, ExQD can be replaced with WExQD. We define the WExQD that returns with probability 1/2 a string drawn according to distribution D and with probability 1/2 an arbitrary string (chosen by an adversary). We now show that in some of the learning algorithms in this paper one can replace ExQD with WExQD We first show 48 Lemma 64. For constant δ, there is a polynomial time learning algorithm for s-Term Monotone r-DNF that makes O(s/ǫ) WExQD and O(sr log(ns)) MQ and, with probability at least 1−δ, learns an s-term monotone r-DNF h that satisfies PrD[h 6= f ] ≤ ǫ. Proof. Consider the algorithm LearnMonotone in Figure 9 with WExQD. If steps 2-11 are repeated 16(s/ǫ) log(1/δ) times then with probability at least 1 − δ, more than 4(s/ǫ) log(1/δ) of the examples received by the WExQD are according to the distribution D. The rest of the proof follows directly from the proof of Lemma 34. Consider now algorithm LearnPolynomial in Figure 10 that learns s-sparse polynomial over F2 of Degree d. We can use the technique in Subsection 8.1, to get an algorithm that learns this class with O(s/ǫ) ExQD and O(2d log(ns)) MQ. Then as in the proof of Lemma 45 the ExQD can be replaced with WExQD. Therefore Lemma 65. For constant δ, there is a polynomial time learning algorithm for s-Sparse Polynomial of Degree d that makes O(s/ǫ) WExQD and O(2ds log(ns)) MQ and, with probability at least 1− δ, learns an s-sparse polynomial of degree d, h, that satisfies PrD[h 6= f ] ≤ ǫ. 8.6 An Improved Query Complexity We first show If there is a polynomial time algorithm A that, given as an Theorem 66. Let C ⊆ k-Junta. input a constant δ, any ǫ and (X, V, I) that satisfies Assumption 17, learns C(Y ) with respect the distribution D (resp. uniform distribution), with confident δ, accuracy ǫ, makes M (ǫ, δ) M Q to F and Q(ǫ, δ) ExQD (resp. WExDD, ExDU ) queries to F then there is a polynomial time tester TD (resp. TW D, TU ) for C that makes O k ǫ + k log k + M ′ + kQ′ + k · 1 ǫ log k + Q′ log(kQ′) ǫ + log log k + log Q′! log 1 queries (resp. O k ǫ + k log k + M ′ + kQ′ + k log k · ǫ + log log k + log Q′! , 1 ǫ + Q′ log 1 queries) where Q′ = Q(ǫ/12, 1/24), M ′ = M (ǫ/12, 1/24) and O(cid:18)k ǫ + k log k + M ′ + Q′(cid:19) 1. If f ∈ C then, with probability at least 2/3, TD, TW D and TU accepts. 2. If f is ǫ-far from every function in C with respect to D then, with probability at least 2/3, TD (resp. TW D) rejects. 3. If f is ǫ-far from every function in C with respect to the uniform distribution then, with probability at least 2/3, TU rejects. 49 Proof. We run TesterC(f,D, ǫ) in Figure 8 with the following changes: In step 1 we run the procedure IApproxTarget(f,D, ǫ, 1/3). By Lemma 58, it uses O(k/ǫ + k log k) queries. In step 2 we run the procedure GTestSet(X, V, I, β). By Lemma 59, it uses k/β queries. The value of In step 4, we will run the procedure IClosef F (f,D, ǫ, 1/15, β) for β will be determined later. any distribution D and IUClosef F (f, ǫ, 1/15, β) for the uniform distribution. By Lemma 62, IClosef F makes O(k/ǫ + (k/ǫ)(log(k/ǫ))/ log(1/β)) queries. By Lemma 63, IUClosef F makes O(k log(1/ǫ) + k log(1/ǫ) log(k log(1/ǫ))/ log(1/β) + 1/ǫ) queries. By Lemma 24 and 61, to distinguish between F ∈ C(Y ) and F ǫ-far from every function in C(Y ) we need to ask M ′ MQ and Q′′ = Q′ + O(1/ǫ) ExQD queries to f . For that we need to run GRelVarValue(w, X, V, I, 1/(24Q′′ ), β), Q′′ times. This takes O(kQ′′ + kQ′′(log(kQ′′))/ log(1/β)) queries. To make Q′′ WExQD, by Lemma 61, we need to run GRelVarValue(w, X, V, I, 1/2, β), Q′′ times. This takes O(kQ′ + kQ′(log k)/ log(1/β)) queries. For the uniform distribution we just need Q′ queries. For MQ we need M ′ queries. Now for the distribution-free model we choose (resp. with WExQD) β = (resp. ǫ log k 1 ǫ log k log2(cid:0) 1 log2(cid:0) 1 1 ǫ + Q′′ log(kQ′′) ǫ + Q′′ log(kQ′′)(cid:1) ǫ + Q′ log k(cid:1) ǫ + Q′ log k ǫ log k ǫ log k β = ) and get the result. For the uniform distribution model we choose β = ǫ and get the result. We note here that when Q′ = 0 then we define log 0 = 0. 8.7 Some Improved Results In this subsection, we give some of the results. See the Table in Figure 16. For k-Junta we have M ′ = Q′ = 0 and then by Theorem 66, we get the query complexity O(k/ǫ + k log k) for the uniform model and O k ǫ + k log k + k ǫ log k ǫ + log log k! log 1 for the distribution-free model. Notice that, the latter query complexity is O(k/ǫ + k log k) when 1/ǫ = O(log log k) or 1/ǫ = kΩ(1). The same result follows for the classes k-Linear and k-Term. For s-Term Monotone r-DNF and s-Unate r-DNF, by Lemma 45, there is an algorithm that learns F ∈ C(Y ) with k = sr variables with M ′ = O(sr log(sr)) MQ and Q′ = O(s/ǫ) WExQD. This gives the result in the Table. For Length-k Decision List, M ′ = 0 MQ and Q′ = O((k/ǫ) log k) WExQD. By Theorem 66, we get the query complexity O(k(log k)/ǫ) for the uniform model and O(k2(log k)/ǫ) for the distribution-free model. It is an open problem whether the class of Length-k Decision List is 50 Class of Functions s-Term Monotone r-DNF s-Term Unate r-DNF k-Junta, k-Term and k-Linear Length k Decision List size-s Decision Trees and size-s Branching Programs F. With Fourier Degree ≤ d Distri- bution U D U D U D U D D #Queries Complexity O(·) sr ǫ + sr log(sr) sr log r + s2r ǫ + s2r k ǫ + k log k ǫ log r log s+log log r+log 1 ǫ k ǫ + k log k + k ǫ log k ǫ +log log k log 1 k log k ǫ k2 log k ǫ s log s ǫ s2 log s ǫ d2d ǫ + d522d Figure 16: A table of the results. In the table, U and D stand for uniform and distribution-free model. learnable with O(k/ǫ) ExQD. If it is, then the query complexity can be reduced to O(k/ǫ + k log k) for the uniform model O(k2/ǫ) for the distribution-free model. For Functions with Fourier Degree ≤ d, it is known from [16], Lemma 21, that this class is learnable with O(d322d log2 n) queries. Therefore, k = d2d, M ′ = O(d522d) and Q′ = 0. By Theorem 66, we get a query complexity O(d2d/ǫ + d522d) in the distribution-free model. References [1] Noga Alon, Tali Kaufman, Michael Krivelevich, Simon Litsyn, and Dana Ron. Test- ing low-degree polynomials over GF(2). In Approximation, Randomization, and Combi- natorial Optimization: Algorithms and Techniques, 6th International Workshop on Ap- proximation Algorithms for Combinatorial Optimization Problems, APPROX 2003 and 7th International Workshop on Randomization and Approximation Techniques in Com- puter Science, RANDOM 2003, Princeton, NJ, USA, August 24-26, 2003, Proceed- ings, pages 188 -- 199, 2003. URL: https://doi.org/10.1007/978-3-540-45198-3_17, doi:10.1007/978-3-540-45198-3\_17. [2] Noga Alon, Tali Kaufman, Michael Krivelevich, Simon Litsyn, and Dana Ron. Test- IEEE Trans. Information Theory, 51(11):4032 -- 4039, 2005. URL: ing reed-muller codes. https://doi.org/10.1109/TIT.2005.856958, doi:10.1109/TIT.2005.856958. [3] Dana Angluin. Queries and concept learning. Machine Learning, 2(4):319 -- 342, 1987. [4] Roksana Baleshzar, Meiram Murzabulatov, Ramesh Krishnan S. Pallavoor, and Sofya Raskhodnikova. Testing unateness of real-valued functions. CoRR, abs/1608.07652, 2016. URL: http://arxiv.org/abs/1608.07652, arXiv:1608.07652. [5] Aleksandrs Belovs and Eric Blais. A polynomial lower bound for testing monotonicity. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, 51 STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 1021 -- 1032, 2016. URL: https://doi.org/10.1145/2897518.2897567, doi:10.1145/2897518.2897567. [6] Arnab Bhattacharyya, Swastik Kopparty, Grant Schoenebeck, Madhu Sudan, and David Zuck- In Property Testing - Current Research and erman. Optimal testing of reed-muller codes. Surveys, pages 269 -- 275. 2010. URL: https://doi.org/10.1007/978-3-642-16367-8_19, doi:10.1007/978-3-642-16367-8\_19. Improved bounds and Combinatorial Optimization. Algorithms [7] Eric Blais. domization International Workshop, RANDOM 2008, Boston, MA, USA, August 317 -- 330, doi:10.1007/978-3-540-85363-3\_26. In Approximation, Ran- and Techniques, 11th International Workshop, pages https://doi.org/10.1007/978-3-540-85363-3_26, 2008. Proceedings, APPROX 2008, juntas. testing 25-27, URL: 2008. 12th and for [8] Eric Blais. Testing juntas nearly optimally. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing, STOC 2009, Bethesda, MD, USA, May 31 - June 2, 2009, pages 151 -- 158, 2009. URL: https://doi.org/10.1145/1536414.1536437, doi:10.1145/1536414.1536437. [9] Eric Blais, Joshua Brody, and Kevin Matulef. Property testing lower bounds via commu- nication complexity. In Proceedings of the 26th Annual IEEE Conference on Computational Complexity, CCC 2011, San Jose, California, USA, June 8-10, 2011, pages 210 -- 220, 2011. URL: https://doi.org/10.1109/CCC.2011.31, doi:10.1109/CCC.2011.31. [10] Eric Blais and Daniel M. Kane. Tight bounds for testing k-linearity. In Approx- imation, Randomization, and Tech- niques - 15th International Workshop, APPROX 2012, and 16th International Work- shop, RANDOM 2012, Cambridge, MA, USA, August 15-17, 2012. Proceedings, pages https://doi.org/10.1007/978-3-642-32512-0_37, doi:10.1007/978-3-642-32512-0\_37. and Combinatorial Optimization. Algorithms 435 -- 446, URL: 2012. [11] Avrim Blum. Learning a function of r relevant variables. In Computational Learning The- ory and Kernel Machines, 16th Annual Conference on Computational Learning Theory and 7th Kernel Workshop, COLT/Kernel 2003, Washington, DC, USA, August 24-27, 2003, Pro- ceedings, pages 731 -- 733, 2003. URL: https://doi.org/10.1007/978-3-540-45167-9_54, doi:10.1007/978-3-540-45167-9\_54. [12] Avrim Blum examples and in and 271, doi:10.1016/S0004-3702(97)00063-5. 1997. Pat machine URL: Langley. Selection features 97(1-2):245 -- https://doi.org/10.1016/S0004-3702(97)00063-5, learning. relevant Intell., Artif. of [13] Manuel Blum, Michael Luby, with applications 595, doi:10.1016/0022-0000(93)90044-W. URL: 1993. to numerical problems. and Ronitt Rubinfeld. Self-testing/correcting 47(3):549 -- https://doi.org/10.1016/0022-0000(93)90044-W, J. Comput. Syst. Sci., 52 [14] Anselm Blumer, Andrzej Ehrenfeucht, fred K. Warmuth. 380, doi:10.1016/0020-0190(87)90114-1. Occam's URL: 1987. Man- 24(6):377 -- https://doi.org/10.1016/0020-0190(87)90114-1, David Inf. Process. Haussler, razor. Lett., and [15] Nader H. Bshouty. Almost optimal distribution-free junta testing. CoRR, abs/1901.00717, 2018. [16] Nader H. Bshouty. Exact learning from an honest teacher that answers membership queries. Theor. Comput. Sci., 733:4 -- 43, 2018. URL: https://doi.org/10.1016/j.tcs.2018.04.034, doi:10.1016/j.tcs.2018.04.034. [17] Nader H. Bshouty and Areej Costa. Exact learning of juntas from membership queries. Theor. Comput. Sci., 742:82 -- 97, 2018. URL: https://doi.org/10.1016/j.tcs.2017.12.032, doi:10.1016/j.tcs.2017.12.032. [18] Nader H. Bshouty and Yishay Mansour. trees and multivariate polynomials. https://doi.org/10.1137/S009753979732058X, doi:10.1137/S009753979732058X. for decision SIAM J. Comput., 31(6):1909 -- 1925, 2002. URL: Simple learning algorithms [19] Deeparnab Chakrabarty and C. Seshadhri. functions over the hypercube. STOC'13, Palo Alto, CA, USA, June 1-4, 2013, pages 411 -- 418, https://doi.org/10.1145/2488608.2488660, doi:10.1145/2488608.2488660. A o(n) monotonicity tester for boolean In Symposium on Theory of Computing Conference, URL: 2013. [20] Deeparnab Chakrabarty and C. Seshadhri. A O(n) non-adaptive tester for unateness. CoRR, abs/1608.06980, 2016. URL: http://arxiv.org/abs/1608.06980, arXiv:1608.06980. [21] Sourav Chakraborty, David Garc´ıa-Soriano, and Arie Matsliah. Efficient sample extrac- tors for juntas with applications. In Automata, Languages and Programming - 38th In- ternational Colloquium, ICALP 2011, Zurich, Switzerland, July 4-8, 2011, Proceedings, Part I, pages 545 -- 556, 2011. URL: https://doi.org/10.1007/978-3-642-22006-7_46, doi:10.1007/978-3-642-22006-7\_46. [22] Xi Chen, Anindya De, Rocco A. Servedio, and Li-Yang Tan. Boolean function monotonic- ity testing requires (almost) n1/2 non-adaptive queries. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015, pages 519 -- 528, 2015. URL: https://doi.org/10.1145/2746539.2746570, doi:10.1145/2746539.2746570. [23] Xi Chen, Rocco A. Servedio, and Li-Yang Tan. New algorithms and lower bounds for mono- tonicity testing. CoRR, abs/1412.5655, 2014. URL: http://arxiv.org/abs/1412.5655, arXiv:1412.5655. [24] Xi Chen, Rocco A. Servedio, Li-Yang Tan, Erik Waingarten, and Jinyu Xie. Settling the query complexity of non-adaptive junta testing. In 32nd Computational Complex- ity Conference, CCC 2017, July 6-9, 2017, Riga, Latvia, pages 26:1 -- 26:19, 2017. URL: https://doi.org/10.4230/LIPIcs.CCC.2017.26, doi:10.4230/LIPIcs.CCC.2017.26. 53 [25] Xi Chen, Erik Waingarten, and Jinyu Xie. Beyond talagrand functions: new lower bounds for testing monotonicity and unateness. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 523 -- 536, 2017. URL: https://doi.org/10.1145/3055399.3055461, doi:10.1145/3055399.3055461. [26] Xi Chen, Erik Waingarten, and Jinyu Xie. adaptive queries. In 58th IEEE Annual Symposium on Foundations of Computer Sci- ence, FOCS 2017, Berkeley, CA, USA, October 15-17, 2017, pages 868 -- 879, 2017. URL: https://doi.org/10.1109/FOCS.2017.85, doi:10.1109/FOCS.2017.85. Boolean unateness testing with eO(n3/4) [27] Xi Chen and Jinyu Xie. Tight bounds for the distribution-free testing of monotone con- junctions. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 54 -- 71, 2016. URL: https://doi.org/10.1137/1.9781611974331.ch5, doi:10.1137/1.9781611974331.ch5. [28] Hana Chockler and Dan Gutfreund. Inf. Pro- cess. Lett., 90(6):301 -- 305, 2004. URL: https://doi.org/10.1016/j.ipl.2004.01.023, doi:10.1016/j.ipl.2004.01.023. A lower bound for testing juntas. [29] Peter Damaschke. Ma- chine Learning, 41(2):197 -- 215, 2000. URL: https://doi.org/10.1023/A:1007616604496, doi:10.1023/A:1007616604496. Adaptive versus nonadaptive attribute-efficient learning. [30] Ilias Diakonikolas, Homin K. Lee, Kevin Matulef, Krzysztof Onak, Ronitt Rubinfeld, Rocco A. Servedio, and Andrew Wan. Testing for concise representations. In 48th Annual IEEE Sym- posium on Foundations of Computer Science (FOCS 2007), October 20-23, 2007, Providence, RI, USA, Proceedings, pages 549 -- 558, 2007. URL: https://doi.org/10.1109/FOCS.2007.32, doi:10.1109/FOCS.2007.32. [31] Ilias Diakonikolas, Homin K. Lee, Kevin Matulef, Rocco A. Servedio, and Andrew Wan. Efficiently testing sparse GF (2) polynomials. Algorithmica, 61(3):580 -- 605, 2011. URL: https://doi.org/10.1007/s00453-010-9426-9, doi:10.1007/s00453-010-9426-9. [32] Elya Dolev and Dana Ron. linear number of queries. https://doi.org/10.4086/toc.2011.v007a011, doi:10.4086/toc.2011.v007a011. Theory of Computing, 2011. Distribution-free testing for monomials with a sub- URL: 7(1):155 -- 176, [33] Eldar Fischer, Guy Kindler, Dana Ron, Shmuel Safra, and Alex Samorodnitsky. Test- ing juntas. In 43rd Symposium on Foundations of Computer Science (FOCS 2002), 16- 19 November 2002, Vancouver, BC, Canada, Proceedings, pages 103 -- 112, 2002. URL: https://doi.org/10.1109/SFCS.2002.1181887, doi:10.1109/SFCS.2002.1181887. [34] Dana Glasner and Rocco A. Servedio. Distribution-free testing for basic boolean functions. https://doi.org/10.4086/toc.2009.v005a010, doi:10.4086/toc.2009.v005a010. Theory of Computing, 5(1):191 -- 216, 2009. lower bound URL: [35] Oded Goldreich. On testing computability by small width obdds. imation, Randomization, niques, 13th and Combinatorial Optimization. Algorithms International Workshop, APPROX 2010, and 14th In Approx- and Tech- International 54 Workshop, RANDOM 2010, Barcelona, Spain, September 1-3, pages doi:10.1007/978-3-642-15369-3\_43. 2010. Proceedings, https://doi.org/10.1007/978-3-642-15369-3_43, 574 -- 587, URL: 2010. [36] Oded Goldreich, editor. ume https://doi.org/10.1007/978-3-642-16367-8, doi:10.1007/978-3-642-16367-8. of Lecture Notes Property Testing - Current Research and Surveys, vol- URL: in Computer Science. Springer, 2010. 6390 [37] Oded Goldreich, Shafi Goldwasser, Eric Lehman, Dana Ron, and Alex Samorod- URL: nitsky. https://doi.org/10.1007/s004930070011, doi:10.1007/s004930070011. Testing monotonicity. Combinatorica, 20(3):301 -- 337, 2000. [38] Oded Goldreich, Shafi Goldwasser, and Dana Ron. nection to learning and approximation. J. ACM, 45(4):653 -- 750, https://doi.org/10.1145/285055.285060, doi:10.1145/285055.285060. Property testing and its con- URL: 1998. [39] Parikshit Gopalan, Ryan O'Donnell, Rocco A. Servedio, Amir Shpilka, and Karl Wimmer. Testing fourier dimensionality and sparsity. SIAM J. Comput., 40(4):1075 -- 1100, 2011. URL: https://doi.org/10.1137/100785429, doi:10.1137/100785429. [40] David Guijarro, Jun Tarui, and Tatsuie Tsukiji. Finding relevant variables in PAC model with membership queries. In Algorithmic Learning Theory, 10th International Confer- ence, ALT '99, Tokyo, Japan, December 6-8, 1999, Proceedings, page 313, 1999. URL: https://doi.org/10.1007/3-540-46769-6_26, doi:10.1007/3-540-46769-6\_26. [41] Shirley Halevy and Eyal Kushilevitz. J. Comput., doi:10.1137/050645804. 37(4):1107 -- 1138, 2007. Distribution-free property-testing. SIAM URL: https://doi.org/10.1137/050645804, [42] Subhash Khot, Dor Minzer, and Muli Safra. On monotonicity testing and boolean isoperi- metric type theorems. In IEEE 56th Annual Symposium on Foundations of Computer Sci- ence, FOCS 2015, Berkeley, CA, USA, 17-20 October, 2015, pages 52 -- 58, 2015. URL: https://doi.org/10.1109/FOCS.2015.13, doi:10.1109/FOCS.2015.13. [43] Subhash Khot and Igor Shinkar. An eO(n) queries adaptive tester for unateness. CoRR, abs/1608.02451, 2016. URL: http://arxiv.org/abs/1608.02451, arXiv:1608.02451. [44] Richard J. Lipton, Evangelos Markakis, Aranyak Mehta, and Nisheeth K. Vishnoi. On the fourier spectrum of symmetric boolean functions with applications to learn- ing symmetric juntas. In 20th Annual IEEE Conference on Computational Complex- ity (CCC 2005), 11-15 June 2005, San Jose, CA, USA, pages 112 -- 119, 2005. URL: https://doi.org/10.1109/CCC.2005.19, doi:10.1109/CCC.2005.19. [45] Zhengyang Liu, Xi Chen, Rocco A. Servedio, Ying Sheng, and Jinyu Xie. Distribution-free In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of junta testing. Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 749 -- 759, 2018. URL: https://doi.org/10.1145/3188745.3188842, doi:10.1145/3188745.3188842. 55 [46] Kevin Matulef, Ryan O'Donnell, Ronitt Rubinfeld, and Rocco A. Servedio. Testing ±1- weight halfspace. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, 12th International Workshop, APPROX 2009, and 13th In- ternational Workshop, RANDOM 2009, Berkeley, CA, USA, August 21-23, 2009. Pro- ceedings, pages 646 -- 657, 2009. URL: https://doi.org/10.1007/978-3-642-03685-9_48, doi:10.1007/978-3-642-03685-9\_48. [47] Kevin Matulef, Ryan O'Donnell, Ronitt Rubinfeld, and Rocco A. Servedio. Testing halfspaces. SIAM J. Comput., 39(5):2004 -- 2047, 2010. URL: https://doi.org/10.1137/070707890, doi:10.1137/070707890. [48] Elchanan Mossel, Ryan O'Donnell, and Rocco A. Servedio. of k relevant variables. https://doi.org/10.1016/j.jcss.2004.04.002, doi:10.1016/j.jcss.2004.04.002. J. Comput. Syst. Sci., 69(3):421 -- 434, Learning functions URL: 2004. [49] Noam Nisan and Mario Szegedy. On the degree of boolean functions as real poly- nomials. In Proceedings of the 24th Annual ACM Symposium on Theory of Comput- ing, May 4-6, 1992, Victoria, British Columbia, Canada, pages 462 -- 467, 1992. URL: https://doi.org/10.1145/129712.129757, doi:10.1145/129712.129757. [50] Michal boolean SIAM J. Discrete Math., http://epubs.siam.org/sam-bin/dbq/article/40744. Parnas, formulae. Dana Ron, and Alex Samorodnitsky. Testing 16(1):20 -- 46, 2002. basic URL: [51] Ronald L. Rivest. Learning decision lists. Machine Learning, 2(3):229 -- 246, 1987. URL: https://doi.org/10.1007/BF00058680, doi:10.1007/BF00058680. [52] Dana Ron. Property testing: A learning theory perspective. Foundations and Trends in Machine Learning, 1(3):307 -- 402, 2008. URL: https://doi.org/10.1561/2200000004, doi:10.1561/2200000004. [53] Dana Ron. Algorithmic and analysis techniques dations and Trends https://doi.org/10.1561/0400000029, doi:10.1561/0400000029. in Theoretical Computer Science, in property testing. 2009. 5(2):73 -- 205, Foun- URL: [54] Ronitt Rubinfeld and Madhu Sudan. applications https://doi.org/10.1137/S0097539793255151, doi:10.1137/S0097539793255151. SIAM J. Comput., 25(2):252 -- 271, 1996. to program testing. Robust characterizations of polynomials with URL: [55] Mert Saglam. Near log-convexity of measured heat in (discrete) time and consequences. In 59th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2018, Paris, France, October 7-9, 2018, pages 967 -- 978, 2018. URL: https://doi.org/10.1109/FOCS.2018.00095, doi:10.1109/FOCS.2018.00095. [56] Leslie G. Valiant. A theory of the learnable. Commun. ACM, 27(11):1134 -- 1142, 1984. URL: https://doi.org/10.1145/1968.1972, doi:10.1145/1968.1972. 56 9 Appendix A In this Appendix, we give some bounds that are used in the paper Lemma 67. Markov's Bound. Let X ≥ 0 be a random variable with finite expected value µ = E[X]. Then for any real numbers κ, K > 0, E[X] Pr(X ≥ κ) ≤ κ Pr(X ≥ KE[X]) ≤ 1 K . . (4) (5) Lemma 68. Chebyshev's Bound. Let X be a random variable with finite expected value µ = E[X] and finite non-zero variance Var[X] = E[X 2] − E[X]2. Then for any real numbers κ, K > 0, Pr(X − µ ≥ κpVar[X]) ≤ Pr(X − µ ≥ K) ≤ 1 κ2 . Var[X] . K 2 (6) (7) Lemma 69. Chernoff 's Bound. Let X1, . . . , Xm are independent random variables taking values i=1 Xi denote their sum and let µ = E[X] denote the sum's expected value. in {0, 1}. Let X =Pm Then (8) (9) Pr[X > (1 + λ)µ] ≤(cid:18) eλ (1 + λ)(1+λ)(cid:19)µ ≤ e− λ2µ 2+λ ≤(e− λ2µ e− λµ 3 3 if 0 < λ ≤ 1 if λ > 1 . For 0 ≤ λ ≤ 1 we have Pr[X < (1 − λ)µ] ≤(cid:18) e−λ (1 − λ)(1−λ)(cid:19)µ ≤ e− λ2µ 2 . Lemma 70. Hoeffding's Bound. Let X1, . . . , Xm are independent random variables taking values i=1 Xi denote their sum and let µ = E[X] denote the sum's expected value. in {0, 1}. Let X =Pm Then for 0 ≤ λ ≤ 1 we have and Pr[X > µ + λm] ≤ e−2λ2m Pr[X < µ − λm] ≤ e−2λ2m (10) (11) 57
1507.01490
1
1507
2015-07-06T14:58:24
Fast and Simple Computation of Top-k Closeness Centralities
[ "cs.DS" ]
Closeness is an important centrality measure widely used in the analysis of real-world complex networks. In particular, the problem of selecting the k most central nodes with respect to this measure has been deeply analyzed in the last decade. However, even for not very large networks, this problem is computationally intractable in practice: indeed, Abboud et al have recently shown that its complexity is strictly related to the complexity of the All-Pairs Shortest Path (in short, APSP) problem, for which no subcubic "combinatorial" algorithm is known. In this paper, we propose a new algorithm for selecting the k most closeness central nodes in a graph. In practice, this algorithm significantly improves over the APSP approach, even though its worst-case time complexity is the same. For example, the algorithm is able to compute the top k nodes in few dozens of seconds even when applied to real-world networks with millions of nodes and edges. We will also experimentally prove that our algorithm drastically outperforms the most recently designed algorithm, proposed by Olsen et al. Finally, we apply the new algorithm to the computation of the most central actors in the IMDB collaboration network, where two actors are linked if they played together in a movie.
cs.DS
cs
Fast and Simple Computation of Top-k Closeness Centralities IMT Institute for Advanced Studies Lucca, Italy Michele Borassi Pierluigi Crescenzi Dipartimento di Ingegneria dell’Informazione, Università di Firenze Andrea Marino Dipartimento di Informatica, Università di Pisa 5 1 0 2 l u J 6 ] S D . s c [ 1 v 0 9 4 1 0 . 7 0 5 1 : v i X r a ABSTRACT Closeness is an important centrality measure widely used in the analysis of real-world complex networks. In particular, the problem of selecting the k most central nodes with re- spect to this measure has been deeply analyzed in the last decade. However, even for not very large networks, this problem is computationally intractable in practice: indeed, Abboud et al have recently shown that its complexity is strictly related to the complexity of the All-Pairs Shortest Path (in short, APSP) problem, for which no subcubic “com- binatorial” algorithm is known. In this paper, we propose a new algorithm for selecting the k most closeness central nodes in a graph. In practice, this algorithm significantly im- proves over the APSP approach, even though its worst-case time complexity is the same. For example, the algorithm is able to compute the top k nodes in few dozens of seconds even when applied to real-world networks with millions of nodes and edges. We will also experimentally prove that our algorithm drastically outperforms the most recently de- signed algorithm, proposed by Olsen et al. Finally, we apply the new algorithm to the computation of the most central actors in the IMDB collaboration network, where two actors are linked if they played together in a movie. Categories and Subject Descriptors G.2.2 [Discrete Mathematics]: Graph Theory—graph al- gorithms; H.2.8 [Database Management]: Database Ap- plications—data mining; I.1.2 [Computing Methodolo- gies]: Algorithms—analysis of algorithms General Terms Design, Algorithms, Performance INTRODUCTION 1. The problem of identifying the most central nodes in a net- work is a fundamental question that has been asked many times in a plethora of research areas, such as biology, com- puter science, sociology, and psychology. Because of the im- portance of this question, several centrality measures have been introduced in the literature (for a recent survey, see [3]). Closeness is certainly one of the oldest and of the most widely used among these measures [2]. Informally, the close- ness of a node v is the inverse of the expected distance be- tween v and a random node w, and it somehow estimates the efficiency of a node in spreading information to other nodes: the larger the closeness, the most “influential” the node is. Formally, given a (directed strongly) connected graph G = (V, E), the closeness of a vertex v is defined as c(v) = n−1 f (v) , where n = V , f (v) = Pw∈V d(v, w) is the farness of v, and d(v, w) is the distance between the two vertices v and w (that is, the number of edges in a shortest path from v to w). If G is not (strongly) connected, the definition is more complicated, because d(v, w) is defined only for vertices reachable from v. Let R(v) be the set of these vertices, and let r(v) denote its cardinality (note that v ∈ R(v) by definition). In the literature [15, 21, 17], the most common generalization is c(v) = r(v) − 1 r(v) − 1 f (v) n − 1 = (r(v) − 1)2 (n − 1)f (v) where f (v) = Pw∈R(v) d(v, w). In order to compute the k vertices with largest closeness, the textbook algorithm computes c(v) for each v and re- turns the k largest found values. The main bottleneck of this approach is the computation of d(v, w), for each pair of vertices v and w (that is, solving the All-Pairs Shortest Paths or APSP problem). This can be done in two ways: either by using fast matrix multiplication, in time O(n2.373) [22], or by performing a breadth-first search (in short, BFS) from each vertex v ∈ V , in time O(mn), where m = E. Usually, the BFS approach is preferred because the other approach contains big constants hidden in the O notation, and because real-world networks are usually sparse, that is, m is not much bigger than n. However, also this approach is too time-consuming if the input graph is very big (with millions of nodes and hundreds of millions of edges). Our algorithm heavily improves the BFS approach by “cutting the BFSes”, through an efficient pruning procedure, which allows us to either compute the closeness of a node v or stop the corresponding BFS as soon as we are sure that the close- ness of v is not among the k largest ones. The worst-case Name Graphs Degree functions Distance function Reachability set function Neighborhood functions Ball functions Farness functions Closeness functions Table 1: notations used throughout the paper. Symbol Definition G = (V, E) n G = (V, E ) deg(v) outdeg(v) d(v, w) R(v) r(v) α(v) ω(v) Γd(v) γd(v) γd+1(v) Nd(v) nd(v) f (v) fd(v) fd(v, x) c(v) cd(v) Graph with node/vertex set V and edge/arc set E V Weighted DAG of strongly connected components (see Section 1.3) Degree of a node in an undirected graph Out-degree of a node in a directed graph Number of edges in a shortest path from v to w Set of nodes reachable from v (by definition, v ∈ R(v)) R(v) Lower bound on r(v), that is, α(v) ≤ r(v) (see Section 2.4) Upper bound on r(v), that is, r(v) ≤ ω(v) (see Section 2.4) Set of nodes at distance d from v, that is, {w ∈ V : d(v, w) = d} Number of nodes at distance d from v, that is, Γd(v) Upper bound on γd+1(v), defined as Pu∈Γd(v) deg(u) if the graph is undirected, Pu∈Γd(v) outdeg(u) otherwise (clearly, γd+1(v) ≤ γd+1(v)) Set of nodes at distance at most d from v, that is, {w ∈ V : d(v, w) ≤ d} Number of nodes at distance at most d from v, that is, Nd(v) Farness of node v, that is, Pw∈R(v) d(v, w) Farness of node v up to distance d, that is, Pw∈Nd (v) d(v, w) Lower bound function on farness of node v, that is, fd(v) − γd+1(v) + (d + 2)(x − nd(v)) (see Lemma 1) Closeness of node v, tha is, (r(v)−1)2 Upper bound on closeness of node v, that is, lary 1) (see Corol- (n−1)f (v) (r(v)−1)2 (n−1) fd(v,r(v)) time complexity of this algorithm is the same as the one of the textbook algorithm: indeed, under reasonable complex- ity assumptions, this worst-case bound cannot be improved. In particular, it was proved in [1] that the complexity of finding the most central vertex is at least the complexity of the APSP: faster combinatorial algorithms for this latter problem would imply unexpected breakthrough in complex- ity theory [23]. However, in practice, our algorithm heavily improves the APSP approach, as shown by our experiments. Finally, we will apply our algorithm to an interesting and prototypical case study, that is, the IMDB actor collabora- tion network: in a little more than half an hour, we have been able to identify the evolution of the set of the 10 most central actors, by analysing snapshots of this network taken every 5 years, starting from 1940 and up to 2014. 1.1 Related Work Closeness is a “traditional” definition of centrality, and con- sequently it was not “designed with scalability in mind”, as stated in [12]. Also in [5], it is said that closeness central- ity can “identify influential nodes”, but it is “incapable to be applied in large-scale networks due to the computational complexity”. The simplest solution considered was to de- fine different measures, that might be related to closeness centrality [12]. A different line of research has tried to develop more efficient algorithms for this problem. As already said, due to theoret- ical bounds [4, 1], the worst-case complexity cannot be im- proved in general, unless widely believed conjectures prove to be false. Nevertheless, it is possible to design approxima- tion algorithms: the simplest approach samples the distance between a node v and l other nodes w, and return the aver- age of all values d(v, w) found [10]. The time-complexity is O(lm) to approximate the centrality of all nodes. More re- fined approximation algorithms are provided in [7, 6], based on the concept of All-Distance Sketch, that is, a procedure that computes the distances between v and O(log n) other nodes, chosen in order to provide good estimates of the close- ness centrality of v. Even if these approximation algorithms work quite well, they are not suited to the ranking of nodes, because the difference between the closeness centrality of two nodes might be very small. Nevertheless, they were used in [16], where the sampling technique developed in [10] was used to actually compute the top k vertices: the re- sult is not exact, but it is exact with high probability. The authors proved that the time-complexity of their algorithm 3 log n), under the rather strong assumption that is O(mn closeness centralities are uniformly distributed between 0 and D, where D is the maximum distance between two nodes (in the worst case, the time-complexity of this algorithm is O(mn)). 2 Other approaches have tried to develop incremental algo- rithms, that might be more suited to real-world networks analyses. For instance, in [14], the authors develop heuristics to determine the k most central vertices in a varying environ- ment. A different work addressed the problem of updating centralities after edge insertion or deletion [18]: for instance, it is shown that it is possible to update the closeness central- ity of 1.2 million authors in the DBLP-coauthorship network 460 times faster than recomputing it from scratch. Finally, some works have tried to exploit properties of real- world networks in order to find more efficient algorithms. In [13], the authors develop a heuristic to compute the k most central vertices according to different measures. The basic idea is to identify central nodes according to a sim- ple centrality measure (for instance, degree of nodes), and then to inspect a small set of central nodes according to this measure, hoping it will contain the top k vertices according to the “complex” measure. Another approach [17] tried to exploit the properties of real-world networks in order to de- velop exact algorithms with worst-case complexity O(mn), but performing much better in practice. As far as we know, this is the only exact algorithm that is able to efficiently compute the k most central vertices in networks with up to 1 million nodes. However, despite this huge amount of research, the ma- jor graph libraries still implement the textbook algorithm: among them, Boost Graph Library [11], Sagemath [9], igraph [20], and NetworkX [19]. This is due to the fact that the only efficient algorithm published until now for top k closeness centrality is [17], which was published only 1 year ago, and it is quite complicated, because it is based on several other algorithms. 1.2 Our Results As we said before, in this paper we present a new and very simple algorithm for the exact computation of top k close- ness central vertices. We show that we drastically improve both the probabilistic approach [16], and the best algorithm available until now [17]. We have computed for the first time the 10 most central nodes in networks with millions of nodes and hundreds of millions of edges, in very little time. A significant example is the IMDB actor network (1 797 446 nodes and 72 880 156 edges): we have computed the 10 most central actors in less than 10 minutes. Moreover, in our DBLP co-authorship network (which should be quite sim- ilar to the network used in [18]), our performance is more than 6 000 times better than the performance of the text- book algorithm: if only the most central node is needed, we can recompute it from scratch more than 10 times faster than performing their update. Finally, our approach is not only very efficient, but it is also very easy to code, making it a very good candidate to be implemented in existing graph libraries. In addition to these definitions, 1.3 Preliminary Definitions We assume the reader to be familiar with the basic notions of graph theory (see, for example, [8]): all the notations and definitions used throughout this paper are summarised in Table 1. let us pre- cisely define the weighted directed acyclic graph G = (V, E ) of strongly connected components (in short, SCCs) corre- sponding to a directed graph G = (V, E). In this graph, V is the set of SCCs of G, and, for any two SCCs C, D ∈ V, (C, D) ∈ E if and only if there is an arc in E from a node in C to the a node in D. For each SCC C ∈ V, the weight w(C) of C is equal to C, that is, the number of nodes in the SCC C. Note that, for each node v ∈ C, r(v) = PD∈R(C) w(D), where R(C) denotes the set of SCCs that are reachable from C in G, and r(C) denotes its cardinality. 1.4 Structure of the Paper In Section 2, we will explain how our algorithm works, and we will prove its correctness. Section 3 will experimentally prove that our algorithm outperforms the best available al- gorithms, by performing several tests on a dataset of real- world networks. Section 4 applies the new algorithm to the analysis of the 10 most central actors in the IMDB actor network. 2. THE ALGORITHM 2.1 Overview As we already said, the textbook algorithm for comput- ing the k vertices with largest closeness performs a BFS from each vertex v, computes its closeness c(v), and, finally, returns the k vertices with biggest c(v) values. Similarly, our algorithm (see Algorithm 1) sets c(v) = BFSCut(v, xk), where xk is the k-th biggest closeness value found until now (xk = 0 if we have not processed at least k vertices). If BFSCut(v, xk) = 0, it means that v is not one of k most cen- tral vertices, otherwise c(v) is the actual closeness of v. This means that, at the end, the k vertices with biggest closeness values are again the k most central vertices. In order to speed-up the function BFSCut(v, xk), we want xk to be as big as possible, and consequently we need to process central vertices as soon as possible. To this purpose, following the idea of [14], we process vertices in decreasing order of degree. Algorithm 1: overview of the new algorithm. The function Kth(c) returns the k-th biggest element of c and the function TopK(c) returns the k biggest elements. 1 PreProcessing (G); // see Section 2.4 2 c(v) ← 0 for each v; 3 xk ← 0; 4 for v ∈ V in decreasing order of degree do 5 6 7 c(v) ← BFSCut (v, xk); if c(v) 6= 0 then xk ← Kth(c); 8 return TopK(c); As we will see in the next sections, Algorithm 1 needs linear time in order to execute the preprocessing. Moreover, it requires time O(n log n) to sort vertices, O(log k) to perform function Kth, and O(1) to perform function TopK, by using a priority queue containing at each step the k most central vertices. Since all other operations need time O(1), the total running time is O(m+n log n+n log k+T ) = O(m+n log n+ T )), where T is the time needed to perform the function BFSCut n times. Before explaining in details how the function BFSCut op- erates, let us note that we can easily parallelise the for loop in Algorithm 1, by giving each vertex to a different thread. The parallelisation is almost complete, because the only “non-parallel” part deals with the shared variable xk, which must be updated in a synchronised way. In any case, this shared variable does not affect performances. First of all, the time needed for the update is very small, compared to the time of BFSes. Moreover, in principle, a thread might use an “old” value of xk, and consequently lose performance: we will experimentally show that the effect of this positive race condition is negligible (Section 3.2). 2.2 An Upper Bound on the Closeness of Lemma 2. For each vertex v and for each d ≥ 0, Nodes The goal of this section is to define an upper bound cv() on the closeness of a node v, which has to be updated whenever, for any d ≥ 0, all nodes in Γd(v) has been reached by the BFS starting from v (that is, whenever the exploration of the d-th level of the BFS tree is finished). More precisely, this upper bound is obtained by first proving a lower bound on the farness of v, as shown in the following lemma. Lemma 1. For each vertex v and for each d ≥ 0, f (v) ≥ fd(v, r(v)) (see Table 1 for the definition of fd(v, r(v))). Proof. From the definitions of Table 1, it follows that f (v) ≥ fd(v) + (d + 1)γd+1(v) + (d + 2)(r(v) − nd+1(v)). Since nd+1(v) = γd+1(v) + nd(v), f (v) ≥ fd(v) − γd+1(v) + (d + 2)(r(v) − nd(v)). Finally, since γd+1(v) is an upper bound on γd+1(v), f (v) ≥ fd(v) − γd+1(v) + (d + 2)(r(v) − nd(v)) = fd(v, r(v)) 1 c(v) ≥ λd(v) := (n − 1) min(cid:18) fd(v, α(v)) (α(v) − 1)2 , fd(v, ω(v)) (ω(v) − 1)2(cid:19) . Proof. From Lemma 1, if we denote a = d + 2 and b = γd+1(v) + a(nd(v) − 1) − fd(v), f (v) ≥ fd(v) − γd+1(v) + a(r(v) − nd(v)) = a(r(v) − 1) + fd(v) − γd+1(v) − a(nd(v) − 1) = a(r(v) − 1) − b. Note that a > 0 because d > 0, and b > 0 because fd(v) = Xw∈Nd(v) d(v, w) ≤ d(nd(v) − 1) < a(nd(v) − 1) ≥ (n − 1) a(r(v)−1)−b x3 x2 . The derivative g′(x) = −ax+2b if w = v, then where the first inequality holds because, d(v, w) = 0, and if w ∈ Nd(v), then d(v, w) ≤ d. Hence, 1 (r(v)−1)2 . Let us consider the function cv g(x) = ax−b is positive for 0 < x < 2b a : this means that 2b a is a local maximum, and there are no local minima for x > 0. Consequently, in each closed interval [x1, x2] where x1 and x2 are positive, the minimum of g(x) is reached in x1 or x2. Since 0 < α(v) − 1 ≤ r(v) − 1 ≤ ω(v) − 1, a and negative for x > 2b g(r(v) − 1) ≥ min(g(α(v) − 1), g(ω(v) − 1)) and the lemma follows. and the conclusion follows. Corollary 1. For each vertex v and for each d ≥ 0, c(v) ≤ cd(v), where cd(v) is defined in Table 1. 2.3 Computing the Upper Bound Apart from r(v), all quantities necessary to compute fd(v, r(v)) (and, hence, to compute the upper bound of Lemma 1) are available as soon as all vertices in Nd(v) are visited by a BFS. Note that, if the graph G is (strongly) connected, then r(v) = n is also available. Moreover, if the graph G is undirected (but not necessarily connected), we can compute r(v) for each vertex v in linear time, at the beginning of the algorithm (by simply computing the con- nected components of G).1 It thus remain to deal with the case in which G is directed and not strongly connected. In this case, let us assume, for now, that we know a lower (respectively, upper) bound α(v) (respectively, ω(v)) on r(v) (see also Table 1): without loss of generality we can assume that α(v) > 1. The next lemma shows that, instead of ex- amining all possible values of r(v) between α(v) and ω(v), it is sufficient to examine only the two extremes of this inter- val. In order to apply this idea, however, we have to work 1 with the inverse c(v) of the closeness of v, because otherwise the denominator might vanish or even be negative (due to the fact that we are both upper bounding γd+1(v) and lower bounding r(v)). In other words, the lemma will provide us a lower bound λd(v) on 1 c(v) (so that, if λd(v) is negative, then λd(v) ≤ 1 1Note that if G is undirected, Lemma 1 still holds if we rede- c(v) trivially holds). fine, for any d ≥ 1, γd+1(v) = Pu∈Γd(v)(deg(u)−1), because at least one edge from each vertex u in Γd(v) connects u to a node in Γd−1(v). 2.4 Computing α(v) and ω(v) It now remains to compute α(v) and β(v) (in the case of a directed graph which is not strongly connected). This can be done during the preprocessing phase of our algo- rithm as follows. Let G = (V, E ) be the weighted directed acyclic graph of SCCs, as defined in Section 1.3. We al- ready observed that, if v and w are in the same SCC, then of SCCs that are reachable from C in G. This means that we simply need to compute a lower (respectively, upper) r(v) = r(w) = PD∈R(C) w(D), where R(C) denotes the set bound α(C) (respectively, ω(C)) on PD∈R(C) w(D), for ev- ery SCC C. To this aim, we first compute a topological sort {C1, . . . , Cl} of V (that is, if (Ci, Cj) ∈ E , then i < j). Suc- cessively, we use a dynamic programming approach, and, by starting from Cl, we process the SCCs in reverse topological order, and we set and α(C) = w(C) + max (C,D)∈E α(D) ω(C) = w(C) + X(C,D)∈E ω(D). Note that processing the SCCs in reverse topological order- ing ensures that the values α(D) and ω(D) on the right hand side of these equalities are available when we process the SCC C. Clearly, the complexity of computing α(C) and ω(C), for each SCC C, is linear in the size of G, which in turn is smaller than G. Observe that the bounds obtained through this simple ap- proach can be improved by using some “tricks”. First of all, when the biggest SCC C is processed, we do not use the dy- namic programming approach and we can exactly compute PD∈R( C) w(D) by simply performing a BFS starting from any node in C. This way, not only α( C) and ω( C) are exact, but also α(C) and ω(C) are improved for each SCC C from which it is possible to reach C. Finally, in order to compute the upper bounds for the SCCs that are able to reach C, we can run the dynamic programming algorithm on the graph obtained from G by removing all components reachable from C, and we can then add PD∈R( C) w(D). 2.5 The BFSCut Function We are now ready to define the function BFSCut(v, x), which returns the closeness c(v) of vertex v if c(v) > x, 0 otherwise. To do so, this function performs a BFS starting from v, and during the BFS it updates the upper bound cd(v) ≥ c(v) (the update is done whenever all nodes in Γd(v) has been reached): as soon as cd(v) ≤ x, we know that c(v) ≤ cd(v) ≤ x, and we return 0. If this situation never occurs, at the end of the visit we have clearly computed c(v). Algorithm 2 is the pseudo-code of the function BFSCut when implemented for strongly connected graphs (recall that, in this case, r(v) = n): this code can be easily adapted to the case of undirected graphs (see the beginning of Section 2.3) and to the case of directed (not necessarily strongly con- nected) graphs (see Lemma 2). Algorithm 2: the BFSCut(v, x) function in the case of strongly connected directed graphs. 1 Create queue Q; 2 Q.enqueue(v); 3 Mark v as visited; 4 d ← 0; f ← 0; γ ← 0; nd ← 0; 5 while Q is not empty do 6 7 8 9 10 11 12 13 14 15 16 17 18 19 u ← Q.dequeue(); if d(v, u) > d then f ← f − γ + (d + 2)(n − nd); c ← (n−1) if c ≤ x then return 0; f ; d ← d + 1; f ← f + d(v, u); γ ← γ + outdeg(u); nd ← nd + 1; for w in adjacency list of u do if w is not visited then Q.enqueue(w); Mark w as visited; 20 return n−1 f ; section, we will real-world networks, 3. EXPERIMENTAL RESULTS test our algorithm on sev- In this to show its per- in order eral exper- formances. SNAP iments were (nexus.igraph.org), (snap.stanford.edu/), LAW LASAGNE (law.di.unimi.it), and IMDB (www.imdb.com). Our tests have been performed on a server running an Intel(R) the networks used in our datasets (piluc.dsi.unifi.it/lasagne), from the collected All NEXUS Xeon(R) CPU E5-4607 0, 2.20GHz, with 48 cores, 250GB RAM, running Ubuntu 14.04 2 LTS; our code has been writ- ten in Java 1.7, and it is available at tinyurl.com/kelujv7. 3.1 Comparison with the State of the Art In order to compare the performance of our algorithm with state of the art approaches, we have selected 21 networks whose number of nodes ranges between 1 000 and 30 000 nodes. We have compared our algorithm Bcm with our implemen- tations of the best available algorithms for top-k closeness centrality.2 The first one [17] is based on a pruning technique and on ∆-BFS, a method to reuse information collected dur- ing a BFS from a node to speed up a BFS from one of its in-neighbors; we will denote this algorithm as Olh. The second one provides top-k closeness centralities with high probability [16]. It is based on performing BFSes from a random sample of nodes to estimate the closeness central- ity of all the other nodes, then computing the exact cen- trality of all the nodes whose estimate is big enough. Note that this algorithm requires the input graph to be (strongly) connected: for this reason, differently from the other algo- rithms, we have run this algorithm on the largest (strongly) connected component. We will denote this latter algorithm as Ocl. In order to perform a fair comparison we have considered the improvement factor mvis , where mvis is the number of mtot arcs visited during the algorithm and mtot is the number of arcs visited by the textbook algorithm, which is based on all- pair shortest-path. It is worth observing that mtot is m · n if the graph is (strongly) connected, but it might be smaller in general. The improvement factor does not consider the pre- processing time, which is negligible, and it is closely related to the running-time, since all the three algorithms are based on performing BFSes. Furthermore, it does not depend on the implementation and on the machine used for the algo- rithm. In the particular case of Olh, we have just counted the arcs visited in BFS and ∆-BFS, without considering all the operations done in the pruning phases (see [17]). Our results are summarized in Table 2, where we report the arithmetic mean and the geometric mean of all the improve- ment factors (among all the graphs). In our opinion, the geometric mean is more significant, because the arithmetic mean is highly influenced by the maximum value. Table 2: comparison of the improvement factors of the new algorithm (Bcm), of the algorithm in [17] (Olh), and the algorithm in [16] (Ocl). Values are computed for k = 1 and k = 10, and they are averaged over all graphs in the dataset. Arithmetic Mean Geometric Mean k Alg Bcm 1 Olh Ocl Bcm 10 Olh Ocl Dir Both Undir Undir Both Dir 4.5% 2.8% 3.46% 1.3% 0.8% 0.9% 31.6% 35.6% 15.8% 21.5% 43.5% 24.2% 55.6% 67.3% 42.8% 50.8% 72.3% 45.4% 8.6% 6.3% 2.7% 3.8% 14.1% 5.3% 31.6% 35.6% 15.8% 21.6% 43.6% 24.2% 80.7% 59.3% 67.5% 78.4% 57.9% 65.0% 2Note that the source code of our competitors is not avail- able. Table 3: detailed comparison of the improvement factor of the three algorithms with respect to the all-pair-shortest-path algorithm, with k = 1 and k = 10. Directed Networks Network polblogs p2p-Gnutella08 wiki-Vote p2p-Gnutella09 p2p-Gnutella06 freeassoc p2p-Gnutella04 as-caida20071105 Network Homo HC-BIOGRID Mus musculus Caenorhabditis elegans ca-GrQc advogato hprd pp ca-HepTh Drosophila melanogaster oregon1 010526 oregon2 010526 GoogleNw dip20090126 MAX Nodes 1224 6301 7115 8114 8717 10617 10876 26475 Nodes 1027 4039 4610 4723 5242 7418 9465 9877 10625 11174 11461 15763 19928 Edges 19022 20777 103689 26013 31525 72172 39994 106762 Edges 1166 10321 5747 9842 14484 42892 37039 25973 40781 23409 32730 148585 41202 k = 10 k = 1 Olh Ocl Olh Bcm Bcm 3.052% 41.131% 88.323% 8.491% 41.321% 91.992% 4.592% 53.535% 87.229% 23.646% 53.626% 92.350% 0.068% 25.205% 40.069% 0.825% 25.226% 62.262% 7.458% 55.754% 86.867% 18.649% 55.940% 90.248% 0.808% 52.615% 77.768% 18.432% 52.831% 88.884% 17.315% 58.204% 85.831% 20.640% 57.954% 87.300% 2.575% 56.788% 84.128% 21.754% 56.813% 89.961% 0.036% 4.740% 42.955% 4.740% 27.985% 0.100% Ocl Undirected Networks k = 1 Olh k = 10 Ocl Ocl Olh Bcm Bcm 5.259% 82.794% 82.956% 14.121% 82.794% 88.076% 8.928% 19.112% 72.070% 5.914% 19.112% 65.672% 7.535% 66.507% 5.135% 7.535% 55.004% 1.352% 1.161% 9.489% 45.623% 1.749% 9.489% 58.521% 5.115% 13.815% 62.523% 3.472% 13.815% 55.099% 0.891% 82.757% 61.688% 0.427% 82.757% 41.364% 2.079% 15.827% 54.300% 0.219% 15.827% 44.084% 3.630% 15.474% 52.196% 2.796% 15.474% 46.257% 1.991% 18.347% 46.847% 1.454% 18.347% 40.513% 0.058% 4.937% 28.221% 0.233% 4.937% 49.966% 5.848% 40.102% 0.269% 5.848% 23.780% 0.090% 0.007% 7.377% 33.501% 4.438% 7.377% 75.516% 14.610% 31.627% 27.727% 20.097% 31.673% 42.901% More detailed results are available in Table 3. In the case k = 1 (respectively, k = 10), the geometric mean of the improvement factor of Bcm is 23 (resp. 6) times smaller than Olh and 54 times smaller than Ocl (resp. 17). Moreover we highlight that the new algorithm outperforms all the competitors in each single graph, both with k = 1 and with k = 10. We have also tested our algorithm on the three unweighted graphs analyzed in [17], respectively called Web, Wiki, and DBLP. By using a single thread implementation of Bcm, in the Web graph (resp. DBLP) we computed the top-10 nodes in 10 minutes (resp. 10 minutes) on the whole graph, having 875 713 nodes (resp. 1 305 444), while Olh needed about 25 minutes (resp. 4 hours) for a subgraph of 400 000 nodes. The most striking result deals with Wiki, where Bcm needed 30 seconds for the whole graph having 2 394 385 nodes instead of about 15 minutes on a subgraph with 1 million nodes. Using multiple threads our performances are even better, as we will show in Section 3.3. 3.2 Real-World Large Networks In this section, we will run our algorithm on a bigger dataset, composed by 25 directed and 15 undirected networks, with up to 7 414 768 nodes and 191 606 827 edges. Once again, we will consider the number of visited arcs by Bcm, i.e. mvis, but this time we will analyze the performance ratio mvis mn instead of the improvement factor. Indeed, due to the large size of these networks, the textbook algorithm did not finish in a reasonable time. It is worth observing that we have been able to compute for the first time the k most central nodes of networks with millions of nodes and hundreds of millions of arcs, with k = 1 and k = 10. The detailed results are shown in Table 5, where for each network we have reported the performance ratio, Table 4: the arithmetic and geometric mean of the perfor- mance ratios (percentage). Arithmetic Mean Geometric Mean k 1 10 Dir Undir Both 2.89% 1.14% 2.24% 0.36% 0.12% 0.24% 3.82% 1.83% 3.07% 0.89% 0.84% 0.87% Undir Both Dir both for k = 1 and k = 10. A summary of these results is provided by Table 4, providing the arithmetic and geometric means. First of all, we note that the values obtained are impres- sive: the geometric mean is always below 1%, and for k = 1 it is even smaller. The arithmetic mean is slightly bigger, mainly because of amazon product-co-purchasing networks, two web networks and one collaboration network, where the performance ratio is quite high. Most of the other networks have a very low performance ratio: with k = 1, 65% of the networks are below 1%, and 32.5% of the networks are be- low 0.1%. With k = 10, 52.5% of the networks are below 1% and 12.5% are below 0.1%. We also outline that in some cases the performance ratio is even smaller: a striking example is com-Orkut, where our algorithm for k = 1 is more than 40 000 times faster than the textbook algorithm, whose performance is m · n, because the graph is connected. 3.3 Multi-Thread Experiments In this section, we will test the performance of a parallel version of Bcm (see Section 2.1). In particular, we have considered the ratio between the time needed to compute the most central node with one thread and with x threads, where x ∈ {1, 2, 4, 8, 16}. This ratio is plotted in Figure 1 for k = 1 (for k = 10 very similar results hold). Ideally, the ratio should be very close to the number of threads; however, due Table 5: performance ratio of the new algorithm. Directed Networks Performance Ratio (%) Network cit-HepTh cit-HepPh p2p-Gnutella31 soc-Epinions1 soc-sign-Slashdot081106 soc-Slashdot0811 twitter-combined soc-sign-Slashdot090216 soc-sign-Slashdot090221 soc-Slashdot0902 gplus-combined amazon0302 email-EuAll web-Stanford web-NotreDame amazon0312 amazon0601 amazon0505 web-BerkStan web-Google in-2004 soc-pokec-relationships wiki-Talk indochina-2004 Nodes 27770 34546 62586 75879 77350 77360 81306 81867 82140 82168 107614 262111 265214 281903 325729 400727 403394 410236 685230 875713 1382870 1632803 2394385 7414768 Edges 352768 421534 147892 508837 516575 828161 1768135 545671 549202 870161 13673453 1234877 418956 2312497 1469679 3200440 3387388 3356824 7600595 5105039 16539643 30622564 5021410 191606827 k = 1 2.31996 1.21083 0.73753 0.16844 0.59535 0.01627 0.76594 0.5375 0.54833 0.01662 0.36511 10.16028 0.00192 6.55454 0.04592 8.17931 7.80459 7.81823 21.0286 0.13662 1.81649 0.00411 0.00029 1.341 k = 10 4.65612 1.64227 2.51074 1.92346 0.65012 0.48842 1.03332 0.58774 0.5995 0.76048 0.3896 11.90729 0.00764 10.67736 0.62945 9.40879 9.33853 9.11571 23.70427 0.23239 2.51671 0.02257 0.00247 2.662 Undirected Networks Performance Ratio (%) Network ca-HepPh ca-AstroPh ca-CondMat dblp-conf2015-net-bigcomp email-Enron loc-gowalla-edges com-dblp.ungraph com-amazon.ungraph com-youtube.ungraph dblp22015-net-bigcomp as-skitter com-orkut.ungraph Nodes 12008 18772 23133 31951 36692 196591 317080 334863 1134890 1305444 1696415 3072441 Edges 118489 198050 93439 95084 183831 950327 1049866 925872 2987624 6108712 11095298 117185083 k = 1 9.41901 1.35832 0.23165 2.46188 0.10452 0.00342 0.20647 2.55046 0.04487 0.01618 0.54523 0.00241 k = 10 9.57862 3.2326 1.07725 3.42476 0.28912 3.04066 0.312 3.08037 0.60811 0.0542 0.61078 0.38956 to memory access, the actual ratio is smaller. For graphs where the performance ratio is small, like in the case of wiki-Talk (see Table 5 in the appendix), the running time is mostly consumed by the preprocessing phase (even if it is O(n log n)); in these cases, we observe that there seems to be no room for parallelization improvements. On the other hand, when the computation is more time consuming, like in the case of web-google or as-skitter, the parallelization is very efficient and close to the optimum. We have also tested if the positive race condition in the update of xk affects performances (see Section 2.1), by con- sidering the performance ratio with a varying number of threads. In Table 6, we report how much the performance ratio increases if the algorithm is run with 16 threads in- stead of 1 (more formally, if pi is the performance ratio with i threads, we report p16−p1 ). For instance, a value of 100% means that the number of visited arcs has doubled: ideally, this should result in a factor 8 speedup, instead of a factor 16 (that is, the number of threads). We observe that these values are very small, especially for k = 10, where all values except one are below 5%. This means that, ideally, instead of a factor 16 improvement, we obtain a factor 15.24. The only case where this is not verified is wiki-Talk, where in any case the performance ratio is very small (see Table 5). p1 Table 6: the increase in performance ratio from 1 to 16 threads. Network MathSciNet com-dblp ydata-v1-0 wiki-Talk web-Google com-youtube dblp22015 as-skitter in-2004 soc-pokec-relationships imdb k = 1 3.88% 1.32% 1.40% k = 10 0.18% 0.74% 0.24% 192.84% 49.40% 0.95% 0.10% 0.47% 0.18% 0.10% 4.51% 4.03% 1.70% 1.91% 2.54% 0.14% 0.09% 17.71% 5.61% IMDB CASE STUDY 4. In this section, we will apply the new algorithm Bcm to analyze the IMDB graph, where nodes are actors, and two actors are connected if they played together in a movie (TV-series are ignored). The data collected come from the website http://www.imdb.com: in line with http://oracleofbacon.org, we decided to exclude some genres from our database: awards-shows, documentaries, game-shows, news, realities and talk-shows. We analyzed t n e m e v o r p m i e c n a m r o f r e P t n e m e v o r p m i e c n a m r o f r e P 15 10 5 0 15 10 5 0 0 0 web-google in-2004 soc-pokec-relationships wiki-Talk 10 5 Number of threads (a) Directed networks. 15 com-dblp MathSciNet ydata-v1_0 imdb com-youtube dblp22015 as-skitter 10 5 Number of threads (b) Undirected networks. 15 Figure 1: the benefits of parallelization. snapshots of the actor graph, taken every 5 years from 1940 to 2010, and 2014. The total time needed to perform the computation was 37 minutes with 30 threads, and the re- sults are reported in Table 7. The Algorithm. The results outline that the performance ratio decreased drastically while the graph size increased: this suggests that the performances of our algorithm increase with the input size. This is even more visible from Figure 2, where we have plotted the inverse of the performance ratio with respect to the number of nodes. It is clear that the plot is very close to a line, especially if we exclude the last two values. This means that the performance ratio is close to 1 cn , where c is the slope of the line in the plot, and the total running time is well approximated by 1 cn O(mn) = O(m). This means that, in practice, for the IMDB actor graph, our algorithm is linear in the input size. ·104 8 6 4 2 0 o i t a r e c n a m r o f r e p f o e s r e v n I 0 0.5 1 1.5 Millions of nodes Figure 2: growth of performance ratio with respect to the number of nodes. The Results. In 2014, the most central actor is Michael Madsen, whose career spans 25 years and more than 170 films. Among his most famous appearances, he played as Jimmy Lennox in Thelma & Louise (Ridley Scott, 1991), as Glen Greenwood in Free Willy (Simon Wincer, 1993), as Bob in Sin City (Frank Miller, Robert Rodriguez, Quentin Tarantino), and as Deadly Viper Budd in Kill Bill (Quentin Tarantino, 2003-2004). It is worth noting that he played in movies of very different kinds, and consequently he could “reach” many actors in a small amount of steps. The sec- ond is Danny Trejo, whose most famous movies are Heat (Michael Mann, 1995), where he played as Trejo, Machete (Ethan Maniquis, Robert Rodriguez, 2010) and Machete Kills (Robert Rodriguez, 2013), where he played as Mathete. The third “actor” is not really an actor: he is the German dictator Adolf Hitler: he was also the most central actor in 2005 and 2010, and he was in the top-10 since 1990. This a consequence of his appearances in several archive footages, that were re-used in several movies (he counts 775 credits, even if most of them are in documentaries or TV-shows, that were eliminated). Among the movies he is credited in, we find Zelig (Woody Allen, 1983), and The Imitation Game (Morten Tyldum, 2014): obviously, in both movies, he played himself. Among the other most central actors, we find many people who played a lot of movies, and most of them are quite im- portant actors. However, this ranking does not discriminate between important roles and marginal roles: for instance, the actress Bess Flowers is not widely known, because she rarely played significant roles, but she appeared in over 700 movies in her 41 years career, and for this reason she was the most central for 30 years, between 1950 and 1980. Fi- nally, it is worth noting that we never find Kevin Bacon in the top 10, even if he became famous for the “Six Degrees of Kevin Bacon” game http://oracleofbacon.org, where the player receives an actor x, and he has to find a path of length at most 6 from x to Kevin Bacon in the actor graph. Kevin Bacon was chosen as the goal because he played in several movies, and he was thought to be one of the most central actors: this work shows that, actually, he is quite [15] Nan Lin. Foundations of social research. McGraw-Hill, 1976. [16] Kazuya Okamoto, Wei Chen, and XY Li. Ranking of closeness centrality for large-scale social networks. Frontiers in Algorithmics, 5059:186–195, 2008. [17] Paul W. Olsen, Alan G. Labouseur, and Jeong-Hyon Hwang. Efficient top-k closeness centrality search. Proceedings of the IEEE 30th International Conference on Data Engineering (ICDE), pages 196–207, 2014. [18] Ahmet E. Sar A´syuce, Kamer Kaya, Erik Saule, and Umit V. Catalyurek. Incremental algorithms for closeness centrality. In IEEE International Conference on BigData, pages 118–122, 2013. [19] Jeremy G. Siek, Lie Quan Lee, and Andrew Lumsdaine. Boost Graph Library: User Guide and Reference Manual, The. Pearson Education, 2001. [20] William Stein and David Joyner. Sage: System for algebra and geometry experimentation. SIGSAM Bulletin, 39(2):61–64, 2005. [21] Stanley Wasserman and Katherine Faust. Social Network Analysis: Methods and Applications. Structural Analysis in the Social Sciences. Cambridge University Press, 1994. [22] Virginia V. Williams. Multiplying Matrices Faster Than Coppersmith-Winograd. In Proceedings of the Forty-fourth Annual ACM Symposium on Theory of Computing, STOC ’12, pages 887–898, New York, NY, USA, 2012. ACM. [23] Virginia V. Williams and Ryan Williams. Subcubic Equivalences between Path, Matrix and Triangle Problems. pages 645–654. Ieee, October 2010. far from being in the top 10. Indeed, his closeness central- ity is 0.336, while the most central actor, Michael Madsen, has centrality 0.354, and the 10th actor, Christopher Lee, has centrality 0.350. We have run again the algorithm with k = 100, and we have seen that the 100th actor is Rip Torn, with closeness centrality 0.341. 5. REFERENCES [1] Amir Abboud, Fabrizio Grandoni, and Virginia V. Williams. Subcubic equivalences between graph centrality problems, APSP and diameter. pages 1681–1697, 2015. [2] Alez Bavelas. Communication patterns in task-oriented groups. Journal of the Acoustical Society of America, 22:725, 1950. [3] Paolo Boldi and Sebastiano Vigna. Axioms for Centrality. Internet Mathematics, 10(3-4):222–262, 2014. [4] Michele Borassi, Pierluigi Crescenzi, and Michel Habib. Into the Square On the Complexity of Quadratic-Time Solvable Problems. arXiv:1407.4972, 2014. [5] Duanbing Chen, Linyuan Lu, Ming-Sheng Shang, Yi-Cheng Zhang, and Tao Zhou. Identifying influential nodes in complex networks. Physica A: Statistical Mechanics and its Applications, 391(4):1777–1787, February 2012. [6] Edith Cohen. All-distances sketches, revisited: HIP estimators for massive graphs analysis. In Proceedings of the 33rd ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, pages 88–99. ACM, 2014. [7] Edith Cohen, Daniel Delling, Thomas Pajor, and RF Werneck. Computing classic closeness centrality, at scale. In Proceedings of the second ACM conference on Online social networks, pages 1–13. ACM, 2014. [8] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms (3rd edition). MIT Press, 2009. [9] G´abor Cs´ardi and Tam´as Nepusz. The igraph software package for complex network research. InterJournal, Complex Systems, 2006. [10] David Eppstein and Joseph Wang. Fast Approximation of Centrality. J. Graph Algorithms Appl., pages 1–2, 2004. [11] Aric A. Hagberg, Daniel A. Schult, and Pieter J. Swart. Exploring network structure, dynamics, and function using NetworkX. In Proceedings of the 7th Python in Science Conference (SciPy), number SciPy, pages 11–15, 2008. [12] U Kang, Spiros Papadimitriou, Jimeng Sun, and Tong Hanghang. Centralities in large networks: Algorithms and observations. In SDM, pages 119–130, 2011. [13] Erwan Le Merrer, Nicolas Le Scouarnec, and Gilles Tr´edan. Heuristical Top-k: Fast Estimation of Centralities in Complex Networks. Information Processing Letters, 114:432–436, 2014. [14] Yeon-sup Lim, Daniel S. Menasch´e, Bruno Ribeiro, Don Towsley, and Prithwish Basu. Online estimating the k central nodes of a network. In Proceedings of the 2011 IEEE Network Science Workshop, number January 1993, pages 118–122, 2011. Year Nodes Edges Perf. ratio 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Year Nodes Edges Perf. ratio 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Year Nodes Edges Perf. ratio 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Year Nodes Edges Perf. ratio 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th Table 7: detailed results of the IMDB actor graph. 1940 69 011 3 417 144 5.62% Semels, Harry (I) Corrado, Gino Steers, Larry Bracey, Sidney Lucas, Wilfred White, Leo (I) Martell, Alphonse Conti, Albert (I) Flowers, Bess Sedan, Rolfe 1960 146 253 11 197 509 2.21% Flowers, Bess Harris, Sam (II) Farnum, Franklyn Miller, Harold (I) Chefe, Jack Holmes, Stuart Steers, Larry Par`ıs, Manuel 1945 83 068 5 160 584 4.43% Corrado, Gino Steers, Larry Flowers, Bess Semels, Harry (I) White, Leo (I) Mortimer, Edmund Boteler, Wade Phelps, Lee (I) Ring, Cyril Bracey, Sidney 1965 174 826 12 649 114 1.60% Flowers, Bess Harris, Sam (II) Farnum, Franklyn Miller, Harold (I) Holmes, Stuart Sayre, Jeffrey Chefe, Jack Par`ıs, Manuel O’Brien, William H. O’Brien, William H. Sayre, Jeffrey Stevens, Bert (I) 1950 97 824 6 793 184 4.03% Flowers, Bess Steers, Larry Corrado, Gino Harris, Sam (II) Semels, Harry (I) Davis, George (I) Magrill, George Phelps, Lee (I) Ring, Cyril Moorhouse, Bert 1970 210 527 14 209 908 1.14% 1955 120 430 8 674 159 2.91% Flowers, Bess Harris, Sam (II) Steers, Larry Corrado, Gino Miller, Harold (I) Farnum, Franklyn Magrill, George Conaty, James Davis, George (I) Cording, Harry 1975 257 896 16 080 065 0.83% Flowers, Bess Harris, Sam (II) Tamiroff, Akim Farnum, Franklyn Miller, Harold (I) Sayre, Jeffrey Quinn, Anthony (I) O’Brien, William H. Holmes, Stuart Stevens, Bert (I) Flowers, Bess Harris, Sam (II) Tamiroff, Akim Welles, Orson Sayre, Jeffrey Miller, Harold (I) Farnum, Franklyn Kemp, Kenner G. Quinn, Anthony (I) O’Brien, William H. 1980 310 278 18 252 462 0.62% Flowers, Bess Harris, Sam (II) Welles, Orson Sayre, Jeffrey Quinn, Anthony (I) Tamiroff, Akim Miller, Harold (I) Kemp, Kenner G. Farnum, Franklyn Niven, David (I) 2000 681 358 33 564 142 0.22% Lee, Christopher (I) Hitler, Adolf Pleasence, Donald 1985 375 322 20 970 510 0.45% Welles, Orson Flowers, Bess Harris, Sam (II) 1990 463 078 24 573 288 0.34% Welles, Orson Carradine, John Flowers, Bess Quinn, Anthony (I) Lee, Christopher (I) Sayre, Jeffrey Carradine, John Kemp, Kenner G. Miller, Harold (I) Niven, David (I) Tamiroff, Akim Harris, Sam (II) Quinn, Anthony (I) Pleasence, Donald Sayre, Jeffrey Tovey, Arthur Hitler, Adolf 1995 557 373 28 542 684 0.26% Lee, Christopher (I) Welles, Orson Quinn, Anthony (I) Pleasence, Donald Hitler, Adolf Carradine, John Flowers, Bess Mitchum, Robert Harris, Sam (II) Sayre, Jeffrey 2005 880 032 41 079 259 0.18% 2010 1 237 879 53 625 608 0.19% 2014 1 797 446 72 880 156 0.14% Hitler, Adolf Hitler, Adolf Madsen, Michael (I) Lee, Christopher (I) Lee, Christopher (I) Steiger, Rod Welles, Orson Sutherland, Donald (I) Quinn, Anthony (I) Steiger, Rod Carradine, John Sutherland, Donald (I) Mitchum, Robert Connery, Sean Pleasence, Donald Hopper, Dennis Keitel, Harvey (I) von Sydow, Max (I) Caine, Michael (I) Sheen, Martin Hopper, Dennis Keitel, Harvey (I) Carradine, David Sutherland, Donald (I) Dafoe, Willem Caine, Michael (I) Sheen, Martin Kier, Udo Trejo, Danny Hitler, Adolf Roberts, Eric (I) De Niro, Robert Dafoe, Willem Jackson, Samuel L. Keitel, Harvey (I) Carradine, David Lee, Christopher (I)
1710.06339
1
1710
2017-10-17T15:14:44
Understanding the Correlation Gap for Matchings
[ "cs.DS" ]
Given a set of vertices $V$ with $|V| = n$, a weight vector $w \in (\mathbb{R}^+ \cup \{ 0 \})^{\binom{V}{2}}$, and a probability vector $x \in [0, 1]^{\binom{V}{2}}$ in the matching polytope, we study the quantity $\frac{E_{G}[ \nu_w(G)]}{\sum_{(u, v) \in \binom{V}{2}} w_{u, v} x_{u, v}}$ where $G$ is a random graph where each edge $e$ with weight $w_e$ appears with probability $x_e$ independently, and let $\nu_w(G)$ denotes the weight of the maximum matching of $G$. This quantity is closely related to correlation gap and contention resolution schemes, which are important tools in the design of approximation algorithms, algorithmic game theory, and stochastic optimization. We provide lower bounds for the above quantity for general and bipartite graphs, and for weighted and unweighted settings. he best known upper bound is $0.54$ by Karp and Sipser, and the best lower bound is $0.4$. We show that it is at least $0.47$ for unweighted bipartite graphs, at least $0.45$ for weighted bipartite graphs, and at lea st $0.43$ for weighted general graphs. To achieve our results, we construct local distribution schemes on the dual which may be of independent interest.
cs.DS
cs
Understanding the Correlation Gap for Matchings Guru Guruganesh∗ Euiwoong Lee† Computer Science Department Carnegie Mellon University Pittsburgh, PA 15213. Given a set of vertices V with V = n, a weight vector w ∈ (R+ ∪ {0})(V 2 ), and a probability vector x ∈ [0, 1](V 2 ) in the matching polytope, we study the quantity Abstract EG[νw(G)] ∑ (u,v)∈(V 2 ) wu,vxu,v where G is a random graph where each edge e with weight we appears with probability xe in- dependently, and let νw(G) denotes the weight of the maximum matching of G. This quantity is closely related to correlation gap and contention resolution schemes, which are important tools in the design of approximation algorithms, algorithmic game theory, and stochastic opti- mization. We provide lower bounds for the above quantity for general and bipartite graphs, and for weighted and unweighted settings. The best known upper bound is 0.54 by Karp and Sipser, and the best lower bound is 0.4. We show that it is at least 0.47 for unweighted bipartite graphs, at least 0.45 for weighted bipartite graphs, and at least 0.43 for weighted general graphs. To achieve our results, we construct local distribution schemes on the dual which may be of inde- pendent interest. 1 Introduction 2 ) and the weight vector w ∈ (R+ ∪ {0})(V We study the size (weight) of the maximum matching of a random graph sampled from various random graph models. Let V be the set of vertices with V = n. Given the probability vector x ∈ [0, 1](V n,w,x be the distribution of random graphs with n vertices such that each pair e ∈ (V 2 ) becomes an edge with probability xe independently. If it becomes an edge, its weight is we. For bipartite graphs, let V1 and V2 be the set of left and right vertices with V1 = V2 = n. Given the probability vector x ∈ [0, 1]V1 ×V2 and the weight vector w ∈ (R+ ∪ {0})V1 ×V2, let DB n,w,x be the distribution of random bipartite graphs with 2n vertices such that each pair e ∈ V1 × V2 becomes an edge with probability xe independently. If it becomes an edge, its weight is we. We use DB 2 ), let DG n,x (resp. DG n,x) for the unweighted case (w = (1, 1, . . . , 1)). We focus on the case when the probability vector x is in the matching polytope of the complete (bipartite) graph. Recall that for bipartite graphs, x ∈ [0, 1]V1 ×V2 is in the matching polytope if ∗Supported in part by Anupam Gupta's NSF awards CCF-1319811 and CCF-1536002. [email protected] †Supported by a Samsung Fellowship and Venkat Guruswami's NSF CCF-1526092. [email protected] 1 each v ∈ V1 ∪ V2 satisfies ∑u xu,v 6 1. For general graphs, x ∈ [0, 1](V 2 ) is in the matching polytope if each v ∈ V satisfies ∑u xu,v 6 1 and each odd set S ⊆ V satisfies ∑{u,v}⊆S xu,v 6 ⌊(S − 1)/2⌋.1 Given a weighted graph G, let νw(G) be the weight of the maximum weight matching of G. If G is unweighted, ν(G) denotes the cardinality of the maximum matching of G. For any x ∈ [0, 1](V 2 ) wu,vxu,v, simply because the probability that (u, v) is included in the maximum matching is at most xu,v. The analogous statement also holds for bipartite graphs. 2 ) and w ∈ (R+ ∪ {0})(V [νw(G)] 6 ∑(u,v)∈(V 2 ), we have E G∼DG n,w,x If x is in the matching polytope2, we can prove that EG[νw(G)] > κ · ∑ wu,vxu,v for some con- stant 0 < κ < 1 . For the general graph model, κ is known to be at least (1 − 1/e)2 ∼ 0.40 for every w [6]. For the bipartite graph model, κ is known to be at least 0.4 for every w [5]. Karp and Sipser [11] showed an upper bound of 0.54 for both bipartite and general graphs, by demon- strating it for the unweighted models where every edge appears with equal probability. Our main results are the following improved lower bounds on κ. Our first theorem concerns the unweighted bipartite model. Theorem 1.1. Let V1 = V2 = n and x ∈ [0, 1]V1 ×V2 be in the matching polytope of the complete bipartite graph on V1 ∪ V2. Then E G∼DB n,x [ν(G)] ∑(u,v)∈V1×V2 xu,v > 0.476. (1) We also obtain a slightly weaker result on the weighted bipartite model. Theorem 1.2. Let V1 = V2 = n and x ∈ [0, 1]V1 ×V2 be in the matching polytope of the complete bipartite graph on V1 ∪ V2. Then for any w ∈ (R+ ∪ {0})V1 ×V2, E G∼DB n,w,x [νw(G)] ∑(u,v)∈V1×V2 wu,vxu,v > (cid:18)1 − 3 2e(cid:19) > 0.4481. Finally, we prove an improved bound on the weighted general graph model. Theorem 1.3. Let V = n and x ∈ [0, 1](V Then for any w ∈ (R+ ∪ {0})(V 2 ), 2 ) be in the matching polytope of the complete graph on V1 ∪ V2. E n,w,x G∼DG ∑(u,v)∈(V [νw(G)] 2 ) wu,vxu,v > e2 − 1 2e2 > 0.4323. 1.1 Applications and Related Work. Contention Resolution Schemes and Correlation Gap. Our work is inspired by and related to the rounding algorithms studied in approximation algorithms. Given a downward-closed family I ⊆ 2E defined over a ground-set E and a submodular function f : 2E → R+, Chekuri et al. [5] considered the problem of finding maxS∈I f (S) and introduced contention resolution schemes (CR schemes) to obtain improved approximation algorithms for numerous problems. Let PI be the 1Our result for general graphs, Theorem 1.3 holds even when x satisfies the first type of constraints. 2If x is not in the matching polytope, one can construct examples where κ = Ω(n). 2 convex combination of all incidence vectors {1S}S∈I . A c-CR scheme π for x ∈ PI is a procedure that, when R is a random subset of E with e ∈ R independently with probability xe, returns π(R) ⊆ R such that π(R) ∈ I with probability 1 and Pr[e ∈ π(R)] > c for all e ∈ E. To construct a CR scheme, they introduced the notion of correlation gap of a polytope, inspired by [1].3 Formally, the correlation gap of I is defined as κ(I) := inf x∈PI , w>0 ER∼Dx [maxS⊆R,S∈I ∑e∈S we] ∑e∈E xewe , (2) where Dx is the distribution where each element e appears in R with probability xe independently. It is easy to see that the existence of c-CR scheme for all x ∈ PI implies κ(I) > c. Chekuri et al. [5] proved the converse that every x ∈ PI admits a κ(I)-CR scheme. By setting E to be the set of all possible edges of a complete (bipartite) graph, and I to be the set of all matchings of a complete graph, our Theorem 1.2 and Theorem 1.3 for weighted bipartite graphs and weighted general graphs imply that there exist 0.4481-CR scheme and 0.4323- CR scheme for bipartite matching polytopes and general matching polytopes respectively. Note that these lower bounds hold when E′ is the set of edges and I ′ is a matching polytope of an arbitrary graph G′, since κ(I) = inf x∈PI , w>0 ER∼Dx [maxS⊆R,S∈I ∑e∈S we] ∑e∈E xewe 6 inf xE′ ∈PI′ , wE′ =0 ER∼Dx [maxS⊆R,S∈I ∑e∈S we] ∑e∈E xewe = κ(I ′). Maximum Matching of Random Graphs. The study of maximum matchings in random graphs has a long history. It was pioneered by the work of Erdos and R´enyi [7, 8], where they proved that a random graph Gn,p has a perfect matching with high probability when p = Ω( ln n n ). The case for sparse graphs was investigated by Karp and Sipser [11] who gave an accurate estimate of ν(G) for Gn,p where p = c n−1 for some constant c > 0. After these two pioneering results, subsequent work has addressed two aspects. The Karp- Sipser algorithm is a simple randomized greedy algorithm, and the first line of works extend the range of models where this algorithm (or its variants) returns an almost maximum matching. Aronson et al. [2] and Chebolu et al. [4] augmented the Karp-Sipser algorithm to achieve tighter results in the standard Gn,p model. Bohman and Frieze [3] considered a new model where a graph is drawn uniformly at random from the collection of graphs with a fixed degree sequence and gave a sufficient condition where the Karp-Sipser algorithm finds an almost perfect matching. The second line of work is based on the following observation: the standard Gn,p model, p = Ω( ln n n ) is required to have a perfect matching, because otherwise there will be an isolated vertex. This naturally led to the question of finding a natural and sparser random graph model with a perfect matching. The considered models include a random regular graph, and a Gn,p with prescribed minimal degree. We refer the reader to the work of Frieze and Pittel [10] and Frieze [9] and references therein. 1.2 Organization Our main technical contribution is lower bounding correlation gaps via local distribution schemes for dual variables, which are used to prove Theorem 1.1 and Theorem 1.2 for unweighted and 3[1] defined the correlation gap of a set function f : 2E → R+. Our results apply to this definition too when f denotes the weight of the maximum matching. 3 weighted bipartite graphs. We present this framework in Section 2 and prove our bounds for unweighted bipartite graphs (Section 3) and weighted bipartite graphs (Section 4). Our result for weighted general graphs is presented in Section 5. 2 Techinques for Bipartite Graphs Let V = V1 ∪ V2 be the set of vertices with V1 = V2 = n, E := V1 × V2. Fix w ∈ (R+ ∪ {0})E and x ∈ [0, 1]E in the bipartite matching polytope of (V, E). Our proofs for Theorem 1.1 and 1.2 for bipartite graphs follow the following general frame- work. Let G = (V, E(G)) be a sampled from the distribution where each potential edge e ∈ E appears with probability xe independently (recall that E = V1 × V2 is the set of all potential edges and E(G) is the edges of one sample G). Let y(G) ∈ (R+ ∪ {0})V be an optimal fractional vertex cover such that for every e = (u, v) ∈ E(G), yu(G) + yv(G) > we. By K onig-Egerv´ary theorem, ky(G)k1 = ν(G). Given G, consider the situation where initially each vertex v has mass yv(G), and each potential edge has mass ye(G) = 0 (we slightly abuse notation and consider y(G) ∈ (R+ ∪ {0})V∪E). We construct local distribution schemes FG : (V ∪ E) × (V ∪ E) → R where FG(a, b) indicates the amount of mass sent from a to b. We require that FG(a, a) = 0, but we allow FG(a, b) 6= −FG(b, a) for a 6= b (the net flow from a to b in this case is FG(a, b) − FG(b, a)). Let t(G) ∈ RV∪E denote the mass of each vertex and edge after the distribution. ta(G) := ya(G) + ∑ FG(b, a) − ∑ FG(a, b). b∈V∪E b∈V∪E We choose FG so that it ensures tv(G) > 0 for every v ∈ V. This implies ∑ e∈E te(G) 6 ∑ ta(G) = ∑ a∈V∪E a∈V∪E ya(G) = ∑ v∈V yv(G) = ν(G). Therefore, if we prove that for each potential edge e ∈ E EG[te(G)] > α · wexe, (3) for some α > 0, it implies that EG[ν(G)] > α · ∑ e∈E EG[te(G)] > α · ∑ e∈E wexe. For weighted and unweighted cases, we construct different local distribution schemes {FG}G that prove (3) with different values of α. Weighted Bipartite Graphs. Given a sample G = (V, E(G)) and a fractional vertex cover y ∈ (R+ ∪ {0})V, our FG(v, e) = yv(G)/ degG(v) if e ∈ E(G) is an edge incident on v ∈ V, and 0 otherwise. Intuitively, each vertex v distributes its mass yv(G) evenly to its incident edges in G. This clearly satisfies tv(G) > 0 for every v ∈ V, and for each e = (u, v) ∈ E, we use the following 4 approximation: EG[te(G)] = Pr[e ∈ G] · EG (cid:20)te(G)e ∈ G(cid:21) e ∈ G(cid:21) 1 yv(G) degG(v) + = xe EG (cid:20) yu(G) degG(u) > xe EG (cid:20)(yu(G) + yv(G)) > xewe EG (cid:20) 1 max(degG(u), degG(v)) e ∈ G(cid:21). max(degG(u), degG(v)) e ∈ G(cid:21) Therefore, to prove Theorem 1.2, it suffices to prove that for every potential edge e ∈ E, E n,w,x (cid:20) G∼DB 1 max(degG(u), degG(v)) e ∈ G(cid:21) > 0.4481, when G is sampled from DB n,w,x with x in the matching polytope. Experimentally trying several extreme cases indicates that the worst case for e = (u, v) ∈ E happens when xe = ε for very small ε, u has only one other edge eu with xeu = 1 − ε, and v is incident on n − 1 edges ev1, . . . , evn−1 with ] as n grows, xevi 1 n−1 ). Section 4 formally proves that this where YU is drawn from a binomial distribution B(n − 1, is indeed the worst case. max(degG(u),degG (v)) e ∈ G] converges to E[ n−1. As ε approaches to 0, EG[ = 1−ε 1+YU 1 1 Unweighted Bipartite Graphs. One simple but important observation is that in the above ex- ]xe, e is an edge with very small xe = ε, and it is adjacent to a ample where EG[te(G)] ≈ E[ large edge eu with xeu = 1 − ε. From the persepctive of xeu, the expected number of adjacent edges is at most 2ε, so EG[teu (G)] ≈ xeu ≈ 1. Since eu gets much more than what it needs (E[teu ] > 0.476 suffices to prove Theorem 1.1), it is natural to take some value from teu(G) to increase te(G). 1+YU 1 Formally, given G = (V, E(G)), our new local distribution scheme FG : (V ∪ E) × (V ∪ E) → R is defined as follows. Let c be an universal constant that will be determined later. FG(a, b) = ya(G) degG (a) cx2 a xb 0 if a ∈ V, b ∈ E(G), a ∈ b if a 6= b ∈ E, a ∩ b 6= ∅ otherwise. (4)   Intuitively, on top of the old local distribution scheme for weighted graphs, each edge e pays cx2 e x f to every adjacent edge f with probability 1 (this quantity does not depend on G). Because this term quadratically depends on the x value of the sender, this payment penalizes edges with large x values to help edges with small x values. For a fixed edge e = (u, v) ∈ E with fixed xe = ε, Theorem 3.1 shows that the worst case is when both u and v have n − 1 other edges of whose x values are equal to 1−ε n . Finally, Lemma 3.2 shows that E[te] > 0.476 for every ε ∈ (0, 1], proving Theorem 1.1. 3 Unweighted Bipartite Graphs We prove Theorem 1.1 for unweighted bipartite graphs. Given G = (V, E(G)), consider the local distribution scheme FG : (V ∪ E) × (V ∪ E) → R given in (4). This implies that the mass after this 5 new distribution scheme for an edge e = (u, v) is given by te(G) = αe(G) + ∑ c(xex2 f − x2 e x f ) + ∑ c(x2 gxe − x2 e xg), f ∈E\{e}: f ∋u g∈E\{e}:g∋v where αe(G) := yu(G)/ degG(u) + yv(G)/ degG(v) denotes the mass after the old distribution scheme used for weighted bipartite graphs. We define βe(x) to be the following. βe(x) := E G∼DB n,x = E G∼DB n,x [te(G)] [αe(G)] + ∑ c(xex2 f − x2 e x f ) + ∑ c(x2 gxe − x2 e xg) f ∈E\{e}: f ∋u g∈E\{e}:g∋v To prove Theorem 1.1, it suffices to prove that βe(x) > 0.476xe for each e. Fix e = (u, v). Let eu1, . . . , eun−1 be n − 1 other edges incident on u and ev1, . . . , evn−1 be n − 1 other edges inci- max(degG(u),degG(v)) e ∈ G] as before. Define dent on v. E F(x0, y1, . . . , yn−1, z1, . . . , zn−1) by [αe(G)] is lower bounded by xe EG[ G∼DB n,x 1 F(x0, y1, . . . , yn−1, z1, . . . , zn−1) := x0 E[ 1 1 + max(Y, Z) ] + n−1 ∑ i=1 c(x0y2 i − x2 0yi) + n−1 ∑ i=1 c(x0z2 i − x2 0zi), , . . . , xeun−1 where Y := Y1 + · · · + Yn−1 and Z := Z1 + · · · + Zn−1 and each Yi (resp. Zi) is an indepen- dent Bernoulli random variable with E[Yi] = yi (resp. E[Zi] = zi). By construction, βe(x) > F(xe, xeu1 , the following theorem shows that F is minimized when xeu1 Theorem 3.1. For x0, y1, . . . , ym, z1, . . . , zm ∈ [0, 1] where ys := ∑m 1 − x0, and ∑n−1 i=1 xvui = · · · = xevn−1 i=1 yi 6 1 − x0 and zs := ∑m ). Given fixed ∑n−1 i=1 xeui and xev1 = · · · = xeun−1 , . . . , xevn−1 i=1 zi 6 , xev1 . F(x0, y1, . . . , ym, z1, . . . , zm) > F(x0, ys m , . . . , ys m , zs m , . . . , zs m ). Proof. Without loss of generality, assume y1 > . . . > ym. We will show that if y1 > ym, ∂F ∂ym − ∂F ∂y1 6 0. (5) This implies that as long as y1 > ym, decreasing y1 and increasing ym by the same amount will never increase F while maintaining y1 + · · · + ym = ys, so F is minimized when y1 = · · · = ym = ys m . The same argument for z1, . . . , zm will prove the theorem. Let Y := Y1 + · · · + Ym and Z := Z1 + · · · + Zm, where each Yi (resp. Zi) is an independent Bernoulli random variable with E[Yi] = yi (resp. E[Zi] = zi). To prove (5), we first compute 6 ∂ E[ 1 1+max(Y,Z) ] ∂ym − ∂ E[ 1 1+max(Y,Z) ] ∂y1 . Let Y′ := Y2 + · · · + Ym−1. We decompose E[ 1 1+max(Y,Z) ] as follows. E[ 1 ] 1 + max(Y, Z) m ∑ m ∑ i=0 m ∑ j=0(cid:18) Pr[Y = i] · Pr[Z = j] · i=0(cid:18) Pr[Y′ = i] · Pr[Z 6 i](cid:0) i=0(cid:18) Pr[Y′ = i] · Pr[Z = i + 1](cid:0) m ∑ = = + 1 1 + max(i, j)(cid:19) (1 − y1)(1 − ym) 1 + i + y1(1 − ym) + (1 − y1)ym 2 + i + y1ym 3 + i(cid:1)(cid:19) 1 − y1ym 2 + i + y1ym 3 + i(cid:1)(cid:19) + m ∑ i=0 Pr[Y′ = i] · Pr[Z > i + 2] · 1 3 + i Therefore, the directional derivative can be written as ( ∂ ∂ym − ) E[ 1 1 + max(Y, Z) ] ∂ ∂y1 m ∑ 1 1 + i m ∑ i=0(cid:18) Pr[Y′ = i] · Pr[Z 6 i](cid:0) i=0(cid:18) Pr[Y′ = i] · Pr[Z = i + 1](cid:0) − i=0(cid:18) Pr[Y′ = i] · Pr[Z 6 i](cid:0) i=0(cid:18) Pr[Y′ = i] · Pr[Z 6 i](cid:0) m ∑ m ∑ 1 + i 1 + i 1 1 − − − 2 2 + i + 1 2 + i + 2 2 + i 2 2 + i + + 1 1 3 + i(cid:1)(cid:19) 3 + i(cid:1)(cid:19) 3 + i(cid:1)(cid:19) 3 + i(cid:1)(cid:19) 1 1 =(y1 − ym) +(y1 − ym) 6(y1 − ym) 6(y1 − ym) 6 y1 − ym 3 , where the last inequality follows from the fact that 1 1 + i (cid:0) − 2 2 + i + 1 3 + i(cid:1) = 2 (1 + i)(2 + i)(3 + i) 6 1 3 . Finally, ( − ∂ ∂ ∂y1 ∂ym ∂ ∂ ∂y1 ∂ym xe(y1 − ym) − =( 6 3 )F )(xe E[ 1 1 + max(Y, Z) − 2cxe(y1 − ym) = 0. ] + cxey2 1 − cx2 e y1 + cxey2 m − cx2 e ym) By taking c = 1 6 . Therefore, for any e ∈ E, βe(x) > F(xe, ys n−1 , . . . , ys n−1, zs n−1, . . . , zs n−1 ) for some ys 6 1 − xe and 7 zs 6 1 − xe. Let G(xe, ys, zs) :=F(xe, ys n − 1 , . . . , ys n − 1 , zs n − 1 , . . . , ] + (n − 1)c(xe( )2 − x2 e ( ys n − 1 )) ) − xe) + cxezs(( zs n − 1 ) − xe) zs ) n − 1 ys n − 1 )) zs n − 1 ys n − 1 1 =xe E[ 1 + max(Y, Z) zs + (n − 1)c(xe( )2 − x2 e ( n − 1 =xe E[ >xe E[ 1 1 + max(Y, Z) 1 1 + max(Y, Z) ] + cxeys(( ] − 2cx2 e where Y ∼ Binomial(n − 1, ys mized when ys = zs = 1 − xe. Finally, let n−1 ), Z ∼ Binomial(n − 1, zs n−1 ). Note that the final quantity is mini- Hn−1(xe) := xe E[ 1 1 + max(Y, Z) ] − 2cx2 e , where Y, Z ∼ Binomial(n − 1, 1−xe n−1 ). Lemma 3.2. For any m ∈ N and xe ∈ [0, 1], Hm(xe) > 0.476xe. Proof. Since the binomial distribution is approximated by the Poisson distribution in the limit, we 1+max(Y,Z) ] − x2/3 (we use this to ease the calculation. Let Y, Z ∼ Poisson(1 − x). Let H(x) := x E[ substitute c = 1/6 into the earlier equation). In particular, we write the expectation in full to get 1 E[ 1 1 + max(Y, Z) ] = ∞ ∑ k=0 ∞ ∑ j=0 1 1 + max(j, k) e−2(1−x) (1 − x)j+k j!k! = 1 e2(1−x) ∞ k=0(cid:16) ∑ k ∑ j=0 1 1 + max(j, k − j) 1 j!(k − j)!(cid:17)(1 − x)k Let Pt(x) denote the above sum truncated at k = t. I.e. Pt(x) := 1 e2(1−x) t k=0(cid:16) ∑ k ∑ j=0 1 1 + max(j, k − j) 1 j!(k − j)!(cid:17)(1 − x)k This is a degree t-polynomial in (1 − x) with a normalizing factor of e−2(1−x) and note that E[ Pt(x) for any t ∈ N. 1 1+max(Y,Z) ] > Truncating this polynomial with t = 15, we can see that this has a minimum value of 0.476 1+max(Y,Z) ] − x/3 > P15(x) − x/3. In the interval for all values of x ∈ [0, 1]. we can see that E[ x ∈ [0, 1], this function achieves its minimum at x = 0 achieving a minimum of 0.476. 1 4 Weighted Bipartite Graphs We prove Theorem 1.2 for weighted bipartite graphs. As explained in Section 2, it suffices to prove that for each e = (u, v) ∈ E, E n,w,x (cid:20) G∼DB 1 max(degG(u), degG(v)) e ∈ G(cid:21) > 0.4481. 8 Fix e = (u, v) and assume V = {v, v1, . . . , vn−1} ∪ {u, u1, . . . , un−1}. Let Y = degG(u) − 1 and Z = degG(v) − 1. Given e ∈ G, Y and Z can be represented as Y = ∑n−1 i=1 Zi, where Yi indicates where (u, vi) ∈ E(G) and Zi indicates where (v, ui) ∈ E(G). This construction ensures that i=1 Yi and Z = ∑n−1 EG(cid:20) 1 max(degG(u), degG(v)) e ∈ G(cid:21) = EY,Z(cid:20) 1 1 + max(Y, Z)(cid:21). Note that Y1, . . . , Yn−1, Z1, . . . , Zn−1 are mutually independent, and E[Y], E[Z] 6 1. By mono- tonicity, assuming E[Y] = E[Z] = 1 never increases the lower bound. The following theorem shows that the worst case happens when one of Y, Z is consistently 1 and the other is drawn from Binomial(n − 1, Theorem 4.1. Let Y = Y1 + · · · + Ym and Z = Z1 + · · · + Zm, where Y1, . . . , Ym, Z1, . . . , Zm are mutu- ally independent Bernoulli random variables with E[Y] = E[Z] = 1. Then, 1 n−1 ). E(cid:20) where YU is drawn from Binomial(m, 1 Proof. We decompose E[ 1 1 1 + max(Y, Z)(cid:21) > E(cid:20) m ). 1 1 + YU(cid:21), 1+max(Y,Z) ] as follows. E(cid:20) 1 1 + max(Y, Z)(cid:21) = = = = m ∑ i=0 m ∑ i=0 m ∑ i=0 m ∑ i=0 m ∑ j=0(cid:18) Pr[Y = i] · Pr[Z = j] · Pr[Y = i](cid:20)(cid:0) Pr[Z = j](cid:1) · i ∑ j=0 Pr[Y = i] · Pr[Y = i] · 1 1 + i 1 1 + i − − m ∑ i=0 m ∑ j=1 1 1 + max(i, j)(cid:19) 1 1 + i +(cid:0) Pr[Y = i](cid:20) m ∑ j=i+1 Pr[Z = j](cid:20) j−1 ∑ i=0 m ∑ j=i+1 Pr[Z = j] · 1 1 + j(cid:1)(cid:21) Pr[Z = j](cid:0) Pr[Y = i](cid:0) 1 1 + i 1 1 + i − − 1 1 + j(cid:1)(cid:21) 1 + j(cid:1)(cid:21). 1 Let tj := ∑ j−1 i=0 Pr[Y = i] ·(cid:0) 1 1+i − 1 tj j . > Lemma 4.2. For all j > 3, t2 2 1+j(cid:1). We prove the following facts about tj's. Proof. Fix j > 3. By the definition of t2 and tj, t2 2 − tj j = = 1 2(cid:18) Pr[Y = 0](1 − 1 3 ) + Pr[Y = 1]( 1 2 − 1 3 )(cid:19)(cid:19) − 1 j(cid:18) j−1 ∑ i=0 1 3 Pr[Y = 0] + 1 12 Pr[Y = 1] − = ( 1 3 − 1 1 + j ) Pr[Y = 0] + ( 1 12 − 1 j(cid:18) j−1 ∑ i=0 j − 1 2j(j + 2) Pr[Y = i](cid:0) 1 1 + i − ) Pr[Y = 1] Pr[Y = i](cid:0) 1 + j(cid:1)(cid:19) 1 1 1 + i − 1 1 + j(cid:1)(cid:19) − 1 j(cid:18) j−1 ∑ i=2 > (cid:18) 1 3 − Pr[Y = i](cid:0) j−1 ∑ i=2(cid:0) 1 j − 1 1 + j 1 1 + i − 1 1 + i − 1 1 + j(cid:1)(cid:19) 1 + j(cid:1)(cid:19) Pr[Y = 0] + ( 1 1 12 − j − 1 2j(j + 2) ) Pr[Y = 1], 9 where the inequality follows from Pr[Y = 0] > Pr[Y = i] for i > 2. To prove t2 to prove that 1 1+i − 1 for j > 3. The former can be proved as 1+j(cid:1) > 0, and 1 i=2(cid:0) 1 12 − j−1 3 − 1 1+j − 1 2j(j+2) j ∑ j−1 2 − tj j > 0, it suffices > 0. It is easy to verify the latter 1 3 1 3 − + + = > 1 3 1 3 2 3j =(cid:0) = − − 1 1 + i j(1 + j) 1 + j j − 2 1 1 + j − 1 j j−1 ∑ i=2(cid:0) −(cid:0) −(cid:0) 3j (cid:1) +(cid:0) 1 1 j − 2 j(1 + j) j − 2 1 + j j − 2 j(1 + j) + + 1 − 1 + j(cid:1) j−1 1 ∑ 1 + i(cid:1) j i=2 j − 2 1 3j (cid:1) 1 + j(cid:1) 1 − 2 j(1 + j) > 0, where the first inequality follows from 1 1+i j > 3. 6 1 3 for i > 2 and the last inequality follows from We prove the theorem by considering the following two cases. Case 1: 2 Pr[Y = 0] > Pr[Y = 1] or 2 Pr[Z = 0] > Pr[Z = 1]. Without loss of generality, assume that 2 Pr[Y = 0] > Pr[Y = 1]. It is equivalent to Pr[Y = 0] > 2 3 Pr[Y = 0] + 1 6 Pr[Y = 1] ⇔ t1 > t2 2 . By Lemma 4.2, it implies that t1 > tj j for all j > 2. Then, since E[Z] = ∑m j=1 j · Pr[Z = j] = 1, E(cid:20) 1 1 + max(Y, Z)(cid:21) = > = m ∑ i=0 m ∑ i=0 m ∑ i=0 Pr[Y = i] · Pr[Y = i] · Pr[Y = i] · 1 1 + i 1 1 + i 1 1 + i − m ∑ j=1 Pr[Z = j]tj j · Pr[Z = j] − t1 m ∑ j=1 − t1 = E[ 1 1 + max(Y, 1) ]. The following lemma proves the theorem in the case t1 > t2 2 . Lemma 4.3. E[ 1 1+max(Y,1) ] > E[ 1 1+max(YU,1) ]. Proof. Note that Y = Y1 + · · · + Ym, and each Yi is a Bernoulli random variable. Let yi := E[Yi]. Without loss of generality, assume y1 > . . . > ym. We will show that if y1 > ym, ∂ E[ 1 1+max(Y,1) ] ∂ym − ∂ E[ 1 1+max(Y,1) ] ∂y1 6 0. (6) 10 This implies that as long as y1 > ym, decreasing y1 and increasing ym by the same amount will 1+max(Y,1) ] while maintaining y1 + · · · + ym = 1, so the expectation is minimized never increase E[ when y1 = · · · = ym, or Y = YU. Consider the following decomposition of E[ 1 1 1+max(X,Y) ]. EY(cid:20) 1 1 + max(1, Y)(cid:21) = Pr[Y = 0] · 1 2 + m ∑ i=1 Pr[Y = i] · 1 1 + i = = = 1 2 1 2 1 2 (1 − m ∑ i=1 Pr[Y = i]) + m ∑ i=1 Pr[Y = i] · 1 1 + i − − m ∑ i=2 m ∑ i=2 Pr[Y = i] · ( Pr[Y > i] · ( 1 2 1 i − − 1 1 + i 1 1 + i ) ). To prove (6), it suffices to prove that for all i > 2, ∂ Pr[Y > i] ∂ym − ∂ Pr[Y > i] ∂y1 > 0. Let Y′ = Y2 + · · · + Ym−1, and fix i > 3. Pr[Y > i] = Pr[Y′ = i − 2]y1ym + Pr[Y′ = i − 1](cid:0)y1(1 − ym) + (1 − y1)ym + y1ym) + Pr[Y′ > i] ∂ Pr[Y > i] ∂y1 = Pr[Y′ = i − 2]ym + Pr[Y′ = i − 1](cid:0)1 − ym(cid:1) Therefore, ∂ Pr[Y > i] ∂ym − ∂ Pr[Y > i] ∂y1 = Pr[Y′ = i − 2](y1 − ym) + Pr[Y′ = i − 1](cid:0)ym − y1(cid:1) = (y1 − ym)(cid:0) Pr[Y′ = i − 2] + Pr[Y′ = i − 1](cid:1). Finally, it remains to show that Pr[Y′ = j] > Pr[Y′ = j + 1] for all j > 0. The case j = 0 is true since Pr[Y′ = 0] = ∏m−1 k=2 (1 − yk) and Pr[Y′ = 1] = m−1 ∑ k=2 Pr[Y′ = 0] · yk 1 − yk 6 m−1 ∑ k=2 Pr[Y′ = 0] yk 1 − y2 = Pr[Y′ = 0] 1 − y2 m−1 ∑ i=2 yk 6 Pr[Y′ = 0], where the last line follows from ∑m−1 k=2 yi 6 1 − y1 6 1 − y2 since y1 is the biggest element. The case j > 1 follows from the fact the sequence (Pr[Y′ = j])j has one mode or two consecutive modes, and at least one of them occurs at j = 0 (E[Y′] < 1 implies Pr[Y′ = 0] > Pr[Y′ = j] for all j > 2). Case 2: 2 Pr[Y = 0] 6 Pr[Y = 1] and 2 Pr[Z = 0] 6 Pr[Z = 1]. Since ∑m E[Z] = ∑m 2 Pr[Z = 0] 6 Pr[Z = 1], it implies i=1 i · Pr[Z = i] = 1, we have Pr[Z = 0] = ∑m i=0 Pr[Z = i] = 1 and i=2(i − 1) Pr[Z = i]. Together with the fact 1 − Pr[Z = 1] = Pr[Z = 0] + m ∑ i=2 Pr[Z = i] 6 2 Pr[Z = 0] < Pr[Z = 1], 11 so Pr[Z = 1] > 1 2 . Finally, 1 + max(Y, Z)(cid:21) = 1 E(cid:20) = > = > m ∑ i=0 m ∑ i=0 m ∑ i=0 m ∑ i=0 m ∑ i=0 Pr[Y = i] · 1 1 + i − m ∑ j=1 Pr[Z = j] · tj Pr[Y = i] · Pr[Y = i] · Pr[Y = i] · 1 1 + i 1 1 + i 1 1 + i − Pr[Z = 1] · t1 − − Pr[Z = 1] · t1 − m ∑ j=2 m ∑ j=2 Pr[Z = j] · tj j · Pr[Z = j] · t2 2 − Pr[Z = 1] · t1 − t2 2 (1 − Pr[Z = 1]) Pr[Y = i] · 1 1 + i − t1 2 − t2 4 = E(cid:20) 1 1 + max(Y, YH)(cid:21), where YH is drawn from Binomial(2, 1 second inequality follows from Pr[Z = 1] > 0.5 and t1 6 t2 2 . 2 ). The first inequality follows from Lemma 4.2, and the 1 1+max(Y,YH) ] > Since YH satisfies 2 Pr[YH = 0] = Pr[YH = 1], the analysis for Case 1 shows that E[ 1+max(1,YU) ]. 1 E[ The following lemma finishes the proof of Theorem 1.2. Lemma 4.4. For any m ∈ N, if Y ∼ Binomial(m, 1 m ), E(cid:20) 1 1 + max(1, Y)(cid:21) > 0.4481 Proof. Since the binomial distribution is approximated by the Poisson distribution in the limit, we use this to ease the calculation. Let Y ∼ Poisson(1). E(cid:20) 1 1 + max(1, Y)(cid:21) = 1 k + 1 Pr[Y′ = k] + 1 2 Pr[Y < 2] ∞ ∑ k=2 ∞ ∑ k=2 1 = = 1 k! e(cid:0) k + 1 ∞ ∑ k=0 5 2 > 0.4481 = (e − ) 1 e 1 1 + 1 2 ( 1 e + 1 e k! · e 1 2(cid:1) + − 1 − 1 − + 1 e ) 1 2 ( 1 e + 1 e ) 5 General Graphs In this section, we prove Theorem 1.3 for weighted general graphs. Our proof methods here closely follow that of Lemma 4.9 of Chekuri et al. [5] that lower bounds the correlation gap for monotone submodular functions by 1 − 1/e. The only difference is that Lemma 5.1 holds for matching with a weaker guarantee (if ν was a monotone submodular function, Lemma 5.1 would hold with 2ν(G) replaced by ν(G)). 12 Proof. Fix weights w ∈ (R+ ∪ {0})E. Define F : [0, 1] → (R+ ∪ {0}) as F(x) := E Now, fix x ∈ [0, 1]E in the matching polytope. We will show F(x) > 0.43 ∑e∈E wexe. G∼DG n,w,x [ν(G)]. Consider the function φ(t) := F(tx) for t ∈ [0, 1]. For each e ∈ E, ∂F ∂xe(cid:12)(cid:12)(cid:12)(cid:12)tx dφ dt = x · ∇F(tx) = ∑ e∈E xe ∂F ∂xe(cid:12)(cid:12)(cid:12)(cid:12)tx ∂ E = G∼DG n,w,tx ∂xe [ν(G)] (cid:12)(cid:12)(cid:12)(cid:12)tx = E = E G∼DG n,w,tx G∼DG n,w,tx [ν(G)e ∈ G] − E G∼DG n,w,tx [ν(G)e /∈ G] [ν(G ∪ {e}) − ν(G \ {e})], where G ∪ {e} (resp. G \ {e}) denotes the graph (V, E(G) ∪ {e}) (resp. (V, E(G) \ {e}). Lemma 5.1. For any fixed graph G with weights {we} and any point x in the matching polytope, ∑ e∈E xe(cid:0)ν(G ∪ {e}) − ν(G \ {e})(cid:1) + 2ν(G) > ∑ e∈E xewe. Proof. Let M ⊆ E(G) be a maximum weight matching of G. Note that ∑ e∈E > ∑ e∈E > ∑ e∈E xe(cid:0)ν(G ∪ {e}) − ν(G \ {e})(cid:1) + 2ν(G) xe(cid:0)ν(G ∪ {e}) − ν(G)(cid:1) + 2 ∑ xe(cid:0)ν(G ∪ {e}) − ν(G)(cid:1) + ∑ e∈E:e∼ f f ∈M f ∈M w f ∑ xew f (7) (8) where f ∼ e indicates that two edges f and e share an endpoint. To prove the lemma, it suffices to show that for each e ∈ E, the coefficient of of xe in (8) is at least we. We consider the following cases. • If M ∪ {e} is a matching, ν(G ∪ {e}) > ν(G) + we and ν(G \ {e}) 6 ν(G), so ν(G ∪ {e}) − ν(G \ {e}) > we. • If e intersects exactly one edge f ∈ M, the coefficient of xe is ν(G ∪ {e}) − ν(G) + w f . If w f > we, it is at least we. If w f < we, M ∪ {e} \ { f } is a matching of weight ν(G) + we − w f . It implies that e /∈ E(G) and ν(G ∪ {e}) − ν(G) > we − w f , so ν(G ∪ {e}) − ν(G) + w f > we. • If e intersects two edges f , g ∈ M, the coefficient of xe is ν(G ∪ {e}) − ν(G) + w f + wg. If w f + wg > we, it is at least we. If w f + wg < we, M ∪ {e} \ { f , g} is a matching of weight ν(G) + we − w f − wg. It implies that e /∈ E(G) and ν(G ∪ {e}) − ν(G) > we − w f − wg, so ν(G ∪ {e}) − ν(G) + w f + wg > we. 13 Combining (7) and Lemma 5.1, dφ dt = ∑ e∈E = ∑ e∈E > ∑ e∈E = ∑ e∈E xe E ∂F ∂xe(cid:12)(cid:12)(cid:12)(cid:12)tx G∼DG n,w,tx [ν(G ∪ e) − ν(G \ e)] xewe − 2 E G∼DG n,w,tx [ν(G)] xewe − 2φ(t). which implies that, Since φ(0) = 0, d dt (e2tφ(t)) = 2e2tφ(t) + e2t dφ dt > e2t ∑ e∈E xewe. e2φ(1) > ∑ e∈E xewe Z 1 0 e2tdt = e2 − 1 2 xewe, ∑ e∈E which proves the theorem. References [1] S. Agrawal, Y. Ding, A. Saberi, and Y. Ye. Price of correlations in stochastic optimization. Operations Research, 60(1):150 -- 162, 2012. 3 [2] J. Aronson, A. Frieze, and B. G. Pittel. Maximum matchings in sparse random graphs: Karp- sipser revisited. Random Structures and Algorithms, 12(2):111 -- 177, 1998. 3 [3] T. Bohman and A. Frieze. Karp -- sipser on random graphs with a fixed degree sequence. Combinatorics, Probability and Computing, 20(05):721 -- 741, 2011. 3 [4] P. Chebolu, A. Frieze, and P. Melsted. Finding a maximum matching in a sparse random graph in o(n) expected time. J. ACM, 57(4):24:1 -- 24:27, May 2010. 3 [5] C. Chekuri, J. Vondrk, and R. Zenklusen. Submodular function maximization via the multi- linear relaxation and contention resolution schemes. SIAM Journal on Computing, 43(6):1831 -- 1879, 2014. Preliminary version in STOC'11. 2, 3, 12 [6] M. Cygan, F. Grandoni, and M. Mastrolilli. How to sell hyperedges: the hypermatching assignment problem. In Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 342 -- 351. Society for Industrial and Applied Mathematics, 2013. 2 [7] P. Erdos and A. R´enyi. On the existence of a factor of degree one of a connected random graph. Acta Mathematica Hungarica, 17(3-4):359 -- 368, 1966. 3 [8] P. Erdos and A. R´enyi. On random matrices ii. Studia Sci. Math. Hungar., 3:459 -- 464, 1968. 3 [9] A. Frieze. Perfect matchings in random bipartite graphs with minimal degree at least 2. Random Structures and Algorithms, 26(3):319 -- 358, 2005. 3 14 [10] A. Frieze and B. Pittel. Perfect matchings in random graphs with prescribed minimal degree. In Mathematics and Computer Science III, pages 95 -- 132. Springer, 2004. 3 [11] R. M. Karp and M. Sipser. Maximum matching in sparse random graphs. In Foundations of Computer Science, 1981. SFCS'81. 22nd Annual Symposium on, pages 364 -- 375. IEEE, 1981. 2, 3 15
1802.06992
1
1802
2018-02-20T07:23:28
Sublinear Algorithms for MAXCUT and Correlation Clustering
[ "cs.DS" ]
We study sublinear algorithms for two fundamental graph problems, MAXCUT and correlation clustering. Our focus is on constructing core-sets as well as developing streaming algorithms for these problems. Constant space algorithms are known for dense graphs for these problems, while $\Omega(n)$ lower bounds exist (in the streaming setting) for sparse graphs. Our goal in this paper is to bridge the gap between these extremes. Our first result is to construct core-sets of size $\tilde{O}(n^{1-\delta})$ for both the problems, on graphs with average degree $n^{\delta}$ (for any $\delta >0$). This turns out to be optimal, under the exponential time hypothesis (ETH). Our core-set analysis is based on studying random-induced sub-problems of optimization problems. To the best of our knowledge, all the known results in our parameter range rely crucially on near-regularity assumptions. We avoid these by using a biased sampling approach, which we analyze using recent results on concentration of quadratic functions. We then show that our construction yields a 2-pass streaming $(1+\epsilon)$-approximation for both problems; the algorithm uses $\tilde{O}(n^{1-\delta})$ space, for graphs of average degree $n^\delta$.
cs.DS
cs
Sublinear Algorithms for MAXCUT and Correlation Clustering ∗ Aditya Bhaskara1, Samira Daruki1,2, and Suresh Venkatasubramanian1 1School of Computing, University of Utah 2Expedia Research Abstract We study sublinear algorithms for two fundamental graph problems, MAXCUT and correla- tion clustering. Our focus is on constructing core-sets as well as developing streaming algorithms for these problems. Constant space algorithms are known for dense graphs for these problems, while Ω(n) lower bounds exist (in the streaming setting) for sparse graphs. Our goal in this paper is to bridge the gap between these extremes. Our first result is to construct core-sets of size eO(n1−δ) for both the problems, on graphs with average degree nδ (for any δ > 0). This turns out to be optimal, under the exponential time hypothesis (ETH). Our core-set analysis is based on studying random-induced sub-problems of optimization problems. To the best of our knowledge, all the known results in our parameter range rely crucially on near-regularity assumptions. We avoid these by using a biased sampling approach, which we analyze using recent results on concentration of quadratic functions. We then show that our construction yields a 2-pass streaming (1 + ε)-approximation for both problems; the algorithm uses eO(n1−δ) space, for graphs of average degree nδ. Introduction 1 Sublinear algorithms are a powerful tool for dealing with large data problems. The range of questions that can be answered accurately using sublinear (or even polylogarithmic) space or time is enormous, and the underlying techniques of sketching, streaming, sampling and core-sets have been proven to be a rich toolkit. When dealing with large graphs, the sublinear paradigm has yielded many powerful results. For many NP-hard problems on graphs, classic results from property testing [22, 7] imply extremely efficient sublinear approximations. In the case of dense graphs, these results (and indeed older ones of [10, 18]) provide constant time/space algorithms. More recently, graph sketching techniques have been used to obtain efficient approximation algorithms for cut problems on graphs [2, 3] in a streaming setting. These algorithms use space that is nearly linear in n (the number of vertices) and are sublinear in the number of edges as long as E = ω(n) (this is called the "semi-streaming" setting). By way of lower bounds, recent results have improved our understanding of the limits of sketch- ing and streaming. In a sequence of results [24, 25, 27], it was shown that for problems like matching and MaxCut in a streaming setting, Ω(n) space is necessary in order to obtain any approximation better than a factor 2 in one round. (Note that a factor 2 is trivial by simply counting edges.) ∗This research was supported in part by National Science Foundation under grants IIS-1251049, IIS-1633724 1 Furthermore, Andoni et al. [9] showed that any sketch for all the cuts in a graph must have size Ω(n). While these lower bounds show that O(n) space is the best possible for approximating problems like MaxCut in general, the constructions used in these bounds are quite specialized. In particular, the graphs involved are sparse, i.e., have Θ(n) edges. Meanwhile, as we mentioned above, if a graph is dense (Ω(n2) edges), random sampling is known to give O(1) space and time algorithms. The question we study in this paper is if there is a middle ground: can we get truly sublinear (i.e., o(n)) algorithms for natural graph problems in between (easy) dense graphs and (hard) sparse graphs? Our main contribution is to answer this in the affirmative. As long as a graph has average degree nδ for some δ > 0, truly sub-linear space (1 + ǫ) approximation algorithms are possible for problems such as MaxCut and correlation clustering. Note that we consider the max-agreement version of correlation clustering (see Section 2) Indeed, we show that a biased sample of vertices forms a "core-set" for these problems. A core-set for an optimization problem (see [1]), is a subset of the input with the property that a solution to the subset provides an approximation to the solution on the entire input. Our arguments rely on understanding the following fundamental question: given a graph G, is the induced subgraph on a random subset of vertices a core-set for problems such as MaxCut? This question of sub-sampling and its effect on the value of an optimization problem is well studied. Results from property testing imply that a uniformly random sample of constant size suffices for many problems on dense graphs. [18, 6] generalized these results to the case of arbitrary k-CSPs. More recently, [12], extending a result in [16], studied the setting closest to ours. For graphs, their results imply that when the maximum and minimum degrees are both Θ(nδ), then a random induced subgraph with eO(n1−δ) acts as a core-set for problems such as MaxCut. Moreover, they showed that for certain lifted relaxations, subsampling does not preserve the value of the objective. Finally, using more modern techniques, [33] showed that the cut norm of a matrix (a quantity related to the MaxCut) is preserved up to a constant under random sampling, improving on [18, 6]. While powerful, we will see that these results are not general enough for our setting. Thus we propose a new, conceptually simple technique to analyze sub-sampling, and present it in the context of MaxCut and correlation clustering. 1.1 Our Results As outlined above, our main result is to show that there exist core-sets of size eO(n1−δ) for MaxCut and correlation clustering for graphs with Ω(n1+δ) edges (where 0 < δ ≤ 1). This then leads to a two-pass streaming algorithm for MaxCut and correlation clustering on such graphs, that uses eO(n1−δ) space and produces a 1 + ε approximation. This dependence of the core-set size on δ is optimal up to logarithmic factors, by a result of [17]. Specifically, [17] showed that any (1+ε) approximation algorithm for MaxCut on graphs of average degree nδ must have running time 2Ω(n1−δ ), assuming the exponential time hypothesis (ETH). Since a core-set of size o(n1−δ) would trivially allow such an algorithm (we can perform exhaustive search over the core-set), our construction is optimal up to a logarithmic factor, assuming ETH. Our streaming algorithm for correlation clustering can be viewed as improving the semi-streaming (space O(n)) result of Ahn et al. [4], while using an additional pass over the data. Also, in the context of the lower bound of Andoni et al. [9], our result for MaxCut can be interpreted as saying that while a sketch that approximately maintains all cuts in a graph requires an Ω(n) size, one that preserves the MaxCut can be significantly smaller, when the graph has a polynomial average degree. 2 At a technical level, we analyze the effect of sampling on the value of the MaxCut and corre- lation clustering objectives. As outlined above, several techniques are known for such an analysis, but we give a new and conceptually simple framework that (a) allows one to analyze non-uniform sampling for the first time, and (b) gets over the assumptions of near-regularity (crucial for [16, 12]) and density (as in [18, 6]). We expect the ideas from our analysis to be applicable to other settings as well, especially ones for which the 'linearization' framework of [10] is applicable. The formal statement of results, an outline of our techniques and a comparison with earlier works are presented in Section 4. 1.2 Related Work MaxCut and correlation clustering are both extremely well-studied problems, and thus we will only mention the results most relevant to our work. Dense graphs. A graph is said to be dense if its average degree is Ω(n). Starting with the work of Arora et al. [10], many NP hard optimization problems have been shown to admit a PTAS when the instances are dense. Indeed, a small random induced subgraph is known to be a core-set for problems such as MaxCut, and indeed all k-CSPs [22, 6, 18, 31]. The work of [10] relies on an elegant linearization procedure, while [18, 6] give a different (and more unified) approach based on "cut approximations" of a natural tensor associated with a CSP. Polynomial density. The focus of our work is on graphs that are in between sparse (constant average degree) and dense graphs. These are graphs whose density (i.e., average degree) is nδ, for some 0 < δ < 1. Fotakis et al. [17] extended the approach of [10] to this setting, and obtained best possible, under the exponential time hypothesis (ETH). By way of core-sets, in their celebrated work on the optimality of the Goemans-Williamson rounding, Feige and Schechtman [16] showed (1 + ε) approximation algorithms with run-time exp(eO(n1−δ)). They also showed that it was the that a random sample of eO(n1−δ) is a core-set for MaxCut, if the graphs are almost regular and have an average degree nδ. This was extended to other CSPs by [12]. These arguments seem to use near-regularity in a crucial way, and are based on restricting the number of possible 'candidates' for the maximum cut. In the streaming setting, there are several Streaming algorithms and lower bounds. algorithms [2, 29, 20, 3, 21, 28] that produce cut or spectral sparsifiers with O( n ǫ2 ) edges using O( n ǫ2 ) space. Such algorithms preserves every cut within (1 + ǫ)-factor (and therefore also preserve the max cut). Andoni et al. [9] showed that such a space complexity is essential; in fact, [9] show that any sketch for all the cuts in a graph must have bit complexity Ω( n ǫ2 ) (not necessarily streaming ones). However, this does not rule out the possibility of being able to find a maximum cut in much smaller space. For MaxCut, Kapralov et al. [26] and independently Kogan et al. [30] proved that any streaming algorithm that can approximate the MaxCut value to a factor better than 2 requires O(√n) space, even if the edges are presented in random order. For adversarial orders, they showed that for any ǫ > 0, a one-pass (1 + ǫ)-approximation to the max cut value must use n1−O(ǫ) space. Very recently, Kapralov et al. [27] went further, showing that there exists an ǫ∗ > 0 such that every randomized single-pass streaming algorithm that yields a (1 + ǫ∗)-approximation to the MAXCUT size must use Ω(n) space. [11] and has Correlation clustering. Correlation clustering was formulated by Bansal et al. been studied extensively. There are two common variants of the problem – maximizing agreement and minimizing disagreement. While these are equivalent for exact optimization (their sum is a constant), they look very different under an approximation lens. Maximizing agreement typically 3 admits constant factor approximations, but minimizing disagreement is much harder. In this paper, we focus on the maximum-agreement variant of correlation clustering and in particular we focus on (1 + ǫ)-approximations. Here, Ailon and Karnin [5] presented an approximation scheme with sublinear query complexity (which also yields a semi-streaming algorithm) for dense instances of correlation clustering. Giotis and Guruswami [19] described a sampling based algorithm combined with a greedy strategy which guarantees a solution within (ǫn2) additive error. (Their work is similar to the technique of Mathieu and Schudy [31].) Most recently, Ahn et al. [4] gave a single- pass semi-streaming algorithm for max-agreement. For bounded weights, they provide an (1 + ǫ)- approximation streaming algorithm and for graphs with arbitrary weights, they present a 0.766(1− ǫ)-approximation algorithm. Both algorithms require (nǫ−2) space. The key idea in their approach was to adapt multiplicative-weight-update methods for solving the natural SDPs for correlation clustering in a streaming setting using linear sketching techniques. 2 Definitions Definition 2.1 (MaxCut). Let G = (V, E, w) be a graph with weights w : E → R+. Let (A, B) be a partition of V and let w(A, B) denote the sum of weights of edges between A and B. Then MaxCut(G) = max(A,B) partition of V w(A, B). For ease of exposition, we will assume that the input graph for MaxCut is unweighted. Our techniques apply as long as all the weights are O(1). Also, we denote by ∆ the average degree, i.e., ij where for every edge ij we have c+ ij, c− ij and for each vertex, di =Pi∈Γ(j) ηij. We will also assume that all Moving now to correlation clustering, let G = (V, E, c+, c−) be a graph with edge weights c+ ij ij ≥ 0 and only one of them is nonzero. For every edge Pi,j wij/V . and c− ij ∈ E, we define ηij = c+ the weights are bounded by an absolute constant in magnitude (for simplicity, we assume it is 1). We define the "average degree" ∆ (used in the statements that follow) of a correlation clustering instance to be (Pi di)/n. same cluster and 0 otherwise. The MAX-AGREE score of this clustering is given by Pij c+ Pij c− Note that the objective value can be simplified toPij c− denotes the sumPij c− Definition 2.2 (MAX-AGREE correlation clustering). Given G = (V, E, c+, c−) as above, consider a partition of V into clusters C1, C2, . . . , Ck, and let χij be an indicator that is 1 if i an j are in the ijχij + ij(1 − χij). The goal is to find a partition maximizing this score. The maximum value of the ij + ηijχij = C − +Pij ηijχij, where C − We will also frequently use concentration bounds, which we state next. score over all partitions of V will be denoted by CC(G). ij − c− ij. 3 Preliminaries We will frequently appeal to Bernstein's inequality for concentration of linear forms of random variables. For completeness, we state it here. Theorem 3.1 (Bernstein's inequality[15]). Let the random variables X1,··· , Xn be independent i be the variance of X. Then, for any t > 0, with Xi − E[Xi] ≤ b for each i ∈ [n]. Let X =Pi Xi and let σ2 =Pi σ2 Pr[X − E[X] > t] ≤ exp(− 4 t2 2σ2(1 + bt/3σ2) ) A slightly more non-standard concentration inequality we use is from Boucheron, Massart and Lugosi [13]. It can be viewed as an exponential version of the classic Efron-Stein lemma. Theorem 3.2 ([13]). Assume that Y1,··· , Yn are random variables, and Y n 1 is the vector of these n random variables. Let Z = f (Y1,··· , Yn), where f : χn → R is a measurable function. De- fine Z (i) = f (Y1,··· , Yi−1, Y ′ n denote the independent copies of Y1,··· , Yn. Then, for all θ > 0 and λ ∈ (0, 1 θ ), i , Yi+1,··· , Yn), where Y1,··· , Y ′ log E[eλ(Z−E[Z])] ≤ log E[e λL+ θ ], λθ 1 − λθ where L+ is the random variable defined as L+ = E[ nXi=1 2 (Z − Z (i)) 1Z>Z (i)Y n 1 ]. 4 Technical overview We now present an outline of our main ideas. Suppose we have a graph G = (V, E). First, we define a procedure vertex sample. This takes as input probabilities pi for every vertex, and produces a random weighted induced subgraph. Sample a set S′ of vertices by selecting each vertex vi Procedure vertex sample ({pi}i∈V ). with probability pi independently. Define H to be the induced subgraph of G on the vertex set S′. For i, j ∈ S′, define wij = 1 Intuitively, the edge weights are chosen so that the total number of edges remains the same, in expectation. Next, we define the notion of an importance score for vertices. Let di denote the degree of vertex i. pipj∆2 .1 Definition 4.1. The importance score hi of a vertex i is defined as hi = min{1, max{di,ǫ∆} αǫ is an appropriately chosen parameter (for MaxCut, we set it to clustering, we set it to }, where C log n , and for correlation C log n , where C is an absolute constant). ǫ8 ∆2αǫ ǫ4 The main result is now the following: Theorem 4.2 (Core-set). Let G = (V, E) have an average degree ∆. Suppose we apply vertex sample with probabilities pi ∈ [hi, 2hi] to obtain a weighted graph H. Then H has eO( n ∆ ) vertices and the quantities MaxCut(H) and CC(H) are within a (1 + ǫ) factor of the corresponding quantities MaxCut(G) and CC(G), w.p. at least 1 − 1 n2 . While the number of vertices output by the vertex sample procedure is small, we would like a core-set of small "total size". This is ensured by the following. Procedure edge sample (H). Given a weighted graph H with total edge weight W , sample ε2W ), to obtain a graph H ′. each edge e ∈ E(H) independently with probability pe := min(1, 8S ′we Now, assign a weight we/pe to the edge e in H ′. The procedure samples roughly S′/ε2 edges, with probability proportional to the edge weights. The graph is then re-weighted in order to preserve the total edge weight in expectation, yielding: 1In correlation clustering, we have edge weights to start with, so the weight in H will be wij · c+ ij (or c− ij ). 5 Theorem 4.3 (Sparse core-set). Let G be a graph n vertices and average degree ∆ = nδ. Let H ′ be the graph obtained by first applying vertex sample and then applying edge sample. Then H ′ is a ǫ-core-set for MaxCut and CC, having size eO( n ∆ ) = eO(n1−δ). We then show how to implement the above procedures in a streaming setting. This gives: Theorem 4.4 (Streaming algorithm). Let G be a graph on n vertices and average degree ∆ = nδ, whose edges arrive in a streaming fashion in adversarial order. There is a two-pass streaming algo- rithm with space complexity eO( n and CC(G). ∆ ) = eO(n1−δ) for computing a (1+ǫ)-approximation to MaxCut(G) Of these, Theorem 4.2 is technically the most challenging. Theorem 4.3 follows via standard edge sampling methods akin to those in [2] (which show that w.h.p., every cut size is preserved). It is presented in Section 7, for completeness. The streaming algorithm, and a proof of Theorem 4.4, are presented in Section 8. In the following section, we give an outline of the proof of Theorem 4.2. 4.1 Proof of the sampling result (theorem 4.2): an outline In this outline we will restrict ourselves to the case of MaxCut as it illustrates our main ideas. Let G be a graph as in the statement of the theorem, and let H be the output of the procedure vertex sample. Showing that MaxCut(H) is at least MaxCut(G) up to an εn∆ additive term is easy. We simply look at the projection of the maximum cut in G to H (see, for instance, [16]). Thus, the challenge is to show that a sub-sample cannot have a significantly larger cut, w.h.p. The natural approach of showing that every cut in G is preserved does not work as 2n cuts is too many for the purposes of a union bound. There are two known ways to overcome this. The first approach is the one used in [22, 16] and [12]. These works essentially show that in a graph of average degree ∆, we need to consider only roughly 2n/∆ cuts for the union bound. If all the degrees are roughly ∆, then one can show that all these cuts are indeed preserved, w.h.p. There are two limitations of this argument. First, for i , where p is the sampling probability) can be large, and we cannot take a union bound over exp(n/∆) cuts. Second, the argument is combinatorial, and it seems difficult to generalize this to analyze non-uniform sampling. non-regular graphs, the variance (roughlyPi pd2 The second approach is via cut decompositions, developed in [18, 6]. Here, the adjacency matrix A is decomposed into poly(1/ε) rank-1 matrices, plus a matrix that has a small cut norm. It turns out that solving many quadratic optimization problems (including MaxCut) on A is equivalent (up to an additive εn∆) to solving them over the sum of rank-1 terms (call this A′). Now, the adjacency matrix of H is an induced square sub-matrix of A, and since we care only about A′ (which has a simple structure), [6] could show that MaxCut(H) ≤ MaxCut(G) + εn2, w.h.p. To the best of our knowledge, such a result is not known in the "polynomial density" regime (though the cut decomposition still exists). Our technique. We consider a new approach. While inspired by ideas from the works above, it also allows us to reason about non-uniform sampling in the polynomial density regime. Our starting point is the result of Arora et al. [10], which gives a method to estimate the MaxCut using a collection of linear programs (which are, in turn, derived using a sample of size n/∆). Now, by a double sampling trick (which is also used in the approaches above), it turns out that showing a sharp concentration bound for the value of an induced sub-program of an LP as above, implies Theorem 4.2. As it goes via a linear programming and not a combinatorial argument, analyzing non-uniform sampling turns out to be quite direct. Let us now elaborate on this high level plan. 6 Induced sub-programs. First, we point out that an analysis of induced sub-programs is also an essential idea in the work of [6]. The main difference is that in their setting, only the variables are sub-sampled (and the number of constraints remains the same). In our LPs, the constraints correspond to the vertices, and thus there are fewer constraints in the sampled LP. This makes it harder to control the value of the objective. At a technical level, while a duality-based argument using Chernoff bounds for linear forms suffices in the setting of [6], we need the more recent machinery on concentration of quadratic functions. We start by discussing the estimation technique of [10]. Estimation with Linear Programs. The rough idea is to start with the natural quadratic program for MaxCut: maxP(i,j)∈E xi(1 − xj), subject to xi ∈ {0, 1}.2 This is then "linearized" using a seed set of vertices sampled from G. We refer to Section 5 for details. For now, Est(G) is a procedure that takes a graph G and a set of probabilities {γi}i∈V (G), samples a seed set using γ, and produces an estimate of MaxCut (G). Now, suppose we have a graph G and a sample H. We can imagine running Est(G) and Est(H) to obtain good estimates of the respective MaxCut values. But now suppose that in both cases, we could use precisely the same seed set. Then, it turns out that the LPs used in Est(H) would be 'induced' sub-programs (in a sense we will detail in Section 6) of those used in Est(H), and thus proving Theorem 4.2 reduces to showing a sufficiently strong concentration inequality for sub-programs. The key step above was the ability to use same seed set in the Est procedures. This can be formalized as follows. Double sampling. Consider the following two strategies for sampling a pair of subsets (S, S′) of a universe [n] (here, qv ≤ pv for all v): • Strategy A: choose S′ ⊆ [n], by including every v w.p. pv, independently; then for v ∈ S′, include them in S w.p. qv/pv, independently. • Strategy B: pick S ⊆ [n], by including every v w.p. qv; then iterate over [n] once again, placing v ∈ S′ with a probability equal to 1 if v ∈ S, and p∗ v if v 6∈ S. Lemma 4.5. Suppose p∗ strategies A and B are identical. v = pv(1 − qv pv )/(1 − pv). Then the distribution on pairs (S, S′) obtained by The proof is by a direct calculation, which we state it here. Proof. Let us examine strategy A. It is clear that the distribution over S is precisely the same as the one obtained by strategy B, since in both the cases, every v is included in S independently of the other v, with probability precisely qv. Now, to understand the joint distribution (S, S′), we need to consider the conditional distribution of S′ given S. Firstly, note that in both strategies, S ⊆ S′, i.e., Pr[v ∈ S′v ∈ S] = 1. Next, we can write Prstrategy A[v ∈ S′v 6∈ S] as Prstrategy A[v ∈ S′ ∧ v 6∈ S] Prstrategy A[v 6∈ S] = pv pv(1 − qv 1 − pv ) . Noting that PrstrategyB[v ∈ S′v 6∈ S] = p∗ 2This is a valid formulation, because for every xi 6= xj that is an edge contributes 1 to the objective, and xi = xj v (by definition) concludes the proof. contribute 0. 7 To show the theorem, we use pv as in the statement of the theorem, Proof of Theorem 4.2. and set q to be the uniform distribution qv = 16 log n ε2∆ . The proof now proceeds as follows. Let S′ be a set sampled using the probabilities pv. These form the vertex set of H. Now, the procedure Est on H (with sampling probabilities qv/pv) samples the set S (as in strategy A). By the guarantee of the estimation procedure (Corollary 5.1.2), we have MaxCut(H) ≈ Est(H), w.h.p. Next, consider the procedure Est on G with sampling probabilities qv. Again, by the guarantee of the estimation procedure (Corollary 5.1.1), we have MaxCut(G) ≈ Est(G), w.h.p. Now, we wish to show that Est(G) ≈ Est(H). By the equivalence of the sampling strategies, we can now take the strategy B view above. This allows us to assume that the Est procedures use the same S, and that we pick S′ after picking S. This reduces our goal to one of analyzing the value of a random induced sub-program of an LP, as mentioned earlier. The details of this step are technically the most involved, and are presented in Section 6. This completes the proof of the theorem. (Note that the statement also includes a bound on the number of vertices of H. This follows immediately from the choice of pv.) 5 Estimation via linear programming We now present the estimation procedure Est used in our proof. It is an extension of [10] to the case of weighted graphs and non-uniform sampling probabilities. Let H = (V, E, w) be a weighted, undirected graph with edge weights wij, and let γ : V → [0, 1] denote sampling probabilities. The starting point is the quadratic program for MaxCut: max Pij∈E wijxi(1 − xj), subject to xi ∈ {0, 1}. The objective can be re-written asPi∈V xi(di − Pj∈Γ(i) wijxj), where di is the weighted degree, Pj∈Γ(i) wij. The key idea now is to "guess" the value of ρi :=Pj∈Γ(i) wijxj, by using a seed set of vertices. Given a guess, the idea is to solve the following linear program, which we denote by LPρ(V ). xi(di − ρi) − si − ti maximize Xi subject to ρi − ti ≤ Xj∈Γ(i) 0 ≤ xi ≤ 1, si, ti ≥ 0. wijxj ≤ ρi + si The variables are xi, si, ti. Note that if we fix the xi, the optimal si, ti will satisfy si + ti = ρi −Pj∈Γ(i) wijxj. Also, note that if we have a perfect guess for ρi's (coming from the MaxCut), i ∈ V is included w.p. γi independently. For every partition (A, S \ A) of S, set ρi =Pj∈Γ(i)∩A the objective can be made ≥ MaxCut(H). Estimation procedure. The procedure Est is the following: first sample a set S ⊆ V where each wij , γj and solve LPρ(V ) (in what follows, we denote this LP by LP γ A,S\A(V ), as this makes the partition and the sampling probabilities clear). Return the maximum of the objective values. Our result here is a sufficient condition for having Est(H) ≈ MaxCut(H). Theorem 5.1. Let H be a weighted graph on n vertices, with edge weights wij that add up to W . Suppose the sampling probabilities γi satisfy the condition Then, we have Est(H, γ) ∈ MaxCut(H) ± εW , with probability at least 1 − 1/n2 (where the probability is over the random choice of S). for all i, j. (1) wij ≤ W ε2 8 log n γiγjPu γu 8 The proof of the Theorem consists of claims showing the upper and lower bound separately. Claim 1. The estimate is not too small. I.e., w.h.p. over the choice of S, there exists a cut (A, S \ A) of S such that LPA,S\A(H) ≥ MaxCut(H) − εW . The estimate is not much larger than an optimal cut. Formally, for any feasible Claim 2. solution to the LP (and indeed any values ρi), there is a cut in H of value at least the LP objective. Proof of Claim 1. Let (AH , V \ AH ) be the max cut in the full graph H. Now consider a sample = S, and let (A, S \ A) be its projection onto S. For any vertex i, recall that ρi =Pj∈Γ(i)∩A Pj∈Γ(i)∩AH , where Yj is the indicator for j ∈ S. Thus wij γj wij γj Yj E[ρi] = Xj∈Γ(i)∩AH γj wij γj = Xj∈Γ(i)∩AH wij. We will use Bernstein's inequality to bound the deviation in ρi from its mean. To this end, note that the variance can be bounded as (1 − γj)w2 ij γj . Var[ρi] = Xj∈Γ(i)∩AH j ≤ Xj∈Γ(i) In what follows, let us write di =Pj∈Γ(i) wij and fi = W γi on the wij implies that wij Now, using Bernstein's inequality (Theorem 3.1), γj(1 − γj) Pu γu w2 ij γ2 γj ≤ ε2 Pr[ρi − E[ρi] > t] ≤ exp − . Then, for every j, our assumption 8 log n fi. Thus, summing over j, we can bound the variance by ε2difi 8 log n . t2 ε2difi 4 log n + 2t 3 8 log n! . ε2fi (2) Setting t = ǫ(di + fi), and simplifying, we have that the probability above is < exp(−4 log n) = 1 n4 . Thus, we can take a union bound over all i ∈ V , and conclude that w.p. ≥ 1 − 1 n3 , ≤ ε(di + fi) for all i ∈ V . (3) Q(x) :=Xi xi(cid:0)di − Xj∈Γ(i) wijxj(cid:1). 9 ρi − Xj∈Γ(i)∩AH (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) wij(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) xi(di − ρi) − ε(di + fi) ≥Xi Xi For any S that satisfies the above, consider the solution x that sets xi = 1 for i ∈ AH and 0 (eq. (3)). Thus the LP objective can be lower bounded as otherwise. We can choose si + ti = ρi −Pj∈Γ(i) wijxj ≤ ε(di + fi), by the above reasoning xi(di − Xj∈Γ(i) wijxj) − 2ε(di + fi). of the claim. This is precisely MaxCut(G) − 2εPi(di + fi) ≥ MaxCut(G) − 4εW . This completes the proof Proof of Claim 2. Suppose we have a feasible solution x to the LP, of objective value Pi xi(di − ρi)−Pi ρi −Pj∈Γ(i) wijxj, and we wish to move to a cut of at least this value. To this end, define the quadratic form The first observation is that for any x ∈ [0, 1]n, and any real numbers ρi, we have Q(x) ≥Xi xi(di − ρi) −Xi ρi − Xj∈Γ(i) wijxj. This is true simply because Q(x) =Pi xi(cid:0)di − ρi(cid:1) + xi(cid:0)ρi −Pj∈Γ(i) wijxj(cid:1), and the fact that the second term is at least −ρi −Pj∈Γ(i) wijxj, as xi ∈ [0, 1]. Next, note that the maximum of the form Q(x) over [0, 1]n has to occur at a boundary point, since for any fixing of variables other than a given xi, the form reduces to a linear function of xi, which attains maximum at one of the boundaries. Using this observation repeatedly lets us conclude that there is a y ∈ {0, 1}n such that Q(y) ≥ Q(x). Since any such y corresponds to a cut, and Q(y) corresponds to the cut value, the claim follows.3 Finally, to show Theorem 4.2 (as outlined in Section 4.1), we need to apply Theorem 5.1 with specific values for γ and wij. Here we state two related corollaries to Theorem 5.1 that imply good estimates for the MaxCut. Corollary 5.1.1. Let H in the framework be the original graph G, and let γi = 16 log n Then the condition wij ≤ ε2 ǫW , w.p. ≥ 1 − n−2. ε2∆ for all i. holds for all i, j, and therefore Est(G, γ) ∈ MaxCut(G) ± 8 log n · W γiγj Pu γu The proof is immediate (with a slack of 2), as wij = 1, W = n∆, and all γu are equal. Corollary 5.1.2. Let H be the weighted sampled graph obtained from vertex sample, and let γi = 16 log n . Then the condition (1) holds w.p. ≥ 1− n−3, and therefore Est(H, γ) ∈ MaxCut(H)± ε2∆ 1 pi ǫW w.p. ≥ 1 − n−2. Proof. In this case, we have wij = 1 pipj∆2 . Thus, simplifying the condition, we need to show that 1 pipj∆2 ≤ 2W pipj∆ 1 Pu∈H . 1 pu Now, for H sampled via probabilities pi, we have (in expectation) W = n A straightforward application of Bernstein's inequality yields that W ≥ n w.p. at least 1 − n−3. This completes the proof. ∆ , andPu∈H 2∆ and Pu∈H 1 pu = n. pu ≤ 2n, 1 6 Random induced linear programs We will now show that the Est on H has approximately the same value as the estimate on G (with appropriate γ values). First, note that Est(G) is maxA⊆S LP γ A,S\A(G), where γi = qi. To write the . For the graph H, the estimation procedure uses an identical program, but the sampling probabilities are now αi := . Also, pipj∆2 . LP, we need the constants ρi, defined by the partition (A, S\A) as ρi :=Pj∈Γ(i)∩A qi/pi, and the estimates ρ, which we now denote by eρi, are defined by eρi :=Pj∈Γ(i)∩A pi∆2 . The degrees are now edi :=Pj∈Γ(i)∩S ′ wij =Pj∈Γ(i)∩S ′ by the way we defined wij,eρi = ρi Our aim in this section is to show the following: The two LPs are shown in Figure 1. pjwij 1 qj qj 1 3We note that the proof in [10] used randomized rounding to conclude this claim, but this argument is simpler; also, later papers such as [17] used such arguments for derandomization. 10 max Xi∈G s.t. Xj∈Γ(i) − Xj∈Γ(i) [xi(di − ρi) − (si + ti)] xj ≤ ρi + si, ∀i ∈ [n] xj ≤ −ρi + ti, ∀i ∈ [n] max Xi∈S ′ s.t. Xj∈Γ(i)∩S ′ − Xj∈Γ(i)∩S ′ [xi(edi −eρi) − (si+ti)] wijxj ≤eρi + si, ∀i ∈ S′ wijxj ≤ −eρi + ti, ∀i ∈ S′ si, ti ≥ 0 ∀i ∈ S′ 0 ≤ xi ≤ 1 ∀i ∈ [n] 0 ≤ xi ≤ 1, (a) The LP on the full graph (b) The sampled LP Figure 1: The two LPs. Theorem 6.1. Let G be an input graph, and let (S, S′) be sampled as described in Section 4.1. Then, with probability ≥ 1 − 1 max A⊆S A,S\A(G) ≥ ∆2 · max A,S\A(H) − εn∆. n2 , we have LP γ LP α A⊆S Proof outline. To prove the theorem, the idea is to take the "strategy B" viewpoint of sampling (S, S′), i.e., fix S, and sample S′ using the probabilities p∗. Then, we only need to understand the behavior of an "induced sub-program" sampled with the probabilities p∗. This is done by considering the duals of the LPs, and constructing a feasible solution to the induced dual whose cost is not much larger than the dual of the full program, w.h.p. This implies the result, by linear programming duality. Let us thus start by understanding the dual of LP γ note that for any given z, the optimal choice of ui is max{0, di − ρi −Pj∈Γ(i) zj}; thus we can think of the dual solution as being the vector z. The optimal ui may thus be bounded by 2di, a fact that we will use later. Next, we write down the dual of the induced program, LP α A,S\A(H), as shown in Figure 2b. A,S\A(G) given A, shown in Figure 2a. We minimize Xi∈G ui + Xj∈Γ(i) ui + ρizi s.t. zj ≥ di − ρi ∀i ∈ V ui ≥ 0, −1 ≤ zi ≤ 1 ∀i ∈ V (a) The dual of LP γ A,S\A(G) minimize Xi∈S ′ ui + Xj∈Γ(i)∩S ′ s.t. [ui +eρizi] wij zj ≥ edi −eρi ∀i ∈ S′ ui ≥ 0, −1 ≤ zi ≤ 1 ∀i ∈ S′. (b) The dual of LP α A,S\A(H). the induced program Figure 2: The dual LPs Following the outline above, we will construct a feasible solution to LP (2b), whose cost is close to the optimal dual solution to LP (2a). The construction we consider is very simple: if z is the optimal dual solution to (2a), we set zi = zi for i ∈ S′ as the candidate solution to (2b). This is clearly feasible, and thus we only need to compare the solution costs. The dual objective values 11 are as follows DualG =Xi∈V ρizi + max{0, di − ρi − Xj∈Γ(i) DualH ≤Xi∈S ′eρizi + max{0, edi −eρi − Xj∈Γ(i)∩S ′ zj} wijzj} (4) (5) Note that there is a ≤ in (5), as zi = zi is simply one feasible solution to the dual (which is a minimization program). Next, our goal is to prove that w.p. at least 1 − 1 n2 , max A⊆S DualH ≤ 1 ∆2 · max A⊆S DualG + εn ∆ . Note that here, the probability is over the choice of S′ given S (as we are taking view-B of the sampling). The first step in proving the above is to move to a slight variant of the quantity DualH, which is motivated by the fact that Pr[Yi = 1] is not quite pi, but p∗ i (as we have conditioned on S). ij. ij := 1 j ∆2 . So also, let d∗ i p∗ p∗ ρi pi∆2 ), and w∗ i := ρi p∗ i :=Pj∈Γ(i) Yjw∗ (6) Let us defineeρ∗ Then, define Dual∗ i ∆2 (recall that eρi is H :=Xi∈S ′eρ∗ i zi + max{0, ed∗ H ≤ εn 2∆ . i − Xj∈Γ(i)∩S ′ i −eρ∗ w∗ ijzj}. A straightforward lemma, which we use here, is the following. Here we bound the difference between the "corrected" dual we used to analyze, and the value we need for the main theorem. Specifically, we bound DualH − Dual∗ Lemma 6.2. Let (S, S′) be sampled as in Section 4.1. Then w.p. at least 1 − 1 all z ∈ [−1, 1]n and for all partitions (A, S \ A) of S,4 DualH − Dual∗ H ≤ εn 2∆ . Proof. To prove the lemma, it suffices to prove that w.p. ≥ 1 − 1 n4 , Yjwij − w∗ n4 , we have that for ij ≤ εn 2∆ (7) . Xi Yieρi −eρ∗ i +Xi Yi Xj∈Γ(i) n4 over the choice of (S, S′), we have: This is simply by using the fact that zi are always in [−1, 1]. Before showing this, we introduce some notation and make some simple observations. First, denote by Y the indicator vector for S′ and by X the indicator for S. Observation 6.3. With probability ≥ 1 − 1 1. For all i ∈ V ,Pj∈Γ(i) qj ≤ 2(di + ε∆). 2. For all i ∈ V ,Pj∈Γ(i),j6∈S 3. Pi ≤ 2ε2n∆. 4. Pi6∈S ≤ 2n∆. 4Note that the partition defines the ρi. j ≤ 2(di + ε∆). Xi(di+ε∆) Yi(di+ε∆) Yj p∗ Xj p∗ i pi 12 All the inequalities are simple consequences of Bernstein's inequality (and our choice of parame- i , qi), and we thus skip the proofs. Next, note that as an immediate consequence of part-1, ters pi, p∗ we have ρi ≤ 2(di + ε∆), for all partitions (A, S \ A) of S. Also, note that from the definitions of the quantities (and the fact qi/pi ≤ ε2), we have Now, we are ready to show (7). The first term can be bounded as follows: (8) (9) (10) ∀i 6∈ S, ε2 p∗ i 1 p∗ 1 pi − (cid:12)(cid:12)(cid:12)(cid:12) i(cid:12)(cid:12)(cid:12)(cid:12) =Xi∈S i(cid:12)(cid:12)(cid:12)(cid:12) ≤ ∆2(cid:12)(cid:12)(cid:12)(cid:12) ρi Xi i =Xi Yieρi −eρ∗ Yiρi ∆2 (cid:12)(cid:12)(cid:12)(cid:12) 1 pi − 1 p∗ 1 pi − 1(cid:12)(cid:12)(cid:12)(cid:12) +Xi6∈S Yiρi ∆2 (cid:12)(cid:12)(cid:12)(cid:12) 1 pi − 1 p∗ i(cid:12)(cid:12)(cid:12)(cid:12) . Using (8) and part-3 of the observation, the first term can be bounded by O(ε2n/∆). For the second term, using (9) together with part-4 of the observation gives a bound of O(ε2n/∆). Thus the RHS above is at most εn 16∆ , as we may assume ε is small enough. Now, consider the second term in (7). When i 6∈ S and j 6∈ S, we have wij − w∗ ij being "small". We can easily bound by 2ε2w∗ ij, using (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 1 p∗ 1 p∗ i p∗ In the last steps, we used (9) and the fact that p∗ 1 pipj − 1 pipj − 1 i pj − p∗ i pj(cid:12)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) For i ∈ S or j ∈ S, we can simply bound wij − w∗ ij by 2wij. Thus we can bound the second +Xi6∈S pi∆2 Xj∈Γ(i) Yi j(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ i ∆2 Xj∈Γ(i)\S j(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:12)(cid:12) 4Xi∈S i ≤ pi for i 6∈ S. ε2 j ≤ i p∗ p∗ term in (7) as 2ε2 p∗ i p∗ j ε2 p∗ i pj 1 p∗ i p∗ ε2Yj pj Yj pj p∗ + 1 . . The second term has only a sum over j not in S – this is why have an extra 2 factor for the first term. Yj . pj j for j 6∈ S, we have Now, consider the first term. The inner summation can be written asPj∈Γ(i)∩S Using parts 1 and 2 of the observation, together with pj ≥ qj/αε, and pj ≥ p∗ Pj∈Γ(i) Let us thus consider the second term. Again using part 2 along with pj ≥ p∗ j for j 6∈ S, we can bound the inner sum by 2ε2(di + ε∆). Then we can appeal to part-4 of the observation to obtain the final claim. pj ≤ 4αε(di + ε∆). Then, using part-3 gives the desired bound on the first term. +Pj∈Γ(i)\S 1 pj Yj This ends up bounding the second term of (7), thus completing the proof of the lemma. Thus our goal is to show the following: Lemma 6.4. Let S satisfy the conditions (a) S ≤ 20n log n 2(di + ε∆). Then, w.p. ≥ 1 − 1 n4 over the choice of S′ given S, we have ε2∆ , and (b) for all i ∈ V ,Pj∈Γ(i)∩S 1 qj ≤ max A⊆S Dual∗ H ≤ 1 ∆2 · max A⊆S DualG + εn 2∆ . The condition (b) on S is a technical one that lets us bound ρi in the proofs. Given Lemma 6.2 and 6.4, it is easy to prove the Theorem 6.1 as follows: 13 Proof of Theorem 6.1. The conditions we assumed on S in Lemma 6.4 hold w.p. at least 1 − 1 n4 (via a simple application of Bernstein's inequality). Thus the conclusion of the lemma holds w.p. at least 1− 2 ∆2 maxA DualG + εn w.p. at least 1 − 3 n4 . Combining this with Lemma 6.2, we have that maxA DualH ≤ 1 n4 . The theorem then follows via LP duality. ∆ It thus suffices to prove Lemma 6.4. The main step is to show a concentration bound on a quadratic function that is not quite a quadratic form. This turns out to be quite technical, and we discuss it in the following sections. 6.1 Proof of Lemma 6.4 Let Yi = 1i∈S ′. For convenience, let us denote the max{} terms in equations (4) and (6) by ui and u∗ i , respectively. Now, Dual∗ H − 1 ∆2 DualG =Xi (cid:18)Yieρ∗ i zi − 1 ∆2 · ρizi(cid:19) +(cid:18)Yi u∗ i − 1 ∆2 · ui(cid:19) . (11) We view the RHS as two summations (shown by the parentheses), and bound them separately. The first is relatively easy. Recall that by definition, eρ∗ i ∆2(cid:0)Yi − p∗ i(cid:1). The expectation of this quantity is 0. We will apply Bernstein's inequality to bound its magnitude. For this, note that the variance is at most (using zi ≤ 1) i = ρi i ∆2 . Thus the first term is equal to p∗ Pi ρizi p∗ Xi ρ2 i )2∆4 p∗ i (p∗ i (1 − p∗ i ) ≤Xi 4(di + ε∆)2(1 − p∗ i ) p∗ i ∆4 . The condition on S gives the bound on ρi that was used above. Next, we note that unless p∗ we have p∗ 4αε·(di+ε∆) i ≥ (di+ε∆) αε∆2 . Thus the variance is bounded byPi ∆2 ≤ 8αεn ∆ . Next, i = 1, (Again, this is because we can ignore terms with p∗ Thus, by Bernstein's inequality, i = 1, and for the rest, we have a lower bound.) ≤ 2αε. i max p∗ i ∆2 ρizi p∗ 2(di + ε∆) i ∆2(cid:12)(cid:12)(cid:12)(cid:12) ≤ (cid:12)(cid:12)(cid:12)(cid:12) i(cid:1)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ t] ≤ exp − i ∆2(cid:0)Yi − p∗ ρizi p∗ Pr[(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xi t2 ∆ + 2tαε! . 16αεn Setting t = εn/4∆, the bound simplifies to exp(− ε2n αε and our size bound on S, this is < exp(−S)/n4. to be important) of splitting it into two terms by adding a "hybrid" term, as follows: The second term of (11) requires most of the work. We start with the trick (which turns out ), for a constant C. Thus, by our choice of C∆αε Xi Yi u∗ i − 1 ∆2 · ui =Xi (cid:18)Yi u∗ i − Yi ui i ∆2(cid:19) +Xi (cid:18)Yi p∗ ui i ∆2 − p∗ 1 ∆2 · ui(cid:19) . The second term will again be bounded using Bernstein's inequality (in which we use our earlier observation that ui = O(di)). This gives an upper bound of εn/8∆, with probability 1 − exp(−S)/n4. We omit the easy details. 14 Let us focus on the first term. We now use the simple observation that max{0, A}−max{0, B} ≤ Showing a concentration bound for such a quadratic function will be subject of the rest of the i , it cancels out. Now, writing cj = 1 − zj (which now ∈ [0, 2]) and using A − B, to bound it by w∗ ijzj − i , we can bound the above by Yi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)ed∗ Xi i − Xj∈Γ(i)∩S ′ i −eρ∗ By the definition of eρ∗ the definition of ed∗ Yi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i ∆2 cj(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Yi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Γ(i) Xi f (Y ) := f (Y1, . . . , Yn) :=Xi section. Let us define =Xi Xj∈Γ(i) ijcj − 1 p∗ Yjw∗ . zj(cid:1)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 1 p∗ i ∆2(cid:0)di − ρi − Xj∈Γ(i) j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) w∗ ijcj(Yj − p∗ Yi(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Γ(i) j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (using w∗ ij = 1 j ∆2 ) p∗ i p∗ w∗ ijcj(Yj − p∗ . (12) We wish to show that Pr[f > εn ∆ ] ≤ exp(−S). Unfortunately, this is not true – there are counter-examples (in which the neighborhoods of vertices have significant overlaps) for which it is not possible to obtain a tail bound better than exp(−n/∆2), roughly speaking. To remedy this, we resort to a trick developed in [22, 16]. The key idea is to condition on the event that vertices have a small weighted degree into the set S′, and obtain a stronger tail bound. "Good" conditioning. We say that a choice of Y 's is good if for all i ∈ V , we have Xj∈Γ(i) w∗ ijYj ≤ ε∆ + 2di p∗ i ∆2 . The first lemma is the following. Lemma 6.5. Let H be the weighted graph on S′ obtained by our algorithm. For any vertex i ∈ V , we have Yj p∗ j(cid:17). The term in the paren- ε , together with j ≤ αε∆ 1 p∗ Pr Xj∈Γ(i) w∗ ijYj > ε∆ + 2di p∗ 1 n6 . i ∆2  < i ∆2(cid:16)Pj∈Γ(i) ijYj = 1 p∗ thesis has expectation precisely di. Thus, applying Bernstein using maxj Proof. Fix some i ∈ V , and consider Pj∈Γ(i) w∗ Pj∈Γ(i) j )2 ≤ di maxj j (1−p∗ p∗ j ) (p∗ , we have 1 p∗ j Yj p∗ j Pr(cid:2) Xj∈Γ(i)∩VH exp(cid:18)− > di + t(cid:3) ≤ exp(cid:18)− (2di + ε∆)αε∆(cid:19) ≤ exp(cid:18)− ε(di + ε∆)2 εt2 (di + t)αε∆(cid:19) . ε2 2αε(cid:19) < 1 n6 . By setting t = (di + ε∆), the RHS above can be bounded by This completes the proof, using our choice of αε. 15 Conditioning on the Y being good, we show the following concentration theorem. Theorem 6.6. Let Yi's be independent random variables, that are 1 w.p. p∗ let f (Y ) be defined as in (12). Then we have i and 0 otherwise, and Pr(cid:2)f (Y ) ≥ εn 8∆ (cid:12)(cid:12) Y is good(cid:3) ≤ 1 n5 · e−20n log n/ε2 . We observe that the theorem implies Lemma 6.4. This is because by the Theorem and the , for any A ⊆ S. Thus n5 . Since the H − DualG ≤ εn/∆ Y good] ≥ 1 − exp(−S) H − maxA DualG ≤ εn/∆ Y good] ≥ 1 − 1 preceeding discussions, Pr[Dual∗ by union bound over A, Pr[maxA Dual∗ probability of the good event is at least 1 − 1 6.2 Concentration bound for quadratic functions n5 (by Lemma 6.5), the desired conclusion follows. n5 To conclude our proof, it suffices to show Theorem 6.6. To bound the quadratic function f , we bound the moment generating function (MGF), E[eλf good]. This is done via a decoupling argument, a standard tool for dealing with quadratic functions. While decoupling is immediate for 'standard' quadratic forms, the proof also works for our f (which has additional absolute values). The rest of the proof has the following outline. Proof outline. The main challenge is the computation of the MGF under conditioning (which introduces dependencies among the Yi, albeit mild ones). The decoupling allows us to partition vertices into two sets, and only consider edges that go across the sets. We then show that it suffices to bound the MGF under a "weakened" notion of conditioning (a property we call δ-good). Under this condition, all the vertices in one of the sets of the partition become independent, thus allowing a bound on the moment - in terms of quantities that depend on the variables on the other set of the partition. Finally, we appeal to a strong concentration bound of Boucheron et al. [13] to obtain an overall bound, completing the proof. We now expand the proof outline above. Decoupling. Consider independent Bernoulli random variables δi that take values 0 and 1 w.p. 1/2 each, and consider the function fδ :=Xi δiYi Xj∈Γ(i) (1 − δj)w∗ ijcj(Yj − p∗ j ) Using the fact that E[g(x)] ≥ E[g(x)] for any function g, and defining Eδ as the expectation with respect to the δi's, we have (1 − δj)w∗ ijcj(Yj − p∗ j ) =Xi 1 2 · YiEδ Xj∈Γ(i) (1 − δj)w∗ ijcj(Yj − p∗ j ) 1 Eδfδ = EδXi ≥Xi =Xi δiYi Xj∈Γ(i) 2 · Yi Xj∈Γ(i) 4 · Yi Xj∈Γ(i) 1 Eδ(1 − δj)w∗ ijcj(Yj − p∗ j ) ijcj(Yj − p∗ w∗ j ) = 1 4 f We used the fact that i never appears in the summation term involving Yi to obtain the first equality. Next, using Jensen's inequality, we have: EY [eλf good] ≤ EY [e4λEδ fδ good] ≤ EY,δ[e4λfδ good] 16 where EY,δ means the expectation with respect to both random variables Y and δ. Now, the interpretation of fδ is simply the following. Consider the partitioning (V +, V −) of V defined by V + = {i ∈ [n] : δi = 1} and V − = {i ∈ [n] : δi = 0}, then ijcj(Yj − p∗ w∗ Yi(cid:12)(cid:12) Xj∈Γ(i)∩V − For convenience, define Ri = Pj∈Γ(i)∩V − w∗ j ), for i ∈ V +. Thus we can write fδ = Pi∈V + YiRi. The condition that Y is good now gives us a bound on Ri. For any cj (it is important to note that the good condition does not involve the constants cj, as those depend on the LP solution; all we know is that 0 ≤ cj ≤ 2), we have ij(Yj + p∗ fδ = Xi∈V + ijcj(Yj − p∗ j )(cid:12)(cid:12). 2w∗ Ri ≤(cid:12)(cid:12) Xj∈Γ(i)∩V − j )(cid:12)(cid:12) 2di i ∆2 ≤ p∗ Now, the quantity we wish to bound can be written as 2(ε∆ + 2di) p∗ i ∆2 ≤ + 2ε∆ + 6di . p∗ i ∆2 [eλf good] ≤ E Y,δ E Y [e4λfδ good] ≤ E δ E Y − E Y + [e4λ Pi∈V + YiRi good]. (13) The key advantage that decoupling gives us is that we can now integrate over Yi ∈ V +, i.e., evaluate the innermost expectation, for any given choice of {Yi : i ∈ V −} (which define the Ri). The problem with doing this in our case is that the good condition introduces dependencies on the Yi, for i ∈ V +. Fortunately, weakening conditioning does not hurt much in computing expectations. This is captured by the following simple lemma. Lemma 6.7. Let Ω be a space with a probability measure µ. Let Q1 and Q2 be any two events such that Q1 ⊂ Q2, and let Z : Ω 7→ R+ be a non-negative random variable. Then, E[ZQ1] ≤ E[ZQ2] Pr[Q1] . Proof. Let Ω1 (resp. Ω2) be the subset of Ω in which Q1 (resp. Q2) is satisfied. By hypothesis, Ω1 ⊆ Ω2. Now by the definition of conditional expectation, and the non-negativity of Z, we have E[XQ1] = Z(x)µ(x)dx ≤ 1 µ(Q1)Zx∈Ω1 1 µ(Q1)Zx∈Ω2 Z(x)µ(x)dx = µ(Q2) µ(Q1) E[ZQ2]. Since µ(Q2) ≤ 1, the conclusion follows. Weaker good property. The next crucial notion we define is a property "δ-good". Given a δ ∈ {0, 1}n (and corresponding partition (V +, V −)), a set of random variables Y is said to be δ-good if for all i ∈ V +, we have Xj∈Γ(i)∩V − w∗ ijYj ≤ ε∆ + 2di p∗ i ∆2 . (14) We make two observations. First, the good property implies the δ-good property, for any choice of δ. Second, and more crucial to our proof, conditioning on δ-good does not introduce any 17 dependencies on the variables {Yi : i ∈ V +}. Now, continuing from (13), and using the fact that the good condition holds with probability > 1/2, we have E δ E Y − E Y + [e4λ Pi∈V + YiRi good] ≤ E δ E Y − E Y + [2e4λ Pi∈V + YiRi δ-good]. E Now for any 0/1 choices for variables Y −, the Ri's get fixed for every i ∈ V +, and we can bound Y +[e4λ Pi∈V + YiRi Ri] easily. Lemma 6.8. Let Yi be independent random 0/1 variables taking value 1 w.p. p∗ given, for i ∈ V +. Suppose λ > 0 satisfies λRi ≤ 1 for all i. Then i R2 i Ri+λ2p∗ i . i , and let Ri be E Y +[eλ Pi∈V + YiRi] ≤ ePi∈V + λp∗ Proof. Since the lemma only deals with i ∈ V +, we drop the subscript for the summations and expectations. One simple fact we use is that for a random variable Z with Z ≤ 1, Using this, and the independence of Yi together with Y 2 E[eZ ] ≤ E[1 + Z + Z 2] ≤ eE[Z]+E[Z 2]. E[eλ P YiRi] =Y E[eλYiRi] ≤Y eE[λYiRi]+E[λ2R2 i = Yi, i Yi]. As E[Yi] = p∗ i , this completes the proof of the lemma. Using the lemma, replacing λ with 4λ yields the following E δ E Y − E Y + [e4λ Pi∈V + YiRi δ-good] ≤ E δ The second term in the summation is already small enough. I.e., using (14) i Ri+16λ2p∗ i R2 i δ-good(cid:3). E Y −(cid:2)ePi∈V + 4λp∗ i ≤ 2λ2αε n ∆ . λ2p∗ i R2 Xi∈V + (15) (16) While the bound on Ri can be used to bound the first term, it turns out that this is not good enough. We thus need a more involved argument. Thus the focus is now to bound E δ E Y −(cid:2)eλg(Y ) δ-good(cid:3), where g(Y ) := Xi∈V + Xj∈Γ(i)∩V − w∗ ijcj(Yj − p∗ . p∗ i(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Outline: concentration bound for g. To deduce a concentration bound for g, we first remove the conditioning (again appealing to Lemma 6.7). This then gives us independence for the Yj, for j ∈ V −. We can then appeal to the fact that changing a Yj only changes g by a small amount, to argue concentration. However, the standard "bounded differences" concentration bound ([13], Theorem ...) will not suffice for our purpose, and we need more sophisticated results [13] (restated as Theorem 3.2). To use the same notation as the theorem, define Z = g(Y ), where we only consider Yr, r ∈ V −. Now, for any such r, consider Z − Z (r). Since Z (r) is obtained by replacing Yr by an independent Y ′ r and re-computing g, we can see that the only terms i which could possibly be affected are i ∈ Γ(r) ∩ V +. Further, we can bound the difference Z − Z (r) by i w∗ 2p∗ ir, Z − Z (r) ≤ Yr − Y ′ r Xi∈Γ(r)∩V + 18 where we have used cr ≤ 2. The summation can be bounded by 2dr Then, to use the theorem, we need r ∆2 . Denote this quantity by θr. p∗ EY ′ rZ − Z (r)2 ≤ Yr − Y ′ r2θ2 r ≤ Yr − Y ′ rθ2 r ≤ Yrθ2 r + p∗ rθ2 r . We used the fact that Yr − Y ′ r ∈ {0, 1}. Now applying Theorem 3.2 by setting θ = 1 V −[eλ(g−E[g])] ≤ E λ2 2 Pr∈V − Yrθ2 V −[e rθ2 r ] r +p∗ E 2λ , we have: Once again, since λθr will turn out to be < 1, we can use the bound E[eλ2Yrθ2 conclude that r /2] ≤ eλ2θ2 r p∗ r , and E V −[eλ(g−E[g])] ≤ e2λ2 Pr∈V − p∗ rθ2 r ≤ e4λ2αε n ∆ . The last inequality is due to a reasoning similar to earlier. We are nearly done. The only step that remains for proving Theorem 6.6 is to obtain a bound on E[g]. For this, we need to bound, for any i, the term By Cauchy-Schwartz and the fact that Yj are independent, we have w∗ ijcj(Yj − p∗ j )]. E[Ri] = E[ Xj∈Γ(i)∩V − i ] = Xj∈Γ(i)∩V − 1 − p∗ i )2∆4 Xj∈Γ(i) j ≤ p∗ (w∗ (p∗ ≤ 1 j E[Ri]2 ≤ E[R2 ij)2cjp∗ j (1 − p∗ j ) αεdi i )2∆3 . ε(p∗ j ≤ αε∆/ε. Thus we have d1/2 i ≤(cid:16) αε ε∆3(cid:17)1/2 n∆1/2 ≤ n ∆(cid:16) αε ε (cid:17)1/2 . To complete the bound, we end up setting λ = ε αε . For this value of λ, we must ensure that ε αε (dr + ε∆) r∆2 ≤ 1, p∗ which is indeed true. 7 Sparse Core-set for Max-Cut In Theorem 4.2, we have shown that there is a core-set (i.e., a smaller weighted graph with the same MAXCUT value) with a small number of vertices. We now show that the number of edges can also be made small (roughly n/∆). This will prove Theorem 4.3. We start with a lemma about sampling edges in graphs with edge weights ≤ 1. (We note that essentially the same lemma is used in several works on sparsifiers for cuts.) 19 p∗ j )/p∗ E[Xi∈V + We have used the fact that (1 − p∗ iRi] ≤(cid:16) αε 4 · εn ∆ . ≤ exp(cid:16)λ ε∆3(cid:17)1/2Xi From our choice of αε, this is < 1 εn 4∆ + λ2αε n ∆(cid:17) . Putting everything together, we get that the desired moment Lemma 7.1. Consider the weighted graph H resulted from vertex sample, defined on set of vertices S′ in which wij < 1. If we apply edge sample on H, then the resulted graph H ′ have with probability at least 1 − 1 n2 . MaxCut(H ′) ± (1 + ǫ)MaxCut(H) Let us first see that the lemma gives us Theorem 4.3. Proof of Theorem 4.3. We only need to verify the bound on the number of edges. As every edge is sampled with probability pij = min(1, 8wij ε2 ), and since the total edge weight is normalized to be S′, we have that the expected number of edges is ≤ 8S ′ n4 , this is at most ε2 , and w.p. at least 1 − 1 16S ′ ε2 , completing the proof. 7.1 Proof of Edge Sampling We now prove Lemma 7.1. Proof. Recall that in edge sample algorithm we first rescale the edge weights so that they sum up to S′, and then sample each edge ij in the resulted graph (also denoted H, as we can assume it to to be a pre-processing) with probability pij = min(wij obtain the graph H ′. Define the indicator variable Xij for each edge eij in graph H, where Xij = 1 if the corresponding edge eij is selected by edge sample and Xij = 0 otherwise. ǫ2 , 1) and reweigh the edges to w′ ij = wij pij 8 Our goal is to show that all cuts are preserved, w.h.p. Consider any cut (A, B) in H. Call the A,B. set of all the edges on this cut as CA,B and the set of in the cut on the sampled graph H ′ as C ′ wij and w′(C ′ w′ ij. Then we have, A,B)] = E[X w′ ijXij] =X w′ ij Pr(Xij = 1) =X pijw′ ij =X wij = w(CA,B). We will now apply Bernstein's inequality to bound the deviation. For this, the variance is first bounded as follows. Var[X w′ ijXij] =X w′ ij 2 Var(Xij) ≤X w2 ij pij (1 − pij) ≤ ǫ2 8 X wij = ǫ2 8 w(CA,B) We used the inequality that unless pij = 1 (in which case the term drops out), we have wij/pij ≤ ε2/8. By the observation on wij/pij above, we can use Bernstein's inequality 3.1 with b = ε2/8, to Set w(CA,B) =Peij ∈CA,B E[w′(C ′ A,B) =Peij ∈C ′ A,B obtain Pr[X w′ ijXij − w(CA,B) ≥ t] ≤ exp − t2 ε2w(CA,B ) 4 8 ! . + tε2 Setting t = εW , where W is the sum of all the edge weights (which is equal to S′ after the pre-processing), the bound above simplifies to exp(−2S′), and thus we can take a union bound over all cuts. This completes the proof. 8 A 2-pass streaming algorithm We now show how our main core set result can be used to design a streaming algorithm for MaxCut. The algorithm works in two passes: the first pass builds a core-set S of size eO(n/∆) as prescribed by Theorem 4.2 and the second pass builds the induced weighted graph G[S] and computes its max cut. This algorithm works under edge insertion/deletion. 20 8.1 Pass 1: Building a core set To construct S, Theorem 4.2 states that each vertex must be sampled with probability pi, where pi ≥ hi and hi = min(1, max(di,ǫ∆) ) is the importance score of a vertex. As the goal is to only choose a small number of vertices, we will also make sure that pi ≤ 2hi. The challenge here is two-fold: we need to sample (roughly) proportional to the degree di, which can only be computed after the stream has passed, and we also need the actual value of pi (or a close enough estimate of it) in order to correctly reweight edges in the second pass. ∆2αǫ The degree di of a vertex i is the "count" of the number of times i appears in the edge stream. To sample with probability proportional to di we will therefore make use of streaming algorithms for ℓ1-sampling [32, 8, 23]. We borrow some notation from [8]. Definition 8.1. Let ρ > 0, f ∈ [1, 2]. A (ρ, f )-approximator to τ > 0 is a quantity τ such that τ /f − ρ ≤ τ ≤ f τ + ρ Lemma 8.2 ([23] (rephrased from [8])). Given a vector x ∈ Rn and parameters ǫ, δ > 0, c > 0 there exists an algorithm A that uses space O(log(1/ǫ)ǫ−1 log2 n log(1/δ)) and generates a pair (i, v) from a distribution Dx on [1 . . . n] such that with probability 1 − δ • Dx(i) is a ( 1 • v is a (0, 1 + ǫ)-approximator to xi nc , 1 + ǫ)-approximator to xi/kxk1 where c is a fixed constant. We will also need to maintain heavy hitters: all vertices of degree at least ∆2 (up to constants). To do this, we will make use of the standard CountMin sketch [14]. For completeness, we state its properties here. Lemma 8.3 ([14]). Fix parameters k, δ > 0. Then given a stream of m updates to a vector x ∈ Rn there is a sketch CM of size O(k log δ−1(log m + log n)) and a reconstruction procedure f : [n] → R such that with probability 1 − δ, for any xi, xi − f (i) ≤ kxk1/k Outline. We will have a collection of r, roughly n/∆ ℓ1-samplers. These samplers will together give a good estimate ((1 + ε)-approximation) of the importance hi for all the vertices that have a small degree (which we define to be < αε∆2). Then, we use the CM sketch to maintain the degrees of all the 'high degree' vertices, i.e., those with degrees ≥ αε∆2. Taken together, we obtain the desired sampling in the first pass. Definition 8.4. Given two sets of pairs of numbers S, S′, let S∪maxS′ = {(x, max(x′,y)∈S∪S ′,x′=x y)} Lemma 8.5. Let S = {(i, vi)} be the set returned by Algorithm 1. Then ∆(cid:1). • S has size eO(cid:0) n • Each i ∈ [n] is sampled with probability pi that is (0, 1 + ǫ) approximated by vi and that (n−c, 1 + ǫ)-approximates hi. Proof sketch. Consider any vertex i with di ≥ ∆2αǫ. By Lemma 8.3, such a vertex will report a count of at least f (i) = (1− ζ)∆2αǫ and thus is guaranteed to be included in Sh. Its reported score vi = 1 satisfies the requirement of the Lemma. Secondly, consider any vertex with degree di < ǫ∆. For such a vertex, hi = ǫ/∆αǫ and thus it is included in Sl with the desired probability and vi. Finally, consider a vertex i with ǫ∆ ≤ di < ∆2αǫ. The probability that none of the ℓ1-samplers yield i is (1− di/n∆)r, and since di/n∆ ≪ 1, this can be approximated as (1− rdi/n∆). Thus, the probability of seeing i is rdi/n∆ = di/∆2αǫ as desired. Corollary 8.5.1. For each (i, vi) ∈ S, hi ≤ vi ≤ 2hi. 21 Algorithm 1 Given n and average degree ∆ Initialize Sl, Sm, Sh ← ∅, and ζ = αε. Sample elements from [1 . . . n] each with probability ǫ/∆αǫ. For each sampled i add (i, ǫ/∆αǫ) to Sl. Fix ζ > 0. Initialize a CountMin sketch CM with size parameter k = n/∆ζ 2. Let f be the associated reconstruction procedure. Initialize r = O(n/∆αǫ) copies A1 . . . Ar of the algorithm A from Lemma 8.2. for each stream update (i, w) (a vertex to which current edge is incident, and weight) do Update each Aj, 1 ≤ j ≤ r. Update CM. end for for j = 1 to r do Sample (i, v) from Aj. Sm = Sm ∪max {(i, v)} end for Sh = {(i, 1) f (i) ≥ (1 − ζ)∆2αǫ} return Sl ∪max Sm ∪max Sh 8.2 Pass 2: Building the induced weighted graph The first pass produces a set S of eO(n/∆) vertices together with estimates vi for their importance score hi. If we weight each edge ij in G[S] by wij = 1/vivj∆2, Theorem 4.2, along with Corol- lary 8.5.1 guarantee that a MaxCut in the resulting weighted graph is a good approximation of the true max cut. Thus, knowing S, constructing the re-weighted G[S] in the second pass is trivial if we had space proportional to the number of edges in G[S]. Unfortunately this can be quadratic in S, so our goal is to implement the edge sampling of Theorem 4.3 in the second pass. This is done as follows: we maintain a set of edges E′. Every time we encounter an edge ij with i, j ∈ S, we check to see if it is already in E′. If not, we toss a coin and with probability pij = min(1, wij log n/ǫ2) we insert (i, j, wij /pij) into E′. By Lemma 7.1, the size of E′ is eO(n/∆), and the resulting graph yields a (1 + ǫ) approximation to the MaxCut. 9 Correlation Clustering Our argument for correlation clustering parallels the one for MaxCut. The MAX-AGREE variant of correlation clustering, while not a CSP (as the number of clusters is arbitrary), almost behaves as one. We start with two simple observations. The first is that we can restrict the number of clusters to 1/ε, for the purposes of a (1 + ε) approximation (Lemma 9.1) . Next, observe that the optimum objective value is at least max{C +, C −} ≥ n∆/2. This is simply because placing all the vertices in a single cluster gives a value C +, while placing them all in different clusters gives C −. Thus, it suffices to focus on additive approximation of εn∆. Lemma 9.1. Let C be the optimal clustering, and let OPT be its max-agree cost. Then there exists a clustering C′ that has cost ≥ (1 − O(ε))OP T , and has at most 1/ε clusters. The lemma is folklore in the correlation clustering literature. Proof. Let A1, A2, . . . , Ak be the clusters in the optimal clustering C. Now, suppose we randomly color the clusters with t = 1/ε colors, i.e., each cluster Ai is colored with a random color in [t]. 22 We then merge all the clusters of a given color into one cluster, thus obtaining the clustering C′. Clearly, C′ has at most t colors. Now, we observe that if u, v ∈ Ai to begin with, then u, v are still in the same cluster in C′. But if u ∈ Ai and v ∈ Aj, and the colors of Ai and Aj are the same, then u and v are no longer separated in C′. Let us use this to see what happens to the objective. Let χuv be an indicator for u, v being in the same cluster in the optimal clustering C, and let χ′ uv be a similar indicator in C′. The original objective is C − +Xij ηijχij. From the above reasoning, if χuv = 1, then χ′ uv] = 1/t, i.e., there is a probability precisely 1/t = ε that the clusters containing u, v now get the same color. Thus, we can write the expected value of the new objective as uv = 1. Also, if χuv = 0, E[χ′ C − +Xij ηijχij + εXij ηij(1 − χij). Let us denote S =Pij ηijχij and S′ =Pij ηij(1 − χij). Then by definition, we have S + S′ = Pij ηij = C + − C −. Now, to show that we have a (1 − ε) approximation, we need to show that C − + S + εS′ ≥ (1 − ε)(C − + S). This simplifies to C − + S + S′ ≥ 0, or equivalently, C + ≥ 0, which is clearly true. This completes the proof. Once we fix the number of clusters k, we can write correlation clustering as a quadratic program in a natural way: for each vertex i, have k variables xiℓ, which is supposed to indicate if i is given the label ℓ. We then have the constraint thatPℓ xiℓ = 1 for all i. The objective function then has a clean form: Xij [ kXℓ=1 xiℓ(1 − xjℓ)c− ij + xiℓxjℓc+ ij] =Xij Xℓ xiℓc− xiℓ(ρiℓ + d− i ), ij + xiℓxjℓηij =Xi,ℓ i =Pj c− ij. where xiℓ = 1 iff vertex i ∈ Cℓ, and ρiℓ =Pj∈Γ(i) xjℓηij and d− Note the similarity with the program for MaxCut. We will show that the framework from Section 4.1 carries over with minor changes. The details of the new Est procedure can be found in Section 9.1 (it requires one key change: we now need to consider k-partitions of the seed set in order to find ρ). The duality based proof is slightly more involved; however we can use the same rough outline. The proof is presented in Section 9.2. 9.1 LP Estimation Procedure for Correlation Clustering Let H = (V, E, c) be a weighted, undirected graph with edge weights c+ ij as before, and let γ : V → [0, 1] denote sampling probabilities. We define EstC(H, γ) to be the output of the following randomized algorithm: sample a set S by including each vertex i in it w.p. γi independently; next, for each partition (A1,··· , Ak) of S, solve the LP defined below, and output the largest objective value. ij and c− 23 LPA1,··· ,Ak (V ) is the following linear program. (As before, we use constants ρiℓ :=Pj∈Γ(i)∩Aℓ ηij γj .) xiℓ(ρiℓ + d− maximize Xi subject to ρiℓ − tiℓ ≤ Xj∈Γ(i) i ) − (siℓ + tiℓ) ηijxjℓ ≤ ρiℓ + siℓ ∀i, ℓ Xℓ xiℓ = 1 ∀i ∈ [n] siℓ, tiℓ ≥ 0 ∀i, ℓ Once again, the best choice of siℓ, tiℓ for each pair i, ℓ are so that siℓ + tiℓ = ρiℓ −Pj∈Γ(i) ηijxjℓ. We now show a result analogous to the one earlier – that under appropriate conditions, EstC is approximately equal to the optimal correlation clustering objective value. Theorem 9.2. Let H be a weighted graph on n vertices with edge weights c+ Suppose the sampling probabilities γi satisfy the condition ij, c− ij that add up to W . wij ≤ W ε2 8k2 log n γiγjPu γu for all i, j. (17) Then, we have EstC(H, γ) ∈ CC(H)± εW , with probability at least 1− 1/n2 (where the probability is over the random choice of S). Note that the only difference is the k2 term in (17). Proof. As before, the proof follows from two complementary claims. Claim 1. W.h.p. over the choice of S, there exists a partitioning (A1,··· , Ak) of S such that LPA1,··· ,Ak (H) ≥ CC(H) − εW . Claim 2. Consider any feasible solution to the LP above (for some values ρiℓ, siℓ, tiℓ). There exists a partitioning in H of objective value at least the LP objective. The proof of Claim 1 mimics the proof in the case of MAXCUT. We use Bernstein's inequality for every ℓ ∈ [k] with deviation being bounded by ε(di + ∆)/k in each term. This is why we need an extra k2 term in the denominator of (17). We omit the details. Proof of Claim 2. Suppose we have a feasible solution x to the LP of objective valuePi,ℓ xiℓ(d− ρiℓ) −Pi,ℓ ρiℓ −Pj∈Γ(i) ηijxjℓ, and we wish to move to a partitioning of at least this value. To this end, define the quadratic form i + Q(x) :=Xi,ℓ xiℓ(cid:0)d− i + Xj∈Γ(i) ηijxjℓ(cid:1). The first observation is that for any x ∈ [0, 1]nk, and any real numbers ρi, we have xiℓ(d− Q(x) ≥Xi,ℓ ρiℓ − Xj∈Γ(i) This is true simply because Q(x) =Pi,ℓ xiℓ(cid:0)d− the second term is at least −ρiℓ −Pj∈Γ(i) ηijxjℓ, as xi ∈ [0, 1]. i + ρiℓ) −Xi,ℓ ηijxjℓ. i + ρiℓ(cid:1) − xiℓ(cid:0)ρiℓ −Pj∈Γ(i) ηijxjℓ(cid:1), and the fact that Next, note that the maximum of the form Q(x) over [0, 1]nk has to occur at a boundary point, since for any fixing of variables other than the ith group of variables xi1,··· , xik for a given i, the 24 form reduces to a linear function of xiℓ, 1 ≤ ℓ ≤ k, which attains maximum at one of the boundaries when subject to the constraint Pℓ xiℓ = 1. Using this observation repeatedly for i ∈ [n] lets us conclude that there is a y ∈ {0, 1}nk such that Q(y) ≥ Q(x). Since any such y corresponds to a partitioning, and Q(y) corresponds to its objective value, the claim follows. This completes the proof of Theorem 9.2. As in the case of MAXCUT, we can show that the estimation procedure can be used for estimating both in the original graph (with uniform probabilities qi), and with the graph H, with sampling probabilities qi/pi. We thus skip stating these claims formally. 9.2 Induced Linear Programs for Correlation Clustering We next need to prove that the EstC procedures have approximately the same values on G and H (with appropriate γ's). To show this, we consider a sample (S, S′) drawn as before, and show that max (A1,··· ,Ak):S LP γ A1,··· ,Ak (V ) ≥ ∆2 max (A1,··· ,Ak):S LP α A1,··· ,Ak(S′) − εn∆, (18) where γi = qi and αi = qi/pi. As before, we consider the duals of the two programs. This is the main place in which our correlation clustering analysis differs from the one for MAXCUT. The dual is as follows subject to ui + Xj∈Γ(i) minimize Xi ηjℓzjℓ ≥ d− ui +Xi,ℓ i + ρiℓ ∀i, ℓ ρiℓziℓ −1 ≤ ziℓ ≤ 1 ∀i ∈ [n], ℓ ∈ [k] The difference now is that for any vector z, the optimal choice of ui i + ρiℓ − Pj∈Γ(i) ηjℓzjℓ}. This is now a maximum of k terms, as opposed to the max of 0 and one other term in the case of MAXCUT. But once again, we can think of the dual solution as being the vector z, and we again have ui ≤ 2di. The dual of LP α the vertices in S′) as the solution to the dual on H. The objective values are now as follows. As we did earlier, we take a solution z to the dual of the LP on G, and use the same values (for (H) can be written down similarly. A1,··· ,Ak is maxℓ{d− DualG =Xi,ℓ ρiℓziℓ +Xi DualH ≤ Xi∈S ′,ℓeρiℓziℓ +Xi i + ρiℓ − Xj∈Γ(i) ℓ {d− max i +eρiℓ − Xj∈Γ(i)∩S ′ ℓ { ed− max ηijzjℓ} pi∆2 . We now show that w.p. at least 1 − 1 n4 , εn ∆ 1 ∆2 max DualH ≤ DualG + (A1,...,Ak):S (A1,...,Ak):S max . wijηijzjℓ} Here also, we have eρiℓ = ρiℓ (19) (20) (21) We can use the same trick as in the MAXCUT case, and move to Dual∗ iℓ := ρiℓ show that w.h.p. (assuming S satisfies conditions analogous to Lemma 6.4), H, in which we use ij as before. The proof of Lemma 6.2 applies verbaitm. Thus it suffices to pi∆2 , weights w∗ eρ∗ max (A1,...,Ak):S Dual∗ H ≤ 1 ∆2 max (A1,...,Ak):S DualG + εn 2∆ . 25 Consider the expression Dual∗ H − 1 ∆2 DualG =Xi Xℓ (Yieρ∗ 1 ∆2 · ρiℓziℓ)! +(cid:18)Yi u∗ i − 1 ∆2 · ui(cid:19) . (22) iℓziℓ − We view this as two summations (shown by the parentheses), and bound them separately. The first is relatively easy. We observe that by definition, iℓ = Xj∈Γ(i)∩Cℓ eρ∗ w∗ ijηijp∗ j qj = ηij p∗ i ∆2 Xj∈Γ(i)∩Cℓ 1 qi = This implies that we can write the first term asPiℓ via Bernstein's inequality. ρiℓziℓ p∗ i ∆2(cid:0)Yi − p∗ (23) 1 i ∆2 · ρiℓ. p∗ i(cid:1). This will then be bounded For bounding the second term, we start with the trick of splitting it into two terms by adding a "hybrid" term, as follows: Xi Yi u∗ i − 1 ∆2 · ui =Xi (cid:18)Yi u∗ i − Yi ui i ∆2(cid:19) +Xi (cid:18)Yi p∗ ui i ∆2 − p∗ 1 ∆2 · ui(cid:19) . The second term can again be bounded using Bernstein's inequality, using the fact that ui = O(di). Let us thus consider the first term. We can appeal to the fact max{P1, . . . , Pk} − ηijw∗ ij(1 − zjℓ)(Yj − p∗ (24) The nice thing now is that we can appeal (in a black-box manner, using the boundedness of η and z) to the concentration bound for quadratic functions in Section 6.2, with ε replaced by ε/k, to conclude the desired concentration inequality. For this goal, we again use a similar conditioning as for MaxCut, which we state it here. "Good" conditioning. We say that a choice of Y 's is good if for all i ∈ V , we have Xj∈Γ(i) w∗ ijηijYj ≤ ε∆ + 2di p∗ i ∆2 26 max{Q1, . . . , Qk} ≤Pi Pi − Qi, to bound it by Xi YiXℓ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ed∗− i +eρ∗ ij = 1 p∗ i p∗ iℓ − Xj∈Γ(i)∩S ′ w∗ ijηijzjℓ − 1 p∗ j ∆2 we can bound the above by Using (23) and w∗ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Γ(i):ηij <0 YiXℓ Xi (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) YiXℓ =Xi Xj∈Γ(i):ηij <0 Yjηijw∗ ij(1 − zjℓ) − ηij p∗ ηijw∗ ij(1 − zjℓ)(Yj − p∗ i ∆2 cjℓ(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) +Xi j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) +Xi This leads to a sum over ℓ of terms of the form Xi (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Γ(i):ηij 6=0 . ηijzjℓ(cid:1)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ηijw∗ ijzjℓ(Yj − p∗ ηijw∗ ijzjℓ(Yj − p∗ j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i + ρiℓ − Xj∈Γ(i) i ∆2(cid:0)d− (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Γ(i):ηij >0 Xj∈Γ(i):ηij >0 j )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) YiXℓ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) YiXℓ . Lemma 9.3. Let H be the weighted graph obtained after sampling with probabilities p∗ vertex i ∈ V , we have i . For any Pr Xj∈Γ(i) w∗ ijηijYj > p∗ ε∆ + 2di 1 n4 . i ∆2  < i ∆2(cid:16)Pj∈Γ(i) ijηijYj = 1 p∗ parenthesis has expectation precisely di. Thus, applying Bernstein using maxj Proof. Fix some i ∈ V , and consider Pj∈Γ(i) w∗ withPj∈Γ(i) ≤ di maxj j (1−p∗ j ) p∗2 j , we have ηij p∗ 1 p∗ j Yj ηij p∗ j (cid:17). The term in the ε , together j ≤ αε∆ 1 p∗ By setting t = (di + ε∆ k ), the RHS above can be bounded by Pr(cid:2) Xj∈Γ(i)∩VH ηijYj p∗ j exp − ε(di + ε∆ (2di + ε∆ > di + t(cid:3) ≤ exp(cid:18)− k )αε∆! ≤ exp(cid:18)− k )2 εt2 (di + t)αε∆(cid:19) . ε2 2αε(cid:19) < 1 n4 . This completes the proof, using our choice of αε. Conditioning on the Y being good, we can obtain the concentration bound for the quadratic function (24). This lets us take a union bound over all possible partitions of S (of which there are at most kn), to obtain (21), which then completes the proof of the main result (Theorem 4.2), for correlation clustering. Acknowledgement We thank Michael Kapralov for helpful discussions as we embarked upon this project. References [1] Pankaj K Agarwal, Sariel Har-Peled, and Kasturi R Varadarajan. Geometric approximation via coresets. Combinatorial and computational geometry, 52:1–30, 2005. [2] Kook Jin Ahn and Sudipto Guha. Graph sparsification in the semi-streaming model. In In- ternational Colloquium on Automata, Languages, and Programming, pages 328–338. Springer, 2009. [3] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: sparsification, spanners, and subgraphs. In Proceedings of the 31st symposium on Principles of Database Systems, pages 5–14. ACM, 2012. [4] KookJin Ahn, Graham Cormode, Sudipto Guha, Andrew McGregor, and Anthony Wirth. In International Conference on Machine Learning, Correlation clustering in data streams. pages 2237–2246, 2015. 27 [5] Nir Ailon and Zohar Karnin. A note on: No need to choose: How to get both a ptas and sublinear query complexity. arXiv preprint arXiv:1204.6588, 2012. [6] Noga Alon, W Fernandez De La Vega, Ravi Kannan, and Marek Karpinski. Random sampling and approximation of max-csps. Journal of computer and system sciences, 67(2):212–243, 2003. [7] Noga Alon, Eldar Fischer, Ilan Newman, and Asaf Shapira. A combinatorial characterization of the testable graph properties: it's all about regularity. SIAM Journal on Computing, 39(1):143– 167, 2009. [8] Alexandr Andoni, Robert Krauthgamer, and Krzysztof Onak. Streaming algorithms via pre- cision sampling. In Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Sym- posium on, pages 363–372. IEEE, 2011. [9] Alexandr Andoni, Robert Krauthgamer, and David P Woodruff. The sketching complexity of graph cuts. arXiv preprint arXiv:1403.7058, 2014. [10] Sanjeev Arora, David Karger, and Marek Karpinski. Polynomial time approximation schemes for dense instances of np-hard problems. In Proceedings of the twenty-seventh annual ACM symposium on Theory of computing, pages 284–293. ACM, 1995. [11] Nikhil Bansal, Avrim Blum, and Shuchi Chawla. Correlation clustering. Machine Learning, 56(1-3):89–113, 2004. [12] Boaz Barak, Moritz Hardt, Thomas Holenstein, and David Steurer. Subsampling mathematical relaxations and average-case complexity. the Twenty- second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '11, pages 512–531, Philadelphia, PA, USA, 2011. Society for Industrial and Applied Mathematics. URL: http://dl.acm.org/citation.cfm?id=2133036.2133077. In Proceedings of [13] St´ephane Boucheron, G´abor Lugosi, and Pascal Massart. Concentration inequalities using the entropy method. Annals of Probability, pages 1583–1614, 2003. [14] Graham Cormode and Shan Muthukrishnan. An improved data stream summary: the count- min sketch and its applications. Journal of Algorithms, 55(1):58–75, 2005. [15] Devdatt P Dubhashi and Alessandro Panconesi. Concentration of measure for the analysis of randomized algorithms. Cambridge University Press, 2009. [16] Uriel Feige and Gideon Schechtman. On the optimality of the random hyperplane rounding technique for max cut. Random Structures & Algorithms, 20(3):403–440, 2002. [17] Dimitris Fotakis, Michael Lampis, and Vangelis Th Paschos. Sub-exponential approximation schemes for csps: from dense to almost sparse. arXiv preprint arXiv:1507.04391, 2015. [18] Alan Frieze and Ravi Kannan. The regularity lemma and approximation schemes for dense problems. In Foundations of Computer Science, 1996. Proceedings., 37th Annual Symposium on, pages 12–20. IEEE, 1996. [19] Ioannis Giotis and Venkatesan Guruswami. Correlation clustering with a fixed number of clus- ters. In Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 1167–1176. Society for Industrial and Applied Mathematics, 2006. 28 [20] Ashish Goel, Michael Kapralov, and Sanjeev Khanna. Graph sparsification via refinement sampling. arXiv preprint arXiv:1004.4915, 2010. [21] Ashish Goel, Michael Kapralov, and Ian Post. Single pass sparsification in the streaming model with edge deletions. arXiv preprint arXiv:1203.4900, 2012. [22] Oded Goldreich, Shari Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. Journal of the ACM (JACM), 45(4):653–750, 1998. [23] Hossein Jowhari, Mert Saglam, and G´abor Tardos. Tight bounds for lp samplers, finding duplicates in streams, and related problems. In Proceedings of the thirtieth ACM SIGMOD- SIGACT-SIGART symposium on Principles of database systems, pages 49–58. ACM, 2011. [24] Michael Kapralov. Better bounds for matchings in the streaming model. In SODA, pages 1679–1697. SIAM, 2013. [25] Michael Kapralov, Sanjeev Khanna, and Madhu Sudan. Approximating matching size from random streams. In SODA, pages 734–751. SIAM, 2014. [26] Michael Kapralov, Sanjeev Khanna, and Madhu Sudan. Streaming lower bounds for approxi- mating max-cut. In SODA, pages 1263–1282. SIAM, 2015. [27] Michael Kapralov, Sanjeev Khanna, Madhu Sudan, and Ameya Velingker. (1+ ω (1))- approximation to max-cut requires linear space. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1703–1722. SIAM, 2017. [28] Michael Kapralov, Yin Tat Lee, Cameron Musco, Christopher Musco, and Aaron Sidford. Single pass spectral sparsification in dynamic streams. In Foundations of Computer Science (FOCS), 2014 IEEE 55th Annual Symposium on, pages 561–570. IEEE, 2014. [29] Jonathan A Kelner and Alex Levin. Spectral sparsification in the semi-streaming setting. Theory of Computing Systems, 53(2):243–262, 2013. [30] Dmitry Kogan and Robert Krauthgamer. Sketching cuts in graphs and hypergraphs. In Proc. ITCS, pages 367–376. ACM, 2015. [31] Claire Mathieu and Warren Schudy. Yet another algorithm for dense max cut: go greedy. In Proceedings of the nineteenth annual ACM-SIAM symposium on Discrete algorithms, pages 176–182. Society for Industrial and Applied Mathematics, 2008. [32] Morteza Monemizadeh and David P Woodruff. 1-pass relative-error lp-sampling with applica- tions. In Proceedings of the twenty-first annual ACM-SIAM symposium on Discrete Algorithms, pages 1143–1160. SIAM, 2010. [33] Mark Rudelson and Roman Vershynin. Sampling from large matrices: J. ACM, 54(4), July 2007. proach through geometric functional analysis. http://doi.acm.org/10.1145/1255443.1255449, doi:10.1145/1255443.1255449. An ap- URL: 29
1606.00996
1
1606
2016-06-03T07:51:56
A Minimal Variance Estimator for the Cardinality of Big Data Set Intersection
[ "cs.DS", "cs.DB" ]
In recent years there has been a growing interest in developing "streaming algorithms" for efficient processing and querying of continuous data streams. These algorithms seek to provide accurate results while minimizing the required storage and the processing time, at the price of a small inaccuracy in their output. A fundamental query of interest is the intersection size of two big data streams. This problem arises in many different application areas, such as network monitoring, database systems, data integration and information retrieval. In this paper we develop a new algorithm for this problem, based on the Maximum Likelihood (ML) method. We show that this algorithm outperforms all known schemes and that it asymptotically achieves the optimal variance.
cs.DS
cs
A Minimal Variance Estimator for the Cardinality of Big Data Set Intersection Reuven Cohen Liran Katzir Aviv Yehezkel Department of Computer Science Technion Haifa 32000, Israel Abstract In recent years there has been a growing interest in developing "streaming algo- rithms" for efficient processing and querying of continuous data streams. These algo- rithms seek to provide accurate results while minimizing the required storage and the processing time, at the price of a small inaccuracy in their output. A fundamental query of interest is the intersection size of two big data streams. This problem arises in many different application areas, such as network monitoring, database systems, data integration and information retrieval. In this paper we develop a new algorithm for this problem, based on the Maximum Likelihood (ML) method. We show that this algorithm outperforms all known schemes and that it asymptotically achieves the optimal variance. 1 Introduction Classical processing algorithms for database management systems usually require several passes over (static) data sets in order to produce an accurate answer to a user query. How- ever, for a wide range of application domains, the data set is very large and is updated on a continuous basis, making this approach impractical. For this reason, there is a growing interest in developing "streaming algorithms" for efficient processing and querying of con- tinuous data streams in data stream management systems (DSMSs). These algorithms seek to provide accurate results while minimizing both the required storage and the processing time per stream element, at the price of a small inaccuracy in their output [2, 7, 11, 21]. Streaming algorithms for DSMSs typically summarize the data stream using a small sketch, and use probabilistic techniques in order to provide approximate answers to user queries. Such big data streams appear in a wide variety of computer science applications. They are common, for example, in computer networks, where detailed usage statistics (such as the source IP addresses of packets) from different parts of the network need to be continuously collected and analyzed for various security and management tasks. A fundamental query of interest is the intersection size of two big data streams. Consider two streams of elements, A and B, taken from two sets A and B respectively. Suppose that each element may appear more than once in each stream. Let n =(cid:12)(cid:12)A∩ B(cid:12)(cid:12). For example, for A = a, b, c, d, a, b and B = a, a, c, c, we get n = 2. Finding n is a problem that arises in many different application areas such as network monitoring, database systems, data integration and information retrieval [4, 5]. on-line detection of denial of service attacks. As an application example, ai ∈ A and bj ∈ B could be streams of IP packets passing through two routers, R1 and R2. In this case, A ∩ B represents the number of flows for- warded by both routers. Thus, \A ∩ B can be used for security and traffic monitoring, e.g., As another example, ai ∈ A and bj ∈ B could be sets of sub-strings found within two text documents. In this case, A ∩ B represents the number of sub-strings shared by both documents, which can be viewed as the similarity of the documents. Among many other applications, this allows plagiarism detection and pruning of near-duplicate search results in search engines. One can find the exact value of n by computing the intersection set C in the following way. For every element bi ∈ B, compare bi to every aj ∈ A and ck ∈ C. If bi /∈ C and bi ∈ A, add bi to C. After all the elements are treated, return the number of elements in C. This naive approach does not scale if storage is limited or if the sets are very large. In these cases, the following estimation problem should be solved. Given two streams of elements (with repetitions) A = a1, a2, . . . , ap, and B = b1, b2, . . . , bq, such that A and B are the respective where m ≪ n. \ρ(A,B) A ∩ B can be estimated in a straightforward manner using the inclusion-exclusion prin- sets of the two streams, and n = A ∩ B, find an estimatebn of n using only m storage units, ciple: \A ∩ B = cA+cB− \A ∪ B, taking advantage of the fact that estimating A, B and A ∪ B is relatively easy. However, we will later show that this scheme produces inaccurate results. In [2], it is proposed to estimate the Jaccard similarity, defined as ρ(A, B) = A∩B A∪B . The idea is to estimate A ∪ B, and then to extract A ∩ B. A third scheme, proposed in [11], suggests that \A ∩ B = ρ(A,B)+1 (cA +cB). With respect to the above three estimation schemes, the main contributions of this paper are as follows: 1. For the first time, we present a complete analysis of the statistical performance (bias and variance) of the above three schemes. 2. We find the optimal (minimum) variance of any unbiased set intersection estimator. 3. We present and analyze a new unbiased estimator, based on the Maximum Likelihood (ML) method, which outperforms the above three schemes. The rest of the paper is organized as follows. Section 2 discusses previous work and presents the three previously known schemes. Section 3 presents our new Maximum Like- lihood (ML) estimator. It also shows that the new scheme achieves optimal variance and that it outperforms the three known schemes. Section 4 analyzes the statistical performance (bias and variance) of the three known schemes. Section 5 presents simulation results con- firming that the new ML estimator outperforms the three known schemes. Finally, Section 6 concludes the paper. 2 Related Work and Previous Schemes The database research community has extensively explored the problem of data cleaning: de- tecting and removing errors and inconsistencies from data to improve the quality of databases [23]. Identifying which fields share similar values, identifying join paths, estimating join directions and sizes, and detecting inclusion dependencies are well-studied aspects of this problem [1, 8, 11, 17, 22]. For example, in [11] the authors present several methods for finding related database fields. Their main idea is to hash the values of each field and keep a small sketch that contains the minimal hash values for each. Then, the Jaccard similarity is used to measure similarities between fields. In [1], the authors study the related problem of detecting inclusion dependencies, i.e., pairs of fields A and B such that A ⊆ B, and they present an efficient way to test all field pairs in parallel. All the above problems are closely related to the "cardinality estimation problem" dis- cussed in this paper. This problem has received a great deal of attention in the past decade thanks to the growing number of important real-time "big data" applications, such as es- timating the propagation rate of viruses, detecting DDoS attacks [14, 15], and measuring general properties of network traffic [21]. Many works address the cardinality estimation problem [7, 9, 12, 16, 20, 21] and propose statistical algorithms for solving it. These algorithms are usually limited to performing only one pass on the received packets and using a fixed small amount of memory. A common approach is to hash every element into a low-dimensional data sketch, which can be viewed as a uniformly distributed random variable. Then, one of the following schemes is often used to estimate the number of distinct elements in the set: 1. Order-statistics based estimators: In this family of schemes, the identities of the small- est (or largest) k elements are remembered for the considered set. These values are then used for estimating the total number of distinct elements [2, 9, 16, 20]. The family of estimators with k = 1 (where the minimal/maximal identity is remembered) is also known as min/max sketches. 2. Bit-pattern based estimators: In this family of schemes, the highest position of the leftmost 1-bit in the binary representation of the identity of each element is remembered and then used for the estimation [7, 12]. If only one hash function is used, the schemes estimate the value of n with an infinite variance. To bound the variance, both schemes repeat the above procedures for m different hash functions and use their combined statistics for the estimation1. A comprehensive overview of different cardinality estimation techniques is given in [7, 21]. State-of-the art cardinality estimators have a standard error of about 1/√m, where m is the number of storage units [6]. The best known cardinality estimator is the HyperLogLog algorithm [12], which belongs to the family of min/max sketches and has a standard error of 1.04/ √m, [12]. For instance, this algorithm estimates the cardinality of a set with 109 elements with a standard error of 2% using m = 2, 048 storage units. Cardinality estimation algorithms can be used for estimating the cardinality of set inter- section. As mentioned in Section 1, a straightforward technique is to estimate the intersection 1Stochastic averaging can be used to reduce the number of hash functions from m to only two [13]. using the following inclusion-exclusion principle: \A ∩ B = cA + cB − \A ∪ B. This method will be referred to as Scheme-1. Other algorithms first estimate the Jaccard similarity ρ(A, B) = A∩B A∪B , and then use some algebraic manipulation on it [2, 11]. Specif- ically, the scheme proposed in [2] estimates both the Jaccard similarity and A ∪ B, and then uses \A ∩ B = \ρ(A, B) · \A ∪ B. This scheme will be referred to as Scheme-2. The third scheme discussed in this paper, referred to as Scheme-3, is presented in [11]. It estimates the Jaccard similarity, A, and B, and then uses \A ∩ B = \ρ(A, B) ρ(A, B) + 1 (cA + cB). The above equation is obtained by substituting the Jaccard similarity definition into ρ(A,B) which yields that ρ(A,B)+1 , ρ(A, B) ρ(A, B) + 1 = A ∩ B A ∩ B + A ∪ B = A ∩ B A + B . In [1, 18], the set intersection estimation problem is solved using smaller sample sets. In While these techniques are simple and unbiased, they are inaccurate for small sets. addition, they are sensitive to the arrival order of the data, and to the repetition pattern. 3 A New Maximum Likelihood Scheme with Optimal Variance In this section we present a new unbiased estimator for the set intersection estimation prob- lem. Because this estimator is based on the Maximum Likelihood (ML) method, it achieves optimal variance and outperforms the three known schemes. Maximum-Likelihood estimation (ML) is a method for estimating the parameters of a statistical model. For example, suppose we are interested in the height distribution of a given population, but are unable to measure the height of every single person. Assuming that the heights are Gaussian distributed with some unknown mean and variance, the mean and variance can be estimated using ML and only a small sample of the overall popula- tion. In general, for a given set of data samples and an underlying statistical model, ML finds the values of the model parameters that maximize the likelihood function, namely, the "agreement" of the selected model with the given sample. In the new scheme, we first find the (probability density) likelihood function of the set intersection estimation problem, L(xA = s, xB = t; θ); namely, given θ = (a, b, n) as the problem parameters2, this is the probability density of s to be the maximal hash value for A and t to be the maximal hash value for B. Then, we look for values of the problem parameters that maximize the likelihood function. Table 1 shows some of the notations we use for the rest of the paper. notation value A ∩ B A ∪ B n u a b α β A B A \ B B \ A Table 1: Notations 3.1 The Likelihood Function of the Set Intersection Estimation Problem B = maxb A and xk We first find the likelihood function for one hash function hk, namely, L(xA = s, xB = t; θ)k, and then generalize it for all hash functions. Recall that for the kth hash function, xk A = i=1 {hk(ai)} and xk maxa j=1 {hk(bj)}. To simplify the notation, we shall omit the superscript k for xk We use PDFU (w) to denote the probability density function (PDF) of a uniformly dis- tributed random variable U(0, 1) at w. Denote the elements in A∩B as {z1, z2, . . . , zn}. Thus, the elements in A and the elements in B can be written as {x1, x2, . . . , xα, z1, z2, . . . , zn} and {y1, y2, . . . , yβ, z1, z2, . . . , zn} respectively (see Table 1). We now divide the likelihood function according to the three possible relations between xA and xB: xA = xB, xA > xB and xA < xB. B, and use xA and xB respectively. Case 1: xA = xB When xA = xB = s holds, the element with the maximal hash value must belong to A ∩ B. The likelihood function of θ given this outcome is L(xA = xB = s; θ) = = PDFU (s) · Pr(cid:0)x(A∪B)\{zi } < s(cid:1) su−1 = n · su−1. nXi=1 nXi=1 (1) This equality holds because there are n possible elements in A ∩ B whose hash value can be the maximum in A ∪ B, and because PDFU (s) = 1. 2The set intersection estimation problem has six identifying parameters (n, u, a, b, α, β), only three of which are needed to derive the others. Case 2: xA < xB In order to have xA < xB, where xA = s and xB = t, the maximal hash value in B must also be in B \ A, and its value must be t. The likelihood function of θ in this case is L(xB\A = t; θ) = βXj=1 PDFU (t) · Pr(cid:0)x(B\A)\{yj } < t(cid:1) = β · tβ−1. In addition, the maximal hash value in A must be s. The probability density for this is L(xA = s; θ) =Xe∈A PDFU (s) · Pr(cid:0)xA\{e} < s(cid:1) = asa−1. Thus, L(xA < xB, xA = s, xB = t; θ) = asa−1 · βtβ−1. (2) Case 3: xA > xB This case is symmetrical to the previous case. Thus, the likelihood function of θ in this case is L(xA > xB, xA = s, xB = t; θ) = αsα−1btb−1. Thus, the likelihood function for set intersection is L(xA = s, xB = t; θ)k = nsu−1 xA = xB βtβ−1asa−1 xA < xB αsα−1btb−1 xA > xB . We now use the following indicator variables: 1. I1 = 1 if xA = xB, and I1 = 0 otherwise, 2. I2 = 1 if xA < xB, and I2 = 0 otherwise, 3. I3 = 1 if xA > xB, and I3 = 0 otherwise, to obtain that L(xA = s, xB = t; θ)k = (nsu−1)I1 · (βtβ−1asa−1)I2 · (αsα−1btb−1)I3. (3) Eq. (3) states the likelihood function for one hash function. To generalize this equation to all m hash functions, denote S = (s1, s2, . . . , sm) and T = (t1, t2, . . . , tm) as the m- dimensional vectors of s and t for each hash function. Corollary 1 The likelihood function for the set intersection estimation problem, for all m hash functions, satisfies: L(xA = S, xB = T ; θ) = mYk=1 (n(sk)u−1)I1,k · (β(tk)β−1a(sk)a−1)I2,k · (α(sk)α−1b(tk)b−1)I3,k, where I1,k is the value of I1 for hash function k, and the same holds for I2,k and I3,k. (cid:4) It is usually easier to deal with the log of a likelihood function than with the likelihood function itself. Because the logarithm is a monotonically increasing function, its maximum value is obtained at the same point as the maximum of the function itself. In our case, log L(xA = S, xB = T ; θ) = log L(xk A = sk, xk B = tk; θ)k mYk=1 mXk=1 mXk=1 mXk=1 = = + log L(xk A = sk, xk B = tk; θ)k I1,k · log (n · (sk)u−1) + mXk=1 I2,k · log (β · (tk)β−1 · a · (sk)a−1) I3,k · log (α · (sk)α−1 · b · (tk)b−1). (4) 3.2 The New Scheme We use Corollary 1 in order to find θ = (a, b, n) that maximizes Eq. (4). Let g(a, b, n) and H(a, b, n) be the gradient and the Hessian matrix of the log-likelihood function. Namely, g is the vector whose components are the partial derivatives of the log-likelihood function for the problem parameters θ = (a, b, n): g(a, b, n) = ( ∂ log L ∂a , ∂ log L ∂b , ∂ log L ∂n ), and H is the matrix of the second-order partial derivatives of the log-likelihood function Hi,j = ∂2 ∂θi∂θj log L , 1 ≤ i, j ≤ 3 , where θ1 = a, θ2 = b and θ3 = n. (5) (6) The new scheme finds the maximal value of the log-likelihood function, i.e., the root of its gradient g(a, b, n). Practically, this is done using iterations of the Newton-Raphson method on the gradient and Hessian matrix g and H. Starting from an initial estimation bθ0 = (ba0,bb0, bn0), the Newton-Raphson method implies that a better estimation is bθ1 = bθ0 − H −1(bθ0) · g(bθ0). The process is repeated, namely, (7) until a sufficiently accurate estimation is reached. This idea is summarized in the following algorithm. dθl+1 =bθl − H −1(bθl) · g(bθl), k=1, where xk Algorithm 1 (A Maximum Likelihood scheme for the set intersection estimation problem) A and xk B are the maximal hash values of A and B respectively for the kth hash function, and returns an estimate of their set intersection cardinality. The scheme gets as an input the sketches of the sets(cid:8)xk A(cid:9)m k=1 and(cid:8)xk B(cid:9)m 1) Estimate a0 =ba, b0 =bb andbu using any cardinality estimation algorithm, such as [12]. 2) Estimate the Jaccard similarity bρ from the given sketches of A and B. n0 =bρ ·bu as an initial value of n (see Scheme-2 in Section 1), and a0, b0 as an initial 4) Return bn. When we implemented Algorithm 1, we discovered that 3 Newton-Raphson iterations are enough for the algorithm to converge. 3) Find the maximum of the likelihood function L (Eq. values of a and b respectively. (4)) as explained above; use 3.3 The Optimal Variance of the New Estimator The new estimator proposed in this section is based on Maximum Likelihood and thus it asymptotically achieves optimal variance [24]. We use the Cramer-Rao bound to compute this optimal variance. The Cramer-Rao bound states that the inverse of the Fisher information matrix is a lower bound on the variance of any unbiased estimator of θ [24]. The Fisher information matrix Fi,j is a way of measuring the amount of information that a random variable X carries about an unknown parameter θ upon which the probability of X depends. It is defined as: Fi,j = −E(cid:20) ∂2 ∂θi∂θj log L(cid:21) . (8) We now use the log-likelihood function (Eq. (4)) to derive this matrix for the set inter- section estimation problem: F(a, b, n) = m · β u · 1 u·α a2 + 1 0 −1 u·α 0 b2 + 1 u·β α u · 1 −1 u·β −1 u·α −1 u·β 1 u·n + 1 u·β + 1 u·α  , (9) where each term is derived due to algebraic manipulations and derivatives of the log- likelihood function. Note that the expected values of the indicator variables I1,k, I2,k and I3,k are required to derive the matrix. For I1,k we get: E[I1,k] = Pr(cid:0)xk n u , 1 ≤ k ≤ m . A = xk B(cid:1) = The first equality is due to the definition of I1,k, and the second is due to Eq. (11). The following are obtained in the same way for every 1 ≤ k ≤ m: u . A > xk A < xk B(cid:1) = β B(cid:1) = α 1. E[I2,k] = Pr(cid:0)xk 2. E[I3,k] = Pr(cid:0)xk Let \A ∩ B be an unbiased estimator for the set intersection estimation problem. Then, according to the Cramer-Rao bound, Varh \A ∩ Bi ≥ (F−1)3,3, where (F−1)3,3 is the term in place [3, 3] in the inverse Fisher information matrix. Finally, from the computation of the term (F−1)3,3, we can obtain the following corollary: u . Corollary 2 Varh \A ∩ Bi ≥ (F−1)3,3, where, (F−1)3,3 = n·u m · α·n(a2+αβ)+β·n(b2+αβ)+(a2+αβ)(b2+αβ). (b2+αβ)(a2+αβ) 4 An Analysis of the Three Schemes From Section 1 In this section we will analyze the statistical performance (bias and variance) of the three schemes discussed in Section 1 for set intersection estimation. 4.1 Preliminaries 4.1.1 Jaccard Similarity Recall that the Jaccard similarity is defined as: ρ(A, B) = A∩B A∪B , where A and B are two finite sets. Its value ranges between 0, when the two sets are completely different, and 1, when the sets are identical. An efficient and accurate estimate of ρ can be computed as follows [3]. Each item in A and B is hashed into (0, 1), and the maximal value of each set is considered as a sketch that represents the whole set. To improve accuracy, m hash functions are used3, and the sketch of each set is a vector of m maximal values. Given a set A = {a1, a2, . . . , ap} and m different hash functions h1, h2, . . . , hm, the maximal hash value for the jth hash function can be formally expressed as: xj A = p i=1 {hj(ai)} , 1 ≤ j ≤ m, max and the sketch of A is: A, x2 X(A) =(cid:8)x1 \ρ(A, B) = Pm A, . . . , xm A(cid:9) . A==xj B j=1 Ixj m X(B) is computed in the same way. Then, the two sketches are used to estimate the Jaccard similarity of A and B: , (10) where the indicator function Ixj notation, for the rest of the paper we use ρ to indicate ρ(A, B). A==xj B is 1 if xj A = xj B, and 0 otherwise. To shorten our 3Stochastic averaging can be used to reduce the number of hash functions from m to only two [13]. Lemma 1 m ρ(1 − ρ)(cid:1). Proof: Consider the j-th hash function. According to [3], In Eq. (10),bρ is a normally distributed random variable with mean ρ and variance 1 i.e., bρ → N(cid:0)ρ, 1 Pr(cid:0)xj B(cid:1) = A ∩ B A ∪ B A = xj . mρ(1−ρ); (11) A = xj binomially distributed, and can be asymptotically approximated to normal distribution as The intuition is to consider the hash function hj and define m(S), for every set S, to be the element in S with the maximum hash value of hj, i.e., hj(m(S)) = xj S. Then, we get m(A) = m(B) only when m(A ∪ B) lies also in their intersection A ∩ B. The probability of this is the Jaccard ratio ρ, and therefore Pr(cid:0)xj From Eqs. (10) and (11) follows thatbρ is a sum of m Bernoulli variables. Therefore, it is → N(cid:0)ρ, 1 m → ∞; namely, bρ = 4.1.2 The Cardinality Estimation Problem Algorithms for estimating the cardinality of set intersection use estimations of A, B, and A ∪ B. These estimations can be found using well-known algorithms for the following cardinality estimation problem: m ρ(1 − ρ)(cid:1). B(cid:1) = ρ. Pm l=1 I x j A =x j B m Instance: A stream of elements x1, x2, . . . , xs with repetitions. Let c be the number of different elements, namely c = {x1, x2, . . . , xs}. Objective: Find an estimatebc of c using only m storage units, where m ≪ c. For the rest of the paper we consider the HyperLogLog algorithm [12] for solving the above problem. As indicated in Section 2, this algorithm has a very small standard error, of about 1.04/ √m where m is the number of storage units. The pseudo-code of this algorithm is as follows: Algorithm 2 The HyperLogLog algorithm for the cardinality estimation problem 1. Initialize m registers: C1, C2, . . . , Cm to 0. 2. For each input element xi do: (a) Let ρ = ⌊− log2 (h1(xi))⌋ be the leftmost 1-bit position of the hashed value. (b) Let j = h2(xi) be the bucket for this element. (c) Cj ← max{Cj, ρ}. 3. To estimate the value of n do: (a) Z ← (Pm j=1 2−Cj )−1 is the harmonic mean of 2Cj . (b) return αmm2Z, where . Lemma 2 du(cid:1)−1 αm =(cid:0)mR ∞ The following lemma summarizes the statistical performance of Algorithm 2: the estimate computed by the algorithm, and m is the number of storage units used by the algorithm. When Algorithm 2 is used with two sets A and B, the following holds: 0 (cid:0)log2(cid:0) 2+u 1+u(cid:1)(cid:1)m For Algorithm 2,bc → N(cid:16)c, c2 m(cid:17), where c is the actual cardinality of the considered set,bc is m ! , cA → N A , A2 cB → N B , B2 m ! , m ! . and \A ∪ B → N A ∪ B , A ∪ B2 (12) The proof is given in [12]. Let us also recall three general lemmas, not related to set intersection cardinality esti- mation. The first lemma, known as the Delta Method, allows us to compute the probability distribution for a function of an asymptotically normal estimator using the estimator's vari- ance: Lemma 3 (Delta Method) Let θ1, θ2, . . . , θm be a sequence of m random variables such that for every integer i √i(θi − θ) → N (0, σ2), where θ and σ2 are finite valued constants. Then, for every integer i and for every function g for which g′(θ) exists and g′(θ) 6= 0, the following holds: √i(g(θi) − g(θ)) → N(cid:16)0, σ2g′(θ)2(cid:17) . A proof is given in [24]. The next lemma shows how to compute the probability distribution of a random variable that is a product of two normally distributed random variables whose covariance is 0: Lemma 4 (Product distribution) Let X and Y be two random variables satisfying X → N (µx, σ2 that Cov [X, Y ] = 0. Then, the product X · Y asymptotically satisfies the following: x) and Y → N(cid:0)µy, σ2 y(cid:1), such X · Y → N(cid:0)µxµy, µ2 A proof is given in [24]. yσ2 x + µ2 xσ2 y(cid:1) . The final lemma states the distribution of the maximal hash value. Let us first recall the beta distribution. Beta (α, β) is defined over the interval (0, 1) and has the following probability and cumulative density functions (PDF and CDF respectively): f (x) = Γ (α + β) Γ (β) Γ (α) xα−1(1 − x)β−1 F (x) =Z x 0 Γ (α + β) Γ (β) Γ (α) xα−1(1 − x)β−1dx, where Γ(z) is the gamma function, defined asR ∞ 0 e−ttz−1dt. Using integration by parts, the gamma function can be shown to satisfy Γ(z + 1) = z · Γ(z). Combining this with Γ(1) = 1 yields that Γ(n) = (n − 1)! holds for every integer n. Two other known beta identities are [19]: Beta (1, 1) ∼ U(0, 1) and Beta (α, β) ∼ 1 − Beta (β, α) . The following lemma presents some key properties of the beta distribution, which we will use in the analysis. Lemma 5 Let x1, x2, . . . , xn be independent RVs, where xi ∼ U(0, 1). Then, (a) X = maxn i=1 xi ∼ Beta (n, 1). (b) X satisfies the following (1) E[X] = n n+1; and (2) Var [X] = n (n+1)2(n+2) . A proof for (a) is given in [10]; the other equalities follow the beta distribution of X. 4.2 Analysis of Scheme-1 Scheme-1 estimates the cardinality of A ∩ B using the inclusion-exclusion principle: \A ∩ B = cA + cB − \A ∪ B. performance. Let bn1 be the estimator found by Scheme-1. The following theorem summarizes its statistical n → N(cid:16)1, (cid:17), where m is the number of Theorem 3 cn1 storage units, and Z satisfies: mn2 (u2 − a2 − b2) − 2a·b m·u·n + 2u·(a2(b2+αβ)+b2(a2+αβ)) m·Z·n 1 Z = α · n(a2 + αβ) + β · n(b2 + αβ) + (a2 + αβ)(b2 + αβ). Proof: For the expectation, from Lemma 2 follows that: E[bn1] = E[ba] + Ehbbi − E[bu] = = a + b − u = n. The first equality is due to the definition of Scheme-1 and the expectation properties, and the second equality is due to Lemma 2. Thus, the estimator is unbiased. For the variance, Lemma 7 in the Appendix proves that Cov [a, b] = n·a·b m·u , and Lemma 8 in the Appendix m·u − u·n·b2(a2+αβ) proves that Cov [a, u] = a2 m + n·a·b , where Z = α · n(a2 + αβ) + β · n(b2 + αβ) + (a2 + αβ)(b2 + αβ). We get that: m·u − u·n·a2(b2+αβ) and Cov [b, u] = b2 m + n·a·b m·Z m·Z Var [bn1] = Var [ba] + Varhbbi + Var [bu] + 2 Covhba,bbi − 2 Cov [ba,bu] − 2 Covhbb,bui = = + a2 m − 2 · − 2 · 1 = m + b2 m u2 + 2 · m a2 n · a · b m − 2 · m · u b2 n · a · b m − 2 · m · u (u2 − a2 − b2) − n · a · b m · u + 2 · + 2 · 2n · a · b m · u u · n · a2(b2 + αβ) u · n · b2(a2 + αβ) m · Z m · Z 2u · n · (a2(b2 + αβ) + b2(a2 + αβ)) = + m · Z . (13) The first equality is due to variance properties and because a, b and u are dependent (Cov [a, b], Cov [a, u] and Cov [b, u] are all 6= 0). The second equality is due to Lemma 2, Lemma 7 and Lemma 8 (both are in the Appendix). The third equality is due to algebraic manipulations. Finally, after dividing by n2 we get the result. 4.3 Analysis of Scheme-2 Scheme-2 estimates the cardinality of A ∩ B by estimating the Jaccard similarity ρ and A ∪ B [2]: \A ∩ B =bρ · \A ∪ B. performance. Theorem 4 cn2 mρ(cid:17), where m is the number of storage units. Let bn2 be the estimator found by Scheme-2. The following theorem summarizes its statistical n → N(cid:16)1, 1 From the definition of Scheme-2, bn2 =bρ ·bu. From Lemma 1 and Lemma 2 follows that: 1. bρ → N(cid:0)ρ, 1 mρ(1 − ρ)(cid:1). Proof: Therefore, the estimator is unbiased. For the variance, applying again Lemma 4 yields: Applying Lemma 4 for the expectation yields: 2. bu → N(cid:16)u, u2 m(cid:17). E[bn2] = E[bρ ·bu] = ρ · u = n. Var [bn2] = u2 · 1 ρ(1 − ρ) + ρ2 · m 1 (u · n − n2 + n2) m n2 , mρ = = u2 m where all the equalities are due to Lemma 4 and algebraic manipulations. Finally, after dividing by n2, we get cn2 mρ(cid:17). n → N(cid:16)1, 1 4.4 Analysis of Scheme-3 Scheme-3 estimates the cardinality of A∩ B by estimating the Jaccard similarity ρ, A, and B [11]: \A ∩ B = dρ ρ + 1 (cA + cB). Lemma 6 Let bn3 be the estimator found by Scheme-3. We will use the following lemma in the analysis. ba +bb → N(cid:0)a + b, 1 m(a2 + b2 + 2abρ)(cid:1), where m is the number of storage units. Proof: For the expectation, The first equality is due to expectation properties, and the second is due to Lemma 2. For the variance, Lemma 7 in the Appendix proves that Cov [a, b] = n·a·b m·u . Thus, Ehba +bbi = E[ba] + Ehbbi = a + b. Varhba +bbi = = Var [ba] + Varhbbi + 2 Covhba,bbi = + = b2 m + 2 · n · a · b m · u (a2 + b2 + 2abρ). = = a2 m 1 m (14) (15) (16) The first equality is due to variance properties and because a and b are dependent (Cov [a, b] 6= 0). The second equality is due to Lemma 2 and Lemma 7, and the third equality is due to algebraic manipulations and the Jaccard similarity definition (ρ = n u ). Combining Eqs. 15 and 16 yields that 1 m (17) (18) Theorem 5 cn3 Proof: m (1 + 2ab u(a+b) + (α + β) u2 Applying Lemma 3 on ρ ρ+1 yields: 1 m ρ(1 − ρ)(cid:19) . (a2 + b2 + 2abρ)(cid:19) . n(a+b)2 )(cid:17), where m is the number of storage units. ρ+1 (ba +bb). From Lemma 1 follows that: ba +bb → N(cid:18)a + b, The following theorem summarizes the statistical performance of bn3. n → N(cid:16)1, 1 From the definition of Scheme-3, bn3 =dρ bρ → N(cid:18)ρ, ρ + 1 → N(cid:18) ρ dρ E[bn3] = E(cid:20) dρ Var [bn3] = A simple comparison yields that Var [bn2] > Var [bn3], i.e., Scheme-3 outperforms Scheme- 2. However, a similar comparison between Scheme-1 and Scheme-3 cannot be done, because neither one is always better than the other. Therefore, the estimator is unbiased. For the variance, applying again Lemma 4 yields: ρ + 1 · [a + b(cid:21) = Applying Lemma 4 for Eqs. (18) and (17) yields: n → N(cid:16)1, 1 ρ ρ + 1 · (a + b) = n. Finally, after dividing by n2, we get: cn3 1 (1 + ρ)4(cid:19) . 1 m (n2 + 2abn2 u(a + b) , 1 m ρ(1 − ρ) ρ + 1 + (α + β) u2n (a + b)2 ). m(1 + 2ab u(a+b) + (α + β) u2 n(a+b)2 )(cid:17). 5 Simulation Results In this section we examine the performance of our new ML estimator and show that it indeed outperforms the three known schemes. We implemented all four schemes, and simulated two sets, A and B, whose cardinalities are as follows: 1. A = a = 106; 4 0 0 0 . s a b i 2 0 0 0 . 0 0 0 0 . m=1,000 m=10,000 0.0 0.2 0.4 0.6 0.8 1.0 Figure 1: The bias of the new ML scheme for f = 1 and for different α values, for m = 1, 000 and m = 10, 000 2. B = a · f , where f > 0; 3. A ∩ B = a · α, where 0 ≤ α ≤ 1. We estimate \A ∩ B for each of the four schemes, for f ∈ {1, 5, 10}, and for α ∈ {0, 0.01, 0.02, . . . , 0.98, 0.99, 1}. We repeat the test for 10, 000 different sets. Thus, for each of the four schemes, and for each f and α values, we get a vector of 10, 000 different estimations. Then, for each f and α values, we compute the variance and bias of this vector, and view the result as the variance and bias of the estimator (for the specific f and α values). Each such of estimations for a specific scheme and for specific f and α values. Let µ = 1 the mean of vf,α. The bias and variance of vf,α are computed as follows: computation is represented by one point in the graph. Let vf,α = (bn1, . . . ,bn104) be the vector i=1bni, be Bias(vf,α) =(cid:12)(cid:12)(cid:12)(cid:12) 104P104 and Figure 1 presents the bias of the ML estimator for f = 1, different α values, and two values of m: m = 1, 000 and m = 10, 000 (recall that m is the number of hash values used small for all α and m values. We got very similar results for bigger f values as well. for the estimations of cA, cB and the Jaccard similaritybρ). We can see that the bias is very n(cid:3)) of our ML estimator for different f Figure 2 presents the normalized variance (Var(cid:2) bn and α values, and for m ∈ {100, 500, 1000, 10000}. As expected, the normalized variance 1 n (µ − n)(cid:12)(cid:12)(cid:12)(cid:12) 104Xi=1 (bni − µ)2. Var [vf,α] = 1 104 a e c n a i r a v d e z i l a m r o n 8 0 0 . 4 0 . 0 0 0 0 . m=100 m=500 m=1,000 m=10,000 e c n a i r a v d e z i l a m r o n 0 3 . 0 0 2 0 . 0 1 0 . 0 0 0 . m=100 m=500 m=1,000 m=10,000 e c n a i r a v d e z i l a m r o n 5 0 . 4 0 . 3 0 . 2 0 . 1 0 . 0 0 . m=100 m=500 m=1,000 m=10,000 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 (a) f = 1 (b) f = 5 (c) f = 10 Figure 2: The normalized variance of the new ML scheme for different values of f , α and m decreases as the number of hash values (m) increases, or as α increases. Overall, the nor- malized variance is very small for all values of α, f and m, indicating that the new scheme is very precise. After showing that the new ML scheme indeed yields good results, we now compare its performance to that of Schemes 1-3. When comparing the statistical performance of two algorithms, it is common to look at their MSE (mean squared error) or RMSE, where MSE = (Bias(bθ))2 + Varhbθi, and RMSE = r(Bias(bθ))2 + Varhbθi. all the estimators are unbiased, we compare only their variance. We define the "relative variance improvement" of the new ML scheme over each scheme as In our case, because Varhbθii − VarhdθMLi , Varhbθii where θi is the estimator of the ith scheme, and θML is the new ML estimator. Figure 3 presents the simulation results for two values of m: m = 10, 000 (upper graphs) and m = 1, 000 (lower graphs). We can see that the new ML estimator outperforms the three schemes for all values of α and f , and for both values of m. This improvement varies between 100% to a few percent. 6 Conclusion In this paper we studied the problem of estimating the number of distinct elements in the set intersection of two streams. We presented a complete analysis of the statistical performance (bias and variance) of three previously known schemes. We then computed the likelihood function of the problem and used it to present a new estimator, based on the ML method. We also found the optimal variance of any unbiased set intersection estimator, which is asymptotically achieved by our new ML scheme. We can conclude that our new scheme outperforms the three known schemes, significantly improves the variance (precision) of the estimator, and yields better results than the three previously known schemes. a a a t n e m e v o r p m i % t n e m e v o r p m i % 0 0 1 0 8 0 6 0 4 0 2 0 0 0 1 0 8 0 6 0 4 0 2 0 f=10 f=5 f=1 t n e m e v o r p m i % 0 8 0 6 0 4 0 2 0 f=10 f=5 f=1 t n e m e v o r p m i % 0 8 0 6 0 4 0 2 0 f=10 f=5 f=1 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 f=10 f=5 f=1 t n e m e v o r p m i % 0 8 0 6 0 4 0 2 0 f=10 f=5 f=1 t n e m e v o r p m i % 0 8 0 6 0 4 0 2 0 f=10 f=5 f=1 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 (a) Scheme-1 (b) Scheme-2 (c) Scheme-3 Figure 3: The percentage of variance improvement of the new ML scheme over each of the other schemes for different values of f and α; the upper graphs are for m = 10, 000 and the lower graphs are for m = 1, 000 a a a a a a References [1] J. Bauckmann, U. Leser, F. Naumann, and V. Tietz. Efficiently detecting inclusion dependencies. In ICDE, pages 1448–1450, 2007. [2] K. S. Beyer, P. J. Haas, B. Reinwald, Y. Sismanis, and R. Gemulla. On synopses for In SIGMOD Conference, pages distinct-value estimation under multiset operations. 199–210, 2007. [3] A. Z. Broder. On the resemblance and containment of documents. In IEEE Compression and Complexity of Sequences 1997, pages 21–29. [4] A. Z. Broder. Identifying and filtering near-duplicate documents. In CPM, pages 1–10, 2000. [5] A. Z. Broder, S. C. Glassman, M. S. Manasse, and G. Zweig. Syntactic clustering of the web. Computer Networks, 29(8-13):1157–1166, 1997. [6] P. Chassaing and L. G´erin. Efficient estimation of the cardinality of large data sets. In Proceedings of the 4th Colloquium on Mathematics and Computer Science, volume AG of Discrete Mathematics & Theoretical Computer Science Proceedings, pages 419–422, 2006. [7] P. Clifford and I. A. Cosma. A statistical analysis of probabilistic counting algorithms. Scandinavian Journal of Statistics, 2011. [8] C. Clifton, E. Housman, and A. Rosenthal. Experience with a combined approach to attribute-matching across heterogeneous databases. In DS-7, pages 428–451, 1997. [9] E. Cohen and H. Kaplan. Tighter estimation using bottom k sketches. PVLDB, 1(1):213–224, 2008. [10] R. Cohen, A. Yehezkel, and L. Katzir. A Unified Scheme for Generalizing Cardinality Estimators to Sum Aggregation. Inf. Process. Lett., 2014. [11] T. Dasu, T. Johnson, S. Muthukrishnan, and V. Shkapenyuk. Mining database struc- ture; or, how to build a data quality browser. In SIGMOD Conference, pages 240–251, 2002. [12] P. Flajolet, ´E. Fusy, O. Gandouet, and F. Meunier. Hyperloglog: the analysis of a near-optimal cardinality estimation algorithm. In Analysis of Algorithms (AofA) 2007. DMTCS. [13] P. Flajolet and G. N. Martin. Probabilistic counting algorithms for data base applica- tions. J. Comput. Syst. Sci., 31:182–209, Sep. 1985. [14] ´E. Fusy and F. Giroire. Estimating the number of active flows in a data stream over a sliding window. In D. Panario and R. Sedgewick, editors, ANALCO, pages 223–231. SIAM, 2007. [15] S. Ganguly, M. N. Garofalakis, R. Rastogi, and K. K. Sabnani. Streaming algorithms In ICDCS, page 4. IEEE Computer for robust, real-time detection of ddos attacks. Society, 2007. [16] F. Giroire. Order statistics and estimating cardinalities of massive data sets. Discrete Applied Mathematics, 157:406–427, 2009. [17] M. A. Hern´andez and S. J. Stolfo. Real-world data is dirty: Data cleansing and the merge/purge problem. Data Min. Knowl. Discov., 2(1):9–37, 1998. [18] H. Kohler. Estimating set intersection using small samples. In ACSC, pages 71–78, 2010. [19] K. Krishnamoorthy. Handbook of Statistical Distributions with Applications. Chapman & Hall/CRC Press, Boca Raton, FL, 2006. [20] J. Lumbroso. An optimal cardinality estimation algorithm based on order statistics and its full analysis. In Analysis of Algorithms (AofA) 2010. DMTCS. [21] A. Metwally, D. Agrawal, and A. E. Abbadi. Why go logarithmic if we can go linear?: Towards effective distinct counting of search traffic. In Proceedings of the 11th Interna- tional Conference on Extending Database Technology: Advances in Database Technology, EDBT '08, pages 618–629. [22] A. E. Monge. Matching algorithms within a duplicate detection system. IEEE Data Eng. Bull., 23(4):14–20, 2000. [23] E. Rahm and H. H. Do. Data cleaning: Problems and current approaches. IEEE Data Eng. Bull., 23(4):3–13, 2000. [24] J. Shao. Mathematical Statistics. Springer, 2003. Appendix Lemma 7 The covariance of cA and cB satisfies Covhba,bbi = n·a·b functions used for the estimation ofba andbb. m·u , where m is the number of hash Proof: Denote xA and xB as the maximal hash values for A and B respectively. Using our notation for I1, I2 and I3 from Section 3.1, and applying the linearity of expectation, we obtain: E[xA · xB] = E[(xA · xB) · (I1 + I2 + I3)] = E[(xA · xB) · I1] + E[(xA · xB) · I2] + E[(xA · xB) · I3] . (19) We consider each term separately: 1) xA = xB: From Eq. (1), E[(xA · xB) · I1] =ZxA=xB n · xu+1 A dx = n u + 2 . 2) xA < xB: From Eq. (2), E[(xA · xB) · I2] =ZZxA>xB B · a · xa A dxA dxB =Z 1 0 β · xβ β . u + 2 a a + 1 · = 3) xB > xA: This case is symmetrical to the second case. We get that E[(xA · xB) · I3] = b b + 1 · α u + 2 . Substituting the three terms into Eq. (19) yields that E[xA · xB] = = n u + 2 + a a + 1 · β u + 2 + b b + 1 · α u + 2 = ab · (u + 2) + n (u + 2)(a + 1)(b + 1) . Using the covariance definition, we obtain: β · xβ B dxB ·Z xB 0 a · xa A dxA = (20) Cov [xA, xB] = E[xA · xB] − E[xA] · E[xB] = ab · (u + 2) + n (u + 2)(a + 1)(b + 1) − a a + 1 · b b + 1 = n = (u + 2)(a + 1)(b + 1) . (21) The first equality is due to the covariance definition, and the second equality is due to Eq. (20) and Lemma 5(b). Eq. (21) states the covariance for one hash function. We can generalize it for all hash B be the maximal hash values for the ith hash function, for A and A and xi functions. Let xi B respectively. Then A, xj Cov(cid:2)xi B(cid:3) =(0 n (u+2)(a+1)(b+1) i 6= j i = j . (22) We are now ready to compute Covhba,bbi. To this end, we first need to choose the cardinality estimator that we will use to estimateba andbb. For simplicity, we use the estimator from [7]: (23) m , ba = Pm i=1 (1 − xi A) where m hash functions are used (symmetrically forbb). Denoting X =P (1 − xi X (Y is symmetrically defined forbb). For each i, xi rewrite the estimator as ba = m maximum of a uniformly distributed variables, and thus a A), we can A is the E(cid:2)xi A(cid:3) = a + 1 Both equalities follow the beta distribution of xi that (a + 1)2(a + 2) . a , and Var(cid:2)xi A(cid:3) = A)i = m · (1 − E(cid:2)xi A(cid:3)) = m · A)i = m · Var(cid:2)xi A(cid:3) = and the variance E[X] = EhX (1 − xi Var [X] = VarhX (1 − xi 1 a + 1 = m a + 1 , ma (a + 1)2(a + 2) . A (Lemma 5(b)). From Eq. (24) it follows (24) (25) (26) From Eqs. (25) and (26) we can conclude that X → N(cid:16) m (a+1)2(a+2)(cid:17), and symmetrically X (symmetrically forbb). Applying for Y . Recall that the estimators can be rewritten asba = m the Delta Method (multivariate version) for the estimator's vector (ba,bb) = (m/X, m/Y ) yields a+1, ma m/Y (cid:19) → N(cid:18)(cid:18) a b (cid:19) , g′ · Σ · g′T(cid:19) , where g(X, Y ) = (m/X, m/Y ) is the function used in the Delta Method, g′ is its partial- derivatives matrix and Σ is the variance matrix: (cid:18) ba bb (cid:19) =(cid:18) m/X Σ =(cid:18) Var [X] Cov [X, Y ] Cov [X, Y ] Var [Y ] (cid:19) . Using covariance properties and Eq. (22), we obtain: Cov [X, Y ] = CovhX 1 − xi Ai = A,X 1 − xj mXi=1 Cov(cid:2)xi A, xi B(cid:3) = mn (u + 2)(a + 1)(b + 1) . (27) Substituting the terms from Eqs. (26) and (27) in Σ yields mn (a+1)(b+1)(u+2) (b+1)2(b+2) ! . mb (a+1)(b+1)(u+2) ma mn (a+1)2(a+2) Σ = bb (cid:19) → N (cid:18) a (cid:18) ba Computing g′ · Σ · g′T yields the final distribution of the estimators: b (cid:19) , a(a+1)2 m(a+2) m(u+2) n(a+1)(b+1) n(a+1)(b+1) m(b+2) !! . m(u+2) b(b+1)2 Finally, according to the Delta Method, Covhba,bbi is the term in place [1, 2] in the matrix. Lemma 8 The covariance of cA and \A ∪ B satisfies Cov [ba,bu] = a2 the number of storage units, and Z satisfies: Z = α · n(a2 + αβ) + β · n(b2 + αβ) + (a2 + αβ)(b2 + αβ). m + n·a·b m·u − u·n·a2(b2+αβ) m·Z , where m is Proof: According to Fisher information matrix properties, \Cov [ba,bn] = (F−1)1,3 is a Maximum Likelihood estimator for Cov [ba,bn], where (F−1)1,3 is the term in place [1, 3] in the inverse Fisher information matrix. Computing the term (F−1)1,3 yields that Therefore, u · n · a2(b2 + αβ) . m · Z Cov [ba,bn] = Cov [ba,bu] = Covhba,ba +bb −bni = Cov [ba,ba] + Covhba,bbi − Cov [ba,bn] = u · n · a2(b2 + αβ) + = . a2 m n · a · b m · u − m · Z (28) The first equality is due to the inclusion-exclusion principle, and the second is due to covari- ance properties. The third equality is due to covariance properties, Lemma 2, Lemma 7 and Eq. (28). Similarly, we can obtain the covariance of cB and \A ∪ B: u · n · b2(a2 + αβ) + . n · a · b m · u − m · Z Covhbb,bui = b2 m
1504.02671
1
1504
2015-04-10T13:23:27
Longest Common Extensions in Sublinear Space
[ "cs.DS" ]
The longest common extension problem (LCE problem) is to construct a data structure for an input string $T$ of length $n$ that supports LCE$(i,j)$ queries. Such a query returns the length of the longest common prefix of the suffixes starting at positions $i$ and $j$ in $T$. This classic problem has a well-known solution that uses $O(n)$ space and $O(1)$ query time. In this paper we show that for any trade-off parameter $1 \leq \tau \leq n$, the problem can be solved in $O(\frac{n}{\tau})$ space and $O(\tau)$ query time. This significantly improves the previously best known time-space trade-offs, and almost matches the best known time-space product lower bound.
cs.DS
cs
Longest Common Extensions in Sublinear Space Philip Bille1 ⋆, Inge Li Gørtz1 ⋆, Mathias Baek Tejs Knudsen2 ⋆⋆, Moshe Lewenstein3 ⋆ ⋆ ⋆, and Hjalte Wedel Vildhøj1 1 Technical University of Denmark, DTU Compute 2 Department of Computer Science, University of Copenhagen 3 Bar Ilan University Abstract. The longest common extension problem (LCE problem) is to construct a data structure for an input string T of length n that supports LCE(i, j) queries. Such a query returns the length of the longest common prefix of the suffixes starting at positions i and j in T . This classic problem has a well-known solution that uses O(n) space and O(1) query time. In this paper we show that for any trade-off parameter 1 ≤ τ ≤ n, the problem can be solved in O( n τ ) space and O(τ ) query time. This significantly improves the previously best known time-space trade-offs, and almost matches the best known time-space product lower bound. 1 Introduction Given a string T , the longest common extension of suffix i and j, denoted LCE(i, j), is the length of the longest common prefix of the suffixes of T starting at position i and j. The longest common extension problem (LCE problem) is to preprocess T into a compact data structure supporting fast longest common extension queries. The LCE problem is a basic primitive that appears as a central subproblem in a wide range of string matching problems such as approximate string matching and its variations [1, 4, 13, 15, 21], computing exact or approximate repetitions [6, 14, 18], and computing palindromes [12, 19]. In many cases the LCE problem is the computational bottleneck. Here we study the time-space trade-offs for the LCE problem, that is, the space used by the preprocessed data structure vs. the worst-case time used by LCE queries. The input string is given in read-only memory and is not counted in the space complexity. Throughout the paper we use ℓ as a shorthand for LCE(i, j). The standard trade-offs are as follows: At one extreme we can store ⋆ Supported by the Danish Research Council and the Danish Research Council under the Sapere Aude Program (DFF 4005-00267) ⋆⋆ Research partly supported by Mikkel Thorup's Advanced Grant from the Danish Council for Independent Research under the Sapere Aude research career programme and the FNU project AlgoDisc - Discrete Mathematics, Algorithms, and Data Struc- tures. ⋆ ⋆ ⋆ This research was supported by a Grant from the GIF, the German-Israeli Founda- tion for Scientific Research and Development, and by a BSF grant 2010437 a suffix tree combined with an efficient nearest common ancestor (NCA) data structure [7,22]. This solution uses O(n) space and supports LCE queries in O(1) time. At the other extreme we do not store any data structure and instead answer queries simply by comparing characters from left-to-right in T . This solution uses O(1) space and answers an LCE(i, j) query in O(ℓ) = O(n) time. Recently, Bille et al. [2] presented a number of results. For a trade-off parameter τ , they gave: 1) a deterministic solution with O( n τ ) space and O(τ 2) query time, 2) a randomized Monte Carlo solution with O( n τ ) space and O(τ log( ℓ τ )) query time, where all queries are correct with high probability, and 3) a randomized Las Vegas solution with the same bounds as 2) but where all queries are guaranteed to be correct. Bille et al. [2] also gave a lower bound showing that any data structure for the LCE problem must have a time-space product of Ω(n) bits. τ )) = O(τ log( n Our Results Let τ be a trade-off parameter. We present four new solutions with the following improved bounds. Unless otherwise noted the space bound is the number of words on a standard RAM with logarithmic word size, not including the input string, which is given in read-only memory. -- A deterministic solution with O(n/τ ) space and O(τ log2(n/τ )) query time. -- A randomized Monte Carlo solution with O(n/τ ) space and O(τ ) query time, -- A randomized Las Vegas solution with O(n/τ ) space and O(τ ) query time. -- A derandomized version of the Monte Carlo solution with O(n/τ ) space and such that all queries are correct with high probability. O(τ ) query time. Hence, we obtain the first trade-off for the LCE problem with a linear time-space product in the full range from constant to linear space. This almost matches the Data Structure Preprocessing Trade-off Space Query Correct Space Time range Reference 1 n ℓ 1 always always 1 n - - Store nothing Suffix tree + NCA 1 n n2 τ n2 n2+ε n c i t s i n i m r e t e D τ log ℓ τ 2 τ τ τ 1 τ log2 n e t n o M o l r a C n τ n τ n τ n τ n τ n τ n τ n τ n τ n τ n τ n τ n τ n τ τ w.h.p. w.h.p. always τ always always 1 ≤ τ ≤ √n [2] log n ≤ τ ≤ n this paper, Sec. 2 1 ≤ τ ≤ n this paper, Sec. 4 1 ≤ τ ≤ n 1 ≤ τ ≤ n this paper, Sec. 3 1 ≤ τ ≤ n 1 ≤ τ ≤ n this paper, Sec. 3.5 Table 1. Overview of solutions for the LCE problem. Here ℓ = LCE(i, j), ε > 0 is an arbitrarily small constant and w.h.p. (with high probability) means with probability at least 1 − n−c for an arbitrarily large constant c. The data structure is correct if it answers all LCE queries correctly. n(τ + log n) w.h.p. n log n τ τ log ℓ τ always always n3/2 w.h.p. [2] [2] s a L s a g e V time-space product lower bound of Ω(n) bits, and improves the best deterministic upper bound by a factor of τ , and the best randomized bound by a factor log( n τ ). See the columns marked Data Structure in Table 1 for a complete overview. While our main focus is the space and query time complexity, we also provide efficient preprocessing algorithms for building the data structures, supporting independent trade-offs between the preprocessing time and preprocessing space. See the columns marked Preprocessing in Table 1. To achieve our results we develop several new techniques and specialized data structures which are likely of independent interest. For instance, in our determin- istic solution we develop a novel recursive decomposition of LCE queries and for the randomized solution we develop a new sampling technique for Karp-Rabin fingerprints that allow fast LCE queries. We also give a general technique for efficiently derandomizing algorithms that rely on "few" or "short" Karp-Rabin fingerprints, and apply the technique to derandomize our Monte Carlo algo- rithm. To the best of our knowledge, this is the first derandomization technique for Karp-Rabin fingerprints. Preliminaries We assume an integer alphabet, i.e., T is chosen from some al- phabet Σ = {0, . . . , nc} for some constant c, so every character of T fits in O(1) words. For integers a ≤ b, [a, b] denotes the range {a, a + 1, . . . , b} and we define [n] = [0, n− 1]. For a string S = S[1]S[2] . . . S[S] and positions 1 ≤ i ≤ j ≤ S, S[i...j] = S[i]S[i + 1]··· S[j] is a substring of length j − i + 1, S[i...] = S[i,S] is the ith suffix of S, and S[...i] = S[1, i] is the ith prefix of S. 2 Deterministic Trade-Off τ log n τ ) space and O(τ log n Here we describe a completely deterministic trade-off for the LCE problem with O( n τ ) query time for any τ ∈ [1, n]. Substituting τ = τ / log(n/τ ), we obtain the bounds reflected in Table 1 for τ ∈ [1/ log n, n]. A key component in this solution is the following observation that allows us to reduce an LCE(i, j) query on T to another query LCE(i′, j′) where i′ and j′ are both indices in either the first or second half of T . Observation 1 Let i, j and j′ be indices of T , and suppose that LCE(j′, j) ≥ LCE(i, j). Then LCE(i, j) = min(LCE(i, j′), LCE(j′, j)). We apply Observation 1 recursively to bring the indices of the initial query within distance τ in O(log(n/τ )) rounds. We show how to implement each round with a data structure using O(n/τ ) space and O(τ ) time. This leads to a solution using O( n τ ) query time. Finally in Section 2.4, we show how to efficiently solve the LCE problem for indicies within distance τ in O(n/τ ) space and O(τ ) time by exploiting periodicity properties of LCEs. τ ) space and O(τ log n τ log n 2.1 The Data Structure We will store several data structures, each responsible for a specific subinterval I = [a, b] ⊆ [1, n] of positions of the input string T . Let Ileft = [a, (a + b)/2], Iright = ((a + b)/2, b], and I = b − a + 1. The task of the data structure for I will be to reduce an LCE(i, j) query where i, j ∈ I to one where both indices belong to either Ileft or Iright. The data structure stores information for O(I/τ ) suffixes of T that start in Iright. More specifically, we store information for the suffixes starting at positions b − kτ ∈ Iright, k = 0, 1, . . . , (I/2)/τ . We call these the sampled positions of Iright. See Figure 1 for an illustration. a j ′ k a+b 2 τ b Ileft Iright Fig. 1. Illustration of the contents of the data structure for the interval I = [a, b]. The black dots are the sampled positions in Iright, and each such position has a pointer to an index j ′ k ∈ Ileft. For every sampled position b − kτ ∈ Iright, k = 0, 1, . . . , (I/2)/τ , we store the index j′ k of the suffix starting in Ileft that achieves the maximum LCE value with the suffix starting at the sampled position, i.e., T [b − kτ...] (ties broken arbitrarily). Along with j′ k, we also store the value of the LCE between suffix T [j′ k and Lk are defined as follows, k...] and T [b − kτ...]. Formally, j′ LCE(h, b − kτ ) j′ k = argmax h ∈ Ileft and Lk = LCE(j′ k, b − kτ ) . Building the structure We construct the above data structure for the interval [1, n], and build it recursively for [1, n/2] and (n/2, n], stopping when the length of the interval becomes smaller than τ . 2.2 Answering a Query We now describe how to reduce a query LCE(i, j) where i, j ∈ I to one where both indices are in either Ileft or Iright. Suppose without loss of generality that i ∈ Ileft and j ∈ Iright. We start by comparing δ < τ pairs of characters of T , starting with T [i] = T [j], until 1) we encounter a mismatch, 2) both positions are in Iright or 3) we reach a sampled position in Iright. It suffices to describe the last case, in which T [i, i + δ] = T [j, j + δ], i + δ ∈ Ileft and j + δ = b − kτ ∈ Iright for some k. Then by Observation 1, we have that LCE(i, j) = δ + LCE(i + δ, j + δ) = δ + min(LCE(i + δ, j′ = δ + min(LCE(i + δ, j′ k), LCE(j′ k), Lk) . k, b − kτ )) Thus, we have reduced the original query to computing the query LCE(i + δ, j′ k) in which both indices are in Ileft. 2.3 Analysis Each round takes O(τ ) time and halves the upper bound for i−j, which initially is n. Thus, after O(τ log(n/τ )) time, the initial LCE query has been reduced to one where i − j ≤ τ . At each of the O(log(n/τ )) levels, the number of sampled positions is (n/2)/τ , so the total space used is O((n/τ ) log(n/τ )). 2.4 Queries with Nearby Indices We now describe the data structure used to answer a query LCE(i, j) when i − j ≤ τ . We first give some necessary definitions and properties of periodic strings. We say that the integer 1 ≤ p ≤ S is a period of a string S if any two characters that are p positions apart in S match, i.e., S[i] = S[i + p] for all positions i s.t. 1 ≤ i < i + p ≤ S. The following is a well-known property of periods. Lemma 1 (Fine and Wilf [5]). If a string S has periods a and b and S ≥ a + b − gcd(a, b), then gcd(a, b) is also a period of S. The period of S is the smallest period of S and we denote it by per(S). If per(S) ≤ S/2, we say S is periodic. A periodic string S might have many periods smaller than S/2, however it follows from the above lemma that Corollary 1. All periods smaller than S/2 are multiples of per(S). The Data Structure Let Tk = T [kτ...(k + 2)τ − 1] denote the substring of length 2τ starting at position kτ in T , k = 0, 1, . . . , n/τ . For the strings Tk that are periodic, let pk = per(Tk) be the period. For every periodic Tk, the data structure stores the length ℓk of the maximum substring starting at position kτ , which has period pk. Nothing is stored if Tk is aperiodic. Answering a Query We may assume without loss of generality that i = kτ , for some integer k. If not, then we check whether T [i + δ] = T [j + δ] until i + δ = kτ . Hence, assume that i = kτ and j = i + d for some 0 < d ≤ τ . In O(τ ) time, we first check whether T [i + δ] = T [j + δ] for all δ ∈ [0, 2τ ]. If we find a mismatch we are done, and otherwise we return LCE(i, j) = ℓk − d. Correctness If a mismatch is found when checking that T [i + δ] = T [j + δ] for all δ ∈ [0, 2τ ], the answer is clearly correct. Otherwise, we have established that d ≤ τ is a period of Tk, so Tk is periodic and d is a multiple of pk (by Corollary 1). Consequently, T [i + δ] = T [j + δ] for all δ s.t. d + δ ≤ ℓk, and thus LCE(i, j) = ℓk − d. 2.5 Preprocessing The preprocessing of the data structure is split into the preprocessing of the recursive data structure for queries where i − j > τ and the preprocessing of the data structure for nearby indices, i.e., i − j ≤ τ . If we allow O(n) space during the preprocessing phase then both can be solved in O(n) time. If we insist on O(n/τ ) space during preprocessing then the times are not as good. Recursive Data Structure Say O(n) space is allowed during preprocessing. Generate a 2D range searching environment with a point (x(l), y(l)) for every text index l ∈ [1, n]. Set x(l) = l and y(l) equal to the rank of suffix T [l...] in the lexicographical sort of the suffixes. To compute j′ k ∈ Ileft = [a, (a+ b)/2] that has the maximal LCE value with a sampled position i = b−kτ ∈ Iright = ((a+b)/2, b] we require two 3-sided range successor queries, see detailed definitions in [17]. The first is a range [a, (a + b)/2]× (−∞, y(i)− 1] which returns the point within the range with y-coordinate closest to, and less-than, y(i). The latter is a range [a, (a + b)/2]× [y(i) + 1,∞) with point with y-coordinate closest to, and greater- than, y(i) returned. Let l′ and l′′ be the x-coordinates, i.e., text indices, of the points returned by the queries. By definition both are in [a, (a + b)/2]. Among suffixes starting in [a, (a + b)/2], T [l′...] has the largest rank in the lexicographic sort which is less than l. Likewise, T [l′′...] has the smallest rank in the lexicographic sort which is greater than l. Hence, j′ k is equal to either l′ or l′′, and the larger of LCE(l, l′) and LCE(l, l′′) determines which one. The LCE computation can be implemented with standard suffix data struc- tures in O(n) space and O(1) query time for an overall O(n) time. 3-sided range successor queries can be preprocessed in O(n log n) space and time and queries can be answered in O(log log n) time, see [11, 16] for an overall O(n log log n) time and O(n log n) space. If one desires to keep the space limited to O(n/τ ) space then generate a sparse suffix array for the (evenly spaced) suffixes starting at kτ in Iright, k = 0, 1, . . . , (I/2)/τ , see [9]. Now for every suffix in Ileft find its location in the sparse suffix array. From this data one can compute the desired answer. The time to compute the sparse suffix array is O(n) and the space is O(n/τ ). The time to search a suffix in Ileft is O(n + log(I/τ )) using the classical suffix search in the suffix array [20]. The time per I is O(In). Overall levels this yields O(n · n + n · (n/2) + n · (n/4) + ··· + n · 1) = O(n2) time. The Nearby Indices Data Structure If Tk is periodic then we need to find its period pk and find the length ℓk of the maximum substring starting at position kτ , which has period pk. Finding period pk, if it exists, in Tk can be done in O(τ ) time and constant space using the algorithm of [3]. The overall time is O(n) and the overall space is O(n/τ ) for the pk's. To compute ℓk we check whether the period pk of Tk extends to Tk+2. That is whether pk is the period of T [kτ...(k + 4)τ − 1]. The following is why we do so. Lemma 2. Suppose Tk and Tk+2 are periodic with periods pk and pk+2, respec- tively. If Tk · Tk+2 is periodic with a period of length at most τ then pk is the period and pk+2 is a rotation of pk. Proof. To reach a contradition, suppose that pk is not the period of Tk · Tk+2, i.e., it has period p′ of length at most τ . Since Tk is of size 2τ , p′ must also be a period of Tk. However, pk and p′ are both prefixes of Tk and, hence, must have different lengths. By Corollary 1 p′ must be a multiple of pk and, hence, not a period. The fact that pk+2 is a rotation of pk can be deduced similarly. ⊓⊔ By induction it follows that Tk · Tk+2 · Tk+4 · . . . · Tk+2M , M ≥ 1, is periodic with pk if each concatenated pair of Tk+2i · Tk+2(i+1) is periodic with a period at most τ . This suggests the following scheme. Generate a binary array of length n/τ where location j is 1 iff Tk+2(j−1) · Tk+2j has a period of length of at most τ . In all places where there is a 0, i.e., Tk · Tk+2 does not have a period of length at most τ and Tk does have period pk, we have that ℓk ∈ [2τ, 4τ − 1]. We directly compute ℓk by extending pk in Tk · Tk+2 as far as possible. Now, using the described array and the ℓk ∈ [2τ, 4τ − 1], in a single sweep for the even kτ 's (and a seperate one for the odd ones) from right to left we can compute all ℓk's. It is easy to verify that the overall time is O(n) and the space is O(n/τ ). 3 Randomized Trade-Offs In this section we describe a randomized LCE data structure using O(n/τ ) space with O(τ + log ℓ τ ) query time. In Section 3.6 we describe another O(n/τ )-space LCE data structure that either answers an LCE query in constant time, or provides a certificate that ℓ ≤ τ 2. Combining the two data structures, shows that the LCE problem can be solved in O(n/τ ) space and O(τ ) time. The randomization comes from our use of Karp-Rabin fingerprints [10] for comparing substrings of T for equality. Before describing the data structure, we start by briefly recapping the most important definitions and properties of Karp-Rabin fingerprints. 3.1 Karp-Rabin Fingerprints For a prime p and x ∈ [p] the Karp-Rabin fingerprint [10], denoted φp,x(T [i...j]), of the substring T [i...j] is defined as φp,x(T [i...j]) = X i≤k≤j T [k]xk−i mod p . If T [i...j] = T [i′...j′] then clearly φp,x(T [i...j]) = φp,x(T [i′...j′]). In the Monte Carlo and the Las Vegas algorithms we present we will choose p such that p = Θ(n4+c) for some constant c > 0 and x uniformly from [p]\ {0}. In this case a simple union bound shows that the converse is also true with high probability, i.e., φ is collision-free on all substring pairs of T with probability at least 1−n−c. Storing a fingerprint requires O(1) space. When p, x are clear from the context we write φ = φp,x. For shorthand we write f (i) = φ(T [1, i]), i ∈ [1, n] for the fingerprint of the ith prefix of T . Assuming that we store the exponent xi mod p along with the fingerprint f (i), the following two properties of fingerprints are well-known and easy to show. Lemma 3. 1) Given f (i), the fingerprint f (i ± a) for some integer a, can be computed in O(a) time. 2) Given fingerprints f (i) and f (j), the fingerprint φ(T [i..j]) can be computed in O(1) time. In particular this implies that for a fixed length l, the fingerprint of all substrings of length l of T can be enumerated in O(n) time using a sliding window. 3.2 Overview The main idea in our solution is to binary search for the LCE(i, j) value using Karp-Rabin fingerprints. Suppose for instance that φ(T [i, i + M ]) 6= φ(T [j, j + M ]) for some integer M , then we know that LCE(i, j) ≤ M , and thus we can find the true LCE(i, j) value by comparing log(M ) additional pair of fingerprints. The challenge is to obtain the fingerprints quickly when we are only allowed to use O(n/τ ) space. We will partition the input string T into n/τ blocks each of length τ . Within each block we sample a number of equally spaced positions. The data structure consists of the fingerprints of the prefixes of T that ends at the sampled positions, i.e., we store f (i) for all sampled positions i. In total we sample O(n/τ ) positions. If we just sampled a single position in each block (similar to the approach in [2]), we could compute the fingerprint of any substring in O(τ ) time (see Lemma 3), and the above binary search algorithm would take time O(τ log n) time. We present a new sampling technique that only samples an additional O(n/τ ) positions, while improving the query time to O(τ + log(ℓ/τ )). Preliminary definitions We partition the input string T into n/τ blocks of τ positions, and by block k we refer to the positions [kτ, kτ + τ ), for k ∈ [n/τ ]. We assume without loss of generality that n and τ are both powers of two. Every position q ∈ [1, n] can be represented as a bit string of length lg n. Let q ∈ [1, n] and consider the binary representation of q. We define the leftmost lg(n/τ ) bits and rightmost lg(τ ) bits to be the head, denoted h(q) and the tail, denoted t(q), respectively. A position is block aligned if t(q) = 0. The significance of q, denoted s(q), is the number of trailing zeros in h(q). Note that the τ positions in any fixed block k ∈ [n/τ ] all have the same head, and thus also the same significance, which we denote by µk. See Figure 2. h(q) t(q) q 0 1 1 0 0 1 0 0 0 0 0 1 1 1 0 1 0 1 1 s(q) Fig. 2. Example of the definitions for the position q = 205035 in a string of length n = 219 with block length τ = 28. Here h(q) is the first lg(n/τ ) = 11 bits, and t(q) is the last lg(τ ) = 8 bits in the binary representation of q. The significance is s(q) = 5. 3.3 The Monte Carlo Data Structure The data structure consists of the values f (i), i ∈ S, for a specific set of sampled positions S ⊆ [1, n], along with the information necessary in order to look up the values in constant time. We now explain how to construct the set S. In block k ∈ [n/τ ] we will sample bk = min(cid:8)2⌊µk/2⌋, τ(cid:9) evenly spaced positions, where µk is the significance of the positions in block k, i.e., µk = s(kτ ). More precisely, in block k we sample the positions Bk = {kτ + jτ /bk j ∈ [bk]}, and let S = ∪k∈[n/τ ] Bk. See Figure 3. We now bound the size of S. The significance of a block is at most lg(n/τ ), and there are exactly 2lg(n/τ )−µ blocks with significance µ, so n/τ −1 lg(n/τ ) S = X k=0 bk ≤ X µ=0 2lg(n/τ )−µ2⌊µ/2⌋ ≤ n τ ∞ X µ=0 2−µ/2 = (cid:16)2 + √2(cid:17) n τ = O (cid:16) n τ (cid:17) . 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 4 0 1 0 2 0 1 0 3 0 1 0 2 0 1 0 4.0 1.0 1.0 1.0 2.0 1.0 1.0 1.0 2.0 1.0 1.0 1.0 2.0 1.0 1.0 1.0 k µk bk T Fig. 3. Illustration of a string T partitioned into 16 blocks each of length τ . The significance µk for the positions in each block k ∈ [n/τ ] is shown, as well as the bk values. The block dots are the sampled positions S. 3.4 Answering a query We now describe how to answer an LCE(i, j) query. We will assume that i is block aligned, i.e., i = kτ for some k ∈ [n/τ ]. Note that we can always obtain this situation in O(τ ) time by initially comparing at most τ − 1 pairs of characters of the input string directly. Algorithm 1 shows the query algorithm. It performs an exponential search to locate the block in which the first mismatch occurs, after which it scans the block directly to locate the mismatch. The search is performed by calls to check(i, j, c), which computes and compares φ(T [i...i + c]) and φ(T [j...j + c]). In other words, assuming that φ is collision-free, check(i, j, c) returns true if LCE(i, j) ≥ c and false otherwise. ⊲ Compute an interval such that ℓ ∈ [ℓ, 2ℓ]. (i, j, ℓ) ← (i + 2µτ, j + 2µτ, ℓ + 2µτ ) if s(j) > µ then ℓ ← 0 µ ← 0 while check(i, j, 2µτ ) do Algorithm 1 Computing the answer to a query LCE(i, j) 1: procedure LCE(i, j) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: µ ← µ − 1 (i, j, ℓ) ← (i + 1, j + 1, ℓ + 1) (i, j, ℓ) ← (i + 2µ−1τ, j + 2µ−1τ, ℓ + 2µ−1τ ) return ℓ µ ← µ + 1 while µ > 0 do if check(i, j, 2µ−1τ ) then ⊲ Identify the block in which the first mismatch occurs while T [i] = T [j] do ⊲ Scan the final block left to right to find the mismatch Analysis We now prove that Algorithm 1 correctly computes ℓ = LCE(i, j) in O(τ + log(ℓ/τ )) time. The algorithm is correct assuming that check(i, j, 2µτ ) always returns the correct answer, which will be the case if φ is collision-free. The following is the key lemma we need to bound the time complexity. Lemma 4. Throughout Algorithm 1 it holds that ℓ ≥ (2µ − 1) τ , s(j) ≥ µ, and µ is increased in at least every second iteration of the first while-loop. Proof. We first prove that s(j) ≥ µ. The claim holds initially. In the first loop j is changed to j + 2µτ , and s(j + 2µτ ) ≥ min{s(j), s(2µτ )} = min{s(j), µ} = µ, where the last equality follows from the induction hypothesis s(j) ≥ µ. Moreover, µ is only incremented when s(j) > µ. In the second loop j is changed to j+2µ−1τ , which under the assumption that s(j) ≥ µ, has significance s(j + 2µ−1τ ) = µ− 1. Hence the invariant is restored when µ is decremented at line 11. Now consider an iteration of the first loop where µ is not incremented, i.e., is even, and hence s(j+2µτ ) > µ, s(j) = µ. Then j so µ will be incremented in the next iteration of the loop. 2µτ is an odd integer, i.e. j+2µτ In order to prove that ℓ ≥ (2µ − 1) τ we will prove that ℓ ≥ (2µ − 1) τ in the first loop. This is trivial by induction using the observation that (2µ − 1) τ + 2µτ = (cid:0)2µ+1 − 1(cid:1) τ . ⊓⊔ Since ℓ ≥ (2µ − 1)τ and µ is increased at least in every second iteration of the first loop and decreased in every iteration of the second loop, it follows that 2µτ there are O(log(ℓ/τ )) iterations of the two first loops. The last loop takes O(τ ) time. It remains to prove that the time to evaluate the O(log(ℓ/τ )) calls to check(i, j, 2µτ ) sums to O(τ + log(ℓ/τ )). Evaluating check(i, j, 2µτ ) requires computing φ(T [i...i+2µτ ]) and φ(T [j...j+ 2µτ ]). The first fingerprint can be computed in constant time because i and i + 2µτ are always block aligned (see Lemma 3). The time to compute the second fingerprint depends on how far j and j + 2µτ each are from a sampled position, which in turn depends inversely on the significance of the block containing those positions. By Lemma 4, µ is always a lower bound on the significance of j, which implies that µ also lower bounds the significance of j + 2µτ , and thus by the way we sample positions, neither will have distance more than τ /2⌊µ/2⌋ to a sam- pled position in S. Finally, note that by the way µ is increased and decreased, check(i, j, 2µτ ) is called at most three times for any fixed value of µ. Hence, the total time to compute all necessary fingerprints can be bounded as   O lg(ℓ/τ ) X µ=0 1 + τ /2⌊µ/2⌋  = O(τ + log(ℓ/τ )) . 3.5 The Las Vegas Data Structure We now describe an O(cid:0)n3/2(cid:1)-time and O(n/τ )-space algorithm for verifiying that φ is collision-free on all pairs of substrings of T that the query algorithm compares. If a collision is found we pick a new φ and try again. With high probability we can find a collision-free φ in a constant number of trials, so we obtain the claimed Las Vegas data structure. If τ ≤ √n we use the verification algorithm of Bille et al. [2], using O(nτ + n log n) time and O(n/τ ) space. Otherwise, we use the simple O(n2/τ )-time and O(n/τ )-space algorithm described below. Recall that all fingerprint comparisions in our algorithm are of the form φ(cid:0)T [kτ...kτ + 2lτ − 1](cid:1) ?= φ(cid:0)T [j...j + 2lτ − 1](cid:1) for some k ∈ [n/τ ], j ∈ [n], l ∈ [log(n/τ )]. The algorithm checks each l ∈ [log(n/τ )] separately. For a fixed l it stores the fingerprints φ(T [kτ...kτ + 2lτ ]) for all k ∈ [n/τ ] in a hash table H. This can be done in O(n) time and O(n/τ ) space. For every j ∈ [n] the algorithm then checks whether φ(cid:0)T [j...j + 2lτ ](cid:1) ∈ H, and if so, it verifies that the underlying two substrings are in fact the same by comparing them character by character in O(2lτ ) time. By maintaining the fin- gerprint inside a sliding window of length 2lτ , the verification time for a fixed l becomes O(n2lτ ), i.e., O(n2/τ ) time for all l ∈ [log(n/τ )]. 3.6 Queries with Long LCEs In this section we describe an O( n τ ) space data structure that in constant time either correctly computes LCE(i, j) or determines that LCE(i, j) ≤ τ 2. The data structure can be constructed in O(n log n τ ) time by a Monte Carlo or Las Vegas algorithm. The Data Structure Let Sτ ⊆ [1, n] called the sampled positions of T (to be defined below), and consider the sets A and B of suffixes of T and T R, respectively. A = {T [i...] i ∈ Sτ} , B = {T [...i]R i ∈ Sτ} . We store a data structure for A and B, that allows us to perform constant time longest common extension queries on any pair of suffixes in A or any pair in B. This can be achieved by well-known techniques, e.g., storing a sparse suffix tree for A and B, equipped with a nearest common ancestor data structure. To define Sτ , let Dτ = {0, 1, . . . , τ} ∪ {2τ, . . . , (τ − 1)τ}, then Sτ = {1 ≤ i ≤ n i mod τ 2 ∈ Dτ} . (1) Answering a Query To answer an LCE query, we need the following def- initions. For i, j ∈ Sτ let LCER(i, j) denote the longest common prefix of T [...i]R ∈ B and T [...j]R ∈ B. Moreover, for i, j ∈ [n], we define the function δ(i, j) = (cid:0)((i − j) mod τ ) − i(cid:1) mod τ 2 . (2) We will write δ instead of δ(i, j) when i and j are clear from the context. The following lemma gives the key property that allows us to answer a query. Lemma 5. For any i, j ∈ [n − τ 2], it holds that i + δ, j + δ ∈ Sτ . Proof. Direct calculation shows that (i + δ) mod τ 2 ≤ τ , and that (j + δ) mod τ = 0, and thus by definition both i + δ and j + δ are in Sτ . To answer a query LCE(i, j), we first verify that i, j ∈ [n − τ 2] and that LCER(i+δ, j+δ) ≥ δ. If this is not the case, we have established that LCE(i, j) ≤ δ < τ 2, and we stop. Otherwise, we return δ + LCE(i + δ, j + δ) − 1. Analysis To prove the correctness, suppose i, j ∈ [n − τ 2] (if not clearly LCE(i, j) < τ 2) then we have that i + δ, j + δ ∈ Sτ (Lemma 5). If LCER(i + δ, j + δ) ≥ δ it holds that T [i...i + δ] = T [j...j + δ] so the algorithm correctly computes LCE(i, j) as δ + 1 + LCE(i + δ, j + δ). Conversely, if LCER(i + δ, j + δ) < δ, T [i...i + δ] 6= T [j...j + δ] it follows that LCE(i, j) < δ < τ 2. Query time is O(1), since computing δ, LCER(i+δ, j +δ) and LCE(i+δ, j +δ) all takes constant time. Storing the data structures for A and B takes space O(A + B) = O(Sτ) = O( n τ ). For the preprocessing stage, we can use recent algorithms by I et al. [8] for constructing the sparse suffix tree for A and B in O( n τ ) time (correct w.h.p.), and a Las Vegas algorithm using O( n τ ) space. They provide a Monte Carlo algorithm using O(n log n τ ) time (w.h.p.). 4 Derandomizing the Monte Carlo Data Structure Here we give a general technique for derandomizing Karp-Rabin fingerprints, and apply it to our Monte Carlo algorithm. The main result is that for any con- stant ε > 0, the data structure can be constructed completely deterministically in O(n2+ε) time using O(n/τ ) space. Thus, compared to the probabilistic pre- processing of the Las Vegas structure using O(n3/2) time with high probability, it is relatively cheap to derandomize the data structure completely. Our derandomizing technique is stated in the following lemma. Lemma 6. Let A, L ⊂ {1, 2, . . . , n} be a set of positions and lengths respectively such that max(L) = nΩ(1). For every ε ∈ (0, 1), there exist a fingerprinting function φ that can be evaluated in O (cid:0) 1 ε(cid:1) time and has the property that for all a ∈ A, l ∈ L, i ∈ {1, 2, . . . , n}: φ(T [a...a + (l− 1)]) = φ(T [i...i + (l− 1)]) ⇐⇒ T [a...a + (l− 1)] = T [i...i + (l− 1)] S max(L)L(cid:17) time, We can find such a φ using O (cid:0) S for any value of S ∈ [1,A]. Proof. We let p be a prime contained in the interval [max(L)nε, 2 max(L)nε]. The idea is to choose φ to be φ = (φp,x1 , . . . , φp,xk ) , k = O(1/ε), where φp,xi is the Karp-Rabin fingerprint with parameters p and xi. Let Σ be the alphabet containing the characters of T . If p ≤ Σ we note that since p = nΩ(1) and Σ = nO(1) we can split each character into O(1) characters from a smaller alphabet Σ′ satisfying p > Σ′. So wlog. assume p > Σ from now on. ε (cid:1) space and O (cid:16) n1+ε log n A ε2 We let S be the set defined by: S = {(T [a . . . a + (l − 1)], T [i . . . i + (l − 1)]) a ∈ A, l ∈ L, i ∈ {1, 2, . . . , n}} Then we have to find φ such that φ(u) = φ(v) ⇐⇒ u = v for all (u, v) ∈ S. We will choose φp,x1 , φp,x2, . . . , φp,xk successively. For any 1 ≤ l ≤ k we let φ≤l = (φp,x1, . . . , φp,xl). For any fingerprinting function f we denote by B(f ) the number of pairs (u, v) ∈ S such that f (u) = f (v). We let B(id) denote the number of pairs (u, v) ∈ S such that u = v. Hence B(f ) ≥ B(id) for every fingerprinting function f , and f satisfies the requirement iff B(f ) = B(id). Say that we have chosen φ≤l for some l < k. We now compare B(φ≤l+1) = B((φp,xl+1 , φ≤l)) to B(φ≤l) when xl+1 is chosen uniformly at random from [p]. For any pair (u, v) ∈ S such that u 6= v and φ≤l(u) = φ≤l(v) we see that, if xl+1 is chosen randomly independently then the probability that φp,xl+1(u) = φp,xl+1(v) is at most max{u,v} p ≤ n−ε. Hence Exl+1(B(φ≤l+1) − B(id)) ≤ B(φ≤l) − B(id) nε , and thus there exists xl+1 ∈ {0, 1, . . . , p − 1} such that B(φ≤l+1) − B(id)) ≤ B(φ≤l) − B(id) nε . Now consider the algorithm where we construct φ successively by choosing xl+1 such that B(φ≤l+1) is as small as possible. Then4 B(φ≤k−1) − B(id) nε B(1) − B(id) . nkε ≤ . . . ≤ ε L n log n A B(φ) − B(id) = B(φ≤k) − B(id) ≤ Since B(1) ≤ n3 and B(φ) − B(id) is an integer it suffices to choose k = (cid:6) 4 order to conclude that B(φ) = B(id). ε(cid:7) in We just need to argue that for given x1, . . . , xl we can find B(φ≤l) in space S (cid:17). First we show how to do it in the case S = ε S(cid:1) and time O (cid:16) 1 O (cid:0) 1 A. To this end we will count the number of collisions for all (u, v) ∈ S such that u = v = l ∈ L for some fixed l ∈ L. First we compute φ≤l(T [a . . . a+(l−1]) for all a ∈ A and store them in a multiset. Using a sliding window the fingerprints can be computed and inserted in time O (ln log n) Now for each position i ∈ [1, n] we compute φ≤l(T [i . . . i + (l− 1]) and count the number of times the fingerprint appears in the multiset. Using a sliding window this can be done in O (ln log n) time as well. Doing this for all l ∈ L gives the number of collisions. S (cid:17) and partition A into A1, . . . , Ar consisting of ≤ S elements each. For each j = 1, 2, . . . , r we define Sj as Now assume that S < A. Then let r = l A S m = O (cid:16) A Sj = {(T [a . . . a + (l − 1)], T [i . . . i + (l − 1)]) a ∈ Aj, l ∈ L, i ∈ {1, 2, . . . , n}} Then S1, . . . , Sr is a partition of S. For each j = 1, 2, . . . , r we can find the collisions in among the elements in Sj in the manner described above. Doing this for each j and adding the results is sufficient to get the desired space and ⊓⊔ time complexity. Corollary 2. For any τ ∈ [1, n], the LCE problem can be solved by a deter- ministic data structure with O(n/τ ) space usage and O(τ ) query time. The data structure can be constructed in O(n2+ε) time using O(n/τ ) space. Proof. We use the lemma with A = {kτ k ∈ [n/τ ]}, L = {2lτ l ∈ [log(n/τ )]}, S = A = n/τ and a suitable small constant ε > 0. References 1. A. Amir, M. Lewenstein, and E. Porat. Faster algorithms for string matching with k mismatches. J. Algorithms, 50(2):257 -- 275, 2004. 4 B(1) is equal to S since 1 is the constant function 2. P. Bille, I. L. Gørtz, B. Sach, and H. W. Vildhøj. Time-space trade-offs for longest common extensions. J. of Discrete Algorithms, 25:42 -- 50, 2014. 3. D. Breslauer, R. Grossi, and F. Mignosi. Simple real-time constant-space string matching. Theor. Comput. Sci., 483:2 -- 9, 2013. 4. R. Cole and R. Hariharan. Approximate String Matching: A Simpler Faster Algo- rithm. SIAM J. Comput., 31(6):1761 -- 1782, 2002. 5. N. J. Fine and H. S. Wilf. Uniqueness Theorems for Periodic Functions. Proc. AMS, 16(1):109 -- 114, 1965. 6. D. Gusfield and J. Stoye. Linear time algorithms for finding and representing all the tandem repeats in a string. J. Comput. Syst. Sci., 69:525 -- 546, 2004. 7. D. Harel and R. E. Tarjan. Fast algorithms for finding nearest common ancestors. SIAM J. Comput., 13(2):338 -- 355, 1984. 8. T. I, J. Karkkainen, and D. Kempa. Faster Sparse Suffix Sorting. In Proc. 31st STACS, volume 25, pages 386 -- 396, Dagstuhl, Germany, 2014. 9. J. Karkkainen and E. Ukkonen. Sparse suffix trees. In Computing and Combina- torics, Second Annual International Conference, COCOON '96, Hong Kong, June 17-19, 1996, Proceedings, pages 219 -- 230, 1996. 10. R. M. Karp and M. O. Rabin. Efficient randomized pattern-matching algorithms. IBM J. Res. Dev., 31(2):249 -- 260, 1987. 11. O. Keller, T. Kopelowitz, and M. Lewenstein. Range non-overlapping indexing and successive list indexing. In Proc. of Workshop on Algorithms and Data Structures (WADS), pages 625 -- 636, 2007. 12. R. Kolpakov and G. Kucherov. Searching for gapped palindromes. In Proc. 19th CPM, LNCS, volume 5029, pages 18 -- 30, 2008. 13. G. M. Landau, E. W. Myers, and J. P. Schmidt. Incremental string comparison. SIAM J. Comput., 27(2):557 -- 582, 1998. 14. G. M. Landau and J. P. Schmidt. An Algorithm for Approximate Tandem Repeats. J. Comput. Biol., 8(1):1 -- 18, 2001. 15. G. M. Landau and U. Vishkin. Fast Parallel and Serial Approximate String Match- ing. J. Algorithms, 10:157 -- 169, 1989. 16. H.-P. Lenhof and M. H. M. Smid. Using persistent data structures for adding range restrictions to searching problems. Theoretical Informatics and Applications (ITA), 28(1):25 -- 49, 1994. 17. M. Lewenstein. Orthogonal range searching for text indexing. In Space-Efficient Data Structures, Streams, and Algorithms, pages 267 -- 302, 2013. 18. M. G. Main and R. J. Lorentz. An O (n log n) algorithm for finding all repetitions in a string. J. Algorithms, 5(3):422 -- 432, 1984. 19. G. Manacher. A New Linear-Time "On-Line" Algorithm for Finding the Smallest Initial Palindrome of a String. J. ACM, 22(3):346 -- 351, 1975. 20. U. Manber and E. W. Myers. Suffix arrays: A new method for on-line string searches. SIAM J. Comput., 22(5):935 -- 948, 1993. 21. E. W. Myers. An O(N D) difference algorithm and its variations. Algorithmica, 1(2):251 -- 266, 1986. 22. P. Weiner. Linear pattern matching algorithms. In Proc. 14th FOCS (SWAT), pages 1 -- 11, 1973.
1207.0933
1
1207
2012-07-04T10:02:15
Optimal Cuts and Bisections on the Real Line in Polynomial Time
[ "cs.DS", "cs.CC", "cs.DM" ]
The exact complexity of geometric cuts and bisections is the longstanding open problem including even the dimension one. In this paper, we resolve this problem for dimension one (the real line) by designing an exact polynomial time algorithm. Our results depend on a new technique of dealing with metric equalities and their connection to dynamic programming. The method of our solution could be also of independent interest.
cs.DS
cs
Optimal Cuts and Bisections on the Real Line in Polynomial Time Marek Karpinski∗ Andrzej Lingas† Dzmitry Sledneu‡ Abstract The exact complexity of geometric cuts and bisections is the longstanding open problem including even the dimension one. In this paper, we resolve this problem for dimension one (the real line) by designing an exact polynomial time algorithm. Our results depend on a new technique of dealing with metric equalities and their connection to dynamic programming. The method of our solution could be also of independent interest. 1 Introduction The metric MAX-CUT, MAX-BISECTION, MIN-BISECTION and other Partitioning prob- lems were all proved to have polynomial time approximation schemes (PTAS) [5, 3, 1, 4, 2, 6]. The above problems are known to be NP-hard in exact setting. The status of those problems for geometric (thus including Euclidean) metrics and this even for dimension one was widely open. In this paper we resolve the status of those problems for just dimension one by giving a polynomial time algorithm. Our solution, somewhat surprisingly, involves certain new ideas for applying dynamic programming which could be also of independent interest. 2 Preliminaries and General Setting We shall define our dynamic programming method in terms of generalized subproblems on finite multisets of reals generalizing slightly a geometric metric setting. For a partition of a finite multiset P of reals into two multisets P1 and P2, the value of the cut is the total length of all intervals on the real line that have one endpoint in P1 and the other one in P2. ∗Research supported partly by DFG grants and the Hausdorff Center grant EXC59-1. Department of Computer Science, University of Bonn. Email: [email protected] †Research supported in part by VR grant 621-2008-4649. Department of Computer Science, Lund Uni- versity. Email: [email protected] ‡Centre for Mathematical Sciences, Lund University. Email: [email protected]. 1 The MAX-CUT problem for P will be now to find a partition of P into two multisets that maximizes the value of the cut. If P = n and the two multisets are additionally required to be of cardinality k and n− k, respectively, then we obtain the (k, n− k) MAX-PARTITION problem for P. In particular, if n is even and k = n/2 then we have the MAX-BISECTION problem. Next, if we replace the requirement of maximization with that of minimization then we obtain the (k, n − k) MIN-PARTITION and MIN-BISECTION problems for P , respectively. In this paper we study geometric instances of the above problems in dimension one (the real line) which could be rephrased as the problems of partitioning arbitrary finite metric spaces of this dimension. 3 The Algorithm The global idea behind our algorithm is as follows. We guess how many of the copies of the rightmost real are respectively in the first and second set and move them to the next to the rightmost real. We also guess how many copies of the reals in the remaining part of the multiset are in the first and second set respectively. Having this information, we can compute exactly the difference between the value of optimal solution for the whole input multiset and that for the multiset resulting from the movement under the guessed partition proportions. The difference can be easily evaluated due to the triangle equality that holds on the real line. Now, we solve the problem for the transformed multiset whose elements are copies of the shrunk set of reals recursively under the guessed partition proportions, after additionally guessing the proportions of the partition for the original copies of the next to the right real. Eventually, we end up with the trivial multiset where all elements are copies of the leftmost real. We eliminate guesses by an enumeration of all possibilities and choosing the best one. Next, we solve the resulting subproblems in bottom up fashion instead the top down to obtain a polynomial time solution. Consider a finite multiset P of reals. We assume that P = n and that P consists of copies of l ≤ n distinct reals. For i = 1, ..., l, let xi denote the i-th smallest real whose copy is in P, and let Pi denote the sub-multiset of P consisting of all elements of P which are copies of reals in {x1, ..., xi}. For convention, we assume P0 = ∅. We shall consider a family of generalized subproblems Si(p, q, r, t), where i ∈ {1, ..., l}, p, q, r, t are integers in {0, ..., n} such that p + q = Pi−1 and r + t = n − Pi−1. The subproblem Si(p, q, r, t) is to find for a multiset that is the union of Pi−1 with r + t copies of xi a partition into two multisets such that p elements of Pi and r copies of xi form the first set and the value of the cut is maximized. The value of such a maximum cut is denoted by M AXCU T (Si(p, q, r, t)). Lemma 1. For i ≥ 2, M AXCU T (Si(p, q, r, t)) = (xi − xi−1)(pt + qr)+ + maxr0≤p∧t0≤q∧r0+t0=Pi−1−Pi−2 M AXCU T (Si−1(p − r0, q − t0, r0 + r, t0 + t)). Proof. For 1 ≤ r0 ≤ p ∧ 1 ≤ t0 ≤ q, consider an optimal solution to Si−1(p − r0, q − t0, r0 + r, t0 + t), where r0 + t0 = Pi−1 − Pi−2. Let us move r copies of the real xi−1 in the first 2 Figure 1: Si−1(p − r0, q − t0, r0 + r, t0 + t). Figure 2: Si(p, q, r, t). set of the solution to the real xi and t copies of xi−1 in the second set of the solution to the same real xi. We obtain a feasible solution to Si(p, q, r, t) whose cut value is (xi − xi−1)(pt + qr) + M AXCU T (Si−1(p− r0, q− t0, r0 + r, t0 + t)). It follows that M AXCU T (Si(p, q, r, t)) ≥ (xi − xi−1)(pt + qr)+ + maxr0≤p∧t0≤q∧r0+t0=Pi−1−Pi−2 M AXCU T (Si−1(p − r0, q − t0, r0 + r, t0 + t)). Contrary, consider an optimal solution to Si(p, q, r, t). Suppose that r0 copies of xi−1 are in the first set of the solution and t0 copies of xi−1 are in the second set of the solution. Note that r0 + t0 = Pi−1 − Pi−2 holds. Let us move r copies of xi in the first set of the solution to the real xi−1 and t copies of xi in the second set of the solution to the same real xi−1. We obtain a feasible solution to Si−1(p − r0, q − t0, r0 + r, t0 + t) whose cut value is M AXCU T (Si(p, q, r, t)) − (xi − xi−1)(pt + qr). It follows that M AXCU T (Si(p, q, r, t)) ≤ (xi − xi−1)(pt + qr)+ + maxr0≤p∧t0≤q∧r0+t0=Pi−1−Pi−2 M AXCU T (Si−1(p − r0, q − t0, r0 + r, t0 + t)). Theorem 1. The geometric MAX-CUT problem on the real line as well as the geometric MAX-BISECTION problem on the real line are solvable in O(n4) time. Proof. First, we shall show that the subproblems Si(p, q, r, t), where i ∈ {1, ..., l}, p, q, r, t are integers in {0, ..., n} such that p + q = Pi−1 and r + t = n−Pi−1 are solvable in O(n4) time. Since p + q = Pi−1, there are O(n) choices for the parameters p, q, and similarly since r + t = n − Pi−1, there are O(n) choices for the parameters r, t. It follows that the total number of considered subproblems is O(n3). We can compute the values of M AXCU T (Si(p, q, r, t)) in bottom up fashion in increasing i order. If i = 1, then p = 0 and q = 0 and M AXCU T (Si(p, q, r, t)) = 0 holds trivially. For i ≥ 2, we apply Lemma 1 in order to compute the value of M AXCU T (Si(p, q, r, t)) in O(n) 3 x1...xi−2xi−1xiq−t0p−r0t0r0trq−t0p−r0t0r0trx1...xi−2xi−1xi time by r0 + t0 = Pi−1 − Pi−2. The corresponding optimal solutions can be obtained by backtracking. The upper bound O(n4) follows. Let xl be the largest real whose copy is in P, and let m be the number of copies of xl in P. The optimal solution to the geometric MAX-CUT problem for P can be found among the optimal solutions to the O(n2) subproblems Sk(p, q, r, t), where p + q = Pk−1 and r + t = m. Furthermore, the optimal solution to the geometric (k, n− k) MIN-PARTITION problem for P can be found among the optimal solutions to the O(n) subproblems Sk(p, q, r, t), where p + q = Pk−1, r + t = m, p + r = k and q + t = n − k. To solve the (k, n− k) MIN-PARTITION problem on the real line, we consider an analo- gous family of generalized subproblems Ui(p, q, r, t), where i ∈ {1, ..., l}, p, q, r, t are integers in {0, ..., n} such that p + q = Pi−1 and r + t = n − Pi−1. The subproblem Ui(p, q, r, t) is to find for a multiset that is the union of Pi−1 with r + t copies of xi a partition into two multisets such that p elements of Pi and r copies of xi form the first set and the value of the cut is minimized. The value of such a minimum cut is denoted by M IN CU T (Si(p, q, r, t)). Analogously, we obtain the following counterparts of Lemma 1 and Theorem 1 for (k, n− k) MIN-PARTITION and MIN-BISECTION. Lemma 2. For i ≥ 2, M IN CU T (Ui(p, q, r, t)) = (xi−xi−1)(pt+qr)+minr0≤p∧t0≤q∧r0+t0=Pi−1−Pi−2 M IN CU T (Ui−1(p−r0, q−t0, r0+r, t0+t)). Theorem 2. The geometric (k, n − k) MIN-PARTITION problem on the real line, in par- ticular the geometric MIN-BISECTION problem on the real line, are analogously solvable by dynamic programming in O(n4) time. 4 Final Remarks It remains an open problem whether our method can be generalized to higher dimensions or those problems turn out to be inherently hard. At stake is the exact computational status of other geometric problems for which our knowledge is very limited at the moment. 5 Acknowledgments We thank Uri Feige, Ravi Kannan and Christos Levcopoulos for a number of interesting discussions on the subject of this paper. References [1] N. Alon, W.F. de la Vega, R. Kannan and M. Karpinski. Random Sampling and Approximation of MAX-CSPs. J. Computer and System Sciences 67 (2003), pp. 212 -- 243. [2] W.F. de la Vega, R. Kannan, M. Karpinski and S. Vempala. Tensor Decomposition and Approximation Schemes for Constraint Satisfaction Problems. Proc. 37th ACM STOC (2005), pp. 747 -- 754. 4 [3] W.F. de la Vega and M. Karpinski. Polynomial Time Approximation of Dense Weighted Instances of MAX-CUT. Random Structures and Algorithms 16 (2000), pp. 314 -- 332. [4] W.F. de la Vega, M. Karpinski and C. Kenyon. Approximation Schemes for Metric Bisection and Partitioning. Proc. 15th ACM-SIAM SODA (2004), pp. 506 -- 515. [5] W.F. de la Vega and C. Kenyon. A Randomized Approximation Scheme for Metric MAX- CUT. Proc. Proc. 39th IEEE FOCS (1998), pp. 468 -- 471; journal version in J. Computer and System Sciences 63 (2001), pp. 531 -- 541. [6] R. Kannan. Spectral Methods for Matrices and Tensors. Proc. 42nd ACM STOC (2010), pp. 1 -- 12. 5
1112.3506
3
1112
2013-11-06T16:02:31
Max-Cut Parameterized Above the Edwards-Erd\H{o}s Bound
[ "cs.DS", "cs.CC", "cs.DM" ]
We study the boundary of tractability for the Max-Cut problem in graphs. Our main result shows that Max-Cut above the Edwards-Erd\H{o}s bound is fixed-parameter tractable: we give an algorithm that for any connected graph with n vertices and m edges finds a cut of size m/2 + (n-1)/4 + k in time 2^O(k)n^4, or decides that no such cut exists. This answers a long-standing open question from parameterized complexity that has been posed several times over the past 15 years. Our algorithm is asymptotically optimal, under the Exponential Time Hypothesis, and is strengthened by a polynomial-time computable kernel of polynomial size.
cs.DS
cs
Max-Cut Parameterized Above the Edwards-Erdos Bound Robert Crowston∗ Mark Jones† Matthias Mnich‡ We study the boundary of tractability for the Max-Cut problem in graphs. Our main result shows that Max-Cut parameterized above the Edwards-Erdos bound is fixed-parameter tractable: we give an algorithm that for any connected graph with n vertices and m edges finds a cut of size Abstract 4 in time 2O(k) · n4, or decides that no such cut exists. number of times over the past 15 years. n − 1 + m 2 + k This answers a long-standing open question from parameterized complexity that has been posed a Our algorithm is asymptotically optimal, under the Exponential Time Hypothesis, and is strength- ened by a polynomial-time computable kernel of polynomial size. 1 Introduction The study of cuts in graphs is a fundamental area in theoretical computer science, graph theory, and polyhedral combinatorics, dating back to the 1960s. A cut of a graph is an edge-induced bipartite subgraph, and its size is the number of edges it contains. Finding cuts of maximum size in a given graph was one of Karp's famous 21 NP-complete problems [25]. Since then, the Max-Cut problem has received considerable attention in the areas of approximation algorithms, random graph theory, combinatorics, parameterized complexity, and others; see the survey [36]. As a fundamental NP-complete problem, the computational complexity of Max-Cut has been inten- sively scrutinized. We continue this line of research and explore the boundary between tractability and hardness, guided by the question: Is there a dichotomy of computational complexity of Max-Cut with respect to the size of the maximum cut? This question was already studied by Erdos [17] in the 1960s, who gave a randomized polynomial-time algorithm that in any n-vertex graph with m edges finds a cut of size at least m/2. Erdos [17, 18] also (erroneously) conjectured that the value m/2 can be raised to m/2 + εm for some ε > 0; only much later it was shown [22, 34] that finding cuts of size m/2 + εm is NP-hard for every ε > 0. Furthermore, the ∗Royal Holloway - University of London, United Kingdom. [email protected] †Royal Holloway - University of London, United Kingdom. [email protected] ‡Cluster of Excellence, Saarbrucken, Germany. [email protected] 1 Max-Cut Gain problem -- maximize the gain compared to a random solution that cuts m/2 edges -- does not allow constant approximation [26] under the Unique Games Conjecture, and the best one can hope for is to cut a 1/2 + Ω(ε/ log(1/ε)) fraction of edges in graphs in which the optimum is 1/2 + ε [8]. However, the lower bound m/2 can be increased, by a sublinear function: Edwards [15, 16] in 1973 proved that in connected graphs a cut of size m/2 + (n − 1)/4, (1) always exists. Thus, any graph with n vertices, m edges and t components has a cut of size at least m/2 + (n − t)/4. The lower bound (1) is famously known as the Edwards-Erdos bound, and it is tight for cliques of every odd order n. The bound has been proved several times [6, 9, 19, 34, 35], with some proofs yielding polynomial-time algorithms to attain it. As (1) is tight for infinitely many non-isomorphic graphs, and finding maximum cuts is NP-hard, raising the lower bound (1) even further requires a new approach: a fixed-parameter algorithm, that for any connected graph with n vertices and m edges, and integer k ∈ N, finds a cut of size at least m/2 + (n − 1)/4 + k (if such exists) in time f (k) · nc, where f is an arbitrary function dependent only on k and c is an absolute constant independent of k. The point here is to confine the combinatorial explosion to the (small) parameter k. But at first sight, it seems not even clear how to find a cut of size m/2 + (n − 1)/4 + k in time nf (k), for any function f . We refer to the books by Downey and Fellows [14] and Flum and Grohe [20] for background on parameterized complexity. In 1997, Mahajan and Raman [29] gave a fixed-parameter algorithm for the variant of this problem with Erdos' lower bound m/2, and showed how to decide existence of a cut of size m/2 + k in time 2O(k) · nO(1). Their result was strengthened by Bollob´as and Scott [6] who replaced m/2 by the stronger bound (2) m/2 + 1 8 (cid:0)√8m + 1 − 1(cid:1) . For unweighted graphs, this bound is weaker than (1). It remained an open question ([9, 21, 29, 30, 38]) whether this result could be strengthened further by replacing (2) with the stronger bound (1). 1.1 Main Results We settle the computational complexity of Max-Cut above the Edwards-Erdos bound (1). Theorem 1. There is an algorithm that computes, for any connected graph G with n vertices and m edges and any integer k ∈ N, in time 2O(k) · n4 a cut of G with size at least m/2 + (n − 1)/4 + k, or decides that no such cut exists. Theorem 1 answers a question posed several times over the past 15 years [9, 21, 29, 30, 38]. In particu- lar, instances with k = O(log m) can be solved efficiently, which thus extends the classical polynomial-time algorithms [6, 9, 19, 34] that compute a cut of size (1). The running time of our algorithm is likely to be optimal, as the following theorem shows. Theorem 2. No algorithm can find cuts of size m/2 + (n− 1)/4 + k in time 2o(k)· nO(1) given a connected graph with n vertices and m edges, and integer k ∈ N, unless the Exponential Time Hypothesis fails. 2 The Exponential Time Hypothesis was introduced by Impagliazzo and Paturi [24], and states that n-variable 3-CNF-SAT formulas cannot be solved in time subexponential in n. Fixed-parameter tractability of Max-Cut above Edwards-Erdos bound m/2 + (n − 1)/4 implies the existence of a so-called kernelization, which is an algorithm that efficiently compresses any instance (G, k) into an equivalent instance (G′, k′), the kernel, whose size g(k) = G′ + k′ itself depends on k only. Alas, the size g(k) of the kernel for many fixed-parameter tractable problems is enormous, and in particular many fixed-parameter tractable problems do not admit kernels of size polynomial in k unless coNP ⊆ NP/poly [5]. We prove the following. Theorem 3. There is a polynomial-time algorithm that, for any integer k ∈ N, compresses any connected graph G = (V, E) with integer k ∈ N to a connected graph G′ = (V ′, E′) of order O(k5), and produces an integer k′ ≤ k, such that G has a cut of size E/2 + (V − 1)/4 + k if and only if G′ has a cut of size E′/2 + (V ′ − 1)/4 + k′, for some k′ ≤ k. Note that Theorems 1 and 3 only hold for unweighted graphs; determining the parameterized com- plexity of the weighted versions remains open. 1.2 Our Techniques and Related Work A number of standard approaches that have been developed for "above-guarantee" parameterizations of other problems are unavailable for this problem; hence, our algorithm differs significantly from others in the area. The most common approach is to use probabilistic analysis of a random variable whose expected value corresponds to a solution matching the guarantee. However, there is no simple randomized procedure known giving a cut of size m/2 + (n− 1)/4. Another approach is to make use of approximation algorithms that give a factor-c approximation, when the problem is parameterized above the bound c· n; here, n is the maximum value of the objective function; yet there is no such approximation algorithm for the Max-Cut problem. Instead, we make use of "one-way" reduction rules. Unlike standard reduction rules, our rules do not produce an equivalent instance, but merely preserve "no"-instances. If they produce a "yes"-instance we know the original instance is also a "yes"-instance, but if they do not, then this fact allows us to show the original instance has a relatively simple structure, which we can then use to solve the problem. We have not seen this approach used in parameterized algorithmics before, and it may prove useful in solving other problems where useful two-way reduction rules are hard to find. Our results are based on algorithmic as well as combinatorial arguments. To prove Theorem 1, we use one-way reduction rules to reduce the problem to one on graphs which are close to being in a special class of graphs we call "clique-forests", on which we show how to solve the problem efficiently. Theorem 2 follows from a straightforward parameterized reduction. Theorem 3 is proven by a careful analysis of random cuts via the probabilistic method. For variants of Max-Cut, the "boundary of tractability" above guaranteed values has also been investigated in the setting of parameterized complexity. For instance, in Max-Bisection we seek a cut such that the number of vertices in both sides of the bipartition is as equal as possible, the tight lower 3 bound on the bisection size is only m/2; fixed-parameter tractability of Max-Bisection above m/2 was recently shown by Gutin and Yeo [21] and Mnich and Zenklusen [33]. 2 Preliminaries With the exception of the term "clique-forest" (see below), we use standard graph theory terminology and notation. Given a graph G, let V (G) be the vertices of G and let E(G) be the edges of G. For disjoint sets S, T ⊆ V (G), let E(S, T ) denote the set of edges in G with one vertex in S and one vertex in T . For S ⊆ V (G), let G[S] denote the subgraph induced by the vertices of S, and let G − S denote the graph G[V (G) \ S]. We say that G has a cut of size t if there exists a set S ⊆ V (G) such that E(S, V (G) \ S) = t. The graph G is connected if any two of its vertices are connected by a path, and it is 2-connected if G − {v} is connected for every v ∈ V (G). A vertex v is a cut-vertex for G if G is connected and G − {v} is disconnected. We study the following formulation of Max-Cut parameterized above Edwards-Erdos bound: Max-Cut above Edwards-Erdos (Max-Cut-AEE) Instance: A connected graph G with n = V (G) vertices and m = E(G) edges, and an integer k ∈ N. Parameter : k. Question: Does G have a cut of size at least m 2 + n−1 4 + k 4 ? We ask for a cut of size m 4 + k, so that we may treat k as an integer at all times. Note that this does not affect the existence of a fixed-parameter algorithm or polynomial-size kernel. 4 , rather than the more usual m 2 + n−1 4 + k 2 + n−1 An assignment or coloring on G is a function α : V (G) → {red, blue}, and an edge is cut or satisfied by α if one of its vertices is colored red and the other vertex is colored blue. Note that a graph has a cut of size t if and only if it has an assignment that satisfies at least t edges. A partial assignment on G is a function α : X → {red, blue}, where X is a subset of V (G). A block in G is a maximal 2-connected subgraph of G. It is well known that the blocks of a graph can be found in linear time, and that for a connected graph, if two blocks intersect then their intersection is a cut-vertex. It follows that any cycle is contained in a single block. We say a block is a leaf-block if it has at most one vertex which is contained in another block. Note that every non-empty graph has a leaf-block. We define a class of graphs, clique-forests, as follows. A clique is a clique-forest, as is an empty graph. The disjoint union of any clique-forests is a clique-forest. Finally, a graph formed from a clique forest by identifying two vertices from separate components is also a clique-forest. Note that the clique-forests are exactly the graphs for which every block is a clique. Such graphs are sometimes called block graphs, but this term has contradictory definitions in the literature1 and we will not use it in this paper. 1e.g. the definition in by Bandelt and Mulder [4] agrees with our definition of clique-forest, but the definition in Chapter 3 of Diestel's book [13] has that every block graph is a tree. 4 To arrive at a realistic analysis of the required computational effort, throughout our model of com- putation is the random access machine with the restriction that arithmetic operations are considered unit-time only for constant-size integers; in this model, two b-bit integers can be added, subtracted, and compared in O(b) time. 3 Fixed-Parameter Algorithm for Max-Cut above the Edwards-Erdos Bound In this section, we prove Theorem 1. Central to this proof is the following lemma, which also forms the basis of our kernel in Theorem 3. Lemma 4. Given a connected graph G with n vertices and m edges and an integer k, we can in polynomial time decide that either G has a cut of size at least m 4 , or find a set S of at most 3k vertices in G such that G − S is a clique-forest. 2 + n−1 4 + k Given a set S as described in Lemma 4, after guessing a coloring of S we reduce Max-Cut-AEE to a related problem on clique-forests, which we show is polynomial time solvable using Lemma 8. As there are at most 23k possible colorings of S, we get an algorithm for Max-Cut-AEE with the required running time. To prove Lemma 4, we use a set of "one-way" reduction rules. These rules produce an instance (G′, k′) such that if (G′, k′) is a "yes"-instance then (G, k) is also a "yes"-instance; this is shown in Lemma 5. The converse does not necessarily hold; if (G′, k′) is a "no"-instance then (G, k) may be a "yes"- or "no"-instance. We show in Lemma 6 that (G′, k′) will be an instance that is trivially easy to solve (one with no edges), so if (G′, k′) is a "yes"-instance then we are done. Otherwise, the reduction rules mark a set of vertices in G, and we will show using Lemma 7 that if S is the set of marked vertices, then S ≤ 3k and G − S is a clique-forest, as required. Rule 1: Apply to a connected graph G with v ∈ V (G), X ⊆ V (G) such that X is a connected component of G − {v} and X ∪ {v} is a clique. All vertices in X. Nothing. Remove: Mark: Parameter: Reduce k by 1 if X is odd, otherwise leave k the same. Rule 2: Apply to a connected graph G reduced by Rule 1 with v ∈ V (G), X ⊆ V (G) such that X is a connected component of G − {v} and X is a clique. All vertices in X. v. Remove: Mark: Parameter: Reduce k by 2. 5 Apply to a connected graph G with a, b, c ∈ V (G) such that {a, b},{b, c} ∈ E(G),{a, c} /∈ E(G), and G − {a, b, c} is connected. The vertices a, b, c. a, b, c. Rule 3: Rule 4: Remove: Mark: Parameter: Reduce k by 1. Apply to a connected graph G with x, y ∈ V (G) such that {x, y} /∈ E(G), G − {x, y} has two connected components, X and Y , and X ∪ {x} and X ∪ {y} are cliques. Vertices {x, y} ∪ X. x, y. Remove: Mark: Parameter: Reduce k by 1. These rules can be applied exhaustively in polynomial time, as each rule reduces the number of vertices in G, and for each rule we can check for any applications of that rule by trying every set of at most three vertices in V (G) and examining the components of the graph when those vertices are removed. Lemma 5. Let (G, k) and (G′, k′) be instances of Max-Cut-AEE such that (G′, k′) is reduced from (G, k) by an application of Rules 1, 2, 3 and 4. Then G′ is connected, and if (G′, k′) is a "yes"-instance of Max-Cut-AEE then so is (G, k). Proof. First, we show that G′ is connected. For Rules 1 and 2, observe that for s, t ∈ V (G) \ X, no path between s and t passes through X, so G − X is connected. For Rule 3, the conditions explicitly state that we only apply the rule if the resulting graph is connected. For Rule 4, observe that we remove all vertices except those in Y , and Y forms a connected component. Second, we prove separately for each rule the following claim, in which n′ denotes the number of vertices and m′ the number of edges removed by the rule. Any assignment to the vertices of G′ can be extended to an assignment on G that cuts an additional m′ 2 + n′ 4 + k−k′ 4 edges. (⋆) Rule 1: Since v is the only vertex connecting X to the rest of the graph, any assignment to G′ can be extended to one which is optimal on X ∪{v}. (Let α be an optimal coloring of G[X ∪ {v}], and let α′ be the α with all colors reversed. Both α and α′ are optimal colorings of G[X ∪ {v}], and one of these will agree with the coloring we are given on G′ since the only overlap is v.) Therefore it suffices to show that X + {v} has a cut of size m′ , since the edges we remove form a clique including v, and all vertices in the clique except v are removed. 4 . Observe that n′ = X and m′ = X(X+1) 4 + k−k′ 2 + n′ 2 If X is even then the maximum cut of the clique X ∪ {v} has size + X 4 + 1(cid:19) = X(X + 2) = X(X + 1) 2 (cid:18)X X 2 4 4 = m′ 2 + n′ 4 , which is what we require as k is unchanged in this case. 6 If X is odd then the maximum cut of the clique X ∪ {v} has size m′ 2 = X(X + 2) (X + 1) (X + 1) 1 4 + = 2 2 4 + n′ 4 + 1 4 , which is what we require as we reduce k by 1 in this case. Rule 2: Order the vertices of X as x1, x2, . . . , xn′ such that there exists an r so that xj is adjacent to v for all j ≤ r, and xj is not adjacent to v for all j > r. Since G is connected and reduced by Rule 1, r ≥ 2 (if there is only one vertex x in X adjacent to v then Rule 1 applies), and since X is a clique but X ∪ {v} is not (otherwise Rule 1 applies), there exists x ∈ X not adjacent to v, and so r ≤ n′ − 1. 2 m, and otherwise xj is the same Color the vertices of X such that xj is the opposite color to v if j ≤ l n′ 2 mo. color as v. Observe that the total number of satisfied edges incident with X is l n′ Since m′ = n′(n′−1) + r, this means that the total number of satisfied edges incident with X is 2 k + minnr,l n′ 2 mj n′ 2 m′ 2 + n′2 4 n′ 4 − +(cid:24) n′ 2 (cid:25)(cid:22) n′ ,(cid:24) n′ 2 (cid:23) + min(cid:26) r 2 2 when X is even, and at least m′ 2 + n′ 4 + 1 2 . 2 + n′ r 2 (cid:25) − 4 + 3 2(cid:27) , 4 when X is odd. Hence, the 4 + 1 2 + n′ which is at least m′ number of satisfied edges incident with X is at least m′ Rule 3: Observe that n′ = 3 and m′ = 2 + E(G′,{a, b, c}). Consider two colorings α, α′ of {a, b, c}: α(a) = α(c) = red, α(b) = blue, and α′(a) = α′(c) = blue, α′(b) = red. Both these colorings satisfy edges {a, b} and {b, c}, and at least one of them will satisfy at least half the edges between {a, b, c} and G′. Therefore, the number of satisfied edges incident with {a, b, c} is at least 2 + E(G′,{a,b,c}) 4 + 1 4 . Rule 4: Given an assignment to G′, color x, y either both red or both blue, such that at least half of the edges between G′ and {x, y} are satisfied. Assume, without loss of generality, that x and y are both colored red. Recall that X = G − (G′ ∪ {x, y}). Let ¯n = X and let ¯m be the number of edges incident with vertices in X. Observe that ¯m = ¯n(¯n−1) 2 vertices with red. Then the total number 4 + ¯n + 1 = ¯m 4 + 3 4 . 2 − 1 vertices with red. Then the total 2 + 1) = ¯n2 4 + 1. Observe that m′ = E(G′,{x, y}) + ¯m and n′ = ¯n + 2, and hence the total number of removed edges 2 + 1 of the vertices in X with blue and ¯n 2 − 1) + 2( ¯n 4 = m′ 4 + 3 2 of the vertices in X with blue and ¯n−1 2 = ¯n(¯n−1) 4 − 1 + ¯n + 2 = ¯m 4 + 1 4 . of satisfied edges incident with X is ¯n+1 2 number of satisfied edges incident with X is ( ¯n satisfied is at least E(G′,{x,y}) If ¯n is odd, color ¯n+1 If ¯n is even, color ¯n 4 + 1 = ¯m 4 + ¯n−1 2 + 2 ¯n+1 2 + n′−2 2 + 2¯n. 2 + 1)( ¯n 2 + ¯n−1 4 = m′ 2 + n′ 2 + n′ · ¯n−1 2 + ¯n 2 + ¯n 2 + ¯n 4 + 3 = m′ + ¯m 2 2 This concludes the proof of the claim (⋆). We now know that any assignment on G′ can be extended to an assignment on G that cuts an 4 , then G has a cut of 4 . Therefore, if (G′, k′) is a "yes"-instance then edges. Hence, if G′ has a cut of size E(G′) 2 + n′ 2 + n−n′−1 4 + k−k′ 4 + k′ 2 + V (G′)−1 4 + k−k′ 2 + n−1 4 = m 4 + m′ 2 + n′ 4 + k + k′ 4 4 additional m′ size m−m′ so is (G, k). Lemma 6. To any connected graph G with at least one edge, at least one of Rules 1 -- 4 applies. 7 Proof. If G is not 2-connected, then let X be a leaf-block in G with cut-vertex r. Otherwise, let X = G and let r be any vertex in G. We say that a set of vertices {a, b, c} in G is an induced P3 if G[{a, b, c}] is a path with 3 vertices (i.e. ab, bc ∈ E(G), ac /∈ E(G)). For any set S of vertices in X, let R(r, S) denote the set of vertices reachable from r in G − S (if r ∈ S then R(r, S) = ∅) . For a, b, c ∈ X, we say {a, b, c} is an important P3 if {a, b, c} is an induced P3 and there is no induced P3 {a′, b′, c′} ⊆ X such that R(r,{a, b, c}) ⊂ R(r,{a′, b′, c′}). (The concept of an important P3 is similar to the concept of "important separators" introduced by Marx [31].) Observe that if there is no induced P3 in X then X is a clique, and Rule 1 applies. Therefore we may assume there is an important P3 in X. Let {a, b, c} be an important P3 with ab, bc ∈ E(G), ac /∈ E(G). If r ∈ {a, b, c} then X − r must have no induced P3 and so X − r is a clique, and Rule 2 applies. Therefore we may assume r /∈ {a, b, c}. If Y = ∅ then G − {a, b, c} is connected and Rule 3 ap- plies. Therefore we may assume Y 6= ∅. Since X is 2-connected, at least two of a, b, c are adjacent to R(r,{a, b, c}). In particular, one of a and c is adjacent to R(r,{a, b, c}). Without loss of generality, assume that c is adjacent to R(r,{a, b, c}). Let Y = G − (R(r,{a, b, c}) ∪ {a, b, c}). We now prove three properties of Y , which will be used to show that Rule 4 applies: (P1) For any x ∈ Y , ax ∈ E(G) if and only if bx ∈ E(G). For suppose there exists x ∈ Y which is adjacent to a but not b. Then {x, a, b} is an induced P3, and R(r,{x, a, b}) ⊇ R(r,{a, b, c})∪{c}, a contradiction as {a, b, c} is an important P3. Similarly, if x is adjacent to b but not a, then {a, b, x} is an induced P3 and R(r,{a, b, x}) ⊇ R(r,{a, b, c})∪{c}. (P2) For each s ∈ {a, b, c} and any x, y ∈ Y , if sx ∈ E(G) and xy ∈ E(G), then sy ∈ E(G). For suppose not; then {s, x, y} is an induced P3, and since at least one vertex t ∈ {a, b, c}\s is adjacent to R(r,{a, b, c}), we have that R(r,{s, x, y}) ⊆ R(r,{a, b, c}) ∪ {t}, a contradiction as {a, b, c} is an important P3. (P3) For each s ∈ {a, b, c} and any x, y ∈ Y , if sx ∈ E(G) and sy ∈ E(G), then xy ∈ E(G). For suppose not. Then {x, s, y} is an induced P3, and as with Property (P2) we have a contradiction. There are now two cases to consider. First, consider the case when a is adjacent to R(r,{a, b, c}). Then, by an argument similar to that used for proving Property (P1), we may show that for any x ∈ Y , cx ∈ E(G) if and only if bx ∈ E(G). This together with Property (P1) implies that a, b, c have exactly the same neighbors in Y . Then by Properties (P2) and (P3) we have that Y is a clique and every vertex in Y is adjacent to each of a, b, c. If b is adjacent to R(r,{a, b, c}) then for any x ∈ Y , {a, x, c} is an induced P3 and R(r,{a, x, c}) ⊇ R(r,{a, b, c}) ∪ {b}, a contradiction as {a, b, c} is an important P3. So b is not adjacent to R(r,{a, b, c}). Then Y ∪ {b} and R(r,{a, b, c}) are the two components of G − {a, c}, and (Y ∪ {b}) ∪ {a} and (Y ∪ {b}) ∪ {c} are cliques. Therefore, Rule 4 applies. Second, consider the case when a is not adjacent to R(r,{a, b, c}). Then b must be adjacent to R(r,{a, b, c}). Furthermore, as X is 2-connected, there must be a path from a to c in G − b, and the intermediate vertices in this path must be in Y . By Property (P2), there exists x ∈ Y adjacent to a and c. Then {a, x, c} is an induced P3 and R(r,{a, x, c}) ⊇ R(r,{a, b, c}) ∪ {b}, a contradiction as {a, b, c} is an important P3. 8 Lemma 7. Let (G′, k′) be an instance derived from (G, k) by exhaustively applying Rules 1 -- 4, and let S be the set of vertices marked during the construction of (G′, k′). Then G − S is a clique-forest. Proof. By Lemma 6, G′ contains no edges, and is therefore a clique-forest. (In fact by Lemma 5, G′ is also connected, and therefore consists of a single vertex.) Let G′′ be a graph derived from G by a single application of Rule 1, 2, 3 or 4. By induction on the length of the reduction from (G, k) to (G′, k′), it is enough to show that if G′′ − S is a clique-forest, then G − S is a clique-forest. If G′′ is derived from G by an application of Rule 1, observe that G − S can be formed from G′′ − S by adding a disjoint clique and identifying one of its vertices with the vertex v in G′′ (unless v is in S, in which case G − S is just formed by adding a disjoint clique), where v is the vertex referred to in Rule 1. Therefore, G − S is a clique-forest. For Rule 3, observe that G − S = G′′ − S. For Rules 2 and 4, observe that G− (G′ ∪ S) is a clique, and that S disconnects G− (G′ ∪ S) from G′. Therefore, G−S can be formed from G′−S by adding a disjoint clique, and so G−S is a clique-forest. Putting Lemmas 5 and 7 together, we can now prove Lemma 4. of Lemma 4. Let (G′, k′) be an instance derived from (G, k) by exhaustively applying Rules 1 -- 4, and let S be the set of vertices marked during the construction of (G′, k′). By Lemma 7, G− S is a clique-forest. Therefore, if S < 3k we are done. It remains to show that if S ≥ 3k then G has an assignment that satisfies at least m So suppose that S ≥ 3k. Observe that every time k is reduced, at most three vertices are marked. Therefore since at least 3k vertices are marked, we have k′ ≤ 0. But since the Edwards-Erdos bound holds for all connected graphs, G′ is a "yes"-instance. Therefore, by Lemma 5, G is a "yes"-instance with parameter k, as required. 2 + n−1 4 + k 4 edges. In what follows, we assume we are given a set S such that S ≤ 3k and G − S is a clique-forest, as given by Lemma 4. Note that we should not assume that (G, k) is reduced by any of Rules 1 -- 4. These rules were only used to produce the separate instance (G′, k′) and S. We may now forget about (G′, k′) and Rules 1 -- 4. We now show that, for a given assignment to S, we can efficiently find an optimal extension to G− S. For this, we consider the following generalisation of Max-Cut where each vertex has an associated weight for each part of the partition. These weights may be taken as an indication of how much we would like the vertex to appear in each part. For convenience, here we will think of an assignment as a function from V to {0, 1} rather than {red, blue}. Max-Cut-with-Weighted-Vertices Instance: A graph G with weight functions w0 : V (G) → N0 and w1 : V (G) → N0, and an integer t ∈ N. Question: Does there exist an assignment f : V → {0, 1} such that Pxy∈E f (x) − f (y) +Pf (x)=0 w0(x) +Pf (x)=1 w1(x) ≥ t? Now Max-Cut is the special case of Max-Cut-with-Weighted-Vertices in which w0(x) = w1(x) = 0 for all x ∈ V (G). 9 Lemma 8. Max-Cut-with-Weighted-Vertices is solvable in polynomial time when G is a clique- forest. 0, w′ Proof. We provide a polynomial-time transformation that replaces an instance (G, w0, w1, t) with an 1, t′) such that G′ has fewer vertices than G. By applying the transformation equivalent instance (G′, w′ at most V (G) times to get a trivial instance, we have a polynomial-time algorithm to decide (G, w0, w1, t). We may assume that G is connected, as otherwise we can handle each component of G separately. Let X ∪ {r} be the vertices of a leaf-block in G, with r a cut-vertex of G (unless G consists of a single block, in which case let r be an arbitrary vertex and X = V (G) − {r}). Recall that by definition of a clique-forest, X ∪ {r} is a clique. For each possible assignment to r, we will in polynomial time calculate the optimal extension to the vertices in X. (This optimal extension depends only on the assignment to r, since no other vertices are adjacent to vertices in X.) We can then remove all the vertices in X, and change the values of w0(r) and w1(r) to reflect the optimal extension for each assignment. Suppose we assign r the value 1. Let ε(x) = w1(x) − w0(x) for each x ∈ X. Now arrange the vertices of X in order x1, x2, . . . xn′ (where n′ = X), such that if i < j then ε(xi) ≥ ε(xj). Observe that there is an optimal assignment for which xi is assigned 1 for every i ≤ t, and xi is assigned 0 for every i > t, for some 0 ≤ t ≤ n′. (Consider an assignment for which f (xi) = 0 and f (xj) = 1, for i < j, and observe that switching the assignments of xi and xj will increase Pf (x)=0 w0(x) + Pf (x)=1 w1(x) by ε(xi) − ε(xj).) Therefore we only need to try n′ + 1 different assignments to the vertices in X in order to find the optimal coloring when f (r) = 1. Let A be the value of this optimal assignment (over X ∪ {r}). By a similar method we can find the optimal assignment when r is assigned 0. Let the number of satisfied edges in this coloring be B. Now remove the vertices in X and incident edges, and let w1(r) = A, and let w0(r) = B. We are ready to prove Theorem 1, and show that Max-Cut-AEE is fixed-parameter tractable. 2 + n−1 4 + k of Theorem 1. By Lemma 4, we can in polynomial time decide that either G has an assignment that satisfies at least m 4 edges, or find a set S of at most 3k vertices in G such that -G− S is a clique- forest. So assume we have found such an S. Then we transform our instance into at most 23k instances of Max-Cut-with-Weighted-Vertices, such that the answer to our original instance is "yes" if and only if the answer to at least one of the instances of Max-Cut-with-Weighted-Vertices is "yes", and in each Max-Cut-with-Weighted-Vertices instance the graph is a clique-forest. As each of these instances can be solved in polynomial time by Lemma 8, we have a fixed-parameter tractable algorithm. For every possible assignment to the vertices in S, we construct an instance of Max-Cut-with- Weighted-Vertices as follows. For every vertex x ∈ G − S, let w0(x) equal the number of vertices in S adjacent to x which are colored blue, and let w1(x) equal the number of vertices in S adjacent to x which are colored red. Then remove the vertices of S from G. By Lemma 4, the resulting graph G′ is a clique-forest. Let m′ be the number of edges in G − S, let n′ be the number of vertices in G − S, and let p be the number of edges within S satisfied by the assignment to S. Then for an assignment to the vertices of G − S, the total number of satisfied edges in G would be exactly Pxy∈E(G−S) f (x) − f (y) + p + Pf (x)=0 w0(x) + Pf (x)=1 w1(x), where f : V (G) \ S → {0, 1} is such that f (x) = 0 if x is colored red, and f (x) = 1 if x is colored blue. Thus, the assignment to S can be extended to one that cuts at 10 2 + n−1 least m "yes"-instance with t = m 4 + k 4 edges in G if and only if the instance of Max-Cut-with-Weighted-Vertices is a 2 + n−1 4 + k 4 − p. 4 Algorithmic Lower Bounds We now prove Theorem 2, by a reduction from the Max-Cut problem with parameter the size k of the cut. By a result of Cai and Juedes [7], the Max-Cut problem with parameter the size k of the cut cannot be solved in time 2o(k)·nO(1) unless the Exponential Time Hypothesis fails. Note that by deleting isolated vertices and identifying together one vertex from each component, we may assume the input graph of an instance of Max Cut is connected. Given the graph G with m edges and n vertices and the integer k ∈ N, let k′ = k − ⌈m/2 + (n − 1)/4⌉. That is, k′ is the integer such that G has a cut of size at least k if and only if G has a cut of size at least m/2 + (n − 1)/4 + k′. Then use a hypothetical algorithm to solve Max-Cut AEE in time 2o(k′) · nO(1) on instance (G, k′), return the answer of the algorithm for the pair (G, k) and the Max-Cut problem. Thus, since k′ ≤ k, an algorithm of time complexity 2o(k) · nO(1) for Max-Cut AEE forces the Exponential Time Hypothesis to fail [14]. This completes the proof of Theorem 2. 5 Polynomial Kernel for Max-Cut Above Edwards-Erdos In this section, we prove Theorem 3. By Lemma 4, in polynomial time we can either decide that (G, k) is a "yes"-instance, or find a set S of vertices in G such that S < 3k and G − S is a clique-forest. In what follows we assume that we have found such a set S. Let n∗ be the number of blocks of G − S. Let C1, . . . , Cn∗ be the blocks of G − S, and recall that by definition each block is a clique. Let J be the set of vertices in G − S that appear in two or more block. For each block Ci, let Ai = Ci \ J. Note that {A1, . . . , An∗ , J} is a partition of the vertices of G − S. Let L ⊆ {1, . . . , n∗} be the set of all i for which Ci is a leaf-block. Let I ⊆ [n∗] be the set of all i for which Ci ∩ J ≥ 3. It can be seen that L ≥ I + 2. (Indeed, consider the bipartite graph with vertex sets J and [n∗], with an edge between v ∈ J and i ∈ [n∗] if v ∈ Ci. Then this is a forest, with all leaves being leaf-blocks in G − S, and for each i ∈ [n∗] the degree of i is Ci ∩ J. It is well known that in a tree the number of vertices of degree at least three is at most the number of leaves −2, from which the claim follows.) We first apply Reduction Rules 5 -- 8. Note that unlike Rules 1 -- 4, these are traditional "two-way" reduction rules, and once we have shown they are valid, we may assume the instance is reduced by these rules. The correctness of these rules is given by Lemma 9. After applying these reduction rules, we will show that either we have a Yes-instance, or the number of vertices in G − S is bounded. Observe that to bound the number of vertices in G − S, it is enough to bound n∗ and Ai for each i. In Lemma 10, we bound L. As L ≥ I + 2, in order to bound n∗ it remains to bound the number of i for which Ci ∩ J ≥ 3. This is done in Lemma 11. Finally in Lemma 12 we bound Ai for each i. These results are combined in Lemma 13. 11 Rule 5: Apply if there exists a vertex x ∈ G − S and a set of vertices X ⊆ V (G) \ S such that X > 1, X ∪ {x} is a clique and X is a connected component of G − (S ∪ {x}), and no vertex in X is adjacent to any vertex in S. All vertices in X. Remove: Parameter: Reduce k by 1 if X is odd, otherwise leave k the same. Rule 6: Apply if there exists vertices s ∈ S, x ∈ G − S and a set of vertices X ⊆ V (G) \ S such that X ∪ {x} is a clique, X ∪ {s} is a clique, X is a connected component of G − (S ∪ {x}), and s is the only vertex in S adjacent to X. All but one vertex of X. Remove: Parameter: Reduce k by 1 if X is even, otherwise leave k the same. Rule 7: Apply if there exist blocks X, Y of G − S such that X and Y are odd, with vertices x ∈ X, y ∈ Y,{z} = X ∩ Y , such that x, z are the only vertices in X adjacent to a vertex in G − X, and y, z are the only vertices in Y adjacent to a vertex in G − Y . All vertices in (X ∪ Y ) − {x, y, z}. New vertices u, v and edges such that {x, y, z, u, v} is a clique Remove: Add: Parameter: No change. Rule 8: Apply if for any block Ci in G − S, there exists X ⊆ Ai such that X > Ai+J+S and for all x, y ∈ X, x and y have exactly the same neighbors in S. Two arbitrary vertices from X. 2 Remove: Parameter: No change. Lemma 9. Let (G, k) and (G′, k′) be instances of Max-Cut-AEE, and S a set of vertices, such that G − S is a clique-forest, and (G′, k′) is reduced from (G, k) by an application of Rule 5, 6, 7 or 8. Then G′ is connected, G′ − S is a clique-forest, and (G′, k′) is a "yes"-instance if and only if (G, k) is a "yes"-instance. of Lemma 9. It is easy to observe that each of the rules preserves connectedness, and that G′ − S is a clique-forest. We now show for each rule that (G′, k′) is a "yes"-instance if and only if (G, k) is a "yes"-instance. Rule 5: Let n′ be the number of vertices and m′ the number of edges removed. Note that m′ = n′(n′+1) . Observe that whatever we assign to the rest of the graph, we can always find an assignment to X that 2 + n′+1 , 4 edges edges in G′, and if X is even, we can satisfy 2 + n−n′−1 satisfies the largest possible number of edges within X ∪{x}. If X is odd this is (n′+1)(n′+1) and if X is even this is n′(n′+2) in G if and only if we can satisfy m−m′ 2 + n−1 m Rule 6: Let n′ be the number of vertices and m′ the number of edges removed. Note that n′ = X − 1 and m′ = n′(n′+1) 4 edges in G if and only if we can satisfy m−m′ + 2n′ = n′(n′+5) = m′ 4 + k 2 + n−1 2 + n′ 2 + n−n′−1 4 . Therefore if X is odd, we can satisfy m 4 edges in G′. 4 + k + k−1 4 4 4 + k = m′ 2 4 4 4 2 . 2 12 First consider the case when x and s are adjacent. Observe that whatever x and s are assigned, it is possible to find an assignment to X that satisfies the maximum possible number of edges within X ∪ {s, x}. This is (n′+2)(n′+4) if X is even. Furthermore note that in G′, whatever x and s are assigned, we will be able to satisfy 2 edges between x, s and the reamining part of X. Therefore if X is odd, we can satisfy m 4 edges in G if and only if we can satisfy m−m′ 4 edges in G′, and if X is even, we can satisfy 2 + n−n′−1 2 + n−1 4 + k−1 4 + k m edges in G′. 4 + k 4 edges in G if and only if we can satisfy m−m′ if X is odd, and (n′+3)(n′+3) 2 + n−1 4 + 2 = m−m′ 4 + 2 = m−m′ 2 + n−n′−1 2 + n−n′−1 2 + n−n′−1 4 + k−9 4 + k−8 2 + n′+9 2 + n′+8 4 + k = m′ = m′ 4 4 4 4 4 4 4 . (n′ 4 4 4 4 4 4 4 (n′+2)(n′+4) 1 − 1) + 4 + k 1 + 1)(n′ 2 + 1)(n′ 1 and m′ 2 + n′+8 2 + n′+9 2 + n′+4 2 + n′+5 4 + k−1 − 1 = m′ − 1 = m′ − 1 = m′ G′ we will be able to satisfy 2 edges between x, s and the remaining part of X. the maximum number of edges within X ∪ {x, s} we can satisfy is (n′+2)(n′+4) odd, and (n′+3)(n′+3) between x, s and the remaining part of X. Second consider the case when x and s are not adjacent.Observe that if x and s are colored differently, if X is if X is even. Furthemore in G′ we will be able to satisfy 1 edge If x and s are colored the same, the maximum number of edges within X ∪ {x, s} we can satisfy is if X is even. Furthemore in Observe that whether or not x and s are colored the same, in G we can satisfy t more edges between if X x, s and X than in G′, where t = m−m′ 4 if X is odd, and t = m−m′ is even. Rule 7: Let n′ = X ∪ Y and let m′ be the number of edges within X ∪ Y . Let n′ 2 = Y , and let m′ 2 be the number of edges within X and Y , respectively. Observe that whatever x, y and z are assigned, we can always satisfy the maximal possible number of edges in within X ∪ Y , which is if X is odd, and (n′+3)(n′+3) 1 = X and n′ 2 + n−n′−1 2 + n−n′−1 − 1 = m′ 3 = 5 = {x, y, z, u, v} and let m′ . Thus, the amount we gain above the Edwards-Erdos bound remains the same. 2 − 1) 3 = 10 be the number of edges within {x, y, z, u, v}. Then in G′, whatever x, y and z are assigned, the maximum number of edges within {x, y, z, u, v} we can satisfy is 6 = m′ Rule 8: Let n′ = Ai. For any assignment to the vertices in S ∪ J, and for each x ∈ Ai, let εR(x) be the number of neighbors of x in S ∪ J which are assigned red, and let εB(x) be the number of neighbors of x in S ∪ J which are assigned blue. Let ε(x) = εB(x) − εR(x). Let the vertices of Ai be numbered x1, x2, . . . , xn′ such that ε(x1) ≥ ε(x2) ≥ . . . ≥ ε(xn′). Observe that the optimal assignment to Ai will be one in which xj is assigned red for j ≤ n′+r 2 , and blue otherwise, for some integer r. Observe that the optimal value of r will be between −(J + S) and (J + S). Indeed, if r > J + S, then switching one of the vertices from red to blue will gain at least J + S edges within Ai, and lose at most J + S edges between Ai and J ∪ S. (A similar argument holds when r < −J − S.) Now let y, z be the two vertices in X removed by the rule. Since y, z have exactly the same neighbors in S ∪ J, and since X > Ai+J+S , we may assume that y = xj, z = xj′, for some j, j′ such that j′ − j > J ∪ S ≥ r, and hence y is assigned red and z is assigned blue. Then note that if we remove y and z, we lose m′′ = 2N (y) ∩ (S ∪ J) + 2(n′ − 2) + 1 edges and n′′ = 2 vertices. Of the edges removed, exactly N (y) ∩ (S ∪ J) + (n′ − 2) + 1 = m′′ 4 were satisfied. Thus, the amount we gain over the n′ 2 − 1 4 n′ 1 − 1 4 3 2 + n′ 3−1 4 n′ − 1 4 2 + n′′ = + + = + m′ 2 m′ 1 2 m′ 2 2 (n′ 4 Let n′ 2 + 4 13 Edwards-Erdos bound remains the same. Note that this happens whatever the assignment to S ∪ J, and that we may assume without loss of generality that y and z are colored differently for any assignment to S ∪ J. We now assume that G is reduced by Rules 5, 6, 7 and 8. Lemma 10. If L ≥ 4S2 + 2S + 2k − 2 then (G, k) is a "yes"-instance. Proof. Suppose L ≥ 4S2 +2S+2k−2. For a leaf block Ci, let Ei be set of edges within G[Ai] together with the set of edges between Ai and S, and let EL = Si∈L Ei. Let VL be the total set of vertices in Si∈L Ai, and observe that VL = Pi∈L Ai. Let mi = Ei and ni = Ai. assignment α on S such that χα(EL) ≥ EL which each vertex is assigned red or blue with equal probability. For any vertex x ∈ G − S, let εα the number of neighbors of x which are assigned red, let εα are assigned blue, and let εα(x) = εα x1, . . . , xni be an ordering of the vertices of Ai such that εα(x1) ≥ εα(x2) ≥ . . . ≥ εα(xni). 2 + ni−1 the total number of satisfied edges in Ei is equal to For a partial assignment α on L and a set of edges E, let χα(E) be the maximum possible number of edges we can satisfy in E, given α. We will show via the probabilistic method that there exists a partial 4 . Consider a random assignment α on S, in R(x) be B(x) be the number of neighbors of x which R(x). Now consider χα(Ei) for some i where i ∈ L. Let First, suppose that Ai is odd. Observe that if there exists x ∈ Ai with εα(x) ≥ r, then χα(Ei) ≥ and blue otherwise. Then 2 . Indeed, suppose εα(x) = r′ > r. Then color xj red if j ≤ ni+1 B(x) − εα 2 + VL 4 + L 4 + r mi 2 ni + 1 2 ni − 1 2 · + ni +1 2 Xj=1 εα B(xj) + ni Xj= ni+3 2 εα R(xj) = ni(ni − 1) 4 + 1 2 ni +1 2 Xj=1 (εα B(xj) + εα R(xj)) + 1 2 ni Xj= ni+3 2 (εα B(xj) + εα R(xj)) + ni − 1 4 + 1 2 ni+1 2 Xj=1 (εα B(xj) − εα R(xj)) + 1 2 ni Xj= ni+3 2 (εα R(xj) − εα B(xj)) = mi 2 + ni − 1 2 + 1 2 ni +1 2 Xj=1   εα(xj) − ni Xj= ni+3 2 εα(xj)  . 4 + 1 2 + ni−1 Observe that this is at least mi 2 . A similar argument applies when εα(xj) = −r′ < −r. Therefore, if there exists x ∈ Ai with an odd number of neighbors in S, then εα(x) ≥ 1 and 4 + 1 so χα(Ei) ≥ mi 4 . If there exists x ∈ Ai with a non-zero even number of neighbors in S, then observe that either εα(x) = 0 or εα(x) ≥ 2. Furthermore, the probability that εα(x) = 0 is at most 1 2 , since given an assignment to 4 . This is true whatever α assigns to S, and therefore Eα[χα(Ei)] ≥ mi 2 εα(x1) ≥ mi 2 + ni 2 + ni 2 + ni−1 4 + r 4 + 1 14 2 · 2 4 + 1 4 + 1 2 + ni 2 + ni 2 + ni 4 + 1 2 = mi 2 + ni−1 2 · 0 + 1 4 + 1 4 . Second, suppose that Ai is even. Observe that if there exist x, y ∈ Ai with εα(x) > εα(y), then εα(xj) ≥ 1. So color xj with red if j ≤ ni all but one of the neighbors in S of x, at most one of the possible assignments to the remaining neighbor will lead to εα(x) being 0. Therefore, Eα[χα(Ei)] ≥ mi 4 . We know that one of the above two cases must hold, since otherwise no vertex in Ai has any neighbors in S, and Rule 5 applies. Therefore, if Ai is odd, Eα[χα(Ei)] ≥ mi j=1 εα(xj) −Pni χα(Ei) ≥ mi and blue otherwise. Then the total number of satisfied edges in Ei is equal to   Xj= ni Also observe that if εα(x) ≥ 2 for all x ∈ Ai, then χα(Ei) ≥ mi εα(xj)  ≥ 2 . Indeed, then P Indeed, suppose 2 + 1 and blue otherwise. Then the total εα(x) = r ≥ 2 for all x ∈ Ai. Then color xj with red if j ≤ ni number of satisfied edges in Ei is equal to εα(xj) − Xj= ni εα R(xj) = εα B(xj) + 2 + ni 4 + 1. ni 2 · Xj=1 Xj=1 mi 2 mi 2 ni 4 ni 4 j= ni 2 +1 + . + + ni 2 + ni 2 +1 ni 2 +1 ni 2 1 2 + 1 2 ni 2 ni 2 2 (cid:16) ni 2 + 1(cid:17)(cid:16) ni 2 − 1(cid:17) + ni 2 +1 Xj=1 εα B(xj) + ni Xj= ni 2 +2 εα R(xj) = = ≥ εα(xj) − ni Xj= ni 2 +2 εα(xj)  ni 2 +1 Xj=1   2r 1 2 1 2 mi 2 mi 2 mi 2 + ni 4 − 1 + + + ni 4 − 1 + ni + 1 . 4 A similar argument applies when εα(x) = −r ≤ −2 for all x ∈ Ai. Finally observe that if εα(x) = 0 or 1 for all x ∈ Ai, then by coloring xj with red if j ≤ ni 4 . Therefore, if there exist x, y ∈ Ai such that x has a neighbor in S which is not adjacent to y, then the probability that εα(x) = εα(y) is at most 1 Otherwise, all vertices in Ai have the same neighbors in S. There must be at least two vertices in S which are adjacent to the vertices in Ai, as otherwise Rule 5 or 6 would apply. Then the probability that εα(x) = 0 for every x ∈ Ai is at most 1 4 . (Consider any assignment to all but two of the neighbors of x in S, and observe that of the four possible assignments to the remaining two vertices, at most two will lead to εα(x) = 0, and at least one will lead to εα(x) ≥ 2.) Therefore, Eα[χα(Ei)] ≥ mi 2 and blue otherwise, χα(Ei) ≥ mi 2 + ni 2 , and the probability that εα(x) ≥ 2 is at least 1 2 and so Eα[χα(Ei)] ≥ mi 4 · 1 = mi 2 · 0 + 1 2 · 0 + 1 2 + ni 2 = mi 2 + ni 2 + ni 2 + ni 4 + 1 4 . 4 + 1 4 . 4 + 1 4 + 1 2 · 1 By linearity of expectation and the fact that χα(EL) = Pi∈L χα(Ei), it holds + VL 4 4(cid:19) = EL (cid:18) mi Eα[χα(EL)] ≥ Xi∈L E[χα(Ei)] ≥ Xi∈L ni 4 + + 2 1 2 + L 4 . 4 + L Now let t′ be the number of components in G − (S ∪ VL), and observe that t′ ≤ L Therefore, there exists a partial assignment α on S such that χα(EL) ≥ EL 4 , as required. 2 . Indeed, if C is a component in G − S then C − VL is connected if not empty. Furthermore, every component in G − S 2 + VL 15 Let C1, . . . ,Ct′ be the components of G − (S ∪ VL). For each j ∈ {1, . . . , t′} let n′ contains at least one leaf-block, and if a component in G− S contains only one leaf-block, then the whole component is a single leaf block, and so C − VL is empty. Therefore, every component in G − (S ∪ VL) has at least two leaf-blocks. j be the number of vertices in Cj and m′ j the number of edges incident with vertices in Cj (including edges between Cj and 4 + L S∪VL). Now let S∪VL be colored such that the number of satisfied edges in EL is at least EL 4 . Note that this might mean that none of the edges in G[S] are satisfied, but that there are at most S2 j−1 of these. Now for each j ∈ {1, . . . , t′} let Cj be colored so that at least half the edges in G[Cj] plus 4 are satisfied, which can be done as this is the Edwards-Erdos bound. By reversing all the colors in Cj if needed, we can ensure that at least half the edges between Cj and the rest of the graph are satisfied, and therefore we can ensure at least of the edges incident with Cj are satisfied. We now have a complete assignment of colors to vertices, which satisfies at least 2 + VL m′ j 2 + j−1 4 n′ n′ t′ t′ t′ + (cid:18) m′ j 2 n′ j − 1 4 (cid:19) = EL EL 2 + VL 4 + L 4 + Xj=1 Xj=1 + L 8 edges. Since L ≥ 4S2 + 2S + 2k − 2, the right-hand side of (3) is is at least n − 1 Xj=1 2 m − S2 4S2 + 2S + 2k − 2 (4S2 + 2S) n − S ≥ + + + = + + + m′ j 2 + VL 4 2 m 2 + n 4 − 8 8 4 n′ j 4 + L − t′ 4 (3) (4) k 4 . 4 m 2 Recall that n∗ is the number of blocks in G − S. Lemma 11. If n∗ ≥ 4S2 + 2S + 4L + 2k − 7 then (G, k) is a "yes"-instance. Proof. We will first produce a partial assignment on G − S which satisfies E(G−S) edges, where t is the number of connected components of G− S. Together with this we produce a set of vertices R ⊆ V \ S such that we can change the color of any vertex in R without changing the number of satisfied edges in G − S. Observe that by choosing the right order on the blocks of G − S, it is possible to color all the blocks in such a way that each time we come to color a block, it contains at most one vertex that has already been colored. So color the vertices of each block Ci such that if Ci is even then half the vertices of Ci are colored red and half are colored blue, and if Ci is odd then Ci+1 of the vertices are colored red and are colored blue. Furthermore, if Ci is odd and Ai contains a vertex which is adjacent to S, then we ensure that at least one such vertex x is colored red, and we add x to R. + V (G−S)−t Ci−1 2 2 4 2 Observe that the number of satisfied edges in a component Cj of G − S is E(G[Cj]) , where ej is the number of even sized blocks in Cj. Let e be the number of blocks in G− S with an even number + Cj+ej−1 4 2 16 of vertices. Therefore, the total number of satisfied edges within G − S is E(G−S) . Note also that t ≤ L. Observe that if we change the color of any vertex in R, the number of satisfied edges within Cj is unchanged. First, suppose that R ≥ 2S2+S+L−e+k−1 ; we will show that we have a "yes"-instance. Color all the vertices in S red, or all blue, whichever satisfies the most edges in E(S, G− S). If this satisfies at least edges in E(S, G − S), then we are done, as the total number of satisfied + 2S2+S+L−e+k−1 + V (G−S)+e−t E(S,G−S) 4 2 2 2 4 edges is at least E(G − S) 2 + E(S, G − S) 2 m − S2 + V (G − S) + e − t e − L n − S + 4 2S2 + S + L − e + k − 1 + 2S2 + S + L − e + k − 1 4 ≥ Otherwise, the number of satisfied edges in E(S, G − S) is between E(S,G−S) ≥ + + 4 2 4 4 2 2S2+S+L−e+k−1 m 2 + n − 1 4 + k 4 . and E(S,G−S) 2 + 2 2 4 . Now change the colors of all the vertices in R from red to blue, and recall that this does not affect the number of satisfied edges within G − S. If the vertices of S were all colored red, then + 2S2+S+L−e+k−1 the number of satisfied edges in E(S, G− S) is increased by R to at least E(S,G−S) , and so again we are done. Otherwise, the vertices of S were all colored blue and we lose R satisfied edges, so the number of satisfied edges in E(S, G − S) is at most E(S,G−S) . But then by changing the color of S from blue to red, we satisfy at least E(S,G−S) in E(S, G − S), and we are done. − (2S2+S+L−e+k−1) + 2S2+S+L−e+k−1 So now we may assume that R < 2S2+S+L−e+k−1 . Let M ⊆ [n∗] be the set of all i for which either Ci is odd and Ai contains a vertex adjacent to S, or Ci is even. Observe that M = R + e < 2R + e < 2S2 + S + L + k − 1. Observe furthermore that L ⊆ M , as if there is a leaf-block Ci with Ci odd and no vertex in Ai adjacent to S, we have an application of Rule 5. It remains to bound [n∗] \ M. Recall that I ⊆ [n∗] is the set of all i for which Ci ∩ J ≥ 3, and that L ≥ I + 2. Therefore we have that M ∪ I < 2S2 + S + L + L − 2 + k − 1 = 2S2 + S + 2L + k − 3. Finally, for any i /∈ M ∪ I, it must be the case that Ci is odd, Ci ∩ J = 2, and Ai has no vertices adjacent to S. But then if Ci, Cj share a vertex for any i, j /∈ M ∪ I, we have an application of Rule 7. Therefore for i /∈ M ∪ I, Ci provides an edge between Cj and Cj′, for some j, j′ ∈ M ∪ I. From the fact that there are no cycles not contained in blocks, it can be seen that [n∗] \ (M ∪ I) ≤ M ∪ I − 1. Thus, we have that n∗ ≤ 2M ∪ I − 1 < 4S2 + 2S + 4L + 2k − 7. edges 4 4 2 2 2 Lemma 12. If Ai ≥ 2S3 + 5S2 + (L + k − 3)S − 2L − J − 2k for some i ∈ {1, . . . , n∗} then (G, k) is a "yes"-instance. Proof. Let i be such that Ai ≥ 2S3 + 5S2 + (L + k − 3)S − 2L − J − 2k. Let n′ = Ai and let m′ be the number of edges within Ai and between Ai and S. Observe first that if we can find an assignment to S ∪ Ai that satisfies at least m′ of these edges, then we have a "yes"-instance: indeed, the component of G − S containing Ai is still connected in G − (S ∪ Ai) unless it 4 + 2S2+S+L+k 2 + n′−1 4 17 is empty. Therefore, the number of components in G− (S ∪ Ai) is no more than in G− S and is therefore at most t ≤ L. Let C1,C2, . . . ,Ct be the components of G− (S ∪ Ai). Color each component Cj optimally so that at least E(G[Cj]) of the edges within Cj are satisfied, and then reverse the colors of Cj if necessary to ensure that at least half the edges between Cj and S ∪ Ai are satisfied. Then the total number of satisfied edges is at least + Cj −1 2 4 m − E(G[S ∪ Ai]) ≥ + 2 m − m′ − S2 2 n − S ∪ Ai − t m′ 2 n − n′ − S − L + + 4 4 n′ − 1 + + m′ + S2 4 + 2 2S2 + S + L + k 4 + n′ + S + L + k − 1 4 = m 2 + n − 1 4 + k 4 , and so we have a "yes"-instance. 4 2 + n′−1 4 + 2S2+S+L+k R(x) be the number of neighbors of x which are assigned red, let εα We now show that if n′ ≥ 2S3 + 5S2 + (L + k − 3)S − 2L − J − 2k then we can find a partial assignment to S ∪ Ai that satisfies at least m′ of the edges within G[Ai] and between Ai and S, completing the proof. For a given partial assignment α on S, and for any vertex x ∈ Ai, let εα B(x) be the number of neighbors of x which are assigned blue, and let εα(x) = εα R(x). Let x1, . . . , xl be the vertices of Ai, ordered so that εα(x1) ≥ εα(x2) ≥ . . . ≥ εα(xl) (the ordering will depend on α). Suppose for some r ∈ {1, . . . , n∗} we assign xj red for j ≤ n′+r 2 vertices in Ai blue. Then 2 (cid:18)P εα(xj)(cid:19). Suppose there the number of satisfied edges is m′ 4 + 1 exist X1, X2 ⊆ Ai with X1,X2 ≥ 2S2+S+L+k and such that εα(x) > εα(y) for all x ∈ X1, y ∈ X2. Observe that by setting r = 0 (if n′ is even) or r ∈ {±1} (if n′ is odd), we get that 2 , and the assign the remaining n′−r 4 − r2 j=1 εα(xj) −Pn′ B(x) − εα 2 + n′ j= n′+r+2 n′ +r 2 2 2 1 2 n′+r 2 Xj=1   εα(xj) − n′ Xj= n′+r+2 2 εα(xj)  ≥ 2S2 + S + L + k 4 , and so we are done. It remains to show that there is some partial assignment α on S such that X1, X2 exist. For the sake of contradiction, suppose this were not the case. Then for any assignment α there exist a set of at least n′− 2S2−S−L− k vertices x in Ai for which εα(x) is the same. Consider first the partial assignment α for which every vertex in S is assigned red. Then for every x ∈ Ai, εα(x) = N (x) ∩ S. It follows that N (x)∩ S is the same for at least n′ − 2S2 −S−L− k vertices x in Ai. Let A′ i be this set of vertices. Now for each vertex s ∈ S, consider the partial assignment α for which s is assigned blue and every other vertex in S is assigned red. Let X1 be the set of vertices in A′ i which are adjacent to s, and let X2 be the set of vertices in A′ i which are not adjacent to s. Then εα(x) = εα(y) if x, y ∈ X1 or x, y ∈ X2, and εα(x) = εα(y) − 2 if x ∈ X1, y ∈ X2. Therefore by our assumption either X1 < 2S2+S+L+k or X2 < 2S2+S+L+k vertices in A′ i which are adjacent to s, or at most 2S2+S+L+k i which are not adjacent to s. Therefore, . It follows that for each s ∈ S there are either at most 2S2+S+L+k vertices in A′ 2 2 2 2 18 there is a set of at least A′ ≥ n′ − 2S2 − S − L − k − S vertices in Ai which are all adjacent to exactly the same vertices in S. If i − S 2 (2S2 + S + L + k) 2S2 + S + L + k 2 2 then we would have an application of Rule 8. Therefore, 2S2 − S − L − k + S 2S2 + S + L + k ≥ Ai + J + S 2 Ai ≤ 4S2 − 2S − 2L − 2k + S(2S2 + S + L + k) − J − S = 2S3 + 5S2 + (L + k − 3)S − 2L − J − 2k . To complete the proof of Theorem 3, we prove Lemma 13, from which Theorem 3 follows. Lemma 13. For a connected graph G that is reduced by Rules 5, 6, 7 and 8 and satisfies V (G) > 29160k5 + 6480k4 − 8532k3 − 492k2 + 731k − 80, the pair (G, k) is a "yes"-instance. Proof. Observe that J ≤ n∗ − 1. By the preceding three lemmas, we may assume that 1. L < 4S2 + 2S + 2k − 2, and 2. n∗ < 4S2 + 2S + 4L + 2k − 7, and 3. Ai < 2S3 + 5S2 + (L + k − 3)S − 2L − J − 2k for any i ∈ {1, . . . , n∗}, for otherwise we have a "yes"-instance. Furthermore, we know that S < 3k. Putting everything together, we have that This in turn implies that L < 4S2 + 2S + 2k − 2 < 36k2 + 8k − 2 . and so J < 180k2 + 40k − 16. For every i ∈ {1, . . . , n∗}, we have n∗ < 4L + 4S2 + 2S + 2k − 7 < 180k2 + 40k − 15, Ai < 2S3 + 5S2 + (S − 2)L + (k − 3)S − J − 2k < 54k3 + 45k2 + (3k − 2)(36k2 + 8k − 2) + 3k2 − 9k − J − 2k ≤ 162k3 − 33k + 4 . (Here we assume that S ≥ 2 and and k ≥ 3, as otherwise the problem can be solved in polynomial time.) Observe that V = Si∈n∗ Ai ∪ J ∪ S. Therefore, the number of vertices in G is at most (180k2 + 40k − 16)(162k3 − 33k + 4) + (180k2 + 40k − 16) + 3k = 29160k5 + 6480k4 − 8532k3 − 600k2 + 688k − 64 + 108k2 + 43k − 16 = 29160k5 + 6480k4 − 8532k3 − 492k2 + 731k − 80 . 19 6 Discussion and Open Problems We showed fixed-parameter tractability of Max-Cut parameterized above the Edwards-Erdos bound m/2 + (n− 1)/4, and thereby resolved an open question from [9, 21, 29, 30, 38]. Furthermore, we showed that the problem has a kernel with O(k5) vertices. We have not attempted to optimize running time or kernel size, and indeed we conjecture that Max-Cut has a kernel with O(k3) vertices and the edge version admits a linear kernel. Our conjecture was recently answered in the affirmative, by Crowston et al. [12]. It remains an open problem whether the weighted version of Max-Cut above the Edwards-Erdos bound is fixed-parameter tractable; our conjecture is that this problem is also fixed-parameter tractable and admits a polynomial kernel. Since an extended abstract of this paper appeared [11], it was shown [10, 32] that the techniques developed in this paper are strong enough to show fixed-parameter tractability of the Maximum Acyclic Subdigraph problem in oriented graphs parameterized above tight lower bound; this solves another open question by Raman and Saurabh [37] in the field of parameterized complexity. Acknowledgment. We thank Tobias Friedrich and Gregory Gutin for help with the presentation of the results. Part of this research has been supported by an International Joint Grant from the Royal Society. References [1] Alon, N.: Bipartite subgraphs. Combinatorica 16(3), 301 -- 311 (1996) [2] Alon, N., Halperin, E.: Bipartite subgraphs of integer weighted graphs. Discrete Mathematics 181, 19 -- 29 (1998) [3] Andersen, L.D., Grant, D.D., Linial, N.: Extremal k-colourable subgraphs. Ars Combinatoria 16, 259 -- 270 (1983) [4] Bandelt, H.J., Mulder, H.M.: Distance-hereditary graphs. Journal of Combinatorial Theory, Series B 41(2), 182 -- 208 (1986) [5] Bodlaender, H.L., Downey, R.G., Fellows, M.R., Hermelin, D.: On problems without polynomial kernels. Journal of Computer and System Sciences 75(8), 423 -- 434 (2009) [6] Bollob´as, B., Scott, A.: Better bounds for Max Cut. In: Contemporary Combinatorics, Bolyai Society Mathematical Studies, vol. 10, pp. 185 -- 246 (2002) [7] Cai, L., Juedes, D.: On the existence of subexponential parameterized algorithms. Journal of Computer and System Sciences 67(4), 789 -- 807 (2003) [8] Charikar, M., Wirth, A.: Maximizing quadratic programs: Extending Grothendieck's inequality. In: Proc. FOCS 2004, pp. 54 -- 60 (2004) [9] Crowston, R., Fellows, M., Gutin, G., Jones, M., Rosamond, F., Thomass´e, S., Yeo, A.: Simultaneously Satisfying Linear Equations Over F2: MaxLin2 and Max-r-Lin2 Parameterized Above Average. In: IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2011), Leibniz International Proceedings in Informatics, vol. 13, pp. 229 -- 240 (2011) 20 [10] Crowston, R., Gutin, G., Jones, M.: Directed acyclic subgraph problem parameterized above Poljak-Turz´ık bound. In: IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2012), Leibniz International Proceedings in Informatics, vol. 18, pp. 400-411 (2012). [11] Crowston, R., Jones, M., Mnich, M.: Max-cut parameterized above the Edwards-Erdos bound. In: Automata, Lan- guages, and Programming, Lecture Notes in Computer Science, vol. 7391, pp. 242 -- 253 (2012) [12] Crowston, R., Gutin, G., Jones, M., Muciaccia, G.: Maximum Balanced Subgraph Problem Parameterized above Lower Bound In: Computing and Combinatorics, Lecture Notes in Computer Science, vol. 7936, pp. 434 -- 445 (2013) [13] Diestel, R.: Graph Theory. Graduate Texts in Mathematics. Springer (2010) [14] Downey, R.G., Fellows, M.R.: Parameterized complexity. Monographs in Computer Science (1999) [15] Edwards, C.S.: Some extremal properties of bipartite subgraphs. Canadian Journal of Mathematics 25, 475 -- 485 (1973) [16] Edwards, C.S.: An improved lower bound for the number of edges in a largest bipartite subgraph. In: Recent Advances in Graph Theory, pp. 167 -- 181 (1975) [17] Erdos, P.: On some extremal problems in graph theory. Israel Journal of Mathemathics 3, 113 -- 116 (1965) [18] Erdos, P.: On even subgraphs of graphs. Matematikai Lapok 18, 283 -- 288 (1967) [19] Erdos, P., Gy´arf´as, A., Kohayakawa, Y.: The size of the largest bipartite subgraphs. Discrete Mathematics 177, 267 -- 271 (1997) [20] Flum, J., Grohe, M.: Parameterized complexity theory. Texts in Theoretical Computer Science. An EATCS Series. Springer-Verlag, Berlin (2006) [21] Gutin, G., Yeo, A.: Note on maximal bisection above tight lower bound. Information Processing Letters 110(21), 966 -- 969 (2010) [22] Haglin, D.J., Venkatesan, S.M.: Approximation and intractability results for the maximum cut problem and its variants. IEEE Transactions on Computers 40(1), 110 -- 113 (1991) [23] Hofmeister, T., Lefmann, H.: A combinatorial design approach to Max Cut. Random Structures and Algorithms 9, 163 -- 175 (1996) [24] Impagliazzo, R., Paturi, R.: On the complexity of k-SAT. Journal of Computer and System Sciences 62(2), 367 -- 375 (2001) [25] Karp, R.M.: Reducibility among combinatorial problems. In: Complexity of computer computations (Proceed Sympo- sium, IBM Thomas J. Watson Research Center, Yorktown Heights, N.Y., 1972), pp. 85 -- 103 (1972) [26] Khot, S., O'Donnell, R.: SDP gaps and UGC-hardness for Max-Cut-Gain. Theory of Computing 5, 83 -- 117 (2009) [27] Lehel, J., Tuza, Zs.: Triangle-free partial graphs and edge covering theorems. Discrete Mathematics 39(1), 59 -- 65 (1982) [28] Locke, S.C.: Maximum k-colorable subgraphs. Journal of Graph Theory 6(2), 123 -- 132 (1982) [29] Mahajan, M., Raman, V.: Parameterizing above guaranteed values: MaxSat and MaxCut. Tech. Rep. TR97-033, Electronic Colloquium on Computational Complexity (1997). http://eccc.hpi-web.de/report/1997/033/ [30] Mahajan, M., Raman, V., Sikdar, S.: Parameterizing above or below guaranteed values. Journal of Computer and System Sciences 75(2), 137 -- 153 (2009) 21 [31] Marx, D.: Parameterized graph separation problems. Theoretical Computer Science 351(3), 394 -- 406 (2006) [32] Mnich, M., Philip, G., Saurabh, S., Such´y, O.: Beyond Max-Cut: λ-extendible properties parameterized above the Poljak-Turz´ık bound. In: IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2012), Leibniz International Proceedings in Informatics, vol. 18, pp. 412 -- 423 (2012). [33] Mnich, M., Zenklusen, R.: Bisections above tight lower bounds. In: Graph-Theoretic Concepts in Computer Science, Lecture Notes in Computer Science, vol. 7551, pp. 184 -- 193 (2012). [34] Ngo. c, N.V., Tuza, Zs.: Linear-time approximation algorithms for the max cut problem. Combinatorics, Probability and Computing 2(2), 201 -- 210 (1993) [35] Poljak, S., Turz´ık, D.: A polynomial algorithm for constructing a large bipartite subgraph, with an application to a satisfiability problem. Canadian Journal of Mathematics 34(3), 519 -- 524 (1982) [36] Poljak, S., Tuza, Z.: Maximum cuts and large bipartite subgraphs. In: Combinatorial optimization (New Brunswick, NJ, 1992 -- 1993), DIMACS Series in Discrete Mathematics and Theoretical Computer Science, vol. 20, pp. 181 -- 244 (1995) [37] Raman, V., Saurabh, S.: Parameterized algorithms for feedback set problems and their duals in tournaments. Theo- retical Computer Science 351(3), 446 -- 458 (2006) [38] Sikdar, S.: Parameterizing from the Extremes: Feasible Parameterizations of some NP-optimization problems. Ph.D. thesis, The Institute of Mathematical Sciences, Chennai, India (2010) 22
1509.05494
1
1509
2015-09-18T03:08:55
FPTAS for Hardcore and Ising Models on Hypergraphs
[ "cs.DS" ]
Hardcore and Ising models are two most important families of two state spin systems in statistic physics. Partition function of spin systems is the center concept in statistic physics which connects microscopic particles and their interactions with their macroscopic and statistical properties of materials such as energy, entropy, ferromagnetism, etc. If each local interaction of the system involves only two particles, the system can be described by a graph. In this case, fully polynomial-time approximation scheme (FPTAS) for computing the partition function of both hardcore and anti-ferromagnetic Ising model was designed up to the uniqueness condition of the system. These result are the best possible since approximately computing the partition function beyond this threshold is NP-hard. In this paper, we generalize these results to general physics systems, where each local interaction may involves multiple particles. Such systems are described by hypergraphs. For hardcore model, we also provide FPTAS up to the uniqueness condition, and for anti-ferromagnetic Ising model, we obtain FPTAS where a slightly stronger condition holds.
cs.DS
cs
FPTAS for Hardcore and Ising Models on Hypergraphs Pinyan Lu∗ Kuan Yang† Chihao Zhang‡ Abstract Hardcore and Ising models are two most important families of two state spin systems in statistic physics. Partition function of spin systems is the center concept in statistic physics which connects microscopic particles and their interactions with their macroscopic and statistical properties of materials such as energy, entropy, ferromagnetism, etc. If each local interaction of the system involves only two particles, the system can be described by a graph. In this case, fully polynomial-time approximation scheme (FPTAS) for computing the partition function of both hardcore and anti-ferromagnetic Ising model was designed up to the uniqueness condition of the system. These result are the best possible since approximately computing the partition function beyond this threshold is NP-hard. In this paper, we generalize these results to general physics systems, where each local interaction may involves multiple particles. Such systems are described by hypergraphs. For hardcore model, we also provide FPTAS up to the uniqueness condition, and for anti-ferromagnetic Ising model, we obtain FPTAS where a slightly stronger condition holds. 5 1 0 2 p e S 8 1 ] S D . s c [ 1 v 4 9 4 5 0 . 9 0 5 1 : v i X r a ∗Microsoft Research. [email protected] †Shanghai Jiao Tong University. [email protected] ‡Shanghai Jiao Tong University. [email protected] 1 Introduction In recent couple of years, there are remarkable progress on designing approximate counting algo- rithms based on correlation decay approach [Wei06, BG08, GK12, RST+11, LLY12, SST12, LLY13, LY13, LLL14, LWZ14, LLZ14, LL15b, LL15a]. Unlike the previous major approximate counting approach that based on random sampling such as Markov Chain Monte Carlo (MCMC) (see for examples [JS97, JS93, JSV04, GJ11, DJV02, Jer95, Vig99, DFJ02, DG00, LV97]), correlation decay based approach provides deterministic fully polynomial-time approximation scheme (FPTAS). New FPTASes were designed for a number of interesting combinatorial counting problems and computing partition functions for statistic physics systems, where partition function is a weighted counting function from the computational point of view. One most successful example is the algorithm for anti-ferromagnetic two-spin systems [LLY12, SST12, LLY13], including counting independent sets [Wei06]. The correlation decay based FPTAS is beyond the best known MCMC based FPRAS and achieves the boundary of approximability [SS12, GSV12]. In this paper, we generalize these results of anti-ferromagnetic two-spin systems to hypergraphs. For physics point of view, this corresponds to spin systems with higher order interactions, where each local interaction involves more than two particles. There are two main ingredients for the original algorithms and analysis on normal graphs (we will use the term normal graph for a graph to emphasize that it is not hypergraphs): (1) the construction of the self-avoiding walk tree by Weitz [Wei06], which transform a general graph to a tree; (2) correlation decay proof for the tree, which enables one to truncate the tree to get a good approximation in polynomial time. However, the construction of the self-avoiding walk tree cannot be extended to hypergraphs, which is the main obstacle for the generalization. The most related previous work is counting independent sets for hypergraphs by Liu and Lu [LL15b]. They established a computation tree with a two-layers recursive function instead of the self-avoiding walk tree and provided a FPTAS to count the number of independent sets for hypergraphs with maximum degree of 5, extending the algorithm for normal graph with the same degree bound. Their proof was significantly more complicated than the previous one due to the complication of the two-layers recursive function. In particular, the "right" degree bound for the problem is a real number between 5 and 6 if one allow fraction degree in some sense. This integer gap provides some room of flexibility and enables them to do some case-by-case numerical argument to complete the proof. However, the parameters for the anti-ferromagnetic two-spin systems on hypergraphs are real numbers. To get a sharp threshold, we do not have any room for numerical approximation. 1.1 Our results We study two most important anti-ferromagnetic two-spin systems on hypergraphs: the hardcore model and the anti-ferromagnetic Ising model. The formal definitions of these two models can be found in Section 2. Our first result is an FPTAS to compute the partition function of hypergraph hardcore model. Theorem 1. For hardcore model with a constant activity parameter of λ, there is an FPTAS to compute the partition function for hypergraphs with maximum degree ∆ ≥ 2 if λ < (∆−1)∆−1 (∆−2)∆ . This bound is exactly the uniqueness threshold for the hardcore on normal graphs. Thus, it is tight since normal graphs are special cases of hypergraphs. To approximately compute the partition function beyond this threshold is NP-hard. In particular, The FPTAS in [LL15b] for counting the number of independent sets for hypergraphs with maximum degree of 5 can be viewed 1 as a special case of our result with parameters ∆ = 5, λ = 1, which satisfies the above uniqueness condition. Another interesting special case is when ∆ = 2. This is not an interesting case for normal graphs since a normal graph with maximum degree of 2 is simply a disjoint union of paths and cycles, whose partition function can be computed exactly. However, the problem becomes more complicated on hypergraphs: it can be interpreted as counting weighted edge covers on normal graphs by viewing vertices of degree two as edges and hyperedges as vertices. The exact counting of this problem is known to be #P-complete and an FPTAS was found recently [LLZ14]. In our model, the uniqueness bound (∆−1)∆−1 (∆−2)∆ is infinite for ∆ = 2 and as a result we give an FPTAS for counting weighted edge covers for any constant edge weight λ. This gives an alternative proof for the main result in [LLZ14]. Our second result is on computing the partition function of anti-ferromagnetic Ising model. Theorem 2. For Ising model with interaction parameter 0 < β < 1 and external field λ, there is an FPTAS to compute the partition function for hypergraphs with maximum degree ∆ if β ≥ 1 − 2e−1/2∆+3 2 . The tight uniqueness bound for anti-ferromagnetic Ising model on normal graphs is β ≥ 1 − 2 ∆ . So, our bound is in the same asymptotic order but a bit worse in the constant coefficient as 2e−1/2 ≈ 1.213 > 1. Moreover, our result can apply beyond Ising model to a larger family of anti-ferromagnetic two-spin systems on hypergraphs. 1.2 Our techniques We also use the correlation decay approach. Although the framework of this method is standard, in many work along this line of research, new tools and techniques are developed to make this relatively new approach more powerful and widely applicable. This is indeed the case for the current paper as well. We summarize the new techniques we introduced here. For hardcore model, we replace the numerical case-by-case analysis by a monotone argument with respect to the edge size of the hypergraph which shows that the normal graphs with edge size of 2 is indeed the worst cases. This gives a tight bound for hardcore model. To handle hypergraph with unbounded edge sizes, we need to prove that the decay rate is much smaller for edges of larger size. Such effect is called computationally efficient correlation decay, which has been used in many previous works to obtain FPTASes for systems with unbounded degrees or edge sizes. In all those works, one sets a threshold for the parameter and proves different types of bounds for large and small ones separately. Such artificial separation gets a discontinuous bound which adds some complications in the proof and usually ends with a case-by-case discussion. In particular, this separation is not compatible with the above monotone argument. To overcome this, we propose a new uniform and smooth treatment for this by modifying the decay rate by a polynomial function of the edge size. After this modification, we only need to prove one single bound which automatically provides computationally efficient correlation. We believe that this idea is important and may find applications in other related problems. For the Ising model, the main difficulty is to get a computation tree as a replacement of the self-avoiding walk tree. We proposed one, which also works for general anti-ferromagnetic two- spin systems on hypergraphs. However, unlike the case of the hardcore model, the computation tree is not of perfect efficiency and this is the main reason that the bound we achieve in Theo- rem 2 is not tight. To get the computationally efficient correlation decay, we also use the above mentioned uniform and smooth treatment. We also extend our result beyond Ising to a family of anti-ferromagnetic two-spin systems on hypergraphs. 2 1.3 Discussion and open problems One obvious open question is to close the gap for Ising model, or more generally extend our work to anti-ferromagnetic two-spin systems on hypergraphs with better parameters. However, it seems that it is impossible to obtain a tight result in these models using the computation tree proposed in this paper, due to its imperfectness. How to overcome this is an important open question. In particular, MCMC based approach does show that larger edge size helps: Even for the hardcore model, our result is tight only for the family of all hypergraphs since the normal graphs are special cases. From both physics and combinatorics point of view, it would be very interesting to study the family of w-uniform hypergraphs where each hyperedge is of the same size w. By our monotone argument, it is plausible to conjecture that one can get better bound for larger w. for hypergraph independent set with maximum degree of ∆ and minimum edge size w, an FPRAS for w ≥ 2∆ + 1 was shown in [BDK08]. However, their result is not tight. Can we get a tight bounds in terms of ∆ and w by correlation decay approach? The high level idea sounds promising, but there is an obstacle to prove such result by our computation tree. To construct the computation tree, we need to construct modified instances. In these modified instances, the size of a hyperedge may decrease to as low as 2. Therefore, even if we start with w-uniform hypergraphs or hypergraphs with minimum edge size of w, we may need to handle the worst case of normal graphs during the analysis. How to avoid this effect is a major open question whose solution may have applications in many other problems. The fact that larger hyperedge size only makes the problem easier is not universally true for approximation counting. One interesting example is counting hypergraph matchings. FPTAS for counting 3D matchings of hypergraphs with maximum degree 4 is given in [LL15b], and extension to weighted setting are studied in [YZ15]. In particular, a uniqueness condition in this setting is defined in [YZ15], and it is a very interesting open question whether this uniqueness condition is also the transition boundary for approximability. 2 Preliminaries A hypergraph G(V,E) consists of a vertex set V and a set of hyperedges E ⊆ 2V . For every hyperedge e ∈ E and vertex v ∈ V , we use e − v to denote e \ {v} and use e + v to denote e ∪ {v}. 2.1 Hypergraph hardcore model The hardcore model is parameterized by the activity parameter λ > 0. Let G(V,E) be a hypergraph. An independent set of G is a vertex set I ⊆ V such that e 6⊆ I for every hyperedge e ∈ E. We use I(G) to denote the set of independent sets of G. The weight of an independent set I is defined as w(I) , λI. We let Z(G) denote the partition function of G(V,E) in the hardcore model, which is defined as Z(G) , XI∈I(G) w(I). The weight of independent sets induces a Gibbs measure on G. For every I ∈ I, we use PrG [I] , w(I) Z(G) 3 to denote the probability of obtaining I if we sample according to the Gibbs measure. For every v ∈ V , we use PrG [v ∈ I] , XI∈I(G) v∈I PrG [I] to denote the marginal probability of v. 2.2 Hypergraph two state spin model Now we give a formal definition to hypergraph two state spin systems. This model is parameterized by the external field λ > 0. An instance of the model is a labeled hypergraph G(V,E, (β, γ)) where β, γ : E → R are two labeling functions that assign each edge e ∈ E two reals β(e), γ(e). A configuration on G is an assignment σ : V → {0, 1} whose weight w(σ) is defined as w(σ) , Ye∈E w(e, σ) Yv∈V w(v, σ) where for a hyperedge e = {v1, . . . , vw} β(e) γ(e) 1 w(e, σ) ,  and for a vertex v, if σ(v1) = σ(v2) = ··· = σ(vw) = 0 if σ(v1) = σ(v2) = ··· = σ(vw) = 1 otherwise w(v, σ) ,(λ if σ(v) = 1 otherwise. 1 The partition function of the instance is given by Z(G) = Xσ∈{0,1}V w(σ). Similarly, the weight of configurations induces a Gibbs measure on G. For every σ ∈ {0, 1}V , we use PrG [σ] , w(I) Z(G) to denote the probability of σ in the measure. For every v ∈ V , we use PrG [σ(v) = 1] , Xσ∈{0,1}V σ(v)=1 PrG [σ] to denote the marginal probability of v. The anti-ferromagnetic Ising model is the special case that β , β(e) = γ(e) ≤ 1 for all e ∈ E. In this model, we call β the interaction parameter of the model. The hardcore model introduced in previous section is the special case that β(e) = 1 and γ(e) = 0 for all e ∈ E. the more general two state spin system and establish the following theorem: We give the whole proof to Theorem 2 in appendix. More precisely, we design an FPTAS for 4 Theorem 3. Consider a class of two state spin system with external field λ such that each instance 2e−1/2∆+3 ≤ β(e), γ(e) ≤ 1 where ∆ is the maximum degree G(V,E, (β, γ)) in the class satisfies 1− of G. There exists an FPTAS to compute the partition function for every instance in the class. 2 Theorem 2 then follows since it is a special case of Theorem 3. Actually, the main idea of FPTAS design and proof for this model is similar to the idea we use to solve hypergraph hardcore model. However, the details of recursion function design and techniques for proof of correlation decay property are pretty different from that in hypergraph hardcore model, so we put the whole section in appendix. 3 Hypergraph Hardcore Model 3.1 Recursion for computing marginal probability We first fix some notations on graph modification specific to hypergraph independent set. Let G(V,E) be a hypergraph. • For every v ∈ V , we denote G − v , (V \ {v} ,E′) where E′ , {e \ {v} e ∈ E}. • For every e ∈ E, we denote G − e , (V,E \ {e}). • Let x be a vertex or an edge and y be a vertex or an edge, we denote G− x− y , (G− x)− y. • Let S = {v1, . . . , vk} ⊆ V , we denote G − S , G − v1 − v2 ··· − vk. • Let F = {e1, . . . , ek} ⊆ E, we denote G − F , G − e1 − e2 ··· − ek. Let G(V,E) be a hypergraph and v ∈ V be an arbitrary vertex with degree d. Let {e1, . . . , ed} be the set of hyperedges incident to v and for every i ∈ [d], ei = {v} ∪ {vij j ∈ [wi]} consists of wi + 1 vertices. We first define a graph G′(V ′,E′), which is the graph obtained from G by replacing v by d copies of itself and each ei contains a distinct copy. Formally, V ′ , (V \ {v}) ∪ {v1, . . . , vd}, E′ , {e ∈ E v 6∈ e} ∪ {ei − v + vi i ∈ [d]}. For every i ∈ [d] and j ∈ [wi], we define a hypergraph Gij(Vij,Eij): Gij , G′ − {vk i ≤ k ≤ d} − {ek 1 ≤ k ≤ i} − {vik 1 ≤ k < j} . Let Rv = PrG[v∈I] PrG[v6∈I] and Rij = PrGij [vij∈I] PrGij [vij6∈I] . We can compute Rv by following recursion: Lemma 4. Rv = λ d Yi=1 The proof of this lemma is postponed to appendix.  1 − wi Yj=1 Rij 1 + Rij  . (1) The Uniqueness Condition Let the underlying graph be an infinite d-ary tree, then the recur- sion (1) becomes uniqueness of the Gibbs measure is that (cid:12)(cid:12)(cid:12) 1 + x(cid:19)d . fλ,d(x) = λ(cid:18) 1 f′λ,d(x)(cid:12)(cid:12)(cid:12) 5 Let x be the positive fixed-point of fλ,d(x), i.e., x > 0 and fλ,d(x) = x. The condition on λ for the < 1. The following proposition is well-known. < 1. f′λ,d(x)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12) Proposition 5. Let λc = dd (d−1)d+1 , then (cid:12)(cid:12)(cid:12) f′λc,d(x)(cid:12)(cid:12)(cid:12) = 1 and for every 0 < λ < λc, it holds that 3.2 The algorithm to compute marginal probability Let G(V,E) be a hypergraph with maximum degree ∆ and v ∈ V be an arbitrary vertex with degree d. Define Gij, Rv, Rij as in Section 3.1. Then the recursion (1) gives a way to compute the marginal probability PrG [v ∈ I] exactly. However, an exact evaluation of the recursion requires a computation tree with exponential size. Thus we introduce the following truncated version of the recursion, with respect to constants c > 0 and 0 < α < 1. R(G, v, L) =  λQd λQd i=1(cid:16)1 −Qwi i=1(cid:16)1 −Qwi λ j=1 j=1 R(Gij ,vij ,L) 1+R(Gij ,vij ,L)(cid:17) 1+R(Gij ,vij ,L−⌊1+c log1/α wi⌋)(cid:17) if d < ∆ and L > 0 R(Gij ,vij ,L−⌊1+c log1/α wi⌋) if d = ∆ otherwise. The recursion can be directly used to compute R(G, v, L) for any given L and it induces a truncated computation tree (with height L in some special metric). It is worth noting that, the case that d = ∆ can only happen at the root of the computation tree, since in each smaller instance, the degree of vij is decreased by at least one. We claim that R(G, v, L) is a good estimate of Rv with a suitable choice of c and α, for those (λ, ∆) in the uniqueness region. Lemma 6. Let G(V,E) be a hypergraph with maximum degree ∆ ≥ 2. Let v ∈ V be a vertex with degree d and let λ < λc = (∆−1)∆−1 (∆−2)∆ be the activity parameter. There exist constants C > 0 (more precisely, C = 6λ√1 + λ) and α ∈ (0, 1) such that R(G, v, L) − Rv ≤ C · αmax{0,L} for every L. The whole proof of this lemma is postponed to the next section. Proof of Theorem 1. Assuming Lemma 6, the proof of Theorem 1 is routine and we put the proof into appendix. 3.3 Correlation decay In this section, we establish Lemma 6. We first prove some technical lemmas. Suppose f : Dd → R is a d-ary function where D ⊆ R is a convex set, let φ : R → R be an increasing differentiable function and Φ(x) , φ′(x). The following proposition is a consequence of the mean value theorem: Proposition 7. For every x = (x1, . . . , xd), x = (x1, . . . , xd) ∈ Dd, it holds that Φ(x) φ(f (x)) − φ(f (x)) for some x ∈ D; 1. f (x) − f (x) = 1 2. φ(f (x)) − φ(f (x)) ≤Pd i=1 Φ(f ) Φ(xi)(cid:12)(cid:12)(cid:12) ∂f (x) ∂xi (cid:12)(cid:12)(cid:12) · φ(xi) − φ(xi) for some x = (x1, . . . , xd) ∈ Dd. 6 xij 1√x(1+x) Lemma 8. Let ∆ ≥ 2 be a constant integer and λ < λc = (∆−1)∆−1 (∆−2)∆ be a constant real. Let d < ∆ 1+xij(cid:17) be a (cid:16)Pd i=1 wi(cid:17)-ary function. and w1, . . . , wd > 0 be integers and f = λQd . Let c < minn log(1+λ)−log λ λ (cid:1) − 1o be a positive number. There Let Φ(x) = exists a constant α < 1 depending on λ and d (but not depending on wi for all i ∈ [d]) such that Φ(xab)(cid:12)(cid:12)(cid:12)(cid:12) i=1(cid:16)1 −Qwi log(cid:0) 1+λ ∂xab (cid:12)(cid:12)(cid:12)(cid:12) ≤ α < 1 Xb=1 Xa=1 for every x = (xij)i∈[d],j∈[wi] where each xij ∈ [0, λ] , 2λ+1 ∂f (x) Φ(f ) wc a 2+4λ j=1 d wa 2 The lemma bounds the amortized decay rate, which is the key to the proof of correlation decay. In previous works, the amortized decay rate is defined as d Xa=1 wa Xb=1 , Φ(f ) Φ(xab)(cid:12)(cid:12)(cid:12)(cid:12) ∂f (x) ∂xab (cid:12)(cid:12)(cid:12)(cid:12) without the wc a factor. Then one need to give a constant α < 1 bound for small wa and a sub constant bound for large wa. With this modification, we only need to prove a single bound as above. Notice that we require c to be a positive constant, so it is necessary to verify that 2λ+1 1 > 0 for every λ > 0. To see this, let h(λ) , 2λ+1 log(cid:0) 1+λ λ (cid:1)− λ (cid:1) − 1, then we can compute that 1 + 2λ 2λ + 2λ2 , 2 2 log(cid:0) 1+λ λ (cid:19) − h′(λ) = log(cid:18)1 + λ 2λ2(1 + λ)2 . h′′(λ) = 1 Since h′′(λ) > 0 for every λ, h′(λ) is increasing. Along with the fact that limλ→∞ h′(λ) = 0, we have h′(λ) < 0 for every λ > 0. This implies that h(λ) is decreasing. Also note that lim λ→∞ h(λ) = lim λ→∞ log (cid:18)1 + 1 λ(cid:19)λ(cid:18)1 + 1 λ(cid:19)1/2! − 1 = 0. It holds that h(λ) > 0 for every λ > 0. Thus a positive c satisfying c < h(λ) exists for every λ > 0. Proof of Lemma 8. To simplify the notation, we first let tij = xij 1+xij , then for every i ∈ [d] and  1 − wi Yj=1 tij  = f · (1 − tab)2 tab 7 j=1 taj · Qwa 1 −Qwa j=1 taj . j ∈ [wi], it holds that tij ∈h0, λ 1+λi and f = λ For every a ∈ [d] and b ∈ [wi], we have = λ(1 − tab)2 Yj∈[wa] ∂f taj · Yi∈[d] i6=a j6=b (cid:12)(cid:12)(cid:12)(cid:12) ∂xab(cid:12)(cid:12)(cid:12)(cid:12) d Yi=1  1 − wi Yj=1 tij  . Thus d wa wa d wa ∂f wc a d wc Φ(f ) 1 + f =s f 1 + f wc aQwa 1 −Qwa j=1 taj j=1 taj Xb=1 Xa=1 Xa=1 1 − tab√tab Xb=1 Let t = (tij)i∈[d],j∈[wi], define h(t) ,s f =vuuut ∂xab(cid:12)(cid:12)(cid:12)(cid:12) Φ(xab)(cid:12)(cid:12)(cid:12)(cid:12) aQwa Xb=1 Xa=1 1 −Qwa j=1 tij(cid:17) i=1(cid:16)1 −Qwi λQd j=1 tij(cid:17) i=1(cid:16)1 −Qwi 1 + λQd For every t = (tij)i∈[d],j∈[wi] where each tij ∈ [0, λ 1+λ ], define a tuple t = (tij)i∈[d],j∈wi such that for every i ∈ [d], λ (cid:1)wi−1 Qwi aQwa 1 −Qwa tij =((cid:0) 1+λ if j = 1 otherwise. 1 − tab√tab 1 − tab√tab j=1 taj taj j=1 taj taj Xa=1 Xb=1 k=1 tik λ 1+λ d wc wa . . j j We claim that h(t) ≤ h(t). To see this, first note that for every i ∈ [d], Qwi sufficient to prove that for every i ∈ [d] Xj=1 1 − tij√tij ≤ Xj=1 wi wi . 1 − tij qtij j=1 tij = Qwi j=1 tij, it is This is a consequence of the Karamata's inequality by noticing that the function 1−ex √ex is convex. We rename ti1 to ti and it is sufficient to upper bound g(t, w) ,vuuuuut where ti ∈h0, λ d i=1(cid:18)1 −(cid:16) λ i=1(cid:18)1 −(cid:16) λ ti(cid:19) 1+λ(cid:17)wi−1 λQd Xi=1 ti(cid:19) · 1+λ(cid:17)wi−1 1 + λQd 1+λi and wi ∈ Z+ for every i ∈ [d]. For every i ∈ [d], we let zi , 1 −(cid:16) λ For every fixed z = (z1, . . . , zd), we can write (2) as 1+λ(cid:17)wi−1 The argument so far is similar to the proof in [LL15b]. In the following, we prove a monotonicity property of each wi and thus avoid the heavy numerical analysis in [LL15b] and allow us to obtain a tight result. wc 1+λ(cid:17)wi−1 i (cid:16) λ 1+λ(cid:17)wi−1 1 −(cid:16) λ ti ti ·(cid:18) 1 − ti√ti + √λ + λ2(cid:19) (2) (wi − 1) ti and thus equivalently ti = (1 − zi)(cid:0) 1+λ zi (cid:18) 1 − ti√ti 1 − zi √λ + λ2(cid:19) wc wi − 1 i . + . λ (cid:1)wi−1 (3) (4) i=1 zi gz(w) =s λQd 1 + λQd i=1 zi d Xi=1 We show that gz(w) is monotonically decreasing with wi for every i ∈ [d]. Denote Ti , 1−ti√ti + (wi−1) √λ+λ2 , then ∂gz(w) ∂wi =s λQd 1 + λQd i=1 zi i=1 zi · zi (cid:18) ∂Ti 1 − zi ∂wi 8 wc i + cwc−1 i Ti(cid:19) . The partial derivative (4) is negative for a suitable choice of c: 1 − zi zi 1 − zi zi 1 − zi zi 1 − zi zi = = = Denote i 1 1 2 wc ∂zi + t−3/2 t′i(t−1/2 i + cwc−1 i Ti(cid:19) ·(cid:18) ∂Ti ·(cid:18)(cid:18)− √λ + λ2(cid:19) wc log(cid:18) 1 + λ i (cid:18)(cid:18)− λ (cid:19) (t1/2 i + t−1/2 · wc−1 i (cid:18) (c + 1)wi − c √λ + λ2 −(cid:18)t1/2 i (cid:18)1 · wc−1 ) + 1 2 2 i i ) + wi log(cid:18) 1 + λ i + cwc−1 1 + √λ + λ2(cid:19)(cid:19) i (cid:18) 1 − ti√ti (wi − 1) √λ + λ2(cid:19) wi + c(cid:18)t−1/2 − t1/2 wi log(cid:18) 1 + λ λ (cid:19) + c(cid:19) + t−1/2 (cid:18)1 i + 2 i i √λ + λ2(cid:19)(cid:19) (wi − 1) λ (cid:19) − c(cid:19)(cid:19)(cid:19) p(t, w) , √λ + λ2 −(cid:18)t1/2(cid:18) 1 (c + 1)w − c 2 Since c ≤ log(1+λ)−log λ 2+4λ , the term w log(cid:18) 1 + λ λ (cid:19) + c(cid:19) + t−1/2(cid:18) 1 2 w log(cid:18)1 + λ λ (cid:19) − c(cid:19)(cid:19) t1/2(cid:18) 1 2 w log(cid:18) 1 + λ λ (cid:19) + c(cid:19) + t−1/2(cid:18) 1 2 w log(cid:18)1 + λ λ (cid:19) − c(cid:19) achieves its minimum at t = λ 1+λ . Thus Moreover, c < 2λ+1 1 + λ p(t, w) ≤ p(cid:18) λ log(cid:0) 1+λ , w(cid:19) =(cid:18) λ λ (cid:1) − 1 implies that c+1 1 + λ(cid:19)1/2(cid:18) c + 1 λ − 2λ log(cid:0) 1+λ λ < 2λ+1 2λ + 1 2λ 2 leads to p(cid:16) λ in p(cid:16) λ 1+λ , 1(cid:17) < 0. In all, we choose a positive constant c < minn log(1+λ)−log λ 1+λ , w(cid:17) ≤ p(cid:16) λ 1+λ , 1(cid:17) < 0. 2+4λ λ (cid:19)(cid:19) w. log(cid:18) 1 + λ λ (cid:1) holds, which consequently λ (cid:1) − 1o, and this results log(cid:0) 1+λ , 2λ+1 2 In light of the monotonicity of wi's, for every fixed z, gz(w) achieves its maximum when w = 1. Thus g(t, w) = max t∈[0, λ 1+λ ]d max z=(z1,...,zd) ∀i∈[d],zi∈h1−( λ 1+λ )wi −1 gz(w) ≤ ,1i max z=(z1,...,zd) ∀i∈[d],zi∈h1−( λ 1+λ )wi −1 gz(1) ≤ max z∈[0,1]d gz(1). ,1i Actually, the case that all wi's are 1 corresponds to counting weighted independent sets on normal graphs and arguments to bound gz(1) can be found in [LLY13]. For the sake of completeness, we give a proof of gz(1) ≤ α < 1 (Lemma 9) in appendix. Lemma 9. Let ∆ > 1, be a constant. Assume λ < λc = (∆−1)∆−1 for some constant α < 1, gz(1) ≤ α < 1 where z = (z1, . . . , zd) ∈ [0, 1]d. (∆−2)∆ be a constant and d < ∆. Then We are now ready to prove the main lemma. Proof of Lemma 6. Let Φ(x) = and φ(x) = R Φ(x) dx = 2 sinh−1(√x). We first apply induction on ℓ , max{0, L} to show that, if d < ∆, then φ(Rv) − φ(R(G, v, L)) ≤ 2√λαL for 1√x(1+x) some constant α < 1. 9 If ℓ = 0, note that Rv ∈ [0, λ], thus φ(R(G, v, L)) − φ(Rv) ≤ 2√λ. We now assume L = ℓ > 0 and the lemma holds for smaller ℓ. For every i ∈ [d] and j ∈ [wi], we denote xij = Rij and xij = R(Gij, vij, L − ⌊1 + c log1/α wi⌋). Let x = (xij)i∈[d],j∈[wi], x = (xij)i∈[d],j∈[wi]. Let f = 1−xij(cid:17) , then it follows from Proposition 7 that for some x = (xij)i∈[d],j∈[wi] with i=1(cid:16)1 −Qwi λQd each xij ∈ [0, λ] j=1 xij φ(Rv) − φ(R(G, v, L)) ≤ · φ(xij) − φ(xij) d wi (♠) d wi Φ(f ) ∂f (x) Φ(xij)(cid:12)(cid:12)(cid:12)(cid:12) Xj=1 Xi=1 ≤ 2√λ Xj=1 Xi=1 ≤ 2√λαL. ∂xij (cid:12)(cid:12)(cid:12)(cid:12) Φ(xij)(cid:12)(cid:12)(cid:12)(cid:12) Φ(f ) (♥) ∂f (x) ∂xij (cid:12)(cid:12)(cid:12)(cid:12) αL−⌊1+c log1/α wi⌋ (♠) follows from the induction hypothesis and (♥) is due to Lemma 8. The case that d = ∆ can only happen at the root of our computational tree. Following the arguments in the proofs of 8, 9 and the bound in (5), it is easy to see that a universal constant upper bound for the error contraction exists, i.e., ∆ wi Xi=1 Xj=1 Φ(f ) Φ(xij)(cid:12)(cid:12)(cid:12)(cid:12) ∂f (x) ∂xij (cid:12)(cid:12)(cid:12)(cid:12) Thus φ(Rv) − φ(R(G, v, L)) ≤ 6√λαL for every v. Then the lemma follows from Proposition 7, since < max z∈[0,1]s ∆2(∆ − 1)∆−1z∆(1 − z) (∆ − 2)∆ + (∆ − 1)∆−1z∆ < 3. Rv − R(G, v, L) = 1 Φ(x) · φ(Rv) − φ(R(G, v, L)) ≤ 6λ√1 + λ · αL for some x ∈ [0, λ] References [BDK08] Magnus Bordewich, Martin Dyer, and Marek Karpinski. Path coupling using stopping times and counting independent sets and colorings in hypergraphs. Random Structures & Algorithms, 32(3):375 -- 399, 2008. [BG08] Antar Bandyopadhyay and David Gamarnik. Counting without sampling: Asymptotics of the log-partition function for certain statistical physics models. Random Structures & Algorithms, 33(4):452 -- 479, 2008. [DFJ02] Martin E. Dyer, Alan M. Frieze, and Mark Jerrum. On counting independent sets in sparse graphs. SIAM Jounal on Computing, 31(5):1527 -- 1541, 2002. [DG00] Martin E. Dyer and Catherine S. Greenhill. On Markov Chains for independent sets. Journal of Algorithms, 35(1):17 -- 49, 2000. [DJV02] Martin Dyer, Mark Jerrum, and Eric Vigoda. Rapidly mixing Markov chains for disman- tleable constraint graphs. In Randomization and Approximation Techniques in Computer Science, pages 68 -- 77. Springer, 2002. 10 [GJ11] Leslie Ann Goldberg and Mark Jerrum. A polynomial-time algorithm for estimating the partition function of the ferromagnetic ising model on a regular matroid. In Proceedings of ICALP, pages 521 -- 532, 2011. [GK12] David Gamarnik and Dmitriy Katz. Correlation decay and deterministic FPTAS for counting colorings of a graph. Journal of Discrete Algorithms, 12:29 -- 47, 2012. [GSV12] A. Galanis, D. Stefankovic, and E. Vigoda. Inapproximability of the partition function for the antiferromagnetic ising and hard-core models. Arxiv preprint arXiv:1203.2226, 2012. [Jer95] Mark Jerrum. A very simple algorithm for estimating the number of k-colorings of a low-degree graph. Random Structures & Algorithms, 7(2):157 -- 166, 1995. [JS93] [JS97] Mark Jerrum and Alistair Sinclair. Polynomial-time approximation algorithms for the ising model. SIAM Journal on Computing, 22(5):1087 -- 1116, 1993. Mark Jerrum and Alistair Sinclair. The Markov chain Monte Carlo method: an approach to approximate counting and integration, pages 482 -- 520. PWS Publishing Co., Boston, MA, USA, 1997. [JSV04] Mark Jerrum, Alistair Sinclair, and Eric Vigoda. A polynomial-time approximation algorithm for the permanent of a matrix with nonnegative entries. Journal of the ACM, 51:671 -- 697, July 2004. [LL15a] Jingcheng Liu and Pinyan Lu. FPTAS for #BIS with degree bounds on one side. In Proceedings of STOC (to appear), 2015. [LL15b] Jingcheng Liu and Pinyan Lu. FPTAS for counting monotone CNF. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 1531 -- 1548, 2015. [LLL14] Chengyu Lin, Jingcheng Liu, and Pinyan Lu. A simple FPTAS for counting edge cov- In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete ers. Algorithms, pages 341 -- 348, 2014. [LLY12] Liang Li, Pinyan Lu, and Yitong Yin. Approximate counting via correlation decay in spin systems. In Proceedings of SODA, pages 922 -- 940, 2012. [LLY13] Liang Li, Pinyan Lu, and Yitong Yin. Correlation decay up to uniqueness in spin systems. In Proceedings of SODA, pages 67 -- 84, 2013. [LLZ14] Jingcheng Liu, Pinyan Lu, and Chihao Zhang. FPTAS for counting weighted edge covers. In Algorithms - ESA 2014 - 22th Annual European Symposium, Wroclaw, Poland, September 8-10, 2014. Proceedings, pages 654 -- 665, 2014. [LV97] Michael Luby and Eric Vigoda. Approximately counting up to four (extended abstract). In Proceedings of STOC, pages 682 -- 687, 1997. [LWZ14] Pinyan Lu, Menghui Wang, and Chihao Zhang. FPTAS for weighted fibonacci gates and its applications. In ICALP (1), pages 787 -- 799, 2014. 11 [LY13] Pinyan Lu and Yitong Yin. Improved FPTAS for multi-spin systems. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques - 16th In- ternational Workshop, APPROX 2013, and 17th International Workshop, RANDOM 2013, Berkeley, CA, USA, August 21-23, 2013. Proceedings, pages 639 -- 654, 2013. [RST+11] Ricardo Restrepo, Jinwoo Shin, Prasad Tetali, Eric Vigoda, and Linji Yang. Improved mixing condition on the grid for counting and sampling independent sets. In Proceedings of FOCS, pages 140 -- 149, 2011. [SS12] Allan Sly and Nike Sun. The computational hardness of counting in two-spin models on d-regular graphs. In Proceedings of FOCS, pages 361 -- 369, 2012. [SST12] Alistair Sinclair, Piyush Srivastava, and Marc Thurley. Approximation algorithms for two-state anti-ferromagnetic spin systems on bounded degree graphs. In Proceedings of SODA, pages 941 -- 953, 2012. [Vig99] Eric Vigoda. Improved bounds for sampling coloring. In Proceedings of FOCS, pages 51 -- 59, 1999. [Wei06] Dror Weitz. Counting independent sets up to the tree threshold. STOC, pages 140 -- 149, 2006. In Proceedings of [YZ15] Yitong Yin and Jinman Zhao. Counting hypergraph matchings up to uniqueness thresh- old. arXiv preprint arXiv:1503.05812, 2015. A Proof of Theorem 1 Proof. The input of the FPTAS is an instance G(V,E) and an accuracy parameter 0 < ε < 1/2. Assume V = {v1, . . . , vn}. Note that I = ∅ is an independent set of G with w(I) = 1. Therefore Z(G) = 1/PrG [I] = PrG" n ^i=1 vi 6∈ I#!−1 For every 1 ≤ i ≤ n, we define a graph Gi(Vi, Ei): n = Yi=1  vi 6∈ I (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) PrG −1 . i−1 ^j=1 vj 6∈ I    Gi−1 incident to vi. • G1 , G; • For every i ≥ 2, Gi , Gi−1 − vi−1 − E′ where E′ , {e ∈ Ei−1 vi−1 ∈ e} consists of edges in j=1 vj 6∈ Ii = PrGi [vi 6∈ I] for every 1 ≤ i ≤ n. It is straightforward to verify that PrGhvi 6∈ I (cid:12)(cid:12)(cid:12)Vi−1 Thus, n Z(G) = (PrGi [vi 6∈ I])−1 = (1 + Ri) , Yi=1 n Yi=1 where Ri , PrGi [vi∈I] L = log(2Cnε−1) log α−1 PrGi [vi6∈I] . Let C and α be constants in Lemma 6. We compute R(Gi, vi, L) with for every 1 ≤ i ≤ n, then Ri − R(Gi, vi, L) ≤ ε 2n . 12 This implies ε 2n ≤ 1 − 1 + Ri 1 + R(G, vi, L) ≤ 1 + ε 2n . i=1 (1 + R(Gi, vi, L))−1 be our estimate of the partition function, then it holds that Let Z =Qn e−ε ≤ Z(G) Z ≤ eε. It remains to bound the running time of our algorithm. Let T (L) denote the maximum running time of computing R(G, v, L) (over all choices of d ≤ ∆ and arbitrary wi). Then by the definition of R(G, v, L), for every L > 0, T (L) ≤ d wi Xi=1 Xj=1 T (L − ⌊1 + c log1/α wi⌋) + O(n). ε(cid:1)O(log ∆) for our choice of L. Thus our algorithm is an It is easy to verify that T (L) = n∆O(L) =(cid:0) n FPTAS for computing Z(G). B Proof of Lemma 4 Proof. By the definition of Rv, we have Rv = PrG [v ∈ I] PrG [v 6∈ I] = λ · PrG′hVd PrG′hVd i=1 vi ∈ Ii i=1 vi 6∈ Ii = λ · d Yi=1 PrG′hvi ∈ I ∧Vi−1 PrG′hvi 6∈ I ∧Vi−1 j=1 vj 6∈ I ∧Vd j=1 vj 6∈ I ∧Vd j=i+1 vj ∈ Ii j=i+1 vj ∈ Ii For every i ∈ [d], define Gi , G′ − {vk i < k ≤ d} − {ek 1 ≤ k < i}, we have PrG′hvi ∈ I ∧Vi−1 j=1 vj 6∈ I ∧Vd PrG′hvi 6∈ I ∧Vi−1 j=1 vj 6∈ I ∧Vd This is because fixing vj ∈ I is equivalent to removing vj from the graph and fixing vj 6∈ I is equivalent to removing all edges incident to vj from the graph. PrG′hvi ∈ I (cid:12)(cid:12)(cid:12)Vi−1 PrG′hvi 6∈ I (cid:12)(cid:12)(cid:12)Vi−1 j=1 vi 6∈ I ∧Vd j=1 vj 6∈ I ∧Vd j=i+1 vj ∈ Ii j=i+1 vj ∈ Ii j=i+1 vj ∈ Ii j=i+1 vj ∈ Ii = = PrGi [vi ∈ I] PrGi [vi 6∈ I] . Since ei is the unique hyperedge in Gi that contains vi, we have PrGi [vi ∈ I] PrGi [vi 6∈ I] wi = 1 − PrGi−vi−ei ^j=1  vij ∈ I  = 1 − wi Yj=1 PrGij [vij ∈ I] = 1 − Rij 1 + Rij . wi Yj=1 C Proof of Lemma 9 Proof. Let λ′c , dd (d−1)d+1 be the uniqueness threshold for the d-ary tree. Then λ < λc ≤ λ′c. Plugging w = 1 into (3), we have gz(1) =s λQd 1 + λQd i=1 zi i=1 zi · 13 √1 − zi. d Xi=1 Let z =(cid:16)Qd i=1 zi(cid:17) 1 d , it follows from Jensen's inequality that 1 + λzd < ds λ′czd(1 − z) 1 + λ′czd (5) g(t, 1) ≤ ds λzd(1 − z) 1+x(cid:17)d 1 + λ′czd (cid:19)′ (cid:18) λ′czd(1 − z) λ′czd−1 = − Recall that fλ,d(x) = λ(cid:16) 1 that dq λ′ czd(1−z) 1+λ′ is . Let x be the positive fixed-point of fλ′ czd achieves its maximum when z = z. The derivative of λ′ c,d(x) and z = 1 1+x . We show czd with respect to z czd(1−z) 1+λ′ (1 + λ′czd)2 (cid:16)z + λ′czd+1 − d(1 − z)(cid:17) . dd Since λ′c = verify that fλ′ (d−1)d+1 , the above achieves maximum at z = d−1 z , then it is easy to c,d(x) = x, which implies z = z because of the uniqueness of the positive fixed-point. d . If we let x = 1−z Therefore, we have for some α < 1, gz(1) ≤ α < ds λ′c zd(1 − z) 1 + λ′c zd =(cid:12)(cid:12)(cid:12) f′λ′ c,d(x)(cid:12)(cid:12)(cid:12) = 1. D FPTAS for Hypergraph Ising Model D.1 The algorithm and recursion for computing marginal probability In this section, we give the recursion function and design an algorithm to compute marginal prob- ability in hypergraph Ising Model. Then we prove that the algorithm is indeed an FPTAS for any instance G(V,E, (β, γ)) if 1 − 2e−1/2∆+3 ≤ β(e), γ(e) ≤ 1. 2 Graph Operations We first fix some notations on graph modification specific to our hypergraph two state spin model. Let G(V,E, (β, γ)) be an instance. The first groups of operations are about vertex removal and edge removal, which is similar to the case of hardcore model: • For every v ∈ V , we denote G − v , (V \ {v} ,E′, (β′, γ′)) where E′ , {e − v e ∈ E} and β′(e − v) = β(e), γ′(e − v) = γ(e) for every e ∈ E.. • For every e ∈ E, we denote G − e , (V,E \ {e} , (β, γ)). • Let x be a vertex or an edge and y be a vertex or an edge, we denote G− x− y , (G− x)− y. • Let S = {v1, . . . , vk} ⊆ V , we denote G − S , G − v1 − v2 ··· − vk. • Let F = {e1, . . . , ek} ⊆ E, we denote G − F , G − e1 − e2 ··· − ek. The second group of operations is about pinning the value of a vertex, whose effect is to change β(e) or γ(e) for edge e incident to it. 14 • Let v ∈ V be a vertex, we denote Gv=0 , (V \{v} ,E′, (β′, γ′)e∈E ′) where E′ , {e − v e ∈ E}, β′(e − v) , β(e) for every e ∈ E and γ′(e − v) ,(γ(e) 1 if v 6∈ e otherwise. This operation is to pin the value of v to 0. • Similarly, for a vertex v ∈ V , we denote Gv=1 , (V \{v} ,E′, (β′, γ′)) where E′ , {e \ {v} e ∈ E}, γ′(e − v) , γ(e) for every e ∈ E and β′(e − v) ,(β(e) 1 if v 6∈ e otherwise. This operation is to pin the value of v to 1. • Let u, v ∈ V be two vertices and i, j ∈ {0, 1}. We denote Gu=i,v=j , (Gu=i) v=j and this notation generalizes to more vertices. • Let S = {v1, . . . , vk} ⊆ V , we use GS=0 (resp. GS=1) to denote Gv1=0,v2=0,...,vk=0 and Gv1=1,v2=1,...,vk=1. Let G(V,E, (β, γ)) be an instance and v ∈ V be an arbitrary vertex with degree d. Let E(v) = {e1, . . . , ed} be the set of edges incident to v. For every i ∈ [d], we assume ei = {v}∪{vij j ∈ [wi]} consists of wi + 1 vertices where wi ≥ 0. We define a new instance G′(V ′,E′, (β′e, γ′e)) which is obtained from G by replacing v by d copies of itself and each ei contains a distinct copy. Formally, V ′ , (V \ {v}) ∪ {v1, . . . , vd} and E′ , (E \ E(v)) ∪ {ei − v + vi i ∈ [d]}; β′(e) = β(e), γ′(e) = γ(e) for every e ∈ E \ E(v) and β′(ei − v + vi) = β(ei), γ′(ei − v + vi) = γ(ei) for every i ∈ [d]. ij)(cid:17) and For every i ∈ [d] and j ∈ [wi], we define two smaller instances G0 ij(cid:16)V 1 ij,E 1 • G0 • G1 , (((G′V<i=0)V>i=1) − ei)V i , (((G′V<i=0)V>i=1) − ei)V i ij(cid:16)V 0 ij)(cid:17): ij, (β1 ij, γ1 ij, (β0 ij , γ0 ij,E 0 <j =1, <j =0; G1 ij ij where V<i , {vk k < i}, V>i , {vk k > i}, V i <j , {vik k < j}. We now define the ratio of the probability on instances defined above. • Let Rv , PrG[σ(v)=1] PrG[σ(v)=0] ; • For every i ∈ [d] and j ∈ [wi], let R0 ij , Pr Pr G0 ij G0 ij [σ(vij )=1] [σ(vij )=0] , R1 ij , Pr Pr G1 ij G1 ij [σ(vij )=1] [σ(vij )=0] . It follows from our definition that for every i ∈ [d], R0 We can compute Rv by the following recursion: i1 = R1 i1. Lemma 10. Rv = λ · d Yi=1 1 − (1 − γ(ei)) R0 1 − (1 − β(ei)) i1 1+R0 1+R0 1 i1 Qwi i1 Qwi j=2 j=2 15 R1 ij 1+R1 ij 1 1+R0 ij . (6) Proof. By the definition of Rv, we have Rv = PrG [σ(v) = 1] PrG [σ(v) = 0] = λ· PrG′hVd PrG′hVd i=1 σ(vi) = 1i i=1 σ(vi) = 0i d Yi=1 = λ· For every i ∈ [d], define Gi , (G′V<i=0)V>i=1, then j=i+1 σ(vj) = 1i PrG′hσ(vi) = 1 ∧Vi−1 j=i+1 σ(vj) = 1i PrG′hσ(vi) = 0 ∧Vi−1 j=1 σ(vj) = 0 ∧Vd j=1 σ(vj) = 0 ∧Vd PrG′hσ(vi) = 1 ∧Vi−1 PrG′hσ(vi) = 0 ∧Vi−1 PrG′hσ(vi) = 1(cid:12)(cid:12)(cid:12)Vi−1 PrG′hσ(vi) = 0(cid:12)(cid:12)(cid:12)Vi−1 PrGi [σ(vi) = 1] PrGi [σ(vi) = 0] . = = j=1 σ(vj) = 0 ∧Vd j=1 σ(vj) = 0 ∧Vd j=i+1 σ(vj) = 1i j=i+1 σ(vj) = 1i . j=1 σ(vj) = 0 ∧Vd j=1 σ(vj) = 0 ∧Vd j=i+1 σ(vj ) = 1i j=i+1 σ(vj ) = 1i Since ei is the unique edge in Gi that contains vi, we have PrGi [σ(vi) = 1] PrGi [σ(vi) = 0] = = = = j=1 σ(vij) = 1i(cid:17) j=1 σ(vij ) = 0i(cid:17) j=2 PrGi−vi−eihσ(vij) = 1(cid:12)(cid:12)(cid:12)Vj−1 j=2 PrGi−vi−eihσ(vij) = 0(cid:12)(cid:12)(cid:12)Vj−1 [σ(vij) = 1] ij [σ(vij) = 0] j=1 σ(vij) = 1i +(cid:16)1 − PrGi−vi−eihVwi j=1 σ(vij) = 0i +(cid:16)1 − PrGi−vi−eihVwi γ(ei)PrGi−vi−eihVwi β(ei)PrGi−vi−eihVwi 1 − (1 − γ(ei))PrGi−vi−ei [σ(vi1) = 1] ·Qwi 1 − (1 − β(ei))PrGi−vi−ei [σ(vi1) = 0] ·Qwi 1 − (1 − γ(ei))PrG1 1 − (1 − β(ei))PrG0 1 − (1 − γ(ei)) R0 1 − (1 − β(ei)) [σ(vi1) = 1] ·Qwi [σ(vi1) = 0] ·Qwi i1 Qwi i1 Qwi R1 ij 1+R1 ij i1 1+R0 1+R0 ij 1+R0 j=2 j=2 i1 i1 1 1 . j=2 PrG1 j=2 PrG0 ij k=1 σ(vk) = 1i k=1 σ(vk) = 0i The last equality is due to the fact that R0 i1 = R1 i1. The algorithm description is similar to Section 3.2. Let G(V,E, (β, γ)) be an instance of our two state spin model with maximum degree ∆, and v ∈ V be an arbitrary vertex with degree d. Let E(v) = {e1, . . . , ed} denote the set of edges incident to v. Define G0 ij as in Section D. Then the recursion (6) gives a way to compute the marginal probability PrG [σ(v) = 1] exactly. However, an exact evaluation of the recursion requires a computation tree with exponential size. Thus we introduce the following truncated version of the recursion, with respect to constants c > 0 and 0 < α < 1. Let ij, Rv, R0 ij, G1 ij, R1 fG(r) = λ · d Yi=1 1 − (1 − γ(ei)) r0 1 − (1 − β(ei)) 1 i1 1+r0 1+r0 r1 ij 1+r1 ij 1 1+r0 ij , j=2 j=2 i1 Qwi i1 Qwi where r , ((r0 ij)1≤j≤wi, (r1 ij )2≤j≤wi)i∈[d] with r0 ij = R(G0 r1 ij = R(G1 ij , vij, L − ⌊1 + c log1/α wi⌋) ij , vij, L − ⌊1 + c log1/α wi⌋). 16 We can describe our truncated recursion as follows: R(G, v, L) =(fG(r) λ if L > 0 otherwise. The recursion can be directly used to compute R(G, v, L) for any given L and it induces a truncated computation tree (with height L in some special metric). We claim that R(G, v, L) is a good estimate of Rv for a suitable choice of c and α, for those 2 2e−1/2∆+3 ≤ β(e), γ(e) ≤ 1 for all e ∈ E. (β, γ, ∆) satisfying that 1 − Lemma 11. Let G(V,E, (β, γ)) be an instance of our generalized two state spin system model with 2e−1/2∆+3 ≤ β(e), γ(e) ≤ 1 for all maximum degree ∆ ≥ 2. Let v ∈ V be a vertex and assume 1 − e ∈ E. There exist constants C > 0 and 0 < α < 1 such that 2 for every L. R(G, v, L) − Rv ≤ C · αmax{0,L} The Lemma 11 will be proved in the next section. The proof of Theorem 3 with this lemma is almost identical to the proof of Theorem 1 and we omit it here. D.2 Correlation decay Again, the key is to bound the amortized decay rate as in the following lemma. Lemma 12. Let ∆ ≥ 2 be a constant integer. Suppose d ≤ ∆ is a constant integer, λ ∈ (0, 1), βc = are constant real numbers and γ1, γ2, . . . γd, β1, β2, . . . , βd ∈ [βc, 1]. Let w1, . . . , wd > 0 1− be integers and 2e−1/2∆+3 2 d i1 1+r0 1 − (1 − γi) r0 1 − (1 − βi) 1 1+r0 r1 ij 1+r1 ij 1 1+r0 ij j=2 j=2 i1 Qwi i1 Qwi x . There exist constants α < 1 and c > 0 depending on Φ(f ) Φ(r1 ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ].   ≤ α < 1 ∂f (r) ∂r1 ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) c , λβ−∆ c for all 1 ≤ i ≤ d and 2 ≤ j ≤ wi. The it holds d f (r) = λ be a (cid:16)Pd γ and ∆ (but not depending on wi) such that Yi=1 i=1 wi(cid:17)-ary function. Let Φ(x) = 1 ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj=2 for every r = (rij)i∈[d],j∈[wi] where each rij ∈ [λβ∆ , zij , r0 Proof. We first let xi , r0 ij i1 1+r0 1+r0 i1 ij that xi, yij, zij ∈h λβ∆ λ i   ∂f (r) ∂r0 Φ(f ) Φ(r0 Xj=1 Xi=1 1+λβ∆ c λ+β∆ wc + wi c , wi , yij , r1 ij 1+r1 ij c i. To simplify the notation, we denote Ai , 1 − (1 − γi)xi yij wi Yj=2 Bi , 1 − (1 − βi)(1 − xi) wi Yj=2 (1 − zij) 17 where Ai ∈ [γi, 1] ⊆ [βc, 1], Bi ∈ [βi, 1] ⊆ [βc, 1]. Then we can write f as d f = λ Ai Bi . Yi=1 We can directly compute the partial derivatives of f , which yields the following for all i ∈ [d] and 2 ≤ j ≤ wi: (1 − xi) ((1 − Ai)(1 − Bi) − (1 − xi)(1 − Ai) − xi(1 − Bi)) xiB2 i Ak Bk xiAiBi = λ Yk∈[d]  k6=i (1 − xi) ((1 − Ai)(1 − Bi) − (1 − xi)(1 − Ai) − xi(1 − Bi)) = f · = λ Yk∈[d]  = λ Yk∈[d]  = f · −(1 − yij)2(1 − Ai) = f · −(1 − Bi)(1 − zij) · −(1 − yij)2(1 − Ai) · −Ai(1 − Bi)(1 − zij) Ak Bk Ak Bk yijBi yijAi B2 i k6=i k6=i Bi ; . ; wi wi + Φ(f ) Φ(r1 Φ(f ) Φ(r0 ∂f (r) ∂r0 ∂f (r) ∂r1 ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 1 − xi (cid:12)(cid:12)(cid:12)(cid:12) Xj=1 i   −(1 − Ai)(1 − Bi) + (1 − xi)(1 − Ai) + xi(1 − Bi) Xj=2 Xj=2 ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 1 − yi (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)  ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)  ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ∂f (r) ∂r0 ∂f (r) ∂r1 Xj=2 xi yi + + wi wi zi 1 − zi (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) AiBi j=2 yij(cid:17)1/(wi−1) j=2 1 − zij(cid:17)1/(wi−1) , zi , 1 −(cid:16)Qwi Ai = 1 − (1 − γi)xiywi−1 Bi = 1 − (1 − βi)(1 − xi)(1 − zi)wi−1, , i ∂f (r) ∂r0  ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)  Xj=2 wi wi 1 − Ai 1 − Bi + Ai (1 − yij) + Xj=2 for every i ∈ [d], then it holds that Bi zij  ·       ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i1 (cid:12)(cid:12)(cid:12)(cid:12) ∂f ∂r0 i1 ∂f ∂r1 ij ∂f ∂r0 ij Thus, d d 1 = wc wc f (r) Xi=1 i   Xi=1 i  Xi=1  Let yi ,(cid:16)Qwi wc = d wi Xj=2 (1 − yij) ≤ (wi − 1)(1 − yi) wi Xj=2 zij ≤ (wi − 1)zi. 18 d wi wi + wc wc ≤ AiBi 1 − Ai −(1 − Ai)(1 − Bi) + (1 − xi)(1 − Ai) + xi(1 − Bi) Since Ai, Bi ∈ [βc, 1] for every i ∈ [d], we have Xi=1 Xi=1 Xi=1 1 − βc β2 c i   i (cid:18) (1 − xi)(1 − Ai) + xi(1 − Bi) − (1 − Ai)(1 − Bi) i (1 − xi)(1 − Ai) + xi(1 − Bi) Xi=1 i (cid:16)(1 − xi)xi(ywi−1 + (1 − βc)(wi − 1) xiywi−1 + (1 − zi)wi−1) + βc(wi − 1)(xiywi−1 (1 − yij) + + (wi − 1)(cid:18) (1 − Ai)(1 − yi) zij Xj=2  (cid:19)(cid:19) (1 − Bi)zi !! (1 − yi) + (1 − xi)(1 − zi)wi−1zi)(cid:17) Ai (1 − xi)(1 − zi)wi−1zi (1 − yi) Ai 1 − Bi Xj=2 AiBi AiBi ≤ ≤ wc wc Bi Bi Bi Ai + + d d i i d i We now assume Lemma 13, thus there exist constants α < 1, c > 0 depending on λ and ∆ such that + (1 − zi)wi−1) + βc(wi − 1)(xiywi−1 i (1 − yi) + (1 − xi)(1 − zi)wi−1zi)(cid:17) ≤ αβce 1 2βc −1 −(1 − Ai)(1 − Bi) + (1 − xi)(1 − Ai) + xi(1 − Bi) AiBi + 1 − Ai Ai wi Xj=2 (1 − yij) + 1 − Bi Bi wi Xj=2 zij  i wc i (cid:16)(1 − xi)xi(ywi−1 for every i ∈ [d]. Thus, i  Xi=1  1 − βc · d · α · eβ−1 ≤ wc d βc c /2−1 2d 2αd 2e−1/2d + 3 · 2e−1/2d + 3 2e−1/2d + 1 · e(1−2/(2e−1/2d+3))−1/2−1 2e−1/2d + 1 · e(1−2/(2e−1/2d+3))−1/2−1 ≤ = α · ≤ α. The last inequality is due to the fact that h(d) , function on d and limd→∞ h(d) = 1. and every r = (rij)i∈[d],j∈[wi] with each rij ∈ [λβ∆ Xj=2 ∂f (r) ∂r0 Φ(f ) Φ(r0 Xi=1 Xj=1 wc + wi wi d i   ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) c , λβ−∆ c ], it holds Φ(f ) Φ(r1 ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ∂f (r) ∂r1 ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)   ≤ α < 1 2e−1/2d+1 · e(1−2/(2e−1/2d+3))−1/2−1 is an increasing Combining all above, there exist constants α < 1 and c > 0 such that for all w1, w2, . . . wd > 0 2d It remains to prove Lemma 13: Lemma 13. For all β < 1 and 0 < δ < 1/2, there exist constants α < 1 and c > 0 such that wc(cid:0)(1 − x)x(yw−1 + (1 − z)w−1) + β(w − 1)xyw−1(1 − y) + β(w − 1)(1 − x)(1 − z)w−1z(cid:1) ≤ αβe for all w ∈ N and all x, y, z ∈ [δ, 1 − δ]. 1 2β −1 19 Proof. For a fixed w, let Vw(x, y, z) , (1 − x)x(yw−1 + (1 − z)w−1) + β(w − 1)xyw−1(1 − y) + β(w − 1)(1 − x)(1 − z)w−1z. Then Vw(x, y, z) achieves maximum value when y = yc , β(w − 1) + 1 − x βw = 1 − 1 − (1 − x)/β w , z = zc , 1 − β(w − 1) + x βw = 1 − x/β w . w , Vw(x, y, z) is an increasing function on y. If y < 1 − 1−(1−x)/β decreasing function on z. Let w , maxn(cid:6) 1 ln(1−δ)mo + 1. If w > w, the monotonicity of Vw(x, y, z) implies that the function achieves it maximum when the y and z are at the boundary, i.e., y = 1 − z = 1 − δ, for every fixed x. e1/(2β)−1 !1/2 We now analyze the case w ≤ w and the case w > w separately. Define α , (cid:16)1+ 1/(2β)−1 δ(cid:7) ,l− 1 w , Vw(x, y, z) is a If z > 1−x/β (cid:17) w . w It is easy to verify that α < 1 since (1 + x/n)n < ex for every x > 0. • (If w ≤ w.) We plug y = yc and z = zc into Vw(x, y, z): c +(1−zc)w−1)+β(w−1)xyw−1 Vw(x, y, z) ≤ (1−x)x(yw−1 The derivative of the right hand side with respect to x is (β(w − 1) + 1 − x)w−1(1 + β(w − 1) − (w + 1)x) − (β(w − 1) + x)w−1(1 + β(w − 1) − (w + 1)(1 − x)) (1−yc)+β(w−1)(1−x)(1−zc)w−1zc. c (βw)w . It is easy to see that the function above is zero when x = 1/2 and positive for smaller x, negative for larger x. Thus, when x = 1/2, y = yc, z = zc, Vw(x, y, z) achieves its maximum value Vw 1 2 , 1 − 1 − 1 w Let c1 , log w 1 2β αe 1− 1 2β 1− , −1 2β 2β 2β 2β ≤ β 1 − w !w 1 − 1 1 − 1 w ! = β 1 − w ! w 1 − 1 w ! w = − log w α > 0, then for all w ≤ w and c′ ∈ (0, c1], w ! w 1 − 1 w ! w 1 − 1 α 1 − = 2β 2β β wc′ Vw(x, y, z) ≤ wc1Vw(x, y, z) ≤ wc1β 1 − < βe 1 2β −1. = αβe 1 2β −1. • (If w > w.) Let c2 , − w log(1 − δ) − 1 > 0. Then Vw(x, y, z) ≤ Vw(x, 1 − δ, δ) = 2x(1 − x)(1 − δ)w−1 + β(w − 1)δ(1 − δ)w−1 The above achieves its maximum when x = 1/2, i.e., Vw(x, y, z) ≤ Vw(cid:0) 1 1 + 2β(w − 1)δ wc2 · Vw(x, y, z) ≤ wc2 · Vw(cid:18) 1 2 , 1 − δ, δ(cid:19) = wc2 · 2 2 , 1 − δ, δ(cid:1). Therefore (1 − δ)w−1. 20 We now prove that for all c′ ∈ (0, c2], g(w) , wc′ 1+2β(w−1)δ when w > w. Since c′ ≤ c2 = − w log(1 − δ) − 1 ≤ −(w − 1) log(1 − δ) − 1 for all w > w, ∂g ∂w (1 − δ)w−1 is decreasing on w = 2 2 (cid:0)c′ + w log(1 − δ)(cid:1) + βδwc′−1(1 − δ)w−1(cid:0)w + (w − 1)(c′ + w log(1 − δ))(cid:1) (log(1 − δ) − 1) + βδwc′−1(1 − δ)w−1 (w + (w − 1)(log(1 − δ) − 1)) + βδwc′−1(1 − δ)w−1(1 + (w − 1) log(1 − δ)) − βδwc′−1(1 − δ)w−1c′) wc′−1(1 − δ)w−1 wc′−1(1 − δ)w−1 wc′−1(1 − δ)w−1 wc′−1(1 − δ)w−1 2 2 2 ≤ ≤ − ≤ − < 0 Thus, g(w) is decreasing on w when w > w. In light of this, wc′ · Vw(x, y, z) can be upper bounded by wc′ In all, we have · V w(cid:0) 1 wc′ 2 , 1 − δ, δ(cid:1) for all c′ ∈ (0, c2]. · Vw(cid:18) 1 · Vw(x, y, z) ≤ wc′ · V w(cid:18) 1 ≤ wc′ ≤ wc1 · V w 1 , 1 − δ, δ(cid:19) , 1 − δ, δ(cid:19) 1 − 1 , 1 − w 2β −1 wc′−c1 2 2 2 1 2β , 2β 1 − 1 w ! wc′−c1 = αβe for all w > w and c′ ∈ (0, c2]. Let c = min{c1, c2}, then we have wcVw(x, y, z) ≤ wc1Vw(x, y, z) ≤ αβe wcVw(x, y, z) ≤ wc1V w(x, y, z) wc′−c1 ≤ αβe wc(cid:0)(1 − x)x(yw−1 + (1 − z)w−1) + β(w − 1)xyw−1(1 − y) + β(w − 1)(1 − x)(1 − z)w−1z(cid:1) ≤ αβe for all w ∈ N and all x, y, z ∈ [δ, 1 − δ]. 2β −1 if w > w, i.e., 2β −1 if w ≤ w and 1 1 2β −1 1 We are now ready to prove Lemma 11. Proof of Lemma 11. Let Φ(x) = 1 If ℓ = 0, note that fv ∈ [λβ∆ x and φ(x) = R Φ(x) dx = ln x. We apply induction on ℓ , max{0, L} to show that, if d ≤ ∆, then φ(fv) − φ(f (G, v, L)) ≤ 4√eαL for some constant α < 1. ], thus φ(f (G, v, L)) − φ(fv) ≤ −2∆ ln βc. Since ln(1 − x) ≤ 2x for all x ∈(cid:0)0, 1 2(cid:1), φ(f (G, v, L)) − φ(fv) ≤ −2∆ ln βc ≤ 4∆ c , λβ−∆ 2√e ∆ + 3 ≤ 4√e. 2 c We now assume L = ℓ > 0 and the lemma holds for smaller ℓ. For every i ∈ [d] and j ∈ [wi], ij, vij, L − ⌊1 + ij)2≤j≤wi)i∈[d]. Let f (r) = ij = R(G0 ij)2≤j≤wi)i∈[d], r = ((r0 we denote r0 c log1/α wi⌋). Let r = ((r0 ij , vij, L − ⌊1 + c log1/α wi⌋), r1 ij and r0 ij)1≤j≤wi, (r1 ij)1≤j≤wi, (r1 ij = R(G1 ij = R1 ij = R0 ij, r1 21 i=1 1−(1−γi) 1−(1−βi) where each r0 λQd r0 i1 1+r0 1 j=2 i1 Qwi i1 Qwi ij ∈ [λβ∆ j=2 1+r0 ij, r1 r1 ij 1+r1 ij 1 1+r0 ij c , λβ−∆ c ], φ(Rv) − φ(R(G, v, L)) ≤ d wi  Xi=1 Xj=1  ≤ 4√e (♠) Xi=1 ≤ 4√eαL. (♥) d , then it follows from Proposition 7 that for some r = ((r0 ij)1≤j≤wi, (r1 ij)2≤j≤wi)i∈[d] ij) − φ(r0 Φ(f ) Φ(r0 ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)  Xj=1  wi ∂f (r) ∂r0 ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ·(cid:12)(cid:12)φ(r0 ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ∂f (r) ∂r0 Φ(f ) Φ(r0 + wi Xj=2 ij ) − φ(r1 ij)(cid:12)(cid:12) wi Φ(f ) Φ(r1 ∂f (r) ∂r1 ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj=2 ·(cid:12)(cid:12)φ(r1  ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)  αL−⌊1+c log1/α wi⌋ ∂f (r) ∂r1   ij)(cid:12)(cid:12) + ij)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Φ(f ) Φ(r1 (♠) follows from the induction hypothesis and (♥) is due to Lemma 12 for all d ≤ ∆. Then the lemma follows from Proposition 7, since Rv − R(G, v, L) = for some x ∈ [λβ∆ c , λβ−∆ c ] 1 Φ(x) · φ(Rv) − φ(R(G, v, L)) ≤ e√eλ−1 · 4√eαL 2 +√eαL. = 4λ−1e c =(cid:16)1 − 2√e(cid:17)−∆ √e ∆+ 3 1 ≤ e√e. The inequality above is due to β−∆ 22
1704.04362
4
1704
2018-09-03T18:33:35
Fast Randomized Algorithms for t-Product Based Tensor Operations and Decompositions with Applications to Imaging Data
[ "cs.DS" ]
Tensors of order three or higher have found applications in diverse fields, including image and signal processing, data mining, biomedical engineering and link analysis, to name a few. In many applications that involve for example time series or other ordered data, the corresponding tensor has a distinguishing orientation that exhibits a low tubal structure. This has motivated the introduction of the tubal rank and the corresponding tubal singular value decomposition in the literature. In this work, we develop randomized algorithms for many common tensor operations, including tensor low-rank approximation and decomposition, together with tensor multiplication. The proposed tubal focused algorithms employ a small number of lateral and/or horizontal slices of the underlying 3-rd order tensor, that come with {\em relative error guarantees} for the quality of the obtained solutions. The performance of the proposed algorithms is illustrated on diverse imaging applications, including mass spectrometry data and image and video recovery from incomplete and noisy data. The results show both good computational speed-up vis-a-vis conventional completion algorithms and good accuracy.
cs.DS
cs
FAST RANDOMIZED ALGORITHMS FOR T-PRODUCT BASED TENSOR OPERATIONS AND DECOMPOSITIONS WITH APPLICATIONS TO IMAGING DATA∗ DAVOUD ATAEE TARZANAGH† AND GEORGE MICHAILIDIS‡ Abstract. Tensors of order three or higher have found applications in diverse fields, including image and sig- nal processing, data mining, biomedical engineering and link analysis, to name a few. In many applications that involve for example time series or other ordered data, the corresponding tensor has a distinguishing orientation that exhibits a low tubal structure. This has motivated the introduction of the tubal rank and the corresponding tubal singular value decomposition in the literature. In this work, we develop randomized algorithms for many common tensor operations, including tensor low-rank approximation and decomposition, together with tensor multiplication. The proposed tubal focused algorithms employ a small number of lateral and/or horizontal slices of the underlying 3-rd order tensor, that come with relative error guarantees for the quality of the obtained solutions. The performance of the proposed algorithms is illustrated on diverse imaging applications, including mass spectrometry data and image and video recovery from incomplete and noisy data. The results show both good computational speed-up vis-a-vis conventional completion algorithms and good accuracy. Key words. tensor slices selection, circulant algebra, low rank decomposition, nuclear norm minimization AMS subject classifications. 15A69, 15A23, 68W20, 65F30 1. Introduction. Tensors are multi-dimensional arrays that have been used in diverse fields of applications, including chemometrics [45], psychometrics [30], image/video and signal processing [24, 25, 35, 44, 54] and link analysis [29]. They have also been the object of intense mathematical study (see for example the review paper by Kolda and Bader [28] and references therein). Analogously to the matrix case, a number of tensor decompositions have been proposed in the literature, briefly described next for the case of 3-way tensors. Let Z ∈ Rn1×n2×n3. Then, there exists a factorization, called a "Tucker decomposition"of Z, of the form R1(cid:88) R2(cid:88) R3(cid:88) (cid:16) (cid:17) (1) Z = gr1r2r3 u(1) r1 ◦ u(2) r2 ◦ u(3) r3 = G ×1 U (1) ×2 U (2) ×3 U (3), r1=1 r2=1 r3=1 where G ∈ RR1×R2×R3 is the core tensor associated with this decomposition, U (i) ∈ Rni×Ri is the i-th factor matrix and ×i is the mode−i product for i = 1, 2, 3. The 3-tuple (R1, R2, R3) is called the Tucker rank or multilinear rank of tensor Z [8, 22]. The conventional Tucker decomposition corresponds to the orthonormal Tucker decomposition, which is also known as the higher-order SVD (HOSVD). De Lathauwer et al. [10] proposed an algorithm to compute a HOSVD decomposition. Soon afterwards they proposed the higher-order orthogonal iteration (HOOI) [11] to provide an inexact Tucker decomposition. The CP decomposition of a tensor is another important notion of tensor-decomposition, which leads to the definition of CP rank. The CP model can be considered as a special case of the Tucker model with a superdiagonal core tensor. Further, the CP rank of a tensor equals that of its Tucker core [21]. 1.1. Third order tensor as operator on matrices. While the Tucker-based factoriza- tion may be sufficient for many applications, in this paper we consider an entirely different tensor decomposition based on circulant algebra [26]. In this factorization, a tensor in Rn1×n2×n3 is viewed as a n1 × n2 matrix of "tubes", also known as elements of the ring Rn3 where addition ∗ R01 GM114029-03 to GM. Funding: This work was supported in part by NSF grants CCF 1540093, IIS 1632730, and NIH grant 5 †Department of Mathematics & UF Informatics Institute, University of Florida, Gainesville, FL, ‡Department of Statistics & UF Informatics Institute, University of Florida, Gainesville, FL, ([email protected]). ([email protected]). 1 8 1 0 2 p e S 3 ] S D . s c [ 4 v 2 6 3 4 0 . 4 0 7 1 : v i X r a 2 D. A. TARZANAGH AND G. MICHAILIDIS is defined as vector addition and multiplication as circular convolution. This "matrix-of-tubes" viewpoint leads to definitions of a new multiplication for tensors ("tubal multiplication"), a new rank for tensors ("tubal rank"), and a new notion of a singular value decomposition (SVD) for tensors ("tubal SVD"). The tubal SVD (t-SVD) provides the "best" tubal rank-r approxi- mation to Z, as measured with respect to any unitary invariant tensor norm. A limitation of the t-SVD decomposition is that it depends directly on the orientation of the tensor, whereas the CP and Tucker decompositions are not. This suggests that the lat- ter decompositions are well suited for data applications where the tensor's orientation is not critical - e.g. chemometrics [45] and/or psychometrics [30]. However, in applications involving time series or other ordered data, the orientation of the tensor is fixed. Examples include, but not limited to, computed tomography (CT) [44], facial recognition [18] and video compres- sion [54], where the tensor decomposition is dependent on the third dimension. Analogous to compressing a two-dimensional image using the matrix SVD (a classic linear algebra example, with detailed writeup in [23]), the t-SVD decomposition can be used to compress several im- ages taken over time (e.g. successive frames from a video). Since such images do not change substantially from frame to frame, we expect tubal compression strategies to provide better results than performing a matrix SVD on each separate image frame. The former consider the tensor as a whole object, rather than as a collection of distinct images [27, 26, 54, 44, 35]. Further, t-SVD is essentially based on a group theoretic approach, where the multidimensional structure is unraveled by constructing group-rings along the tensor fibers 1. The advantage of such an approach over existing ones is that the resulting algebra and corresponding analysis enjoys many similar properties to matrix algebra and analysis. For example, it is shown in [20] that recovering a 3-way tensor of length n and Tucker rank (r, r, r) from random measurements requires O(rn2 log2(n)) observations under a matrix coherence condition on all mode-n unfold- ings. However, the number of samples needed for exact recovery of a 3-way tensor of length n and tensor tubal-rank r is O(rn2 log(n2)) under a weaker tensor coherence assumption [53]. Further, consider the decomposition X = L + E, where L ∈ Rn1×n2×n3 is low rank and E is sparse. Let n(1) = max(n1, n2) and n(2) = min(n1, n2). The work in [35] shows that for tensor L with coherence parameter µ, the recovery is guaranteed with high probability for the tubal rank of order n(2)n3/(µ(log n(1)n3)2) and a number of nonzero entries in E of order O(n1n2n3). Hence, under the same coherence condition (see, Definitions 14 and 15), the tubal robust tensor factorization problem perfectly recovers the low-rank and sparse components of the underlying tensor. A shortcoming of these three classical decompositions is their brittleness with respect to severely corrupted or outlier data entries. To that end, a number of approaches have been developed in the literature to recover a low-rank tensor representation from data subject to noise and corrupted entries. We focus on two instances of the problem based on the t-SVD algorithm: (i) noisy tensor completion, i.e., recovering a low-rank tensor from a small subset of noisy entries, and (ii) noisy robust tensor factorization, i.e., recovering a low-rank tensor from corrupted data by noise and/or outliers of arbitrary magnitude [35, 54]. These two classes of tensor factorization problems have attracted significant interest in the research community [2, 6, 44, 54]. In particular, convex formulations of noisy tensor factorization have been shown to exhibit strong theoretical recovery guarantees and a number of algorithms has been developed for solving them [54, 44, 35]. tages, also exhibits a number of drawbacks listed below: It is frequently mentioned that (noisy) tensor factorization, despite its numerous advan- • The available methods [4, 27, 26, 54, 44, 35] are inherently sequential and all rely on the repeated and costly computation of t-SVD factors, Discrete Fourier Transform (DFT) and its inverse (IDFT), that limit their scalability. • The basis tensor vectors resulting from t-SVD have little concrete meaning, which makes it challenging for practitioners to interpret the obtained results. For instance, 1We consider the group rings constructed out of cyclic groups, resulting in an algebra of circulants. However, the results presented in this paper hold true for the general group-ring construction. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 3 √ the vector [(1/2) age - (1/ 2) height + (1/2)income], being one of the significant uncorrelated factors from a data set of people's features is not easily interpretable (see discussion in [15]). Kuruvilla et al. in [31] have also claimed: "it would be interesting to try to find basis vectors for all experiment vectors, using actual experiment vectors and not artificial bases that offer little insight". • The t-SVD decomposition for sparse tensors does not preserve sparsity in general, which for large size tensors leads to excessive computations and storage requirements. Hence, it is important to compute low-rank tensor factorizations that preserve such structural properties of the original data tensor. 1.2. Main Contributions. In this paper, we study scalable randomized tensor multipli- cation (rt-product algorithm) and tensor factorization (rt-project) operations and extend the matrix CX and CUR type decompositions [12, 13, 15, 36] to third order tensors using a circulant algebra embedding. To that end, we develop a basic algorithm (t-CX), together with a more general one (t-CUR) based on tensor slice selection that come with relative error guarantees. Finally, we propose a new tensor nuclear norm minimization method, called CUR t-NN, which solves the noisy tensor factorization problem using a small number of lateral and/or horizontal slices of the underlying tensor. Specifically, CUR t-NN uses an adaptive technique to sample slices of the tensor based on a leverage score for them and subsequently solves a convex op- timization problem followed by a projection step to recover a low rank approximation to the underlying tensor. Advantages of CUR t-NN include: • Contrary to nuclear norm minimization based approaches, which minimize the sum of the singular values of the underling tensor, our approach only minimizes the sum of singular values of the set of sampled slices corresponding to the largest leverage scores. Thus, we obtain a more accurate and robust approximation to the rank function. • Using subspace sampling, we obtain provable relative-error recovery guarantees for tubal product based tensor factorization. This technique is likely to be useful for other tensor approximation and data analysis problems. • The proposed algorithm for noisy tensor factorization tasks has polynomial time com- plexity. 1.3. Related work on randomized tensor factorization. Note that there has been prior work on the topic of randomized methods for tensor low rank approximations/decomposi- tions. For example, recent work includes [37, 5]. Our methods are different from these studies, since we rely on the t-product construct in [4, 26, 27] to provide tubal tensor multiplication and low rank approximation. In [37], the proposed tensor-CUR algorithm employs a CUR matrix approximation to one of the unfolding matrix modes (the distinguished mode) providing an approximation based on few tube fibers and few slices. Hence, that algorithm achieves an ad- ditive error guarantee in terms of the flattened (unfolded) tensor, rather than the original one. However, the algorithms presented in this work offer relative error guarantees for the obtained approximations, in terms of the original low tubal rank tensor. Further, we propose a new tensor nuclear norm minimization method, which solves the noisy tensor factorization problem in the fully and partially observed setting using a small number of lateral and/or horizontal slices of the underlying tensor. It is worth mentioning that randomized algorithms were used to efficiently solve the robust matrix PCA problem using small sketches constructed from ran- dom linear measurements of the low rank matrix [43, 55, 34, 36, 39]. Our proposed nuclear norm minimization approach is different from these studies, since we relay on slice selection and projection (mainly t-CUR factorization). Further, our proposed algorithm uses an adap- tive sampling strategy and provides high probability recovery guarantees of the exact low rank tensor approximation under a weaker coherence assumption. The remainder of the paper is organized as follows. In Section 2, we review some relevant mathematical concepts including the tensor circulant algebra, basic definitions and theorems of tensors, and the t-SVD decomposition based on the t-product concept. In Section 3, we provide the randomized tensor decompositions and provide their relative error guarantees and introduce 4 D. A. TARZANAGH AND G. MICHAILIDIS the concept of slice selection and projection. In Section 4, we introduce, evaluate and analyze our proposed algorithm (CUR t-NN) for large scale noisy tensor decomposition. Experimental results are presented in Section 5 and some concluding remarks are drawn in Section 6. The detailed proofs of the main results established are delegated to the Appendix. 2. Mathematical preliminaries. Next, we introduce key definitions and concepts used in subsequent developments. Tensor indexing. We denote tensors by boldface Euler script letters, e.g., X, matrices by boldface capital letters, e.g., X, vectors by lowercase letters, e.g., x. The order of a tensor is the number of dimensions (also refereed to as ways or modes). In this work, we focus on 3-way tensors. Fibers and slices [51]. A fiber of tensor X is a one-dimensional array defined by fixing two of the indices. Specifically, X:jk is the (j,k)-th column fiber, Xi:k is the (i,k)-th row fiber, and Xij: is the (i,j)-th tube fiber. A slice of tensor X is a two-dimensional array defined by fixing one index only. Specifically, Xi:: is the i-th horizontal slice, X:j: is the j-th lateral slice, and X::k is the k-th frontal slice. For convenience, X::k is written as Xk. The vectorization of X is denoted by vec(X). For a 3-way tensor X ∈ Rn1×n2×n3, we denote its (i, j, k)-th entry as Xijk. (a) horizontal slices (b) lateral slices (c) frontal slices Fig. 1: Slices of an n1 × n2 × n3 tensor X. Norms. We denote the (cid:96)1 norm as (cid:107)X(cid:107)1 := (cid:80) maxijk xijk, and the Frobenius norm as (cid:107)X(cid:107)F := reduce to the vector or matrix norms if X is a vector or a matrix. ijk xijk, the infinity norm as (cid:107)X(cid:107)∞ := ijk xijk2. The above norms Operators. For X ∈ Rn1×n2×n3, and using the Matlab commands fft,ifft, we denote by X the result of applying the Discrete Fourier Transform (DFT) on X along the 3-rd dimension, i.e., X = fft(X, [], 3). Analogously, one can also compute X from X via the Inverse Discrete Fourier Transform (IDFT), using ifft( X, [], 3). In particular, we denote by X the block diagonal matrix with each blockcorresponding to the frontal slice X::k of X. i.e., (cid:113)(cid:80)  X::1 X::2 . . . X::n3  . X = bdiagk∈[n3]( X::k) := 2.1. Tensor basics. Next, we review relevant mathematical concepts including the tensor SVD (t-SVD), basic definitions and operations and other technical results of tensors [27, 44, 53], that are used throughout the paper. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 5 Definition 1. (Tensor product). Given two tensors Z ∈ Rn1×n2×n3 and X ∈ Rn2×n4×n5, the t-product Z ∗ X is the n1 × n4 × n3 tensor, (2) where and C = Z ∗ X = fold (circ (Z)) .unfold (X) ,  , Z::n3 Z::1 ... Z::n3−1 . . . Z::2 . . . Z::3 ... . . . . . . Z::1 circ (Z) :=  Z::1 Z::2 ... Z::n3  ,  X::1 X::2 ... X::n3 unfold (X) := fold (unfold (X)) = X. Because the circular convolution of two tube fibers can be computed by the DFT, the t-product can be alternatively computed in the Fourier domain, as shown in Algorithm 1. Algorithm 1 t-product C = Z ∗ X in the Fourier domain 1: Input: Z ∈ Rn1×n2×n3; X ∈ Rn2×n4×n3 2: Z ← fft(Z, [], 3); 3: X ← fft(X, [], 3); 4: for k = 1, . . . , n3 do X::k; 5: 6: end for 7: C ← ifft(C, [], 3); 8: return C C::k = Z::k Definition 2. (Conjugate transpose). The conjugate transpose of a tensor X ∈ Rn1×n2×n3 is tensor X∗ ∈ Rn2×n1×n3 obtained by conjugate transposing each of the frontal slices and then reversing the order of transposed frontal slices 2 through n3. Definition 3. (Identity tensor). The identity tensor I ∈ Rn×n×n3 is the tensor whose first frontal slice is the n × n identity matrix, and whose other frontal slices are all zeros. Definition 4. (Orthogonal tensor). A tensor Q ∈ Rn×n×n3 is orthogonal if it satisfies Q∗ ∗ Q = Q ∗ Q∗ = I. Definition 5. (F-diagonal Tensor). A tensor is called f−diagonal if each of its frontal slices is a diagonal matrix. Theorem 6. (t-SVD). Let X ∈ Rn1×n2×n3. Then, it can be factored as (3) where U ∈ Rn1×n2×n3, V ∈ Rn1×n2×n3 are orthogonal and Σ ∈ Rn1×n2×n3 is a f-diagonal tensor. X = U ∗ Σ ∗ VT , Note that t-SVD can be efficiently computed based on the matrix SVD in the Fourier domain. This is based on the key property that the block circulant matrix can be mapped to a block diagonal matrix in the Fourier domain, i.e. (4) where Fn3 denotes the n3 × n3 DFT matrix and ⊗ denotes the Kronecker product. n3 (Fn3 ⊗ In1) · circ (X) · (F −1 ⊗ In2 ) = X, 6 D. A. TARZANAGH AND G. MICHAILIDIS Definition 7. (Tensor multi and tubal rank). The tensor multi-rank of X ∈ Rn1×n2×n3 is a vector υ ∈ Rn3 with its i − th entry being the rank of the i-th frontal slice of X, ri = rank( Xi::). The tensor tubal rank, denoted by r = rankt(X), is defined as the number of nonzero singular tubes of Σ, where Σ is obtained from the t-SVD of X = U ∗ Σ ∗ VT . That is, (5) r = card{i : Σii: (cid:54)= 0} = max i ri, where card denotes the cardinality of a set. The tensor tubal rank shares some properties of the matrix rank, e.g. rankt(X ∗ Z) ≤ min(rankt(X), rankt(Z)). Many tensor completion and decomposition techniques for video and seismic noise reduction rely on a low-rank factorization of a time-frequency transform. Further, certain energy methods broadly used in image processing, e.g., PDEs [1] and belief propagation techniques mainly focus on local relationships. The basic assumption is that the missing entries depend primarily on their neighbors. Hence, the further apart two pixels are, the smaller their dependance is. However, for video and time series of images the value of the missing entry also depends on entries which are relatively far away in the time/sequence dimension. Thus, it is necessary to develop a tool to directly capture such global information in the data. Using (5), r0 is the rank of the "mean image" across the video sequence. Meanwhile, r1 is the rank of the next frequency's content across frames, etc. Under a smoothness assumption that captures global information at given pixels across time, the frontal slices (after FFT) for bigger i have smaller singular values. Definition 8. (Tensor nuclear norm). The tensor nuclear norm of a tensor X ∈ Rn1×n2×n3, denoted by (cid:107)X(cid:107)(cid:126), is defined as the average of the nuclear norm of all frontal slices of X, i.e. (6) (cid:107)X(cid:107)(cid:126) := 1 n3 (cid:107) X::k(cid:107)∗. n3(cid:88) k=1 The above tensor nuclear norm is defined in the Fourier domain. It is closely related to the nuclear norm of the block circulant matrix in the original domain. Indeed, 1 n3 (cid:107) X(cid:107)∗ (cid:107) X::k(cid:107)∗ = n3(cid:88) (cid:107)(Fn3 ⊗ In1 ) · circ (X) · (F −1 (cid:107)circ (X)(cid:107)∗. k=1 n3 (cid:107)X(cid:107)(cid:126) = = = 1 n3 1 n3 1 n3 ⊗ In2 )(cid:107)∗ The above relationship gives an equivalent definition of the tensor nuclear norm in the original domain. Thus, the tensor nuclear norm is the nuclear norm (with a factor 1/n3) of a new matricization (block circulant matrix) of a tensor. Definition 9. (Tensor spectral norm). The tensor spectral norm of X ∈ Rn×n×n3 , denoted as (cid:107)X(cid:107), is defined as (cid:107)X(cid:107) := (cid:107) X(cid:107)2 = (cid:107)(Fn3 ⊗ In1) · circ (X) · (F −1 ⊗ In2)(cid:107)2, n3 where (cid:107) · (cid:107)2 denotes the spectral norm of a matrix. Definition 10. (Inverse of tensor). The inverse of X ∈ Rn×n×n3, denoted by X−1 satisfies (7) where I is the identity tensor of size n × n × n3. X−1 ∗ X = X ∗ X−1 = I, FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 7 Definition 11. (Standard tensor basis). The lateral basis ei, is of size n1 × 1 × n3 with only one entry equal to 1 and the remaining equal to zero, in which the nonzero entry 1 will (cid:62) only appear at the first frontal slice of ei. Normally its transpose e is called the horizontal i basis. The other standard tensor basis is called tube basis ei, and corresponds to a tensor of size 1× 1× n3 with one entry equal to 1 and the rest equal to 0. Figure 2 illustrates these bases. Fig. 2: The lateral basis e3 and the tube basis e5. The black cubes are 1, gray and white cubes are 0. The white cubes stand for the potential entries that could be 1. 2.2. Linear algebra with tensors: free submodules. The set of complex numbers C with standard scalar addition and multiplication is a field and Cn3 forms a vector space over this field. However, as pointed out in [25, 27], the set of tubes C1×1×n3 equipped with the tensor product form a ring with unity. A module over a ring can be thought of as a generalization of a vector space over a field, where the corresponding scalars are the elements of the ring. In linear algebra over a ring, the analog of a subspace is a free submodule. Our algorithm relies on submodules, and the following theorem. Theorem 12. The set of slices (8) forms a free module over the set of tubes C1×1×n3. Υ := {X:j: X:j: ∈ Cn1×1×n3, j ∈ [n2]}, Proof. A detailed proof is provided in [4]. Using Theorem 12, Υ has a basis so that any element of it can be written as a "t-linear combination" of elements of a set of basis slices. A "t-linear combination", is defined as a sum of slices multiplied, based on the t-product, by coefficients from C1×1×n3. Definition 13. (Slice-wise linear independence) The slices in a subset Λ = {X:1:, . . . , X:n:} of Υ are said to be linearly dependent, if there exists a finite number of distinct slices X:1:, . . . , X:m: in Λ, and tubes C11:, . . . , Cmm:, not all zero, such that where O denotes the lateral slice comprising of all zeros. The slices in a subset Λ = {X:1:, . . . , X:n:} of Υ are said to be linearly independent if the can only be satisfied by all zero tubes Cjj:, j = 1, . . . , n. j=1 Based on the computable t-SVD, the tensor nuclear norm [44] is used to replace the tubal rank for low-rank tensor recovery (from incomplete/corrupted tensors) by solving the following (9) equation m(cid:88) j=1 n(cid:88) X:j: ∗ Cjj: = O, X:j: ∗ Cjj: = O, 8 D. A. TARZANAGH AND G. MICHAILIDIS convex program, (10) where (cid:107)L(cid:107)(cid:126) denotes the tensor nuclear norm and min s.t. L (cid:107)L(cid:107)(cid:126) (cid:107)PΩ(X − L)(cid:107) ≤ ∆, (PΩ(X)ij = Xij, if (i, j) ∈ Ω and (PΩ(X))ij = 0 otherwise. Similarly to the matrix completion problem, recovery of tensor X from its observed entries is essentially infeasible if the large majority of the entries are equal to zero [7]. For the tensor completion case, it is the case that if tensor X only has a few entries which are not equal to zero, in its t-SVD U ∗ S ∗ V(cid:62) = X, the singular tensors U and V will be highly concentrated. Indeed, not all tensors can be recovered from data sets with missing entries and/or large outliers. Hence, in analogy to the main idea in matrix completion [7], tensor slices U(:, i, :) and V(:, i, : ), i = 1, 2, ..., r, need to be sufficiently spread out, which in turn implies that they should be uncorrelated with the standard tensor basis. Our analysis in Section 4 will focus on noisy tensor completion based on a robust factorization algorithm whose estimation/recovery guarantees are expressed in terms of the coherence of the target low-rank tensor L. It establishes that lower values of tensor coherence provide better recovery results. In addition, we propose a randomized approximation algorithm, whose guarantees are also related to the notion of tensor coherence. The following three notions of tensor coherence are defined next. Definition 14. (Tensor µ0-coherence). Let V ∈ Rn×r×n3 contain orthonormal lateral basis with r ≤ n. Then, the µ0-coherence of V is given by: nn3 nn3 µ0(V) := max 1≤i≤n r (cid:107)V(cid:62) ∗ei(cid:107)2 F = (cid:107)Vi::(cid:107)2 F , max 1≤i≤n r where ei is standard lateral basis. Definition 15. (Tensor µ1-coherence). For a tensor L ∈ Rn1×n2×n3 assume that rankt(L) = r. Then, the µ1-coherence of L is defined as r where L has the skinny t-SVD L = U ∗ S ∗ V(cid:62) . µ1(L) := n1n2n2 3 (cid:107)U ∗ VT(cid:107)2∞, Definition 16. (Tensor (µ, r)-coherence). For any µ > 0, we call a tensor L (µ, r)- coherent if rankt(L) = r, max{µ0(U), µ0(V)} ≤ µ, µ1(L) ≤ µ. Note that the standard tensor coherence condition is much weaker than the matrix weak co- herence one for each frontal slice of X [53]. Hence, in the analysis of the proposed randomized algorithms, we will use the standard tensor coherence condition. 3. Approximate Tensor Low Rank Decompositions. We develop extensions of the matrix CX and CUR decompositions [13, 15] to third-order tensors. The proposed algorithms result in computing low-rank tensor approximations that are explicitly expressed in terms of a small number of slices of the input tensor. We start by introducing a basic computational tool -a randomized tensor multiplication procedure- that is used in subsequent developments. 3.1. Approximate tensor multiplication. Next, we present a randomized tensor-product and provide key results on the quality of the resulting approximation. Given two tensors A and B, using Definition 1, the t-product may be written as follows: (11) A ∗ B = A:t: ∗ Bt::, n2(cid:88) t=1 FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 9 where ∗ denotes the tensor product. It can be easily shown that the left hand side of (11) is equivalent to the block multiplication and then summation in the Fourier domain. When tensor multiplication is formulated as (11), we can develop a randomized algorithm to approximate the product A ∗ B. Algorithm 2 takes as input two tensors A ∈ Rn1×n2×n3 and B ∈ Rn2×n4×n3 , a positive integer c ≤ n2, and a probability distribution {pi}n2 i=1 over [n2]. It returns as output two tensors C and R, where the lateral slices of C correspond to a small number of sampled and rescaled slices of A, and similarly the horizontal slices of R constitute a small number of sampled and rescaled slices of B. Specifically, consider at most c lateral slices (in expectation) of A selected, with the i-th lateral slice of A in C be chosen with probability pi = min{1, cpi}. Then, define the sampling tensor S ∈ Rn2×n2×n3 to be binary where Sii1 = 1 if the i-th slice is selected and Sij2:n3 = 0 otherwise. Define the rescaling tensor D ∈ Rn2×c×n3 to be the tensor with cpj, if i − 1 of the previous slices have been selected and Dij2:n3 = 0 otherwise. Dij1 = 1/ Analogously, the rt-product samples and rescales the corresponding horizontal slices of tensor B. In both cases, C = A ∗ S ∗ D is an n1 × c × n3 tensor consisting of sampled and rescaled copies of the lateral slices of A, and R = (S ∗ D)(cid:62) ∗ B = D ∗ S(cid:62) ∗ B is a c × n4 × n3 tensor comprising of sampled and rescaled copies of the horizontal slices of B. For the case of n3 = 1, the algorithm selects column-row pairs in Algorithm 2 and is identical to the algorithm in [13]. √ Algorithm 2 (rt-product), a fast Monte-Carlo algorithm for approximate tensor multiplica- tion. 1: Input: A ∈ Rn1×n2×n3, B ∈ Rn2×n4×n3, pi ≥ 0, i ∈ [n2] s.t. (cid:80) i∈[n2] pi = 1, positive integer c ≤ n2. 2: Initialize S ∈ Rn2×n2×n3 and D ∈ Rn2×c×n3 to the all zeros tensors; 3: t = 1; 4: for i = 1, . . . , n2 do 5: 6: 7: 8: Pick i with probability min{1, cpi}; if i is picked then Sit1 = 1, Sit2:n3 = 0; Dtt1 = 1/ min{1, t = t + 1; cpi}, Dtt2:n3 = 0; √ 9: end if 10: 11: end for 12: C = A ∗ S ∗ D, R = D ∗ S(cid:62) ∗ B; 13: C ← fft(C, [], 3), 14: for k = 1, . . . , n3 do R::k; 15: 16: end for 17: Z ← ifft( Z, [], 3); 18: return Z Z::k = C::k R ← fft(R, [], 3); 3.2. Running time of rt-product. The rt-product is computationally efficient, has small memory requirements, and is well suited for large scale problems. Indeed, the rt-product algorithm can be implemented without storing tensors A ∈ Rn1×n2×n3 and B ∈ Rn2×n4×n3 and uses O(max(n1, n4)cn3 log(n3)) flops to transform the input to the Fourier domain and O(c(n1 + n2 + n4)n3) flops to construct C ∈ Rn1×c×n3 and R ∈ Rc×n4×n3 , where (12) A ∗ B ∼ C ∗ R. It is worth mentioning that we do not require storing the sampling and rescaling tensors S and D in our implementation. Next, we provide the main result on the quality of the approximation obtained by Algo- rithm 2 that specifies the assumptions under which (12) holds. The most interesting of these 10 D. A. TARZANAGH AND G. MICHAILIDIS assumptions is that the sampling probabilities used to randomly sample the lateral slices of A and the corresponding horizontal slices of B are non-uniform and depend on the product of the norms of the lateral slices of A and/or the corresponding horizontal slices of B. Following [13], we consider two examples of nonuniform sampling probabilities: i. If we would like to use information from both tensors A and B, we consider sampling probabilities {pi}n2 i=1 such that (13) pi ≥ β (cid:80)n2 (cid:107)A:i:(cid:107)F(cid:107)Bi::(cid:107)F i=1 (cid:107)A:i:(cid:107)F(cid:107)Bi::(cid:107)F , β ∈ (0, 1]. ii. If only information on A is easily available, then we use sampling probabilities {pi}n2 i=1 such that (14) pi ≥ β (cid:107)A:i:(cid:107)2 (cid:107)A(cid:107)2 F F , β ∈ (0, 1]. The following theorem gives the main result for Algorithm 2, and generalizes Theorem 6 in [15] to third order tensors . Theorem 17. Suppose A ∈ Rn1×n2×n3, B ∈ Rn2×n4×n5, and c ≤ n2. In Algorithm 2, if the sampling probabilities {pi}n2 i=1 satisfy (13) or (14), then the following holds (15) E[(cid:107)A ∗ B − C ∗ R(cid:107)F ] ≤ 1√ βc (cid:107)A(cid:107)F(cid:107)B(cid:107)F . The following lemma establishes a bound for tensor multiplication with respect to the spectral norm with improved sampling complexity. Lemma 18. Given a tensor A ∈ Rn1×n2×n3, choose c ≥ 48r log(4r/(βδ))/(β2). Let C ∈ be the corresponding subtensors of A. If sampling probabilities {pi}n2 Rn1×c×n3 and R = C(cid:62) satisfy (14), then with probability at least 1 − δ, we have i=1 (16) where kπ = k ∈ [n3] is the index of the tensor's frontal slice with the maximum spectral norm (cid:107) A::k (cid:62) ::k − C::k (cid:62) ::k(cid:107)2. A C ≤ /2(cid:107) A::kπ(cid:107)2 2, 3.3. Slice-based tensor CX decomposition. Next, using the concept of free submod- ules and Definition 13, we introduce the novel notion of slice selection and projection before formulating a tensor CX decomposition. Definition 19. Let C ∈ Rn1×c×n3 and X ∈ Rn1×n2×n3. Then, the tensor project (t- project) operator for X, ΠC(X), is an n1 × n2 × n3 tensor obtained as (17) where ∗ denotes the t-product, ΠC(X) is the projection of X onto the subspace spanned by the lateral slices of C, and C† is the Moore-Penrose generalized inverse of tensor C [26]. ΠC(X) := C ∗ C† ∗ X, Because the circulant convolution of two tube fibers can be computed by the DFT, the t-project can be alternatively computed in the Fourier domain, as shown in Algorithm 3. Definition 20. (t-CX). Given an n1 × n2 × n3 tensor X, let C be an n1 × c × n3 tensor whose lateral slices correspond to c lateral slices from tensor X. Then, the n1 × n2 × n3 tensor is called a t-CX decomposition of X. ΠC(X) = C ∗ C† ∗ X, (cid:107)A ∗ A(cid:62) − C ∗ C(cid:62)(cid:107) ≤ max k∈[n3] (cid:62) ::k − C::k (cid:62) ::k(cid:107)2 C A (cid:8)(cid:107) A::k (cid:9) FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 11 Algorithm 3 t-project ΠC(X) computation in the Fourier domain. 1: Input: X ∈ Rn1×n2×n3; C ∈ Rn1×c×n3. 2: X ← fft(X, [], 3); 3: C ← fft(C, [], 3); 4: for k = 1, . . . , n3 do † X::k; ::k Z::k = C::k C 5: 6: end for 7: Z ← ifft( Z, [], 3); 8: return ΠC(X) = Z The following remarks are of interest for the previous definition. • The choice for the number of lateral slices c in the t-CX approximation depends on the application under consideration; neverthelees, we are primarily interested in the case c (cid:28) n2. For example, c could be constant, independent of the dimension of tensor, or logarithmic in the size of n2, or a large constant factor less than n2. • The t-CX decomposition expresses each X slice in terms of a linear combination of basis slices (see, Definition 13), each of which corresponds to an actual lateral slice of X. Hence, t-CX provides a low-rank approximation to the original tensor X, even though its structural properties are different than those of the t-SVD. • Given a set of lateral slices C, the approximation ΠC(X) = C ∗ C† ∗ X is the "best" approximation to X in the following sense (cid:107)X − C ∗ (C† ∗ X)(cid:107)F = (18) min Y∈Rn1×c×n3 (cid:107)X − C ∗ Y(cid:107)F . Next, we provide the t-CX decomposition algorithm and provide its relative error. Al- gorithm 4 takes as input an n1 × n2 × n3 tensor A, a tubal rank parameter r, and an error parameter . It returns as output an n1 × c × n3 tensor C comprising of a small number of slices of A. Let L = U ∗ Σ ∗ V(cid:62) , be a tubal rank-r approximation of tensor A. Central to our proposed randomized algorithm is the concept of sampling slices of the tensor based on a leverage score [15], defined by pi ≥ β rn3 ∀ i ∈ [n2], β ∈ (0, 1]. (cid:107) Vi::(cid:107)2 F , (19) where V = fft(V, [], 3). The goal is to select a small number of lateral slices of A. Note that we define rescaling and sampled tensors D and S in the Fourier domain. This leads to a significant reduction in time complexity of the fast Fourier transform and its inverse. For the case n3 = 1, the algorithm selects column-row pairs in Algorithm 4 and is identical to the algorithm of [15]. Next, we present a lemma of general interest. The derived properties aid in obtaining tensor based randomized (cid:96)2 regression and low rank estimation guarantees. Lemma 21. Given a target tensor A ∈ Rn1×n2×n3 , let  ∈ (0, 1] and L = U ∗ Σ ∗ V(cid:62) be a rankt-r approximation of A. Let Γ = (V(cid:62)∗ S∗ D)†−(V(cid:62)∗ S∗ D)(cid:62). If the sampling probabilities {pi}n2 i=1 satisfy (19), and if c ≥ 48r log(4r/(βδ))/(β2), then with probability at least 1 − δ, the following hold (20a) (20b) (20c) (20d) rankt(V(cid:62) ∗ S) = rankt(V) = rankt(L), (cid:107)Γ(cid:107) = (cid:107)Σ−1 V(cid:62)∗S∗D − ΣV(cid:62)∗S∗D(cid:107), (L ∗ S ∗ D)† = (V(cid:62) ∗ S ∗ D)†Σ−1U(cid:62) , (cid:107)Σ−1 V(cid:62)∗S∗D − ΣV(cid:62)∗S∗D(cid:107)2 ≤  2 , √ 2 12 D. A. TARZANAGH AND G. MICHAILIDIS Algorithm 4 (t-CX), a fast Monte-Carlo algorithm for tensor low rank approximation. i∈[n2] pi = 1, a rank parameter r, positive 1: Input: A ∈ Rn1×n2×n3 , pi ≥ 0, i ∈ [n2] s.t. (cid:80) integer c ≤ n2. 2: A ← fft(A, [], 3); 3: Initialize S and D to the all zeros tensors; 4: t = 1; 5: for i = 1, . . . , n2 do 6: 7: 8: Pick i with probability min{1, cpi}; if i is picked then Sit1 = 1, Dtt1 = 1/ min{1, t = t + 1; Sit2:n3 = 0; cpi}, Dtt2:n3 = 0; √ 9: 10: end if 11: 12: end for 13: for k = 1, . . . , n3 do S::k 14: 15: end for 16: Z ← ifft( Z, [], 3); 17: return Z Z::k = A::k D::k( A::k S::k D::k)† A::k; where ΣV(cid:62)∗S∗D is an F-diagonal tensor and contains the r non-zero singular tubes of V(cid:62)∗S∗D. Note that the equation (20d) shows that in terms of its singular tubes, the tensor V(cid:62)∗S∗D -i.e., the slice sampled and rescaled version of V- is almost an orthogonal tensor. A useful property of an orthogonal tensor V is that V† (see, Definition 4). Equation (20b) shows that although this property does not hold for V(cid:62) ∗ S ∗ D, the difference between (V(cid:62) ∗ S ∗ D)† and (V(cid:62) ∗ S ∗ D)(cid:62) can be bounded. = V(cid:62) Using Theorem 17 and Lemma 21, we provide in proposition 22 a sampling complexity for a tensor based randomized "(cid:96)2-regression" as in [15]. Indeed, Lemmas 2 and 3 of [15] follow by using the Frobenius norm bound of Theorem 17 and applying Markov's inequality. The claim of Lemma 1 of [15] follows by applying Lemma 21. If we consider the failing probability δ = 0.05, the claims of all three lemmas hold simultaneously with probability at least 0.85 and in the following proposition we condition on this event. The proof follows along similar lines to the proof of Theorem 5 in [15]. Proposition 22. Given a target tensor A ∈ Rn1×n2×n3 , let L = U∗Σ∗V(cid:62) be a rankt-r ap- proximation of A. Choose c = O(r log(r/β)/(β2)) slices of A with their sampling probabilities {pi}n2 i=1 satisfying (19). Then, with probability at least 0.85, the following holds (cid:107)A − A ∗ S ∗ D ∗ (L ∗ S ∗ D)† ∗ L(cid:107)F ≤ (1 + )(cid:107)A − A ∗ L† ∗ L(cid:107)F. (21) Let L = U ∗ Σ ∗ V(cid:62) be a t-SVD of tensor L ∈ Rn1×n2×n3. In the remainder of the paper, we use the following two parameters related to the coherence of tensor L,  := rµ0(V) n3 , (22) where Uc is the left singular tensor of C ∈ Rn1×c×n3 lateral slices of L. c := n3 cµ0(Uc) , The following theorem shows that projection based on slice sampling leads to near optimal estimation in tensor regression, when the covariate tensor has small coherence, µ0(V). Theorem 23. Given A ∈ Rn1×n2×n3, let L = U∗ Σ∗ V(cid:62) be a rankt-r approximation of A. Choose c = O( log()/2), and let Ac ∈ Rn1×c×n2 be a tensor of c lateral slices of A sampled FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 13 uniformly without replacement. Further, let Lc ∈ Rn1×c×n3 consist of the corresponding slices of L. Then, with probability at least 0.85, the following holds (cid:107)A − Ac ∗ L† c ∗ L(cid:107)F ≤ (1 + )(cid:107)A − A ∗ L† ∗ L(cid:107)F . Next, by using Lemma 21, we provide a low rank estimation bound for the t-CX algorithm, under the coherence assumption. Indeed, we will take advantage of a constant β in equation (19) to provide relative error estimation guarantees for the t-CX algorithm under uniform slice sampling, when tensor A under consideration exhibits sufficient incoherence. Corollary 24. Given a target tensor A ∈ Rn1×n2×n3 , let L = U ∗ Σ ∗ V(cid:62) be a rankt −r approximation of A. Choose c = O( log() log(1/δ)/2), and let C be a tensor of c lateral slices of A sampled uniformly without replacement. Then, the following holds (23) with probability at least 1 − δ. (cid:107)A − C ∗ C† ∗ A(cid:107)F ≤ (1 + )(cid:107)A − L(cid:107)F , 3.4. Slice-based tensor CUR decomposition. Similar to the matrix case, the t-CX decomposition suffices when n1 (cid:28) n2 because C† ∗ A is small in size. However, when n1 and n2 are almost equal, computing and storing the dense matrix C† ∗ A in memory becomes prohibitive. The CUR decomposition provides a very useful alternative. Next, we introduce a tensor CUR (t-CUR) decomposition based on the rt-product. Definition 25. (t-CUR). Let X be an n1×n2×n3 tensor. For any given C, an n1×c×n3 tensor whose slices comprise of c lateral slices of tensor X, and R, an l × n2 × n3 tensor whose slices comprise of l horizontal slices of tensor X, the n1 × n2 × n3 tensor C ∗ U ∗ R, is a lateral-horizontal-based tensor approximation to X for any c × l × n3 tensor U. The following remarks are of interest regarding the previous definition. • The t-CUR decomposition is most appropriate as a data analysis tool, when the data consist of one- and/or two modes that are qualitatively different than the remaining ones. In this case, the t-CUR decomposition approximately expresses the original data tensor in terms of a basis consisting of underlying subtensors that are actual data slices and not artificial bases. • The t-CUR approximation is a t-CX approximation, but one with a very special struc- ture; i.e., every lateral slice of X can be expressed in terms of the basis provided by C (see, Definition 13) using only the information contained in a small number of horizontal slices of X and a low-dimensional encoding tensor. • In terms of its t-SVD structure, U contains the "inverse-of-X" information. For the proposed t-CUR decomposition, U will be a generalized inverse of the intersection between selected tensors C and R. Note that the structural simplicity of the t-CUR tensor decomposition becomes apparent in the Fourier domain, as detailed in Algorithm 5. The latter takes as input an n1 × n2 × n3 tensor A, an n1 × c × n3 tensor C consisting of a small number of lateral slices of A, and an error parameter . Letting C = U ∗ Σ ∗ V , Algorithm 5 uses sampling probabilities (cid:62) (24) pi ≥ β cn3 (cid:62) (cid:107) U i::(cid:107), ∀i ∈ [n1], β ∈ (0, 1], to select a small number of horizontal slices of A. It returns an l×n2×n3 tensor R comprising of a small number of horizontal slices of A and an c×l×n3 tensor U consisting of the corresponding slices of C. 14 D. A. TARZANAGH AND G. MICHAILIDIS Algorithm 5 (t-CUR), a fast Monte-Carlo algorithm for tensor low rank approximation. 1: Input: A ∈ Rn1×n2×n3, C ∈ Rn1×c×n3 consisting of c lateral slices of A, pi ≥ 0, i ∈ [n2] i∈[n2] pi = 1, a rank parameter r, and positive integer l ≤ n1. s.t. (cid:80) 2: A ← fft(A, [], 3); 3: C ← fft(C, [], 3); 4: Initialize S and D to the all zeros tensors; 5: t = 1; 6: for i = 1, . . . , n1 do 7: 8: Pick i with probability min{1, lpi}; if i is picked then Sit1 = 1, Dtt1 = 1/ min{1, t = t + 1; Sit2:n3 = 0; lpi}, Dtt2:n3 = 0; √ 9: 10: 11: 15: 16: R::k = D::k end if 12: 13: end for 14: for k = 1, . . . , n3 do U::k =(cid:0) D::k (cid:62) A::k; S ::k (cid:62) S C::k ::k U::k R::k; 17: 18: end for 19: Z ← ifft( Z, [], 3); 20: return Z Z::k = C::k (cid:1)† ; Corollary 26. Given A ∈ Rn1×n2×n3 , let L = U ∗ Σ ∗ V(cid:62) be a rankt −r approxi- In Algorithm 5, choose c = O( log() log(1/δ)/2), and let C ∈ Rn1×c×n3 mation of A. be a tensor of c slices of A sampled uniformly without replacement. Further, choose l = O(c log(c) log(1/δ)/2), and let R ∈ Rl×n2×n3 be a tensor of l horizontal slices of A sampled uniformly without replacement. Then, the following holds (cid:107)A − C ∗ U ∗ R(cid:107)F ≤ (1 + )(cid:107)A − L(cid:107)F , with probability at least 1 − δ. Remark 27. In many applications such as tensor completion problems discussed in Section 5.3, it may not feasible to compute the t-SVD of the entire tensor A due to either computational cost or large set of missing values. In these cases, algorithms requiring knowledge of the leverage scores can not be applied. Hence, we may use an estimate where a subset of the lateral slices are chosen uniformly and without replacement, and the horizontal leverage scores (24) are calculated using the top-r right singular slices of this lateral tensor instead of the entire A tensor. Remark 28. Note that for any subspace, the smallest µ0 can be is 1. In such case, we are using the optimal subspace sampling with β = 1. Note also that we have provided Corol- laries (24) and (26) based on uniform sampling. However, it can be easily seen that the rel- ative error guarantees hold with nonuniform sampling probabilities (19) and (24), if we set c = O(r log(r/β) log(1/δ)/(β2)), and l = O(c log(c/β) log(1/δ)/(β2)). 4. Tensor completion and robust factorization. Next, we provide a CUR tensor nuclear norm minimization (CUR t-NN) procedure that solves a noisy tensor factorization problem, using a small number of lateral and/or horizontal slices of the underlying tensor and exhibits favorable computational complexity and in addition comes with performance guaran- tees. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 15 4.1. Related work on matrix problems. Low rank plus sparse matrix decomposition. In many image processing and computer vision applications, the given data matrix X can be decomposed as a sum of a low-rank and a sparse component. To that end, Cand´es et al. proposed Robust PCA [6] to model data matrices generated according to the following mechanism: (25) rank(L) + (cid:107)E(cid:107)0 min L s.t. X = L + E. Note that the solution of (25) is an NP-hard problem. It is established in [7] that if L exhibits a certain degree of low-rankness, while E is sparse enough, then the formulation of (25) can be relaxed into a convex problem of the form: (cid:107)L(cid:107)∗ + (cid:107)E(cid:107)1 X = L + E. (26) min s.t. L This model implicitly assumes that the underlying data structure lies in a single low-rank subspace. However, in many applications (e.g. image classification) it is more likely that the data are obtained from a union of multiple subspaces, and hence recovery of the structure based on the above decomposition would be inaccurate. In order to segment the data into their respective subspaces, one needs to compute an affinity matrix that encodes the pairwise affinities between data vectors. Liu [32] proposed a more general rank minimization problem, where the data matrix itself is used as the dictionary, resulting in the following convex optimization problem: (27) (cid:107)L(cid:107)∗ + (cid:107)E(cid:107)2,1 min L s.t. X = XL + E, diag(L) = 0. When the subspaces are globally independent, the data are noiseless and sampling is suf- [32] show that the optimal solution, denoted by L∗, to the problem given ficient, Liu et al. by 27 corresponds to the widely used Shape Iteration Matrix (SIM) method [9]. The latter is a "block-diagonal" affinity matrix that indicates the true segmentation of the data. To handle data corrupted by noise, the popular Low Rank Representation (LRR) introduced in [32] adopts a regularized formulation that introduces an extra penalty term to fit the noise component. Further, after obtaining the self-representation matrix L, the affinity matrix C is usually constructed as C = 1 the obtained affinity matrix C will be processed through a spectral clustering algorithm [40] to produce the final clustering result and obtain the corresponding data generating subspaces. 2 (L + L(cid:62)), where · represents the absolute operator. Then, It is established in [52, 47] that combining sparse and low-rank regularization can improve the performance of image classification. The basic objective function of this combination [52] is as follows: λ1(cid:107)L(cid:107)∗ + λ2(cid:107)L(cid:107)1 + λ3(cid:107)E(cid:107)(cid:96) L s.t. min (28) where λ1, λ2, λ3 are tuning parameters and (cid:107)E(cid:107)(cid:96) indicates different norms suitable for different types for corrupting the data by noise; for example, the squared Frobenius norm for Gaussian noise and the (cid:96)1 norm for random spiked noise. Equation (28) is similar to the objective functions in [47, 16], where a detailed explanation of the formulation given in (28) is also provided. X = DL + E, diag(Z) = 0, 4.1.1. Low rank tensor decomposition. Lu et al. [35] extended Robust PCA [6] to the third order tensor based on t-SVD and proposed the following convex optimization problem: (29) (cid:107)L(cid:107)(cid:126) + λ(cid:107)E(cid:107)1 min L,E s.t. X = L + E, where λ is a tuning parameter. This model implicitly assumes that the underlying data come from a single low-rank sub- space. When the data is drawn from a union of multiple subspaces, which is common in image 16 D. A. TARZANAGH AND G. MICHAILIDIS classification, the recovery based on the above formulation may lack in accuracy. To that end, Xie et al. [49] extended LRR based subspace clustering to a multi-view one, by employing the rank sum of different mode unfoldings to constrain the subspace coefficient tensor, resulting in the following convex optimization problem: (cid:107)L(cid:107)(cid:126) + λ(cid:107)E(cid:107)2,1 X = X ∗ L + E, (30) min L s.t. Equation (30) is similar to the objective functions in [25, 42] and a detail explanation of (30) is provided in that paper. 4.2. Proposed algorithm. Next, we propose an algorithm for large scale tensor decom- position of noisy data. Our proposal, called CUR t-NN, extends Algorithm 5 to the noisy tensor factorization. The main steps are outlined in Algorithm 6. Note that CUR t-NN can be used in combination with an arbitrary optimization algorithm. In this paper, we have chosen to solve the noisy tensor factorization formulations (10), (29) and (30) using an Alternating Direction Method of Multiplier (ADMM) algorithm [3]. ADMM is the most widely used approach for robust tensor PCA in both the fully and partially observed settings. Indeed, ADMM achieves much higher accuracy than (accelerated) proximal gradient algorithm using fewer iterations. It works well across a wide range of problem settings and does not require careful tuning of the regularization parameters. Further, the following empirical finding has been frequently observed: namely, the rank of the iterates often remains bounded by the rank of the initializer, thus enabling efficient computations [6]. This feature is not shared by the block coordinate decent algorithm. We provide a variant of ADMM for solving problem (29) in the Appendix (see, Algorithm 7). With a small modification, Algorithm 7 can be also used to solve the tensor completion problem 10, and tensor subspace clustering problem (30). In the following algorithm, ADMM(X, λ) denotes the ADMM algorithm for solving regularized tensor nuclear norm minimization problems (10), (29) and (30), where X is the (sampled) data tensor and λ is a regularization parameter. Algorithm 6 CUR t-NN, tensor nuclear norm minimization based on CUR factorization. 1: X ∈ Rn1×n2×n3, positive integer c and l, and a regularization parameter λ; 2: Let C be a tensor of c selected lateral slices of X using probabilities (19); 3: C ← ADMM(C, λ); 4: Let R be a tensor of l selected horizontal slices of X using probabilities (24); 5: R ← ADMM(R, λ); † 6: Let U = W 7: L = C ∗ U ∗ R; 8: return L , where W is the l × c × n3 tensor formed by sampling the corresponding l horizontal slices of C; 4.3. Running Time of CUR t-NN. Algorithm 6 significantly reduces the per-iteration complexity of nuclear norm minimization problems. Indeed, in each iteration, a base tensor nuclear norm minimization algorithm requires O(n1n2n3 log(n3)) flops to transform the tensor to the Fourier domain, O(n1n2n3 min(n1, n2)) flops for the t-SVD computation and factor- ization, and O(n1n2n3 log(n3)) flops to transform it back to the original domain. On the other hand, Algorithm 6 only requires O(max(cn1, ln2)n3 log(n3)), O(max(n1c, ln2)n3r) and O(max(cn1, ln2)n3 log(n3)) flops, for the respective steps. Further, Algorithm 6 can be imple- mented without storing the data tensor X and can be advantageous when r (cid:28) min(n1, n2), which occurs frequently in real data sets. 4.4. Theoretical guarantees. Next, using Lemma 21, we establish that Algorithm 6 exhibits high probability recovery guarantees comparable to those of the exact algorithms that use the full data tensor. Our first result bounds the µ0 and µ1-coherence (see, Definitions (14) and (15)) of a randomized tensor in terms of the coherence of the full tensor. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 17 Lemma 29. Let Lc be a tensor formed by selecting c slices of a rankt −r tensor L = U ∗ Σ ∗ V that satisfy the probabilistic conditions in (19). If c ≥ 48r log(4r/(βδ))/(β2), then with probability at least 1 − δ: • µ0(ULc) = µ0(U), • µ0(VLc ) ≤ 1 − /2 • µ1(Lc) ≤ r 1 − /2 where  ∈ (0, 1]. 1 µ0(V), µ0(U)µ0(V), Our next theorem provides a bound for the estimation error of the CUR t-NN Algorithm. Theorem 30. Under the notion of Algorithm 6, choose c = O( log() log(1/δ)/2), and be the corresponding lateral and horizontal sub- is (µ, r)-coherent, then with probability at least 1 − δ, and R∗ l = O(c log(c) log(1/δ)/2). Let C∗ tensors of the exact solution L∗ C∗ . If L∗ 1−/2 , r)-coherent, and and R∗ are ( rµ2 (cid:113) (cid:107)L∗ − L(cid:107)F ≤ (2 + ) (cid:107)C∗ − C(cid:107)2 F + (cid:107)R∗ − R(cid:107)2 F , where L is a solution obtained by Algorithm 6. 5. Experimental Results. Next, we investigate the efficiency of the proposed random- ized algorithms on both synthetic and real data sets. The results are organized in the following three sub-sections: in Section 5.1, we compare the performance of the rt-product to that of the t-product using synthetic data. In Section 5.2, we use the proposed t-CX and t-CUR algorithms for finding important ions and positions in two Mass Spectrometry Imaging (MSI) data sets. Finally, in Section 5.3, we apply the proposed tensor factorization CUR t-NN algorithm on data sets related to image and video processing. All algorithms have been implemented in the MATLAB R2018a environment and run on a Mac machine equipped with a 1.8 GHz Intel Core i5 processor and 8 GB 1600 MHz DDR3 of memory. 5.1. Experimental results for fast tensor multipication. A random data tensor X ∈ Rn1×n2×n3 of dimension n1 = 105, n2 = 103 and n3 = 5 is generated as follows: the first frontal slice of X is set to X(:, :, 1) = sprandn(n1, n2, 1); i.e. comprising of n1 × n2 sparse normally distributed random matrix. The remaining frontal slices are generated by sprandn(X(:, :, 1)), which results in the same sparsity structure as X(:, :, 1), with normally distributed random entries with mean 0 and variance 1. We perform a t-SVD decomposition on X and select the left singular value tensor U for our experiments. We consider both uniform and nonuniform sampling schemes. For nonuniform sampling, we use a randomized approach (similar to Algorithm 4 in [14]) to obtain normal- ized leverage scores of U. Further, the Frobenius and spectral bounds given in (15) and (16), respectively, are used as performance metrics for Algorithm 2. Table (2) shows the Rela- tive Frobenius Error (RFE) -(cid:107)U(cid:62) F - and Relative Spectral Error (RSE) - (cid:107)U(cid:62) r ∗S∗D∗D∗S(cid:62)∗Ur based on l ≈ r log(r) slices, and its deterministic counterpart. The depicted results are averaged over 10 independent replications. (cid:62) 2- for the rt-product algorithm to recover U r Ur(cid:107)F /(cid:107)Ur(cid:107)2 Ur(cid:107)2/(cid:107)Ur(cid:107)2 (cid:62) Ur − U r (cid:62) Ur− U r Ur = U(cid:62) r r Very large improvements in computational speed can be seen when using the rt-product, especially when coupled with a non-uniform sampling scheme. Further, the gains become more pronounced for larger number of slices sampled and larger rank. 5.2. Finding Important Ions and Positions in MSI. MSI is used to visualize the spatial distribution of chemical compounds, such as metabolites, peptides or proteins by their molecular masses. The ability of MSI to localize panels of biomolecules in tissue samples has led to a rapid and substantial impact in both clinical and pharmacological research, aided in 18 D. A. TARZANAGH AND G. MICHAILIDIS t-product rt-product Rank, selected slices r=100, l=460 r=200, l=1000 r=300, l=1700 r=400, l=2500 r=500, l=3100 time (s) 9.09 36.36 162.99 321.43 684.01 non-uniform sampling time(s) RFE RSE 43e-4 25e-4 29e-4 13e-3 12e-4 70e-3 64e-3 56e-3 31e-3 71e-3 8.13 14.27 34.89 41.04 67.07 uniform sampling time(s) RFE RSE 11e-2 82e-2 34e-2 38e-3 43e-3 39e-2 12e-2 41e-2 90e-2 23e-2 1.03 1.08 1.39 1.64 3.09 Table 1: Relative errors and running times of tensor multipication algorithms. uncovering biomolecular changes associated with disease and finally provided low cost imaging of drugs. Typical techniques used require finding important ions and positions from a 3D image: ions to be used in fragmentation studies to identify key compounds, and positions for follow up validation measurements using microdissection or other orthogonal techniques. Unfortunately, with modern imaging machines, these must be selected from an overwhelming amount of raw data. Existing popular techniques used to reduce the volume of data, include principal components analysis and non-negative matrix factorization, but return difficult-to- interpret linear combinations of actual data elements. A recent paper [50] shows that CX and CUR matrix decompositions can be used directly to address this selection need. One major shortcoming of CX and/or CUR matrix decompositions is that they can only handle 2-way (matrix) data. However, MSI data form a multi-dimensional array. Hence, in order to use CX/CUR matrix decompositions, one has first to reformulate the multi-way array as a matrix. Such preprocessing usually leads to information loss, which in turn could cause significant performance degradation. By using instead the t-CX and t-CUR decompositions (Algorithms 4 and 5, respectively) one can obtain good low-rank approximations of the available data, expressed as combinations of actual ions and positions, as opposed to difficult-to-interpret eigen-ions and eigen-positions produced by matrix factorization techniques. We show that this leads to effective prioritization of information for both actual ions and actual positions. In particular, important ions can be discovered by using leverage scores as the importance sampling distribution. Further, selection of important positions from the original tensor can be accomplished based on the random sampling algorithm in [50], since the distribution of the leverage scores of positions is uniform. To this end, we consider the following two ways of computing leverage scores of a given data set: • Deterministic: Compute the normalized tensor leverage scores exactly using probabil- • Randomized: Compute an approximation to the normalized leverage scores of tensor (mapped to a block diagonal matrix in the Fourier domain) by using Algorithm 4 of [14]. ities (19) and (24). 5.2.1. Description and Analysis of MSI data sets. Next, we use the following two data sets for illustration purposes, that are publicly available at the OpenMSI Web gateway2. They represent two diverse acquisition modalities, including one mass spectrometry image of the left coronal hemisphere of a mouse brain (see, Figure 3) acquired using a time-of-flight (TOF) mass analyzer and one MSI data set of a lung acquired using an Orbitrap mass analyzer. These data sets form a 122×120×80339 and a 122×120×500000 tensor, respectively. As described in [50], the brain data set is processed using peak-finding to identify the most intense ions. Using this technique, the original brain data is reduced from 122× 120× 80339 values to a data set of size 122× 120× 2000. To compute the CX decomposition, we reshape the MSI data cube into a 2https://openmsi.nersc.gov/openmsi/client/ FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 19 Fig. 3: Sample ions in the brain data set. two-dimensional (14640× 2000) matrix, where each row corresponds to the spectrum of a pixel in the image, and each column to the intensity of an ion across all pixels, thus describing the distribution of the ion in physical space. No peak-finding was applied to the lung data set. Fig. 4: Distribution of leverage scores of tensor X, relative to the best rank−5 space for the brain data set. Left: Horizontal scores; Right: Lateral scores; Bottom: Frontal scores. For the brain data set, we evaluate the quality of the approximation of the leverage scores based on a rank r = 5 approximation. The distribution of the deterministic leverage scores for the ions and pixels is shown in Figure 4. Table (2) shows the relative square error (RSE) (cid:107)X − X(cid:107)F /(cid:107)X(cid:107)F using t-CX decomposition to recover rank −5 tensor X for selection of c = 25, 35, 45 and, 55 ions, using both randomized and deterministic leverage scores. Table (3) provides the reconstruction errors to the best rank−5 approximation, based on the t-CX decomposition coupled with horizontal slice selection. The results obtained running both ran- 20 D. A. TARZANAGH AND G. MICHAILIDIS Number of selected slices Randomized RSE 25 35 45 55 19.13e-2 17.24e-2 16.35e-2 15.14e-2 CX t-CX Deterministic time RSE 8.46 8.95 14.99 15.86 18.84e-2 17.59e-2 16.93e-2 16.52e-2 time 4.56 5.12 7.01 8.16 Randomized RSE 13.65e-2 17.43e-2 11.32e-2 16.26e-2 Deterministic time RSE 4.47 5.99 7.01 8.99 16.05e-2 13.13e-2 11.01e-2 10.16e-2 time 4.13 4.87 6.14 6.63 Table 2: RSE of matrix and tensor low rank decomposition relative to the best rank−5 space for identifying important ions in the brain data set. Number of selected slices Randomized RSE 25 35 45 55 45.24e-2 35.87e-2 24.13e-2 23.16e-2 CX t-CX Deterministic time RSE 7.41 7.63 11.89 12.93 46.03e-2 35.68e-2 24.19e-2 24.39e-2 time 3.15 3.81 5.29 5.83 Randomized RSE 37.65e-2 28.00e-2 23.98e-2 15.23e-2 Deterministic time RSE 4.06 4.55 5.59 5.71 16.05e-2 13.13e-2 21.01e-2 15.17e-2 time 3.01 3.19 4.15 4.23 Table 3: RSE of matrix and tensor low rank decomposition relative to the best rank−5 space for finding important pixels in the brain data set. domized and deterministic CX and t-CX algorithms are based on 10 independent replicates and then averaging them. Note that for pixel selection, the deterministic CX decomposition results in larger reconstruction errors than its randomized CX counterpart. The reason for this behavior lies in the distribution of the leverage scores for the pixels, which are fairly uniform (see, Figure 4). Number of selected slices Decomposition using ions Decomposition using ions and pixels CX t-CX CUR t-CUR 25 35 45 55 RSE 40.82e-2 41.98e-2 30.16e-2 30.74e-2 time 3.31 4.13 5.78 6.67 RSE 46.89e-2 29.63e-2 22.35e-2 20.81e-2 time 3.05 3.24 3.36 4.05 RSE 59.76e-2 42.57e-2 12.18e-2 19.00e-2 time 2.89 3.16 4.25 5.47 RSE 24.67e-2 22.71e-2 18.15e-2 18.15e-2 time 2.14 2.67 3.13 3.26 Table 4: RSE of matrix and tensor low rank decomposition relative to the best rank−15 space for finding important ions and pixels in the lung data set. For the lung data set, reconstruction errors to the best rank r = 15 approximation based on randomized t-CX and t-CUR decompositions are given in Table (4) based on averages over 10 independent replicates. It can be seen that the t-CX and t-CUR match or outperform their matrix variants in terms of accuracy, while improving on computing time. These results introduce the concept of t-CX/ t-CUR tensor factorizations to MSI, describ- ing their utility and illustrating principled algorithmic approaches to deal with the overwhelm- ing amount of data generated by this technology and their ability to select important and intepretable ions/pixels. 5.3. Robust PCA in the fully and partially observed settings. Many images exhibit an inherent low rank structure and are suitably denoised by low-rank modeling methods, such as robust PCA [6]. In this section, we assess the performance of the CUR t-NN on two popular FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 21 data sets, and for the typical use cases they represent. We compare the performance of the proposed CUR t-NN algorithm to the following techniques: • EXACT NN, the exact matrix completion [7]; • RPCA NN, the robust matrix completion [6]; • E-TUCKER NN, the TUCKER based tensor completion [33]; • R-TUCKER NN, the robust TUCKER based tensor completion [20]; • EXACT t-NN, the t-SVD based tensor completion [53]; • RPCA t-NN, the robust t-SVD based tensor completion [35]; All algorithms are terminated either when the relative square error (RSE), RSE := (cid:107)L∗ − L(cid:107)F (cid:107)L∗(cid:107)F ≤ 10−3, or the number of iterations and CPU times exceed 1,000 and 20 minutes, respectively. 5.3.1. CUR t-NN on the Extended Yale B data set. We apply the CUR t-NN on the Extended Yale B data set to evaluate the accuracy of the proposed low-rank representations, as well as its computation time. The database consists of 2432 images of 38 individuals, each under 64 different lighting conditions [17]. We used 30 images from each subject and kept them at full resolution. Each image comprises of 192 × 168 pixels on a grayscale range. The data are organized into a 192× 1140× 168 tensor that exhibits low tubal rank, which is an expected feature due to the spatial correlation within lateral slices [18]. Laplacian (salt and pepper 3) noise was introduced separately in all frontal slices of the observation tensor for 20% of the entries. Robust Completion Approach RPCA NN [6] R-TUCKER NN [20] RPCA t-NN [35] CUR t-NN RSE 0.0056 0.0034 0.0021 0.0026 Time(s) 417 513 495 136 Table 5: RSE of tensor robust completion methods on Extended Yale B dataset. We provide visualizations of the reconstructed first image from the first subject at the 20% noise level in Figure 5. We compare the performance of the CUR t-NN, RPCA t-NN, R-TUCKER NN and RPCA NN for solving the robust tensor low rank approximation prob- lem (29). Table 5 shows the accuracy of the CUR t-NN together with that of competing algorithms for the Extended Yale B data set. As shown in Figure 5 and Table 5, CUR t-NN estimates nearly the same face model as the RPCA t-NN requiring only a small fraction of time. On the other hand, all algorithms exhibit small RSE, but the CUR t-NN proves essentially as competitive as the best method RPCA t-NN, but achieves almost the same performance at approximately 1/4 of the time. Beyond just speed-ups and/or accuracy improvements of the CUR t- NN algorithm, its output can be directly used in place of the singular slices and tubes that standard methods provide. The latter represent linear combinations of the slices of the tensor, which for an image data set capture an "average eigenface". On the other hand, CUR t-NN reconstructs the tensor through selection of real faces in the data set, thus giving the opportunity to researchers to inspect them and examine their representativeness. Hence, similar to the original CUR decomposition of matrices, CUR t-NN enhances the interpretability of the tensor decomposition [18, 48, 41]. 3This noise can be caused by sharp and sudden disturbances in the image signal. It demonstrates itself as sparsely occurring white and black pixels. 22 D. A. TARZANAGH AND G. MICHAILIDIS (a) (b) Fig. 5: The 1st frame of the noisy tensor factorization result for the Extended Yale B data set. (a) Left: The original frame. (a)Right: Noisy image (20% pixels corrupted). (b) Left: RPCA t-NN [35]. (b) Right: CUR t-NN. 5.3.2. CUR t-NN on a video data set. Next, we compare the CUR t-NN to the aforementioned listed competing methods for video data representation and compression from randomly missing entries. The video data, henceforth referred to as the Basketball video (source: YouTube) is mapped to a 144 × 256 × 80 tensor, obtained from with a nonstationary panning camera moving from left to right horizontally following the running players. We randomly sampled 50% entries from the Basketball video. We compare the performance of the CUR t- NN, EXACT t-NN, E-TUCKER NN and EXACT NN for solving the tensor completion problem (10). The result is shown in Table 6. It can be seen that the CUR t-NN outperforms almost all its competitors in terms of CPU running time and accuracy and essentially matches that of EXACT t-NN. Completion Approach EXACT NN [7] E-TUCKER NN [33] EXACT t-NN [53] CUR t-NN RSE 0.1001 0.0900 0.0715 0.0850 Time(s) 687 718 695 205 Table 6: RSE of tensor completion results for the Basketball video. 6. Conclusion. This paper introduced two randomized algorithms for basic tensor oper- ations -rt-product and rt-project- and then used in tensor CX and CUR decomposition algo- rithms, whose aim is to select informative slices. The randomized tensor operations together with the tensor decompositions algorithms comes with relative error recovery guarantees. These algorithms can be effectively used in the analysis of large scale tensors with small tubal rank. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 23 (a) (b) Fig. 6: The 20th frame of the tensor completion result for the Basketball video. (a) Left: The original video. (a) Right: Sampled video (50% sampling rate). (b) Left: EXACT t-NN based reconstruction [53]. (b) Right: CUR t-NN based reconstruction. In addition, we proposed the CUR t-NN algorithm that exploits the advantages of ran- domization for dimensionality reduction and can be used effectively for large scale noisy tensor decompositions. Indeed, CUR t-NN uses an adaptive technique to sample slices of the tensor based on a leverage score for them and subsequently solves a convex optimization problem fol- lowed by a projection step to recover a low rank approximation to the underlying tensor. The proposed algorithm has linear running time, and provably maintains the recovery guarantees of the exact algorithm with full data tensor. Acknowledgments. The authors would like to thank the Associate Editor and three anonymous referees for many constructive comments and suggestions that improved significantly the structure and readability of the paper. REFERENCES [1] M. Bertalmio, G. Sapiro, V. Caselles, and C. Ballester, Image inpainting, in Proceedings of the 27th annual conference on Computer graphics and interactive techniques, ACM Press/Addison-Wesley Publishing Co., 2000, pp. 417 -- 424. [2] T. Bouwmans, A. Sobral, S. Javed, S. K. Jung, and E.-H. Zahzah, Decomposition into low-rank plus additive matrices for background/foreground separation: A review for a comparative evaluation with a large-scale dataset, arXiv preprint arXiv:1511.01245, (2015). [3] S. Boyd, N. Parikh, E. Chu, B. Peleato, J. Eckstein, et al., Distributed optimization and statistical learning via the alternating direction method of multipliers, Foundations and Trends R(cid:13) in Machine learning, 3 (2011), pp. 1 -- 122. [4] K. Braman, Third-order tensors as linear operators on a space of matrices, Linear Algebra and its Ap- plications, 433 (2010), pp. 1241 -- 1253. [5] C. F. Caiafa and A. Cichocki, Generalizing the column -- row matrix decomposition to multi-way arrays, Linear Algebra and its Applications, 433 (2010), pp. 557 -- 573. [6] E. J. Cand`es, X. Li, Y. Ma, and J. Wright, Robust principal component analysis?, Journal of the ACM (JACM), 58 (2011), p. 11. [7] E. J. Cand`es and B. Recht, Exact matrix completion via convex optimization, Foundations of Compu- tational mathematics, 9 (2009), pp. 717 -- 772. [8] J. D. Carroll and J.-J. Chang, Analysis of individual differences in multidimensional scaling via an n-way generalization of eckart-young decomposition, Psychometrika, 35 (1970), pp. 283 -- 319. 24 D. A. TARZANAGH AND G. MICHAILIDIS [9] J. P. Costeira and T. Kanade, A multibody factorization method for independently moving objects, International Journal of Computer Vision, 29 (1998), pp. 159 -- 179. [10] L. De Lathauwer, B. De Moor, and J. Vandewalle, A multilinear singular value decomposition, SIAM journal on Matrix Analysis and Applications, 21 (2000), pp. 1253 -- 1278. [11] L. De Lathauwer, B. De Moor, and J. Vandewalle, On the best rank-1 and rank-(r 1, r 2,..., rn) approximation of higher-order tensors, SIAM journal on Matrix Analysis and Applications, 21 (2000), pp. 1324 -- 1342. [12] A. Deshpande, L. Rademacher, S. Vempala, and G. Wang, Matrix approximation and projective clus- tering via volume sampling, in Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, Society for Industrial and Applied Mathematics, 2006, pp. 1117 -- 1126. [13] P. Drineas, R. Kannan, and M. W. Mahoney, Fast monte carlo algorithms for matrices i: Approxi- mating matrix multiplication, SIAM Journal on Computing, 36 (2006), pp. 132 -- 157. [14] P. Drineas, M. Magdon-Ismail, M. W. Mahoney, and D. P. Woodruff, Fast approximation of matrix coherence and statistical leverage, Journal of Machine Learning Research, 13 (2012), pp. 3475 -- 3506. [15] P. Drineas, M. W. Mahoney, and S. Muthukrishnan, Relative-error cur matrix decompositions, SIAM Journal on Matrix Analysis and Applications, 30 (2008), pp. 844 -- 881. [16] P. Foggia, G. Percannella, and M. Vento, Graph matching and learning in pattern recognition in the last 10 years, International Journal of Pattern Recognition and Artificial Intelligence, 28 (2014), p. 1450001. [17] A. S. Georghiades, P. N. Belhumeur, and D. J. Kriegman, From few to many: Illumination cone models for face recognition under variable lighting and pose, IEEE transactions on pattern analysis and machine intelligence, 23 (2001), pp. 643 -- 660. [18] N. Hao, M. E. Kilmer, K. Braman, and R. C. Hoover, Facial recognition using tensor-tensor decom- positions, SIAM Journal on Imaging Sciences, 6 (2013), pp. 437 -- 463. [19] D. Hsu, S. Kakade, T. Zhang, et al., Tail inequalities for sums of random matrices that depend on the intrinsic dimension, Electronic Communications in Probability, 17 (2012). [20] B. Huang, C. Mu, D. Goldfarb, and J. Wright, Provable low-rank tensor recovery, Optimization- Online, 4252 (2014). [21] B. Jiang, F. Yang, and S. Zhang, Tensor and its tucker core: the invariance relationships, Numerical Linear Algebra with Applications, 24 (2017), p. e2086. [22] I. Jolliffe, Principal component analysis, Wiley Online Library, 2002. [23] D. Kalman, A singularly valuable decomposition: the svd of a matrix, The college mathematics journal, 27 (1996), pp. 2 -- 23. [24] E. Karahan, P. A. Rojas-Lopez, M. L. Bringas-Vega, P. A. Valdes-Hernandez, and P. A. Valdes- Sosa, Tensor analysis and fusion of multimodal brain images, Proceedings of the IEEE, 103 (2015), pp. 1531 -- 1559. [25] E. Kernfeld, S. Aeron, and M. Kilmer, Clustering multi-way data: a novel algebraic approach, arXiv preprint arXiv:1412.7056, (2014). [26] M. E. Kilmer, K. Braman, N. Hao, and R. C. Hoover, Third-order tensors as operators on matrices: A theoretical and computational framework with applications in imaging, SIAM Journal on Matrix Analysis and Applications, 34 (2013), pp. 148 -- 172. [27] M. E. Kilmer and C. D. Martin, Factorization strategies for third-order tensors, Linear Algebra and its Applications, 435 (2011), pp. 641 -- 658. [28] T. G. Kolda and B. W. Bader, Tensor decompositions and applications, SIAM review, 51 (2009), pp. 455 -- 500. [29] T. G. Kolda, B. W. Bader, and J. P. Kenny, Higher-order web link analysis using multilinear algebra, in Data Mining, Fifth IEEE International Conference on, IEEE, 2005, pp. 8 -- pp. [30] P. M. Kroonenberg, Three-mode principal component analysis: Theory and applications, vol. 2, DSWO press, 1983. [31] F. G. Kuruvilla, P. J. Park, and S. L. Schreiber, Vector algebra in the analysis of genome-wide expression data, Genome biology, 3 (2002), pp. research0011 -- 1. [32] G. Liu, Z. Lin, S. Yan, J. Sun, Y. Yu, and Y. Ma, Robust recovery of subspace structures by low-rank representation, IEEE Transactions on Pattern Analysis and Machine Intelligence, 35 (2013), pp. 171 -- 184. [33] J. Liu, P. Musialski, P. Wonka, and J. Ye, Tensor completion for estimating missing values in visual data, IEEE Transactions on Pattern Analysis and Machine Intelligence, 35 (2013), pp. 208 -- 220. [34] R. Liu, Z. Lin, S. Wei, and Z. Su, Solving principal component pursuit in linear time via l 1 filtering, arXiv preprint arXiv:1108.5359, (2011). [35] C. Lu, J. Feng, Y. Chen, W. Liu, Z. Lin, and S. Yan, Tensor robust principal component analysis: Exact recovery of corrupted low-rank tensors via convex optimization, (2016), pp. 5249 -- 5257. [36] L. W. Mackey, M. I. Jordan, and A. Talwalkar, Divide-and-conquer matrix factorization, in Advances in Neural Information Processing Systems, 2011, pp. 1134 -- 1142. [37] M. W. Mahoney, M. Maggioni, and P. Drineas, Tensor-cur decompositions for tensor-based data, SIAM Journal on Matrix Analysis and Applications, 30 (2008), pp. 957 -- 987. [38] M. Mohri and A. Talwalkar, Can matrix coherence be efficiently and accurately estimated?, in Pro- ceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, 2011, pp. 534 -- 542. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 25 [39] Y. Mu, J. Dong, X. Yuan, and S. Yan, Accelerated low-rank visual recovery by random projection, in Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, IEEE, 2011, pp. 2609 -- 2616. [40] A. Y. Ng, M. I. Jordan, and Y. Weiss, On spectral clustering: Analysis and an algorithm, (2002), pp. 849 -- 856. [41] F. Nie, H. Huang, X. Cai, and C. H. Ding, Efficient and robust feature selection via joint 2, 1-norms minimization, in Advances in neural information processing systems, 2010, pp. 1813 -- 1821. [42] X. Piao, Y. Hu, J. Gao, Y. Sun, and Z. Lin, A submodule clustering method for multi-way data by sparse and low-rank representation, arXiv preprint arXiv:1601.00149, (2016). [43] M. Rahmani and G. K. Atia, Randomized robust subspace recovery and outlier detection for high dimen- sional data matrices, IEEE Transactions on Signal Processing, 65, pp. 1580 -- 1594. [44] O. Semerci, N. Hao, M. E. Kilmer, and E. L. Miller, Tensor-based formulation and nuclear norm regularization for multienergy computed tomography, IEEE Transactions on Image Processing, 23 (2014), pp. 1678 -- 1693. [45] A. Smilde, R. Bro, and P. Geladi, Multi-way analysis: applications in the chemical sciences, John Wiley & Sons, 2005. [46] D. A. Tarzanagh and G. Michailidis, Estimation of graphical models through structured norm mini- mization, Journal of Machine Learning Research, 18 (2018), pp. 1 -- 48. [47] Y.-X. Wang, H. Xu, and C. Leng, Provable subspace clustering: When lrr meets ssc, in Advances in Neural Information Processing Systems, 2013, pp. 64 -- 72. [48] J. Wright, A. Y. Yang, A. Ganesh, S. S. Sastry, and Y. Ma, Robust face recognition via sparse representation, IEEE transactions on pattern analysis and machine intelligence, 31 (2009), pp. 210 -- 227. [49] Y. Xie, D. Tao, W. Zhang, and L. Zhang, Multi-view subspace clustering via relaxed l 1-norm of tensor multi-rank, arXiv preprint arXiv:1610.07126, (2016). [50] J. Yang, O. Rubel, M. W. Mahoney, and B. P. Bowen, Identifying important ions and positions in mass spectrometry imaging data using cur matrix decompositions, Analytical chemistry, 87 (2015), pp. 4658 -- 4666. [51] J. Zhang, A. K. Saibaba, M. Kilmer, and S. Aeron, Divide-and-conquer matrix factorization, in arXiv preprint arXiv:1609.07086, 2016, pp. 1 -- 26. [52] Y. Zhang, Z. Jiang, and L. S. Davis, Learning structured low-rank representations for image classifi- cation, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2013, pp. 676 -- 683. [53] Z. Zhang and S. Aeron, Exact tensor completion using t-svd, IEEE Transactions on Signal Processing, 65, pp. 1511 -- 1526. [54] Z. Zhang, G. Ely, S. Aeron, N. Hao, and M. Kilmer, Novel methods for multilinear data completion and de-noising based on tensor-svd, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2014, pp. 3842 -- 3849. [55] T. Zhou and D. Tao, Godec: Randomized low-rank & sparse matrix decomposition in noisy case, in International conference on machine learning, Omnipress, 2011. 6.1. Proof of Theorem 17. Let Fn3 denote the Discrete Fourier Matrix. Then, Defini- tion 1 implies that (Fn3 ⊗ I)circ(A)(F −1 n3 ⊗ I)(Fn3 ⊗ I)unfold(A(cid:62) ) = (cid:62) ::1 A A::1   , A::2 A (cid:62) ::2 . . . A::n3 A::n3 (31) = bdiagk∈[n3]( A::k A (cid:62) ::k). 26 D. A. TARZANAGH AND G. MICHAILIDIS Using (31) and the unitary invariance of the Frobenius norm, we have (cid:107)A ∗ B − C ∗ R(cid:107)2 n3 n3 F = (cid:107)(Fn3 ⊗ I)circ(A)(F −1 − (Fn3 ⊗ I)circ(C)(F −1 (cid:107) bdiagk∈n3( A::k n3(cid:88) = n3(cid:88) B::k − C::k 1 n3 1 n3 (cid:107) A::k k=1 = (cid:107) A::k B::k − A::k = 1 n3 k=1 ⊗ I)(Fn3 ⊗ I)unfold(B) ⊗ I)(Fn3 ⊗ I)unfold(R)(cid:107)2 F B::k − C::k R::k)(cid:107)2 F , R::k(cid:107)2 F S::k D::k D::k S (cid:62) ::k B::k(cid:107)2 F . (32) lateral and horizontal slices are scaled by score 1/(cid:112)min{1, cpj}. Note that if min{1, cpj} = 1, In Algorithm 2, we define Ij, j ∈ [n2] as an indicator variable, which is set to 1 if both thej-th lateral slice of A and the j-th horizontal slice of B are selected. In this case, the selected then Ij = 1 with probability 1, and 1 − Ij/ min{1, cpj} = 0. Then, taking expectation on both sides of (32) and considering the set Υ = {j ∈ [n2] : cpj < 1} ⊆ [n2], we get E(cid:2)(cid:107)A ∗ B − C ∗ R(cid:107)2 (cid:3) = F  2 2 i1i2 A:jk Bj:k Bji2k Ai1jk   1 − Ij cpj A:jk Bj:k(cid:107)2 F j∈Υ (cid:19) (cid:88) (cid:18) (cid:88) (cid:18) (cid:88) (cid:88) (cid:88) j1∈Υ j∈Υ j2∈Υ (cid:19) (cid:19) 1 − Ij cpj 1 − Ij cpj pi1i2j1j2 E [pi1i2j1j2] , j1∈Υ j2∈Υ Ai1j2k Bj2i2k. E(1 − Ij/cpj)2 A 2 i1jk 2 B ji2k B 2 ji2k A i2=1 i2=1 j∈Υ j∈Υ 2 i1jk n2(cid:88) 1 cpj 2(cid:107) Bj:k(cid:107)2 (cid:107) A:jk(cid:107)2 1 c pj j∈Υ 2(cid:107)Bj:1(cid:107)2 (cid:107)A:j1(cid:107)2 pj F(cid:107)Bj::(cid:107)2 (cid:107)A:j:(cid:107)2 pj F 2 2 . + ··· + (cid:88) j∈Υ 1 c 2(cid:107)Bj:n3(cid:107)2 (cid:107)A:jn3(cid:107)2 pj 2 = = = = 1 n3 1 n3 1 n3 1 n3 1 n3 E E E E k=1 k=1 k=1 k=1 i2=1 i1=1 i1=1 i1=1 i2=1 i2=1 j∈Υ (cid:107)(cid:88) (cid:18) n3(cid:88)  n1(cid:88) n2(cid:88) n3(cid:88)  n1(cid:88) n2(cid:88) n3(cid:88)  n1(cid:88) n2(cid:88) n3(cid:88) n1(cid:88) n2(cid:88) (cid:88) n3(cid:88) (cid:17) Ai1j1k n2(cid:88) n1(cid:88) n3(cid:88) (cid:88) n3(cid:88) (cid:88) n3(cid:88) (cid:88) (cid:88) (cid:88) n1(cid:88) Bj1i2k i1=1 i1=1 i2=1 i1=1 k=1 k=1 k=1 k=1 j∈Υ j∈Υ 1 n3 1 n3 1 c 1 c ≤ 1 n3 (33) where pi1i2j1j2 = (cid:16) (cid:17)(cid:16) (cid:3) = E(cid:2)(cid:107)A ∗ B − C ∗ R(cid:107)2 1 − Ij1 cpj1 F 1 − Ij2 cpj2 = = = (34) Since for j ∈ [Υ], E[1 − Ij/cpj] = 0 and E[(1 − Ij/cpj)2] = (1/cpj) − 1 ≤ 1/cpj, we get FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 27 Equation (15) follows from (34) by using Jensen's inequality and the fact that the sampling probabilities (13) and (14) are defined in the original domain. 6.2. Proof of Lemma 18. Using Definitions 1 and 9, we have that (cid:107)A ∗ A(cid:62) − C ∗ C(cid:107) = (cid:107)(Fn3 ⊗ I)circ(A)(F −1 − (Fn3 ⊗ I)circ(C)(F −1 n3 (cid:62) ::k − C::k = (cid:107) bdiagk∈n3( A::k A C (cid:62) (cid:62) ::k(cid:107)2 ::k − C::k A = max k∈[n3] (cid:8)(cid:107) A::k C n3 (cid:62) ::k)(cid:107)2, (cid:9), ⊗ I)(Fn3 ⊗ I)unfold(A(cid:62) ) ⊗ I)(Fn3 ⊗ I)unfold(C(cid:62) )(cid:107)2, (35) where the first equality follows from the unitary invariance of the spectral norm, the second equality from (31) and the third equality follows since the spectral norm of a block matrix is equal to the maximum of block norms. Let kπ = k ∈ [n3] be the index of the tensor's frontal slice with maximum spectral norm A (cid:62) ::k(cid:107)2. Using (35), and Example 4.3 in [19], we obtain (cid:62) ::k − C::k (cid:107) A::k C (36) with probability at least 1 − δ. (cid:107) A::kπ A (cid:62) ::kπ − C::kπ C (cid:62) ::kπ (cid:107)2 ≤  2 (cid:107) A::,kπ(cid:107)2 2, 6.3. Proof of Lemma 21. Let σi,k be the i-th largest singular value of slice k. For all 1 ≤ i ≤ r and 1 ≤ k ≤ n3, we have 1 − max k∈[n3] i,k(V(cid:62) ∗ S ∗ D) = max σ2 k∈[n3] σi,k(V(cid:62) ∗ V) − max k∈[n3] σi,k(V(cid:62) ∗ S ∗ D ∗ D ∗ S(cid:62) ∗ V) ≤ (cid:107)V ∗ V(cid:62) − V(cid:62) ∗ S ∗ D ∗ D ∗ S(cid:62) ∗ V(cid:107)2. Using Lemma 18 and (37), we get 1 − max k∈[n3] i,k(V(cid:62) ∗ S ∗ D) ≤ /2(cid:107) V::kπ(cid:107)2 σ2 2 for all 1 ≤ i ≤ r and an index kπ ∈ [n3]. Since  ∈ (0, 1], each tubal singular value of V(cid:62)∗S is positive, which implies that rankt(V(cid:62) ∗ S) = To prove (20b), we use the t-SVD of V(cid:62) ∗ S ∗ D and note that rankt(V) = rankt(L). (cid:107)Ω(cid:107) = (cid:107)(cid:16) = (cid:107)(cid:16) = (cid:107)(cid:0)Σ−1 = (cid:107)VV(cid:62)∗S∗D V(cid:62) ∗ S ∗ D UV(cid:62)∗S∗DΣV(cid:62)∗S∗DV(cid:62) V(cid:62) ∗ S ∗ D (cid:17)† −(cid:16) (cid:0)Σ−1 V(cid:62)∗S∗D − ΣV(cid:62)∗S∗D (cid:17)(cid:62)(cid:107) (cid:17)† −(cid:16) (cid:1) U(cid:62) UV(cid:62)∗S∗DΣV(cid:62)∗S∗DV(cid:62) V(cid:62)∗S∗D(cid:107) V(cid:62)∗S∗D V(cid:62)∗S∗D − ΣV(cid:62)∗S∗D (cid:1)(cid:107). (cid:17)(cid:62)(cid:107) V(cid:62)∗S∗D (37) (38) (39) The claim follows since VV(cid:62)∗S∗D and UV(cid:62)∗S∗D are orthogonal tensors. To prove (20c), note that † (L ∗ S ∗ D) (40) = (cid:17)† (cid:16) (cid:16) U ∗ Σ ∗ V(cid:62) ∗ S ∗ D U ∗ Σ ∗ UV(cid:62)∗S∗D ∗ ΣV(cid:62)∗S∗D ∗ V(cid:62) = = VV(cid:62)∗S∗D ∗ (Σ ∗ UV(cid:62)∗S∗D ∗ ΣV(cid:62)∗S∗D) (cid:17)† V(cid:62)∗S∗D † ∗ U(cid:62) . 28 D. A. TARZANAGH AND G. MICHAILIDIS To remove the pseudoinverse in the above derivations, we use the first part of the Lemma. In this case, (41) (Σ ∗ UV(cid:62)∗S∗D ∗ ΣV(cid:62)∗S∗D) † = (Σ ∗ UV(cid:62)∗S∗D ∗ ΣV(cid:62)∗S∗D) = Σ−1 V(cid:62)∗S∗DΣ−1. V(cid:62)∗S∗D ∗ U(cid:62) −1 By combining (40) and (41), we get the result. To prove (20d), we have that for all 1 ≤ i ≤ r and 1 ≤ k ≤ n3, (cid:107)Ω(cid:107) = (cid:107)Σ−1 V(cid:62)∗S∗D − ΣV(cid:62)∗S∗D(cid:107) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 1 σi,k(V(cid:62) ∗ S ∗ D) = max i,k (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)σi,k(V(cid:62) ∗ S ∗ D) − /2(cid:112)1 − /2 σ2 i,k(V(cid:62) ∗ S ∗ D) − 1 σi,k(V(cid:62) ∗ S ∗ D) = max i,k ≤ √ ≤ / 2 from (39) by definition by simple manipulation if  < 1 =>(cid:112)1 − /2 > 1/ from (37) √ 2. 6.4. Proof of Theorem 23. From Definition 14, and using (19) with β = n3/µ0(V) ∈ (0, 1], we have that for all i ∈ [n2]. (cid:107) Vi::(cid:107)2 F = β rn3 β r (cid:107)Vi::(cid:107)2 F ≤ β r r n2n3 µ0(V) = 1 n2 = pi, Using Proposition 22, our choice of c implies that (42) (cid:107)A − Ac ∗ L† c ∗ L(cid:107)F = (cid:107)A − A ∗ C ∗ D ∗ (Lc ∗ D)† ∗ L(cid:107)F , ≤ (1 + )(cid:107)A − A ∗ L† ∗ L(cid:107)F . holds with probability at least 0.85. X ∈ Rn1×c×n3, it follows that 6.5. Proof of Corollary 24. Since C+ ∗ A minimizes (cid:107)A − C ∗ X(cid:107)F over all tensors (cid:107)A − C ∗ C† ∗ A(cid:107)F ≤ (cid:107)A − C ∗ L† C ∗ L(cid:107)F . Now, using (42), we get (43) (cid:107)A − C ∗ C† ∗ A(cid:107)F ≤ (1 + )(cid:107)A − L(cid:107)F , with probability at least 0.85. We can trivially boost the success probability to 1−δ by repeating Algorithm 4 O(log(1/δ)) rounds. Specifically, let Ci denote the output of Algorithm 4 at round i; using (43) for each Ci we have (44) (cid:107)A − Ci ∗ C† i ∗ A(cid:107)F ≤ (1 + )(cid:107)A − L(cid:107)F , with probability at least 0.85. Now, let C denote the set of all columns used in the approximation. Since each Ci = C∗ Si for some tensor Si and C+∗ A minimizes (cid:107)A− C∗ X(cid:107)F over all tensors X ∈ Rn1×c×n3, it follows that for each i. Hence, if (cid:107)A − C ∗ C† ∗ A(cid:107)F ≤ (cid:107)A − Ci ∗ C† i ∗ A(cid:107)F , (cid:107)A − C ∗ C† ∗ A(cid:107)F ≤ (1 + )(cid:107)A − L(cid:107)F , fails to hold, then for each i, (44) also fails to hold. Since 0.15 < 1/e, the desired conclusion must hold with probability at least 1 − (1/e)log(1/δ) = 1 − δ. FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 29 6.6. Proof of Corollary 26. Using (42), it follows that (45) (cid:107)A − C ∗ U ∗ R(cid:107)F ≤ (1 + )(cid:107)A − C ∗ C† ∗ A(cid:107)F , with probability at least 0.85. Using (43) and (45), our choice of c and l implies the following holds with probabilities at least 0.7, (cid:107)A − C ∗ U ∗ R(cid:107)F ≤ (1 + )2A − L(cid:107)F ≤ (1 + (cid:48))A − L(cid:107)F , (46) where (cid:48) = 3. The inequality (46) holds with probability at least 1 − δ by following the boosting strategy employed in the proof of Corollary 24. Indeed, since in each trial inequality (46) fails with probability less than 0.3 < 1/e, the claim of Corollary 26 will hold with probability greater than 1 − (1/e)log(1/δ) = 1 − δ. 6.7. Proof of Lemma 29. Since from Lemma 21 we have rankt(Lc) = rankt(L), the first claim follows similarly by using Lemma 1 of [38]. To prove the second claim, using Lemma 21, assume that S(cid:62) ∗ V consists of the first c horizontal slices of V. Then, if Lc = U ∗ Σ ∗ V(cid:62) ∗ S has rankt(Lc) = rankt(L) = r, the tensor V(cid:62) ∗ S must have full tubal rank. Thus, we can write c ∗ Lc = (U ∗ Σ ∗ V(cid:62) ∗ S)+ ∗ U ∗ Σ ∗ V(cid:62) ∗ S L+ = (Σ ∗ V(cid:62) ∗ S)+ ∗ U(cid:62) ∗ U ∗ Σ ∗ V(cid:62) ∗ S = (Σ ∗ V(cid:62) ∗ S)+ ∗ Σ ∗ V(cid:62) ∗ S = (V(cid:62) ∗ S)+ ∗ Σ(cid:62) ∗ Σ ∗ V(cid:62) ∗ S = (V(cid:62) ∗ S)+ ∗ V(cid:62) ∗ S = V(cid:62) ∗ S ∗ (V(cid:62) ∗ S ∗ S(cid:62) ∗ V)−1V(cid:62) ∗ S, where the second and third equalities follow from U(cid:62) ∗ U = Ic. The fourth and fifth equalities result from Σ having full tubal rank and V having full lateral slice rank, and the sixth follows from S(cid:62) ∗ V having full horizontal slice rank. Next, denote the right singular vectors of Lc by Vc ∈ Rc×r×n3. Define ei,c as the i-th lateral slice of Ic and ei,n2 as the i-th lateral slice of I. Then we have, µ0(Vc) = = = = = cn3 r cn3 r cn3 r cn3 r cn3 r max 1≤i≤c max 1≤i≤c max 1≤i≤c max 1≤i≤c max 1≤i≤c F c ∗ei,c(cid:107)2 c ∗ Lc ∗ei,c} (cid:107)V(cid:62) (cid:62) trace{e i,c ∗ L+ (cid:62) i,c ∗ (V(cid:62) ∗ S)+ ∗ V(cid:62) ∗ S ∗ei,c} trace{e (cid:62) trace{e i,c ∗ S(cid:62) ∗ V ∗ W−1 ∗ V(cid:62) ∗ S ∗ei,c} (cid:62) trace{e i,n2 ∗ V ∗ W−1 ∗ V(cid:62) ∗ei,n2}, where W = V(cid:62) ∗ S ∗ S(cid:62) ∗ V and the final equality follows from V(cid:62) ∗ S ∗ei,c = V(cid:62) ∗ei,n2 for all 1 ≤ i ≤ c. Next, we have µ0(VLC) = cn3 r cn3 = r ≤ cn3 r max 1≤i≤c (cid:62) trace{e i,n2 (cid:62) trace{W−1 ∗ V(cid:62) ∗ei,n2 ∗e i,n2 ∗ V ∗ W−1 ∗ V(cid:62) ∗ei,n2} ∗ V} ∗ V(cid:107)2(cid:126), (cid:62) (cid:107)V(cid:62) ∗ei,n2 ∗e i,n2 max 1≤i≤c (cid:107)W−1(cid:107)2 max 1≤i≤c 30 D. A. TARZANAGH AND G. MICHAILIDIS where the last inequality follows form Holder's inequality. (cid:62) Since V(cid:62) ∗ei,n2 ∗e i,n2 ∗ V has tubal rank one, using the definition of µ0-coherence, we have µ0(VLC ) ≤ c n2 Now, using (38), we have that (cid:107)W−1(cid:107)2 ≤ n2 (cid:107)W−1(cid:107)2µ0(V). c(1−/2) . Thus, it follows that µ0(VLC) ≤ µ0(V)/(1 − /2). To prove the last claim under Lemma 21, we note that µ1(Lc) = n1cn2 3 r max 1≤i≤n1 1≤j≤c max 1≤i≤n1 (cid:62) (cid:107)e i,n1 ∗ Uc ∗ V(cid:62) c ∗ej,c(cid:107)2 F (cid:107)U(cid:62) c ∗ei,n1(cid:107)2 F max 1≤j≤c (cid:107)V(cid:62) c ∗ej,c(cid:107)2 F 3 ≤ n1cn2 ≤ r r (1 − /2) µ0(U)µ0(V). 6.8. Proof of Theorem 30. Define A(X) as the event that a tensor X is ( rµ2 1−/2 , r)- coherent. To prove Theorem 30, let L denote the solution obtained by CUR t-NN and let L∗ be the exact solution of problems (10), (29) and (30). In Algorithm 6, define ¯L as (cid:21) (cid:20)C1 (cid:3), and L∗ R2 C2 L∗ 22 , ¯L = (cid:3)(cid:62) , and R =(cid:2) R1 C2 R2 . It can easily be seen that where C =(cid:2)C1 subtensor of L∗ (47) (cid:107)L∗ − ¯L(cid:107)2 F ≤ (cid:107)C∗ − C(cid:107)2 F + (cid:107)R∗ − R(cid:107)2 F , 22 ∈ R(n1−l)×(n2−c)×n3 is the bottom right Now, define W ( L, ¯L) as the event (48) (cid:107) L − ¯L(cid:107)F ≤ (1 + )(cid:107)L∗ − ¯L(cid:107)F . If W ( L, ¯L) holds, we have (cid:107)L∗ − L(cid:107)F ≤ (cid:107)L∗ − ¯L(cid:107)F + (cid:107) ¯L − L(cid:107)F ≤ (cid:107)L∗ − ¯L(cid:107)F + (1 + )(cid:107)L∗ − ¯L(cid:107)F ≤ (2 + )(cid:107)L∗ − ¯L(cid:107)F (cid:107)C∗ − C(cid:107)2 ≤ (2 + ) F + (cid:107)R∗ − R(cid:107)2 (cid:113) F by the triangle inequality from (48) from (47). Next, we consider all three events W ( L, ¯L), A(R∗ ) with log(3/δ). Using Lemma 29, our choice of c and l implies that A(C∗ ) holds with probability at least 1 − δ/3. Since L is a t-CUR approximation to ¯L, from Corollary 26, we get that W ( L, ¯L) holds with probability at least 1 − δ/3. ), and A(C∗ ) and A(R∗ Using the union bound, it follows that (cid:92) (cid:92) Pr(W ( L, ¯L) A(C∗ ) A(R∗ )) ≥ 1 − Pr(W ( L, ¯L)c) − Pr(A(C∗ ≥ 1 − δ/3 − δ/3 − δ/3 = 1 − δ. )c) − Pr(A(R∗ )c) FAST RANDOMIZED ALGORITHMS FOR TENSOR OPERATIONS 31 Algorithm 7 , L ← ADMM(X, λ) Initialize: L0 = E0 = Y0 = 0, ρ = 1.1, µ0 = 1e − 3, µmax = 1e + 10,  = 1e − 8. while not converged do • Lk+1 ← argminL (cid:107)L(cid:107)∗ + µk • Ek+1 ← argminE λ(cid:107)E(cid:107)1 + µk • Yk+1 = Yk + µk(Lk+1 + Ek+1 − X); • Update µk+1 by µk+1 = min(ρµk, µmax); • Check (cid:107)Lk+1 − Lk(cid:107)∞ ≤ , (cid:107)Ek+1 − Ek(cid:107)∞ ≤ ,(cid:107)Lk+1 + Ek+1 − X(cid:107)∞ ≤ ; (cid:107)2 2 (cid:107)L + Ek − X + Yk F ; (cid:107)2 2 (cid:107)Lk+1 + E − X + Yk F ; µk µk end while 6.9. Optimization by ADMM. We provide the optimization and parameter setting details of ADMM used in Algorithm 7 for solving a robust tensor factorization. As discussed in [54], the updates of Lk+1 and Ek+1 have closed form solutions. It is easy to see that the main per-iteration cost of Algorithm 7 is in the update of Lk+1, which requires computing the fft of L and the SVD of block matrix L = fft(L) in the Fourier domain. The next result establishes the global convergence of the ADMM for solving problem (29) (for details on the convergence analysis, see [46]). Note that similar results hold for solving problems (10), and (30). Theorem 31. The sequence (Lk, Ek, Yk) generated by Algorithm 7 from any starting point converges to a stationary point of problem (29).
1507.01768
2
1507
2015-10-13T12:49:34
The Restricted Isometry Property of Subsampled Fourier Matrices
[ "cs.DS", "cs.IT", "cs.IT", "math.PR" ]
A matrix $A \in \mathbb{C}^{q \times N}$ satisfies the restricted isometry property of order $k$ with constant $\varepsilon$ if it preserves the $\ell_2$ norm of all $k$-sparse vectors up to a factor of $1\pm \varepsilon$. We prove that a matrix $A$ obtained by randomly sampling $q = O(k \cdot \log^2 k \cdot \log N)$ rows from an $N \times N$ Fourier matrix satisfies the restricted isometry property of order $k$ with a fixed $\varepsilon$ with high probability. This improves on Rudelson and Vershynin (Comm. Pure Appl. Math., 2008), its subsequent improvements, and Bourgain (GAFA Seminar Notes, 2014).
cs.DS
cs
The Restricted Isometry Property of Subsampled Fourier Matrices Ishay Haviv∗ Oded Regev† Abstract A matrix A ∈ Cq×N satisfies the restricted isometry property of order k with constant ε if it preserves the ℓ2 norm of all k-sparse vectors up to a factor of 1 ± ε. We prove that a matrix A obtained by randomly sampling q = O(k · log2 k · log N) rows from an N × N Fourier ma- trix satisfies the restricted isometry property of order k with a fixed ε with high probability. This improves on Rudelson and Vershynin (Comm. Pure Appl. Math., 2008), its subsequent improvements, and Bourgain (GAFA Seminar Notes, 2014). 1 Introduction A matrix A ∈ Cq×N satisfies the restricted isometry property of order k with constant ε > 0 if for every k-sparse vector x ∈ CN (i.e., a vector with at most k nonzero entries), it holds that (1 − ε) · kxk2 2 ≤ kAxk2 2 ≤ (1 + ε) · kxk2 2 . (1) Intuitively, this means that every k columns of A are nearly orthogonal. This notion, due to Cand`es and Tao [11], was intensively studied during the last decade and found various applications and connections to several areas of theoretical computer science, including sparse recovery [8, 20, 27], coding theory [14], norm embeddings [6, 23], and computational complexity [4, 31, 25]. The original motivation for the restricted isometry property comes from the area of com- pressed sensing. There, one wishes to compress a high-dimensional sparse vector x ∈ CN to a vector Ax, where A ∈ Cq×N is a measurement matrix that enables reconstruction of x from Ax. Typical goals in this context include minimizing the number of measurements q and the running time of the reconstruction algorithm. It is known that the restricted isometry property of A, for ε < √2 − 1, is a sufficient condition for reconstruction. In fact, it was shown in [11, 10, 9, 8] that under this condition, reconstruction is equivalent to finding the vector of least ℓ1 norm among all vectors that agree with the given measurements, a task that can be formulated as a linear pro- gram [13, 16], and thus can be solved efficiently. ∗School of Computer Science, The Academic College of Tel Aviv-Yaffo, Tel Aviv 61083, Israel. †Courant Institute of Mathematical Sciences, New York University. Supported by the Simons Collaboration on Algorithms and Geometry and by the National Science Foundation (NSF) under Grant No. CCF-1320188. 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 NSF. 1 The above application leads to the challenge of finding matrices A ∈ Cq×N that satisfy the re- stricted isometry property and have a small number of rows q as a function of N and k. (For sim- plicity, we ignore for now the dependence on ε.) A general lower bound of q = Ω(k · log(N/k)) is known to follow from [18] (see also [17]). Fortunately, there are matrices that match this lower bound, e.g., random matrices whose entries are chosen independently according to the normal distribution [12]. However, in many applications the measurement matrix cannot be chosen ar- bitrarily but is instead given by a random sample of rows from a unitary matrix, typically the discrete Fourier transform. This includes, for instance, various tests and experiments in medicine and biology (e.g., MRI [28] and ultrasound imaging [21]) and applications in astronomy (e.g., radio telescopes [32]). An advantage of subsampled Fourier matrices is that they support fast matrix-vector multiplication, and as such, are useful for efficient compression as well as for effi- cient reconstruction based on iterative methods (see, e.g., [26]). In recent years, with motivation from both theory and practice, an intensive line of research has aimed to study the restricted isometry property of random sub-matrices of unitary matrices. Letting A ∈ Cq×N be a (normalized) matrix whose rows are chosen uniformly and independently from the rows of a unitary matrix M ∈ CN×N, the goal is to prove an upper bound on q for which A is guaranteed to satisfy the restricted isometry property with high probability. Note that the fact that the entries of every row of A are not independent makes this question much more difficult than in the case of random matrices with independent entries. The first upper bound on the number of rows of a subsampled Fourier matrix that satisfies the restricted isometry property was O(k · log6 N), which was proved by Cand`es and Tao [12]. This was then improved by Rudelson and Vershynin [30] to O(k · log2 k · log(k log N) · log N) (see also [29, 15] for a simplified analysis with better success probability). A modification of their analysis led to an improved bound of O(k · log3 k · log N) by Cheraghchi, Guruswami, and Vel- ingker [14], who related the problem to a question on the list-decoding rate of random linear codes over finite fields. Interestingly, replacing the log(k log N) term in the bound of [30] by log k was crucial for their application.1 Recently, Bourgain [7] proved a bound of O(k · log k · log2 N), which is incomparable to those of [30, 14] (and has a worse dependence on ε; see below). We finally mention that the best known lower bound on the number of rows is Ω(k · log N) [5]. 1.1 Our Contribution In this work, we improve the previous bounds and prove the following. Theorem 1.1 (Simplified). Let M ∈ CN×N be a unitary matrix with entries of absolute value O(1/√N), and let ε > 0 be a fixed constant. For some q = O(k · log2 k · log N), let A ∈ Cq×N be a matrix whose q rows are chosen uniformly and independently from the rows of M, multiplied bypN/q. Then, with high probability, the matrix A satisfies the restricted isometry property of order k with constant ε. The main idea in our proof is described in Section 1.3. We arrived at the proof from our recent work on list-decoding [19], where a baby version of the idea was used to bound the sample com- 1Note that the list-decoding result of [14] was later improved by Wootters [33] using different techniques. 2 plexity of learning the class of Fourier-sparse Boolean functions.2 Like all previous work on this question, our proof can be seen as a careful union bound applied to a sequence of progressively finer nets, a technique sometimes known as chaining. However, unlike the work of Rudelson and Vershynin [30] and its improvements [14, 15], we avoid the use of Gaussian processes, the “symmetrization process,” and Dudley’s inequality. Instead, and more in line with Bourgain’s proof [7], we apply the chaining argument directly to the problem at hand using only elementary arguments. It would be interesting to see if our proof can be cast in the Gaussian framework of Rudelson and Vershynin. We remark that the bounds obtained in the previous works [30, 14] have a multiplicative O(ε−2) term, where a much worse term of O(ε−6) was obtained in [7]. In our proof of Theo- rem 1.1 we nearly obtain the best known dependence on ε. For simplicity of presentation we first prove in Section 3 our bound with a weaker multiplicative term of O(ε−4), and then, in Section 4, we modify the analysis and decrease the dependence on ε to eO(ε−2). 1.2 Related Literature As mentioned before, one important advantage of using subsampled Fourier matrices in com- pressed sensing is that they support fast, in fact nearly linear time, matrix-vector multiplication. In certain scenarios, however, one is not restricted to using subsampled Fourier matrices as the measurement matrix. The question then is whether one can decrease the number of rows us- ing another measurement matrix, while still keeping the near-linear multiplication time. For k < N1/2−γ where γ > 0 is an arbitrary constant, the answer is yes: a construction with the optimal number O(k · log N) of rows follows from works by Ailon and Chazelle [1] and Ailon and Liberty [2] (see [6]). For general k, Nelson, Price, and Wootters [27] suggested taking subsampled Fourier matrices and “tweaking” them by bunching together rows with random signs. Using the Gaussian-process-based analysis of [30, 14] and introducing further techniques from [22], they showed that with this construction one can reduce the number of rows by a logarithmic factor to O(k · log2(k log N) · log N) while still keeping the nearly linear multiplication time. Our result shows that the same number of rows (in fact, a slightly smaller number) can be achieved already with the original subsampled Fourier matrices without having to use the “tweak.” A natural open question is whether the “tweak” from [27] and their techniques can be combined with ours to further reduce the number of rows. An improvement in the regime of parameters of k = ω(√N) would lead to more efficient low-dimensional embeddings based on Johnson–Lindenstrauss ma- trices (see, e.g., [1, 2, 23, 3, 27]). 2The result in [19] is weaker in two main respects. First, it is restricted to the case that Ax is in {0, 1}q. This significantly simplifies the analysis and leads to a better bound on the number of rows of A. Second, the order of quantifiers is switched, namely it shows that for any sparse x, a random subsampled A works with high probability, whereas for the restricted isometry property we need to show that a random A works for all sparse x. 3 1.3 Proof Overview Recall from Theorem 1.1 and from (1) that our goal is to prove that a matrix A given by a random sample Q of q rows of M satisfies with high probability that for all k-sparse x, kAxk2 2. Since M is unitary, the latter is equivalent to saying that kAxk2 2. Yet another way of expressing this condition is as j∈Q(cid:2)(Mx2)j(cid:3) ≈ E 2 ≈ kMxk2 j∈[N](cid:2)(Mx2)j(cid:3) , 2 ≈ kxk2 E i.e., that a sample Q ⊆ [N] of q coordinates of the vector Mx2 gives a good approximation to the average of all its coordinates. Here, Mx2 refers to the vector obtained by taking the squared ab- solute value of Mx coordinate-wise. For reasons that will become clear soon, it will be convenient to assume without loss of generality that kxk1 = 1. With this scaling, the sparsity assumption implies that kMxk2 2 is not too small (namely at least 1/k), and this will determine the amount of additive error we can afford in the approximation above. This is the only way we use the sparsity assumption. At a high level, the proof proceeds by defining a finite set of vectors H that forms a net, i.e., a set satisfying that any vector Mx2 is close to one of the vectors in H. We then argue using the Chernoff-Hoeffding bound that for any fixed vector h ∈ H, a sample of q coordinates gives a good approximation to the average of h. Finally, we complete the proof by a union bound over all h ∈ H. In order to define the set H we notice that since kxk1 = 1, Mx can be seen as a weighted average of the columns of M (possibly with signs). In other words, we can think of Mx as the expectation of a vector-valued random variable given by a certain probability distribution over the columns of M. Using the Chernoff-Hoeffding bound again, this implies that we can approximate Mx well by taking the average over a small number of samples from this distribution. We then let H be the set of all possible such averages, and a bound on the cardinality of H follows easily (basically N raised to the number of samples). This technique is sometimes referred to as Maurey’s empirical method. The argument above is actually oversimplified, and carrying it out leads to rather bad bounds on q. As a result, our proof in Section 3 is slightly more delicate. Namely, instead of just one set H, we have a sequence of sets, H1, H2, . . ., each being responsible for approximating a different scale of Mx2. The first set H1 approximates Mx2 on coordinates on which its value is highest; since the value is high, we need less samples in order to approximate it well, as a result of which the set H1 is small. The next set H2 approximates Mx2 on coordinates on which its value is somewhat smaller, and is therefore a bigger set, and so on and so forth. The end result is that any vector Mx2 can be approximately decomposed into a sum ∑i h(i), with h(i) ∈ Hi. To complete the proof, we argue that a random choice of q coordinates approximates all the vectors in all the Hi well. The reason working with several Hi leads to the better bound stated in Theorem 1.1 is this: even though as i increases the number of vectors in Hi grows, the quality of approximation that we need the q coordinates to provide decreases, since the value of Mx2 there is small and so errors are less significant. It turns out that these two requirements on q balance each other perfectly, leading to the desired bound on q. 4 Acknowledgments. We thank Afonso S. Bandeira, Mahdi Cheraghchi, Michael Kapralov, Jelani Nelson, and Eric Price for useful discussions, and anonymous reviewers for useful comments. 2 Preliminaries Notation. The notation x ≈ε,α y means that x ∈ [(1 − ε)y − α, (1 + ε)y + α]. For a matrix M, we denote by M(ℓ) the ℓth column of M and define kMk∞ = maxi,j Mi,j. The Restricted Isometry Property. The restricted isometry property is defined as follows. Definition 2.1. We say that a matrix A ∈ Cq×N satisfies the restricted isometry property of order k with constant ε if for every k-sparse vector x ∈ CN it holds that (1 − ε) · kxk2 2 ≤ kAxk2 2 ≤ (1 + ε) · kxk2 2. Chernoff-Hoeffding Bounds. We now state the Chernoff-Hoeffding bound (see, e.g., [24]) and derive several simple corollaries that will be used extensively later. N · ∑N N · ∑N Theorem 2.2. Let X1, . . . , XN be N identically distributed independent random variables in [0, a] satisfy- ing E[Xi] = µ for all i, and denote X = 1 i=1 Xi. Then there exists a universal constant C such that for every 0 < ε ≤ 1/2, the probability that X ≈ε,0 µ is at least 1 − 2e−C·Nµε Corollary 2.3. Let X1, . . . , XN be N identically distributed independent random variables in [0, a] satis- fying E[Xi] = µ for all i, and denote X = 1 i=1 Xi. Then there exists a universal constant C such that for every 0 < ε ≤ 1/2 and α > 0, the probability that X ≈ε,α µ is at least 1 − 2e−C·Nαε/a. Proof: If µ ≥ α is at least 1 − 2e−C·Nαε/a. Otherwise, Theorem 2.2 for ε = α X ≈ε,0 µ, hence X ≈0,α µ, is at least 1 − 2e−C·Nµε Corollary 2.4. Let X1, . . . , XN be N identically distributed independent random variables in [−a, +a] satisfying E[Xi] = µ and E[Xi] = µ for all i, and denote X = 1 i=1 Xi. Then there exists a universal constant C such that for every 0 < ε′ ≤ 1/2 and α > 0, the probability that X ≈0,ε′· µ+α µ is at least 1 − 4e−C·Nαε′/a. Proof: The corollary follows by applying Corollary 2.3 to max(Xi, 0) and to − min(Xi, 0). ε then by Theorem 2.2 the probability that X ≈ε,0 µ is at least 1 − 2e−C·Nµε 2/a, and the latter is at least 1 − 2e−C·Nαε/a. 2/a, which > ε implies that the probability that 2/a. µ N · ∑N We end with the additive form of the bound, followed by an easy extension to the complex case. Corollary 2.5. Let X1, . . . , XN be N identically distributed independent random variables in [−a, +a] satisfying E[Xi] = µ for all i, and denote X = 1 i=1 Xi. Then there exists a universal constant C such that for every b > 0, the probability that X ≈0,b µ is at least 1 − 4e−C·Nb2/a2 N · ∑N . 5 Proof: We can assume that b ≤ 2a. The corollary follows by applying Corollary 2.4 to, say, α = 3b/4 and ε′ = b/(4a). Corollary 2.6. Let X1, . . . , XN be N identically distributed independent complex-valued random variables satisfying Xi ≤ a and E[Xi] = µ for all i, and denote X = 1 i=1 Xi. Then there exists a universal constant C such that for every b > 0, the probability that X ≈0,b µ is at least 1 − 8e−C·Nb2/a2 Proof: By Corollary 2.5 applied to the real and imaginary parts of the random variables X1, . . . , XN it follows that for a universal constant C, the probability that Re(X) ≈0,b/√2 Re(µ) and Im(X) ≈0,b/√2 Im(µ) is at least 1 − 8e−C·Nb2/a2 . By triangle inequality, it follows that with such probability we have X ≈0,b µ, as required. N · ∑N . 3 The Simpler Analysis In this section we prove our result with a multiplicative term of O(ε−4) in the bound. We start with the following theorem. Theorem 3.1. For a sufficiently large N, a matrix M ∈ CN×N, and sufficiently small ε, η > 0, the follow- η−1 log N · log2(1/η)), let Q be a multiset of q uniform and independent ing holds. For some q = O(ε−3 random elements of [N]. Then, with probability 1 − 2−Ω(ε−2·log N·log(1/η)), it holds that for every x ∈ CN, j∈Q(cid:2)(Mx)j2(cid:3) ≈ε,η·kxk2 j∈[N](cid:2)(Mx)j2(cid:3). Throughout the proof we assume without loss of generality that the matrix M ∈ CN×N satisfies 2), and γ = η/(2t). We start by kMk∞ = 1. For ε, η > 0, we denote t = log2(1/η), r = log2(1/ε defining several vector sets as follows. E E 1·kMk2 ∞ The Vector Sets Gi. For every 1 ≤ i ≤ t + r, let Gi denote the set of all vectors g(i) ∈ CN that can be represented as g(i) = √2 F · ∑ (ℓ,s)∈F (−1)s/2 · M(ℓ) (2) for a multiset F of O(2i · log(1/γ)) pairs in [N] × {0, 1, 2, 3}. A trivial counting argument gives the following. Claim 3.2. For every 1 ≤ i ≤ t + r, Gi ≤ NO(2i·log(1/γ)). The Vector Sets Hi. For a t-tuple of vectors (g(1+r), . . . , g(t+r)) ∈ G1+r × · · · × Gt+r and for 1 ≤ i ≤ t, let Bi be the set of all j ∈ [N] for which i is the smallest index satisfying g(i+r) ≥ 2 · 2−i/2. For such i, define the vector h(i) by j 2 · 1j∈Bi, 9 · 2−i). Let Hi be the set of all vectors h(i) that can be obtained in this way. h(i) j = min(g(i+r) j 6 (3) Claim 3.3. For every 1 ≤ i ≤ t, Hi ≤ NO(ε−2·2i·log(1/γ)). Proof: Observe that every h(i) ∈ Hi is fully defined by some (g(1+r), . . . , g(i+r)) ∈ G1+r × · · · × Gi+r. Hence Hi ≤ G1+r · · · Gi+r ≤ NO(log(1/γ))·(21+r+22+r+···+2i+r) ≤ NO(log(1/γ))·2i+r+1 . Using the definition of r, the claim follows. Lemma 3.4. For every η > 0 and some q = O(ε−3 η−1 log N · log(1/γ)), let Q be a multiset of q uniform and independent random elements of [N]. Then, with probability 1 − 2−Ω(ε−2·log N·log(1/γ)), it holds that for all 1 ≤ i ≤ t and h(i) ∈ Hi , E j∈Q(cid:2)h(i) j (cid:3) ≈ε, η E j (cid:3). j∈[N](cid:2)h(i) Proof: Fix an 1 ≤ i ≤ t and a vector h(i) ∈ Hi, and denote µ = Ej∈[N][h(i) applied with α = η and a = 9 · 2−i (recall that h(i) it holds that Ej∈Q[h(i) that the probability that some h(i) ∈ Hi does not satisfy Ej∈Q[h(i) ]. By Corollary 2.3, j ≤ a for every j), with probability 1 − 2−Ω(2i·qε η), ] ≈ε, η µ. Using Claim 3.3, the union bound over all the vectors in Hi implies ] ≈ε, η µ is at most j j j NO(ε−2·2i·log(1/γ)) · 2−Ω(2i·qε η) ≤ 2−Ω(ε−2·2i·log N·log(1/γ)) . We complete the proof by a union bound over i. Approximating the Vectors Mx. Lemma 3.5. For every vector x ∈ CN with kxk1 = 1, every multiset Q ⊆ [N], and every 1 ≤ i ≤ t + r, there exists a vector g ∈ Gi that satisfies (Mx)j ≈0,2−i/2 gj for all but at most γ fraction of j ∈ [N] and for all but at most γ fraction of j ∈ Q. Proof: Observe that for every ℓ ∈ [N] there exist pℓ,0, pℓ,1, pℓ,2, pℓ,3 ≥ 0 that satisfy 3 ∑ s=0 pℓ,s = xℓ and √2 · 3 ∑ s=0 pℓ,s · (−1)s/2 = xℓ. Notice that the assumption kxk1 = 1 implies that the numbers pℓ,s form a probability distribution. Thus, the vector Mx can be represented as Mx = N ∑ ℓ=1 xℓ · M(ℓ) = √2 · N ∑ ℓ=1 3 ∑ s=0 pℓ,s · (−1)s/2 · M(ℓ) = E (ℓ,s)∼D [√2 · (−1)s/2 · M(ℓ)], where D is the distribution that assigns probability pℓ,s to the pair (ℓ, s). 7 Let F be a multiset of O(2i · log(1/γ)) independent random samples from D, and let g ∈ Gi be the vector corresponding to F as in (2). By Corollary 2.6, applied with a = √2 (recall that kMk∞ = 1) and b = 2−i/2, for every j ∈ [N] the probability that (Mx)j ≈0,2−i/2 gj (4) is at least 1 − γ/4. It follows that the expected number of j ∈ [N] that do not satisfy (4) is at most γN/4, so by Markov’s inequality the probability that the number of j ∈ [N] that do not satisfy (4) is at most γN is at least 3/4. Similarly, the expected number of j ∈ Q that do not satisfy (4) is at most γQ/4, so by Markov’s inequality, with probability at least 3/4 it holds that the number of j ∈ Q that do not satisfy (4) is at most γQ. It follows that there exists a vector g ∈ Gi for which (4) holds for all but at most γ fraction of j ∈ [N] and for all but at most γ fraction of j ∈ Q, as required. Lemma 3.6. For every multiset Q ⊆ [N] and every vector x ∈ CN with kxk1 = 1 there exists a t-tuple of vectors (h(1), . . . , h(t)) ∈ H1 × · · · × Ht for which j (cid:3) and 1. Ej∈Q(cid:2)(Mx)j2(cid:3) ≈O(ε),O(η) Ej∈Q(cid:2)∑t i=1 h(i) j (cid:3). 2. Ej∈[N](cid:2)(Mx)j2(cid:3) ≈O(ε),O(η) Ej∈[N](cid:2)∑t Proof: By Lemma 3.5, for every 1 ≤ i ≤ t there exists a vector g(i+r) ∈ Gi+r that satisfies i=1 h(i) (Mx)j ≈0,2−(i+r)/2 g(i+r) j (5) for all but at most γ fraction of j ∈ [N] and for all but at most γ fraction of j ∈ Q. We say that j ∈ [N] is good if (5) holds for every 1 ≤ i ≤ t, and otherwise that it is bad. Notice that all but at most tγ fraction of j ∈ [N] are good and that all but at most tγ fraction of j ∈ Q are good. Let (h(1), . . . , h(t)) and (B1, . . . , Bt) be the vectors and sets associated with (g(1+r), . . . , g(t+r)) as defined in (3). We claim that h(1), . . . , h(t) satisfy the requirements of the lemma. We first show that for every good j it holds that (Mx)j2 ≈3ε,9η ∑t . To obtain it, we i=1 h(i) j observe that if j ∈ Bi for some i, then 2 · 2−i/2 ≤ g(i+r) j ≤ 3 · 2−i/2. (6) The lower bound follows simply from the definition of Bi. For the upper bound, which trivially holds for i = 1, assume that i ≥ 2, and notice that the definition of Bi implies that g(i+r−1) < 2 · 2−(i−1)/2. Using (5), and assuming that ε is sufficiently small, we obtain that j g(i+r) j ≤ (Mx)j + 2−(i+r)/2 ≤ g(i+r−1) ≤ 2−i/2(23/2 + 21/2 · ε + ε) ≤ 3 · 2−i/2. j + 2−(i+r−1)/2 + 2−(i+r)/2 Hence, by the upper bound in (6), for a good j ∈ Bi we have h(i) j = g(i+r) j Observe that by the lower bound in (6), 2 and h(i′) j = 0 for i′ 6= i. (Mx)j ∈ [g(i+r) j − 2−(i+r)/2, g(i+r) j + 2−(i+r)/2] ⊆ [(1 − ε) · g(i+r) j , (1 + ε) · g(i+r) j ], 8 and that this implies that (Mx)j2 ≈3ε,0 ∑t does not belong to any Bi, recalling that t = log2(1/η), it follows that j i=1 h(i) . On the other hand, in case that j is good but (Mx)j ≤ g(t+r) and thus (Mx)j2 ≈0,9η 0 = ∑t + 2−(t+r)/2 ≤ 2 · 2−t/2 + 2−(t+r)/2 ≤ 3 · 2−t/2 ≤ 3√η, i=1 h(i) j Finally, for every bad j we have . j (cid:12)(cid:12)(cid:12)(Mx)j2 − t ∑ i=1 h(i) j (cid:12)(cid:12)(cid:12) ≤ max(cid:16)(Mx)j2, t ∑ i=1 h(i) j (cid:17) ≤ 2. Since at most tγ fraction of the elements in [N] and in Q are bad, their effect on the difference between the expectations in the lemma can be bounded by 2tγ. By our choice of γ, this is η, completing the proof of the lemma. Finally, we are ready to prove Theorem 3.1. Proof of Theorem 3.1: By Lemma 3.4, applied with η = η/(2t), a random multiset Q of size q = O(cid:16)ε−3 η−1 log N · log2(1/η)(cid:17) η−1 · t · log N · log(1/γ)(cid:17) = O(cid:16)ε−3 satisfies with probability 1 − 2−Ω(ε−2·log N·log(1/η)) that for all 1 ≤ i ≤ t and h(i) ∈ Hi, j (cid:3) , j∈[N](cid:2)h(i) j (cid:3) ≈ε,η/t E j i ≈ε,η E j∈[N]h t j i. j∈Q(cid:2)h(i) j∈Qh t in which case we also have ∑ i=1 ∑ i=1 h(i) E E h(i) We show that a Q with the above property satisfies the requirement of the theorem. Let x ∈ CN be a vector, and assume without loss of generality that kxk1 = 1. By Lemma 3.6, there exists a t- tuple of vectors (h(1), . . . , h(t)) ∈ H1 × · · · × Ht satisfying Items 1 and 2 there. As a result, E j∈Q(cid:2)(Mx)j2(cid:3) ≈O(ε),O(η) E j∈[N](cid:2)(Mx)j2(cid:3) , and we are done. 3.1 The Restricted Isometry Property Equipped with Theorem 3.1, it is easy to derive our result on the restricted isometry property (see Definition 2.1) of random sub-matrices of unitary matrices. Theorem 3.7. For sufficiently large N and k, a unitary matrix M ∈ CN×N satisfying kMk∞ ≤ O(1/√N), and a sufficiently small ε > 0, the following holds. For some q = O(ε−4 · k · log2(k/ε) · log N), let A ∈ Cq×N be a matrix whose q rows are chosen uniformly and independently from the rows of M, mul- tiplied bypN/q. Then, with probability 1 − 2−Ω(ε−2·log N·log(k/ε)), the matrix A satisfies the restricted isometry property of order k with constant ε. 9 Proof: Let Q be a multiset of q uniform and independent random elements of [N], defining a matrix A as above. Notice that by the Cauchy-Schwarz inequality, any k-sparse vector x ∈ CN √k. Applying Theorem 3.1 with ε/2 and some η = Ω(ε/k), we get with kxk2 = 1 satisfies kxk1 ≤ that with probability 1 − 2−Ω(ε−2·log N·log(k/ε)), it holds that for every x ∈ CN with kxk2 = 1, j∈Q(cid:2)(Mx)j2(cid:3) ≈ε/2,ε/2 N · E It follows that every vector x ∈ CN satisfies kAxk2 isometry property of order k with constant ε. j∈[N](cid:2)(Mx)j2(cid:3) = kMxk2 2 ≈ε,0 kxk2 2, hence A satisfies the restricted 2 = N · E kAxk2 2 = 1 . 4 The Improved Analysis In this section we prove the following theorem, which improves the bound of Theorem 3.1 in terms of the dependence on ε. Theorem 4.1. For a sufficiently large N, a matrix M ∈ CN×N, and sufficiently small ε, η > 0, the following holds. For some q = O(log2(1/ε) · ε−1 η−1 log N · log2(1/η)), let Q be a multiset of q uniform and independent random elements of [N]. Then, with probability 1 − 2−Ω(log N·log(1/η)), it holds that for every x ∈ CN, E j∈Q(cid:2)(Mx)j2(cid:3) ≈ε,η·kxk2 1·kMk2 ∞ E j∈[N](cid:2)(Mx)j2(cid:3). (7) We can assume that ε ≥ η, as otherwise, one can apply the theorem with parameters η/2, η/2 1 · kMk2 and derive (7) for ε, η as well (because the right-hand size is bounded from above by kxk2 ∞). As before, we assume without loss of generality that kMk∞ = 1. For ε ≥ η > 0, we define t = 2). For the analysis given in this section, we define γ = η/(60(t + r)). log2(1/η) and r = log2(1/ε Throughout the proof, we use the vector sets Gi from Section 3 and Lemma 3.5 for this value of γ. The Vector Sets Di,m. For a (t + r)-tuple of vectors (g(1), . . . , g(t+r)) ∈ G1 × · · · × Gt+r and for 1 ≤ i ≤ t, let Ci be the set of all j ∈ [N] for which i is the smallest index satisfying g(i) ≥ 2 · 2−i/2. For m = i, . . . , i + r define the vector h(i,m) by j and for other values of m define h(i,m) = 0. Now, for every m, let ∆(i,m) be the vector defined by h(i,m) j = g(m) j 2 · 1j∈Ci, (8) ∆(i,m) j =( h(i,m) j 0, − h(i,m−1) j , if h(i,m) j − h(i,m−1) j otherwise. ≤ 30 · 2−(i+m)/2; (9) Note that the support of ∆(i,m) is contained in Ci. Let Di,m be the set of all vectors ∆(i,m) that can be obtained in this way. Claim 4.2. For every 1 ≤ i ≤ t and i ≤ m ≤ i + r, Di,m ≤ NO(2m·log(1/γ)). 10 Proof: Observe that every vector in Di,m is fully defined by some (g(1), . . . , g(m)) ∈ G1 × · · · × Gm. Hence Di,m ≤ G1 · · · Gm ≤ NO(log(1/γ))·(21+22+···+2m) ≤ NO(log(1/γ))·2m+1 , and the claim follows. Lemma 4.3. For every ε, η > 0 and some q = O(ε−1 η−1 log N · log(1/γ)), let Q be a multiset of q uniform and independent random elements of [N]. Then, with probability 1 − 2−Ω(log N·log(1/γ)), it holds that for every 1 ≤ i ≤ t, m, and a vector ∆(i,m) ∈ Di,m associated with a set Ci, E j∈Q(cid:2)∆(i,m) j (cid:3) ≈0,b E j∈[N](cid:2)∆(i,m) j (cid:3) for b = O(cid:16)ε · 2−i · Ci N + η(cid:17) . (10) Proof: Fix i, m, and a vector ∆(i,m) ∈ Di,m associated with a set Ci as in (9). Notice that [∆(i,m) j ] ≤ 30 · 2−(i+m)/2 · Ci N . E j∈[N] By Corollary 2.4, applied with ε′ = ε · 2(m−i)/2, α = η, and a = 30 · 2−(i+m)/2, we have that (10) holds with probability 1 − 2−Ω(2m·qε η). Using Claim 4.2, the union bound over all the vectors in Di,m implies that the probability that some ∆(i,m) ∈ Di,m does not satisfy (10) is at most The result follows by a union bound over i and m. NO(2m·log(1/γ)) · 2−Ω(2m·qε η) ≤ 2−Ω(2m·log N·log(1/γ)) . Approximating the Vectors Mx. Lemma 4.4. For every multiset Q ⊆ [N] and every vector x ∈ CN with kxk1 = 1 there exist vector collections (∆(i,m) ∈ Di,m)m=i,...,i+r associated with sets Ci (1 ≤ i ≤ t), for which 1. Ej∈[N](cid:2)(Mx)j2(cid:3) ≥ ∑t i=1 2−i · CiN − η, 2. Ej∈Q(cid:2)(Mx)j2(cid:3) ≈O(ε),O(η) Ej∈Q(cid:2)∑t 3. Ej∈[N](cid:2)(Mx)j2(cid:3) ≈O(ε),O(η) Ej∈[N](cid:2)∑t Proof: By Lemma 3.5, for every 1 ≤ i ≤ t + r there exists a vector g(i) ∈ Gi that satisfies i=1 ∑i+r m=i ∆(i,m) j ∆(i,m) i=1 ∑i+r m=i (cid:3), and (cid:3). (Mx)j ≈0,2−i/2 g(i) j j (11) for all but at most γ fraction of j ∈ [N] and for all but at most γ fraction of j ∈ Q. We say that j ∈ [N] is good if (11) holds for every i, and otherwise that it is bad. Notice that all but at most 11 (t + r)γ fraction of j ∈ [N] are good and that all but at most (t + r)γ fraction of j ∈ Q are good. Consider the sets Ci and vectors h(i,m), ∆(i,m) associated with (g(1), . . . , g(t+r)) as defined in (8). We claim that ∆(i,m) satisfy the requirements of the lemma. Fix some 1 ≤ i ≤ t. For every good j ∈ Ci, the definition of Ci implies that g(i) j using (11) it follows that (Mx)j ≥ g(i) j − 2−i/2 ≥ 2−i/2. ≥ 2 · 2−i/2, so (12) We also claim that (Mx)j ≤ 3 · 2−(i−1)/2. This trivially holds for i = 1, so assume that i ≥ 2, and notice that the definition of Ci implies that g(i−1) < 2 · 2−(i−1)/2, so using (11), it follows that j (Mx)j ≤ g(i−1) j + 2−(i−1)/2 ≤ 3 · 2−(i−1)/2. Since at most (t + r)γ fraction of j ∈ [N] are bad, (12) yields that E j∈[N](cid:2)(Mx)j2(cid:3) ≥ t ∑ i=1 2−i · Ci N − (t + r)γ/2 ≥ t ∑ i=1 2−i · Ci N − η, as required for Item 1. Next, we claim that every good j satisfies (Mx)j2 ≈O(ε),O(η) t ∑ i=1 h(i,i+r) j . (13) (14) (15) For a good j ∈ Ci and m ≥ i, (cid:12)(cid:12)(Mx)j2 − h(i,m) j (cid:12)(cid:12) ≤ 2 · (Mx)j · 2−m/2 + 2−m ≤ 10 · 2−(i+m)/2, where the first inequality follows from (11) and the second from (13). In particular, for m = i + r (recall that r = log2(1/ε 2)), we have j j (cid:12)(cid:12)(Mx)j2 − h(i,i+r) and thus (Mx)j2 ≈O(ε),0 h(i,i+r) good j ∈ S Ci we have (Mx)j2 ≈O(ε),0 ∑t (Mx)j ≤ g(t) i=1 h(i,i+r) Next, we claim that for every good j, and thus (Mx)j2 ≈0,9η 0 = ∑t belong to any Ci, by our choice of t, it satisfies j j (cid:12)(cid:12) ≤ 10 · ε · 2−i ≤ 10 · ε · (Mx)j2 , . Since every good j belongs to at most one of the sets Ci, for every i=1 h(i,i+r) j . On the other hand, if j is good but does not + 2−t/2 ≤ 3 · 2−t/2 = 3√η , . This establishes that (14) holds for every good j. (Mx)j2 ≈O(ε),O(η) t ∑ i=1 i+r ∑ m=i ∆(i,m) j . (16) 12 This follows since for every 1 ≤ i ≤ t, the vector h(i,i+r) can be written as the telescopic sum where we used that h(i,i−1) = 0. We claim that for every good j, these differences satisfy h(i,i+r) = i+r ∑ m=i(cid:0)h(i,m) − h(i,m−1)(cid:1) , ≤ 30 · 2−(i+m)/2, h(i,m) j − h(i,m−1) j thus establishing that (16) holds for every good j. Indeed, for m ≥ i + 1, (15) implies that h(i,m) j − h(i,m−1) j ≤ 10 · (2−(i+m)/2 + 2−(i+m−1)/2) ≤ 30 · 2−(i+m)/2, (17) and for m = i it follows from (11) combined with (13). Finally, for every bad j we have (cid:12)(cid:12)(cid:12)(Mx)j2 − t ∑ i=1 i+r ∑ m=i ∆(i,m) j (cid:12)(cid:12)(cid:12) ≤ 1 + 30 · max 1≤i≤t(cid:16) i+r ∑ m=i 2−(i+m)/2(cid:17) ≤ 60 . Since at most (t + r)γ fraction of the elements in [N] and in Q are bad, their effect on the difference between the expectations in Items 2 and 3 can be bounded by 60(t + r)γ. By our choice of γ this is η, as required. Finally, we are ready to prove Theorem 4.1. Proof of Theorem 4.1: Recall that it can be assumed that ε ≥ η. By Lemma 4.3, applied with ε = ε/r and η = η/(rt), a random multiset Q of size η−1 · r2 · t · log N · log(1/γ)(cid:17) q = O(cid:16)ε−1 = O(cid:16) log2(1/ε) · ε−1 η−1 log N · log2(1/η)(cid:17) satisfies with probability 1 − 2−Ω(log N·log(1/η)), that for every 1 ≤ i ≤ t, m, and ∆(i,m) ∈ Di,m associated with a set Ci, in which case we also have E j∈Q(cid:2)∆(i,m) j j E (cid:3) ≈0,bi j∈[N](cid:2)∆(i,m) i ≈0,b E j∈[N]h t i+r ∑ m=i ∑ i=1 (cid:3) for bi = O(cid:16) ε r · 2−i · Ci N ∆(i,m) j i for b = O(cid:16)ε · t ∑ i=1 η + rt(cid:17), 2−i · Ci N + η(cid:17) . (18) E j∈Qh t ∑ i=1 i+r ∑ m=i ∆(i,m) j We show that a Q with the above property satisfies the requirement of the theorem. Let x ∈ CN be a vector, and assume without loss of generality that kxk1 = 1. By Lemma 4.4, there exist vector collections (∆(i,m) ∈ Di,m)m=i,...,i+r associated with sets Ci (1 ≤ i ≤ t), satisfying Items 1, 2, and 3 there. Combined with (18), this gives and we are done. E j∈Q(cid:2)(Mx)j2(cid:3) ≈O(ε),O(η) E j∈[N](cid:2)(Mx)j2(cid:3) , 13 4.1 The Restricted Isometry Property It is easy to derive now the following theorem. The proof is essentially identical to that of Theo- rem 3.7, using Theorem 4.1 instead of Theorem 3.1. Theorem 4.5. For sufficiently large N and k, a unitary matrix M ∈ CN×N satisfying kMk∞ ≤ O(1/√N), and a sufficiently small ε > 0, the following holds. For some q = O(log2(1/ε)ε−2 · k · log2(k/ε) · log N), let A ∈ Cq×N be a matrix whose q rows are chosen uniformly and independently from the rows of M, multiplied bypN/q. Then, with probability 1 − 2−Ω(log N·log(k/ε)), the matrix A satisfies the restricted isometry property of order k with constant ε. References [1] N. Ailon and B. Chazelle. The fast Johnson–Lindenstrauss transform and approximate near- est neighbors. SIAM J. Comput., 39(1):302–322, 2009. Preliminary version in STOC’06. [2] N. Ailon and E. Liberty. Fast dimension reduction using Rademacher series on dual BCH codes. Discrete & Computational Geometry, 42(4):615–630, 2009. Preliminary version in SODA’08. [3] N. Ailon and E. Liberty. An almost optimal unrestricted fast Johnson–Lindenstrauss trans- form. ACM Transactions on Algorithms, 9(3):21, 2013. Preliminary version in SODA’11. [4] A. S. Bandeira, E. Dobriban, D. G. Mixon, and W. F. Sawin. Certifying the restricted isometry property is hard. IEEE Transactions on Information Theory, 59(6):3448–3450, 2013. [5] A. S. Bandeira, M. E. Lewis, and D. G. Mixon. Discrete uncertainty principles and sparse signal processing. CoRR, abs/1504.01014, 2015. [6] R. Baraniuk, M. Davenport, R. DeVore, and M. Wakin. A simple proof of the restricted isom- etry property for random matrices. Constructive Approximation, 28(3):253–263, 2008. [7] J. Bourgain. An improved estimate in the restricted isometry problem. In Geometric Aspects of Functional Analysis, volume 2116 of Lecture Notes in Mathematics, pages 65–70. Springer, 2014. [8] E. J. Cand`es. The restricted isometry property and its implications for compressed sensing. Comptes Rendus Mathematique, 346(9-10):589–592, 2008. [9] E. J. Cand`es, J. K. Romberg, and T. Tao. Stable signal recovery from incomplete and inaccurate measurements. Comm. Pure Appl. Math., 59(8):1207–1223, 2006. [10] E. J. Cand`es, M. Rudelson, T. Tao, and R. Vershynin. Error correction via linear programming. In 46th Annual IEEE Symposium on Foundations of Computer Science, FOCS, pages 295–308, 2005. [11] E. J. Cand`es and T. Tao. Decoding by linear programming. IEEE Transactions on Information Theory, 51(12):4203–4215, 2005. 14 [12] E. J. Cand`es and T. Tao. Near-optimal signal recovery from random projections: Universal encoding strategies? IEEE Trans. on Information Theory, 52(12):5406–5425, 2006. [13] S. S. Chen, D. L. Donoho, and M. A. Saunders. Atomic decomposition by basis pursuit. SIAM J. Comput., 20(1):33–61, 1998. [14] M. Cheraghchi, V. Guruswami, and A. Velingker. Restricted isometry of Fourier matrices and list decodability of random linear codes. SIAM J. Comput., 42(5):1888–1914, 2013. Preliminary version in SODA’13. [15] S. Dirksen. Tail bounds via generic chaining. Electron. J. Probab., 20(53):1–29, 2015. [16] D. L. Donoho, M. Elad, and V. N. Temlyakov. Stable recovery of sparse overcomplete repre- sentations in the presence of noise. IEEE Transactions on Information Theory, 52(1):6–18, 2006. [17] S. Foucart, A. Pajor, H. Rauhut, and T. Ullrich. The Gelfand widths of ℓp-balls for 0 < p ≤ 1. J. Complexity, 26(6):629–640, 2010. [18] A. Y. Garnaev and E. D. Gluskin. On the widths of Euclidean balls. Soviet Mathematics Doklady, 30:200–203, 1984. [19] I. Haviv and O. Regev. The list-decoding size of Fourier-sparse boolean functions. In Proceed- ings of the 30th Conference on Computational Complexity, CCC, pages 58–71, 2015. [20] P. Indyk and I. Razenshteyn. On model-based RIP-1 matrices. In Automata, Languages, and Programming - 40th International Colloquium, ICALP, pages 564–575, 2013. [21] A. C. Kak and M. Slaney. Principles of Computerized Tomographic Imaging. Society of Industrial and Applied Mathematics, 2001. [22] F. Krahmer, S. Mendelson, and H. Rauhut. Suprema of chaos processes and the restricted isometry property. CoRR, abs/1207.0235, 2012. [23] F. Krahmer and R. Ward. New and improved Johnson-Lindenstrauss embeddings via the restricted isometry property. SIAM J. Math. Analysis, 43(3):1269–1281, 2011. [24] C. McDiarmid. Concentration. In Probabilistic methods for algorithmic discrete mathematics, volume 16 of Algorithms Combin., pages 195–248. Springer, Berlin, 1998. [25] A. Natarajan and Y. Wu. Computational complexity of certifying restricted isometry property. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX, pages 371–380, 2014. [26] D. Needell and J. A. Tropp. CoSaMP: iterative signal recovery from incomplete and inaccurate samples. Commun. ACM, 53(12):93–100, 2010. 15 [27] J. Nelson, E. Price, and M. Wootters. New constructions of RIP matrices with fast multipli- cation and fewer rows. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 1515–1528, 2014. [28] D. G. Nishimura. Principles of Magnetic Resonance Imaging. Stanford University, 2010. [29] H. Rauhut. Compressive sensing and structured random matrices. In M. Fornasier, edi- tor, Theoretical foundations and numerical methods for sparse recovery, volume 9, pages 1–92. De Gruyter, 2010. [30] M. Rudelson and R. Vershynin. On sparse reconstruction from Fourier and Gaussian mea- surements. Comm. Pure Appl. Math., 61(8):1025–1045, 2008. Preliminary version in CISS’06. [31] A. M. Tillmann and M. E. Pfetsch. The computational complexity of the restricted isometry property, the nullspace property, and related concepts in compressed sensing. IEEE Transac- tions on Information Theory, 60(2):1248–1259, 2014. [32] S. Wenger, S. Darabi, P. Sen, K. Glassmeier, and M. A. Magnor. Compressed sensing for aperture synthesis imaging. In Proceedings of the International Conference on Image Processing, ICIP, pages 1381–1384, 2010. [33] M. Wootters. On the list decodability of random linear codes with large error rates. In Pro- ceedings of the 45th Annual ACM Symposium on Theory of Computing, STOC, pages 853–860, 2013. 16
1207.4127
1
1207
2012-07-11T14:47:24
On finding minimal w-cutset
[ "cs.DS", "cs.AI" ]
The complexity of a reasoning task over a graphical model is tied to the induced width of the underlying graph. It is well-known that the conditioning (assigning values) on a subset of variables yields a subproblem of the reduced complexity where instantiated variables are removed. If the assigned variables constitute a cycle-cutset, the rest of the network is singly-connected and therefore can be solved by linear propagation algorithms. A w-cutset is a generalization of a cycle-cutset defined as a subset of nodes such that the subgraph with cutset nodes removed has induced-width of w or less. In this paper we address the problem of finding a minimal w-cutset in a graph. We relate the problem to that of finding the minimal w-cutset of a treedecomposition. The latter can be mapped to the well-known set multi-cover problem. This relationship yields a proof of NP-completeness on one hand and a greedy algorithm for finding a w-cutset of a tree decomposition on the other. Empirical evaluation of the algorithms is presented.
cs.DS
cs
On finding minimal w-cutset Bozhena Bidyuk and Rina Dechter Information and Computer Science University Of California Irvine Irvine, CA 92697-3425 Abstract The complexity of a reasoning task over a graph- ical model is tied to the induced width of the un- derlying graph. It is well-known that the con- ditioning (assigning values) on a subset of vari- ables yields a subproblem of the reduced com- plexity where instantiated variables are removed. If the assigned variables constitute a cycle-cutset, the rest of the network is singly-connected and therefore can be solved by linear propagation al- gorithms. A w-cutset is a generalization of a cycle-cutset defined as a subset of nodes such that the subgraph with cutset nodes removed has In this paper we induced-width of w or less. address the problem of finding a minimal w- cutset in a graph. We relate the problem to that of finding the minimal w-cutset of a tree- decomposition. The latter can be mapped to the well-known set multi-cover problem. This rela- tionship yields a proof of NP-completeness on one hand and a greedy algorithm for finding a w- cutset of a tree decomposition on the other. Em- pirical evaluation of the algorithms is presented. 1 Introduction A cycle-cutset of an undirected graph is a subset of nodes that, when removed, the graph is cycle-free. Thus, if the assigned variables constitute a cycle-cutset, the rest of the network is singly-connected and can be solved by lin- ear propagation algorithms. This principle is at heart of the well-known cycle-cutset conditioning algorithms for Bayesian networks [16] and for constraint networks [7]. Recently, the idea of cutset-conditioning was extended to accommodate search on any subset of variables using the notion of w-cutset, yielding a hybrid algorithmic scheme of conditioning and inference paramterized by w [18]. The w-cutset is defined as a subset of nodes in the graph that, once removed, the graph has tree-width of w or less. The hybrid w-cutset-conditioning algorithm applies search to the cutset variables and exact inference (e.g., bucket elimination [8]) to the remaining network. Given a w- cutset Cw , the algorithm is space exponential in w and time exponential in w + jCw j [9]. The scheme was ap- plied successfully in the context of satisfiability [18] and constraint optimization [13]. More recently, the notion of conditioning was explored for speeding up sampling al- gorithms in Bayesian networks in a scheme called cutset- sampling. The idea is to restrict sampling to w-cutset vari- ables only (peform inference on the rest) and thus reduce the sampling variance ([5, 6]). Since the processing time of both search-based and sampling-based schemes grows with the size of the w- cutset, it calls for a secondary optimization task for finding a minimal-size w-cutset. Also, of interest is the task of find- ing the full sequence of minimal w-cutsets, where w ranges from 1 to the problem’s induced-width (or tree-width), so that the user can select the w that fits his/her resources. We call the former the w-cutset problem and the latter the se- quence w-cutset problem. The w-cutset problem extends the task of finding minimum cycle-cutset (e.g. a 1-cutset), a problem that received fair amount of attention [3, 2, 20]. The paper addresses the minimum size w-cutset and, more generally, the minimum weight w-cutset problem. First, we relate the size of a w-cutset of a graph to its tree-width and the properties of its tree-decompositions. Then, we prove that the problem of finding a minimal w-cutset of a given tree decomposition is NP-complete by reduction from the set multi-cover problem [20]. Consequently, we apply a well-known greedy algorithm (GWC) for the set multi- cover problem to solve the minimum w-cutset problem. The algorithm finds w-cutset within O(1+ ln m) of optimal where m is the maximum number of clusters of size greater than w + 1 sharing the same variable in the input tree de- composition. We investigate its performance empirically and show that, with rare exceptions, GWC and its vari- ants find a smaller w-cutset than the well-performing MGA cycle-cutset algorithm [3] (adapted to the w-cutset prob- lem) and a w-cutset algorithm (DGR) proposed in [11]. UAI 2004BIDYUK & DECHTER43 2 Preliminaries and Background 2.1 General graph concepts We focus on automated reasoning problems R=<X ,F > where X is a set of variables and F is a set of functions over subsets of the variables. Such problems are associated with a graphical description and thus also called graphical models. The primary examples are constraint networks and Bayesian or belief networks formally defined in [16]. The structure of a reasoning problem can be depicted via several graph representations. DE FIN IT ION 2.1 (Primal-, dual-,hyper-graph of a probem) The primal graph G=<X ,E>of a reasoning problem <X ,F > has the variables X as its nodes and an arc connects two nodes if they appear in the scope of the same function f 2 F . A dual graph of a reasoning problem has the scopes of the functions as the nodes and an arc connects two nodes if the corresponding scopes share a variable. The arcs are labelled by the shared variables. The hypergraph of a reasoning problem has the variables X as nodes and the scopes as edges. There is a one-to-one correspondance between the hypergraph and the dual graphs of a problem. We next describe the notion of a tree-decomposition [10, 14]. It is applicable to any grapical model since it is defined relative to its hypergraph or dual graph. DE FIN IT ION 2.2 (tree-decomp., cluster-tree, tree-width) Let R =< X; D; F > be a reasoning problem with its hypergraph H = (X; F )). (We abuse notation when we identify a function with its scope). A tree-decomposition for R (resp., its hypergraph H) is a triple < T ; (cid:31); >, where T =<V ; E> is a tree, and (cid:31) and are labeling functions which associate with each vertex v 2 V two sets, (cid:31)(v) (cid:18) X and (v) (cid:18) F such that 1. For each function fi 2 F , there is exactly one vertex v 2 V such that fi 2 (v), and scope(fi ) (cid:18) (cid:31)(v). 2. For each variable Xi 2 X , the set fv 2 V jXi 2 (cid:31)(v)g induces a connected subtree of T . This is also called the running intersection property. We will often refer to a node and its functions as a cluster and use the term tree-decomposition and cluster tree inter- changeably. The maximum size of node (cid:31)i minus 1 is the width of the tree decomposition. The tree width of a graph G denoted tw(G) is the minimum width over all possible tree decompositions of G [1].The tree-width of a graph is also referred to as induced width of a graph. We sometime denote the optimal tree-width of a graph by tw(cid:3). There is a known relationship between tree-decompositions and chordal graphs. A graph is chordal if any cycle of length 4 or more has a chord. Every tree-decomposition of a graph corresponds to a chordal graph that augments the input graph where the tree clusters are the cliques in the chordal graph. And vice-versa, any chordal graph is a tree- decomposition where the clusters are the maximal cliques. Therefore, much of the discussion that follows, relating to tree-decompositions of graphs, can be rephrased using the notion of chordal graph embeddings. 2.2 w-cutset of a graph DE FIN IT ION 2.3 (w-cutset of a graph) Given a graph G=<X; E>, Cw (cid:26) X is a w-cutset of G if the subgraph over X nC has tree-width (cid:20) w. Clearly, a w-cutset is also a w 0 -cutset when w 0 (cid:21) w. The cutset Cw is minimal if no w-cutset of smaller size exists. jD(Ci )j For completeness, we also define the weighted w-cutset problem that generalizes minimum w-cutset problem (where all node weights are assumed the same). For ex- ample, in w-cutset conditioning, the space requirements max ) where dmax is the max- of exact inference are O(dw imum node domain size in graph G. The total time re- quired to condition on w-cutset C is O(N (cid:1) dw max ) (cid:2) jD(C )j where jD(C )j is the size of the cutset domain space and N is the number of variables. The upper bound value d jC j max on jD(C )j produces a bound on the computation time of max ) (cid:2) djC j the cutset-conditioning algorithm: O(N (cid:1) dw max = O(N (cid:1) dw+jC j max ). In this case, clearly, we want to minimize the size of C. However, a more refined optimization task is to minimize the actual value of jD(C )j: jD(C )j = YCi2C Since the minimum of jD(C )j corresponds to the minimum of lg jD(C )j, we can solve this optimization task by assign- ing each node Xi cost ci = lg jD(Xi )j and minimizing the cost of cutset: cost(C ) = lg jD(C )j = XCi2C lg jD(Xi )j = Xi Similar considerations apply in case of the w-cutset sam- pling algorithm. Here, the space requirements for the exact inference are the same. The time required to sample a node Ci 2 C is O(dw max ) (cid:2) jD(Ci )j. The total sampling time max ) (cid:2) PCi2C jD(Ci )j. To minimize the total pro- is O(dw cessing time, we assign each node Xi cost ci = jD(Xi )j and select the w-cutset of minimum cost: cost(C ) = XCi2C jD(Ci )j DE FIN IT ION 2.4 (weighted w-cutset of a graph) Given a reasoning problem <X; F > where each node Xi 2 X has associated cost(Xi ) = ci , the cost of a w-cutset Cw is given by: cost(Cw ) = PXi 2Cw ci . The minimum weight w-cutset problem is to find a min-cost w-cutset. ci 44BIDYUK & DECHTERUAI 2004 In practice, we can often assume that all nodes have the same cost and solve the easier minimal w-cutset problem. In section 3, we establish relations between the size of w- cutset of a graph and the width of its tree-decomposition. In section 4, we show that the problem is NP-hard even when finding a minimum w-cutset of a chordal graph (cor- responding to a tree-decomposition of a graph). A A ACE DEF A B D C E B D C E F (a) F (b) ADE ABD B C E F (c) AB AC CE EF 3 w-Cutset and Tree-Decompositions In this section, we explore relationship between w-cutset of a graph and its tree-decomposition. THEOREM 3.1 Given a graph G=<X; E>, if G has a w- cutset Cw , then there is a tree-decomposition of G having a tree-width tw (cid:20) jCw j + w. Proof. If there exists a w-cutset Cw , then we can remove Cw from the graph yielding, by definition, a subgraph G 0 over X nCw that has a tree decomposition T with clusters of size at most w+1. We can add the set Cw to each cluster of T yielding a tree-decomposition with clusters of size at most w + 1 + jCw j and tree-width w + jCw j. ut We can conclude therefore that for any graph tw (cid:3) (cid:20) jCi j+i for every i. Moreover, THEOREM 3.2 Given a graph G, if c(cid:3) i is the size of a small- i , and tw(cid:3) is its tree-width, then: est i-cutset C (cid:3) c(cid:3) 1 + 1 (cid:21) c(cid:3) 2 + 2 (cid:21) ::: (cid:21) c(cid:3) i + i (cid:21) ::: (cid:21) tw(cid:3) (1) Proof. Let us define (cid:1)i;i+1 = c(cid:3) i+1 , then we claim i (cid:0) c(cid:3) that (cid:1)i;i+1 (cid:21) 1. Assume to the contrary that ci = ci+1 , that is (cid:1)i;i+1 =0. Since C (cid:3) i is an i-cutset, we can build a tree decomposition T with maximum cluster size (i+1). Note, i j > 0 or we would have tw(cid:3) = i. for all i < tw(cid:3) , jC (cid:3) Pick some Xj 2 C (cid:3) i and add Xj to every cluster yielding tree decomposition T 0 with maximum cluster size (i+2). i nXj is an (i+1)-cutset of size c(cid:3) Clearly, C (cid:3) i (cid:0) 1 = c(cid:3) i+1 (cid:0) 1 i+1 . ut which contradicts the minimality of C (cid:3) Given a graph G = (V ; E ), the w-cutset sequence problem seeks a sequence of minimal j -cutsets where j ranges from j ; :::; Ctw(cid:3) = (cid:30). Let 1 to the graph’s tree-width: C (cid:3) 1 ; :::; C (cid:3) w be a subset-minimal w-cutset, namely one that does not C 0 contain another w-cutset. If we have a w-cutset sequence, we can reason about which w to choose for applying the w- cutset conditioning algorithm or w-cutset sampling. Given a w-cutset sequence we define a function f (i) = jCi j + i where i ranges from 1 to tw. This function characterizes the complexity of the w-cutset conditioning algorithms: for each i, the space complexity is exponential in i and the time complexity is exponential in f (i). The space con- sideration suggests selecting i as small as possible. No- tice that for various intervals of i, f (i) maybe constant: if jCi j = jCi+1 j + 1. Thus, given a w-cutset sequence, whenever f (i) = f (i + 1), then w = i is preferred over Figure 1: (a) Graph; (b) triangulated graph and correspond- ing tree decomposition of width 2; (c) graph with 1-cutset node fDg removed and corresponding tree-decomposition. w = i + 1. Alternatively, given a bound on the space- complexity expressed by r, we can select a most preferred wp -cutset such that: wp (r) = arg min j fr = j g In the empirical section 6, we demonstrate the analysis of function f (i) and its implications. (2) THEOREM 3.3 Given a tree-decomposition T =(V ; E ) where V =fV1 ; :::; Vt g is the set of clusters and given a con- w of G satisfies: stant w, a minimum w-cutset C (cid:3) w j (cid:20) Xi;jVi j>w+1 jC (cid:3) (jVi j (cid:0) (w + 1)) Proof. From each cluster Vi 2 V of size larger than (w+1), select a subset of nodes Ci (cid:26) Vi of size jCi j = jVi j (cid:0) (w + 1) so that jVi nCi j (cid:20) w + 1. Let Cw = [i;jVi j>w+1Ci . By construction, Cw is a w-cutset of G and: w (cid:20) jCw j = j [i Ci j (cid:20) Pi jCi j = Pi;jVi j>w+1 jVi j (cid:0) c(cid:3) (w + 1). ut Since a w-cutset yields a tree-decomposition having tw = w, it looks reasonable when seeking w-cutset to start from a good tree-decomposition and find its w-cutset (or a se- quence). In particular, this avoids the need to test if a graph has tw = w. This task is equivalent to finding a w-cutset of a chordal (triangulated) graph. DE FIN IT ION 3.1 (A w-cutset of a tree-decomposition) Given a tree decomposition T =<V ; E> of a reasoning problem <X; F > where V is a set of subsets of X then w (cid:26) X is a w-cutset relative to T if for every i, C T w j (cid:20) w + 1. jVi nC T We should note upfront, however, that a minimum-size w- cutset of T (even if T is optimal) is not necessarily a mini- mum w-cutset of G. Example 3.4 Consider a graph in Figure 1(a). An optimal tree decomposition of width 2 is shown in Figure 1(b). This tree-decomposition clearly does not have a 1-cutset of size < 2. However, the graph has a 1-cutset of size 1, fDg, as shown in Figure 1(c). UAI 2004BIDYUK & DECHTER45 On the other hand, given a minimum w-cutset, removing the w-cutset from the graph yields a graph having tw (cid:3) = w. Because, otherwise, there exists a tree-decomposition over X nCw having tw < w. Select such a tree and select a node in Cw that can be added to the tree-decomposition without increasing its tree-width beyond w. Such a node must exist, contradicting the minimality of Cw . It is still an open question if every minimal w-cutset is a w- cutset of some minimum-width tree-decomposition of G. 4 Hardness of w-Cutset on Cluster-Tree While it is obvious that the general w-cutset problem is NP-complete (1-cutset is a cycle-cutset known to be NP- complete), it is not clear that the same holds relative to a given tree-decomposition. We now show that, given a tree- decomposition T of a hyper-graph H, the w-cutset problem for T is NP-complete.We use a reduction from set multi- cover (SMC) problem. DE FIN IT ION 4.1 (Set Cover (SC)) Given a pair < U; S > where U is universal set and S is a set of subsets S=fS1 ; :::; Smg of U , find a minimum set C (cid:26) S s.t. each element of U is covered at least once: [Si2C Si = U . DE FIN IT ION 4.2 (Set Multi-Cover(SMC)) Given a pair < U; S > where U is universal set and S is a set of subsets S = fS1 ; :::; Smg of U, find a minimum cost set C (cid:26) S s.t. each Ui 2 U is covered at least ri > 0 times by C. The SC is an instance of SMC problem when 8i; ri = 1. THEOREM 4.1 (NP-completeness) The problem ” Given a tree-decomposition T =<V ; E> and a constant k , does there exist a w-cutset of T of size at most k ? ” is NP- complete. Proof. Given a tree decomposition T =<V ; E> over X and a subset of nodes C 2 X , we can verify in linear time whether C is a w-cutset of T by checking if 8Vi 2 V , jVi nC j (cid:20) w + 1. Now, we show that the problem is NP- hard by reduction from set multi-cover. Assume we are given a set multi-cover problem <U; S>, where U =fX1 ; :::; Xng and S =fS1 ; :::; Smg, a covering re- quirement ri > 0 for each Ui 2 U . a cluster tree T =<V ; E> over S where there We define is a node Vi 2 V corresponding to each variable Ui in U that contains all subsets Sj 2 S that cover node Xi : Vi = fSj 2 S jXi 2 Sj g. Additionally, there is a node VS 2 V that contains all subsets in S: VS = S . Thus, V = fVi jUi 2 U g [ VS . The edges are added between each cluster Vi;i6=s and cluster VS : E = fVi VS jUi 2 U g to satisfy running intersection property in T . Define w+1=jS j (cid:0) mini ri = m (cid:0) mini ri . For each Vi;i6=s , U={U1,U2,U3} r1=2, r2=2, r3=1 S1={U1}, S2={U3}, S3={U1, U2}, S4={U2, U3}, S5={U1, U2, U3} (a) SMC ' 1V S1,S3,S5, Q1 1,Q1 2,Q1 3 S1,S2,S3,S4,S5 ' SV ' 2V S3,S4,S5, 2,Q2 Q2 1,Q2 3 ' 3V S2,S4,S5, Q3 1,Q3 2 (b) 3-cutset problem Figure 2: (a) A set multi-cover problem <U; S> where U =fU1 ; U2 ; U3g, S =fS1 ; :::; S5g, the covering requirements r1 =2, (b) Correspond- r3 =1. r2 =2, ing augmented tree decomposition T 0=<V 0 ; E> over S 0=fS1 ; :::; S5 ; Q1 3g. 1 ; Q2 1 ; Q3 1 ; Q1 2 ; Q2 2 ; Q3 2 ; Q1 3 ; Q2 since jVi j (cid:20) m and ri > 0, then jVi j(cid:0)ri (cid:20) jVi j(cid:0)mini ri (cid:20) m (cid:0) mini ri = w + 1. Consequently, jVi j (cid:20) ri + w + 1. For each Vi s.t. jVi j < ri + w + 1, de fine (cid:1)i =ri + w + 1 (cid:0) jVi j and augment cluster Vi with a set of nodes i :::Q(cid:1)i i g yielding a cluster V 0 i = Vi [ Qi of size Qi = fQ1 i j=ri + w + 1. jV 0 We will show now that a set multi-cover <U; S> has a so- lution of size k iff there exists a w-cutset of augmented tree decomposition T 0=<V 0 ; E> of the same size.The aug- mented tree for sample SMC problem in Figure 2(a) is shown in Figure 2(b). Let C be a set multi-cover solution of size k . Then, 8Ui 2 i j (cid:0) ri = w + 1. i j (cid:21) ri which yields jV 0 U , jC \ V 0 i nC j (cid:20) jV 0 Since jC j (cid:21) mini ri , then jVS nC j (cid:20) jVS j (cid:0) mini ri = m (cid:0) mini ri = w + 1. Therefore, C is a w-cutset of size k . Let Cw be a w-cutset problem of size k . If Cw contains a node Qj 2 Qi , we can replace it with some node Sp 2 V 0 i without increasing the size of the cutset. Thus, without loss of generality, we can assume Cw (cid:26) S . For each V 0 i corresponding to some Ui 2 U , let Ci = Cw \ V 0 i . By i nCw j (cid:20) w+1. Therefore, jCi j (cid:21) de finition of w-cutset, jV 0 i j (cid:0) (w + 1) = ri . By de finition, Cw is a cover for the jV 0 given SMC problem. Minimum w-cutset problem is NP-hard by reduction from set multi-cover and is verifiable in linear time. Therefore, minimum w-cutset problem is NP-complete. ut Example 4.2 Let us demonstrate those steps for the SMC problem with U =fU1 ; U2 ; U3g and S=fS1 ; :::; S5g shown in Figure 2(a). Define T =<V ; E>, V =fV1 ; V2 ; V3 ; Vs g, over S: V1=fS1 ; S2 ; S3g, f1=3, V2=fS3 ; S4 ; S5g, f2=3, V3=fS2 ; S4 ; S5g, f3=3, VS =fS1 ; :::; S5g, fS =5. Then, w = jS j (cid:0) 1 (cid:0) mini ri = 5 (cid:0) 1 (cid:0) 1 = 3. Augment: 1 ; Q3 1 ; Q2 V1 : (cid:1)1=w+1+r1 (cid:0) f1=4+2-3=3, Q1=fQ1 1g. 2 ; Q2 V2 : (cid:1)2=w+1+r2 (cid:0) f2=4+2-3=3, Q2=fQ1 2 ; Q3 2g. 3 ; Q2 V3 : (cid:1)3=w+1+r3 (cid:0) f3=4+1-3=2, Q3=fQ1 3g. The augmented tree decomposition T 0 is shown in Fig- 46BIDYUK & DECHTERUAI 2004 ure 2(b). Any SMC solution such as C =fS3 ; S5g is a 3- cutset of T and vice versa. ACE DEF U={V1,V2,V3 ,V4} r1=1, r2=1, r3=1,r4=1 In summary, we showed that when w is not a constant the w-cutset problem is NP-complete. This implies that the w- cutset sequence problem over tree-decompositions is hard. 5 Algorithm GWC for minimum cost w-cutset Next, we show that the problem of finding w-cutset can be mapped to that of finding set multi-cover. The map- ping suggests an application of greedy approximation al- gorithm for set multi-cover problem to find w-cutset of a tree decomposition. When applied to a tree decomposi- tion T =<V ; E> over X , it is guaranteed to find a solution within factor O(1 + ln m) of optimal where m is the max- imum # of clusters of size > (w + 1) sharing the same node. To avoid loss of generality, we consider the weighted version of each problem. The mapping is as follows. Given any w-cutset problem of a tree-decomposition T =<V ; E> over X, each cluster node Vi 2 V of the tree becomes a node of universal set U. A covering set SXj =fVi 2 V jXj 2 Vi g is created for each node Xj 2 X . The cost of SXj equals the cost of Xj . The cover requirement is ri = jVi j (cid:0) (w + 1). Covering a node in SMC with a set SXj corresponds to removing node Xj from each cluster in T. Then, the solution to a set multi-cover is a w-cutset of T. Let C be a solution to the SMC problem. For each Ui 2 U , the set C contains at least ri subsets SXj that contain Ui . Consequently, since Ui = Vi , then jVi \ C j (cid:21) ri and jVi nC j (cid:20) jVi j (cid:0) ri = jVi j (cid:0) jVi j + (w + 1) = w + 1. By definition, C is a w- cutset. An example is shown in Figure 3. This duality is important because the properties of SC and SMC problems are well studied and any algorithms previously developed for SMC can be applied to solve w-cutset problem. A well-known polynomial time greedy algorithm exists for weighted SMC [20] that chooses repeatedly set Si that cov- ers the most ”li ve” (covered less than ri times) nodes fi at the cost ci : a set that minimizes the ratio ci =fi . In the con- text of w-cutset, fi is the number of clusters whose size still exceeds (w + 1) and ci is the cost of node Xi . As dis- cussed earlier, ci maybe defined as the size of the domain of node Xi or its log. When applied to solve the w-cutset problem, we will refer to the algorithm as GWC (Greedy W -Cutset). It is formally defined in Figure 4. We define here the approximation algorithm metrics: ADE ABD V1={ACE} V2={ADE} V3={ABD} V4={DEF} (a) SA={V1,V2,V3}, SD={V2,V3,V4}, SB={V3}, SE={V1,V2,V4}, SC={V1}, SF={V4} (b) (a) A tree decomposition T =<V ,E> where Figure 3: V =fV1 ; :::; V4 g over X =fA; B ; C; D; E ; F g; the (b) corresponding set multi-cover problem <U ,S> where U =fV1 ; V2 ; V3 ; V4g and S =fSA , SB , SC , SD , SF g; here, set SXi contains a cluster Vj iff Xi 2 Vj . The 1-cutset of T is a solution to the set multicover with covering require- ments r1 =r2=r3 =r4=1: when node Vi 2 V is ”co vered” by set SXi , node Xi is removed from each cluster. Greedy w-Cutset Algorithm (GWC) Input: A set of clusters V = fV1 ; :::; Vm g of a tree- decomposition over X = fX1 ; :::; Xng where 8Vi 2 V , Vi (cid:26) X ; the cost of each node Xi is ci . Output : A set C (cid:26) X s.t. jVi nC j (cid:20) w. Set C = ;,t=0. While 9Vi s.t. jVi j > w + 1 do 1. 8Xi 2 X , compute fi = jfVj gj s.t. Xi 2 Vj . 2. Find node Xi 2 X that minimizes the ratio ci =fi . 3. Remove Xi from all clusters: 8Vi 2 V ; Vi = Vi nXi . 4. Set X = X nXi , C = C [ fXig. End While Return C jVj j > w and Figure 4: Greedy w-cutset Algorithm. GWC is a factor O(1+ ln m) approximation algorithm [17] where m is the maximum number of clusters sharing the same node (same as the maximum set size in SMC). This bound is nearly the best possible for a polynomial al- gorithm due to strong inapproximability results for the set cover problem, the special case of set multi-cover problem. Approximation guarantee better than O(ln m) is not possi- ble for any polynomial time algorithm unless P=NP [4, 15]. Furthermore, 9 absolute constants C , (cid:1)0 s.t. 8 (cid:1) (cid:21) (cid:1)0 no polynomial-time algorithm can approximate the optimum within a factor of ln (cid:1) (cid:0) C ln ln (cid:1) unless P=NP [19]. 6 Experiments DE FIN IT ION 5.1 (factor (cid:14) approximation) An algorithm A is a factor (cid:14) , (cid:14) > 0, approximation algorithm for minimization problem P if A is polynomial and for ev- ery instance I 2 DP it produces a solution s such that: cost(s) (cid:20) (cid:14) (cid:3) costOP T (s); (cid:14) > 1. We use Bayesian networks as input reasoning problems. In all experiments, we started with a moral graph G of a Bayesian network B which was used as the input to the minimal w-cutset problem. The tree-decomposition of G was obtained using min-fill algorithm [12]. UAI 2004BIDYUK & DECHTER47 Our benchmarks are two CPCS networks from UAI repos- itory: cpcs360b with N=360 nodes and induced width w(cid:3)=22 and cpcs422b with N=422 nodes and induced width w(cid:3)=27, one instance each. Our other benchmarks are lay- ered random networks where each node is assigned a set of parents selected randomly from a previous layer. One set of random networks consisted of 4 layers of L = 50 nodes each, total of N =50x4=200 nodes; each node as- signed P = 3 parents. The second set of random net- works consisted of 8 layers of L = 25 nodes each, total of N =25x8=200 nodes; each node assigned P = 3 par- ents. For random networks, the results are averaged over 100 instances. We compare the performance of two greedy heuristic algorithms- MGA (Modified Greedy Algorithm due to [3]) and DGR (Deterministic Greedy Algorithm due to [11])- to our proposed algorithms: GWC (Greedy W - Cutset) and its variants. All nodes domains of size 2. The MGA algorithm is adapted from a minimum cost cycle-cutset algorithm of [3] that iteratively removes all nodes if degree 1 from the graph and adds to cutset the node that minimizes the cost to degree ratio. The algorithm stops when remaining subgraph is cycle-free. The MGA is a fac- tor 4 approximation algorithm. In [20], a factor 2 approx- imation algorithm is defined based on layering. However, it can not be easily adapted to finding minimal w-cutset for w > 1. For MGA, the only modification required to find w-cutset is to stop when original graph with cutset nodes removed can be decomposed into a cluster tree of width w or less (using min- fill heuristics). In our implementation, MGA algorithm uses the GWC heuristics to break ties: if two nodes have the same degree, the node found in most of the clusters of size > w is added to the cutset. The DGR algorithm is the Deterministic Greedy Algorithm for finding an elimination order of the variables that yields a tree-decomposition of bounded width defined in [11]. DGR obtains a w-cutset while computing the elimination order of the variables. When eliminating some node X yields a cluster that is too large (size > w + 1), the algorithm uses greedy heuristics to pick a cutset node among all the nodes that are not in the ordering yet. Specifically , the determin- istic algorithm adds to the cutset a node X that maximizes expression pjNX jCX , where NX is a set of neighbours of X that are not eliminated yet and CX = QUi2NX jD(Ui )j. The GWC algorithm was implemented as described earlier picking at each iteration a node found in most clusters of size > w + 1 with a secondary heuristics (tie breaking) that selects the node contained in most of the clusters. Several variants of GWC with different tie breaking heuristics were tested that were allowed to rebuild a tree decomposition af- ter removing a cutset node: GWCA - breaks ties by selecting the node found in most of the clusters of the tree decomposition; GWCM - breaks ties by selecting the node found in most of the clusters of maximum size; GWCD - breaks ties by selecting the node of highest de- gree (the degree of the node is computed on the subgraph with all cutset nodes removed and all resulting singly- connected nodes removed). Note that GWC and GWCA only differ in that GWCA rebuilds a cluster-tree after re- moving a cutset node. Also note that MGA and GWCD have their primary and tie-breaking heuristics switched. Table 1: w-cutset. Networks: I=cpcs360b, II=cpcs422b, III=4-layer random networks, L=50, N=200, P=3; IV =8- layer random networks, L=25, N=200, P=3. 9 10 8 7 1 2 3 4 5 6 w MGA 30 22 20 18 16 15 14 13 12 10 I 36 22 19 18 16 14 13 12 11 10 w*=20 DGR 27 20 17 16 15 14 13 12 11 10 GWC GWCA 27 21 18 16 15 14 13 12 11 10 GWCD 27 21 18 16 15 14 13 12 11 10 MGA 80 70 65 60 54 49 44 41 38 36 II 84 70 63 54 49 43 38 32 27 23 w*=22 DGR 78 66 58 52 46 41 36 31 26 22 GWC GWCA 78 65 57 51 45 40 35 30 25 21 GWCD 78 65 57 51 45 40 35 30 25 21 MGA 87 59 54 52 50 48 47 45 44 43 III w*=49 DGR 80 57 52 50 48 46 44 43 42 40 GWC 78 61 53 49 46 44 43 42 41 39 GWCA 74 56 50 47 44 42 41 39 38 37 GWCD 74 56 49 47 44 42 41 39 38 37 MGA 99 74 69 66 63 61 59 56 54 51 IV w*=24 DGR 90 71 65 61 58 55 52 49 47 44 GWC 93 77 68 63 59 55 52 49 46 43 GWCA 87 70 62 57 54 51 48 45 42 39 GWCD 86 70 62 57 54 51 48 45 42 39 11 12 13 14 15 16 17 18 19 20 w 0 1 2 3 4 5 6 7 8 9 I MGA 0 1 2 3 4 5 6 7 8 9 w*=20 DGR 0 1 2 3 4 5 6 7 8 9 GWC GWCA 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 GWCD 9 7 8 2 8 9 4 5 6 7 MGA 33 30 28 II 2 3 4 5 8 9 7 21 19 16 w*=22 DGR 8 6 5 4 3 2 GWC 19 16 13 10 2 3 4 5 6 8 9 GWCA 18 15 12 GWCD 18 15 12 9 8 6 5 4 3 2 MGA 41 40 39 37 36 35 34 33 31 30 III w*=49 DGR 39 38 36 36 34 33 32 31 30 29 GWC 38 37 36 35 34 33 32 31 30 29 GWCA 36 35 34 33 32 31 30 29 28 27 GWCD 36 34 34 33 32 31 30 29 28 27 MGA 49 47 44 41 39 36 34 31 28 26 IV 41 38 36 33 31 28 25 23 21 19 w*=24 DGR GWC 40 37 35 32 29 27 25 23 20 18 GWCA 37 34 32 30 27 25 23 21 19 17 GWCD 37 35 32 30 28 25 24 21 19 17 48BIDYUK & DECHTERUAI 2004 The results are presented in Table 1. For each bench- mark, the table provides the fi ve rows of results correspond- ing to the fi ve algorithms (labelled in the second column). Columns 3-12 are the w-cutset sizes for the w-value. The upper half of the table entires provides results for w in range [1; 10]; the lower half of the table provides results for w in range [11; 20]. The results for cpcs360b and cpcs422b correspond to a single instance of each network. The result for random networks are averaged over 100 instances. The best entries for each w are highlighted. As Table 1 shows, it pays to rebuild a tree decomposi- tion: with rare exceptions, GWCA finds a cutset as small as GWC or smaller. On average, GWCA, GWCM, and GWCD computed the same-size w-cutsets. The results for GWCM are omitted since they do not vary sufficiently from the others. The performance of MGA algorithm appears to depend on the network structure. In case of cpcs360b, it computes the same size w-cutset as GWC variants for w (cid:21) 10. However, in the instance of cpcs422b, MGA consistently finds larger cutsets except for w=20. On average, as reflected in the results for random networks, MGA finds larger cutset than DGR or any of the GWC-family algorithms. In turn, DGR occasionally finds a smaller cutset compared to GWC, but always a larger cutset compared to GWCA and GWCD. We measured the GWC algorithm approximation parame- ter M in all of our benchmarks. In cpcs360b and cpcs422b we have M = 86 and M = 87 yielding approximation factor of 1 + ln M (cid:25) 5:4. In random networks, M varied from 29 to 47 yielding approximation factor 2 [4:3; 4:9]. Thus, if C is the w-cutset obtained by GWC and Copt is the minimum size w-cutset, then on average: jC j jCopt j (cid:20) 5 Looking at the results as solutions to the sequence w-cutset problems, we can inspect the sequence and suggest good w’s by analysing the function f (i) = jCi j + i as de- scribed in section 3. To illustrate this we focus on algo- rithm GWCA for CPC364, CPCS424 and 4-layer random networks (See Table 2). For cpcs360b we observe a small range of values for f (i), namely f (i) 2 f20; 21; 23; 28g. In this case the point of choice is w = 4 because f (1) = 28, f (2) = 23, f (3) = 21 while at i = 4 we obtain reduction f (4) = 20 which stays constant for i (cid:21) 4. Therefore, we can have the same time complexity for w-cutset as for exact inference (w(cid:3) = 20) while saving a lot in space, reducing space complexity from exponential in 20 to exponential in 4 only. For w-cutset sampling this implies sampling 20 variables (out of 360) and for each variable doing inference exponential in 4. The results are even more interesting for cpcs422b where we see a fast decline in time complexity with relatively Table 2: Function f (i) for i=1...16, GWCA. Networks: I=cpcs360b, random, L=50, III=4-layer II=cpcs422b, N=200, P=3. f(i) 9 10 8 7 6 5 4 3 2 1 i 28 23 21 20 20 20 20 20 20 20 I II 79 67 60 55 50 46 42 38 34 31 III 75 57 53 51 49 48 48 47 47 47 f(i) 11 12 13 14 15 16 17 18 19 20 i 20 20 20 20 20 20 20 20 20 20 I II 29 27 25 23 23 22 22 22 22 22 III 47 47 47 47 47 47 47 47 47 47 slow decline in space complexity for the range i = 1; :::; 11. The decline is more moderate for i (cid:21) 11 but is still cost-effective: for i = 16 we get the same time per- formance as i = 20 and therefore i = 16 represents a more cost-effective point. Finally, for the case of 4-layer random networks, on av- erage the function f (i) decreases for i = 1:::8 and then remains constant. This suggests that if space complexity allows, the best point of operation is w = 8. 7 Related Work and Conclusions In this paper, we formally defined the minimum w-cutset problem applicable to any reasoning problems with graph- ical models such as constraint networks and Bayesian net- works. The minimum w-cutset problem extends the min- imum cycle-cutset problem corresponding to w = 1. The motivation for finding a minimal w-cutset is to bound the space complexity of the problem (exponential in the width of the graph) while minimizing the required additional pro- cessing time (exponential in the width of the graph plus the size of cutset). The cycle-cutset problem corresponds to the well-known weighted vertex-feedback set problem and can be approx- imated within factor 2 of optimal by a polynomial algo- rithm. We show that the minimal w-cutset problem is harder. Since any set multi-cover problem (SMC) ([20]) can be reduced to a w-cutset problem of a clique tree, the w-cutset problem of a tree-decomposition is at least as hard as SMC and cannot have a constant-factor polynomial ap- proximation algorithm unless P=NP. This complexity re- sult applies to the problem of finding minimal w-cutset of a graph. Consider chordal graphs discussed earlier in Section 2.1. Each chordal graph has a corresponding tree decomposition whose clusters are the maximal cliques of the graph and vice-versa. If there was a constant-factor w- cutset algorithm for a graph, then it could be used to find the minimal w-cutset of a chordal graph that is the minimal UAI 2004BIDYUK & DECHTER49 w-cutset of the corresponding tree-decomposition. Empirically, we show that the minimal cycle-cutset heuris- tics based on the degree of a node is not competitive with the tree-decomposition of the graph. We also demonstrate that the proposed GWC-family algorithms consistently out- perform the previously defined algorithms based on the node elimination order in [18, 13] and [11]. In [18, 13], the next elimination node is added to the cutset if its bucket size exceeds the limit. A similar approach was explored in [11] in DGR algorithm (presented in the empirical section) except that the cutset node was chosen heuristically among all the nodes that were not eliminated yet. The immediate drawback of either approach is that it does not permit to change the order of the nodes already eliminated. As the empirical results demonstrate, DGR usually finds smaller cutset than MGA but bigger than GWC/GWCA/GWCD. good The main objective of our future work is to find heuristics for w-cutset problem that are independent from the tree-decomposition of a graph. So far, we only looked at the degree of a node as a possible heuristics and found empirically that GWC heuristics are usually superior. Al- ternatively, we want to incorporate into the heuristic mea- sure of the ”goodness” of the w-cutset other factors such as correlation between variables that strongly affect the con- vergence of the Markov-chain based w-cutset sampling. Fi- nally, there are open questions remaining regarding the re- lationship between w-cutset of a graph and a w-cutset of its tree-decomposition. It is not clear, for example, whether the minimal w-cutset of a graph is a w-cutset of one of its minimum width tree-decompositions. 8 Acknowledgements This work was supported in part by NSF grant IIS-0086529 and MURI ONR award N00014-00-1-061 7. References [1] S. A. Arnborg, ‘Efficient algorithms for combinatorial problems on graphs with bounded decomposability - a survey’, BIT, 25, 2–23, (1985). [2] A. Becker, R. Bar-Yehuda, and D. Geiger, ‘Random algorithms for the loop cutset problem’, in Uncer- tainty in AI, (1999). [3] A. Becker and D. Geiger, ‘A sufficiently fast algo- rithm for finding close to optimal junction trees’, in Uncertainty in AI, pp. 81–89, (1996). [4] M. Bellare, C. Helvig, G. Robins, and A. Zelikovsky, ‘Provably good routing tree construction with multi- port terminals’, in Twenty-Fifth Annual ACM Sympo- sium on Theory of Computing, pp. 294–304, (1993). [5] B. Bidyuk and R. Dechter, ‘Cycle-cutset sampling for bayesian networks’, Sixteenth Canadian Conf. on AI, (2003). [6] B. Bidyuk and R. Dechter, ‘Empirical study of w- cutset sampling for bayesian networks’, UAI, (2003). [7] R. Dechter, ‘Enhancement schemes for constraint processing: Backjumping, learning and cutset decom- Intelligence, 41, 273–312, position’, Artificial (1990). [8] R. Dechter, ‘Bucket elimination: A unifying frame- Intelligence, 113, 41– work for reasoning’, Artificial 85, (1999). [9] R. Dechter, Constraint Processing, Morgan Cauf- mann, 2001. [10] R. Dechter and J. Pearl, ‘Network-based heuristics for constraint satisfaction problems’, Arti ficial Intel- ligence, 34, 1–38, (1987). [11] D. Geigher and M. Fishelson, ‘Optimizing exact ge- netic linkage computations’, in 7th Annual Interna- tional Conf. on Computational Molecular Biology, (2003). pp. 114–121, [12] U. Kjaerulff. Triangulation of graphs - algorithms giving small total space, 1990. [13] J Larossa and R. Dechter, ‘Dynamic combination of search and variable-elimination in csp and max-csp’, Constraints, (2003). [14] S.L. Lauritzen and D.J. Spiegelhalter, ‘Local compu- tation with probabilities on graphical structures and their application to expert systems’, Journal of the Royal Statistical Society, Series B, 50(2), 157–224, (1988). [15] C. Lund and M. Yannakakis, ‘On the hardness of approximating minimization problems’, J. of ACM, 41(5), 960–981, (September 1994). [16] J. Pearl, Probabilistic Reasoning in Intelligent Sys- tems, Morgan Kaufmann, 1988. [17] S. Rajagopalan and V.V. Vazirani, ‘Primal-dual rnc approximation algorithms for (multi)set (multi)cover and covering integer programs’, SIAM J. of Comput- ing, 28(2), 525–540, (1998). ‘Resolution vs. search; [18] I. Rish and R. Dechter, two strategies for sat’, J. of Automated Reasoning, 24(1/2) , 225–275, (2000). [19] Luca Trevisan, ‘Non-approximability resu.lts for op- timization problems on bounded degree instances’, In proceedings of 33rd ACM STOC, (2001). [20] V. V. Vazirani, Approximation Algorithms, Springer, 2001. 50BIDYUK & DECHTERUAI 2004
1111.0321
3
1111
2016-03-13T09:49:08
Anonymous Meeting in Networks
[ "cs.DS", "cs.DC" ]
A team consisting of an unknown number of mobile agents, starting from different nodes of an unknown network, possibly at different times, have to meet at the same node. Agents are anonymous (identical), execute the same deterministic algorithm and move in synchronous rounds along links of the network. Which configurations are gatherable and how to gather all of them deterministically by the same algorithm? We give a complete solution of this gathering problem in arbitrary networks. We characterize all gatherable configurations and give two universal deterministic gathering algorithms, i.e., algorithms that gather all gatherable configurations. The first algorithm works under the assumption that an upper bound n on the size of the network is known. In this case our algorithm guarantees gathering with detection, i.e., the existence of a round for any gatherable configuration, such that all agents are at the same node and all declare that gathering is accomplished. If no upper bound on the size of the network is known, we show that a universal algorithm for gathering with detection does not exist. Hence, for this harder scenario, we construct a second universal gathering algorithm, which guarantees that, for any gatherable configuration, all agents eventually get to one node and stop, although they cannot tell if gathering is over. The time of the first algorithm is polynomial in the upper bound n on the size of the network, and the time of the second algorithm is polynomial in the (unknown) size itself. Our results have an important consequence for the leader election problem for anonymous agents in arbitrary graphs. For anonymous agents in graphs, leader election turns out to be equivalent to gathering with detection. Hence, as a by-product, we obtain a complete solution of the leader election problem for anonymous agents in arbitrary graphs.
cs.DS
cs
Anonymous Meeting in Networks∗ Yoann Dieudonn´e† Andrzej Pelc‡ Abstract A team consisting of an unknown number of mobile agents, starting from different nodes of an unknown network, possibly at different times, have to meet at the same node. Agents are anonymous (identical), execute the same deterministic algorithm and move in synchronous rounds along links of the network. An initial configuration of agents is called gatherable if there exists a deterministic algorithm (even dedicated to this particular configuration) that achieves meeting of all agents in one node. Which configurations are gatherable and how to gather all of them deterministically by the same algorithm? We give a complete solution of this gathering problem in arbitrary networks. We characterize all gatherable configurations and give two universal deterministic gathering algorithms, i.e., algorithms that gather all gatherable configurations. The first algorithm works under the assumption that a common upper bound N on the size of the network is known to all agents. In this case our algorithm guarantees gathering with detection, i.e., the existence of a round for any gatherable configuration, such that all agents are at the same node and all declare that gathering is accomplished. If no upper bound on the size of the network is known, we show that a universal algorithm for gathering with detection does not exist. Hence, for this harder scenario, we construct a second universal gathering algorithm, which guarantees that, for any gatherable configuration, all agents eventually get to one node and stop, although they cannot tell if gathering is over. The time of the first algorithm is polynomial in the upper bound N on the size of the network, and the time of the second algorithm is polynomial in the (unknown) size itself. Our results have an important consequence for the leader election problem for anonymous agents in arbitrary graphs. Leader election is a fundamental symmetry breaking problem in distributed computing. Its goal is to assign, in some common round, value 1 (leader) to one of the entities and value 0 (non- leader) to all others. For anonymous agents in graphs, leader election turns out to be equivalent to gathering with detection. Hence, as a by-product, we obtain a complete solution of the leader election problem for anonymous agents in arbitrary graphs. Keywords: gathering, deterministic algorithm, anonymous mobile agent. 6 1 0 2 r a M 3 1 ] S D . s c [ 3 v 1 2 3 0 . 1 1 1 1 : v i X r a ∗A preliminary version of this paper appeared in the Proc. 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2013). A part of this research was done during the Dieudonn´e's stay at the Research Chair in Distributed Computing of the Universit´e du Qu´ebec en Outaouais as a postdoctoral fellow. Supported in part by NSERC discovery grant and by the Research Chair in Distributed Computing of the Universit´e du Qu´ebec en Outaouais. †MIS, Universit´e de Picardie Jules Verne Amiens, France and D´epartement d'informatique, Universit´e du Qu´ebec en Outaouais, ‡D´epartement d'informatique, Universit´e du Qu´ebec en Outaouais, Gatineau, Qu´ebec J8X 3X7, Canada. E-mail: [email protected]. Gatineau, Qu´ebec J8X 3X7, Canada. E-mail: [email protected]. Introduction 1 The background. A team of at least two mobile agents, starting from different nodes of a network, possibly at different times, have to meet at the same node. This basic task, known as gathering or rendezvous, has been thoroughly studied in the literature. This task has even applications in everyday life, e.g., when agents are people that have to meet in a city whose streets form a network. In computer science, mobile agents usually represent software agents in computer networks, or mobile robots, if the network is a labyrinth. The reason to meet may be to exchange data previously collected by the agents, or to coordinate some future task, such as network maintenance or finding a map of the network. The model and the problem. The network is modeled as an undirected connected graph, referred to hereafter as a graph. We seek gathering algorithms that do not rely on the knowledge of node labels, and can work in anonymous graphs as well (cf. [4]). The importance of designing such algorithms is motivated by the fact that, even when nodes are equipped with distinct labels, agents may be unable to perceive them because of limited sensory capabilities, or nodes may refuse to reveal their labels, e.g., due to security or privacy reasons. Note that if nodes had distinct labels, then agents might explore the graph and meet in the smallest node, hence gathering would reduce to exploration. On the other hand, we assume that edges incident to a node v have distinct labels in {0, . . . , d− 1}, where d is the degree of v. Thus every undirected edge {u, v} has two labels, which are called its port numbers at u and at v. Port numbering is local, i.e., there is no relation between port numbers at u and at v. Note that in the absence of port numbers, edges incident to a node would be undistinguishable for agents and thus gathering would be often impossible, as the adversary could prevent an agent from taking some edge incident to the current node. There are at least two agents that start from different nodes of the graph and traverse its edges in synchronous rounds. They cannot mark visited nodes or traversed edges in any way. The adversary wakes up some of the agents at possibly different times. A dormant agent, not woken up by the adversary, is woken up by the first agent that visits its starting node, if such an agent exists. Agents are anonymous (identical) and they execute the same deterministic algorithm. (Algorithms assuming anonymity of agents may be also used if agents refuse to reveal their identities.) Every agent starts executing the algorithm in the round of its wake-up. Agents do not know the topology of the graph or the size of the team. We consider two scenarios: one when agents know an upper bound on the size of the graph and another when no bound is known. In every round an agent may perform some local computations and move to an adjacent node by a chosen port, or stay at the current node. When an agent enters a node, it learns its degree and the port of entry. When several agents are at the same node in the same round, they can exchange all information they currently have. However, agents that cross each other on an edge, traversing it simultaneously in different directions, do not notice this fact. Also, agents cannot observe any part of the network except the currently visited node. We assume that the memory of the agents is unlimited: they can be viewed as Turing machines. An initial configuration of agents, i.e., their placement at some nodes of the graph, is called gatherable if there exists a deterministic algorithm (even only dedicated to this particular configuration) that achieves meeting of all agents in one node, regardless of the times at which some of the agents are woken up by the adversary. In this paper we study the following gathering problem: Which initial configurations are gatherable and how to gather all of them deterministically by the same algorithm? In other words, we want to decide which initial configurations are possible to gather, even by an algorithm specifically designed for this particular configuration, and we want to find a universal gathering algorithm that gathers all such configurations. We are interested only in terminating algorithms, in which every agent eventually stops forever. Our results. We give a complete solution of the gathering problem in arbitrary networks. We characterize all gatherable configurations and give two universal deterministic gathering algorithms, i.e., algorithms that 1 gather all gatherable configurations. The first algorithm works under the assumption that a common upper bound N on the size of the network is known to all agents. In this case our algorithm guarantees gathering with detection, i.e., the existence of a round for any gatherable configuration, such that all agents are at the same node and all declare that gathering is accomplished. If no upper bound on the size of the network is known, we show that a universal algorithm for gathering with detection does not exist. Hence, for this harder scenario, we construct a second universal gathering algorithm, which guarantees that, for any gatherable configuration, all agents eventually get to one node and stop, although they cannot tell if gathering is over. The time of the first algorithm is polynomial in the upper bound N on the size of the network, and the time of the second algorithm is polynomial in the (unknown) size itself. While gathering two anonymous agents is a relatively easy task (cf. [17]), our problem of gathering an unknown team of anonymous agents presents the following major difficulty. The asymmetry of the initial configuration because of which gathering is feasible, may be caused not only by non-similar locations of the agents in the graph, but by their different situation with respect to other agents. Hence a new algorithmic idea is needed in order to gather: agents that were initially identical, must make decisions based on the memories of other agents met to date, in order to distinguish their future behavior. In the beginning the memory of each agent is a blank slate and in the execution of the algorithm it records what the agent has seen in previous steps of the navigation and what it heard from other agents during meetings. Even a slight asymmetry occurring in a remote part of the graph must eventually influence the behavior of initially distant agents. Notice that agents in different initial situations may be unaware of this difference in early meetings, as the difference may be revealed only later on, after meeting other agents. Hence, for example, an agent may mistakenly "think" that two different agents that it met in different stages of the algorithm execution, are the same agent. Confusions due to this possibility are a significant challenge absent both in gathering two (even anonymous) agents and in gathering many labeled agents. Our results have an important consequence for the leader election problem for anonymous agents in ar- bitrary graphs. Leader election [44] is a fundamental symmetry breaking problem in distributed computing. Its goal is to assign, in some common round, value 1 (leader) to one of the entities and value 0 (non-leader) to all others. For anonymous agents in graphs, leader election turns out to be equivalent to gathering with detection (see Section 5). Hence, as a by-product, we obtain a complete solution of the leader election problem for anonymous agents in arbitrary graphs. Related work. Gathering was mostly studied for two mobile agents and in this case it is usually called rendezvous. An extensive survey of randomized rendezvous in various scenarios can be found in [4], cf. also [2, 3, 5, 36]. Deterministic rendezvous in networks was surveyed in [45]. Several authors considered the geometric scenario (rendezvous in an interval of the real line, see, e.g., [11, 32], or in the plane, see, e.g., [6, 7]). Gathering more than two agents was studied, e.g., in [36, 43]. In [51] the authors considered rendezvous of many agents with unique labels, and gathering many labeled agents in the presence of Byzantine agents was studied in [23]. The problem was also studied in the context of multiple robot systems, cf. [15, 26], and fault tolerant gathering of robots in the plane was studied, e.g., in [1, 16]. For the deterministic setting a lot of effort was dedicated to the study of the feasibility of rendezvous, and to the time required to achieve this task, when feasible. For instance, deterministic rendezvous with agents equipped with tokens used to mark nodes was considered, e.g., in [41]. Deterministic rendezvous of two agents that cannot mark nodes but have unique labels was discussed in [21, 39, 48]. These papers were concerned with the time of rendezvous in arbitrary graphs. In [21] the authors showed a rendezvous algorithm polynomial in the size of the graph, in the length of the shorter label and in the delay between the starting time of the agents. In [39, 48] rendezvous time is polynomial in the first two of these parameters and independent of the delay. Memory required by two anonymous agents to achieve deterministic rendezvous was studied in [28, 29] for trees and in [17] for general graphs. Memory needed for randomized rendezvous in the ring was 2 discussed, e.g., in [40]. Apart from the synchronous model used, e.g., in [17, 21, 48, 51] and in this paper, several authors investigated asynchronous rendezvous in the plane [14, 26] and in network environments [10, 18, 20, 24, 33]. In the latter scenario the agent chooses the edge which it decides to traverse but the adversary controls the speed of the agent. Under this assumption rendezvous in a node cannot be guaranteed even in very simple graphs and hence the rendezvous requirement is relaxed to permit the agents to meet inside an edge. In particular, in [33] the authors studied asynchronous rendezvous of two anonymous agents. Gathering many anonymous agents in a ring [19, 37, 38] and in a tree [25] was studied in a different model, where agents execute Look-Compute-Move cycles in an asynchronous way and can see positions of other agents during the Look operation. While agents have the advantage of periodically seeing other agents, they do not have any memory of past events, unlike in our model. Tree exploration by many agents starting at the same node was studied in [27]. Some of the techniques of this paper have been later used in our paper [22] in the context of anonymous graph exploration by many agents. The leader election problem was introduced in [42] and has been mostly studied in the scenario where all nodes have distinct labels and the leader is found among them [30, 35, 46]. In [34], the leader elec- tion problem was approached in a model based on mobile agents for networks with labeled nodes. Many authors [8, 9, 12, 49, 50] studied leader election in anonymous networks. In particular, [50] characterized message-passing networks in which leader election among nodes can be achieved when nodes are anony- mous. Memory needed for leader election in unlabeled networks was studied in [31]. 2 Preliminaries Throughout the paper, the number of nodes of a graph is called its size. In this section we recall four procedures known from the literature, that will be used as building blocks in our algorithms. The aim of the first two procedures is graph exploration, i.e., visiting all nodes of the graph by a single agent (cf., e.g., [13, 47]). The first of these procedures assumes an upper bound N on the size of the graph. It is based on universal exploration sequences (UXS) and is a corollary of the result of Reingold [47]. It allows the agent to traverse all nodes of any graph of size at most N, starting from any node of this graph, using P (N ) edge traversals, where P is some polynomial. After entering a node of degree d by some port p, the agent can compute the port q by which it has to exit; more precisely q = (p + xi) mod d, where xi is the corresponding term of the UXS of length P (N ). The second procedure makes no assumptions on the size but it is performed by an agent using a fixed token placed at the starting node of the agent. (It is well known that a terminating exploration even of all anonymous rings of unknown size by a single agent without a token is impossible.) In our applications the roles of the token and of the exploring agent will be played by agents or by groups of agents. The first procedure works in time polynomial in the known upper bound N on the size of the graph and the second in time polynomial in the size of the graph. At the end of each procedure all nodes of the graph are visited. Moreover, at the end of the second procedure the agent is with the token and has a complete map of the graph with all port numbers marked. We call the first procedure EXP LO(N ) and the second procedure EST , for exploration with a stationary token. We denote by T (EXP LO(N )) the maximum time of execution of the procedure EXP LO(N ) in a graph of size at most N. Before describing the third procedure we define the following notion from [50]. Let G be a graph and v a node of G. The view from v is the infinite rooted tree V(v) with labeled ports, defined as follows. Nodes of this tree are all (not necessarily simple) finite paths in G starting at v and represented as the corresponding sequences of port numbers. The root of the tree is the empty path, and children of path π of length x are all paths of length x + 2, whose prefix is π. A child ρ of node π, such that ρ = πpq (with juxtaposition standing for concatenation) is connected with node π by an edge that has port p at node π and port q at node ρ. 3 The truncated view V l(v) at depth l is the rooted subtree of V(v) induced by all nodes at distance at most l from the root. The third procedure, described in [17], permits a single anonymous agent starting at node v of an n-node graph, to find a positive integer S(v) ∈ {1, . . . , n}, called the signature of the agent, such that V(v) = V(w) if and only if S(v) = S(w). This procedure, called SIGN (N ) works for any graph G of known upper bound N on its size and its running time is polynomial in N. After the completion of SIGN (N ), graph G has been completely explored (i.e., all the nodes of G have been visited at least once) and the agent is back at its starting node. We denote by T (SIGN (N )) the maximum time of execution of the procedure SIGN (N ) in a graph of size at most N. Finally, the fourth procedure is for gathering two agents in a graph of unknown size. It is due to Ta- Shma and Zwick [48] and relies on the fact that agents have distinct labels. (Using it as a building block in our scenario of anonymous agents is one of the difficulties that we need to overcome.) Each agent knows its own label (which is a parameter of the algorithm) but not the label of the other agent. We will call this procedure T Z((cid:96)), where (cid:96) is the label of the executing agent. In [48], the authors give a polynomial P in two variables, increasing in each of the variables, such that, if there are agents with distinct labels (cid:96)1 and (cid:96)2 operating in a graph of size n, appearing at their starting positions in possibly different times, then they will meet after at most P (n,(cid:96)) rounds since the appearance of the later agent, where (cid:96) is the smaller label. Also, if an agent with label (cid:96)i performs T Z((cid:96)i) for P (n,(cid:96)i) rounds and the other agent is inert during this time, the meeting is guaranteed. We will also use a notion similar to that of the view but reflecting the positions of agents in an initial configuration. Consider a graph G and an initial configuration of agents in this graph. Let v be a node occupied by an agent. The enhanced view from v is the couple (V(v), f ), where f is a binary valued function defined on the set of nodes of V(v), such that f (π) = 1 if there is an agent at the unique node w in G that is reached from v by path π, and f (π) = 0 otherwise. (Recall that nodes of V(v) are paths in G, represented as sequences of port numbers.) Thus the enhanced view of an agent additionally marks in its view the positions of other agents in the initial configuration. An important notion used throughout the paper is the memory of an agent. Intuitively, the memory of an agent in a given round is the total information the agent collected since its wake-up, both by navigating in the graph and by exchanging information with other agents met until this round. This is formalized as follows. The memory of an agent A at the end of some round which is the t-th round since its wake-up, is the sequence (M0, M1, . . . , Mt), where M0 is the information of the agent at its start and Mi is the information acquired in round i. The terms Mi are defined as follows. Suppose that in round i the agent A met agents A1, . . . , Ak at node v of degree d. Suppose that agent A entered node v in round i leaving an adjacent node w by port p and entering v by port q. Suppose that agent Aj entered node v in round i leaving an adjacent node wj by port pj and entering v by port qj. If some agent did not move in round i then the respective ports are replaced by −1. The term Mi for agent A, called its i-th memory box is defined as the sequence (d, p, q,{(p1, q1, R1), . . . , (pk, qk, Rk)}), where Rj is the memory of the agent Aj at the end of round i− 1. This definition is recursive with respect to global time (unknown to agents), starting at the wake-up of the earliest agent by the adversary. Note that if an agent is woken up by the adversary at a node of degree d and no other agents are at this node at this time then M0 = (d,−1,−1,∅) for this agent (at its wake-up the agent sees only the degree of its starting position). If an agent is woken up by some other agents, it also learns their memories to date. Note also that, since the memory of the agent is the total information it acquired to date, any deterministic algorithm used by agents to navigate (including any deterministic gathering algorithm) may be viewed as a function from the set of all memories into the set of integers greater or equal to −1 telling the agent to take a given port p (or stay idle, in which case the output is −1), if it has a given memory. It should be noted that memories of agents may often be (at least) exponential in the size of the graph in which they navigate. 4 If two agents meet, they must necessarily have different memories. Indeed, if they had identical memo- ries, then they would be woken up in the same round and they would traverse identical paths to the meeting node. This contradicts the assumption that agents start at different nodes. We will end this section by introducing the order ≺ on the set M of all possible memories, and the notion of P reft(M) that will be used throughout the paper. Let <α be any linear order on the set of all memory boxes (one such simple order is to code all possible memory boxes as binary sequences in some canonical way and use lexicographic order on binary sequences). Let <β be a lexicographic order on the set M based on the order <α. Now the linear order ≺ on the set M is defined as follows: M1 ≺ M2 if (1) the number of memory boxes of M1 is strictly smaller than that of M2 or (2) M1 and M2 have the same number of memory boxes and M1 <β M2. When M1 ≺ M2 (resp. M2 ≺ M1), we say memory M2 is larger (resp. smaller) than M1. The order ≺ has the property that if the memory of agent A is smaller than the memory of agent B in some round then it will remain smaller in all subsequent rounds. Let A be an agent with a memory M = (M0, M1, . . . , Ms) in round t(cid:48) (with s ≤ t(cid:48)): the memory of agent A in round t for t ≤ t(cid:48) is denoted P reft(M) and is equal to (M0, M1, . . . , Ms−(t(cid:48)−t)) if t(cid:48) − t < s, and to the empty word otherwise. 3 Known upper bound on the size of the graph In this section we assume that a common upper bound N on the size of the graph is known to all agents at the beginning. The aim of this section is to characterize gatherable configurations and give a universal gathering algorithm that gathers with detection all gatherable configurations. The time of such an algorithm is the number of rounds between the wake-up of the first agent and the round when all agents declare that gathering is accomplished. Consider the following condition on an initial configuration in an arbitrary graph. G: There exist agents with different views, and each agent has a unique enhanced view. We will prove the following result. Theorem 3.1 An initial configuration is gatherable if and only if it satisfies the condition G. If a common upper bound N on the size of the graph is known to all agents then there exists an algorithm for gathering with detection all gatherable configurations. This algorithm works in time polynomial in N. In order to appreciate the full strength of Theorem 3.1 notice that it can be rephrased as follows. If an initial configuration does not satisfy condition G then there is no algorithm (even no algorithm dedicated to this specific configuration, knowing it entirely) that permits to gather this configuration, even gather it without detection: simply no algorithm can bring all agents simultaneously to one node. On the other hand, assuming that all agents know a common upper bound on the size of the graph, there is a universal algorithm that gathers with detection all initial configurations satisfying condition G. Our algorithm works in time polynomial in any commonly known upper bound N on the size of the graph. Hence, if this upper bound is polynomial in the size of the graph, the algorithm is polynomial in the size as well. In the next section we will show how the positive part of the result changes when no upper bound on the size of the graph is known. It is also important to stress the global nature of the second part of condition G. While the first part concerns views of individual agents, which depend only on the position of the agent in the graph, the second part concerns enhanced views, which depend, for each agent, on the positions of all agents in the graph. In our algorithms, the actions of each agent eventually depend on its enhanced view, and hence require learning the initial positions of other agents with respect to the initial position of the given agent. (Since not only agents but also nodes are anonymous, no "absolute" positions can ever be learned). This can be done only by meeting other agents and learning these positions, sometimes indirectly, with agent A acting as intermediary in conveying the initial position of agent B to agent C. In short, the execution of a gathering algorithm for 5 an agent depends on the actions of other agents. This is in sharp contrast to rendezvous of two anonymous agents, cf., e.g., [17], where actions of each agent depend only on its view, whose sufficient part (a truncated view) can be constructed individually by each agent without any help from the outside. This is also in sharp contrast with gathering or other tasks performed by two or more labeled agents, when actions of each agent depend on its label known by the agent in advance, and simple decisions based on comparison of labels are made after meetings of subsets of agents when the task involves more than two agents, cf., e.g., [24]. The rest of the section is devoted to the proof of Theorem 3.1. We start with the following lemma. Lemma 3.1 If an initial configuration does not satisfy condition G, then it is not gatherable. Proof. Suppose that an initial configuration C does not satisfy condition G and that agents execute the same deterministic algorithm. First suppose that the configuration C does not satisfy the first part of condition G, i.e., that the views of all agents are identical. Suppose that the adversary wakes up all agents in the same round. We show that no pair of agents can meet. Suppose, for contradiction, that agents A1 and A2 are the first to meet and that this occurs in round t from the common start. Since the initial views of the agents are identical and they execute the same deterministic algorithm, the sequences of port numbers encountered by both agents are identical and hence they both enter the node at which they first meet by the same port. This is a contradiction. Now suppose that the configuration C does not satisfy the second part of condition G, i.e., that there exists an agent whose enhanced view is not unique. Consider distinct agents A and A(cid:48) that have identical enhanced views. Let B be any agent and suppose that q is a sequence of port numbers that leads from agent A to agent B in the enhanced view of agent A. (Notice that there may be many such sequences, corresponding to different paths leading from A to B.) Then there exists an agent B(cid:48) such that q is a sequence of port numbers that leads from agent A(cid:48) to agent B(cid:48) in the enhanced view of agent A(cid:48). Agent B(cid:48) has the same enhanced view as agent B. Since agents A and A(cid:48) were different, agents B and B(cid:48) are different as well. Hence for every agent there exists another agent whose enhanced view is identical. Call such agents homologs. Suppose again that the adversary wakes up all agents in the same round. We will show that, although now some meetings of agents are possible, homologs will never meet. Suppose that agents A and A(cid:48) are homologs. Since A and A(cid:48) have the same enhanced view at the beginning, it follows by induction on the round number that their memory will be identical in every round. Indeed, whenever A meets an agent B in some round, its homolog A(cid:48) meets a homolog B(cid:48) of B in the same round and hence the memories of A and A(cid:48) evolve identically. In particular, since all agents execute the same deterministic algorithm, agents A and A(cid:48) follow identical sequences of port numbers on their paths. As before, if they met for the first time at (cid:3) some node, they would have to enter this node by the same port. This is a contradiction. The other (much more difficult) direction of the equivalence from Theorem 3.1 will be shown by con- structing an algorithm which, executed by agents starting from any initial configuration satisfying condition G, accomplishes gathering with detection of all agents. (Our algorithm uses the knowledge of an upper bound N of the size of the graph: this is enough to prove the other direction of the equivalence, as for any specific configuration satisfying condition G even a gathering algorithm dedicated to this specific configura- tion is enough to show that the configuration is gatherable, and such a dedicated algorithm knows the exact size of the graph. Of course, our algorithm accomplishes much more: knowing just an upper bound on the size of the graph it gathers all configurations satisfying condition G and does this with detection.) We first give a high-level idea of the algorithm, then describe it in detail and prove its correctness. From now on we assume that the initial configuration satisfies condition G. Idea of the algorithm. At high level the algorithm works in two stages. The aim of the first stage for any agent is to meet another agent, in order to perform later an exploration in which one of the agents will play 6 the role of the token and the other the role of the explorer (roles will be decided comparing memories of the agents). To this end the agent starts an exploration of the graph using the known upper bound N on its size. The aim of this exploration is to wake up all, possibly still dormant agents. Afterwards, in order to meet, agents use the procedure T Z mentioned in Section 2. However, this procedure requires a label for each agent and our agents are anonymous. One way to differentiate agents and give them labels is to find their views: a view (truncated to N) from the initial position could serve as a label because the first part of condition G guarantees that there are at least two distinct views. However, it is a priori not at all clear how to find the view of an agent (truncated to N) in time polynomial in N. (Recall that the size of the view truncated to N is exponential in N.) Hence we use procedure SIGN (N ) mentioned in Section 2, which is polynomial in N and can still assign labels to agents after exploring the graph, producing at least two different labels. Then, performing procedure T Z for a sufficiently long time guarantees a meeting for every agent. In the second stage each explorer explores the graph using procedure EXP LO(N ) and then backtracks to its token left at the starting node of the exploration. After the backtrack, memories of the token and of the explorer are updated to check for anomalies caused by other agents meeting in the meantime either the token or the explorer. Note that, due to the fact that some agents may have identical memories at this stage of the algorithm, an explorer may sometimes falsely consider another token as its own, due to their identical memories. By contrast, an end of each backtrack is a time when an explorer can be sure that it is on its token and the token can be sure that its explorer is with it. Explorers repeat these explorations with backtrack again and again, with the aim of creating meetings with other agents and detecting anomalies. As a consequence of these anomalies some agents merge with others, mergers being decided on the basis of the memories of the agents. Each explorer eventually either merges with some token or performs an exploration without anomalies. In the latter case it waits a prescribed amount of time with its token: if no new agent comes during the waiting time, the end of the gathering is declared, otherwise another exploration is launched. It will be proved that eventually, due to the second part of condition G, all agents merge with the same token B and then, after the last exploration made by the explorer A of B and after undisturbed waiting time, the end of the gathering is correctly declared. We now give a detailed description of the algorithm. Algorithm Gathering-with-Detection with parameter N (upper bound on the size of the graph) During the execution of the algorithm an agent can be in one of the following six states: setup, cruiser, shadow, explorer, token, searcher, depending on its memory. For every agent A in state shadow there is exactly one agent B in some state different from shadow, called the guide of A. We will also say that A is a shadow of B. Below we describe the actions of an agent A in each of the states and the transitions between the states. At wake-up agent A enters the state setup. State setup. Agent A performs SIGN (N ) visiting all nodes (and waking up all still dormant agents) and finding the signature of its initial position v, called the label of agent A. Agent A transits to state cruiser. State cruiser. Agent A performs T Z((cid:96)), where (cid:96) is its label, until meeting an agent in state cruiser or token at a node v. When such a meeting occurs, we consider 2 cases. Case 1. Agent A meets an agent B in state token. We consider 2 subcases Subcase 1.1. Agent B is not with its explorer at the time of the meeting. Then agent A transits to state shadow of B. 7 Subcase 1.2. Agent B is with its explorer C at the time of the meeting. Then agent A transits to state shadow of C. Case 2. Agent A does not meet an agent in state token. Then there is at least one other agent in state cruiser at node v (because, as mentionned above, the considered meeting involves an agent in state cruiser or token). We consider 2 subcases. Subcase 2.1. Agent A has the largest memory among all agents in state cruiser at node v. Then agent A transits to state explorer. Subcase 2.2. Agent A does not have the largest memory among all agents in state cruiser at node v. If there is exactly one agent B in state cruiser with memory larger than A at node v, then A transits to state token. Otherwise, it becomes shadow of the agent in state cruiser at node v with largest memory. State shadow. Agent A has exactly one guide and is at the same node as the guide in every round. In every round it makes the same move as the guide. If the guide B transits itself to state shadow and gets agent C as its guide, then agent A changes its guide to C as well. Agent A declares that gathering is over if the unique agent in state explorer collocated with it makes this declaration. Before describing the actions in the three remaining states, we define the notion of seniority of an agent in state token (respectively explorer). The seniority in a given round is the number of rounds from the time when the agent became token (respectively explorer). State explorer When agent A transits to state explorer, there is another agent B that transits to state token in the same round at the same node v. Agent B is called the token of A. Agent A has a variable recent-token that it initializes to the memory of B in this round. Denote by EXP LO∗(N ) the procedure EXP LO(N ) followed by a complete backtrack in which the agent traverses all edges traversed in EXP LO(N ) in the reverse order and the reverse direction. The variable recent-token is updated in the beginning of each execution of EXP LO∗(N ). An execution of EXP LO∗(N ) is called clean if the following condition is satisfied: in each round during this execution, in which A met an agent C that is not in state shadow, the memory of C is equal to that of B, and in each round during this execution, in which the token B was met by an agent D, the memory of D was equal to that of A. Notice that after the execution of EXP LO∗(N ), agent A is together with its token B and thus they can verify if the execution was clean, by inspecting their memories. The execution time of EXP LO∗(N ) is at most 2T (EXP LO(N )). After transiting to state explorer, agent A waits for T (SIGN (N )) + P (N, L) rounds, where L is the largest possible label (it is polynomial in N). Then it executes the following protocol: 8 while A has not declared that gathering is over do do EXP LO∗(N ) /*now agent A is with its token.*/ if in round t(cid:48) agent A met an agent C in state token of higher seniority than that of A or of equal seniority but such that recent-token ≺ P reft(MC) where MC is the memory of agent C and t is the last round before t(cid:48) when agent A updated its variable recent-token then A transits to state searcher if B was visited in round t(cid:48) by an agent C in state explorer of higher seniority than that of B or of equal seniority but such that P reft(MB) ≺ R where MB is the memory of agent B, t is the last round before t(cid:48) when agent C updated its variable recent-token and R is the variable recent-token of agent C in round t(cid:48) then A transits to state searcher until the execution of EXP LO∗(N ) is clean agent A waits 2 · T (EXP LO(N )) rounds: this waiting period is interrupted if A is visited by another agent; if the waiting period of 2 · T (EXP LO(N )) rounds has expired without any interruption then A declares that gathering is over. endwhile State token When agent A transits to state token, there is another agent B that transits to state explorer in the same round at the same node v. Agent B is called the explorer of A. Agent A remains idle at a node v and does not change its state, except when its explorer B transits to state searcher. In this case it transits to state shadow and B becomes its guide. Agent A declares that gathering is over if the unique agent in state explorer collocated with it makes this declaration. State searcher Agent A performs an entire execution of EXP LO∗(N ) until its termination, regardless of any meet- ings it could make during this execution. Then the agent starts another execution of EXP LO∗(N ) which is stopped as soon as agent A meets an agent B in state token. If at the time of the meeting agent B is not with its explorer C then agent A transits to state shadow of B (B becomes its guide). Otherwise, agent A transits to state shadow of C (C becomes its guide). The proof of the correctness of the algorithm is split into the following lemmas. Lemma 3.2 In Algorithm Gathering-with-Detection every agent eventually stops after time polynomial in N and declares that gathering is over. Proof. At its wake-up an agent A enters state setup and remains in it for at most T (SIGN (N )) rounds (the time to complete an exploration and find its label (cid:96)) and then transits to state cruiser. We will prove that in state cruiser agent A can spend at most T (SIGN (N )) + 2P (N, (cid:96)) rounds. We will use the 9 following claim. Claim 1. Let t be the first round, if any, in which an agent transits to state token. Then there exists an agent B that remains in state token and is idle from round t on. To prove the claim, let Z be the set of agents that transited to state token in round t. In every round t(cid:48) > t, each agent from Z with the current largest memory remains in state token and stays idle. Indeed, the reasons why such an agent, call it X, could leave the state token in round t(cid:48) all lead to a contradiction. There are four such reasons. • Case 1. The token X was visited by an agent in state explorer of higher seniority. We get a contradiction with the fact that the agents belonging to Z have the highest seniority. • Case 2. The explorer of the token X met an agent Y in state token of higher seniority. Since the explorer of X has the same seniority as X, by transitivity the seniority of agent Y is higher than that of agent X which is a contradiction with the definition of Z. • Case 3. In round k < t(cid:48) the token X was visited by an agent Y in state explorer of equal seniority but such that P refs(MX ) ≺ R where MX is the memory of agent X, s is the last round before k when agent Y updated its variable recent-token and R is the variable recent-token of agent Y in round k. This case is impossible. Indeed, by definition, agent X has one of the highest memories among the agents from Z in round t(cid:48). Hence, according to the definition of order ≺ given in Section 2, agent X had one of the highest memories among the agents from Z in all rounds between t and t(cid:48). Moreover, since Y and X have the same seniority, this implies that the token of Y belongs to Z. Hence, in round s the memory of agent X is greater than or equal to the memory of the token of Y , which is a contradiction with P refs(MX ) ≺ R. • Case 4. In round k < t(cid:48) the explorer of the token X met an agent Y in state token of equal seniority but such that R ≺ P refs(MY ) where MY is the memory of agent Y , s is the last round before k when the explorer of X updated its variable recent-token, and R is the variable recent-token of the explorer of X in round k. Similarly as before, we can get a contradiction with the fact that R ≺ P refs(MY ). the agents in Z in all previous rounds, the claim follows. Since an agent with the largest memory in Z in a given round must have had the largest memory among • In order to prove our upper bound on the time spent by A in state cruiser, observe that after at most T (SIGN (N )) rounds since A transits to state cruiser, all other agents have quit state setup. Consider the additional 2P (N, (cid:96)) rounds during which agent A performs T Z((cid:96)). Let round τ be the end of the first half of this segment S of 2P (N, (cid:96)) rounds. Some meeting must have occurred on or before round τ, due to the properties of T Z. If agent A was involved in one of those meetings, it left state cruiser by round τ. Otherwise, it must have met some other agent in state either cruiser or token during the second half of the segment S. Indeed, if it does not meet another agent in state cruiser, it must meet another agent in state token, which transited to this state by round τ. (Claim 1 guarantees the existence of such an agent after round τ.) This proves our upper bound on the time spent by A in state cruiser. From state cruiser agent A can transit to one of the three states: shadow, explorer or token. To deal with the state shadow, we need the following claim. Claim 2. If agent A becomes the shadow of an agent B in some round t, then agent B cannot itself switch to state shadow in the same round. To prove the claim, there are 3 cases to consider. 10 • Case 1. Agent A transits from state token to state shadow in round t. According to the algorithm, agent B is an explorer transiting to state searcher in round t. • Case 2. Agent A transits from state searcher to state shadow in round t. According to the algorithm, B is -- either an agent in state token that is not with its explorer in round t, in which case agent B remains in state token in round t -- or an agent in state explorer. However an agent in state explorer cannot switch directly to state shadow. Hence B cannot transit to state shadow in round t. • Case 3. Agent A transits from state cruiser to state shadow in round t. According to the algo- rithm, B is either in one of the situations described in Case 2, in which case B does not switch to state shadow in round t, or B is an agent in state cruiser that transits to state explorer. • In all cases, B does not switch to state shadow in round t, which proves the claim. In view of Claim 2 and of the fact that the termination conditions for an agent in state shadow are the same as of its guide, we may eliminate the case of state shadow from our analysis. Consider an agent A in state explorer. After waiting time of T (SIGN (N )) +P (N, L) rounds, where L is the largest possible label (it is polynomial in N), agent A knows that all other agents have already transited from the state cruiser (they used at most T (SIGN (N )) rounds in state setup and at most P (N, L) rounds in state cruiser, as their labels are at most L and at least one token is already present in the graph). In what follows, we show that, after at most a polynomial time ρ, agent A either leaves state explorer or declares that gathering is over. In order to prove this, we first compute an upper bound on the number of non-clean explorations EXP LO∗(N ) that can be performed by agent A as an explorer. An exploration could be non-clean due to several reasons, according to the description of the algorithm. • In round t(cid:48) agent A met an agent C in state token of higher seniority than that of A, or of equal seniority but such that recent-token ≺ P reft(MC), where t is the last round before round t(cid:48) when the variable recent-token of A was updated. According to the algorithm, agent A transits to state searcher as soon as it terminates its exploration EXP LO∗(N ) after round t(cid:48). Hence such a meeting can make at most 1 non-clean exploration. • In round t(cid:48) the token B of A was visited by an agent C in state explorer of higher seniority than that of B, or of equal seniority but such that P reft(MB) ≺ R, where R is the variable recent- token of agent C and t is the last round before round t(cid:48) when the variable recent-token of C was updated. According to the algorithm, agent A transits to state searcher as soon as it terminates its exploration EXP LO∗(N ) after round t(cid:48). Hence such a meeting can make at most 1 non-clean exploration. • Either agent A or its token B met an agent in state searcher. Since the lifespan of a searcher is at most the time of two consecutive executions of EXP LO∗(N ), it can overlap at most three con- secutive executions of this procedure. Hence one searcher can make non-clean at most 6 explorations (3 by meeting A and 3 by meeting B). Since there are at most N searchers, this gives at most 6N non-clean explorations. • In round t(cid:48) agent A met an agent C in state token of lower seniority than that of A, or of equal seniority but such that P reft(MC) ≺ recent-token, where t is the last round before t(cid:48) when the 11 variable recent-token of A was updated. After this meeting, the remaining time when agent C remains in state token is at most the duration of one execution of EXP LO∗(N ) (after at most this time the explorer of C becomes searcher and hence C transits to state shadow). This time can overlap at most two consecutive executions of EXP LO∗(N ), hence such meetings can make at most 2N non-clean explorations. • In round t(cid:48) the token B of A met an agent C in state explorer of lower seniority than that of B, or of equal seniority but such that recent-token ≺ P reft(MB) (where t is the last round before round t(cid:48) when the variable recent-token of C was updated). A similar analysis as in the previous case shows that such meetings can make at most 2N non-clean explorations. • Agent A met an agent C in state explorer. The memories of the two agents at this time are different. After this meeting, the remaining time when agent C remains in state explorer is at most the duration of two consecutive executions of EXP LO∗(N ) because after the return of C on its token, the tokens of A and C have different memories and hence after another exploration, C must become a searcher. Indeed, since by assumption A remains in state explorer till the end of the algorithm, we must have R ≺ P reft(MB), where R is the variable recent-token of C at the time t, where t is the first round after the meeting of A and C, in which agent C updated its variable recent-token. This gives at most 3N non-clean explorations. • A met an agent C in state token in round s, that looked like its token B at this time, but that turned out not to be the token B after the backtrack of A on B. More precisely, recent-token = P reft(Mc) in round s (where t is the last round before round s when the variable recent-token of A was updated) but P refs(MB) (cid:54)= P refs(MC). After round s agent C remains in state token for at most the duration of two executions of EXP LO∗(N ). This gives at most 3N non-clean explorations. • In round t(cid:48) the token B was visited by an agent C of equal seniority in state explorer such that recent-token = P reft(MB), where t is the last round before t(cid:48) when the variable recent-token of C was updated and this agent turned out not to be A after the backtrack of A on B. Similarly as before, this gives at most 3N non-clean explorations. Hence there can be at most 19N + 2 non-clean executions of EXP LO∗(N ) for agent A (notice that, e.g., an agent can make non-clean one exploration in the state explorer and then in the state searcher, hence for simplicity we add all the above upper bounds). A similar analysis shows that during at most 19N + 2 waiting periods of a duration 2T (EXP LO(N )) agent A can be met by a new agent. Recall that before performing the first execution of EXP LO∗(N ) agent A has been waiting for T (SIGN (N )) + P (N, L) rounds. Hence if agent A has not left state explorer after at most ρ = T (SIGN (N )) + P (N, L) + (38N +5)(4T (EXP LO(N )) rounds since it transited to state explorer, there has been a clean execution of EXP LO∗(N ) followed by a waiting period without any new agent coming during the period of ρ rounds, and thus agent A declares that gathering is over by the end of this period. Otherwise, agent A transits to state searcher before spending ρ rounds in state explorer, in which case it uses at most 2·T (EXP LO(N )) rounds for one execution of EXP LO∗(N ) and after additional at most 2 · T (EXP LO(N )) rounds it finds an idle agent X in state token (claim 1 guarantees the existence of such an agent): it then becomes the shadow of either X or of the explorer of X. It remains to consider an agent A in state token. From this state, either at some point the agent transits to state shadow or it remains in state token till the end of the algorithm. In this latter case, its explorer declares that gathering is over after at most T (SIGN (N )) + P (N, L) + (38N + 5)(4T (EXP LO(N )) rounds since it transited to state explorer. However, as soon as an explorer declares that gathering is over, its token does the same. So, agent A declares that gathering is over after at most T (SIGN (N )) + 12 P (N, L) + (38N + 5)(4T (EXP LO(N )) rounds since it transited to state token (recall that, according to the algorithm, agent A and its explorer have reached their current state at the same time). Hence every agent eventually terminates. We conclude by observing that the execution time of the entire algorithm is upper bounded by the sum of the following upper bounds: • the time between the wake up of the first agent and the time of the wake up of an agent A that will be in state explorer when declaring that gathering is over; this time is upper bounded by T (SIGN (N )). • the time that such an agent A spends in state setup and cruiser • the time that such an agent A spends in state explorer We have shown above that each of these upper bounds is O(T (SIGN (N ))+P (N, L)+N·T (EXP LO(N ))), where L is polynomial in N. Since the values of T (EXP LO(N )), T (SIGN (N )) and P (N, L) are all polynomial in N, this proves that the running time of Algorithm Gathering-with-Detection is polynomial in (cid:3) N. In the sequel we will use the following notion, which is a generalization of the enhanced view of a node. Consider a configuration of agents in any round. Color nodes v and w with the same color if and only if they are occupied by agents A1, . . . , Ar and B1, . . . , Br, respectively, where Ai and Bi have the same memory in this round. A colored view from node v is the view from v in which nodes are colored according to the above rule. In view of Lemma 3.2, all agents eventually declare that gathering is over. Hence the final configuration must consist of agents in states explorer , token and shadow, all situated in nodes v1, . . . , vk, such that in each node vi there is exactly one agent Ei in state explorer, exactly one agent Ti in state token and possibly some agents in state shadow. Call such a final configuration a clone configuration if there are at least two distinct nodes vi, vj which have identical colored views. We will first show that the final configuration cannot be a clone configuration and then that it must consist of all agents gathered in a unique node and hence our algorithm is correct. Lemma 3.3 The final configuration cannot be a clone configuration. Proof. Suppose for contradiction that the final configuration in round f contains distinct nodes which have identical colored views. Let A be one of the agents woken up earliest by the adversary. There exists an agent A(cid:48) (also woken up earliest by the adversary) which has an identical memory as A and an identical colored view. Notice that if two agents have the same memory at time t they must have had the same memory at time t − 1. Since colors in a colored view are decided by memories of agents, this implies (by a backward induction on the round number) that the colored views of A and A(cid:48) are the same in each round after their wake-up, and in particular in the round of their wake-up. In this round no agent has moved yet and hence each agent is in a different node. Hence colored views in this round correspond to enhanced views. Thus we can conclude that the enhanced views from the initial positions of agents A and A(cid:48) were identical, which (cid:3) contradicts the assumption that in the initial configuration every agent has a unique enhanced view. Lemma 3.4 In the final configuration all agents must be at the same node. Proof. It follows from the formulation of the algorithm that at least one agent transits to state token. By Claim 1 in the proof of Lemma 3.2, there exists an agent that remains in the state token till the end of the algorithm. By Lemma 3.2, this agent declares that gathering is over. Let B be the first (or one of the first) agents in state token that declares that gathering is over. Let A be its explorer. Let τ0 be the round in which 13 agent A starts its last exploration EXP LO∗(N ). Let τ1/2 be the round in which backtrack begins during this execution. Let τ1 be the round in which this backtrack (and hence the execution of EXP LO∗(N )) is finished, and let τ2 be the round in which A declares that gathering is over. Claim 1. In round τ0 all agents in state token have the same memory. In order to prove the claim we first show that all agents in state token in round τ0 have the same seniority. Observe that there cannot be any agent in state token of higher seniority than B: at least one of such agents would be seen by A during its last clean exploration EXP LO∗(N ) between rounds τ0 and τ1 contradicting its cleanliness. Also there cannot be any agent C in state token of lower seniority than B. Indeed, let D be the explorer of C. Either D becomes a searcher between τ0 and τ1 and thus it meets the token B before time τ2 which contradicts the declaration of A and B at time τ2 or it remains an explorer, in which case C remains a token between τ0 and τ1 and thus C is visited by A during its last clean exploration, contradicting its cleanliness. This shows that all agents in state token in round τ0 have the same seniority. Hence their explorers start and finish EXP LO∗(N ) at the same time. Consequently no token existing in round τ0 can transit to state shadow before round τ1. Agent A must have seen all these tokens during its last exploration. It follows that the memory of each such token in round τ0 must be equal to the memory of B at this time: otherwise, agent A would detect such a discrepancy during its last • exploration, which would contradict the cleanliness of this exploration. This proves Claim 1. Claim 1 implies that in time τ0 all agents in state explorer have the same memory. Indeed, since at time τ0 agent A is together with B, each explorer must be with its token, since tokens have the same memory. Claim 2. In round τ0 there are no agents in state searcher. Suppose for contradiction that there is a searcher S in round τ0. Recall that S performs two explo- rations: one entire exploration EXP LO∗(N ) and another partial exploration EXP LO∗(N ) until meeting a token or an explorer. Case 1. S finished its first exploration EXP LO∗(N ) by round τ0. Hence its second exploration ends by round τ1. It could not end by round τ0 because S would not be a searcher in this round anymore. If it ended between τ0 and τ1, it must have met a token C. By Claim 1, all explorers have the same seniority and hence at time τ1 the explorer D of C backtracked to C. This exploration is not clean for D. Either D becomes a searcher at time τ1 and thus meets A and B before time τ2, contradicting their declaration at time τ2, or D starts another EXP LO∗(N ) and it meets itself A and B before time τ2, contradicting their declaration at time τ2. This shows that the second exploration of S cannot end between τ0 and τ1, hence Case 1 is impossible. Case 2. S finished its first exploration EXP LO∗(N ) between τ0 and τ1/2. Hence it must visit some token C during its second exploration (and before starting the backtrack) by round τ1. As before, this contradicts the declaration of A and B at time τ2. Case 3. S finished its first exploration EXP LO∗(N ) between τ1/2 and τ1. Hence the entire backtrack during this first exploration took place between rounds τ0 and τ1. During this backtrack, S visited some token. As before, this contradicts the declaration of A and B at time τ2. Case 4. S finished its first exploration EXP LO∗(N ) after round τ1. This is impossible, as it would not be in state searcher in round τ0. • Claim 3. Let E be the set of agents in state explorer in round τ0. In round τ1/2 every agent from E can reconstruct its colored view in round τ0. To prove the claim first note that since agent A starts its last exploration in round τ0 and all agents from E have the same memory in round τ0, they all start an exploration EXP LO∗(N ) in this round. In round This concludes the proof of Claim 2. 14 τ1/2 every agent from E has visited all nodes of the graph and starts its backtrack. In round τ0 there are no agents in state setup or cruiser, in view of the waiting time when A transited to state explorer, and there are no agents in state searcher by Claim 2. Hence the visit of all nodes between rounds τ0 and τ1/2 permits to see all agents that were tokens at time τ0. Since at this time every explorer were with its token, this permits to reconstruct the memories and the positions of all agents in round τ0. This is enough to • reconstruct the colored views of all agents in round τ0, which proves the claim. To conclude the proof of the lemma it is enough to show that in round τ0 only one node is occupied by agents, since this will be the final configuration. Suppose that nodes v (cid:54)= v(cid:48) are occupied in this round. Let A be the explorer at v and A(cid:48) the explorer at v(cid:48). Note that the colored views of A and A(cid:48) in round τ0 must be different, for otherwise the configuration in round τ0 would be a clone configuration, and consequently the final configuration would also be clone, contradicting Lemma 3.3. Since, by Claim 3, in round τ1/2 each of the agents A and A(cid:48) has reconstructed its colored view in round τ0, their memories in round τ1/2 are different. Between rounds τ1/2 and τ1, during its backtrack, agent A(cid:48) has visited again all tokens, in particular the token of A. Hence A, after backtracking to its token in round τ1, realizes that another explorer has visited its token, which contradicts the cleanliness of the last exploration of A. This contradiction shows that in round τ0 only one node is occupied and hence the same is true in the final configuration. This (cid:3) concludes the proof of the lemma. Now the proof of Theorem 3.1 follows directly from Lemmas 3.1, 3.2, and 3.4. 4 Unknown upper bound on the size of the graph In this section we show that, if no upper bound on the size of the graph is known, then there is no universal algorithm for gathering with detection all gatherable configurations. Nevertheless, we still show in this case a universal algorithm that gathers all gatherable configurations: all agents from any gatherable configuration eventually stop forever at the same node (although no agent is ever sure that gathering is over). The time of such an algorithm is the number of rounds between the wake-up of the first agent and the last round in which some agent moves. Our algorithm is polynomial in the (unknown) size of the graph. We first prove the following negative result. Theorem 4.1 There is no universal algorithm for gathering with detection all gatherable configurations in all graphs. Proof. Consider the following initial configurations. In configuration C the graph is a 4-cycle with clock- wise oriented ports 0,1 at each node, and with additional nodes of degree 1 attached to two non-consecutive nodes. There are two agents starting at a node of degree 2 and at its clockwise neighbor, cf. Fig. 1 (a). In configuration Dn, for n = 4k, the graph is constructed as follows. Take a cycle of size n with clockwise oriented ports 0,1 at each node. Call clockwise consecutive nodes of the cycle v0, . . . , vn−1 (names are used only to explain the construction) and attach two nodes of degree 1 to v0 and one node of degree 1 to every other node with even index. Initial positions of agents are at nodes vi, where i = 4j or i = 4j − 1, for some j, cf. Fig. 1 (b). Each of the configurations C and Dn, for n ≥ 8, is gatherable. Indeed, in each of these configurations there exist agents with different views (agents starting at nodes of degree 2 and of degree 3) and each agent has a unique enhanced view (this is obvious for configuration C and follows from the existence of a unique node of degree 4 for configurations Dn). Hence each of these configurations satisfies condition G and consequently, by Theorem 3.1, there is an algorithm for gathering with detection each specific configuration, as such a dedicated algorithm knows the configuration and hence may use the knowledge of the size of the graph. It remains to show that there is no universal algorithm that gathers with detection all configurations C and Dn. Suppose, for contradiction, that A is such an algorithm. Suppose that the adversary wakes up 15 Figure 1: Configurations C and D8 in the proof of Theorem 4.1. Black nodes are occupied by agents all agents simultaneously and let t be the time after which agents in configuration C stop at the same node and declare that gathering is over. Consider the configuration D8t and two consecutive agents antipodal to the unique node of degree 4, i.e., starting from nodes v4t and v4t−1. Call X the agent starting at a node of degree 2 in configuration C and call Y the agent starting at its clockwise neighbor (of degree 3) in this configuration. Call X(cid:48) the agent starting at node v4t−1 and call Y (cid:48) the agent starting at node v4t in configuration D8t. (Again names are used only to explain the construction.) In the first t rounds of the executions of algorithm A starting from configurations C and D8t the memories of the agents X and X(cid:48) and of the agents Y and Y (cid:48) are the same. This easily follows by induction on the round number. Hence after t rounds agents X(cid:48) and Y (cid:48) starting from configuration D8t stop and (falsely) declare that gathering is over. This contradicts universality of algorithm A. (cid:3) Our final result is a universal algorithm gathering all gatherable configurations, working without any additional knowledge. It accomplishes correct gathering and always terminates but (as opposed to Algorithm Gathering-with-Detection which used an upper bound on the size of the graph), this algorithm does not have the feature of detecting that gathering is over. We first present a high-level idea of the algorithm, then describe it in detail and prove its correctness. Recall that we assume that the initial configuration satisfies condition G (otherwise gathering, even without detection, is impossible by Lemma 3.1). Idea of the algorithm. Since in our present scenario no upper bound on the size of the graph is known, already guaranteeing any meeting between agents must be done differently than in Algorithm Gathering-with-Detection. After wake-up each agent proceeds in phases i = 1, 2, . . . , where in phase i it "supposes" that the graph has size at most 2i. In each phase an appropriate label based on procedure SIGN (2i) is computed and procedure T Z is performed sufficiently long to guarantee a meeting at most at the end of phase (cid:100)log2 m(cid:101), where m is the real size of the graph. If no meeting occurs in some phase for a sufficiently long time, the agent starts the next phase. 16 0000111122000000000011111112220000023 (a) CONFIGURATION C (b) CONFIGURATION D8 Another important difference occurs after the meeting, when one of the agents becomes an explorer and the other its token. Unlike in the case of known upper bound on the size of the graph, there is no way for any explorer to be sure at any point of the execution that it has already visited the entire graph. Clearly procedure EXP LO(m) cannot give this guarantee, as m is unknown, and procedure EST of exploration with a stationary token, which does not require the knowledge of an upper bound, cannot give this guarantee either, as an explorer cannot be always sure that it visits its own token, because memories of several agents playing the role of the token can be identical at various stages of the execution, and hence these "tokens" may be undistinguishable for the explorer. Nevertheless, our algorithm succeeds in accomplishing the task by using a mechanism which is analo- gous to the "butterfly effect". Even a slight asymmetry in a remote part of the graph is eventually commu- nicated to all agents and guarantees that at some point some explorer will visit the entire graph (although in some graphs no explorer can ever be sure of it at any point of an execution) and then all agents will eventually gather at the token of one of these explorers. Making all agents decide on the same token uses property G and is one of the main technical difficulties of the algorithm. Algorithm Gathering-without-Detection Similarly as in Algorithm Gathering-with-Detection, an agent can be in one of the following five states: traveler, shadow, explorer, token, searcher. State traveler partly combines the roles of previous states setup and cruiser. For every agent A in state shadow the notion of guide is defined as before. Below we describe the actions of an agent A in each of the states and the transitions between the states. At wake-up agent A enters the state traveler. State traveler. In this state agent A works in phases i = 1, 2, . . . . In phase i the agent supposes that the graph has size at most n = 2i. Agent A performs SIGN (2i) in order to visit all nodes (and wake up all still dormant agents), if the assumption is correct, and find the current signature of its initial position v, called the label (cid:96)n = (cid:96)2i of agent A. Let L2i be the maximum possible label of an agent in phase i. (Note that L2i is polynomial in n). Then agent A performs T Z((cid:96)n) for ∆n rounds, where ∆n = ∆2i = T (SIGN (2i)) + 2P (2i, L2i) + Σi−1 j=1Qj, for n ≥ 4 (i.e., i ≥ 2), and ∆2 = T (SIGN (2)) + 2P (2, L2). In the formula for ∆n, Qj is defined as T (SIGN (2j)) + ∆2j and is an upper bound on the duration of phase j. Note that by induction on i we can prove that ∆2i = T (SIGN (2i)) + 2P (2i, L2i) + Σi−1 j=1[2j(T (SIGN (2(i−j))) + P (2(i−j), L2(i−j)))]. Hence ∆n is upper-bounded by 2ii(T (SIGN (2i)) + 2P (2i, L2i)) = n log2(n)(T (SIGN (n)) + 2P (n, Ln)) which is a polynomial in n. If no agent has been met during phase i, agent A starts phase i + 1. As soon as another agent is met in some phase k, agent A interrupts this phase and transits either to state shadow or token or explorer. Suppose that the first meeting of agent A occurs in round t at node v. Case 1. There are some agents in round t at node v which are either in state searcher, or explorer or token . Let H be the set of these agents. Subcase 1.1. There are some agents in H that are either in state explorer or token. Let I be the set of all those agents in H. Agent A transits to state shadow and its guide is the agent having the largest memory in set I. Subcase 1.2. There is no agent in H that is either in state explorer or token. Agent A transits to state shadow and its guide is the agent in state searcher having the largest memory in set H. Case 2. There are only agents in state traveler in round t at node v. Subcase 2.1. Agent A has the largest memory among all agents in round t at node v. Then agent A transits to state explorer. Subcase 2.2. Agent A does not have the largest memory among all agents in round t at node v. 17 If there is exactly one agent B with memory larger than A, then agent A transits to state token. Otherwise, it transits to state shadow of the agent with largest memory. (Note that cases 1 and 2 cover all possibilities because an agent in state shadow always accompanies its guide and this guide cannot be an agent in state traveler.) State shadow. Agent A has exactly one guide and is at the same node as the guide in every round. In every round it makes the same move as the guide. If the guide B transits itself to state shadow and gets agent C as its guide, then agent A changes its guide to C as well. In the description of the actions in the three remaining states, we will use the notion of seniority defined for Algorithm Gathering-with-Detection. State explorer. When agent A transits to state explorer, there is another agent B that transits to state token in the same round at the same node v. Agent B is called the token of A. Agent A has a variable recent-token that it initializes to the memory of B in this round. We first define the notion of a consistent meeting for agent A. Let t be the last round when agent A updated its variable recent-token. A consistent meeting for A is a meeting in round t(cid:48) > t with an agent C in state token of the same seniority as A, such that M is the current memory of C and P reft(M) = recent-token. Intuitively, a consistent meeting is a meeting of an agent that A can plausibly consider to be its token B. Note that, according to this definition, a meeting in the round when the variable recent-token is updated, is not a consistent meeting. We now briefly describe the procedure EST based on [13] that will be subsequently adapted to our needs and which allows an agent to construct a BFS tree of the network provided that it cannot confuse its token with another one. The agent constructs a BFS tree rooted at its starting node r marked by the stationary token. In this tree it marks port numbers at all nodes. During the BFS traversal, some nodes are added to the BFS tree. In the beginning, the agent adds the root r and then it makes the process of r. The process of a node w consists in checking all the neighbors of w in order to determine whether some of them have to be added to the tree or not. When an agent starts the process of a node w, it goes to the neighbor reachable via port 0 and then checks the neighbor. When a neighbor v of w gets checked, the agent verifies if v is equal to some node previously added to the tree. To do this, for each node u belonging to the current BFS tree, the agent travels from v using the reversal q of the shortest path q from r to u in the BFS tree (the path q is a sequence of port numbers). If at the end of this backtrack it meets the token, then v = u: in this case v is not added to the tree as a neighbor of w and is called w-rejected. If not, then v (cid:54)= u. Whether node v is rejected or not, the agent then comes back to v using the path q. If v is different from all the nodes of the BFS tree, then it is added to the tree. Once node v is added to the tree or rejected, the agent makes an edge traversal in order to be located at w and then goes to a non-checked neighbor of w, if any. The order, in which the neighbors of w are checked, follows the increasing order of the port numbers of w. When all the neighbors of w are checked, the agent proceeds as follows. Let X be the set of the shortest paths in the BFS tree leading from the root r to a node y having non-checked neighbors. If X is empty then procedure EST is completed. Otherwise, the agent goes to the root r, using the shortest path from w to r in the BFS tree, and then goes to a node y having non-checked neighbors, using the lexicographically smallest path from X. From there, the agent starts the process of y. Note that given a graph G of size at most n, every execution of EST in G lasts at most 8n5 rounds. Indeed, processing every node v takes at most 4n3 rounds (because each node v has at most n− 1 neighbors, checking a neighbor of v takes at most 2n2 rounds, and before (resp. after) each checking of a neighbor w of v, the agent makes an edge traversal from v to w (resp. w to v)). Considering the fact that there are at 18 most n nodes to process in G and the fact that moving from a node that has been processed to the next node to process costs at most 2n rounds, we get the upper bound of 8n5 rounds. Hereafter we define T (EST (n)) as being equal to 8n5. The procedure EST (cid:48) is a simulation of EST with the following two changes. The first change concerns the beginning of the execution of EST (cid:48) when the agent is with its token: it updates its variable recent-token w.r.t to the current memory of its token. The second change concerns meetings with the token. Consider a verification if a node w , which is getting checked, is equal to some previously constructed node u. This verification consists in traveling from w using the reverse path q, where q is the path from the root r to u in the BFS tree and checking the presence of the token. If at the end of the simulation of path q in EST (cid:48) agent A makes a consistent meeting, then it acts as if it saw the token in EST ; otherwise it acts as if it did not see the token in EST . To introduce the next proposition, we first need to define the notion of a truncated spanning tree. We say that a tree T is a truncated spanning tree of a graph G if T can be obtained from a spanning tree of G by removing one or more of its subtrees. Proposition 4.1 Given a graph G of size of at most n (unknown to the agents), the following two properties hold: (1) every execution of EST (cid:48) in G lasts at most T (EST (n)) rounds and (2) every execution of EST (cid:48) produces a spanning tree of G or a truncated spanning tree of G. Proof. If the agent never confuses its token with another one, the proposition follows directly. So in this proof, we focus only on the situations where there are possible confusions among tokens. When such confusions may occur? The execution of procedure EST (cid:48) consists of alternating periods of two different types. The first one corresponds to periods when the agent processes a node and the second one corresponds to those when the agent moves to the next node to process it. During the periods of the second type, an agent does not use any token to move: it follows the same path regardless of whether it meets some token or not on its path. Hence, an agent can confuse its token with another one only in periods of the first type. During such periods, an agent may indeed be "mislead" by a token which is not its own token, when verifying whether a node has to be rejected or not, by wrongly rejecting a node. This leads to the construction of a spanning tree which is truncated, which proves the second property of the proposition. Concerning the first property, note that, as for procedure EST , every execution of EST (cid:48) in G lasts at most 8n5. Indeed, processing every node v also takes at most 4n3 rounds (as each node v has at most n − 1 neighbors, checking a neighbor of v takes at most 2n2 rounds, and before (resp. after) each checking of a neighbor w of v, the agent makes an edge traversal from v to w (resp. w to v)). Besides, still for the same reasons as for procedure EST , there are at most n nodes to process in G and moving from a node that has been processed to the next node to process costs at most 2n rounds. Hence, we also obtain the upper bound (cid:3) of 8n5 rounds. Since T (EST (n)) = 8n5, the first property of the proposition follows. The procedure EST ∗ is a simulation of EST (cid:48) with the following change. Suppose that the execution of EST (cid:48) produced the route α of the agent. In procedure EST ∗, upon completing procedure EST (cid:48), the agent traverses the reverse route α and then again α and α. Hence in procedure EST ∗ the agent traverses the concatenation of routes α, α, α, α. These parts of the trajectory will be called, respectively, the first, second, third and fourth segment of EST ∗. The variable recent-token is updated at the beginning of the first and third segment of EST ∗. Note that in these rounds agent A is certain to be with its token. The (possibly truncated) spanning tree resulting from the simulation EST ∗ is the (possibly truncated) spanning tree resulting from the execution of the first segment. In view of the description of procedure EST ∗ and Proposition 4.1, we have the following proposition. 19 Proposition 4.2 Given a graph G of size n (unknown to the agents), the following two properties hold: (1) every execution of EST ∗ in G lasts at most 4T (EST (n)) rounds and (2) every execution of EST ∗ produces a spanning tree of G or a truncated spanning tree of G. Similarly as for EXP LO∗(n), an execution of EST ∗ is called clean if the following condition is satisfied: in each round during this execution, in which A met an agent C that is not in state shadow, the memory of C is equal to that of B, and in each round during this execution, in which the token B was met by an agent D, the memory of D was equal to that of A. Notice that after the execution of EST ∗, agent A is together with its token B and thus they can verify if the execution was clean, by inspecting their memories. After transiting to state explorer, agent A executes the following protocol: repeat forever /*Before the first turn of the loop agent A has just entered state explorer and is with its token. After each turn of the loop, agent A is with its token, waiting after a clean exploration.*/ if A has just transited to state explorer or A has just been visited by another agent then do EST ∗ if in round t(cid:48) agent A met an agent C in state token of higher seniority than that of A or of equal seniority but such that recent-token ≺ P reft(MC) where MC is the memory of agent C and t is the last round before round t(cid:48) when agent A updated its variable recent-token then A transits to state searcher if in round t(cid:48) agent A met another agent C in state explorer, such that either the seniority of C is higher than that of A, or these seniorities are equal but P refmin(tA,tC )(RA) ≺ P refmin(tA,tC )(RC), where RA (resp. RC) is the value of the variable recent-token of A (resp. C) at the time of the meeting and tA (resp. tC) is the last round before t(cid:48) when agent A (resp. C) updated its variable recent-token then A transits to state searcher if B was visited in round t(cid:48) by an agent C in state explorer of higher seniority than that of B or of equal seniority but such that P reft(MB) ≺ R, where MB is the memory of agent B, R is the variable recent-token of agent C in round t(cid:48), and t is the last round before t(cid:48) when the variable R was updated then A transits to state searcher until the execution of EST ∗ is clean State token. When agent A transits to state token, there is another agent B that transits to state explorer in the same round at the same node v. Agent B is called the explorer of A. Agent A remains idle at a node v and does not change its state, except when its explorer B transits to state searcher. In this case it transits to state shadow and B becomes its guide. State searcher After transiting to state searcher agent A performs the sequence of explorations EXP LO(n) for n = 1, 2, 3, . . . , until it meets an agent in state token or explorer in round t. Let S be the set of these agents met by A in round t. Agent A transits to state shadow and its guide is the agent from S with largest 20 memory. The analysis of the algorithm is split into the following lemmas. Lemma 4.1 In Algorithm Gathering-without-Detection every agent eventually stops after time polynomial in the size of the graph. Proof. Let m be the size of the graph (unknown to the agents). Let i = (cid:100)log2 m(cid:101). Let A be any agent. We may assume that at some point A is woken up (otherwise it would be idle all the time). We will first show that A must meet some other agent at the end of phase i at the latest. To this end, we need to prove the following claim. Claim 1. Let t be the first round, if any, in which an agent transits to state token. Then there exists an agent B that remains in state token and is idle from round t on. To prove the claim, let Z be the set of agents that transited to state token in round t. In every round t(cid:48) > t, the agent from Z with the current largest memory remains in state token and stays idle. Indeed, the reasons why such an agent, call it X, could leave the state token in round t(cid:48) all lead to a contradiction. There are six such reasons: four of them are identical to those given in Claim 1 of the proof of Lemma 3.2. Hence to show the validity of the claim, we only need to deal with the two remaining reasons which are the following ones. • The explorer of token X, denoted E, met an agent Y in state explorer of higher seniority. Since agent E has the same seniority as agent X, by transitivity the seniority of agent Y (and of its token) is higher than that of agent X, which is a contradiction with the definition of Z. • In round k < t(cid:48) the explorer of token X, denoted E, met an agent Y in state explorer of equal seniority but such that P refmin(tE ,tY )(RE) ≺ P refmin(tE ,tY )(RY ), where RE (resp. RY ) is the value of the variable recent-token of E (resp. Y ) at the time of the meeting and tE (resp. tY ) is the last round before k when agent E (resp. Y ) updated its variable recent-token. This case is impossible. Indeed, by definition, agent X is among the agents having the highest memory among the agents from Z in round t(cid:48). Hence, according to the definition of order ≺ given in Section 2, agent X was among the agents having the highest memory among the agents from Z in all rounds between t and t(cid:48). Moreover, since E and Y have the same seniority, this implies that the token of Y belongs to Z. Hence, in round min(tE, tY ) the memory of agent X is greater than or equal to the memory of the token of Y , which is a contradiction with P refmin(tE ,tY )(RE) ≺ P refmin(tE ,tY )(RY ). Since an agent with the largest memory in Z in a given round must have had the largest memory among • the agents in Z in all previous rounds, the claim follows. Now we are ready to prove the following claim. Claim 2. Agent A must meet some other agent at the end of phase i at the latest. Assume by contradiction that agent A does not meet any agent by the end of phase i. So, there exists at least one agent executing the first i phases in state traveler. Let F be the first agent to finish the execution of phase i. According to the algorithm, phase i is made up of two parts. The first one consists in performing SIGN (2i) and finding the current signature (cid:96)2i of the initial position of the executing agent. The signature (cid:96)2i plays the role of the agent's label in the second part of phase i which consists in performing T Z((cid:96)2i) for ∆2i = T (SIGN (2i)) + 2P (2i, L2i) + Σi−1 j=1Qj is an upper bound on the sum of durations of phases 1 to i − 1, and L2i is the maximum possible label of an agent in phase i. Observe that at the end of the execution by agent F , at some round t, of the first part of phase i, all the agents in the graph are necessarily woken up due to the properties of procedure SIGN (2i) (as m ≤ 2i). Hence, we consider two cases. j=1Qj rounds, where Σi−1 21 • No agent meets another agent by round t + T (SIGN (2i)) + Σi−1 j=1Qj. In that case, we know that from round t + 1 + T (SIGN (2i)) + Σi−1 j=1Qj on, all the agents execute the second part of phase i and for each of them there remain at least P (2i, L2i) rounds before the end of the second part of phase i. Since the agents cannot all determine the same signature in phase i, there are at least two agents having two distinct labels and thus two agents meet by round t(cid:48) = t + T (SIGN (2i)) + P (2i, L2i) + Σi−1 j=1Qj due to the properties of procedure T Z. So, at least one agent transits to state token by round t(cid:48). However, the last period of P (2i, L2i) rounds when agent A executes the second part of phase i starts after round t(cid:48). So, in view of the properties of procedure T Z and of Claim 1, we know that agent A meets an agent in state token by the end of phase i if it does not meet an agent in another state before. We get a contradiction with the assumption made at the beginning of this proof. • At least two agents meet by round t + T (SIGN (2i)) + Σi−1 j=1Qj. In that case, we know that an agent transits to state token by this round. Using similar arguments as before, we can prove that agent A meets an agent in state token by the end of phase i if it does not meet an agent in another state before. Again we get a contradiction with the assumption made at the beginning of this proof. So, we get a contradiction in all cases. Hence, agent A must meet some other agent at the end of phase • i at the latest, which proves the claim. According to Claim 2, we know that after time at most Σi j=1Qj = j=1T (SIGN (2j) + ∆2j agent A transits from state traveler either to state shadow or token or Σi explorer. To deal with the state shadow, we need the following claim. Claim 3. If agent A becomes the shadow of an agent B at some round t, then agent B cannot itself switch to state shadow in the same round. To prove the claim, there are 3 cases to consider. • Case 1. Agent A transits from state token to state shadow in round t. According to the algorithm, agent B is an explorer transiting to state searcher in round t. • Case 2. Agent A transits from state searcher to state shadow in round t. According to the algorithm, B is -- either an agent in state explorer. However, an agent in state explorer cannot switch directly to state shadow. Hence B cannot transit to state shadow in round t. -- or an agent in state token. Let K be the set of agents in state explorer or token that are at the same node as A in round t. According to the algorithm, agent B is the agent having the highest memory in K. This implies that agent B is not with its explorer in round t because an agent in state explorer has a higher memory than its token (refer to the way they are created from state traveler). However, an agent in state token may transit to state shadow only if it is with its explorer. Hence agent B remains in state token in round t. • Case 3. Agent A transits from state traveler to state shadow in round t. Let J be the set of the other agents that are at the same node v as agent A in round t. We have 3 subcases to consider. -- There are only agents in state traveler in J . According to the algorithm, agent B is a traveler transiting to state explorer. -- There is no agent in state explorer or token in J but at least one agent in state searcher. According to the algorithm, agent B is an agent in state searcher that does not transit to state shadow in round t (because an agent in state searcher can transit to state shadow only if it is with an agent in state explorer or token). 22 -- There is at least one agent in state explorer or token in J . According to the algorithm, agent B is an agent in state explorer or token that cannot switch to state shadow in round t for similar reasons as in Case 2. • In all cases, B does not switch to state shadow in round t, which proves the claim. In view of Claim 3 and of the fact that the termination conditions for an agent in state shadow are the same as of its guide, we may exclude the state shadow from our analysis. Consider an agent in state explorer. Either at some point it transits to state searcher, in which case, after executing this transition, it uses at most Σm i=1T (EXP LO(i)) rounds to perform procedures EXP LO(i) for i = 1, 2, . . . , m, by which time it must have met some token or explorer (because at least one token is idle all the time starting from the first round when an agent transits to state token, according to Claim 1) and hence must have transited to state shadow, or it remains in state explorer till the end of the algorithm. We will first show that the total number of rounds in which the agent moves as an explorer is polynomial in m. This is not enough to show that, after polynomial time, A transits to state searcher or remains idle forever (as an explorer), since we still need to bound the duration of each period of idleness between any consecutive periods of moving. This will be addressed later. Two events can trigger further moves of agent A while it is in state explorer: a meeting causing a non-clean exploration EST ∗ or a visit of A by some agent, when A stays with its token after a clean exploration. We first treat the first of these two types of events and bound the total time of explorations caused by them. An exploration made by agent A could be non-clean due to several reasons, according to the description of the algorithm. • In round s agent A met an agent C in state token of higher seniority than that of A, or of equal seniority but such that recent-token ≺ P reft(MC), where t is the last round before round s when the variable recent-token of A was updated. According to the algorithm, agent A transits to state searcher as soon as it terminates its exploration EST ∗ after round s. Hence such a meeting can cause at most 1 exploration EST ∗ of A to be non-clean. • In round s the token B of A was visited by an agent C in state explorer of higher seniority than that of B, or of equal seniority but such that P reft(MB) ≺ R, where R is the variable recent- token of agent C, and t is the last round before round s when the variable recent-token of C was updated. According to the algorithm, agent A transits to state searcher as soon as it terminates its exploration EST ∗ after round s. Hence such a meeting can cause at most 1 exploration EST ∗ of A to be non-clean. • Either agent A or its token B met an agent C in state traveler. Since C transits immediately to state shadow, all agents in state traveler can cause at most m explorations EST ∗ of agent A to be non-clean. • Either agent A or its token B met an agent C in state searcher. Since C transits immediately to state shadow, all agents in state searcher can cause at most m explorations EST ∗ of agent A to be non-clean. • A met an agent C in state token of lower seniority than that of A, or of equal seniority but such that P refk(MC) ≺ recent-token, where k is the last round before this meeting when agent A updated its variable recent-token. After this meeting, the remaining time when agent C remains in state token is less than the longest duration of one execution of EST ∗ (after less than this time the explorer of C 23 becomes searcher and hence C transits to state shadow). Thus, as an agent in state token, agent C can cause at most 4T (EST (m)) explorations EST ∗ of A to be non-clean. Hence all such meetings can cause at most m · 4T (EST (m)) explorations EST ∗ of A to be non-clean. • In round s the token B of A met an agent C in state explorer of lower seniority than that of B, or of equal seniority but such that recent-token ≺ P reft(MB), (where t is the last round before s when the variable recent-token of C was updated). A similar analysis as in the previous case shows that such meetings can cause at most m · 4T (EST (m)) explorations EST ∗ of A to be non-clean. • In round s agent A met an agent C in state explorer of lower seniority than that of A, or of equal seniority but such that P refmin(tA,tC )(RC) ≺ P refmin(tA,tC )(RA), where RA (resp. RC) is the value of the variable recent-token of A (resp. C) at the time of the meeting and tA (resp. tC) is the last round before s when agent A (resp. C) updated its variable. After the meeting agent C "loses", i.e., it will transit to state searcher after backtracking to its token. Hence agent C remains in state explorer for less than 4T (EST (m)) rounds after the meeting. Similarly as before, such meetings can cause at most m · 4T (EST (m)) explorations EST ∗ of A to be non-clean. • In round s agent A met an agent C in state explorer of equal seniority and such that P refmin(tA,tC )(RA) = A (resp. t(cid:48) P refmin(tA,tC )(RC), where RA (resp. RC) is the value of the variable recent-token of A (resp. C) at the time of the meeting and tA (resp. tC) is the last round before s when agent A (resp. C) updated its variable recent-token. Let t(cid:48) C) be the first round since s when agent A (resp. C) updates its variable recent-token. From round h = max(t(cid:48) C) on, this kind of meeting with agent C can- not occur anymore. Indeed, in view of the fact that the memories of A and C are necessarily different in round s and the fact that once agent C finishes the execution of EST ∗ involving this meeting, its variable recent-token will be updated, we know that P refmin(t(cid:48) C )(RC) from round h on. Since the difference between max(t(cid:48) C) and s is less than the longest duration of one execution of EST ∗, similarly as before, such meetings can cause at most m · 4T (EST (m)) explorations EST ∗ of A to be non-clean. C )(RA) (cid:54)= P refmin(t(cid:48) A,t(cid:48) A,t(cid:48) A, t(cid:48) A, t(cid:48) • In round s agent A met an agent C in state explorer of higher seniority than that of A or of equal seniority but such that P refmin(tA,tC )(RA) ≺ P refmin(tA,tC )(RC), where RA (resp. RC) is the value of the variable recent-token of A (resp. C) at the time of the meeting and tA (resp. tC) is the last round before s when agent A (resp. C) updated its variable. According to the algorithm, agent A transits to state searcher as soon as it terminates its exploration EST ∗ after round s. Hence such a meeting can cause at most 1 exploration EST ∗ of A to be non-clean. • A met an agent C in state token in round s, that looked like its token B at this time, but that turned out not to be the token B after the backtrack of A on B. More precisely, recent-token = P reft(Mc) in round s (where t is the last round before s when the variable recent-token of A was updated) but P refs(MB) (cid:54)= P refs(MC). After round s agent C may look like token B of A for less than 4T (EST (m)) rounds because after less than this time A backtracks to its token B and, from this time on, it can see the difference between B and C. Similarly as before such meetings can cause at most m · 4T (EST (m)) explorations EST ∗ of A to be non-clean. • In round t(cid:48) the token B was visited by an agent C of equal seniority in state explorer such that recent-token = P reft(MB), where t is the last round before t(cid:48) when the variable recent-token of C was updated, and this agent turned out not to be A after the backtrack of A on B. Similarly as before, such meetings can cause at most m · 4T (EST (m)) explorations EST ∗ of A to be non-clean. 24 Hence the first of the two types of events (meeting causing a non-clean exploration) can cause at most (24T (EST (m)) + 2)m + 3 explorations EST ∗ of A to be non-clean. (As before we add up all upper bounds for simplicity). Considering the fact that each non-clean exploration EST ∗ is directly followed by at most one clean exploration EST ∗, this kind of meeting can cause at most 2((24T (EST (m)) + 2)m + 3)4T (EST (m)) rounds of motion of A. The second type of events (a visit of A by some agent, when A stays with its token after a clean exploration) can cause at most (2m(1 + 4T (EST (m))) + 1)4T (EST (m)) rounds of motion of A. Indeed, according to the algorithm, a visit of A by some agent C when A stays idle with its token B can be of the following kinds. • Agents A and B are visited by an agent C in state traveler. Since, at this visit, agent C transits immediately to state shadow, such visits can trigger at most m exploration EST ∗ of agent A. • Agents A and B are visited by an agent C in state searcher. Since, at this visit, agent C transits immediately to state shadow, such visits can trigger at most m exploration EST ∗ of agent A. • In round s, agents A and B are visited by an agent C in state explorer of lower seniority than that of B, or of equal seniority but such that RC ≺ P reftC (MB), where MB is the memory of agent B in round s, RC is the variable recent-token of agent C in round s, and tC is the last round before s when the variable RC was updated. After the visit agent C "loses", i.e., it will transit to state searcher after backtracking to its token. Hence agent C remains in state explorer for less than 4T (EST (m)) rounds after the visit and thus, such visits can trigger at most m · 4T (EST (m)) explorations EST ∗ of A. • In round s agents A and B are visited by an agent C in state explorer of equal seniority to that of B and such that RC = P reftC (MB), where MB is the memory of agent B in round s, RC is the variable recent-token of agent C in round s, and tC is the last round before s when the variable RC was updated. Let t(cid:48) C be the first round after s when agent C updates its variable recent-token. From round t(cid:48) C on, this kind of visit by agent C cannot occur anymore. Indeed, in view of the fact that the memories of A and C are necessarily different in round s and the fact that once agent C finishes the execution of EST ∗, its variable recent-token will be updated, we know that RC (cid:54)= P reft(cid:48) (MB) from round t(cid:48) C and s is less than the longest duration of one execution of EST ∗, similarly as before, such visits can trigger at most m· 4T (EST (m)) explorations EST ∗ of A. C on. Since the difference between t(cid:48) C • In round s, agents A and B are visited by an agent C in state explorer of higher seniority than that of A or of equal seniority to that of B and such that P reftC (MB) ≺ RC, where MB is the memory of agent B in round s, RC is the variable recent-token of agent C in round s, and tC is the last round before s when the variable R was updated. According to the algorithm, agent A transits to state searcher as soon as it terminates its exploration EST ∗ after round s. Hence such visits can trigger at most 1 exploration EST ∗ of A. Hence adding the first exploration that must be made by A (which is not trigerred by any meeting), we get an upper bound of (2((28T (EST (m)) + 3)m + 3) + 1)4T (EST (m)) rounds during which agent A moves in state explorer. It remains to consider an agent in state token. It may either transit to state shadow or remain in state token forever. In the latter case it is idle all the time. Since Σi j=1T (SIGN (2j) + ∆2j , T (EST (m)) and T (EXP LO(m)) are all polynomial in m, the above analysis shows that there exists a polynomial Y , such that, for each agent A executing Algorithm Gathering-without-Detection in any graph of size m, the number of rounds during which this agent moves 25 is at most Y (m). In order to finish the proof, we need to bound the number of rounds during which an agent A can be idle before moving again. To do this we will use the following claim. Claim 4. If in round t of the execution of Algorithm Gathering-without-Detection no agent moves, then no agent moves in any later round of this execution. To prove the claim notice that if no agent moves in round t, then in this round no agent is in state traveler or searcher. Moreover each agent in state explorer must be idle and stay with its token in this round (all other nodes must be in state shadow). In order for some agent to move in round t + 1, some explorer would have to visit some other token in round t, contradicting the definition of t. Hence all • agents are idle in round t + 1. By induction, all agents are idle from round t on. This proves the claim. Since for each agent executing Algorithm Gathering-without-Detection in a graph of size m, the num- ber of rounds in which it moves is at most Y (m) and there are at most m agents, Claim 4 implies that after time at most m · Y (m) since the wake up of the first agent, all agents must stop forever. (cid:3) By Lemma 4.1 there exists a round after which, according to Algorithm Gathering-without-Detection, no agent moves. Call the resulting configuration final. The following lemma implies that Algorithm Gathering-without-Detection is correct. Lemma 4.2 In every final configuration exactly one node is occupied by agents. Proof. A final configuration must consist of agents in states explorer , token and shadow, all situated in nodes v1, . . . , vk, such that in each node vi there is exactly one agent Ei in state explorer, exactly one agent Ti in state token and possibly some agents in state shadow. As before we call such a final configuration a clone configuration if there are at least two distinct nodes vi, vj which have identical colored views. The same argument as in the proof of Lemma 3.3 shows that a final configuration cannot be a clone configuration. It is enough to prove that k = 1. Suppose for contradiction that k > 1. We will consider two cases. In the first case the memories of all explorers Ei are identical and in the second case they are not. In both cases we will derive a contradiction. Case 1. All explorers Ei in the final configuration have identical memory. In this case all these explorers performed the last exploration EST ∗ simultaneously, in view of the fact that the algorithm that they execute is deterministic. We start with the following claim. Claim 1. If a node has been rejected by the explorer Ej in the construction of its (truncated) spanning tree during its last exploration EST ∗, then this node, let us call it w, must have been either added previously by Ej to its (truncated) spanning tree, or added by another explorer Es in the construction of its (truncated) spanning tree during its last exploration EST ∗. The node w was rejected by Ej for the following reason. Ej traveled from w using the reversal q of the path q, where q is a path (coded as a sequence of ports) from vj to some node u already in the (truncated) spanning tree of Ej, and at the end of this path q, Ej met a token with memory M, such that P reft(M) = recent-token, where t is the last round when Ej updated its variable recent-token. There are two possible cases. If the token met by Ej is its own token (residing at vj), then w is equal to some node u already added previously to the (truncated) spanning tree of Ej. If, on the other hand, the token met by Ej is the token of some other explorer Es, then we will show that w is added by Es to its (truncated) spanning tree. Indeed, since Ej has added a node u to its (truncated) spanning tree, such that the path from vj to u is q, the explorer Es must have added a node u(cid:48) to its (truncated) spanning tree, such that the path from vs to u(cid:48) is q as well, because both Es and Ej have identical memories. However, this node u(cid:48) • must be equal to w, since the path from w to vs is q. This proves the claim. 26 The contradiction in Case 1 will be obtained in the following way. Using (truncated) spanning trees produced by explorers Ei during their last exploration EST ∗ (recall that these trees are isomorphic, since memories of the explorers are identical), we will construct the colored view for each explorer. Using the fact that memories of the explorers are identical, these colored views will be identical. This will imply that the final configuration is a clone configuration, which is impossible. The construction proceeds as follows (we will show it for explorer E1). Let Ti be the (truncated) spanning tree produced by Ei. Each tree Ti has its root vi colored black and all other nodes colored white. We will gradually attach various trees to T1 in order to obtain the colored view from v1. First attach to every node of T1 its neighbors that have been rejected by E1 during the construction of T1. Explorer E1 has visited these nodes, hence the respective port numbers can be faithfully added. Consider any such rejected node w. By Claim 1, there are two possibilities. If node w was previously added by E1 to T1 as some node u, then we proceed as follows. Let T (cid:48) 1 at w, identifying its root u with w. If node w was added by another explorer Es in the construction of its (truncated) spanning tree Ts, we proceed as follows. As mentioned in the proof of Claim 1, the explorer Es must have added a node u(cid:48) to its (truncated) spanning tree, such that the path from vs to u(cid:48) is q. Let T (cid:48) s be the tree Ts but rooted at u(cid:48) instead of vs. We attach tree T (cid:48) 1 be the tree T1 but rooted at u instead of v1. We attach tree T (cid:48) s at w, identifying its root u(cid:48) with w. After processing all nodes rejected by E1 and adding the appropriate trees, we attach all rejected neigh- bors of nodes in the newly obtained increased tree. These nodes could have been rejected either by E1 itself or by another explorer Ej whose (re-rooted) tree T (cid:48) j has been attached. For each newly attached node rejected by Ej, the construction continues as before, replacing the role of T1 by Tj. The above construction proceeds infinitely, producing an infinite rooted tree (rooted at a node corre- sponding to v1). We make one final addition in order to obtain the view V(v1) from v1 (cf. Claim 2) : each node u of the tree is assigned a label corresponding to the shortest path from the root to u. The resulting infinite tree is denoted by T . Claim 2. T corresponds to view V(v1) We prove the claim by induction. First of all, note that T truncated at depth 1 from its root corresponds to the truncated view V 1(v1). Assume as induction hypothesis that the tree T truncated at depth l from its root, call it T l, corresponds to the truncated view V l(v1). We will show that T (l+1) corresponds to the truncated view V (l+1)(v1). According to the process described above, whenever a node u, corresponding to a node x in the network N , is added to T under construction, exactly one child v is eventually added to u for each neighbor y of x in N . More precisely, node x is connected to node y by an edge having port p at node x and port q at node y iff node u and its child v are connected between them by an edge having port p at node u and port q at node v. In addition, if the label of u is path ρ then the label of v is path ρpq. Hence, if in tree T we identify a node with its label, we have the following two properties: (1) for every path π of length 2l (according to the induction hypothesis, π is located at distance l from the root of T and corresponds to a path from v1 in N ), its children correspond to all paths from v1 of length 2l + 2 whose prefix is π in N and (2) for every path π of length 2l, every child ρ of path π, such that ρ = πpq, is connected to π in T by an edge that has port p at node π and port q at node ρ. Moreover, since T l is V l(v1), the above two properties also hold if l is replaced by any value ranging from 0 to (l − 1). Hence T (l+1) is V (l+1)(v1), which proves the claim. • To produce the colored view, notice that there are only two colors in this colored view: white corre- sponding to empty nodes in the final configuration and black corresponding to nodes v1,..., vk (all these nodes get identical colors: since memories of explorers are the same, memories of their tokens are also the same and memories of corresponding nodes in state shadow are also identical). It remains to indicate how the colors are distributed in the constructed view. This is done as follows. When a tree T (cid:48) j is attached, exactly one of its nodes (namely the node corresponding to vj) is black. Exactly these nodes become black in the 27 obtained colored view. This construction of colored views is done for all explorers Ei. Consider two explorers Ei and Ej. Since these explorers have the same memory, the trees T (cid:48) s attached at a given stage of the construction of the views of Ei and Ej are isomorphic. They are also attached in the same places of the view. Hence by induction of the level of the view it follows that both colored views are identical. This implies that the final configuration is a clone configuration which gives a contradiction in Case 1. Case 2. There are at least two explorers Ei and Ej with different memories in the final configuration. Consider the equivalence relation on the set of explorers E1, . . . , Ek, such that two explorers are equiv- alent if their memories in the final configuration are identical. Let C1, . . . ,Ch, where h > 1, be the equiva- lence classes of this relation. Suppose w.l.o.g. that C1 is a class of explorers with smallest seniority. We will use the following claim. Claim 3. During the last exploration EST ∗ of explorers in C1, at least one of the following statements holds: • an explorer from C1 has visited a token of an explorer not belonging to C1; • a token of an explorer from C1 has been visited by an explorer not belonging to C1. In order to prove the claim consider two cases. If every node of the graph has been visited by some explorer from C1, we will show that the first statement holds. Indeed, since explorers from C1 have the smallest seniority, during their last execution of EST ∗ all tokens, which are in the final configuration, are already at their respective nodes (because otherwise there would be at least one token and its explorer in the final configuration that were created after the creation of the tokens from C1, which would be a contradiction with the fact that explorers from C1, and hence also their tokens, have the smallest seniority in the final configuration). Hence some explorers from C1 must visit the tokens of explorers outside of C1. Hence we can restrict attention to the second case, when some nodes of the graph have not been visited by any explorer from C1. Notice that if there were no other classes than C1, this could not occur. Indeed, we would be then in Case 1 (in which all explorers have identical memory). Thus Claim 1 would hold, which implies that all nodes must be visited by some explorer, in view of the graph connectivity. Hence the fact that some node is not visited by explorers from C1 must be due to a meeting of some other agent (which is neither an explorer from C1 nor a token of such an explorer) during their last exploration EST ∗. What kind of a meeting can it be? It cannot be a meeting with an agent in state traveler or searcher because this would contradict that the last exploration was clean. For the same reason it cannot be a meeting of an explorer from C1 with another explorer. This leaves only the two types of meetings • specified in the claim, which finishes the proof of the claim. Let (Ex, T ok) be a couple of an explorer outside of C1 and of its token, such that either an explorer from C1 visited T ok or a token of an explorer from C1 has been visited by Ex during the last exploration of explorers in the class C1. Such a couple exists by Claim 3. The seniority of Ex and T ok must be the same as that of explorers from C1, for otherwise their last exploration would not be clean. For the same reason, when explorers from C1 started their last exploration, the explorer Ex must have started an exploration as well (possibly not its final exploration): otherwise the exploration of explorers from C1 would not be clean. Moreover we show that when explorers from C1 finished their last exploration, explorer Ex must have finished an exploration as well. To prove this, consider two cases, corresponding to two possibilities in Claim 3. Suppose that an explorer Ej from C1 has visited T ok and that its exploration did not finish simultaneously with the exploration of Ex. Consider the consecutive segments S1, S2, S3, S4 of the last exploration EST ∗ of Ej. (Recall that these segments were specified in the definition of EST ∗.) Since Ej has visited T ok during EST ∗, it must have visited it during each segment Si. At the end of S1, explorer Ej knows how long EST ∗ will take. At the end of S2 its token learns it as well. When Ej visits T ok again 28 in segment S3, there are two possibilities. Either T ok does not know when the exploration of Ex finishes, or it does know that it finishes at a different time than the exploration of Ej. In both cases the explorer Ej that updated its variable recent-token at the end of S2 can see that recent-token (cid:54)= P reft(M), where M is the memory of T ok and t is the end of S2. This makes the last exploration of Ej non clean, which is a contradiction. This proves that Ex and Ej finish their exploration simultaneously, if Ej has visited T ok. The other case, when Ex has visited the token of Ej is similar. Hence we conclude that explorations of Ej and of Ex started and finished simultaneously. Let τ be the round in which the last exploration of Ej (and hence of all explorers in C1) finished. The exploration of Ex that finished in round τ cannot be its final exploration because then it would have the same memory as Ej in the final configuration and thus it would be in the class C1 contrary to the choice of Ex. Hence Ex must move after round τ. It follows that there exists a class Ci (w.l.o.g. let it be C2) such that explorers from this class started their last exploration after round τ. Note that during this last exploration, explorers from C2 could not visit all nodes of the graph, for otherwise they would meet explorers from C1 after round τ, inducing them to move after this round, contradicting the fact that explorers from C1 do not move after round τ. The fact that some node is not visited by explorers from C2 must be due to a meeting of some other agent (which is neither an explorer from C2 nor a token of such an explorer) during their last exploration EST ∗. Otherwise, for explorers in C2 the situation would be identical as if their equivalence class were the only one, and hence, as in Case 1, they would visit all nodes. Moreover, the fact that some node is not visited by explorers from C2 must be due to a meeting of some explorer outside of C1 or of its token (if not, explorers from C1 would move after round τ, which is a contradiction). An argument similar to that used in the proof of Claim 3 shows that there exists a couple (Ex(cid:48), T ok(cid:48)), such that Ex(cid:48) is an explorer outside of C1 ∪ C2, T ok(cid:48) is its token, and either an explorer from C2 visited T ok(cid:48) or a token of an explorer from C2 has been visited by Ex(cid:48) during the last exploration of explorers in the class C2. Let τ(cid:48) be the round in which the last exploration of explorers from C2 is finished. Similarly as before, the explorer Ex(cid:48) terminates some exploration in round τ(cid:48) but continues to move afterwards. Repeating the same argument h − 1 times we conclude that there exists a round τ∗ after which all explorers from C1 ∪ ··· ∪ Ch−1 never move again, but the last exploration of explorers from Ch starts on or after τ∗. During this last exploration there must be a node not visited by any explorer from Ch, otherwise some explorers from C1 ∪ ··· ∪ Ch−1 would move after τ∗. This is due to a meeting. It cannot be a meeting with an agent in state traveler or searcher because this would contradict that the last exploration was clean. For the same reason it cannot be a meeting of an explorer from Ch with another explorer. Hence two possibilities remain. Either an explorer from Ch visits a token of an explorer from C1 ∪···∪Ch−1 or a token of an explorer from Ch is visited by an explorer from C1∪···∪Ch−1. The first situation is impossible because it would contradict the cleanliness of the last exploration of explorers from Ch and the second situation is impossible because explorers from C1 ∪ ··· ∪ Ch−1 do not move after τ∗. Hence in Case 2 we obtain a (cid:3) contradiction as well, which completes the proof. Lemmas 4.1 and 4.2 imply the following result. Theorem 4.2 Algorithm Gathering-without-Detection performs a correct gathering of all gatherable con- figurations and terminates in time polynomial in the size of the graph. 5 Consequences for leader election Leader election [44] is a fundamental symmetry breaking problem in distributed computing. Its goal is to assign, in some common round, value 1 (leader) to one of the entities and value 0 (non-leader) to all others. The assignment should happen once for each identity, in a unique common round, and cannot be changed afterwards. In the context of anonymous agents in graphs, leader election can be formulated as follows: 29 • There exists a common unique round in which one of the agents assigns itself value 1 (i.e., it declares itself a leader) and each other agent assigns itself value 0 (i.e., it declares itself non-leader). The following proposition says that the problems of leader election and of gathering with detection are equivalent in the following strong sense. Consider any initial configuration of agents in a graph. If gathering with detection can be accomplished for this configuration in some round t, then leader election can be accomplished for this configuration in some round t(cid:48) > t, and conversely, if leader election can be accomplished for this configuration in some round t, then gathering with detection can be accomplished for this configuration in some round t∗ > t. Proposition 5.1 Leader election is equivalent to gathering with detection. Proof. Suppose that gathering with detection is accomplished and let t be the round when all agents are together and declare that gathering is over. As mentioned in the Preliminaries, all agents must have different memories, since they are at the same node, and, being together, they can compare these memories. Since, in view of detection, the round t is known to all agents, in round t + 1 the agent with the largest memory assigns itself value 1 and all other agents assign themselves value 0. Conversely, suppose that leader election is accomplished and let t be the round in which one of the agents assigns itself value 1 and all other agents assign themselves value 0. Starting from round t the agent with value 1 stops forever and plays the role of the token, all other agents playing the role of explorers. First, every explorer finds the token by executing procedure EXP LO(n) for T (EXP LO(n)) rounds in phases n = 1, 2, ..., until it finds the token in round t(cid:48) (this round may be different for every explorer). Then every explorer executes procedure EST (using the token) and finds the map of the graph and hence its size m. i=1 T (EXP LO(i)) + T (EST (m)). By this round all explorers must have found the token and executed procedure EST , i.e., they are all together with the token. In round t∗ all agents declare that gathering is over. (cid:3) Then it waits with the token until round t∗ = t +(cid:80)m Proposition 5.1 implies that the class of initial configurations for which leader election is at all possible (even only using an algorithm dedicated to this specific configuration) is equal to the class of gatherable configurations, i.e., to the class of configurations satisfying property G. Similarly as for gathering, we will say that a leader election algorithm is universal if it performs leader election for all such configurations. It follows that a small modification of Algorithm Gathering-with-Detection is a universal leader election algorithm, provided that an upper bound on the size of the graph is known to the agents. The modification is the following: use Algorithm Gathering-with-Detection to gather all agents in some round t, and, in round t + 1, elect as leader the agent that has the largest memory in the round of the gathering declaration (this agent assigns itself value 1 and all other agents assign themselves value 0). Let LE be the name of this modified algorithm. The following corollary summarizes the above discussion and gives a complete solution of the leader election problem for anonymous agents in arbitrary graphs. Corollary 5.1 For a given initial configuration, leader election is possible if and only if this configuration satisfies condition G. If an upper bound on the size of the graph is known, then Algorithm LE accomplishes leader election for all these configurations. There is no universal algorithm accomplishing leader election for all configurations satisfying condition G in all graphs. References [1] Noa Agmon and David Peleg. Fault-tolerant gathering algorithms for autonomous mobile robots. SIAM Journal on Computing, 36(1):56 -- 82, 2006. 30 [2] Steve Alpern. The rendezvous search problem. SIAM Journal on Control and Optimization, 33(3):673 -- 683, 1995. [3] Steve Alpern. Rendezvous search on labelled networks. Naval Research Logistics, 49:256 -- 274, 2002. [4] Steve Alpern and Shmuel Gal. Theory of Search Games and Rendezvous. Kluwer Academic Publisher, 2003. [5] Eddie Anderson and Richard Weber. The rendezvous problem on discrete locations. Journal of Applied Probability, 28(4):839 -- 851, 1990. [6] Edward Anderson and S´andor Fekete. Asymmetric rendezvous on the plane. In 14th Annual Sym- posium on Computational Geometry, June 7-10, 1998, Minneapolis, Minnesota, USA. Proceedings, pages 365 -- 373, 1998. [7] Edward Anderson and S´andor Fekete. Two dimensional rendezvous search. Operations Research, 49(1):107 -- 118, 2001. [8] Dana Angluin. Local and global properties in networks of processors (extended abstract). In 12th Annual ACM Symposium on Theory of Computing, April 28-30, 1980, Los Angeles, California, USA. Proceedings, pages 82 -- 93, 1980. [9] Hagit Attiya and Marc Snir. Better computing on the anonymous ring. 12(2):204 -- 238, 1991. Journal of Algorithms, [10] Evangelos Bampas, Jurek Czyzowicz, Leszek Gasieniec, David Ilcinkas, and Arnaud Labourel. Al- most optimal asynchronous rendezvous in infinite multidimensional grids. In Distributed Computing, 24th International Symposium, DISC 2010, Cambridge, MA, USA, September 13-15, 2010. Proceed- ings, pages 297 -- 311, 2010. [11] Vic Baston and Shmuel Gal. Rendezvous search when marks are left at the starting points. Naval Research Logistics, 48(8):722 -- 731, 2001. [12] Paolo Boldi and Sebastiano Vigna. Computing anonymously with arbitrary knowledge. In Proceedings of the Eighteenth Annual ACM Symposium on Principles of Distributed Computing, PODC, '99At- lanta, Georgia, USA, May 3-6, 1999, pages 181 -- 188, 1999. [13] J´er´emie Chalopin, Shantanu Das, and Adrian Kosowski. Constructing a map of an anonymous graph: Applications of universal sequences. In Principles of Distributed Systems - 14th International Confer- ence, OPODIS 2010, Tozeur, Tunisia, December 14-17, 2010. Proceedings, pages 119 -- 134, 2010. [14] Mark Cieliebak, Paola Flocchini, Giuseppe Prencipe, and Nicola Santoro. Distributed computing by mobile robots: Gathering. SIAM Journal on Computing, 41(4):829 -- 879, 2012. [15] Reuven Cohen and David Peleg. Convergence properties of the gravitational algorithm in asyn- chronous robot systems. SIAM Journal on Computing, 34(6):1516 -- 1528, 2005. [16] Reuven Cohen and David Peleg. Convergence of autonomous mobile robots with inaccurate sensors and movements. SIAM Journal on Computing, 38(1):276 -- 302, 2008. [17] Jurek Czyzowicz, Adrian Kosowski, and Andrzej Pelc. How to meet when you forget: rendezvous in arbitrary graphs. Distributed Computing, 25(2):165 -- 178, 2012. log-space 31 [18] Jurek Czyzowicz, Andrzej Pelc, and Arnaud Labourel. How to meet asynchronously (almost) every- where. ACM Transactions on Algorithms, 8(4):37, 2012. [19] Gianlorenzo D'Angelo, Gabriele Di Stefano, and Alfredo Navarra. Gathering on rings under the look- compute-move model. Distributed Computing, 27(4):255 -- 285, 2014. [20] Gianluca De Marco, Luisa Gargano, Evangelos Kranakis, Danny Krizanc, Andrzej Pelc, and Ugo Vac- caro. Asynchronous deterministic rendezvous in graphs. Theoretical Computer Science, 355(3):315 -- 326, 2006. [21] Anders Dessmark, Pierre Fraigniaud, Dariusz R. Kowalski, and Andrzej Pelc. Deterministic ren- dezvous in graphs. Algorithmica, 46(1):69 -- 96, 2006. [22] Yoann Dieudonn´e and Andrzej Pelc. Deterministic network exploration by anonymous silent agents with local traffic reports. In Automata, Languages, and Programming - 39th International Colloquium, ICALP 2012, Warwick, UK, July 9-13, 2012, Proceedings, Part II, pages 500 -- 512, 2012. [23] Yoann Dieudonn´e, Andrzej Pelc, and David Peleg. Gathering despite mischief. ACM Transactions on Algorithms, 11(1):1, 2014. [24] Yoann Dieudonn´e, Andrzej Pelc, and Vincent Villain. How to meet asynchronously at polynomial cost. In ACM Symposium on Principles of Distributed Computing, PODC 2013, Montreal, QC, Canada, July 22-24, 2013, pages 92 -- 99, 2013. [25] Paola Flocchini, David Ilcinkas, Andrzej Pelc, and Nicola Santoro. Remembering without memory: Tree exploration by asynchronous oblivious robots. Theoretical Computer Sci.ence, 411(14-15):1583 -- 1598, 2010. [26] Paola Flocchini, Giuseppe Prencipe, Nicola Santoro, and Peter Widmayer. Gathering of asynchronous robots with limited visibility. Theoretical Computer Science, 337(1-3):147 -- 168, 2005. [27] Pierre Fraigniaud, Leszek Gasieniec, Dariusz R. Kowalski, and Andrzej Pelc. Collective tree explo- ration. Networks, 48(3):166 -- 177, 2006. [28] Pierre Fraigniaud and Andrzej Pelc. Deterministic rendezvous in trees with little memory. In Dis- tributed Computing, 22nd International Symposium, DISC 2008, Arcachon, France, September 22-24, 2008. Proceedings, pages 242 -- 256, 2008. [29] Pierre Fraigniaud and Andrzej Pelc. Delays induce an exponential memory gap for rendezvous in trees. ACM Transactions on Algorithms, 9(2):17, 2013. [30] Greg N. Frederickson and Nancy A. Lynch. Electing a leader in a synchronous ring. Journal of the ACM, 34(1):98 -- 115, 1987. [31] Emanuele G. Fusco and Andrzej Pelc. How much memory is needed for leader election. Distributed Computing, 24(2):65 -- 78, 2011. [32] Shmuel Gal. Rendezvous search on the line. Operations Research, 47(6):974 -- 976, 1999. [33] Samuel Guilbault and Andrzej Pelc. Asynchronous rendezvous of anonymous agents in arbitrary graphs. In Principles of Distributed Systems - 15th International Conference, OPODIS 2011, Toulouse, France, December 13-16, 2011. Proceedings, pages 421 -- 434, 2011. 32 [34] Med Amine Haddar, Ahmed Hadj Kacem, Yves M´etivier, Mohamed Mosbah, and Mohamed Jmaiel. Electing a leader in the local computation model using mobile agents. In 6th ACS/IEEE International Conference on Computer Systems and Applications, AICCSA 2008, Doha, Qatar, March 31 - April 4, 2008, Proceedings, pages 473 -- 480, 2008. [35] Daniel S. Hirschberg and J. B. Sinclair. Decentralized extrema-finding in circular configurations of processors. Communications of the ACM, 23(11):627 -- 628, 1980. [36] Amos Israeli and Marc Jalfon. Token management schemes and random walks yield self-stabilizing mutual exclusion. In 9th Annual ACM Symposium on Principles of Distributed Computing, Quebec City, Quebec, Canada, August 22-24, 1990, Proceedings, pages 119 -- 131, 1990. [37] Ralf Klasing, Adrian Kosowski, and Alfredo Navarra. Taking advantage of symmetries: Gathering of many asynchronous oblivious robots on a ring. Theoretical Computer Science, 411(34-36):3235 -- 3246, 2010. [38] Ralf Klasing, Euripides Markou, and Andrzej Pelc. Gathering asynchronous oblivious mobile robots in a ring. Theoretical Computer Science, 390(1):27 -- 39, 2008. [39] Dariusz R. Kowalski and Adam Malinowski. How to meet in anonymous network. Theoretical Com- puter Science, 399(1-2):141 -- 156, 2008. [40] Evangelos Kranakis, Danny Krizanc, and Pat Morin. Randomized rendezvous with limited memory. ACM Transactions on Algorithms, 7(3):34, 2011. [41] Evangelos Kranakis, Nicola Santoro, Cindy Sawchuk, and Danny Krizanc. Mobile agent rendezvous in a ring. In 23rd International Conference on Distributed Computing Systems (ICDCS 2003), 19-22 May 2003, Providence, RI, USA. Proceedings, pages 592 -- 599, 2003. [42] G´erard Le Lann. Distributed systems - towards a formal approach. In IFIP Congress 77, Toronto, Canada, August 8-12, 1977. North-Holland, Proceedings, pages 155 -- 160, 1977. [43] Wei Shi Lim and Steve Alpern. Minimax rendezvous on the line. SIAM Journal on Control and Optimization, 34(5):1650 -- 1665, 1996. [44] Nancy Ann Lynch. Distributed Algorithms. Morgan Kaufmann, 1996. [45] Andrzej Pelc. Deterministic rendezvous in networks: A comprehensive survey. Networks, 59(3):331 -- 347, 2012. [46] Gary L. Peterson. An O(n log n) unidirectional algorithm for the circular extrema problem. ACM Transactions on Programming Languages and Systems, 4(4):758 -- 762, 1982. [47] Omer Reingold. Undirected connectivity in log-space. Journal of the ACM, 55(4), 2008. [48] Amnon Ta-Shma and Uri Zwick. Deterministic rendezvous, treasure hunts, and strongly universal exploration sequences. ACM Transactions on Algorithms, 10(3):12, 2014. [49] Masafumi Yamashita and Tiko Kameda. Electing a leader when processor identity numbers are not In Distributed Algorithms, 3rd International Workshop, Nice, France, distinct (extended abstract). September 26-28, 1989, Proceedings, pages 303 -- 314, 1989. 33 [50] Masafumi Yamashita and Tsunehiko Kameda. i- characterizing the solvable cases. IEEE Transactions on Parallel and Distributed Systems, 7(1):69 -- 89, 1996. Computing on anonymous networks: Part [51] Xiangdong Yu and Moti Yung. Agent rendezvous: A dynamic symmetry-breaking problem. In Au- tomata, Languages, and Programming - 23rd International Colloquium, ICALP 1996, Paderborn, Germany, July 8-12, 1996, Proceedings, pages 610 -- 621, 1996. 34
1805.09924
2
1805
2018-07-01T07:39:26
Longest Unbordered Factor in Quasilinear Time
[ "cs.DS" ]
A border u of a word w is a proper factor of w occurring both as a prefix and as a suffix. The maximal unbordered factor of w is the longest factor of w which does not have a border. Here an O(n log n)-time with high probability (or O(n log n log^2 log n)-time deterministic) algorithm to compute the Longest Unbordered Factor Array of w for general alphabets is presented, where n is the length of w. This array specifies the length of the maximal unbordered factor starting at each position of w. This is a major improvement on the running time of the currently best worst-case algorithm working in O(n^{1.5} ) time for integer alphabets [Gawrychowski et al., 2015].
cs.DS
cs
Longest Unbordered Factor in Quasilinear Time Tomasz Kociumaka∗1, Ritu Kundu†2, Manal Mohamed‡2, and Solon P. Pissis§ 2 1Institute of Informatics, University of Warsaw, Warsaw, Poland 2Department of Informatics, King's College London, London, UK July 3, 2018 Abstract A border u of a word w is a proper factor of w occurring both as a prefix and as a suffix. The maximal unbordered factor of w is the longest factor of w which does not have a border. Here an O(n log n)-time with high probability (or O(n log n log2 log n)-time deterministic) algorithm to compute the Longest Unbordered Factor Array of w for general alphabets is presented, where n is the length of w. This array specifies the length of the maximal unbordered factor starting at each position of w. This is a major improvement on the running time of the currently best worst-case 1.5) time for integer alphabets [Gawrychowski algorithm working in O(n et al., 2015]. 1 Introduction There are two central properties characterising repetitions in a word –period and border – which play direct or indirect roles in several diverse applications ranging over pattern matching, text compression, assembly of genomic sequences and so on (see [3, 6]). A period of a non-empty word w of length n is an integer p such that 1 ≤ p ≤ n, if w[i] = w[i + p], for all 1 ≤ i ≤ n − p. For instance, 3, 6, 7, and 8 are periods of the word aabaabaa. On the other hand, a border u of w is a (possibly empty) proper factor of w occurring both as a prefix and as a suffix of w. For example, ε, a, aa, and aabaa are the borders of w = aabaabaa. In fact, the notions of border and period are dual: the length of each border of w is equal to the length of w minus the length of some period of w. For example, aa is a border of the word aabaabaa; it corresponds to period 6 = aabaabaa − aa. Consequently, the basic data structure of periodicity on words is the border array which stores the length of the longest border for each prefix of w. The computation of the border array of w was the fundamental concept behind the first linear-time pattern matching algorithm – given a word ∗[email protected][email protected][email protected] §[email protected] 1 w (pattern), find all its occurrences in a longer word y (text). The border array of w is better known as the "failure function" introduced in [15] (see also [1]). It is well-known that the border array of w can be computed in O(n) time, where n is the length of w, by a variant of the Knuth-Morris-Pratt algorithm [15]. Another notable aspect of the inter-dependency of these dual notions is the relationship between the length of the maximal unbordered factor of w and the periodicity of w. A maximal unbordered factor is the longest factor of w which does not have a border; its length is usually represented by µ(w), e.g. the maximal unbordered factor is aabab and µ(w) = 5 for the word w = baabab. This dependency has been a subject of interest in the literature for a long time, starting from the 1979 paper of Ehrenfeucht and Silberger [9] in which they raised the question – at what length of w, µ(w) is maximal (i.e., equal to the minimal period of the word as it is well-known that it cannot be longer than that). This line of questioning, after being explored for more than three decades, culminated in 2012 with the work by Holub and Nowotka [11] where an asymptotically optimal upper bound (µ(w) ≤ 3 7 n) was presented; the historic overview of the related research can be found in [11]. Somewhat surprisingly, the symmetric computational problem-given a word w, compute the longest factor of w that does not have a border-had not been studied until very recently. In 2015, Kucherov et al. [14] considered this ar- guably natural problem and presented the first sub-quadratic-time solution. A naıve way to solve this problem is to compute the border array starting at each position of w and locating the rightmost zero, which results in an algorithm with O(n2) worst-case running time. On the other hand, the computation of the maximal unbordered factor can be done in linear time for the cases when µ(w) or its minimal period is small (i.e., at most half the length of w) us- ing the linear-time computation of unbordered conjugates [8]. However, as has been illustrated in [14] and [2], most of the words do not fall in this category owing to the fact that they have large µ(w) and consequently large minimal period. In [14], an adaptation of the basic algorithm has been provided with average-case running time O(n2/σ4), where σ is the alphabet's size; it has also been shown to work better, both in practice and asymptotically, than another straightforward approach that employs data structures from [13, 12] to query all relevant factors. The currently fastest worst-case algorithm to compute the maximal unbor- dered factor of a given word takes O(n1.5) time; it was presented by Gawrychowski et al. [10] and it works for integer alphabets (alphabets of polynomial size in n). This algorithm works by categorising bordered factors into short borders and long borders depending on a threshold, and exploiting the fact that, for each position, the short borders are bounded by the threshold and the long borders are small in number. The resulting algorithm runs in O(n log n) time on aver- age. More recently, an O(n)-time average-case algorithm was presented using a refined bound on the expected length of the maximal unbordered factor [2]. Our Contribution. In this paper, we show how to efficiently answer the Longest Unbordered Factor question using combinatorial insight. Specifically, we present an algorithm that computes the Longest Unbordered Factor Array in O(n log n) time with high probability. The algorithm can also be implemented deterministically in O(n log n log2 log n) time. This array specifies the length of the maximal unbordered factor at each position in w. We thus improve on the running time of the currently fastest algorithm, which reports only the maximal 2 unbordered factor of w and works only for integer alphabets, taking O(n1.5) time. Structure of the Paper. In Section 2, we present the preliminaries, some useful properties of unbordered words, the algorithmic toolbox, and a formal definition of the problem. We lay down the combinatorial foundation of the algorithm in Section 3 and expound the algorithm in Section 4; its analysis is explicated in Section 5. We conclude this paper with a final remark in Section 6. 2 Background Definitions and Notation. We consider a finite alphabet Σ of letters. Let Σ∗ be the set of all finite words over Σ. The empty word is denoted by ε. The length of a word w is denoted by w. For a word w = w[1]w[2] . . w[n], w[i . . j] denotes the factor w[i]w[i + 1] . . w[j], where 1 ≤ i ≤ j ≤ n. The concatenation of two words u and v is the word composed of the letters of u followed by the letters of v. It is denoted by uv or also by u · v to show the decomposition of the resulting word. Suppose w = uv, then u is a prefix and v is a suffix of w; if u 6= w then u is a proper prefix of w; similarly, if v 6= w then v is a proper suffix of w. Throughout the paper we consider a non-empty word w of length n over a general alphabet Σ; in this case, we replace each letter by its rank such that the resulting word consists of integers in the range {1, . . . , n}. This can be done in O(n log n) time after sorting the letters of Σ. An integer 1 ≤ p ≤ n is a period of w if and only if w[i] = w[i + p] for all 1 ≤ i ≤ n − p. The smallest period of w is called the minimum period (or the period ) of w, denoted by λ(w). A word u (u 6= w) is a border of w, if w = uv = v′u for some non-empty words v and v′; note that u is both a proper prefix and a suffix of w. It should be clear that if w has a border of length w − p then it has a period p. Thus, the minimum period of w corresponds to the length of the longest border (or the border ) of w. Observe that the empty word ε is a border of any word w. If u is the shortest border then u is the shortest non-empty border of w. The word w is called bordered if it has a non-empty border, otherwise it is unbordered. Equivalently, the minimum period p = w for an unbordered word w. Note that every bordered word w has a shortest border u such that w = uvu, where u is unbordered. By µ(w) we denote the maximum length among all the unbordered factors of w. Useful Properties of Unbordered Words. Recall that a word u is a border of a word w if and only if u is both a proper prefix and a suffix of w. A border of a border of w is also a border of w. A word w is unbordered if and only if it has no non-empty border; equivalently ε is the only border of w. The following properties related to unbordered words form the basis of our algorithm and were presented and proved in [7]. Proposition 1 ([7]). Let w be a bordered word and u be the shortest non-empty border of w. The following propositions hold: 1. u is an unbordered word; 2. u is the unique unbordered prefix and suffix of w; 3 3. w has the form w = uvu. Proposition 2 ([7]). For any word w, there exists a unique sequence (u1, · · · , uk) of unbordered prefixes of w such that w = uk · · · u1. Furthermore, the following properties hold: 1. u1 is the shortest border of w; 2. uk is the longest unbordered prefix of w; 3. for all i, 1 ≤ i ≤ k, ui is an unbordered prefix of uk. The computation of the unique sequence described in Proposition 2 pro- vides a unique unbordered-decomposition of a word. For instance, for w = baababbabab the unique unbordered-decomposition of w is baa · ba · b · ba · ba · b. Longest Successor Factor (Length and Reference) Arrays. Here, we present the arrays that will act as a toolbox for our algorithm. The longest successor factor of w (denoted by lsf ) starting at position i, is the longest factor of w that occurs at i and has at least one other occurrence in the suffix w[i + 1 . . n]. The longest successor factor array gives for each position i in w, the length of the longest factor starting both at position i and at another position j > i. Formally, the longest successor factor array (LSFℓ) is defined as follows. LSFℓ[i] =(cid:26) 0 max{k w[i . . i + k − 1] = w[j . . j + k − 1}, if i = n, for i < j ≤ n. Additionally, we define the LSF-Reference Array, denoted by LSFr. This array specifies, for each position i of w, the reference of the longest successor factor at i. The reference of i is defined as the position j of the last occurrence of w[i . . i + LSFℓ[i] − 1] in w; we say i refers to j. Formally, LSF-Reference Array (LSFr) is defined as follows. LSFr[i] =(cid:26) nil max{j w[j . . j + LSFℓ[i] − 1] = w[i . . i + LSFℓ[i] − 1]} Computation: Note that the longest successor factor array is a mirror image of the well-studied longest previous factor array which can be computed in O(n) time for integer alphabets [4, 5]. Moreover, in [4], an additional array that keeps a position of some previous occurrence of the longest previous factor was presented; such position may not be the leftmost. Arrays LSFℓ and LSFr can be computed using simple modifications (pertaining to the symmetry between the longest previous and successor factors) of this algorithm1 within O(n) time for integer alphabets; see Appendix A.4 for an example. if LSFℓ[i] = 0, for i < j ≤ n. Remark 1. For brevity, we will use lsf and luf to represent the longest successor factor and the longest unbordered factor, respectively. 1The modified algorithm also computes some starting position j > i for each factor w[i . . i+ LSFℓ[i] − 1], 1 ≤ i ≤ n. Each such factor corresponds to the lowest common ancestor of the two terminal nodes in the suffix tree of w representing the suffixes w[i . . n] and j[j . . n]; this ancestor can be located in constant time after linear-time preprocessing [?]. A linear-time preprocessing of the suffix tree also allows for constant-time computation of the rightmost starting position of each such factor. 4 Problem Definition. The Longest Unbordered Factor Array problem can be defined formally as follows. Longest Unbordered Factor Array Input: A word w of length n. Output: An array LUF[1 . . n] such that LUF[i] is the length of the maximal unbordered factor starting at position i in w, for all 1 ≤ i ≤ n. Example 1. Consider w = aabbabaabbaababbabab, then the longest unbor- dered factor array is as follows. (Observe that w is unbordered thus µ(w) = w = 20.) i 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 b a a b b a b a a b a a b b a b w[i] LUF[i] 20 3 12 9 12 3 14 3 11 3 10 5 b a b a 2 3 5 2 2 2 2 1 3 Combinatorial Tools The core of our algorithm exploits the unique unbordered-decomposition of all suffixes of w in order to compute the length of the maximal (longest) unbordered prefix of each such suffix. Let the unbordered-decomposition of w[i . . n] be uk · · · u1 as in Proposition 2. Then LUF[i] = uk. In order to compute the unbordered-decomposition for all the suffixes efficiently, the algorithm uses the repetitive structure of w characterised by the longest successor factor arrays. Basis of the algorithm. Abstractly, it is easy to observe that for a given position, if the length of the longest successor factor is zero (no factor starting at this position repeats afterwards) then the suffix starting at that position is necessarily unbordered. On the other hand, if the length of the longest successor factor is smaller than the length of the unbordered factor at the reference (the position of the the last occurrence of the longest successor factor) then the ending positions of the longest unbordered factors at this position and that at its reference will coincide; these two cases are formalised in Lemmas 3 and 4 below. The remaining case is not straightforward and its handling accounts for the bulk of the algorithm. Lemma 3. If LSFℓ[i] = 0 then LUF[i] = n − i + 1, for 1 ≤ i ≤ n. Lemma 4. If LSFr[i] = j and LSFℓ[i] < LUF[j] then LUF[i] = j + LUF[j] − i, for 1 ≤ i ≤ n. Proof. Let k = j + LUF[j] − 1. We first show that w[i . . k] is unbordered. Assume that w[i . . k] is bordered and let β be the length of one of its borders (β < LSFℓ[i] as LSFr[i] = j). This implies that w[i . . i + β − 1] = w[k − β + 1 . . k]. Since w[i . . i + LSFℓ[i] − 1] = w[j . . j + LSFℓ[i] − 1], we get w[j . . j + β − 1] = w[k − β + 1 . . k] (i.e., w[j . . k] is bordered) which is a contradiction. Moreover, w[k + 1 . . n] can be factorised into prefixes of w[j . . k] (by definition of LUF); every such prefix is also a proper prefix of w[i . . i + LSFℓ[i] − 1] which will make every factor w[i . . k′], k < k′ ≤ n, to be bordered. This completes the proof. 5 We introduce the notion of a hook to handle finding the unbordered-decomposition of suffixes w[i . . n] for the remaining case (i.e., when LSFℓ[i] ≥ LUF[LSFr[i]]). Definition 3.1 (Hook). Consider a position j in a length-n word w. Its hook Hj is the smallest position q such that w[q . . j − 1] can be decomposed into unbordered prefixes of w[j . . n]. The following observation provides a greedy construction of this decomposi- tion. Observation 5. The decomposition of a word v into unbordered prefixes of another word u is unique. This decomposition can be constructed by iteratively trimming the shortest prefix of u which occurs as a suffix of the decomposed word. Moreover, the decomposability into unbordered prefixes of u is hereditary in a certain sense: Observation 6. If a word v can be decomposed into unbordered prefixes of u, then every prefix of v also admits such a decomposition. Example 2. Consider w = aabbabaabbaababbabab as in Example 1. Observe that H18 = 13: the factor w[13 . . 17] = ba · b · ba can be decomposed into unbor- dered prefixes of w[18 . . 20] = bab. Moreover, no prefix of w[18 . . 20] matches a suffix of w[1 . . 12] = · · · aa. The hook Hj has its utility when j is a reference as shown in the following lemma. Lemma 7. Consider a position i such that LSFℓ[i] ≥ LUF[j], where j = LSFr[i]. Then LUF[i] =(Hj − i LUF[j] if i < Hj, otherwise. Proof. Let u = w[j . . j + LUF[j] − 1], v = w[i . . i + LSFℓ[i] − 1], and q = Hj. Observe that u occurs at position i and that w[q . . n] can be decomposed into unbordered prefixes of u. Case a: i < q. We shall prove that w[i . . q − 1] is the longest unbordered prefix of w[i . . n]; see Fig. 1. By Observation 6, any longer factor w[i . . k], q ≤ k ≤ n has a suffix w[q . . k] composed of unbordered prefixes of u. Thus, w[i . . k] must be bordered, because u is its prefix. To conclude, for a proof by contradiction suppose that w[i . . q − 1] has a border v′. Note that v′ ≤ LSFℓ[i], so v′ is a prefix of v. Hence, it occurs both as a suffix of w[1 . . q − 1] and a prefix of w[j . . n], which contradicts the greedy construction of q = Hj (Observation 5). Case b: i ≥ q. The decomposition of w[q . . n] into unbordered prefixes of u yields a decomposition of w[i . . n] into unbordered prefixes of u, starting with u. This is the unbordered-decomposition of w[i . . n] (see Proposition 2), which yields LUF[i] = u = LUF[j]. 6 i i u v LSFℓ[i] = v LSFr[i] = j q q ur ur−1 · · · u2 u1 Hj = q j j u v LUF[j] = u Figure 1: Case a (i < q): The unbordered-decomposition of w[i . . n] consists of w[i . . q − 1] as the longest unbordered prefix, followed by a sequence of unbor- dered prefixes of u, including u itself at position j. Therefore, LUF[i] = q − i. 4 Algorithm The algorithm operates in two phases: a preprocessing phase followed by the main computation phase. The preprocessing phase accomplishes the following: Firstly, compute the longest successor factor array LSFℓ together with LSFr array. If LSFr[i] = j then we say i refers to j and mark j in a boolean array (IsReference) as a reference. In the main phase, the algorithm computes the lengths of the longest un- bordered factors for all positions in w. Moreover, it determines HOOK[j] = Hj for each potential reference, i.e., each position j such that j = LSFr[i] and LSFℓ[i] ≥ LUF[j] for some i < j; see Lemma 7. Positions are processed from right to left (in decreasing order) so that if i refers to j, then LUF[j] (and HOOK[j], if necessary) has already been computed before i is considered. For each position i, the value of LUF[i] is determined as follows: 1. If LSFℓ[i] = 0, then LUF[i] = n − i + 1. 2. Otherwise (a) If LSFℓ[i] < LUF[j], then LUF[i] = j + LUF[j] − i. (b) If LSFℓ[i] ≥ LUF[j] and i ≥ HOOK[j], then LUF[i] = LUF[j]. (c) If LSFℓ[i] ≥ LUF[j] and i < HOOK[j], then LUF[i] = HOOK[j] − i. If i is a potential reference, then HOOK[i] is also computed, as described in the Section 4.1 (see Algorithm 2 in Appendix A.1 for a pseudo-code of the main algorithm). It is evident that the computational phase of the algorithm fundamentally reduces to finding the hooks for potential references; for brevity, the term reference will mean a potential reference hereafter. 4.1 Finding Hook (FindHook Function) Main idea When FindHook is called on a reference j, it must return Hj. A simple greedy approach follows directly from Observation 5; see also Figure 2. Initially, the factor w[1 . . j − 1] is considered and the shortest suffix of w[1 . . j − 1] which is a prefix of w[j . . n] is computed. Then this suffix, denoted u1 = w[i1 . . j − 1], is truncated (chopped) from the considered factor w[1 . . j − 1]; the next factor considered will be w[1 . . i1 − 1]. In general, we iteratively compute and truncate the shortest prefixes of w[j . . n] from the right 7 q ip · · · ur ip−1 · · · up ik i2 i1 j · · · uk u2 u1 u Figure 2: A chain of consecutive shortest prefixes of w[j . . n] starting at positions i1 > i2 > · · · > ir = q. No prefix of w[j . . n] is a suffix of w[1 . . q − 1], so the hook value of position j is Hj = q. Meanwhile, HOOK[ik] is set to ip−1 in order to avoid iterating through ik+1, . . . , ip−1 again. end of the considered factor; shortening the length of the considered factor in each iteration and terminating as soon as no prefix of w[j . . n] can be found. If the considered factor at termination is w[1 . . q − 1], position q is returned by the function as Hj. The factors w[q . . j −1] considered by successive calls of FindHook function may overlap. Moreover, the same chains of consecutive unbordered prefixes may be computed several times throughout the algorithm. To expedite the chain computation in the subsequent calls of FindHook on another reference j′ (j′ < j), we can recycle some of the computations done for j by shifting the value HOOK[·] of each such index (at which a prefix was cut for j) leftwards (towards its final value). Consider the starting position ik at which uk was cut (i.e., uk = w[ik . . ik−1 − 1] is the shortest unbordered prefix of w[j . . n] computed at ik−1). Let ip be the first position considered after ik such that up > uk. In this case, every factor uk+1, . . . , up−1 is a prefix of uk; see Figure 2. Therefore, w[ip−1 . . ik − 1] can be decomposed into prefixes of uk (and of w[ik . . n]). Consequently, we set HOOK[ik] = ip−1 so that the next time a prefix of length greater than or equal to uk is cut at ik, we do not have to repeat truncating the prefixes uk+1, . . . , up−1 and we may start directly from position ip−1. In order to express the intermediate values in the HOOK table, we generalize the notion of Hj: for a position j and a length ℓ, we define Hℓ j as the largest position q such that w[q . . j − 1] can be decomposed into unbordered prefixes of w[j . . n] whose lengths do not exceed ℓ. Observe that H0 j = Hj if ℓ ≥ LUF[j]. j = j and Hℓ Implementation For each position ik, we set HOOK[ik] = Huk , equal to ip−1 in the case considered above. Computing these values for all indices ik can be efficiently realised using a stack. Every starting position ip, at which up is cut, is pushed onto the stack as a (length, position) pair (up, ip). Before pushing, every element (uk, ik) such that uk < up is popped and the hook value of index ik is updated (HOOK[ik] = Huk = ip−1 = ip + up). A pseudo- code implementation of this function is given below as Algorithm 1. ik ik Analysis Throughout the algorithm, each unbordered prefix up at position ip is computed just once by the FindHook function. Nevertheless, a longer2 2It will be easy to deduce after Lemma 9 that the length of the prefix cut (the next time) at the same position will be at least twice the length of the current prefix cut at it. 8 Algorithm 1 Return Hj and set HOOK[i] ← Hβ the stack i for each (β, i) pushed onto 1: function FindHook(j) 2: 3: st ← NewStack() q ← HOOK[j] β ← FindBeta(q, j) ⊲ the length of the shortest prefix of w[j . . n] ending at q − 1 while (β 6= 0) do 4: 5: 6: 7: 8: 9: 10: 11: HandlePopping(st, j, q, β) Push(st, (β, q − β)) q ← HOOK[q − β] β ← FindBeta(q, j) HandlePopping(st, j, q, ∞) return q 12: function HandlePopping(st, j, q, β) 13: while IsNotEmpty(st) and Length(Top(st)) < β do 14: 15: (length,pos) ← Pop(st) HOOK[pos] ← q ⊲ returns Hj ⊲ q = Hlength pos unbordered prefix u′ on reference j′ (where q < j′ < j). p may be computed at ip again when FindHook is called In what follows, we introduce certain characteristics of the computed unbor- dered prefixes which aids in establishing the relationship between the stacks of various references. Let Sj be the set of positions pushed onto the stack during a call of FindHook on reference j. Definition 4.1 (Twin Set). A twin set of reference j for length ℓ, denoted by T ℓ is the set of all the positions i ∈ Sj which were pushed onto the j , stack paired with length ℓ in the call of FindHook on reference j (i.e., T ℓ j = {i (ℓ, i) was pushed onto the stack of j}). Note that a unique shortest unbordered prefix of w[j . . LUF[j] − 1] occurs at each i belonging to the same twin set. However, as and when a longer prefix at i is cut (say ℓ′) for another reference j′ < j, i will be added to T ℓ′ j ′ . LUF[j] Remark 2. Sj = T ℓ j . Sℓ=1 Hereafter, a twin set will essentially imply a non-empty twin set. Lemma 8. If j′ and j are references such that j′ ∈ Sj, then Hj ≤ Hj ′ . Proof. Since j′ ∈ Sj , the suffix w[j′ . . n] (and, by Observation 6, its every pre- fix w[j′ . . k]) can be decomposed into unbordered prefixes of w[j . . n]. Conse- quently, any decomposition into unbordered prefixes of w[j′ . . n] yields a decom- position into unbordered prefixes of w[j . . n]. In particular, w[Hj ′ . . n] admits such a decomposition, which implies Hj ≤ Hj ′ . If the stack Sj is the most recent stack containing a reference j′, we say that j′ is the parent of j. More formally, the parent of j′ is defined as min{j : j′ ∈ Sj }. If j′ does not belong to any stack (and thus has no parent), we will call it a base reference. 9 Hj i v · · · j′ v · · · k p v′ z z j · · · Figure 3: The pair (z, i) is the first to be pushed onto the stack of j′. The factor z is unbordered, has v as a proper prefix and some v′ as a proper suffix, where both v and v′ are unbordered prefixes of w[j . . n] whose lengths ℓ and ℓ′, respectively, satisfy ℓ < ℓ′. Lemma 9. If j and j′ are two references such that j is the parent of j′ and j′ ∈ T ℓ j , then each position i ∈ Sj ′ satisfies the following properties: 1. i ∈ T ℓ j ; 2. there exists k ∈ T ℓ′ j , with ℓ′ > ℓ, such that (k + ℓ′ − i, i) is pushed onto the stack of j′. j ′ . Proof. Let p be the value of HOOK[j′] prior to the execution of FindHook(j′). Since j′ ∈ T ℓ j ′ . As j is the parent of j′, no further call has updated HOOK[j′]. Thus, we conclude that p = Hℓ j , the earlier call FindHook(j) has set HOOK[j′] = Hℓ Consequently, the first pair pushed onto the stack of j′ (cf. Algorithm 1) is (z, i), where z = w[i . . p − 1] is the shortest suffix of w[1 . . p − 1] which also occurs as a prefix of w[j′ . . n] (see Figure 3). Moreover, observe that z > ℓ by the greedy construction of Hℓ j ′ . Recall that j′ ∈ T ℓ j implies that w[j′ . . n] can be decomposed into unbordered prefixes of w[j . . n], with the first prefix of length ℓ, denoted v = w[j′ . . j′ +ℓ−1]. With an occurrence at position j′, the factor z also admits such a decomposi- tion, still with the first prefix v (due to z > v). Additionally, note that w[p . . j′ − 1] can be decomposed into unbordered prefixes of v. Concatenating the decompositions of z = w[i . . p − 1], w[p . . j′ − 1], and w[j′ . . n], we conclude that w[i . . n] can be decomposed into unbordered prefixes of w[j . . n] with the first prefix (in this unique decomposition) equal to v. Hence, i ∈ Sj ′ belongs to the same twin set as j′; i.e., it satisfies the first claim of the lemma. Additionally, in the aforementioned decomposition of w[i . . n] consider the factor v′ = w[k . . p − 1] which ends at position p − 1. By the greedy construction for ℓ′ = v′ > ℓ. of Hℓ Moreover, recall that (z, i) = (k + ℓ′ − i, i) is pushed onto the stack of j′. Consequently, i also satisfies the second claim of the lemma. j ′ , its length v′ is strictly larger than ℓ, so k ∈ T ℓ′ j A similar reasoning is valid for each i that will appear in Sj ′ . Lemma 10. If j is the parent of two references j′′ < j′, both of which belong to T ℓ j , then Sj ′ ∩ Sj ′′ = ∅. Proof. Let u = w[j . . j + LUF[j] − 1] and v be the shortest unbordered prefix of u cut at j′ and j′′ (i.e., v = ℓ). Let u′ = w[j′ . . j′ + LUF[j′] − 1] and 10 u′′ = w[j′′ . . j′′ + LUF[j′′] − 1]. Here, the current call to the FindHook function has been made on the reference j′′. Consider a position i such that i ∈ Sj ′ and i would also appear in Sj ′′ ; let the corresponding prefixes of u′ and u′′ cut at i be z′ and z′′ (examine Figure 4). Observe that i was in T ℓ j (Lemma 9), therefore, each of z′ and z′′ has v as a proper prefix. Let v′ and v′′ be the corresponding proper suffixes of z′ and z′′ where v′ and v′′ are unbordered prefixes of u; both of length greater than v. q i v · · · p · · · v′ z′′ z′ v v′′ x k · · · j′′ v · · · j u u′ j′ v u′′ Figure 4: The pair (z′, i) and (z′′, i) are pushed onto the stack of j′ and j′′, respectively, where i is a position common to both Sj ′ and Sj ′′ . Since i ∈ Sj ′ , w[i . . j′ − 1] can be decomposed from right to left into unbor- dered prefixes of u′ such that each prefix (say v) of u having length greater than v that had been computed when j was considered, is covered ; i.e., v appears as either a proper suffix or a factor of some shortest prefix in such decomposition. In other words, the shortest prefix of u′ that ends with v starts from the nearest v preceding v whose corresponding position was pushed in Sj ′ . Note that the same condition is also valid for any prefix of v that is longer than v. 1. z′ < z′′: The factor w[p . . k − 1] can be decomposed into unbordered prefixes of u′, where p and k are as in Figure 4. Let x be the rightmost prefix of such decomposition (x has v as proper prefix, v′′ as a proper suffix, and the corresponding position of this v; i.e., i + z′′ − x is in Sj ′ ). Moreover, z′ < x otherwise z′′ cannot be unbordered. Observe the two equal-length factors w[i . . i + z′′] and w[j′′ . . j′′ + z′′]. It follows from i+z′′−x ∈ Sj ′ that j′′+z′′−x ∈ Sj ′ . Consequently, w[i . . i+z′′−x] and w[j′′ . . j′′ + z′′ − x] have the same right to left decomposition in prefixes of u′ implying that if if i ∈ Sj ′ then j′′ should have been in Sj ′ which is a contradiction. 2. z′ ≥ z′′: This implies that z′′ is an unbordered prefix of u′. Therefore, if i was pushed onto the stack of j′ then j′′ should also had been pushed onto its stack which is a contradiction. 4.2 Finding Shortest Border (FindBeta Function) Given a reference j and a position q, function FindBeta returns the length β of the shortest prefix of w[j . . n] that is a suffix of w[1 . . q − 1], or β = 0 if there is no such prefix; note that the sought shortest prefix is necessarily unbordered. To find this length, we use 'prefix-suffix queries' of [13, 12]. Such a query, given a positive integer d and two factors x and y of w, reports all prefixes of 11 x of length between d and 2d that occur as suffixes of y. The lengths of sought prefixes are represented as an arithmetic progression, which makes it trivial to extract the smallest one. A single prefix-suffix query can be implemented in O(1) time after randomized preprocessing of w which takes O(n) time in expec- tation [13], or O(n log n) time with high probability [12]. Additionally, replacing hash tables with deterministic dictionaries [16], yields an O(n log n log2 log n)- time deterministic preprocessing. To implement FindBeta, we set x = [j . . n], y = [1 . . q − 1] and we ask prefix-suffix queries for subsequent values d = 1, 3, . . . , 2k − 1, . . . until d exceeds min(x, y). Note that we can terminate the search as soon as a query reports a non-empty answer. Hence, the running time is O(1 + log β) if the query is successful (i.e., β 6= 0) and O(log n) otherwise. Furthermore, we can expedite the successful calls to FindBeta if we already know that β /∈ {1, . . . , ℓ}. In this case, we can start the search with d = ℓ + 1. j ′ for some j′, we can Specifically, if j is not a base reference and belongs to T ℓ start from d = 2ℓ + 1 because Lemma 9.2 guarantees that β > ℓ + ℓ′ ≥ 2ℓ. 5 Analysis Algorithm 2 computes the longest unbordered factor at each position i; position i is a start-reference or it refers to some other position. The correctness of the computed LUF[i] follows directly from Lemmas 3 through 7. The analysis of the algorithm running time necessitates probing of the total time consumed by FindHook and the time spent by FindBeta function which, in turn, can be measured in terms of the total size of the stacks of various references. Lemma 11. The total size of all the stacks used throughout the algorithm is O(n log n). Moreover, the total running time of the FindBeta function is O(n log n). Proof. First, we shall prove that any position p belongs to O(log n) stacks. By Lemma 9.1, the stack of any reference is a subset of the stack of its parent. Moreover, by Lemmas 9.1 and 10, the stacks of references sharing the same parent are disjoint. A similar argument (see Lemma 13 in Appendix A.3) shows that the stacks of base references are disjoint. Consequently, the references j1 > . . . > js whose stacks Sji contain p form a chain with respect to the parent relation: j1 is a base reference, and the parent of any subsequent ji is ji−1. Let us define ℓ1, . . . , ℓs so that p ∈ T ℓi ji . By i > ℓi such that ki ∈ T ℓ′ Lemma 9.2, for each 1 ≤ i < s, there exist ki and ℓ′ i ji and ℓi+1 = ki − p + ℓ′ i ≥ ℓi + ℓ′ i > 2ℓi. Due to 1 ≤ ℓi ≤ n, this yields s ≤ 1 + log n = O(log n), as claimed. Next, let us analyse the successful calls β = FindBeta(q, j) with p = q − β. Observe that after each such call, p is inserted to the stack Sj and to the twin set j , i.e, j = ji and β = ℓi for some 1 ≤ i ≤ s. Moreover, if i > 0, then ji ∈ T ℓi−1 T β ji−1 , which we are aware of while calling FindBeta. Hence, we can make use of the fact that ℓi /∈ {1, . . . , 2ℓi−1} to find β = ℓi in time O(log ℓi ). For i = 1, ℓi−1 the running time is O(1 + log ℓ1). Hence, the overall running time of successful 12 i=2 log ℓi ℓi−1 O(1 + log ℓs) = O(log n), which sums up to O(n log n) across all positions p. queries β = FindBeta(q, j) with p = q − β is O(1 + log ℓ1 +Ps ) = As far as the unsuccessful calls 0 = FindBeta(q, j) are concerned, we ob- serve that each such call terminates the enclosing execution of FindHook. Hence, the number of such calls is bounded by n and their overall running time is clearly O(n log n). Theorem 12. Given a word w of length n, Algorithm 2 solves the Longest Unbordered Factor Array problem in O(n log n) time with high probability. It can also be implemented deterministically in O(n log n log2 log n) time. Proof. Assuming an integer alphabet, the computation of LSFℓ and LSFr arrays along with the constant time per position initialisation of the other arrays sum up the preprocessing stage (Lines 2–7) to O(n) time. The running time required for the assignment of the luf for all positions (Lines 9–18) is O(n). The time spent in construction of the data structure to answer prefix-suffix queries used in FindBeta function is O(n log n) with high probability or O(n log n log2 log n) deterministic. Additionally, the total running time of the FindHook function for all the references, being proportional to the aggregate size of all the stacks, can be deduced from Lemma 11. This has been shown to be O(n log n) in the worst case, same as the total running time of FindBeta. The claimed bound on the overall running time follows. To show that the upper bound shown in Lemma 11 in the worst case is tight, we design an infinite family of words that exhibit the worst-case behaviour (see Appendix A.2 for more details). 6 Final Remark Computing the longest unbordered factor in o(n log n) time for integer alphabets remains an open question. References [1] A. V. Aho, J. E. Hopcroft, and J. D. Ullman. The design and analysis of computer algorithms, 1974. Reading: Addison-Wesley, pages 207–209, 1987. [2] P. Cording and M. Knudsen. Maximal unbordered factors of random strings. In S. Inenaga, K. Sadakane, and T. Sakai, editors, Proceedings of the International Symposium String Processing and Information Retrieval SPIRE, pages 93–96, 2016. [3] M. Crochemore, C. Hancart, and T. Lecroq. Algorithms on Strings. Cam- bridge University Press, 2007. [4] M. Crochemore and L. Ilie. Computing longest previous factor in linear time and applications. Inf. Process. Lett., 106(2):75–80, 2008. 13 [5] M. Crochemore, L. Ilie, C. S. Iliopoulos, M. Kubica, W. Rytter, and T. Wale´n. Computing the longest previous factor. Eur. J. Comb., 34(1):15– 26, 2013. [6] M. Crochemore and W. Rytter. Jewels of Stringology. World Scientific, 2002. [7] J. Duval. Relationship between the period of a finite word and the length of its unbordered segments. Discrete Mathematics, 40(1):31 – 44, 1982. [8] J.-P. Duval, T. Lecroq, and A. Lefebvre. Linear computation of unbordered conjugate on unordered alphabet. Theoretical Computer Science, 522:77 – 84, 2014. [9] A. Ehrenfeucht and D. Silberger. Periodicity and unbordered segments of words. Discrete Math, 26(2):101–109, 1979. [10] P. Gawrychowski, G. Kucherov, B. Sach, and T. Starikovskaya. Computing the longest unbordered substring. In C. Iliopoulos, S. Puglisi, and E. Yil- maz, editors, Proceedings of the International Symposium String Processing and Information Retrieval SPIRE, pages 246–257, 2015. [11] S. Holub and D. Nowotka. The Ehrenfeucht–Silberger problem. Journal of Combinatorial Theory, Series A, 119(3):668–682, 2012. [12] T. Kociumaka, J. Radoszewski, W. Rytter, and T. Wale´n. Efficient data In String Processing and structures for the factor periodicity problem. Information Retrieval SPIRE, pages 284–294. Springer, 2012. [13] T. Kociumaka, J. Radoszewski, W. Rytter, and T. Walen. Internal pat- tern matching queries in a text and applications. In Proceedings of the Annual ACM-SIAM Symposium on Discrete Algorithms SODA, pages 532– 551, 2015. [14] G. Kucherov, A. Loptev, and T. Starikovskaya. On maximal unbordered factors. In Proceedings of the Annual Symposium on Combinatorial Pat- tern Matching CPM, Lecture Notes in Computer Science, pages 343–354. Springer, 2015. [15] J. Morris Jr and V. Pratt. A linear pattern-matching algorithm. Technical Report 40, University of California, Berkeley, 1970. [16] M. Rui. 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, Automata, Languages and Programming, ICALP 2008, Part I, volume 5125 of LNCS, pages 84–95. Springer, 2008. 14 A Appendix A.1 Pseudo-code Algorithm 2 Compute the Longest Unbordered Factor Array 1: procedure LongestUnborderedFactor(word w, integer n = w) ⊲ Preprocessing: LSFℓ, LSFr ← LongestSuccessorFactor(w) for i ← 1 to n do if LSFℓ[i] 6= 0 then IsReference[LSFr[i]] ← true HOOK[1 . . n] ← 1, · · · , n ⊲ Main Algorithm: for i ← n to 1 do if LSFℓ[i] = 0 then LUF[i] ← n − i + 1 else j ← LSFr[i] if LSFℓ[i] < LUF[j] then LUF[i] ← j + LUF[j] − i else if i ≥ HOOK[j] then LUF[i] ← LUF[j] else LUF[i] ← HOOK[j] − i if IsPotentialReference(i) then 3 HOOK[i] ← FindHook(i) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: ⊲ starting reference A C++ implementation of our algorithm can also be made available upon request. A.2 Words Exhibiting Worst-Case Behaviour A word can be made to exhibit the worst-case behaviour if we force the maximum number of positions to be pushed onto Θ(log n) stacks. This can be achieved as follows. 1. Maximise the number of references: Every position in each twin set T l j is a reference. 2. Maximise the size of each stack: The largest position (reference) in any If j′ is largest twin set pushes the rest of the positions onto its stack. reference in T ℓ j then Sj ′ = T ℓ j − {j′}. 3. Maximise the number of twin sets obtained for a stack: This increases the number of unbordered prefixes that can be cut at some position i, therefore, increasing the number of re-pushes of i. This can be achieved by keeping T ℓ + 1. j = 2T ℓ+1 j Using the above, Algorithm 3 creates a word w over Σ = {a,b}, such that the total size of the stack of the base reference j (w[j] = a) and the references that 3 IsPotentialReference(i) returns true if there exists i′ such that LSFr[i′] = i and LSFℓ[i′] ≥ LUF[i]. 15 appear in Sj is tSj − t, where t is the number of non-empty twin sets obtained for the stack of j. Assume a binary alphabet Σ = {a, b}, the following words exhibit the maximum total size of the stacks used: w3 = (aabaabb)2, tmax = 3; w4 = (aabaabbaabaabbb)2, tmax = 4; w5 = (aabaabbaabaabbbaabaabbaabaabbbb)2, tmax = 5; etc., where tmax is the maximum number of stacks onto which some propor- tional number of elements has been pushed by Algorithm 2. Position 1 in w4, for example, is pushed onto four stacks paired with length 1, 3, 7 then 15. The total size of the stacks used by each word from this family of words is thus Θ(n log n). Figure 5 (in Appendix A.2) shows the relation between the lengths of the words and the total size of the stacks used by Algorithm 2 for the specified family of the words. Algorithm 3 Create Word w Over Σ = {a,b} 1: w ← "" 2: block ← "a" 3: i ← 1 4: while i ≤ t − 1 do 5: 6: 7: 8: w ← w + block 9: w ← w + w w ← w + block + w block ← block + "b" i ← i + 1 15 10 x a m t 5 1 0.5 tmax total size of stacks 0 0 0.5 1 1.5 2 2.5 n/105 6 0 1 / s k c a t s f o e z i s l a t o t Figure 5: Plot showing the maximum number of stacks onto which some element has been pushed (tmax) and the total size of stacks used by Algorithm 2 for specially designed words. A.3 Stacks of the Base References are Disjoint Lemma 13. If j1 6= j2 are base references, then Sj1 ∩ Sj2 = ∅. Proof. Suppose that the FindHook function is called for each position in w. We define a base position analogously as a position that does not appear in any stack. For a proof by contradiction, let i be the largest element of Sj1 ∩ Sj2 , with (ℓ1, i) and (ℓ2, i) pushed onto the stacks of j1 and j2, respectively. Note 16 that i + ℓ1 ∈ {j1} ∪ Sj1 and i + ℓ2 ∈ {j2} ∪ Sj2 . Thus, our choice of j1 6= j2 as base positions and i as the largest element of Sj1 ∩ Sj2 guarantees ℓ1 6= ℓ2. We assume that ℓ1 < ℓ2 without loss of generality. Let u be the longest unbordered factor at j1. Note that due to i ∈ Sj1 , the suffix w[i . . n] can be decomposed into unbordered prefixes of u. In particular, w[i . . i + ℓ2 − 1] admits such a decomposition w[i . . i + ℓ2 − 1] = v1 · · · vr with v1 = ℓ1. Moreover, observe that vr > ℓ1; otherwise, vr would be a border of w[i . . i + ℓ2 − 1]. Let vs be the first of these factors satisfying vs > ℓ1 and let k = j1 + v1 · · · vs−1. Note that w[j1 . . k − 1] admits a decomposition w[j1 . . k − 1] = v1 · · · vs−1 into unbordered prefixes of vs. Consequently, j1 ∈ Sk if k is a base position, and j1 ∈ Sk′ if k is not a base position and k ∈ Sk′ for some base position k′. In either case, this contradicts the assumption that j1 is a base position. In fact, Algorithm 2 calls the FindHook function on a subset of positions; i.e., potential references. However, as we show below, all base references are actually base positions. For a proof by contradiction, suppose that j′ is a base reference, but it would have been pushed onto the stack of a base position j > j′. Below, we show that the longest unbordered factor at j, denoted u, does not have any other occurrence in w. First, suppose that it occurs at a position k > j. Observe that w[j . . k − 1] can be decomposed into unbordered prefixes of u. Consequently, j ∈ Sk if k is a base position, and j ∈ Sk′ if k is not a base position and k ∈ Sk′ for some base position k′. In either case, this contradicts the assumption that j is a base position. Next, suppose that u occurs at a position k < j and let us choose the largest such k. Observe that LSFℓ[k] ≥ u and LSFr[k] = j since j is the only position of u larger than k. However, this means that j is a potential reference, contrary to our assumption. In particular, we conclude that u′ = w[j′ . . j + u − 1] does not have any border of length u or more. On the other hand, shorter borders are excluded since u is unbordered and u′ can be decomposed into unbordered prefixes of u. Consequently, u′ is unbordered. However, j′ is a potential reference, so u′ occurs to the left of j′. This yields an occurrence of u to the left of j, a contradiction. A.4 Example of Longest Successor Factor Arrays Example 3. Let w = aabbabaabbaababbabab. The associated arrays are as follows. i w[i] 9 10 11 12 13 14 15 16 17 18 19 20 1 2 b b a a LSFℓ[i] 5 6 3 0 LSFr[i] 7 14 15 16 17 10 11 14 15 18 19 17 18 19 20 18 19 20 nil nil 7 a 3 8 a 4 a 4 b 3 a 2 b 1 a 2 b 1 b 2 a 1 3 b 5 4 b 4 5 a 3 6 b 4 b 3 a 0 17
1603.07768
1
1603
2016-03-24T22:16:13
Online Budgeted Allocation with General Budgets
[ "cs.DS" ]
We study the online budgeted allocation (also called ADWORDS) problem, where a set of impressions arriving online are allocated to a set of budget-constrained advertisers to maximize revenue. Motivated by connections to Internet advertising, several variants of this problem have been studied since the seminal work of Mehta, Saberi, Vazirani, and Vazirani (FOCS 2005). However, this entire body of work focuses on a single budget for every advertising campaign, whereas in order to fully represent the actual agenda of an advertiser, an advertising budget should be expressible over multiple tiers of user-attribute granularity. A simple example is an advertising campaign that is constrained by an overall budget but is also accompanied by a set of sub-budgets for each target demographic. In such a contract scheme, an advertiser can specify their true user-targeting goals, allowing the publisher to fulfill them through relevant allocations. In this paper, we give a complete characterization of the ADWORDS problem for general advertising budgets. In the most general setting, we show that, unlike in the single-budget ADWORDS problem, obtaining a constant competitive ratio is impossible and give asymptotically tight upper and lower bounds. However for our main result, we observe that in many real-world scenarios (as in the above example), multi-tier budgets have a laminar structure, since most relevant consumer or product classifications are hierarchical. For laminar budgets, we obtain a competitive ratio of e/(e-1) in the small bids case, which matches the best known ADWORDS result for single budgets. Our algorithm has a primal-dual structure and generalizes the primal-dual analysis for single- budget ADWORDS first given by Buchbinder, Jain, and Naor (ESA 2007).
cs.DS
cs
Online Budgeted Allocation with General Budgets Nathaniel Kell Debmalya Panigrahi Department of Computer Science, Duke University, Durham, NC, USA. Email: {kell,debmalya}@cs.duke.edu Abstract We study the online budgeted allocation (also called ADWORDS) problem, where a set of impressions arriving online are allocated to a set of budget-constrained advertisers to maximize revenue. Motivated by connections to Internet advertising, several variants of this problem have been studied since the seminal work of Mehta, Saberi, Vazirani, and Vazirani (FOCS 2005). However, this entire body of work focuses on a single budget for every advertising campaign, whereas in order to fully represent the actual agenda of an advertiser, an advertising budget should be expressible over multiple tiers of user-attribute granularity. A simple example is an advertising campaign that is constrained by an overall budget but is also accompanied by a set of sub-budgets for each target demographic. In such a contract scheme, an advertiser can specify their true user-targeting goals, allowing the publisher to fulfill them through relevant allocations. In this paper, we give a complete characterization of the ADWORDS problem for general advertising budgets. In the most general setting, we show that, unlike in the single-budget ADWORDS problem, obtaining a constant competitive ratio is impossible and give asymptotically tight upper and lower bounds. However for our main result, we observe that in many real-world scenarios (as in the above example), multi-tier budgets have a laminar structure, since most relevant consumer or product classifications are hierarchical. For laminar budgets, we obtain a competitive ratio of e/(e − 1) in the small bids case, which matches the best known ADWORDS result for single budgets. Our algorithm has a primal-dual structure and generalizes the primal-dual analysis for single-budget ADWORDS first given by Buchbinder, Jain, and Naor (ESA 2007). However many new ideas are required to overcome the barriers introduced by laminar budgets-our algorithm uses a novel formulation that overcomes non-monotonicity in the syntactically defined dual variables, as well as a dynamically maintained labeling scheme that properly tracks the "most-limiting" budgets in the hierarchy. Internet advertising, adwords, user targeting, primal-dual algorithms Index Terms I. INTRODUCTION The online budgeted allocation problem, also called the ADWORDS problem, has had a significant impact on the theory and practice of online (Internet) advertising. In this problem, an advertisement publisher is tasked with matching user-generated advertisement slots on a web page (typically called impressions) to advertisers (typically called bidders). More formally, the publisher is given a set of offline bidders u ∈ U at the outset of the problem, each of which is specified by a budget Bu indicating the maximum revenue the publisher can receive from bidder u. A set of impressions v ∈ V then arrive in an online sequence and must each be irrevocably assigned to a unique bidder. Upon assigning impression v to bidder u, the publisher receives revenue ruv (typically called a bid value) from bidder u. The objective is to maximize the total revenue generated over all impressions. The ADWORDS problem was introduced in the seminal work of Mehta, Saberi, Vazirani, and Vazirani [22]. While this problem generalizes the classic online matching problem introduced by Karp, Vazirani, and Vazirani [19], the research focus has been on the so called small bids case, i.e., on algorithmic performance as the ratio maxv∈V buv tends to 0 for all advertisers. This assumption models most real-world scenarios, where the revenue generated from a single impression is infinitesimal compared to the total budget of an advertiser. The small bids assumption distinguishes ADWORDS from online matching and makes them incomparable from a technical perspective; given its natural applicability and popularity in Internet advertising, we will also focus primarily on the small bids case. Since the introduction of these problems, several variants of ADWORDS and online matching have been studied, motivated primarily by the evolving challenges advertisement publishers face in practice. For example, Agrawal and Devanur [4] recently considered arbitrary linear and non-linear convex budget constraints for the stochastic input model, and Devanur and Jain [12] studied concave returns on revenue, both motivated by problem features such as Bu Illustration of how the "Californian female" example translates into a bidder's budget in an instance of ADGENERAL Fig. 1. (and in this case also ADLAMINAR). For simplicity, we only have a Los Angeles residency subdivision for the 30-39 age range, giving us four dimensions in total. Observe that Ks = {2, 3} for the 30-39 age-range budget, and and Ks = {1, 2, 3, 4} for the overall budget; furthermore, we have that B{2,3} = 2500. The algorithm has currently earned $500, $100, and $400 on dimensions 1, 3, and 4, respectively (and $0 on dimensions 2); therefore, we have used $1025 out of the overall budget's capacity of $2500. If an impression v is newly assigned to this bidder u such that r(1) uv = $10 and r(k) uv = 0 for k = 2, 3, 4, then we will have then earned $510 on dimension 1 and $1035 overall. = 1000 and B{1,2,3,4} u u under-delivery penalties and pay-per-click advertisements. Another motivation for these variants that is receiving increasing attention is that of impression diversification or representativeness. More specifically, a campaign contract is usually of the form: "deliver ten million advertisements to Californian females in the month of July." Although such an agreement clearly indicates a target group to which the publisher should restrict its assignments, often the advertiser still wants the impressions to be equally spread among the sub-populations of the targeted group (e.g., in the above contract, the advertiser will likely be unhappy if their ads are only shown to white females in their twenties living in Los Angeles). Although it can be at odds with short-term revenue gains, ensuring diversity is crucial with respect to long-term revenue for the publisher, as advertisers that see a high return on investment (in this case via reaching desired audiences) are more likely to continually purchase future contracts. There are several recent works that address impression diversification (e.g., see [15], [7], and [17]). In many of these results, the objective function of the problem incorporates a diversity penalty, usually in the form of a distance function that incurs a cost if the algorithm's assignment differs too much from the advertiser's ideal allocation. However another natural approach, which to the best of our knowledge has yet to be considered, is a scheme where contracts are specified over multiple tiers of user-attribute granularity. Recalling our previous contract example, in a multi-tier scheme the advertiser could further specify constraints in terms of age groups, e.g., "no more than four million of the total ten million advertisements should be shown to age groups 20-29, 30-39, and 40+, respectively." Further constraints could also be placed on each age group in terms of residency, e.g., "of the maximum four million advertisements assigned in each age group, no more than two million should be shown to residents in Los Angeles." This scheme has several appealing features, the foremost being that it allows advertisers to explicitly indicate their true user-targeting goals with a high degree of expressibility (whereas penalty functions often assume that the ideal allocation must follow the same distribution as the overall targeted population, i.e., is forced to be a representative sample). With this motivation, we introduce a generalization of the ADWORDS problem that we call ADWORDS with general budgets (denoted ADGENERAL). As earlier, there is an offline set of advertisers U, and a set of impressions V that arrive online. We also have a set of dimensions Ku for each bidder u that represent the smallest level of {+ $2500 20-29 + 30-39 + 40+ + $1000 $1000 $1000 $∞ (dimension 1) LA 30-39 + + $500 (dimension 2) (dimension 3) (dimension 4) LA 30-39 + + {{$500 $400 $125 $500 + $400 + $125 = $1025 (k) user-attribute granularity over which the bidder defines her budgets. In our previous example, one dimension would correspond to "Californian females living in Los Angeles in the age range 20-29"; another dimension would be "Californian females living outside of Los Angeles in age range 40+". For simplicity of notation, we will consider a universal set of dimensions K = ∪uKu and assume that each bidder has this same set of dimensions; dimensions in K\Ku will simply earn no revenue and have no budget constraints for bidder u. If an impression v is assigned to uv (called the bid value in dimension k) on each dimension k ∈ K. Note an advertiser u, then the algorithm earns r (k) that we allow multiple non-zero r uv revenue entries for a single impression-bidder pair (u, v). This is to reflect the fact that certain categories are more definite than others. For instance, the campaign that an advertisement belongs to is known but attributes of an online user may be less certain. If an anonymous online user has a 60% chance of being below 30 and 40% of being above 30 (e.g., based on browsing behavior), then the revenue earned for this user should be split in the same proportion between these two user category dimensions. In this case, the bid vector has a non-zero entry in multiple dimensions. (The reader is referred to Chatwin [11] for an overview on uncertainty in determining online user attributes. Adhikari and Dutta discuss how attribute uncertainty is weighted in real-time bidding strategies [1], while Ghosh et al. [15] highlights the different levels of information about the users available to different entities in Internet advertising. Techniques for determining user attributes based on historical and prior behavior have also been extensively studied in the marketing research community (see Barajas Jamora [6] and references contained therein), where the mapping of user behavior to attributes is inherently probabilistic.) The revenue generated from an advertiser u is subject to an arbitrary set of budget constraints Su, where each (see Figure constraint s ∈ Su caps the total revenue generated from a subset of dimensions Ks to a budget B 1 to see how subsets of dimensions are used to define the budgets in our example). As usual, the objective in the ADGENERAL problem is to maximize the total revenue generated by the algorithm. We will measure our algorithms using competitive analysis, which is the maximum ratio over all instances of the objectives of an optimal solution and the algorithmic solution (see, e.g., [9]). (s) u A natural question is whether this generalization changes the structure of the ADWORDS problem. To understand this, let us consider an instance with a single advertiser. In this case, an algorithm that assigns all impressions to the lone advertiser is clearly optimal for the ADWORDS problem. However, let us now consider the ADGENERAL problem with 2 dimensions, and budget constraints of $1 each on dimensions {1, 2} and {2, 3}. Now, suppose the first impression has a revenue of $1 on dimension 2 alone. Should the algorithm assign the impression to the lone advertiser? If it does, then the instance will generate two impressions yielding a revenue of $1 on dimensions 1 and 3 each, while if it does not, then the instance will generate no other impression. Clearly, this example shows that no algorithm can do better than a competitive ratio of 2, even with a single advertiser. One may object that the small bids assumption is being violated, but replacing an impression of bid value $1 with 1/ impressions of bid value  → 0 still produces a constant lower bound of 3/2. In fact, this lower bound is a manifestation of a more general observation: it may be a better option for the algorithm to not allocate an impression, or to not earn revenue from some of the dimensions, even when possible to do so. This is in sharp contrast to the classical ADWORDS problem, where an impression should always be allocated if possible. Thus, the ADGENERAL problem introduces an aspect of "admission control" to the ADWORDS framework. Our results for ADGENERAL are characterized in the following theorem. Theorem 1. The competitive ratio of the ADGENERAL problem is Θ(lg p) under the small bids assumption, where p = maxu∈U,k∈K {s : k ∈ Ks} denotes the the maximum number of budget constraints for an advertiser to which any dimension belongs. Although there is a super-constant lower bound for ADGENERAL, we observe that many multi-tier budgets based on real-world instances will have additional structure. As we saw earlier in our motivating example, each budget constraint was a subdivision of a more general constraint, i.e., the total budget for Californian females was divided into age groups to obtain the second level of budgets, and then each of these age groups was divided based on residency to obtain the next level. In essence, many consumer and product classifications are naturally hierarchical. If the budgets of an ADGENERAL instance are defined over such a taxonomy, then we have the additional structure that the budget sets {Ks : s ∈ Su} for each bidder u form a laminar family, i.e., for every pair of intersecting sets in {Ks : s ∈ Su}, one is contained in the other. Thus, we also consider the ADWORDS with laminar budgets problem (ADLAMINAR). It turns out that laminar budgets make admission control redundant - the algorithm can now earn revenue whenever possible. However, there are other conceptual difficulties. Consider an instance with 2 dimensions, where an advertiser has a budget of $1 for dimension 1 and an overall budget of $2 for dimensions {1, 2}. At any point in the algorithm, what is the total budget of dimension 2, i.e., cap on total revenue earned from dimension 2? This value clearly depends on the revenue earned on dimension 1, and therefore changes during the course of the algorithm. This is in sharp contrast to the classical ADWORDS setting where the total budget of a bidder remains unchanged during the course of the algorithm (note the distinction between total budget and remaining budget). The first technical hurdle, therefore, is to define a dynamic notion of total budget on individual dimensions. In addition, we also need to define a notion of current budget utilization for individual dimensions to determine which dimensions we should prefer in making the allocation. Again, this notion is canonical in the classical ADWORDS problem – it is simply the fraction of the budget of a bidder that has already been earned as revenue. In our more general setting, a single dimension might be in multiple budget constraints, and therefore, we must first identify the most constraining budget. Once we do so, we need a mechanism for importing the budget utilization of this constraining budget to the dimension itself. For instance, in the example above, if the revenue earned on dimension 1 is $1 and that on dimension 2 is $0 at some point in the algorithm, then should be budget utilization for dimension 2 be 0.5 (from its most constraining budget constraint) or 0 (from the fact that the algorithm has not earned any revenue at all from dimension 2 yet)? It turns out that these concepts (revenue cap, most constraining budget, and budget utilization of a dimension) are closely tied to each other and have to be defined through a common inductive process. Our main technical contribution for the ADLAMINAR problem is to carefully define these entities in a way that ensures semantic consistency and eventually gives our main result for this problem: an algorithm with a competitive ratio of e/(e− 1), matching that for the classic ADWORDS problem [22]. Theorem 2. The competitive ratio of ADLAMINAR is e/(e − 1) under the small bids assumption. Finally, we study the ADGENERAL problem without the small bids assumption. In the absence of this assumption, there are two possible variants – either (a) the algorithm can choose the amount of revenue it earns on any given dimension (which can be less than the corresponding bid value) from an impression, or (b) the algorithm is constrained to earn the entire bid value as revenue on any dimension, which means that an assignment of an impression to an advertiser is only allowed if adding the bid value to the previously earned revenue on each dimension does not violate any constraint. The former is more natural in the context of Internet advertising – we call it the ADGEN-P problem1 and match the bounds in the small bids case. Theorem 3. The competitive ratio of the ADGEN-P problem is Θ(lg p), where p = maxu∈U,k∈K {s : k ∈ Ks} denotes the the maximum number of budget constraints for an advertiser to which any dimension belongs. (cid:80) We also study the latter problem (where the entire bid value is always added to the revenue), primarily because of interesting connections to the classical online admission control problem [5]. In Theorem 4, we give the competitive ratio of the ADGEN-AON problem (AON for "all or nothing"). As a byproduct of our result, we also obtain tight bounds for the online admission control problem, slightly improving the classical bounds of [5]. Theorem 4. Let  = maxu,v,s denote the maximum bid-to-budget ratio and p = maxu∈U,k∈K {s : k ∈ Ks} denote the the maximum number of budget constraints for an advertiser that a dimension belongs to. If lg(2p) <  < 1, then the competitive ratio of the ADGEN-AON problem is Θ Note that we do not consider  ≤ 1 For reasons of brevity, we do not discuss the admission control problem here – the implication of the above theorem to this problem is straightforward – and relegate the details for the large bids case, both ADGEN-P and ADGEN-AON, to the appendix. lg(2p) in Theorem 4, as in this case ADGEN-AON is essentially identical to ADGENERAL with small bids. (cid:16) p k∈Ks B(s) u (cid:17) .  1−  r(k) uv 1 1P for "partial" Related Work. Given the large volume of work in this area, we will only sample a small fraction of the online matching and ADWORDS literature, focusing on results in the (adversarial) online model. For a comprehensive survey, including results in stochastic input models, the reader is referred to the survey by Mehta [20]. Karp, Vazirani, and Vazirani [19] introduced the online matching problem, and gave a tight e/(e− 1)-competitive algorithm (see also [16], [8], and [13]). The first generalization was to the b-matching problem by Kalyanasundaram and Pruhs [18]. Later generalizations include a vertex-weighted version by Aggarwal et al. [3], a pay-per-click model using stochastic rewards by Mehta and Panigrahi [21] (see also [23]), and a bi-objective model suggested by Aggarwal et al. [2]. Devanur and Jain [12] explored non-linear concave objectives to encode, e.g., penalties for under-delivery. In terms of techniques, most of the initial results used combinatorial methods, but recent work has focused on a (randomized) primal dual technique introduced by Devanur et al. [13]. The ADWORDS problem, which generalizes b-matching, was introduced by Mehta et al. [22], who gave an e/(e − 1) approximation for small bids. They also showed that this competitive ratio is the best possible. Without the small bids assumption, the greedy algorithm for the ADWORDS problem has a competitive ratio of 2, and while this is tight for deterministic algorithms, obtaining a better ratio using a randomized algorithm is open. Buchbinder et al. [10] gave an alternative primal-dual analysis for the algorithm of Mehta et al. [22] with the same competitive ratio. More recently, other variants of the ADWORDS problem have been considered. For instance, Feldman et al. [14] and Aggarwal et al. [3] introduced variants to model display ads with vertex weights and/or capacities. Paper Organization. In Section II, we prove an e/(e − 1) upper bound for ADLAMINAR under the small bids assumption (Theorem 2). In Section III, we prove an O(lg p) upper bound for ADGENERAL under the small bids assumptions (Theorem 1). Our results for ADGENERAL without the small bids assumptions (Theorems 3 and 4 for ADGEN-P and ADGEN-AON, respectively), as well as our Ω(lg p) lower bound for ADGENERAL, can be found in the appendix. II. ADWORDS WITH LAMINAR BUDGET CONSTRAINTS (ADLAMINAR) (k) Recall the ADLAMINAR problem: we given a set of offline bidders U and a set of impressions V that arrive online, where each bidder-impression pair (u, v) is specified by a bid value r uv for each dimension k ∈ K. The revenue generated from a bidder u is subject to an arbitrary set of budget constraints Su, where each constraint (s) s ∈ Su caps the total revenue generated from a subset of dimensions Ks to a given budget B u . We assume that the sets {Ks : s ∈ Su} form a laminar family, i.e., for every pair of intersecting sets in {Ks : s ∈ Su}, one is contained in the other. In this section, we give an algorithm for the ADLAMINAR problem with a competitive ratio of e/(e − 1) under the small bids assumption (Theorem 2). This bound is tight because of a matching lower bound for the ADWORDS problem [22]. Throughout this section, we assume that for every dimension k ∈ K, a constraint s with Ks = {k} appears in Su for each bidder u. This is wlog since a budget can be made arbitrarily large. We will call these constraints singleton budgets of bidder u. A. Primal and Dual Formulations Our algorithm uses a primal-dual formulation of the ADLAMINAR problem. In other words, we give a primal LP formulation of the ADLAMINAR problem and its corresponding dual, and update the solutions to both LPs on the arrival of a new impression. The primal updates, which are guided by the dual solution, define the algorithm. The main challenge is to show that the dual updates maintain feasibility while ensuring that the ratio of the primal and dual objectives remains bounded by the desired competitive ratio ρ = e/(e − 1). (s) Let us define the current budget utilization for constraint s of bidder u (denoted κ u ) to be the fraction of budget (s) for impressions v assigned to bidder B u u thus far. Let us call a dimension k active for bidder u if for all budgets s ∈ Su such that k ∈ Ks, the algorithm (s) u < 1. In other words, u's active dimensions are the ones on which the algorithm can still receive currently has κ revenue from u. currently used by the algorithm, or formally, κ k∈Ks,v r u =(cid:80) (s) (k) uv /B (s) u An algorithm for ADLAMINAR might gain revenue from only a subset of dimensions when assigning an impression to a bidder. To implement this flexibility in the LP, we introduce the notion of assignment types. Note that Eq. (1) ensures that the algorithm receives no revenue from inactive dimensions for a bidder, and Eq. (2) ensures that every impression v is assigned using a single type to a single bidder. The dual D of this LP is defined as: u ∀ u ∈ U, v ∈ V, t ⊆ K : min α(s) u B(s) u + (cid:88) (cid:88) (cid:88) s∈Su s∈Su (cid:32) ∀ u ∈ U, s ∈ Su : ∀ v ∈ V : (cid:88) (cid:88) v σv (cid:33) α(s) u (k) r uvt k∈Ks α(s) u ≥ 0 σv ≥ 0. (cid:88) k (k) r uvt + σv ≥ (3) Let t ⊆ K. For impression v and bidder u, we define a type-t assignment as one where the dimensions in t are active and the dimensions in K \ t are inactive. Thus, our decision variables for the LP will be of the form xuvt, where the algorithm sets xuvt to be 1 if impression v is assigned to bidder u using a type-t assignment (and 0 otherwise). We then define r (k) uvt = 0. Our primal LP P is now defined as: (k) uvt = r (k) (cid:88) (cid:88) uv if k ∈ t; otherwise, r (cid:88) xuvt (cid:88) ∀ u ∈ U, s ∈ Su : max xuvt u,v,t v,t k ∀ v ∈ V : u,t (k) r uvt (cid:88) k∈Ks xuvt ≤ 1 (k) uvt ≤ B(s) r u ∀ u ∈ U, v ∈ V, t ⊆ K : xuvt ≥ 0. (1) (2) (s) u = 1 once a budget B Now, if we naıvely enforce α (s) u = 1, then the dual variable α Unfortunately, the dual stated above cannot be used directly in a primal dual algorithm. If a constraint s has budget (s) utilization κ u also needs to be equal to 1 in order to balance the contributions to the two sides of the dual constraint by dimensions k ∈ Ks. (Note that the primal objective does not increase for these dimensions and hence the value of σv in the dual objective cannot depend on these dimensions either, if the ratio of the primal to dual objective is to be maintained.) (s) u is tight, then the primal-dual ratio could be proportional to the number of nested levels, if a nested set of budgets are all tight. To obtain a constant competitive ratio, (s) what our scheme will (roughly speaking) need to do is only set α to 1 at the highest level of nesting for each u nested set of tight constraint. If we think of the primal objective as being "attributed" to dual variables in order to maintain the primal dual ratio, then what we roughly want is that at any point of time, the primal objective from a given dimension for some bidder u is attributed to a unique dual variable representing a budget constraint for u (s) u variables need to containing that dimension. However, in order to implement this property in an online setting, α be non-monotone since the budgets in lower nesting levels might become tight first followed by the higher levels. (s) Therefore, we need a means of raising and lowering each α u so that at the end of the instance, the revenue earned from a dimension for bidder u is attributed to exactly one of these variables. In general, non-monotonicity of dual variables is undesirable in online algorithms because a satisfied dual constraint might become unsatisfied later. To overcome this problem, we give a new dual D(cid:48) where we decompose α into decision variables that are indeed monotone in our eventual primal-dual analysis. Formally, our transformed dual D(cid:48) is defined as follows. Since each Su is laminar, we can represent its set system as a forest Fu, where each node in the forest corresponds to a constraint s ∈ Su, and the singleton budgets are the leaves. Let As be the set of ancestors of s in Fu, including s itself. Define a new decision variable (s) (where for a maximal γ = 0). Using the new variables, we can rewrite Eqn. (3) in our original set s with no parent in Fu, we set γ (s(cid:48)) u , and let p(s) be the parent budget of s. Observe that α u =(cid:80) u − γ (s) u = γ s(cid:48)∈As α (p(s)) u (p(s)) u (s) u (s) dual formulation as: ∀ u ∈ U, v ∈ V, t ⊆ K : (cid:32)(cid:16) (cid:88) s∈Su γ(s) u − γ(p(s)) u (cid:33) (k) r uvt (cid:17) (cid:88) k∈Ks (cid:88) k (k) r uvt. + σv ≥ (4) Next, we observe that the outermost summation on the LHS of Eqn. (4) telescopes, and the only remaining γ are those for singleton budgets. This gives us our final dual formulation D(cid:48): (s) u (cid:88) min σv + v u (cid:16) (cid:88) (cid:88) (cid:88) s∈Su (cid:17) (cid:88) k B(s) u γ(s) u − γp(s) u (k) γ({k}) u uvt + σv ≥ r ≥ 0. u − γ(p(s)) γ(s) u ∀ u ∈ U, v ∈ V, t ⊆ K : ∀ u ∈ U, s ∈ Su : k (k) r uvt (5) (6) B. Labeling Scheme (s) u corresponding to the "most-limiting" budget B (s) u . However, simply using utilization to define γ Recalling our above discussion, our goal will be to attribute the revenue earned on a dimension k for bidder (s) (s) u to exactly one dual variable γ u , ideally to the γ such u (s) that k ∈ Ks. This suggests that we should make γ a monotonically increase function of the budget's current u (s) utilization κ u does not capture the interactions between budgets (s) in the laminar setting. The overarching issue with just using κ is the fact that B u might be the most utilized (s) constraint for only some of the dimensions in Ks, since other budgets that sit below B in the hierarchy may have u higher utilization. This raises the following question: should the revenue currently constrained by these descendant budgets, say revenue earned on some particular dimension k(cid:48), affect how the algorithm determines the extent to (s) which B u limits other unbounded dimensions like k? The answer is not immediate. It is tempting to say "no" since the dimension-k(cid:48) revenue is already bounded by a tighter budget; on the other hand, B (s) u might in fact become the tightest budget for dimension k(cid:48) later in the instance and ignoring the dimension-k(cid:48) revenue till that time will prevent a smooth transition of the tightest budget for k(cid:48). To overcome this challenge, we introduce a labeling scheme (cid:96) (s) u will represent the modified notion of the budget's utilization that we need to properly measure the remaining capacity for future revenue. Our primal-dual analysis will then follow by making each dual variable a monotone function of these labels. u : ∪uSu → [0, 1]. Label (cid:96) (s) u for budget B (s) u (s) More concretely, we address the above challenge by having our labels maintain the following two high-level features: • For label (cid:96) (s) u and bidder u, revenue from a dimension k ∈ s will only contribute to the label if (cid:96) is at least as large as the labels of all budgets containing k that are subsets of s. This corresponds to identifying the "most constrained" budget for any dimension by interpreting these abstract labels as surrogates of actual budget utilizations. • In defining label (cid:96) (s) u , we need to identify the capacity of constraint s for future revenue earnings from the (s) dimensions that are deriving their label from s. We define this capacity as the total budget B u minus the budgets of constraints below s that have a higher label. This automatically discounts the revenue earning capacities of dimensions that are deriving labels from descendant constraints of s. (s) u One challenge with maintaining these properties is that they are somewhat circular. To determine the value of a label, we need to first determine which dimensions count toward the label, but determining dimension inclusion requires comparisons between label values. Another challenge is maintaining smoothness. As impressions are assigned to bidders, budgets that were previously slack will become tight, which requires us to reassign dimensions to labels and change their capacities. In order to make our primal-dual analysis smooth, we will need to ensure that labels remain consistent after we reassign dimensions to labels and change label capacities. (cid:80){k}∈L(s) R (cid:80) (k) u s(cid:48)∈T (s) B (s) u − B (cid:96)(s) u = . (s(cid:48)) u (7) To overcome the issue of circularity, we will not give an explicit label definition but rather give a set of label properties that we maintain throughout the algorithm. These properties are based on two sets of budgets, L(s) and T (s), that the algorithm will dynamically update for all bidders u and budgets B (we drop the subscript u for simplicity). The two sets partition the descendant dimensions of s (i.e., each descendant dimension belongs to exactly one set in L(s)∪ T (s)). Intuitively, L(s) contains singleton budgets {k} representing dimensions that count (s) toward label (cid:96) u . On the other hand, T (s) contains the closest descendants of s that have a bigger label than s, i.e., every dimension in s that is not in L(s) derives its label from a budget in T (s) or from one their respective descendants. (k) u be the total revenue currently earned on dimension k for bidder u. Formalizing the above discussion, Let R we say the labels for bidder u are valid if the following three properties hold for all s ∈ Su. 1) Property 1: For all {k} ∈ L(s), all constraints s(cid:48) on the path from {k} to s in Fu have (cid:96) (s(cid:48)) 2) Property 2: For all s(cid:48) ∈ T (s), we have (cid:96) u > (cid:96) 3) Property 3: The following identity holds: (s(cid:48)) u ≤ (cid:96) u , and for all s(cid:48)(cid:48) on the path from s(cid:48) to s, we have (cid:96) (s) u . (s(cid:48)(cid:48)) u ≤ (cid:96) (s) u . (s) u (s) (s) u Note that once we have fixed sets T (s) and L(s) for all s, we can verify all three properties and use Eqn. (7) to directly compute each label for each s ∈ Su. Also observe we can initialize all labels to be 0, and set T (s) = ∅ and L(s) = {{k} : k ∈ K} to start with a valid labeling. Finally, we note that we will soon show that all labels remain non-negative (in the proof of Lemma 5). Next, we define a procedure for updating labels after the revenue earned in a single dimension increases infinitesimally. More specifically, suppose an impression v is assigned to bidder u, and assume we have a valid (k) labeling for the sets in Su before the assignment. The assignment of the impression changes the values of R for u the active dimensions k. This necessitates label updates, which we define for an infinitesimally small increment in the value of R for a particular dimension k. Note that the overall assignment of the impression is a sequence of such incremental changes. (k) u The labels that we increase on such an increment are (cid:96) such that {k} ∈ L(s), i.e., we will increase R in (s) and leave T (s) and L(s) fixed. If the labeling is valid before a given the numerator of Eqn. (7) for all such (cid:96) u (s) increment, and if after the increment the relative ordering of all (cid:96) remains the same, then by the definition of u Properties 1 and 2 the labeling remains valid. Thus, in terms of updating L(s) and T (s), we only need to consider (k) when the relative order of labels changes as a result of adding to R u . In particular, there are two types of reordering that need considered. We will call these two reordering possibilities Events 1 and 2 and describe how the algorithm updates L(s) and T (s) in each case. Later, we will show that these set redefinitions maintain the current value of the label. • Event 1: For some s such that {k} ∈ L(s), there now exists a descendant s(cid:48) of s such that (cid:96) (s) u , where s(cid:48) is on the path from {k} to s and (cid:96) u previously. In this event, s(cid:48) is now added to T (s). All singleton-budgets {k} that are descendants of s(cid:48) and belong to L(s) are now removed from L(s). Additionally, all descendants of s(cid:48) that belong to T (s) are also removed from T (s). • Event 2: For some constraint s such that {k} ∈ L(s), there now exists a descendant s(cid:48) of s such that ∈ T (s) previously. In this event, s(cid:48) is removed from T (s). Conversely to Event 1, all (s) u ≥ (cid:96) (cid:96) constraints in T (s(cid:48)) are added to T (s), and all {k} ∈ L(s(cid:48)) are added to L(s). In order to make the process smooth, we will think of the updates in Events 1 and 2 as being done at the transition (s(cid:48)) point where (cid:96) u . This completes the description of our labeling scheme and the process by which the algorithm determines them. We encourage the reader to refer to Figure 2 for a small example of an Event 2 update.2 We now prove the following lemma, which will be useful for our primal-dual analysis. (s(cid:48)) u , where s(cid:48) (s(cid:48)) u ≤ (cid:96) (s(cid:48)) u > (cid:96) (s) u = (cid:96) (s) (k) u 2In terms of how L(s) and T (s) are updated, Event 1 is the reverse of Event 2. So, reversing the example in the Figure 2 will provide the reader with an Event 1 example. Illustration of the modifications made to L(s) and T (s) in Event 2, occurring between budget sets s = {1, 2, 3, 4} and Fig. 2. s(cid:48) = {1, 2}. In this example, the algorithm is incrementing the revenue on dimension 3. The state of the labels before dimension 3 revenue is added is shown on top. Notice that {3} ∈ L({1, 2, 3, 4}) since (cid:96){3}u = 1/10 is smaller than (cid:96){1,2,3,4} = 1/5 (note that the value of (cid:96){1,2,3,4} corresponds to the left most rectangle, where the middle and right rectangles show the revenue levels of the dimensions that are not included in the label). After increasing dimension 3 to $10/3, we have that (cid:96){1,2,3,4} = 2/3, which means it is about to surpass label (cid:96){1,2} , therefore triggering Event 2. The state of the labels after the Event 2 modifications are shown on bottom (at the transition point). Notice that {1, 2} has been removed from T ({1, 2, 3, 4}), and we have added the sets in L({1, 2}) to L({1, 2, 3, 4}) (namely, {1} and {2}). u u u u T({1,2,3,4})={{1,2},{4}}L({1,2,3,4})={{3}}{{B({1,2})u=$15{B({1})u=$10{$5{B({2})u=$10{$5{B({4})u=$10{$9{B({3})u=$10$1{B({1,2,3,4})u=$30B({1,2,3,4})uB({1,2})uB({4})u=301510=$5{$1$5+$5=$10{$5{$5{$9$10/3{{{$40/3B({1,2,3,4})uB({4})u=3010=$20L({1,2,3,4})={{1},{2},{3}}T({1,2,3,4})={{4}}$5+$5=$10{(dim.1)(dim.2)(dim.3)(dim.4)(dimension3increasesto$10/3) Lemma 5. For every constraint s, the label (cid:96) Proof: Clearly when neither Event 1 or 2 occurs, (cid:96) (s) u is monotonically non-decreasing over the course of the algorithm. (s) u can only increase (this follows directly from the definition (s) of the update procedure). Thus, it suffices to show that (cid:96) u does not decrease when it participates in Event 1 or 2. (s) In particular, we will show that (cid:96) u has an identical value after L(s) and T (s) have been modified in either event. We will show that this holds for Event 1, noting that the argument for Event 2 is identical. Suppose the updates for Event 1 occur for a constraint s and a descendant s(cid:48), triggered by a dimension k ∈ s. The changes are: s(cid:48) is added to T (s), all descendant singleton-budgets of s(cid:48) that were in L(s) are removed from L(s), and all descendants of s(cid:48) that were in T (s) are removed from T (s). Recall that before the event, we have that (k) u (cid:80){k}∈L(s) R (cid:80) (cid:80){k}∈L(s(cid:48)) R (cid:80) (w) w∈T (s) B u (k) u w(cid:48)∈T (s(cid:48)) B (s) u − (s(cid:48)) u − . (w(cid:48)) u (cid:96)(s) u = (cid:96)(s(cid:48)) u = B B Therefore, using the definitions of L(s) and T (s) before they are modified by the event, the new (cid:96) (s) new) can be written as: (cid:96) (cid:80){k}∈L(s) R (cid:80) (k) (cid:80){k}∈L(s(cid:48)) R u +(cid:80) (s(cid:48)) (k) u w(cid:48)∈T (s(cid:48)) B . (w(cid:48)) u (s) (cid:96) new = u − u − B at the moment Event 1 occurs, we have (cid:96) u − B w∈T (s) B (w) (s) (s) u (denoted (8) For the competitive analysis, it suffices to show that a) the ratio between dual and primal objectives is at most ρ, and b) the dual solution is feasible. (s(cid:48)) u (s(cid:48)) u (s) u = (cid:96) (s) u = (cid:96) (s) new = (cid:96) (which follows from the fact that To complete the proof, note that the above argument does not exclude the possibility of (cid:80){k}∈L(s) R Since (cid:96) a/b = c/d = α implies (a − c)/(b − d) = α). (k) u = 0 (k) and the denominator in Eqn. (8) being negative (if this were to happen, the increments to R u would decrease the label by making it more negative). However, in both events this cannot be the case. First observe that Event 2 can only occur between two non-zero labels (since in Event 2, s(cid:48) ∈ T (s) before the event, which implies a strict (s(cid:48)) (s(cid:48)) (s) inequality (cid:96) u = 0, but in Event 1, the denominator of (cid:96) u = (cid:96) u (s) u . This is because Event 1 can only occur between two labels must always be smaller than the denominator of (cid:96) such that {k} ∈ L(s) where k the dimension is currently being incremented. Since (cid:96) at the (s(cid:48)) (s(cid:48)) (s) transition point in Event 1, it must be the case that (cid:96) u . This implies (cid:96) u u (s) u before the modifications to L(s) and T (s). must have a smaller denominator than (cid:96) (s(cid:48)) u ). Event 1 can (and will) occur when (cid:96) is increasing at a higher rate than (cid:96) (s) is surpassing (cid:96) u (s) u < (cid:96) (s(cid:48)) u C. Algorithm Definition and Analysis Duv =(cid:80) Using our dual formulation and labeling scheme, we are now ready to define and analyze our algorithm. Consider (s(cid:48)) the arrival of impression v. Define gu(s) = maxs(cid:48)∈As (cid:96) u , i.e., the maximum label of an ancestor of s in the forest Fu (including s itself). Our algorithm assigns impression v to bidder u = arg maxu(cid:48)∈U{Du(cid:48)v}, where For the rest of the section, let ρ = e/(e − 1). For a primal assignment of impression v to bidder u, we change (k) uv and tu is the current active dimensions for bidder u. k∈tu(1 − eg({k}) u −1)r the dual solution by setting σv = ρ · Duv and update γ eg(s) u − 1 e − 1 u −1 − e is computed after the assignment of the current impression v. = ρ(eg(s) where g γ(s) u = to be (s) u (s) u −1), : (p(s)) u u as the subset of constraints in Su where the value of γ Primal-Dual Ratio. Our goal is to show that when an impression v is assigned to a bidder u, the change in dual objective is at most ρ = e/(e− 1) times that of the primal objective. First, note that the dual objective is a function of the labels, and we have argued above that the labels do not change when either of Event 1 or 2 happens. Therefore, we only need to account for the change in the dual objective when the labels change but neither of the two events happen. Let us define S∗ is different from γ We can rewrite the dual objective as(cid:80) (cid:16) (cid:80) v∈V σv +(cid:80) ∗ u (cid:54)= γ(p(s)) u = {s ∈ Su : γ(s) S since for all the other terms, the s∈S∗ u − γ γ = 0. For any constraint s ∈ S∗ u(s) be its closest ancestor in Fu that is also in S∗ u, let p∗ value of γ u. u , T (s) = {s(cid:48) u(s(cid:48)) = s} for any s ∈ S∗ B(s) Now, observe that by Property 2 of labels and the definitionof g u. (cid:88) (cid:88) Then, the dual objective can be further rewritten as  . (cid:88) (cid:88) u − γ ∈ S∗ u : p∗ B(s(cid:48)) (p(s)) u (p(s)) u (s) B u (cid:17) γ(s) u σv + (s) u }. (s) (s) (s) u u u u v∈V u s∈S∗ u u − s(cid:48)∈T (s) As earlier, we will analyze the change in the dual and primal objectives when the revenue on a dimension k uv . Note that for any singleton constraint {k}, there is a unique is incremented by an infinitesimal amount ∆r ({k}) u . Therefore, the only dual variable in S∗ (i.e., in the s ∈ S∗ u satisfying k ∈ L(s); furthermore, g = g u (s) (s) dual objective given above) that changes is γ u . Let us denote the change in g u . Using the small bids assumption, we can write: (s) u by ∆g (s) u = (cid:96) (k) (s) B(s) (cid:88) ∆γ(s) u · u − s(cid:48)∈T (s) B(s(cid:48)) u  = (s) ∂γ u (s) ∂g u · ∆g(s) u · B(s) (cid:80) u − (cid:88) s(cid:48)∈T (s) B(s(cid:48)) u ∆r (k) uv s(cid:48)∈T (s) B · (s(cid:48)) u  B(s) u −  B(s(cid:48)) u (cid:88) s(cid:48)∈T (s) Summing over all the infinitesimal changes in revenue, the total change in the dual objective for the assignment (k) uv , where tu is the set of active dimensions. Since the of impression v is given by σv + ρ · algorithm sets (cid:80) (s) B u −1) · = ρ · (eg(s) u − u −1) · ∆r(k) = ρ · (eg({k}) uv . u −1) · r k∈tu(eg({k}) (cid:88) σv = ρ · k∈tu the total change in the dual objective can be written as: u −1)r(k) uv , (1 − eg({k}) (cid:88) k∈tu (cid:88) k∈tu r(k) uv , (1 − eg({k}) u −1)r(k) uv + ρ · u −1) · r(k) (eg({k}) uv = ρ · (cid:88) k∈tu ρ · which is exactly ρ times the increase in the primal objective. Dual Feasibility. Finally, we argue that the dual is feasible when the algorithm terminates. Lemma 6. At the end of the algorithm, the dual is feasible. Proof: The feasibility of Eqn. (5) follows directly from definition of g is a non-deceasing (s) u . We now show Eqn. (6). Let tu be the set of active dimensions for bidder u when impression v = 1. This follows from the fact that if k is inactive, u = 1 as well). Since s is an ancestor of {k} function of g arrived. First, observe that for all k (cid:54)∈ tu, we have that g a constraint s ∈ Su containing k has reached κ ({k}) in Fu, we also have g u (s) u = 1 (and thus (cid:96) (s) u , and the fact γ ({k}) u ({k}) u = 1. = γ (s) u (s) Let u(cid:48) be the bidder to which the algorithm assigned impression v. Let (cid:100)g assigned (and define (cid:100)g (s) u(cid:48) similarly). We have the following: (s) u be the value of g (s) u when v was γ({k}) u (k) r uvt + σv = = (cid:88) (cid:88) k k(cid:54)∈tu (cid:88) γ({k}) u (k) r uvt + ρ (cid:92) u(cid:48) −1)r g({k}) (k) u(cid:48)v (cid:88) k∈tu (1 − e k∈tu u −1 − 1/e)r (eg({k}) ({k}) u and the fact that γ (k) uvt + ρ (k) r uvt + ρ (cid:88) k∈tu ({k}) u (by substituting σv) (cid:92) u(cid:48) −1)r g({k}) (k) u(cid:48)v, (1 − e (9) = 1 for all k (cid:54)∈ tu. We can now γ({k}) u (k) uvt + σv ≥ r ≥ ≥ (cid:88) (cid:88) (cid:88) k(cid:54)∈tu k(cid:54)∈tu k(cid:54)∈tu (cid:88) (cid:88) (cid:88) k∈tu k∈tu k∈tu (k) uvt + ρ r (k) r uvt + ρ (k) r uvt + ρ (cid:88) (cid:88) k∈tu k∈tu (k) uvt + ρ (k) uvt + ρ u −1 − 1/e)r (eg({k}) u −1 − 1/e)r (eg({k}) (cid:88) (1 − 1/e)r (k) uvt = k (k) r uvt (cid:92) u −1)r g({k}) (k) u(cid:48)v u −1)r(k) (1 − e (1 − eg({k}) (since ρ = e/(e − 1)). uv (cid:88) k (cid:88) k where the second equality follows by substituting γ establish Eqn. (6) as follows: The first inequality follows from Eqn. (9) and the fact that the algorithm assigns v to u(cid:48) = arg maxu∈U{Duv}. The second inequality is because 1 − eg({k}) since r u −1 is a non-increasing function of g , and the third inequality follows ({k}) u (k) uv ≥ r (k) uvt. III. ADWORDS WITH GENERAL BUDGET CONSTRAINTS (ADGENERAL) Recall the ADGENERAL problem: we given a set of offline bidders U and a set of impressions V that arrive online, where each bidder-impression pair (u, v) is specified by a bid value r uv for each dimension k ∈ K. The revenue generated from a bidder u is subject to an arbitrary set of budget constraints Su, where each constraint s ∈ Su caps the total revenue generated from a subset of dimensions Ks to a given budget B In this section, we will prove an O(lg p) upper bound for ADGENERAL (Theorem 1). (s) u . (k) A. Algorithm Definition As in Section II, let κ exponential potential function defined by: (s) u denote the current utilization of budget B (s) u . The algorithm (we call it ALGO) uses an (cid:88) (cid:88) (cid:88) (cid:88) (cid:16) (s) B u p φ = φ(s) u = u s u s (2p + 2)κ(s) u − 1 , (cid:17) (s) u (s) where κ u φ = 0 initially. is defined as the fraction of B At any stage of ALGO, a dimension k is said to be active for bidder u if and only if(cid:80) u ≤ 1; otherwise, dimension k is said to be inactive for bidder u. (Note that this is a different definition of active dimensions than what is used in Section II). ALGO only attempts to earn revenue on active dimensions, and hence, the total revenue if impression v is allocated to bidder u is given by: that has already been used by the algorithm at any stage. Note that φ(s) B(s) s:k∈s u ruv = r(k) uv , where Au is the set of current active dimensions for bidder u. (cid:88) k∈Au The algorithm makes a greedy assignment with respect to ruv, i.e., it assigns impression v to arg maxu ruv. Note that it is possible that Au = ∅ for all bidders u, and therefore the algorithm does not assign impression v to any bidder, even though there are dimensions and bidders where it could have earned revenue. This completes the description of our algorithm. For our analysis, it will be sufficient to quantify the small bids assumption as the following property for any B. Algorithm Analysis impression v, bidder u, dimension k, and constraint s such that k ∈ s: . 1 lg(2p + 2) (cid:88) k∈s (k) r uv (s) u ≤ B (10) We first establish the feasibility of the solution, which follows almost directly from how we define active dimensions. Lemma 7. If ALGO assigns an impression v to a bidder u, then it can earn revenue on all the active dimensions Au of u without violating any constraint. Proof: We need to show that for all constraints s of bidder u, (cid:88) (k) r uv (s) u ≤ 1. k∈Au∩s B κ(s) u + > 1 Suppose not. Then, for some constraint s, (k) r uv (s) u κ(s) u + B (cid:88) i.e., (2p + 2)κ(s) lg(2p+2) > 2p + 2 k∈Au∩s 1 lg(2p + 2) u + 1 (s) u (s) u i.e., (2p + 2)κ(s) i.e., pφ B i.e., φ B (s) u (s) u u > p + 1 + 1 > p + 1 > 1, i.e., κ(s) u + > 1 (by the small bids assumption Eqn. (10)) which contradicts the fact that dimension k is active for bidder u. This lemma implies that ALGO is indeed able to earn revenue on all active dimensions of a bidder u when it assigns an impression to u. Next, we will bound the total revenue of an optimal solution that we denote by OPT against the total revenue of ALGO. Let uOPT(v) (resp., uALGO(v)) be the bidder that OPT (resp., ALGO) allocates impression v to. For every dimension k that OPT earns revenue from, one of the following holds: 1) Case 1: dimension k is active for bidder uOPT(v) in ALGO when impression v arrives, and ALGO assigns v to the same bidder, i.e., uALGO(v) = uOPT(v). 2) Case 2: dimension k is active for bidder uOPT(v) in ALGO when impression v arrives, but ALGO assigns v to a different bidder, i.e., uALGO(v) (cid:54)= uOPT(v). 3) Case 3: dimension k is inactive for bidder uOPT(v) in ALGO when impression v arrives. We partition the dimensions that OPT earns revenue from into active and inactive dimensions (according to their status in ALGO for bidder uOPT(v)). For active dimensions, the next lemma gives a straightforward charging argument using the greediness of the choice made by ALGO. Lemma 8. For any impression v, the total revenue earned by OPT on the active dimensions is at most the total revenue earned by ALGO overall. Proof: For case 1 above (OPT and ALGO choose the same bidder), the two algorithms earn the same revenue on the active dimensions. For case 2 above, the fact ALGO makes a greedy choice implies that it earns at least as much revenue by assigning to different bidder as it would have made by assigning to u, which includes the revenue on all the active dimensions. The more involved case is that of inactive dimensions. In this case, we use a different global charging argument over all dimensions, based on the potential function. In particular, we show that for a bidder u, the total revenue of OPT from inactive dimensions (recall that this only includes revenue from impressions that arrived after the dimension became inactive in ALGO) can be charged, up to a logarithmic loss, to the revenue that ALGO earned overall from bidder u. Lemma 9. Fix a bidder u. The total revenue that OPT earns in inactive dimensions for bidder u is at most the final potential of bidder u in ALGO. Proof: For any dimension k, let v ∈ Vu,k denote the subset of impressions assigned to u by OPT that arrived after k became an inactive dimension for bidder u in ALGO. We need to bound the total revenue earned by OPT on dimension k from impressions in Vu,k, summed over all k. For any impression v ∈ Vu,k, we have: (cid:88) φ (s) u (s) u s:k∈s B > 1, is the final potential for constraint s of bidder u. Thus,the revenue that OPT earns from impressions (s) u where φ v ∈ Vu,k on dimension k, summed over all dimensions, can be bounded as follows: (k) r uv (s) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) r(k) uv < φ(s) u r(k) uv = φ v∈Vu,k k s:k∈s B s k∈s v∈Vu,k B v∈Vu,k k (s) u (s) u u ≤ (cid:88) s φ(s) u , where the last inequality follows from the feasibility of OPT. Finally, we need to lower bound the final potential of a bidder in terms in terms of the revenue it generates for ALGO. This is done in the following lemma. Lemma 10. The increase in potential of a bidder u during the course of ALGO is at most 4 lg(2p + 2) times the revenue that ALGO earns from u. Proof: Suppose ALGO assigns impression v to bidder u. Let Ka denote the set of active dimensions for bidder u when this assignment is made. Let η . Then, the increase in potential is given by: k:k∈Ka∩s r(k) uv B(s) u (cid:16) (2p + 2)κ(s) u +η(s) (cid:17) (cid:16) (cid:16) u (2p + 2)η(s) u − (2p + 2)κ(s) (cid:17) (cid:17) u − 1 u ·lg(2p+2) − 1 2η(s) (cid:88) · 2 lg(2p + 2) · u (cid:33) (cid:33) · (cid:88) s ∆φ(s) u = = = ≤ s (s) (s) B u p u =(cid:80) (cid:88) (cid:88) (cid:88) (cid:88) (s) B u p s s (2p + 2)κ(s) (s) B u p (s) B u p φ(s) u + (cid:32) (cid:32) u = (cid:80) (cid:32)(cid:88) φ(s) u + (s) r(k) uv · s (cid:88) k∈Ka (cid:33) (cid:88) s (k) r uv (s) u B , (11) k:k∈Ka∩s where the last inequality follows since η rearranging the RHS of inequality (11), we have: k:k∈Ka∩s r(k) uv B(s) u and ax ≤ 1 + ax for 0 ≤ x ≤ 1, a ≥ 1. By ∆φ(s) u ≤ 2 lg(2p + 2) · φ (s) u (s) u s:k∈s B + {s : k ∈ s} p ≤ 4 lg(2p + 2) · r(k) uv , since k is active and p ≥ {s : k ∈ s}. completing proof of the upper bound in Theorem 1. A competitive ratio of O(lg p) for ADGENERAL in the small bids case now follows from Lemmas 7, 9, and 10, (cid:88) k∈Ka REFERENCES [1] Shalinda Adikari and Kaushik Dutta. Real time bidding in online digital advertisement. In DESRIST, pages 19–38, 2015. [2] Gagan Aggarwal, Yang Cai, Aranyak Mehta, and George Pierrakos. Biobjective online bipartite matching. In WINE, pages 218–231, 2014. [3] Gagan Aggarwal, Gagan Goel, Chinmay Karande, and Aranyak Mehta. Online vertex-weighted bipartite matching and single-bid budgeted allocations. In SODA, pages 1253–1264, 2011. [4] Shipra Agrawal and Nikhil R. Devanur. Fast algorithms for online stochastic convex programming. In SODA, pages 1405–1424, 2015. [5] Baruch Awerbuch, Yossi Azar, and Serge A. Plotkin. Throughput-competitive on-line routing. In STOC, pages 32–40, 1993. [6] Joel Barajas Zamora. Online display advertising causal attribution and evaluation. 2015. [7] Vijay Bharadwaj, Peiji Chen, Wenjing Ma, Chandrashekhar Nagarajan, John Tomlin, Sergei Vassilvitskii, Erik Vee, and Jian Yang. SHALE: an efficient algorithm for allocation of guaranteed display advertising. In SIGKDD, pages 1195–1203, 2012. [8] Benjamin E. Birnbaum and Claire Mathieu. On-line bipartite matching made simple. SIGACT News, 39(1):80–87, 2008. [9] Allan Borodin and Ran El-Yaniv. Online computation and competitive analysis. Cambridge University Press, 1998. [10] Niv Buchbinder, Kamal Jain, and Joseph Naor. Online primal-dual algorithms for maximizing ad-auctions revenue. In ESA, pages 253–264, 2007. 5990–6007, 2013. [11] Richard E. Chatwin. An overview of computational challenges in online advertising. In American Control Conference, ACC, pages [12] Nikhil R. Devanur and Kamal Jain. Online matching with concave returns. In STOC, pages 137–144, 2012. [13] Nikhil R. Devanur, Kamal Jain, and Robert D. Kleinberg. Randomized primal-dual analysis of RANKING for online bipartite matching. [14] Jon Feldman, Nitish Korula, Vahab S. Mirrokni, S. Muthukrishnan, and Martin P´al. Online ad assignment with free disposal. In WINE, [15] Arpita Ghosh, Randolph Preston McAfee, Kishore Papineni, and Sergei Vassilvitskii. Bidding for representative allocations for display [16] Gagan Goel and Aranyak Mehta. Online budgeted matching in random input models with applications to adwords. In SODA, pages In SODA, pages 101–107, 2013. pages 374–385, 2009. advertising. In WINE, pages 208–219, 2009. [17] S. Ali Hojjat, John Turner, Suleyman Cetintas, and Jian Yang. Delivering guaranteed display ads under reach and frequency requirements. In AAAI, pages 2278–2284, 2014. [18] Bala Kalyanasundaram and Kirk Pruhs. An optimal deterministic algorithm for online b-matching. Theor. Comput. Sci., 233(1-2):319– [19] Richard M. Karp, Umesh V. Vazirani, and Vijay V. Vazirani. An optimal algorithm for on-line bipartite matching. In STOC, pages [20] Aranyak Mehta. Online matching and ad allocation. Foundations and Trends in Theoretical Computer Science, 8(4):265–368, 2013. [21] Aranyak Mehta and Debmalya Panigrahi. Online matching with stochastic rewards. In FOCS, pages 728–737, 2012. [22] Aranyak Mehta, Amin Saberi, Umesh V. Vazirani, and Vijay V. Vazirani. Adwords and generalized online matching. J. ACM, 54(5), [23] Aranyak Mehta, Bo Waggoner, and Morteza Zadimoghaddam. Online stochastic matching with unequal probabilities. In SODA, pages 982–991, 2008. 325, 2000. 352–358, 1990. 2007. 1388–1404, 2015. APPENDIX A ADGEN-AON LOWER BOUND In this section, we prove the lower bound for Theorem 4. As a byproduct of this lower bound, we also obtain tight bounds for the online admission control problem, slightly improving the classical bounds of [Awerbuch et al. 1993].  lg(2p) implies that p Recall that we assume  > 1 lg(2p). In our instance, we have a single advertiser with a set of p budget constraints (we index budget constraints by s), where each constraint has a budget of 1. We will assume that p 1− is integral. 1− > 2.) Each impression has bid value of  on a single, unique dimension. (Note that  > 1 (This allows us to use impressions and dimensions interchangeably in the rest of the construction.) We are now left to specify the mapping of impressions to constraints. Let us denote (cid:96) = 1−  . First, we construct a hierarchical segmentation of the constraints 1, 2, . . . , p, where segment j of level i comprises constraints (j− 1)· p1−i/(cid:96) + 1, (j− 1) · p1−i/(cid:96) + 2, . . . , j · p1−i/(cid:96). Overall, there are (cid:96) + 1 levels i = 0, 1, . . . , (cid:96), and level i partitions the overall set of p constraints into pi/(cid:96) segments j = 1, 2, . . . , pi/(cid:96). Each such segment comprises p1−i/(cid:96) constraints. Note that the segments in level i are a refinement of the segments in level i − 1. For the purpose of visualization, the reader can imagine a complete p1/(cid:96)-ary tree on p leaves, where each leaf represents a constraint and each internal node corresponds to a segment.  The online arrival of impressions is divided into (cid:96) + 2 rounds. The first round is special and is called the initial round (described below). Every subsequent round, indexed 0, 1, . . . , (cid:96), comprises a set of impression blocks. Each impression block of round i corresponds to a unique segment in level i. Such an impression block comprises 1/ identical impressions, all of which appear in all constraints of the segment of level i that the impression block corresponds to. Clearly, the total number of impression blocks in round i is at most the total number of segments in level i, i.e., at most pi/(cid:96). However, not all segments receive an impression block corresponding to it; only the active segments (we define this notion below) in level i receive an impression block. Therefore, the arrival rule for round i is simple: every active segment in level i receives a unique impression block. The relative order of arrival of impressions in a round is arbitrary. As we mentioned above, the initial round is special - in this round, there is a single impression with bid value δ > 0 that appears in all constraints. Now, we are only left to describe the rule for defining active segments. After the initial round, all segments in all levels are inactive, except the single segment in level 0 comprising all dimension. Therefore, in round 0, there is a single impression block corresponding to all the constraints. Next, we define the inductive process for activating segments. Recall that the impression blocks arriving in round i ≥ 0 correspond to the active segments in level i. The algorithm assigns some subset of these impressions to the sole advertiser. For any segment j in level i that received an impression block, if the algorithm assigned t > 0 impressions from the block, then all impression blocks at level i + t that are refinements of the current block are made active. After round i, all segments in level i are made inactive. This completes the description of the instance. First, we need to show that the construction is valid. In particular, we need to show that i + t ≤ (cid:96) (i.e., there is a level where the refined segments can be activated) if the algorithm assigns t impressions of a segment in round i. We prove a more general lemma. Lemma 11. At any point of time, if a segment in level i is active, then every constraint in that segment has a current utilization of i + δ. Proof: The algorithm must assign the impression in the initial round to stay competitive; therefore, the lemma holds for i = 0. Inductively, the segments that are made active at level i + t had utilization i before round i (by the inductive hypothesis) and have an additional utilization of t from round i. is valid. As a corollary of this lemma, we can infer that i+t ≤ (cid:96) since utilization cannot exceed 1; hence, the construction Let (cid:96)s be the last round where constraint s was in an active segment, and let the corresponding segment be τs. For every constraint s, the optimal solution assigns the entire impression block corresponding to τs in level (cid:96)s. Note that the segments τs partition the set of constraints, and hence, the optimal assignment is feasible. Clearly, the optimal solution earns a revenue of 1 on the impression block corresponding to segment τs. To compare the revenue of the algorithm, we redistribute the revenue earned by the algorithm on an impression by dividing it equally among all the constraints that the impression appears in. Next, we sum the revenues on constraints in the same segment τs. We will now compare this revenue on τs with the unit revenue that the optimal solution earns. To upper bound the (redistributed) revenue of the algorithm, we first note that the algorithm does not earn any revenue on the impression block τs itself in round (cid:96)s. If (cid:96)s ≤ (cid:96) − 1, this follows from the fact that refinements of τs were not marked active. If (cid:96)s = (cid:96), then by Lemma 11, the utilization at the beginning of the round is 1 −  + δ, which prevents the algorithm from earning any further revenue (note that revenue comes in units of ). Lemma 12. The total revenue earned by segment τs in the algorithm is at most 2 p1/(cid:96) . Proof: Let r0, r1, . . . , rj denote the rounds in which segment τs earns revenue, and let t0, t1, . . . , tj be the number of impressions assigned in the respective rounds. In other words, r0 = 0, r1 = t0 +r0, r2 = t1 +r1, . . . , (cid:96)s = rj + tj. Then, the revenue earned by constraint s is j(cid:88) q=0 (cid:96)s−1(cid:88) i=0 tq · 1 p1−rq/(cid:96) ≤  · 1 p1−i/(cid:96) ≤ 2 p1−((cid:96)s−1)/(cid:96) , where the last inequality follows since p−1/(cid:96) ≤ 1/2 for (cid:96) ≤ lg p which follows from  > 1 p1−(cid:96)s/(cid:96) constraints, the revenue earned by the algorithm on segment τs is at most The lower bound now follows by comparing Lemma 12 to the optimal revenue, and setting δ → 0. p1/(cid:96) . 2 lg(2p). Since τs comprises APPENDIX B ADGENERAL AND ADGEN-P LOWER BOUND (THEOREM 1 AND THEOREM 3) In this section, we prove a Ω(lg p) lower bound for ADGENERAL that will be constructed via a reduction from the online problem considered by Awerbuch et al. in [5], which we call ADMISSION-CONTROL. At the end of the section, we will describe how the problem definition of ADMISSION-CONTROL can be modified so that the reduction implies the same lower bound for ADGEN-P. We formally define this problem as follows. ADMISISON-CONTROL: At the outset, the online algorithm is given an edge-capacitated graph G = (V, E), where ce denotes the capacity of edge e. Demand requests then arrive in an online sequence R = (cid:104)r1, . . . , rh(cid:105), where each request ri is specified by a path Pi between two vertices (si, ti) and a capacity demand di. Upon the arrival of ri, the algorithm must decide to either reject the request or route it along Pi. The objective of the algorithm is to maximize the total demand of admitted requests subject to the constraint that for any edge e, the sum of capacity demands from admitted requests using e does not exceed ce. We note that this is a less general problem than the one considered in [5] (e.g. in the original problem, the algorithm can choose routing paths, requests have arrival times, etc.); however to extend their lower bound, the above problem definition will suffice. For completeness, we will give the proof of the "small-demands" ADMISSION-CONTROL lower bound from [5] (i.e. in the given instance, the maximum demand-to-capacity ratio is arbitrarily small). This will be useful as our reduction will not be completely "black-box", i.e., we need to have some knowledge of the proof's online sequence in order to perform the reduction. Let L(n) be the line graph defined on n + 1 vertices {v1, . . . , vn+1} (with n edges). Then the following lemma holds. Lemma 13. ( [5]) Let A an online algorithm for ADMISSION-CONTROL under the small demands assumption. Then there exists an instance I for L(n) such that the capacity earned by the optimal solution is Ω(lg n) times the demand earned by A. Proof: 2i Without loss of generality, assume n is a power of two. The instance will consist of lg n + 1 phases indexed by i = 0, . . . , lg n. In phase i, we will issue 2i groups of requests. The jth group in phase i consists of 1/δ requests each with capacity demand δ and identical routing paths Pj (and so the total capacity for each group in every phase is 1). Fix a phase i and group j ∈ {0, 1, . . . , 2i − 1}. Then path Pj is defined to be the segment of L(n) starting at . In other words, in a given phase we are splitting L(n) into 2i edge -disjoint vertex v jn subsegments each of the length n/2i, where each subsegment defines a path for a group. and ending at vertex v (j+1)n This implies that Let xi be the total demand admitted by the algorithm from requests in phase i. Observe that in order to admit a unit of demand from the requests in phase i, the algorithm must use up a total capacity of n/2i (since each path i=0 2−inxi ≤ n. Pj in phase i has n/2i edges). Since the total capacity of edges in the graph is n, we have that(cid:80)lg n Let Sk = 2−k(cid:80)k i=0 xi be the normalized total capacity obtained by the algorithm from phases 0 through k. By −ixi ≤ 1. lg n(cid:88) (12) i=0 2 2i equation (12), we have that lg n(cid:88) k=0 Sk = lg n(cid:88) k(cid:88) k=0 i=0 lg n(cid:88) k=0 2 −kxi ≤ 2 2 −kxk ≤ 2. Thus, there exists a k(cid:48) such that Sk(cid:48) ≤ 2/ lg n, implying the algorithm only earned at most 2k(cid:48)+1/ lg n total capacity after the completion of phase k(cid:48). The optimal solution at this point is to reject all requests before phase k(cid:48) and admit all requests in phase k(cid:48) to obtain capacity 2k(cid:48). Therefore, the adversary can stop the sequence after phase k(cid:48) to obtain the desired instance. Given Lemma 13 and its proof, let I be the instance implied by the statement of the lemma, and let I(cid:48) be the entire of sequence of requests given by the construction (all lg n + 1 phases, regardless of the algorithm's behavior). We construct our lower bound instance for ADGEN-AON (in the same bids case) as follows. • There will be one bidder u for the instance. • Each group in I(cid:48) will correspond to both a dimension and an impression. Specifically, for all impressions that correspond to the vth group in I(cid:48), we set r (v) uv = δ and r • Each edge e will correspond to a budget constraint B (se) u uv = 0 for all k (cid:54)= v. , where the capacity of the budget is ce = 1 and set se is defined to be the set of dimensions whose corresponding request group use edge e along their paths in I(cid:48). Observe that the single request in phase 1 of I(cid:48) traverses all of L(n); therefore based on the construction, the first dimension belongs to n different budget constraints, which implies p = n. It now follows from Lemma 13 that any algorithm for ADGEN-AON is Ω(lg p) competitive. (k) Extension to ADGEN-P: To show a Ω(lg p) lower bound for ADGENERAL (without the small bids assumption), we modify the definition of ADMISSION-CONTROL so that algorithm chooses to accept each request with some fraction fi ∈ [0, 1] (i.e., the algorithm routes demand fi·di for request ri). We then change the lower bound instance in Lemma 13 so that each request has unit demand (instead of issuing 1/δ requests with δ demand). The remainder of the reduction is equivalent. Using the same arguments as before, we obtain the desired Ω(lg p) lower bound for the ADGEN-P setting. APPENDIX C ADGEN-P AND ADGEN-AON UPPER BOUND (THEOREM 3 AND THEOREM 4) In this section, we give our upper bounds for ADGEN-P and ADGEN-AON. We will first present the algorithm under the context ADGEN-AON. At the end of the section, we will outline how the same analysis extends to ADGEN-P. In both settings, the algorithm and analysis will be almost identical to our algorithm for ADGENERAL in Section III. A. Algorithm Definition Again let κ (s) u denote the fraction of B (s) u an exponential potential function defined by: currently used by the algorithm. The algorithm (we call it ALGO) uses (cid:88) (cid:88) (cid:88) (cid:88) φ = φ(s) u = (cid:18) (s) B u p (p + 1) (s) u κ 1− − 1 . (cid:19) s u Note that φ = 0 initially. At any stage of ALGO, a dimension k is said to be active for bidder u if and only if (cid:80) u ≤ 1, else dimension k is said to be inactive for bidder u. (Note that this is a different definition of active dimensions than what is used in Section II). ALGO only attempts to earn revenue on active dimensions, and hence, the total revenue if impression v is allocated to bidder u is given by: φ(s) B(s) s:k∈s u s u ruv = r(k) uv , where Au is the set of current active dimensions for bidder u. (cid:88) k∈Au The algorithm makes a greedy assignment with respect to ruv, i.e., it assigns impression v to arg maxu ruv. Note that it is possible that Au = ∅ for all bidders u, and therefore the algorithm does not assign impression v to any bidder, even though there are dimensions and bidders where it could have earned revenue. This completes the description of our algorithm. B. Algorithm Analysis We first establish feasibility of the solution. Lemma 14. If ALGO assigns an impression v to a bidder u, then it can earn revenue on all the active dimensions Au of u without violating any constraint. Proof: We need to show that for all constraints s of bidder u, κ k∈Au∩s r(k) uv B(s) u ≤ 1. Suppose not. Then, u +(cid:80) (s) for some constraint s, κ(s) u +  ≥ κ(s) u + (cid:88) k∈Au∩s (k) r uv (s) u B > 1 (by the definition of ) (cid:32) 1 1− since κ (s) u 1 −  (cid:33) > 1 from the first line i.e., (p + 1) κ (s) u + 1− > (p + 1) i.e., (p + 1) (s) u κ 1− > p + 1 (s) u (s) u i.e., pφ B i.e., φ B (s) u (s) u + 1 > p + 1 > 1, which contradicts the fact that dimension k is active for bidder u. This lemma implies that ALGO is indeed able to earn revenue on all active dimensions of a bidder u when it assigns an impression to u. Next, we will bound the total revenue of an optimal solution that we denote by OPT against the total revenue of ALGO. Let uOPT(v) (resp., uALGO(v)) be the bidder that OPT (resp., ALGO) allocates impression v to. For every dimension k that OPT earns revenue from, one of the following holds: 1) Case 1: dimension k is active for bidder uOPT(v) in ALGO when impression v arrives, and ALGO assigns v 2) Case 2: dimension k is active for bidder uOPT(v) in ALGO when impression v arrives, but ALGO assigns v to the same bidder, i.e., uALGO(v) = uOPT(v). to a different bidder, i.e., uALGO(v) (cid:54)= uOPT(v). 3) Case 3: dimension k is inactive for bidder uOPT(v) in ALGO when impression v arrives. We partition the dimensions that OPT earns revenue from into active and inactive dimensions (according to their status in ALGO for bidder uOPT(v)). For active dimensions (cases 1 and 2 above), the next lemma gives a straightforward charging argument using the greediness of the choice made by ALGO. Lemma 15. For any impression v, the total revenue earned by OPT on the active dimensions is at most the total revenue earned by ALGO overall. Proof: For case 1 above (OPT and ALGO choose the same bidder), the two algorithms earn the same revenue on the active dimensions. For case 2 above, the fact that ALGO makes a greedy choice implies that it earns at least as much revenue by assigning to a different bidder as it would have made by assigning to u, which includes the revenue on all the active dimensions. The more involved case is that of inactive dimensions (case 3 above). In this case, we use a different global charging argument over all dimensions, based on the potential function. In particular, we show that for a bidder u, the total revenue of OPT from inactive dimensions (recall that this only includes revenue from impressions that arrived after the dimension became inactive in ALGO) can be charged, up to a loss equal to the desired competitive ratio, to the revenue that ALGO earned overall from bidder u. Lemma 16. Fix a bidder u. The total revenue that OPT earns in inactive dimensions for bidder u is at most the final potential of bidder u in ALGO. Proof: For any dimension k, let Vu,k denote the subset of impressions assigned to u by OPT that arrived after k became an inactive dimension for bidder u in ALGO. We need to bound the total revenue earned by OPT on dimension k from impressions in Vu,k, summed over all k. For any impression v ∈ Vu,k, we have: (cid:88) φ (s) u (s) u s:k∈s B > 1, is the final potential for constraint s of bidder u. Thus, the revenue that OPT earns from impressions (s) u where φ v ∈ Vu,k on dimension k, summed over all dimensions, can be bounded as follows: (k) r uv (s) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) r(k) uv < φ(s) u r(k) uv = v∈Vu,k k s:k∈s B s k∈s v∈Vu,k B φ (s) u (s) u v∈Vu,k k (cid:88) s u ≤ φ(s) u , where the last inequality follows by the feasibility of OPT. Next, we need to lower bound the final potential of a bidder in terms of the revenue that ALGO earns from her. This is given in the next lemma. Lemma 17. The increase in potential of a bidder u during the course of ALGO is at most 4· p that ALGO earns from u.  1−  times the revenue Proof: Suppose ALGO assigns impression v to bidder u. Let Ka denote the set of active dimensions for bidder . The increase in potential for bidder u is given as (s) k:k∈Ka∩s r(k) uv B(s) u u when this assignment is made. Let η follows: u = (cid:80) where the inequality follows since η rearranging the RHS of inequality (13) and using the fact that {s : k ∈ s} ≤ p, we obtain: u ≤  and ax ≤ 1 + ax for 0 ≤ x ≤ 1, a ≥ 1. By k:k∈Ka∩s r(k) uv B(s) , (13) (cid:88) s ∆φ(s) u = (cid:18) s s s = = φ(s) u + (s) B u p (s) B u p (cid:88) (cid:88) (cid:32) (cid:88) (cid:32) (cid:88) u = (cid:80) (cid:32)(cid:88) (cid:88) (cid:88) r(k) uv · φ(s) u + ≤ (s) s r(k) uv k∈Ka 1−  (cid:19) (s) κ u 1− (cid:33) (cid:19) (cid:17) η  − 1 (cid:88) (k) r uv (s) B u (s) u k:k∈Ka∩s (cid:33) (p + 1) (s) u +η (s) u κ 1− − (p + 1) (p + 1) (p + 1) (s) u η 1− − 1 (cid:18) (cid:32)(cid:16) · (s) κ u 1− (cid:33) (cid:33) (s) B u p (s) B u p (p + 1)  1− (p + 1)  1−  · · φ (s) u (s) u s:k∈s B + {s : k ∈ s} p (since k is active, and p ≥ {s : k ∈ s}) (cid:16)   since (p + 1) 1− ≤ 2 · p 1− for large enough p (cid:17) , (cid:88) s ∆φ(s) u ≤ (p + 1)  1−  (p + 1) ≤ 2 · k∈Ka r(k) uv  (cid:88) (cid:17) k∈Ka  1−   1−  (cid:16) p p ≤ 4 · as desired. A competitive ratio of O C. Extension to ADGEN-P for ADGEN-AON now follows from Lemmas 15, 16, and 17. (cid:80) We begin by noting that for ADGEN-P, we will assume that the maximum bid-to-budget ratio maxu,v,s < 1. Obviously, this assumption is wlog for ADGEN-AON since any u, v pair that results in  > 1 cannot be assigned (and it is easy to show an arbitrarily large lower bound when  = 1). For ADGEN-P, however, allowing instances where  > 1 still admits a nontrivial problem definition since the algorithm can choose to earn partial revenues. However, since such a scenario would clearly never arise in practice (i.e, an impression generating more revenue than a budget) and only complicates the analysis, we proceed with this added assumption. u r(k) uv k∈Ks B(s) To adapt our ADGEN-AON algorithm and analysis for ADGEN-P, the algorithm will now choose to earn 1 lg(2p+2) 1 fraction of all revenues and set the parameter  = lg(2p+2) in algorithm and proof (so essentially the algorithm treats the instance as if its a ADGENERAL small-bids instance). Otherwise, the algorithm behaves identically as before. Since we are assuming the maximum bid-to-budget ratio is at most 1, this scaling procedure ensures that the lg(2p+2) factor. revenue generated by an impression never increases the utilization of a constraint by more than a To show a O(lg p) competitive ratio, it suffices to show that Lemmas 14 through 17 still hold in this setting. It is not too hard to verify that Lemmas 14, 16, and 17 follow by the same arguments, noting that in these proofs, (k) lg(2p+2) factor (except in Lemma uv still denotes the revenue earned by the algorithm after its been reduced by a r (k) uv denotes the amount of revenue the optimal solution chooses to earn). Lemma 15 uses the same argument, 16, r lg(2p+2) factor of that earned by the except now the greedy property implies that the algorithm earns at least a optimal solution on a active dimension (instead of strictly more); however, losing this factor in this case is fine since the we are ultimately aiming for a O(lg p) competitive ratio. Hence, our algorithm extends to the ADGEN-P setting. 1 1 1
1609.00810
1
1609
2016-09-03T10:14:59
Greedy MAXCUT Algorithms and their Information Content
[ "cs.DS", "cs.DM", "cs.IT", "cs.IT" ]
MAXCUT defines a classical NP-hard problem for graph partitioning and it serves as a typical case of the symmetric non-monotone Unconstrained Submodular Maximization (USM) problem. Applications of MAXCUT are abundant in machine learning, computer vision and statistical physics. Greedy algorithms to approximately solve MAXCUT rely on greedy vertex labelling or on an edge contraction strategy. These algorithms have been studied by measuring their approximation ratios in the worst case setting but very little is known to characterize their robustness to noise contaminations of the input data in the average case. Adapting the framework of Approximation Set Coding, we present a method to exactly measure the cardinality of the algorithmic approximation sets of five greedy MAXCUT algorithms. Their information contents are explored for graph instances generated by two different noise models: the edge reversal model and Gaussian edge weights model. The results provide insights into the robustness of different greedy heuristics and techniques for MAXCUT, which can be used for algorithm design of general USM problems.
cs.DS
cs
Greedy MAXCUT Algorithms and their Information Content Yatao Bian, Alexey Gronskiy and Joachim M. Buhmann Department of Computer Science, ETH Zurich {ybian, alexeygr, jbuhmann}@inf.ethz.ch 6 1 0 2 p e S 3 ] S D . s c [ 1 v 0 1 8 0 0 . 9 0 6 1 : v i X r a Abstract-MAXCUT defines a classical NP-hard problem for graph partitioning and it serves as a typical case of the symmetric non-monotone Unconstrained Submodular Maximization (USM) problem. Applications of MAXCUT are abundant in machine learning, computer vision and statistical physics. Greedy algo- rithms to approximately solve MAXCUT rely on greedy vertex labelling or on an edge contraction strategy. These algorithms have been studied by measuring their approximation ratios in the worst case setting but very little is known to characterize their robustness to noise contaminations of the input data in the average case. Adapting the framework of Approximation Set Coding, we present a method to exactly measure the cardinality of the algorithmic approximation sets of five greedy MAXCUT algorithms. Their information contents are explored for graph instances generated by two different noise models: the edge reversal model and Gaussian edge weights model. The results provide insights into the robustness of different greedy heuristics and techniques for MAXCUT, which can be used for algorithm design of general USM problems. I. INTRODUCTION Algorithms are mostly analyzed by measuring their run- time and memory consumption for the worst possible input instance. In many application scenarios, algorithms are also selected according to their "robustness" to noise perturbations of the input instance and their insensitivity to randomization during algorithm execution. How should this "robustness" property be measured? Machine learning requires that algo- rithms with random variables as input generalize over these fluctuations. The algorithmic answer has to be stable w.r.t. this uncertainty in the input instance. Approximation Set Coding (ASC) quantifies the impact of input randomness on the solution space of an algorithm by measuring the attainable resolution for the algorithm's output. We employ this framework in an exemplary way by estimating the ro- bustness of MAXCUT algorithms to specific input instances. Thereby, we effectively perform an average case analysis of the generalization properties of MAXCUT algorithms. such that the cut value cut(S1, S2) := (cid:80) A. MAXCUT and Unconstrained Submodular Maximization Given an undirected graph G = (V, E) with vertex set V = {v1, v2,··· , vn} and edge set E with nonnegative weights wij,∀(i, j) ∈ E, the MAXCUT problem aims to find a partition of vertices into two disjoint subsets S1 and S2, wij is maximized. MAXCUT is emlpoyed in various applications, such as in semisupervised learning ([1]), in social network ([2]), in statistical physics and in circuit layout design ([3]). (cid:80) i∈S1 j∈S2 MAXCUT is considered to be a typical case of the USM problem because its objective can be formulated as a set function: f (S) := cut(S, V \S), S ⊆ V , which is submodular, nonmonotone, and symmetric (f (S) = f (V \S)). Beside MAXCUT, USM captures many practical problems such as MAXDICUT ([4]), variants of MAXSAT and the maximum facility location problem ([5], [6]). B. Greedy Heuristics and Techniques The five algorithms investigated here (as summarized in Table I) belong to two greedy heuristics: double greedy and backward greedy. The double greedy algorithms exploit the symmetric property of USM, and conducts classical forward greedy and backward greedy simultaneously: it works on two solutions initialized as ∅ and the ground set V , respectively, then processes the elements (vertices for MAXCUT problem) one at a time, for which it determines whether it should be added to the first solution or removed from the second solution. The backward greedy algorithm removes the smallest weighted edge in each step. The difference of the four double greedy algorithms lies in the greedy techniques they use: sorting, randomization and the way to initialize the first two vertices. C. Approximation Set Coding for Algorithm Analysis In analogy to Shannon's theory of communication, the ASC framework ([7], [8], [9]) determines distinguishable sets of solutions and, thereby, provides a general principle to conduct model validation ([10], [11]). As an algorithmic variant of the ASC framework, [12], [13] defines the algorithmic t- approximation set of an algorithm A at step t as the set of feasible solutions after t steps, CA t (G) := At(G), where At(G) is the solution set which are still considered as viable by A after t computational steps. ASC utilizes the two instance-scenario to investigate the information content of greedy MAXCUT algorithms. Since we investigate the average case behavior of algorithms, we have to specify the probability distribution of the input instances. We generate graph instances in a two step process. First, generate a "master graph" G, e.g., a complete graph with Gaussian distributed weights. In a second step, we generate two input graphs G(cid:48), G(cid:48)(cid:48) by independently applying a noise process to edge weights of the master graph G. TABLE I: Summary of Greedy MAXCUT Algorithms Name D2Greedy RDGreedy SG SG3 EC Greedy Heuristic Double Backward Techniques Sort. Rand. Init. Vertices (cid:88) (cid:88) (cid:88) (cid:88) (cid:88) : t t (cid:17)(cid:105) E(cid:104) I A := max I A t = max The algorithmic analogy of information content ([7]), i.e. algorithmic information content I A , is computed as the max- imum stepwise information I A t (cid:16) C ∆A t (G(cid:48), G(cid:48)(cid:48)) (1) t (G(cid:48)(cid:48)) t (G(cid:48))CA t (G(cid:48), G(cid:48)(cid:48)) := The expectation is taken w.r.t. (G(cid:48), G(cid:48)(cid:48)); ∆A t (G(cid:48)(cid:48)) denotes the intersection of approximation CA sets, and C is the solution space, i.e., all possible cuts. The information content I A t measures how much information is extracted by algorithm A at iteration t from the input distribution that is relevant to the output distribution. t (G(cid:48))∩CA log CA II. GREEDY MAXCUT ALGORITHMS We investigate five greedy algorithms (Table I) for MAX- CUT. According to the type of greedy heuristic, they can be divided into two categories: I) Double Greedy: SG, SG3, D2Greedy, RDGreedy; II) Backward Greedy: Edge Contrac- tion. Besides the type of greedy heuristic, the difference between the algorithms are mainly in three techniques: sorting the candidate elements, randomization and the way initializing the first two vertices. In the following, we briefly introduce one typical algorithm in each category and we present the others by showing the difference (details are in the Supplement VI-A because of space limit). A. Double Greedy Algorithms D2Greedy (Alg. 1) is the Deterministic double greedy, RDGreedy is the Randomized double greedy, they were proposed by [14] to solve the general USM problem with 1/3 and 1/2 worst-case approximation guarantee, respectively. They use the same double greedy heuristic as SG ([15]) and SG3 (variant of SG), which are classical greedy MAXCUT algorithms. We prove in Supplement VI-B that, for MAXCUT, SG and D2Greedy use equivalent labelling criteria except for initializing the first two vertices. As shown in Alg. 1, D2Greedy maintains two solution sets: S initialized as ∅, T initialized as the ground set V . It labels all the vertices one by one: for vertex vi, it computes the objective gain of adding vi to S and the gain of removing vi from T , then labels vi to have higher objective gain. SG and D2Greedy differ in the initialization of the first two vertices: SG picks first of all the maximum weighted edge and distributes its two vertices to the two active subsets. Compared to D2Greedy, the RDGreedy uses randomization Algorithm 1: D2Greedy ([14]) Input: Complete graph G = (V, E) with nonnegative edges Output: A disjoint cut and the cut value 1 S0 := ∅, T 0 := V ; 2 for i = 1 to n do 3 4 5 6 ai := f (Si−1 ∪ {vi}) − f (Si−1); bi := f (T i−1\{vi}) − f (T i−1); if ai ≥ bi then Si := Si−1 ∪ {vi}, T i := T i−1 ; else 7 Si := Si−1, T i := T i−1\{vi} ; 8 9 return Sn, V \Sn, and cut(Sn, V \Sn) //expand S //shrink T technique when labelling each vertex: it labels each vertex with probability proportional to the objective gain. Compared to SG, SG3 sorts the unlabelled vertices according to a certain score function (which is proportional to the possible objective gains), and selects the vertex with the maximum score to be the next one to be labelled. B. Edge Contraction (EC) EC ([16], Alg. 2) contracts the smallest edge in each step. The two vertices of this contracted edge become one "super" vertex, and the weight of an edge connecting this super vertex to any other vertex is assigned as the sum of weights of the original two edges. EC belongs to the backward greedy in the sense that it tries to remove the least expensive edge from the cut set in each step. We can easily derive a heuristic for the MAX-K-CUT problem by using n − k steps instead of n − 2 steps. Algorithm 2: Edge Contraction (EC) ([16]) Input: Complete graph G = (V, E) with nonnegative edge Output: A disjoint cut S1, S2 and cut value cut(S1, S2) ContractionList(i) := {i}; 1 for i = 1 : n do 2 3 for i = 1 : n − 2 do 4 5 6 7 Find a minimum weight edge (x, y) in G; v := contract(x, y), V := V ∪ {v}\{x, y} ; //contract for j ∈ V \{v} do 8 wvj := wxj + wyj; ContractionList(v) := ContractionList(x) ∪ ContractionList(y); 9 Denote by x and y the only 2 vertices in V ; 10 return S1 := ContractionList(x), S2 := ContractionList(y), cut(S1, S2) := wxy III. COUNTING SOLUTIONS IN APPROXIMATION SETS To compute the information content according to Eq. 1, we need to exactly compute the cardinalities of four different solution sets. For MAXCUT problem, the solution space has the cardinality C = 2n−1−1. In the following we will present guaranteed methods for exact counting CA t (G(cid:48)(cid:48)) t (G(cid:48), G(cid:48)(cid:48)) (sub-/superscripts omitted for notational and ∆A clarity). t (G(cid:48)),CA A. Counting Methods for Double Greedy Algorithms The counting methods for the double greedy algorithms are similar, so we only discuss the method for SG3 here; details about other methods and the corresponding proofs are in the Supplement VI-C and VI-D, respectively. For the SG3 (Alg. 6, see Supplement), after step t (t = 1,··· , n − 1) there are k = n − t − 1 unlabelled vertices, and it is clear that C(G(cid:48)) = C(G(cid:48)(cid:48)) = 2k. To count the intersection set ∆(G(cid:48), G(cid:48)(cid:48)), assume the solution set pair of G(cid:48) 2), the solution set pair of G(cid:48)(cid:48) is (S(cid:48) is 2}, 1∪ S(cid:48) 1 , S(cid:48)(cid:48) (S(cid:48)(cid:48) 2}, respectively. Denote L := T (cid:48) ∩ T (cid:48)(cid:48) be T (cid:48)(cid:48) = V \{S(cid:48)(cid:48) the common vertices of the two unlabelled vertex sets, so l = L (0 ≤ l ≤ k) is the number of common vertices in the unlabelled k vertices. Denote M(cid:48) := T (cid:48)\L, M(cid:48)(cid:48) := T (cid:48)(cid:48)\L be the sets of different vertex sets between the two unlabelled vertex sets. Then, 2 ), so the unlabelled vertex sets are T (cid:48) = V \{S(cid:48) 1 ∪ S(cid:48)(cid:48) 1, S(cid:48) ∆(G(cid:48), G(cid:48)(cid:48)) = 1\M(cid:48), S(cid:48)(cid:48) 1\M(cid:48)(cid:48), S(cid:48) if (S(cid:48)(cid:48) (S(cid:48) otherwise 2\M(cid:48)) is matched by 2\M(cid:48)(cid:48)) or (S(cid:48) 2\M(cid:48)(cid:48), S(cid:48) 1\M(cid:48)(cid:48))  2l 0 B. Counting Method for Edge Contraction Algorithm For EC (Alg. 2), after step t (t = 1,··· , n − 2) there are k = n − t "super" vertices (i.e. contracted ones). It is straightforward to see that C(G(cid:48)) = C(G(cid:48)(cid:48)) = 2k−1 − 1. To count the intersection ∆(G(cid:48), G(cid:48)(cid:48)), suppose there are l (0 ≤ l ≤ k) common super vertices in the unlabelled k ver- tices. Remove the l common super vertices from each set, then there are h = k − l distinct super vertices in each set, denote them by P := {p1, p2,··· , ph}, Q := {q1, q2,··· , qh}, respectively. Notice that p1∪p2∪···∪ph = q1∪q2∪···∪qh, so after some contractions in both P and Q, there must be some common super vertices between P and Q. Assume the maximum number of common super vertices after all possible contractions is c∗, then it holds ∆(G(cid:48), G(cid:48)(cid:48)) = 2c∗+l−1 − 1 . (2) To compute c∗, we propose a polynomial time algorithm (Alg. 3) with a theoretical guarantee in Theorem 1 (for the proof see Supplement VI-E). The algorithm finds the maximal number of common super vertices after all possible contractions, that is used to count ∆(G(cid:48), G(cid:48)(cid:48)) for EC. Theorem 1. Given two distinct super vertex sets P := {p1, p2,··· , ph}, Q := {q1, q2,··· , qh} (any 2 super ver- tices inside P or Q do not intersect, and there is no common super vertex between P and Q), such that p1∪p2∪···∪ph = q1 ∪ q2 ∪ ··· ∪ qh, Alg. 3 returns the maximum number of common super vertices between P and Q after all possible contractions. IV. EXPERIMENTS We conducted experiments on two exemplary models: the edge reversal model and the Gaussian edge weights model. Each model involves the master graph G and a noise type used to generate the two noisy instances G(cid:48) and G(cid:48)(cid:48). The width of Algorithm 3: Common Super Vertex Counting Input: Two distinct super vertex sets P , Q Output: Maximum number of common super vertices after all possible contractions 1 c := 0; 2 while P (cid:54)= ∅ do 3 4 5 6 7 Randomly pick pi ∈ P ; Find qj ∈ Q s.t. pi ∩ qj (cid:54)= ∅; if qj\pi (cid:54)= ∅ then if pi\qj (cid:54)= ∅ then For pi, find pi(cid:48) ∈ P\{pi} s.t. pi(cid:48) ∩ (qj\pi) (cid:54)= ∅; pii(cid:48) := pi ∪ pi(cid:48), P := P ∪ {pii(cid:48)}\{pi, pi(cid:48)} ; For qj, find qj(cid:48) ∈ Q\{qj} s.t. qj(cid:48) ∩ (pi\qj) (cid:54)= ∅; qjj(cid:48) := qj ∪ qj(cid:48), Q := Q ∪ {qjj(cid:48)}\{qj, qj(cid:48)} ; if pii(cid:48) == qjj(cid:48) then Remove pii(cid:48), qjj(cid:48) from P , Q, respectively; c := c + 1; 8 9 10 11 12 13 14 return c the instance distribution is controlled by the strength of the noise model. These models provide the setting to investigate the algorithmic behavior. A. Experimental Setting Edge Reversal Model: To obtain the master graph, we generate a balanced bipartite graph Gb with disjoint vertex sets S1, S2. Then we assign uniformly distributed weights in n2 ] to all edges inside S1 or S2 and we assign uniformly [0, 8 distributed weights in [1− 8 n2 , 1] to all edges between S1 and S2, thus generating graph G(cid:48) b. Then randomly flip edges in G(cid:48) b to generate the master graph G. Here, flip edge eij means changing its weight wij to 1 − wij with probability pm, and (f lip eij) ∼ Ber(pm); pm = 0.2 is used to generate the master graph G. Noisy graphs G(cid:48), G(cid:48)(cid:48) are generated by flipping the edges in G with probability p, ((f lip eij) ∼ Ber(p)). Gaussian Edge Weights Model: The master graph G is generated with Gaussian distributed edge weights wij ∼ m), µ = 600, σm = 50, negative edges are set to be N (µ, σ2 µ. Noisy graphs G(cid:48), G(cid:48)(cid:48) are obtained by adding Gaussian distributed noise nij ∼ N (0, σ2), negative noisy edges are set to be 0. For both noise models, we conducted 1000 experiments on i.i.d. generated noisy graphs G(cid:48) and G(cid:48)(cid:48), and then we aggregate the results to estimate the expectation in Eq. 1. B. Results We plot the information content and stepwise information per node in Fig. 1 and 2, respectively. For the edge reversal model, we also investigate the number of equal edge pairs be- tween G(cid:48) and G(cid:48)(cid:48): d = 0,··· , m (m is the total edge number), d measures the consistency of the two noisy instances. The expected fraction of equal edge pairs is Ed = p2 + (1 − p)2, and it is plotted as the dashed magenta line in Fig. 1(a). C. Analysis Before discussing these results, let us revisit the stepwise in- formation and information content. From the counting methods (a) Edge Reversal Model, n: 100 (b) Gaussian Edge Weights Model, n: 100 Fig. 1: Information Content per Node t (G(cid:48)) t (G(cid:48)(cid:48)) (e.g., A = SG3), an we insert these values in Section III, we derive the analytical form of C, CA and CA into the definition of stepwise information, (cid:16)C ∆A (cid:17) CA t (G(cid:48)(cid:48)) t (G(cid:48))CA t (G(cid:48), G(cid:48)(cid:48))) − log(CA t (G(cid:48)(cid:48)))) t (G(cid:48), G(cid:48)(cid:48)) + 2t + log(2n−1 − 1) − 2(n − 1) t = E log I A = E(log(C∆A = E log ∆A t (G(cid:48), G(cid:48)(cid:48)) t (G(cid:48))CA (3) The information content is computed as the maxi- mum stepwise information I A := maxt I A . Notice that t t (G(cid:48), G(cid:48)(cid:48)) measures the ability of A to find common log ∆A solutions for the two noisy instances G(cid:48), G(cid:48)(cid:48), given the under- lying input graph G. t (G(cid:48), G(cid:48)(cid:48)) = log CA in the noise free limit (G(cid:48) = G(cid:48)(cid:48)), Our results support the following observations and analysis: • All investigated algorithms reach the maximum infor- mation content i.e., for p = 0, 1 in the edge reversal model and for σ = 0 in the Gaussian edge weights model. In this circumstance, t (G(cid:48)) = n − t − 1, so I A E log ∆A t = t+log(2n−1−1)−(n−1), and the information content reaches its maximum log(2n−1 − 1) at the final step t = n − 1. • Fig. 1(a) demonstrates that the information content qual- itatively agrees with the consistency between two noisy instances (the dashed magenta line), which reflects that log ∆A • Stepwise information (Fig. 2) of the algorithms increase initially, but after reaching the optimal step t∗ (the step with highest information), it decreases and finally vanishes. • For the greedy heuristics, backward greedy is more infor- mative than double greedy under both models. EC (backward greedy) achieves the highest information content. We explain this behavior by delayed decision making of the backward greedy edge contraction. With high probability it preserves consistent solutions by contracting low weight edges that t (G(cid:48), G(cid:48)(cid:48)) is affected by the noisy instances. have a low probability to be included in the cut. The same phenomena arises for the reverse-delete algorithm to calculate the minimum spanning tree of a graph (see [13]). • The information content of the four double greedy al- gorithms achieve different rank orders for the two models. SG3 is inferior to other double greedy algorithms under Gaussian edge weights model, but this only happens when p ∈ [0.2, 0.87] for the edge reversal model. This results from that information content of one specific algorithm is affected by both the input master graph G and the noisy instances G(cid:48), G(cid:48)(cid:48), which are completely different under the two models. • Different greedy techniques cast different influences on the information content. The four double greedy algorithms differ by the techniques they use (Table I). (1) The ran- domization technique makes RDGreedy very fragile w.r.t. information content, though it improves the worst-case ap- proximation guarantee for the general USM problem ([14]). RDGreedy labels each vertex with a probability proportional to the objective gain, this randomization makes the consistency between CA t (G(cid:48)(cid:48)) very weak, resulting in t (G(cid:48), G(cid:48)(cid:48)). (2) The small approximation set intersection log ∆A initializing strategy for the first 2 vertices as used in SG decreases the information content (SG is outperformed by D2Greedy under both models) due to early decision making. (3) The situation is similar for the sorting techniquey used in SG3 under Gaussian edge weights model, it is outperformed by both SG and D2Greedy. But for the edge reversal model, this observation only holds when p ∈ [0.2, 0.87]. t (G(cid:48)) and CA • SG and D2Greedy behave very similar under both models, which is caused by an equivalent processing sequence apart from initializing of the first two vertices (proved in Supplement VI-B). 00.10.20.30.40.50.60.70.80.9110−310−210−1100Noise [p]Information Content per Node [bits] SG3ECSGD2GreedyR2Greedy SG3 EC SG D2Greedy RDGreedy 02040608010012014016018020010−310−210−1100Noise [std. dev.]Information Content per Node [bits] SG3ECSGD2GreedyR2Greedy SG3 EC SG D2Greedy RDGreedy (a) Edge Reversal Model, n: 100, p = 0.65 (b) Gaussian Edge Weights Model, n: 100, σ = 125 Fig. 2: Stepwise Information per Node V. DISCUSSION AND CONCLUSION REFERENCES This work advocates an information theoretically guided average case analysis of the generalization ability of greedy MAXCUT algorithms. We have contributed to the foundation of approximation set coding by presenting provably correct methods to exactly compute the cardinality of approximation sets. The counting algorithms for approximate solutions enable us to explore the information content of greedy MAXCUT al- gorithms. Based on the observations and analysis, we propose the following conjecture: • Different greedy heuristics (backward, double) and differ- ent processing techniques (sorting, randomization, intilization) sensitively influence the information content. The backward greedy with its delayed decision making consistently outper- forms the double greedy strategies for different noise models and noise levels. Since EC demonstrated to achieve the highest robustness, it is valuable to develop the corresponding algorithm for the general USM. In this work ASC has been employed as a descriptive tool to compare algorithms. We could also use the method for algorithm design. A meta-algorithm modifies the algo- rithmic steps of a MAXCUT procedure and measures the resulting change in information content. Beneficial changes are accepted and detrimental changes are rejected. It is also imaginable that design principles like delayed decision making are systematically identified and then combined to improve the informativeness of novel algorithms. ACKNOWLEDGMENT This work was partially supported by SNF Grant # 200021 138117. The authors would like to thank Andreas Krause, Mat´us Mihal´ak and Peter Widmayer for valuable discussions. [1] J. Wang, T. Jebara, and S.-F. Chang, "Semi-supervised learning using greedy max-cut," JMLR, vol. 14, no. 1, pp. 771–800, Mar. 2013. [2] R. Agrawal, S. Rajagopalan, R. Srikant, and Y. Xu, "Mining newsgroups using networks arising from social behavior," in WWW. ACM, 2003, pp. 529–535. [3] F. Barahona, M. Grotschel, M. Junger, and G. Reinelt, "An application of combinatorial optimization to statistical physics and circuit layout design," Operations Research, vol. 36, no. 3, pp. 493–513, 1988. [4] E. Halperin and U. Zwick, "Combinatorial approximation algorithms for the maximum directed cut problem," in ACM-SIAM symposium on Discrete algorithms, 2001, pp. 1–7. [5] A. A. Ageev and M. Sviridenko, "An 0.828-approximation algorithm for the uncapacitated facility location problem," Discrete Applied Math- ematics, vol. 93, no. 2, pp. 149–156, 1999. [6] G. Cornuejols, M. Fisher, and G. L. Nemhauser, "On the uncapacitated location problem," Annals Discr. Math., vol. 1, pp. 163–177, 1977. [7] J. M. Buhmann, "Information theoretic model validation for clustering." in ISIT, 2010, pp. 1398–1402. [8] J. Buhmann, "Context sensitive information: Model validation by in- formation theory," in Pattern Recognition, ser. LNCS 6718. Springer Berlin / Heidelberg, 2011, pp. 12–21. [9] J. M. Buhmann, "Simbad: Emergence of pattern similarity," in Springer, 2013, Similarity-Based Pattern Analysis and Recognition. pp. 45–64. [10] M. H. Chehreghani, A. G. Busetto, and J. M. Buhmann, "Information theoretic model validation for spectral clustering." in AISTATS, 2012, pp. 495–503. [11] G. Zhou, S. Geman, and J. M. Buhmann, "Sparse feature selection by information theory," in ISIT. IEEE, 2014, pp. 926–930. [12] L. M. Busse, M. H. Chehreghani, and J. M. Buhmann, "The information IEEE, 2012, pp. 2746–2750. [13] A. Gronskiy and J. M. Buhmann, "How informative are minimum content in sorting algorithms," in ISIT. spanning tree algorithms?" in ISIT. IEEE, 2014, pp. 2277 – 2281. [14] N. Buchbinder, M. Feldman, J. Naor, and R. Schwartz, "A tight linear time (1/2)-approximation for unconstrained submodular maximization," in FOCS. IEEE, 2012, pp. 649–658. [15] S. Sahni and T. Gonzalez, "P-complete approximation problems," Jour- nal of the ACM (JACM), vol. 23, no. 3, pp. 555–565, 1976. [16] S. Kahruman, E. Kolotoglu, S. Butenko, and I. V. Hicks, "On greedy construction heuristics for the max-cut problem," Int. J. Comput. Science and Engineering, vol. 3, no. 3, pp. 211–218, 2007. 10010110210−410−310−210−1100StepStepwise Information per Node (p = 0.65) SG3ECSGD2GreedyR2Greedy SG3 EC SG D2Greedy RDGreedy 10010110210−510−410−310−210−1StepStepwise Information per Node (sigma = 125) SG3ECSGD2GreedyR2Greedy SG3 EC SG D2Greedy RDGreedy VI. SUPPLEMENTARY MATERIAL A. Details of Double Greedy Algorithms Algorithm 4: SG ([15]) Input: A complete graph G = (V, E) with nonnegative edge weights wij,∀i, j ∈ V, i (cid:54)= j Output: A disjoint cut and the cut value 1 Pick the maximum weighted edge (x, y); 2 S1 := {x},S2 := {y}, cut(S1, S2) := wxy; 3 for i = 1 : n − 2 do 4 //w(i, Sk) :=(cid:80) If w(i, S1) > w(i, S2), then add i to S2, else add it to S1; cut(S1, S2) := cut(S1, S2) + max{w(i, S1), w(i, S2)}; wij , k = 1, 2 j∈Sk 5 6 return S1, S2, and cut(S1, S2) Algorithm 5: RDGreedy ([14]) Input: A complete graph G = (V, E) with nonnegative edge weights wij,∀i, j ∈ V, i (cid:54)= j Output: A disjoint cut and the cut value 1 S0 := ∅, T 0 := V ; 2 for i = 1 to n do 3 4 5 ai := f (Si−1 ∪ {vi}) − f (Si−1); bi := f (T i−1\{vi}) − f (T i−1); i := max{bi, 0}; i := max{ai, 0}, b(cid:48) a(cid:48) a(cid:48) With probability i+b(cid:48) a(cid:48) T i := T i−1//If a(cid:48) i = b(cid:48) i i do: Si := Si−1 ∪ {vi}, a(cid:48) i = 0, assume i+b(cid:48) a(cid:48) b(cid:48) ) do: a(cid:48) i+b(cid:48) i i i i = 1 Else (with the compliment probability Si := Si−1, T i := T i−1\{vi}; 8 return 2 subsets: Sn, V \Sn, and cut(Sn, V \Sn) 6 7 6 7 Algorithm 6: SG3 Input: A complete graph G = (V, E) with nonnegative edge weights wij,∀i, j ∈ V, i (cid:54)= j Output: A disjoint cut S1, S2 and the cut value cut(S1, S2) 1 Pick the maximum weighted edge (x, y); 2 S1 := {x},S2 := {y},V := V \{x, y}, cut(S1, S2) := wxy; 3 for i = 1 : n − 2 do 4 5 score(j) := w(j, S1) − w(j, S2) ; for j ∈ V do // w(j, Sk) :=(cid:80) j(cid:48)∈Sk wjj(cid:48) , k = 1, 2 Choose the vertex j∗ with the maximum score; If w(j∗, S1) > w(j∗, S2), then add j∗ to S2, else add it to S1; V := V \{j∗}; cut(S1, S2) := cut(S1, S2) + max{w(j∗, S1), w(j∗, S2)}; 8 9 10 return S1, S2, and cut(S1, S2) B. Equivalence Between Labelling Criterions of SG and D2Greedy Claim: for processing the first 2 vertices, D2Greedy and SG conduct the same labelling strategy for each vertices. Except Proof. To verify this, assume in the beginning of a certain step i, the solution set pair of SG is (S1, S2), of D2Greedy is (S, T ) (for simplicity omit the step index here). D2Greedy is: S1 ↔ S and S2 ↔ (V \T ). Note that the relationship between solution sets of SG and For SG, the labelling criterion for vertex i is: w(i, S2) − w(i, S1) = wij (4) (cid:88) wij − (cid:88) i,j∈S2 i,j∈S1 For D2Greedy, the labelling criterion for vertex i is: ai − bi = [f (S ∪ {vi}) − f (S)] − [f (T\{vi}) − f (T )] −  (5) wij wij i∈S,j∈V \S i∈T,j∈V \T = = = wij i∈S,j=i i,j∈V \S\{vi} i∈S∪{vi},j∈V \S\{vi} i∈T\{vi},j∈V \T∪{vi}  (cid:88)  (cid:88)  (cid:88) wij − (cid:88)  (cid:88) wij − (cid:88)  (cid:88)  (cid:88)  (cid:88)  (cid:88) wij − (cid:88) wij − (cid:88) −  wij − (cid:88) wij − (cid:88)   wij − (cid:88) wij − (cid:88) i,j∈(V \T )∪(T\S\{vi}) i,j∈(S)∪(T\S\{vi}) i∈T\{vi},j=i i,j∈V \T i,j∈V \T i,j∈V \T i,j∈S i,j∈S wij wij wij wij = 2 = 2 i,j∈S2 i,j∈S1 = 2[w(i, S2) − w(i, S1)] wij −  (6) (7) (8) where Eq. 8 comes from the relationship between solution sets of SG and D2Greedy. So the labelling criterion for SG and D2Greedy is equivalent with each other. C. Counting Methods for Double Greedy Algorithms D2Greedy: summarized in Alg. 1, we have proved that it has the same labelling criterion with SG, the relationship between solution sets of SG and D2Greedy is: S1 ↔ S and S2 ↔ (V \T ), we will use S1 and S2 in the description of its counting methods. In step t (t = 1,··· , n) there are k = n − t unlabelled vertices, it is not difficult to know that the number of possible solutions for each instance is C(G(cid:48)) = C(G(cid:48)(cid:48)) = 2k − 1 if S1 (cid:54)= ∅ and S2 (cid:54)= ∅ otherwise (cid:26) 2k (cid:54)= pii(cid:48)). That means, there is only one such that pii(cid:48)(cid:48) possible way to construct the removed common super vertex. We will use inductive assumption to prove the claim. First of all, in the beginning (step 0), the conditions hold. Assume the conditions hold in step t. In step t + 1, there are 2 possible situations: • There are no common super vertex removed. Condition 1 holds because the contracted super vertices pair do not equal. Condition 2, 3 hold as well because there are no contracted super vertices removed. • There are common super vertex removed. Condition 1 holds because the only common super vertices pair have been removed from P, Q, respectively. To prove condition 2, notice that the smaller vertices for pii(cid:48) are pii(cid:48)\pi = pi(cid:48) and pii(cid:48)\p(cid:48) i = pi, respectively, for qjj(cid:48) are qjj(cid:48)\qj = qj(cid:48) and qjj(cid:48)\q(cid:48) j = qj, according to Condition 1, they can not be common super vertices, so there are no smaller common super vertices. To prove condition 3, assume there exists pii(cid:48)(cid:48) = qjj(cid:48)(cid:48), such that pii(cid:48)(cid:48) (cid:54)= pii(cid:48) (respectively, qjj(cid:48)(cid:48) (cid:54)= qjj(cid:48)), so pi(cid:48)(cid:48) (cid:54)= pi(cid:48) (pj(cid:48)(cid:48) (cid:54)= pj(cid:48)). From Alg. 3 we know that pi ∪ pi(cid:48)(cid:48) = pii(cid:48)(cid:48) ⊇ qj\pi and pi ∪ pi(cid:48) = pii(cid:48) ⊇ qj\pi (respectively, qj∪qj(cid:48)(cid:48) = qjj(cid:48)(cid:48) ⊇ pi\qj and qj∪qj(cid:48) = qjj(cid:48) ⊇ pi\qj), so that pi(cid:48)(cid:48) ⊇ qj\pi and pi(cid:48) ⊇ qj\pi (respectively, qj(cid:48)(cid:48) ⊇ pi\qj and qj(cid:48) ⊇ pi\qj), that contradicts the known truth that pi(cid:48) and pi(cid:48)(cid:48) (respectively, qj(cid:48) and qj(cid:48)(cid:48)) must be totally different with each other (from Condition 1). Then we use the Claim to prove that the c returned by Alg. 3 is exactly the maximum number of common super vertices after all possible contractions. Because the 3 conditions hold for each step, we know that finally all the common super vertices are removed out from P and Q. From Condition 2 we know that all the removed common super vertices are the smallest ones, from Condition 3 we get that there is not a second way to construct the common super vertices, so the resulted c is the maximum number of common super vertices after all possible contractions. 1, S(cid:48) 1\S(cid:48)(cid:48) 2 ), so the unlabelled vertex sets are T (cid:48) = V \S(cid:48) To count the intersection set (i.e. C(G(cid:48))∩C(G(cid:48)(cid:48))), assume 2), the solution sets of G(cid:48)(cid:48) is the solution sets of G(cid:48) is (S(cid:48) 1\S(cid:48) 1 , S(cid:48)(cid:48) (S(cid:48)(cid:48) 2, T (cid:48)(cid:48) = V \S(cid:48)(cid:48) 2 , respectively. Denote L := T (cid:48) ∩ T (cid:48)(cid:48) be the common vertices of the two unlabelled vertex sets, so l = L (0 ≤ l ≤ k) is the number of common vertices in the unlabelled k vertices. Denote M(cid:48) := T (cid:48)\L, M(cid:48)(cid:48) := T (cid:48)(cid:48)\L be the sets of different vertex sets between the two unlabelled vertex sets. Then, 1\M(cid:48)(cid:48)) matches (S(cid:48) 1\M(cid:48), S(cid:48)(cid:48) 2\M(cid:48)(cid:48)) matches 1\M(cid:48), S(cid:48)(cid:48) 2\M(cid:48)). (S(cid:48)(cid:48) Assume w.l.o.g. 2\M(cid:48)): (S(cid:48)(cid:48) 2\M(cid:48)(cid:48), S(cid:48) (S(cid:48) 1\M(cid:48)(cid:48), S(cid:48) (S(cid:48) 2\M(cid:48)(cid:48)) or 1\M(cid:48)(cid:48), S(cid:48) 1) if that C(G (cid:48) (cid:26) 2l ) = ) ∩ C(G (cid:48)(cid:48) 1 ∪ S(cid:48)(cid:48) if S(cid:48) otherwise ) ∩ C(G (cid:48)(cid:48) (cid:48) 1 (cid:54)= ∅ and S(cid:48) 2 ∪ S(cid:48)(cid:48) 2 (cid:54)= ∅ 2l − 1 2) otherwise, C(G SG3: presented in Section III-A. SG: summarized in Alg. 4, the methods to count its approx- ) = 0 imation sets is the same as that of SG3. RDGreedy: summarized in Alg. 5, the methods to count its 2 1 ∪ S(cid:48) 1 ∪ S(cid:48)(cid:48) 1 ∪ S(cid:48)(cid:48) 1\M(cid:48)(cid:48), S(cid:48) approximation sets is the same as that of D2Greedy. D. Proof of the Correctness of Method to Count C(G(cid:48)) ∩ C(G(cid:48)(cid:48)) of SG3 1 ∪S(cid:48)(cid:48) Proof. First of all, notice that M(cid:48) must be included in S(cid:48)(cid:48) and M(cid:48)(cid:48) must be included in S(cid:48) 2, because M(cid:48) has no 2 ∪ M(cid:48)(cid:48) = intersection with M(cid:48)(cid:48), and we know that S(cid:48)(cid:48) 2 ∪ M(cid:48). After removing M(cid:48) from S(cid:48)(cid:48) 1 ∪ S(cid:48) S(cid:48) 2 , and M(cid:48)(cid:48) 1 ∪ S(cid:48) 2\M(cid:48)(cid:48)) from S(cid:48) 2, the vertices in the pairs, (S(cid:48) 1\M(cid:48), S(cid:48)(cid:48) 2\M(cid:48)), can not be changed by distributing any and (S(cid:48)(cid:48) other unlabelled vertices , so if they can not match with each other, there will be no common solutions. If they can match, in the following, there is only one way to distribute M(cid:48) and M(cid:48)(cid:48) to have common solutions. And the vertices in the common set L = T (cid:48) ∩ T (cid:48)(cid:48) can be distributed consistently in the two instances, so in this situation C(G(cid:48))∩ C(G(cid:48)(cid:48)) = 2l. E. Proof of Theorem 1 Proof. First of all, We will prove the following claim, then use the claim to prove Theorem 1. In each step t (t = 0,··· , n − 2), the following Claim: conditions hold: 1) The remained super vertices in P, Q are distinct with each other, that means any 2 super vertices inside P or Q do not have intersection, and there are no common super vertex between P and Q. 2) The common super vertex removed from P, Q, i.e., pii(cid:48) = qjj(cid:48), is the smallest common super vertex containing pi or pi(cid:48) (respectively, qj or qj(cid:48)) 3) The common super vertex removed from P, Q, i.e., pii(cid:48) = qjj(cid:48), are "unique" (i.e., there does not exist pii(cid:48)(cid:48) = qjj(cid:48)(cid:48),
1307.2863
1
1307
2013-07-10T17:47:20
Dynamic Data Structure for Tree-Depth Decomposition
[ "cs.DS" ]
We present a dynamic data structure for representing a graph $G$ with tree-depth at most $D$. Tree-depth is an important graph parameter which arose in the study of sparse graph classes. The structure allows addition and removal of edges and vertices such that the resulting graph still has tree-depth at most $D$, in time bounds depending only on $D$. A tree-depth decomposition of the graph is maintained explicitly. This makes the data structure useful for dynamization of static algorithms for graphs with bounded tree-depth. As an example application, we give a dynamic data structure for MSO-property testing, with time bounds for removal depending only on $D$ and constant-time testing of the property, while the time for the initialization and insertion also depends on the size of the formula expressing the property.
cs.DS
cs
Dynamic Data Structure for Tree-Depth Decomposition Zdenek Dvor´ak Martin Kupec Vojtech Tuma1 Computer Science Institute, Charles University Prague, Czech Republic {rakdver,kupec,voyta}@iuuk.mff.cuni.cz. Abstract We present a dynamic data structure for representing a graph G with tree-depth at most D. Tree-depth is an important graph parameter which arose in the study of sparse graph classes. The structure allows addition and removal of edges and vertices such that the resulting graph still has tree-depth at most D, in time bounds depending only on D. A tree-depth decomposition of the graph is main- tained explicitly. This makes the data structure useful for dynamization of static algo- rithms for graphs with bounded tree-depth. As an example application, we give a dynamic data structure for MSO-property testing, with time bounds for removal depending only on D and constant-time testing of the property, while the time for the initialization and insertion also depends on the size of the formula expressing the property. The concept of tree-depth, introduced in [12], appears prominently in the sparse graph theory and in particular the theory of graph classes with bounded expansion, developed mainly by Nesetril and Ossona de Mendez [11, 13, 14, 15, 16, 17]. One of its many equivalent definitions is as follows. The tree-depth td(G) of an undirected simple graph G is the smallest integer t for that there exists a rooted forest T of height t with vertex set V (G) such that for every edge xy of G, either x is ancestor of y in T or vice versa -- in other words, G is a subgraph of the closure of F . Alternatively, tree-depth can be defined using (and is related to) rank func- tion, vertex ranking number, minimum elimination tree or weak-coloring num- bers. Futhermore, a class of graphs closed on subgraphs has bounded tree-depth if and only if it does not contain arbitrarily long paths. Tree-depth is also re- lated to other structural graph parameters -- it is greater or equal to path-width (and thus also tree-width), and smaller or equal to the smallest vertex cover. 1The work leading to this invention has received funding from KONTAKT II LH12095 and SVV 267313. 1 Determining tree-depth of a graph is NP-complete in general. Since tree- depth of a graph G is at most log(G) times its tree-width, tree-depth can be approximated up to log2(G)-factor, using the approximation algorithm for tree-width [1]. Furthermore, for a fixed integer t, the problem of deciding whether G has tree-depth at most t can be solved in time O(G). Minimal minor/subgraph/induced subgraph obstructions for the class of all graphs of tree-depth at most t are well characterized, see [4]. Clearly, tree-depth is mono- tone with respect to all these relations. For more information about tree-depth, see the book [18]. A motivation for investigating structural graph parameters such as tree- depth is that restricted structure often implies efficient algorithms for prob- lems that are generally intractable. Structural parameters have a flourishing relationship with algorithmic meta-theorems, combining graph-theoretical and structural approach with tools from logic and model theory -- see for instance [8]. A canonical example of a meta-theorem using a structural parameter is the re- sult of Courcelle [3] which gives linear-time algorithms for properties expressible in MSO logic on classes of graphs with bounded tree-width. Tree-depth is similar to tree-width, in the sense that it measures "tree- likeness" of a graph and also allows decomposition with algorithmically ex- ploitable properties. However, tree-depth is more restrictive, since bounded tree-depth implies bounded tree-width, but forbids the presence of long paths. Long paths turn out to be related to the hardness of model checking for MSO logic [10, 6]. This motivated a search for meta-theorems similar to [3] on more restricted classes of graphs, such as the result of Lampis [9] that provides al- gorithms with better dependence on the size of the formula for classes such as those with bounded vertex cover or bounded max-leaf number. This result was subsequently generalized by Gajarsk´y and Hlinen´y to graphs with bounded tree-depth [7]. In the usual static setting, the problem is to decide whether a graph given on input has some fixed property P . Our work is of dynamic kind, that is, the considered graph gradually changes over time and we have to be able to answer any time whether it has the property P . One application comes im- mediately in mind. Graphs modelling many natural phenomena, such as the web graph, graphs of social networks or graphs of some physical structure all change rapidly. However, there is another area where this dynamic approach is useful. For example, one reduces a graph by removing edges, and each time an edge is removed, some procedure has to be performed. Instead of running the procedure from scratch every time, it makes sense to keep some dynamic infor- mation. Classical examples are the usage of a disjoint-find-union data structure in minimal spanning tree algorithms [2] or Link-cut trees for network flow algo- rithms [19]. A more recent example is a data structure for subgraph counting [5] with applications in graph coloring and social networking. The main theorem of our paper follows. Theorem 1. Let φ be a MSO2 formula and D ∈ N. There exists a data structure for representing a graph G with td(G) ≤ D supporting the following operations: 2 • insert edge e, provided that td(G + {e}) ≤ D, • delete edge e, • query -- determine whether G satisfies the formula φ. The time complexity of deletion depends on D only, in particular, it does not depend on φ or G. The time complexity of insertion depends on φ and D, but does not depend on G. The time complexity of the initialization of the data structure depends on φ, D and G. The query is done in constant time, as is addition or removal of an isolated vertex. The dependence of the initialization and edge insertion is roughly a tower of height D where the highest element of the tower is the number of nested quantifiers of φ squared. The basic idea of the data structure is to explicitly maintain a forest of smallest depth whose closure contains G, together with its compact constant- size summary obtained by identifying "equivalent" subtrees. This summary is sufficient to decide the property expressed by φ, as outlined in the following paragraph. Two graphs are said to be n-equivalent, if they satisfy the same first or- der formulas with at most n quantifier alterations -- that is, for instance, of the form ∀x1..i1 ∃xi1+1..i2 ∀xi2+1..i3 . . . ∃xin−1+1..in φ(x1..n), where φ is quantifier-free. This concept of n-equivalency is of practical use for model checking. It serves to reduce the investigated graph to a small one, so that time-expensive approaches as brute force become possible (a technique known as kernelization). An exam- ple of such application is the following theorem (from section 6.7 of [18]): for every D, n exists N such that every graph G with td(G) ≤ D is n-equivalent to one of its induced subgraphs of order at most N . This can be extended even to labeled graphs. In our work we use a similar theorem, taken from [7]. Infor- mally, the result says that when one is interested in checking whether a specific formula is true on a class of trees of bounded depth, then one can also assume bounded degree. This allows us to only maintain the summary of the tree-depth decomposition as described above. In the rest of the paper, the first section reviews necessary definitions and tools we use, and the second section describes in detail the data structure and its operations. We conclude the paper with the application to dynamic model checking. 1 Preliminaries In this paper, all trees we work with are rooted. For simplicity, we assume in this section that all graphs we work with are connected. If we encounter a disconnected graph, we consider each of its connected components individually. Let T be a tree, the depth of T is the maximum length of a path from the root of T to a leaf of T . Two trees are isomorphic if there exists a graph-isomorphism between them such that the root is preserved under it. Mostly we will work with 3 trees with vertices labelled from some set of l labels -- two l-labelled trees are l- isomorphic if they are isomorphic as trees and the isomorphism preserves labels. The closure clos(T ) is the graph obtained from T by adding all edges (x, y) such that x is an ancestor of y, and x 6= y. For instance, the closure of a path is a complete graph. The tree-depth td(G) is the minimum number t such that there exists a forest T of depth t such that G ⊆ clos(T ). For instance, the tree-depth of a path on n vertices is ⌈log2(n + 1)⌉. A limb of a vertex v ∈ T is the subgraph induced by some of the children of v. A second-order logic formula φ is in MSO1 logic, if all second-order quantifiers are over sets of elements (vertices) and the language contains just the relation edge(u, v). The following result is a simplification of Lemma 3.1 from [7]. Lemma 2. Let φ be an MSO1 sentence, l, D ∈ N. Then there exists a number S with the following property. Let T be an l-labelled tree of depth at most D with vertices labelled with l labels, and v a vertex of T . If v has more than S pairwise l-isomorphic limbs, then for the tree T ′ obtained by deleting one of those limbs we have that T ′ satisfies φ ⇐⇒ T satisfies φ. The Lemma implies in particular that with respect to φ-checking there are only finitely many l-labelled trees of depth at most D -- that is, every l-labelled tree of depth at most D is φ-equivalent to some l-labelled tree of depth at most D and maximum degree at most S. We call such trees φ-minimal. Let G be a graph of tree-depth D, the tree decomposition T of G is a 2D−1- labelled tree such that G ⊆ clos(T ), where a vertex v is labelled by a 0-1 vector of length D − 1 that encodes the edges between v and the vertices on the path from v to the root (1 whenever the edge is present, 0 otherwise). Let lD be a set of labels we describe later, compressed tree decomposition of the graph G is an lD-labelled tree C obtained from a tree decomposition T of G as follows. For every vertex, all its limbs that are pairwise-isomorphic are deleted except for one representative, in which we additionally store the number of these limbs. Vertices of C are called cabinets, and the underlying tree decomposition T is called a decompression of C. A set of all vertices corresponding to the same cabinet (that is, inducing lD-isomorphic limbs) and having the same vertex as a father in the decompression is called a drawer. Thus every cabinet is disjointly partitioned into drawers. For an example how a graph, its tree decomposition and compressed tree decomposition look like, see the figures on page 5 (in the compressed tree decomposition, the number next to the drawers denotes how many vertices are there in each drawer). Now we describe the labelling. We start inductively, with l0 being just a set of vectors of length D − 1. Assume that φ is some fixed formula we specify later (in Section 2.5) and let S be the number obtained from applying Lemma 2 to it. Let B be a cabinet that induces a subtree of depth t′ ≤ t in C. The label of B consists of the label of a corresponding vertex b of T and of a vector vec with entry for every lt−1-labelled φ-minimal tree M of depth smaller than 4 Figure 1: Graph Figure 2: Tree-depth decomposition 1 2 1 1 2 1 2 Figure 3: Compressed graph t′ with value vecM = min{S, number of limbs of b which are φ-equivalent to M }. During the update operations, we will be occasionally forced to have more than one cabinet for a given isomorphism type (that is, a cabinet will have two pairwise-isomorphic limbs). Both the decomposition and the individual cabinets that have isomorphic children will be called dirty. 2 Data structure Our data structure basically consists of storing some extra information for every vertex v of the represented graph G, and of a compressed tree-depth decompo- sition T of G with depth at most D. We will store the following for every v ∈ G. • Label of the cabinet corresponding to v, that is, the vector of its neigh- bors on the path to root and the vector with the numbers of limbs of v isomorphic to individual φ-minimal trees. 5 • Pointer to the father of v in T (more precisely, pointer to a vertex u of G that is the father of v in the decompression of T ). However, in some operations we need to change the father of all vertices in a drawer at once -- thus instead of storing father individually for every vertex, for every drawer we will maintain a pointer to the common father of the vertices in this drawer, and every vertex in the drawer will have a pointer to this pointer. • Linked list of sons of v in T . This is again implemented by having a linked list of drawers at v, and for every drawer in it, a linked list of vertices in this drawer. Additionally, we keep the vertex v which is the root of T and we call it r -- we again assume connectedness of G in this section, otherwise we keep a list of roots corresponding to individual components. 2.1 Extraction of a path In this subsection we describe an auxiliary operation of extracting a path. It can be seen as a temporary decompression of a part of T in order to make some vertex accessible. The result of extracting v from T is a dirty compressed tree decomposition T ′ of G, such that on the cabinets in T ′ corresponding to r − v path there are no cabinets to which corresponds more than one vertex of G. First, we find the vertices of the r − v path, and the corresponding cabinets in T . This is done by simply following the father-pointers from v, and then by going backwards from r, always picking the cabinet that corresponds to the label of the vertex on the r − v path. Then, for every cabinet B on this path with more than one vertex, let b be the vertex of the r − v path lying in B, and c its father -- which we assume to be the only vertex in its cabinet, C. We remove b from the lists of sons of c of the label of b, and move b into a new list for c, and do the corresponding change in T ′, that is, creating a new cabinet of the same label as a son of C, thus making C a dirty cabinet. The complexity of this operation is clearly linear in D. 2.2 Edge deletion Edge deletion is simple -- let vu be the edge to be deleted, with v the lower vertex (in the tree-order imposed by T ). We extract the vertex v from T . Now u lies on the r − v path, and as there are no other vertices in the cabinets on the corresponding path in T , we remove the edge vu from the graph and change the labels for the cabinets and vertices accordingly. The only affected labels are on the r − v path, and we will precompute during initialization what the label should change into. It can also happen that removal of such edge disconnects the graph -- this also depends only on labels and thus will be precomputed in advance. When such situation occurs, we split T into two components -- the new root depends only on the labels, and the vertices for which labels change are only on the r − v path. 6 Now, we need to clean the dirty cabinets. As the only dirty cabinets are on the r − v path, we traverse this path, starting from v and going upwards, and for every vertex w in a dirty cabinet, we compare the label of w with the labels of other present drawers at the father of w, and move w to the correct drawer/cabinet. The complexity of this operation is clearly linear in D. 2.3 Rerooting Rerooting is also an auxiliary operation, which will allow us to easily handle the edge insertion. This operation takes a compressed tree decomposition T and a vertex rN of G, for which we have a guarantee that there is a tree decomposition with depth at most D such that rN is its root, outputs one such compressed tree decomposition T ′ and updates data for vertices in G accordingly. In this subsection we denote by rO the root of T , that is, the old root. We proceed as follows: 1. extract rN from T , 2. remove rN from T entirely, 3. consider the connected components thereof -- those that do not contain rO have depth < D and thus can be directly attached under rN . Recurse into the component with rO. Only the third point deserves further explanation. The components are de- termined by the labels only, so we will precompute which labels are in which components and what vertices are the roots of the components. Every connected component of T − rN that does not contain rO must have as its highest vertex (under the tree-order) a son of rN , thus these components are already in their proper place. For the component C with rO, either it has depth < D and thus can be attached under rN , with rO being a son of rN . We have to deal with two details -- firstly, there might be some edges to rN from vertices that were above rN in T -- but none of these vertices was in a cabinet with more than one vertex, thus we only change the labels accordingly. Secondly, the limbs of rN in T that are in C have no father after removal of rN . But as they are in C, for every such limb there is an edge from it to some vertex on the rN − rO path T . Choose lowest such vertex, and make it new father for that limb. This refathering is done by using the pointers for the drawers -- note that every cabinet that is a root of such limb consist only of single drawer, thanks to the extraction of rN . Thus the total number of operations we have to do is linear in D and the maximum number of children of rN , which is ld. As in the case of edge deletion, we have to clean dirty cabinets (which are in C) in the end. This can again be done by simply comparing labels on that former rN − rO path. However, it might happen that C has depth exactly D. But we are guar- anteed that there exist a tree decomposition with rN as a root, which implies 7 that there exists a tree decomposition of C with depth D − 1. If we know which vertex can serve as a root of such decomposition, we can apply the operation recursively. We describe the procedure to find a root in Section 2.5. An addi- tional thing we have to care about is that some vertices of C have an edge to rN -- this information has to be preserved in the recursive call. But the number of such vertices is bounded by a function of D and thus it is not a problem -- we only modify their labels accordingly. After this recursive call, we again clean dirty cabinets. The complexity of this operation for one call is linear in D + ld+ time to find new root, and there are at most D recursive calls. 2.4 Edge insertion Let u, v be two vertices not connected with an edge, such that G + uv has treedepth at most D, we now describe how to add such edge. If the edge uv respects the tree-order (that is, either u lies on v − r path or vice versa), we just extract the lower of the two vertices, add the edge, and get rid of dirty cabinets. Otherwise, there exists a vertex r1 which is a root of some tree decomposition of G + uv. We describe the procedure for finding it in Section 2.5. Reroot into this vertex to obtain decomposition T1. Now, u and v must be in the same connected component C1 of T1 − r1. Again, unless the edge uv respects the tree-order now, we can find a vertex r2 in C1 which is a root of some tree decomposition of C1 + uv of depth at most D − 1, and reroot into it to obtain decomposition T2 of C1, with u and v lying in the same component C2 of C1 −r2. Carrying on in the obvious manner, this process stops after at most D iterations. The complexity of this operation is O(D· complexity of rerooting). Finally, we just remark that addition and removal of a vertex (without in- cident edges) is implemented trivially by just adding/removing new component with the corresponding label. 2.5 Finding a root Let us recall what we have to face in this section. We want to find a vertex v such that there is a tree T of depth at most t′ ≤ t such that its closure contains the connected component C of the graph G + (a, b) − {v1, v2, . . . , vk} as a subgraph and v is a root of T . The vertices v1, v2, . . . , vk correspond to the roots found in previous applications of this procedure, (a, b) denotes the edge we are trying to add. At this point we define the formula φ according to which we constructed the labelling of our trees. Let γ(C) be a formula which is true whenever C is connected -- this is easily seen to be expressible in MSO1 logic -- and τd(G) the following formula: τd(G) = (∃v ∈ G)(∀C ⊆ G)(γ(C − {v}) ⇒ τd−1(C − {v})), with τ1(v) being always true. Then τd(G) says that there exists a tree T with depth at most d such that G ⊆ clos(T ). Furthermore, as we need to express the 8 addition of an edge, we work with the logic with two extra constants a, b, and modify the formula for γ accordingly to obtain γ ′ and τ ′. The resulting formula τ ′ t is the formula φ. Using Lemma 2, we construct all φ-minimal trees -- note that we have to consider every possible evaluation of the constants a, b, that is, we construct all trees of depth at most t such that no vertex has more than S pairwise-isomorphic limbs, and then for every two of labels, we choose two arbitrary vertices having that label, and choose them to be a and b. For every such minimal tree, we evaluate the formula, that is, we find which vertex is to be the root of the tree decomposition. It might happen that the formula is false, that is, no such vertex exists, which means we evaluated a and b so that the graph has tree- depth greater than d. But such evaluation will not occur during the run of the structure -- recall that we restricted the edge additions -- and thus we can safely discard these minimal trees. Thus for every minimal tree we store the label of the vertices that can be made root, and when applying the rerooting subroutine, we find an arbitrary vertex of this label. This has complexity at most D, because when looking for the given vertex, we follow first pointer from the corresponding linked list of children for a vertex. This means that the total complexity of the edge insertion is O(D(D + lD)). Finally, let us remark on the complexity of initialization. From [7] we conclude that lD, that is, the number of φ-minimal trees, is roughly a tower of 2's of height linear in D, to the power φ2. The complexity of operations we do for every φ-minimal tree is bounded by a polynomial in D and lD. 2.6 Dynamic model checking We now describe how to modify the structure so that it also allows queries of the form "does G satisfy the formula ϕ", where ϕ is some fixed MSO formula. The modifications affect only the Section 2.5. Instead of using just the formula φ to obtain the φ-minimal trees, we apply the Lemma 2 to the formula ϕ also and in the construction of the minimal trees and the labelling, we use the higher of the two numbers obtained from the Lemma. Then for every such obtained minimal tree we evaluate whether it satisfies ϕ or not, this time without evaluating the constants a, b. References [1] H. L. Bodlaender, J. R. Gilbert, H. Hafsteinsson, and T. Kloks, frontsize, and shortest elimination Approximating treewidth, pathwidth, tree, Journal of Algorithms, 18 (1995), pp. 238 -- 255. [2] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, Intro- duction to algorithms, The MIT Press, 2009. [3] B. Courcelle, The monadic second-order logic of graphs. i. recognizable sets of finite graphs, Information and computation, 85 (1990), pp. 12 -- 75. 9 [4] Z. Dvor´ak, A. C. Giannopoulou, and D. M. Thilikos, Forbid- den graphs for tree-depth, European Journal of Combinatorics, 33 (2012), pp. 969 -- 979. [5] Z. Dvor´ak and V. Tuma, A dynamic data structure for counting sub- graphs in sparse graphs, in Algorithms and Data Structures Symposium, WADS 2013, London (Ont.), Proceedings, Springer, 2013. To appear. [6] M. Frick and M. Grohe, The complexity of first-order and monadic second-order logic revisited, in Logic in Computer Science, 2002. Proceed- ings. 17th Annual IEEE Symposium on, IEEE, 2002, pp. 215 -- 224. [7] J. Gajarsky and P. Hlineny, Faster Deciding MSO Properties of Trees of Fixed Height, and Some Consequences, in IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Sci- ence (FSTTCS 2012), D. D'Souza, T. Kavitha, and J. Radhakrishnan, eds., vol. 18 of Leibniz International Proceedings in Informatics (LIPIcs), Dagstuhl, Germany, 2012, Schloss Dagstuhl -- Leibniz-Zentrum fuer Infor- matik, pp. 112 -- 123. [8] M. Grohe and S. Kreutzer, Methods for algorithmic meta theorems, Model Theoretic Methods in Finite Combinatorics, 558 (2011), pp. 181 -- 206. [9] M. Lampis, Algorithmic meta-theorems for restrictions of treewidth, Algo- rithmica, 64 (2012), pp. 19 -- 37. [10] M. Lampis, Model checking lower bounds for simple graphs, CoRR, abs/1302.4266 (2013). [11] J. Nesetril and P. Ossona de Mendez, Linear time low tree-width partitions and algorithmic consequences, in Proceedings of the thirty-eighth annual ACM symposium on Theory of computing, STOC '06, ACM, 2006, pp. 391 -- 400. [12] , Tree-depth, subgraph coloring and homomorphism bounds, European Journal of Combinatorics, 27 (2006), pp. 1022 -- 1041. [13] , Grad and classes with bounded expansion i. decompositions, Euro- pean Journal of Combinatorics, 29 (2008), pp. 760 -- 776. [14] , Grad and classes with bounded expansion ii. algorithmic aspects, European Journal of Combinatorics, 29 (2008), pp. 777 -- 791. [15] , Grad and classes with bounded expansion iii. restricted graph ho- momorphism dualities, European Journal of Combinatorics, 29 (2008), pp. 1012 -- 1024. [16] , First order properties on nowhere dense structures, J. Symbolic Logic, 75 (2010), pp. 868 -- 887. 10 [17] , On nowhere dense graphs, European J. Combin., 32 (2011), pp. 600 -- 617. [18] , Sparsity: Graphs, Structures, and Algorithms, vol. 28, Springer, 2012. [19] D. D. Sleator and R. Endre Tarjan, A data structure for dynamic trees, Journal of computer and system sciences, 26 (1983), pp. 362 -- 391. 11
1901.07118
1
1901
2019-01-21T23:22:47
A Space-efficient Parameterized Algorithm for the Hamiltonian Cycle Problem by Dynamic Algebraziation
[ "cs.DS" ]
An NP-hard graph problem may be intractable for general graphs but it could be efficiently solvable using dynamic programming for graphs with bounded width (or depth or some other structural parameter). Dynamic programming is a well-known approach used for finding exact solutions for NP-hard graph problems based on tree decompositions. It has been shown that there exist algorithms using linear time in the number of vertices and single exponential time in the width (depth or other parameters) of a given tree decomposition for many connectivity problems. Employing dynamic programming on a tree decomposition usually uses exponential space. In 2010, Lokshtanov and Nederlof introduced an elegant framework to avoid exponential space by algebraization. Later, F\"urer and Yu modified the framework in a way that even works when the underlying set is dynamic, thus applying it to tree decompositions. In this work, we design space-efficient algorithms to solve the Hamiltonian Cycle and the Traveling Salesman problems, using polynomial space while the time complexity is only slightly increased. This might be inevitable since we are reducing the space usage from an exponential amount (in dynamic programming solution) to polynomial. We give an algorithm to solve Hamiltonian cycle in time $\mathcal{O}((4w)^d\, nM(n\log{n}))$ using $\mathcal{O}(dn\log{n})$ space, where $M(r)$ is the time complexity to multiply two integers, each of which being represented by at most $r$ bits. Then, we solve the more general Traveling Salesman problem in time $\mathcal{O}((4w)^d poly(n))$ using space $\mathcal{O}(\mathcal{W}dn\log{n})$, where $w$ and $d$ are the width and the depth of the given tree decomposition and $\mathcal{W}$ is the sum of weights. Furthermore, this algorithm counts the number of Hamiltonian Cycles.
cs.DS
cs
A Space-efficient Parametrized Algorithm for the Hamiltonian Cycle Problem by Dynamic Algebraziation Mahdi Belbasi, Martin Furer Department of Computer Science and Engineering University Park, PA 16802, USA Pennsylvania State University {mahdi,furer}@cse.psu.edu Abstract. An NP-hard graph problem may be intractable for general graphs but it could be efficiently solvable using dynamic programming for graphs with bounded width (or depth or some other structural parameter). Dynamic programming is a well-known ap- proach used for finding exact solutions for NP-hard graph problems based on tree decom- positions. It has been shown that there exist algorithms using linear time in the number of vertices and single exponential time in the width (depth or other parameters) of a given tree decomposition for many connectivity problems. Employing dynamic programming on a tree decomposition usually uses exponential space. In 2010, Lokshtanov and Nederlof in- troduced an elegant framework to avoid exponential space by algebraization. Later, Furer and Yu modified the framework in a way that even works when the underlying set is dy- namic, thus applying it to tree decompositions. In this work, we design space-efficient algorithms to solve the Hamiltonian Cycle and the Traveling Salesman problems, using polynomial space while the time complexity is only slightly increased. This might be inevitable since we are reducing the space usage from an exponential amount (in dynamic programming solution) to polynomial. We give an algo- rithm to solve Hamiltonian cycle in time O((4w)d nM (n log n)) using O(dn log n) space, where M (r) is the time complexity to multiply two integers, each of which being repre- sented by at most r bits. Then, we solve the more general Traveling Salesman problem in time O((4w)dpoly(n)) using space O(Wdn log n), where w and d are the width and the depth of the given tree decomposition and W is the sum of weights. Furthermore, this algorithm counts the number of Hamiltonian Cycles. 1 Introduction Dynamic programming (DP) is largely used to avoid recomputing subproblems. It may decrease the time complexity, but it uses auxiliary space to store the intermediate values. This auxiliary space may go up to exponential in the size of the input. This means both the running time and the space complexity are exponential for some algorithms solving those NP-complete problems. Space complexity is a crucial aspect of algorithm design, because we typically run out of space before running out of time. To fix this issue, Lok- shtanov and Nederlof [16] introduced a framework which works on a static underlying set. The problems they considered were Subset Sum, Knapsack, Traveling Salesman (in time O(2nw) using polynomial space),Weighted Steiner Tree, and Weighted Set Cover. They use DFTs, zeta transforms and Mobius transforms [19, 20], taking advantage of the fact that working on zeta (or discrete Fourier) transformed values is significantly easier since the subset convolution operation converts to pointwise multiplication oper- ation. In all their settings, the input is a set or a graph which means the underlying set for the subproblems is static. Furer and Yu [12] changed this approach modifying a dynamic programming algorithm applied to a tree decomposition (instead of the graph itself). The resulting algorithm uses only polynomial space and the running time does 9 1 0 2 n a J 1 2 ] S D . s c [ 1 v 8 1 1 7 0 . 1 0 9 1 : v i X r a 2 M. Belbasi, M. Furer not increase drastically. By working with tree decompositions, they obtain parametrized algorithms which are exponential in the tree-depth and linear in the number of vertices. If the tree decomposition has a bounded width, then the algorithm is both fast and space-efficient. In this setting, the underlying set is not static anymore, because they are working with different bags of nodes. They show that using algebraization helps to save space even if the underlying set is dynamic. They consider perfect matchings in their paper. In recent years, there have been several results in this field where algebraic tools are used to save space when DP algorithms are applied to NP-hard problems. In 2018, Pilipczuk and Wrochna [18] applied a similar approach to solve the Minimum Dominat- ing Set problem. Although they have not directly used these algebraic tools but it is a similar approach (in time O(3dpoly(n)) using poly(n) space). We have to mention that there is no general method to automatically transform dynamic programming solutions to polynomial space solutions while increasing the tree-width pa- rameter to the tree-depth in the running time. One of the interesting NP-hard problems in graph theory is Hamiltonian Cycle. It seems harder than many other graph problems. We are given a graph and we want to find a cycle visiting each vertex exactly once. The naive deterministic algorithm for the Hamil- tonian Cycle problem and the more general the Traveling Salesman problem runs in time O(n!) using polynomial space. Later, deterministic DP and inclusion-exclusion al- gorithms for these two problems running in time O∗(2n)1 using exponential space were given in [2,13,15]. The existence of a deterministic algorithm for Hamiltonian cycle run- ning in time O((2 − )n), for a fixed  > 0 is still an open problem. There are some randomized algorithms which run in time O((2− )n), for a fixed  > 0 like the one given in [4]. Although, there is no improvement in deterministic running time, there are some results on parametrized algorithms. In 2011, Cygan et al. [11] designed a parametrized algorithm for the Hamiltonian Cycle problem, which runs in time 4twV O(1). They also √ presented a randomized algorithm for planar graphs running in time O(26.366 n). In 2015, Bodlaender et al. [6] introduced two deterministic single exponential time algo- rithm for Hamiltonian Cycle: One based on pathwidth running in time O(6pwpwO(1)n2)2 and the other is based on treewidth running in time O(15twtwO(1)n2), where pw and tw are the pathwidth and the treewidth respectively. The authors also solve the Traveling Salesman problem in time O(n(2 + 2ω)pwpwO(1)) if a path decomposition of width pw of G is given, and in time O(n(7 + 2ω+1)twtwO(1)), where ω denotes the matrix multi- plication exponent. One of the best known upper bound for ω [21] is 2.3727. They do not consider the space complexity of their algorithm and as far as we checked it uses exponential space. Recently, Curticapean et al. [10] showed that there is no positive  such that the prob- lem of counting the number of Hamiltonian cycles can be solved in O∗((6 − )pw) time assuming SETH. Here pw is the width of the given path decomposition of the graph. They show this tight lower bound via matrix rank. 2 Preliminaries In this section we review notations that we use later. 1 O∗ notation hides the polynomial factors of the expression. 2 O notation hides the logarithmic factors of the expression. A Space-efficient Parametrized Algorithm for Hamiltonian Cycle by Dynamic Algebraization 3 2.1 Tree Decomposition A tree decomposition of a graph G = (V, E), of G is a tree T = (VT , ET ) such that each node x in VT is associated with a set Bx (called the bag of x) of vertices in G, and T has the following properties: -- The union of all bags is equal to V . In other words, for each v ∈ V , there exists at -- For every edge {u, v} ∈ E, there exists a node x such that u, v ∈ Bx. -- For any nodes x, y ∈ VT , and any node z ∈ VT belonging to the path connecting x least one node x ∈ VT with Bx containing v. and y in T , Bx ∩ By ⊆ Bz. The width of a tree decomposition is the size of its largest bag minus one. The treewidth of a graph G is the minimum width over all tree decompositions of G called tw(G). In the following, we use the letter k for the treewidth. Arnborg et al. [1] showed that constructing a tree decomposition with the minimum treewidth is an NP-hard problem but there are some approximation algorithms for finding near-optimal tree de- compositions [5, 7, 9]. In 1996, Bodlaender [5] introduced a linear time algorithm to find the minimum treewidth if the treewidth is bounded by a constant. To simplify many application algorithms, the notion of a nice tree decomposition has been introduced which has the following properties. The tree is rooted and every node in a nice tree decomposition has at most two children. Any node x in a nice tree decom- position τ is of one of the following types (let c be the only child of x or let c1 and c2 be the two children of x): -- Leaf node, a leaf of τ without any children. -- Forget node (forgetting vertex v), where v ∈ Bc and Bx = Bc \ {v}, -- Introduce vertex node (introducing vertex v), where v /∈ Bc and Bx = Bc ∪ {v} , -- Join node, where x has two children with the same bag as x, i.e. Bx = Bc1 = Bc2. We should mention that in some papers like [12], for the sake of simplicity an introduce edge node is defined which is not a part of the standard definition of the nice tree decomposition. Here introduce edge nodes are not needed and we can handle the problem easier without such nodes. In fact, we add edges to the bags as soon as the endpoints are introduced. It has been shown that any given tree decomposition can be converted to a nice tree decomposition with the same treewidth in polynomial time [14]. Definition 1. The depth of a tree decomposition is the maximum number of distinct vertices in the union of all bags on a path from the root to the leaf. We use d to denote the depth of a given tree decomposition. We have to mention that this is different from the depth of a tree. This is the depth of a tree decompisition as defined above. Definition 2. The tree-depth of a graph G, is the minimum over the depths of all tree decompositions of G. We use td to denote the tree-depth of a graph. After defining the treewidth and the tree-depth, now we have to talk about the relationship between these parameters in a given graph G: Lemma 1. (see [17, Corollary 2.5] and [8]) For any connected graph G, td(G) ≥ tw(G) + 1 ≥ td(G) log2 V (G) . 4 M. Belbasi, M. Furer Example: The path Pn with n vertices, has treewidth 1 and tree-depth of log2(n+1). One should note that finding the treewidth and the tree-depth of a given graph G are known to be an NP-hard problem. A question which arises here, is whether there exists a tree decomposition such that its width is the treewidth and its depth is the tree-depth of the original graph? In other words, is it possible to construct a tree decomposition of a given graph which minimizes both the depth and the width? If the answer is yes, how to gain such a tree decomposition. Although we are not focusing on this question here, but it seems an interesting problem to think about. 2.2 Algebraic tools to save space When we use dynamic programming to solve a graph problem on a tree decomposition, it usually uses exponential space. Lokshtanov and Nederlof converted some algorithms using subset convolution or union product into transformed version in order to reduce the space complexity. Later, Furer and Yu [12] also used this approach in a dynamic setting, based on tree decompositions for the Perfect Matching problem. In this work, we introduce algorithms to solve the Hamiltonian cycle and the Traveling Salesman prob- lems. First, let us recall some definitions. Let R[2V ] be the set of all functions from the power set of the universe V to the ring R. The operator ⊕ is the pointwise addition and the operator (cid:12) is the pointwise multipli- cation. Definition 3. A relaxation of a function f ∈ R[2V ] is a sequence of functions {f i : f i ∈ R[2V ], 0 ≤ i ≤ V}, where ∀ 0 ≤ i ≤ V and ∀X ⊆ V, f i[X] is defined as: 0 f i[X] = f [X] arbitrary value if i < X, if i = X, if i > X. Definition 4. The zeta transform of a function f ∈ R[2V ] is defined as: (1) (2) (3) ζf [X] = f [Y ]. (cid:88) Y ⊆X (cid:88) Y ⊆X Definition 5. The Mobius transform of a function f ∈ R[2V ] is defined as: µf [X] = (−1)X\Y f [Y ]. Lemma 2. The Mobius transform is the inversion of the zeta transform and vice versa, i.e. µ(ζf [X]) = ζ(µf [X]) = f [X]. (4) See [19, 20] for the proof. Instead of storing exponentially many intermediate results, we store the zeta transformed values. We can assume that instead of working on the original nice tree decomposition, we are working on a mirrored nice tree decomposition to which the zeta transform has been applied. We work on zeta transformed values and finally to recover the original values, we use Equation 4. The zeta transform converts the "hard" union product operation (∗u) to the "easier" pointwise multiplication operation ((cid:12)) which results in saving space. A Space-efficient Parametrized Algorithm for Hamiltonian Cycle by Dynamic Algebraization 5 Definition 6. Given f, g ∈ R[2V ] and X ∈ 2V , the Subset Convolution of f and g denoted (f ∗R g) is defined as: (f ∗R g)[X] = f (X1)g(X \ X1). (5) (cid:88) X1⊆X (cid:88) X1∪X2=X Definition 7. Given f, g ∈ R[2V ] and X ∈ 2V , the Union Product of f and g denoted (f ∗u g) is defined as: (f ∗u g)[X] = f (X1)g(X2). (6) Theorem 1. ( [3]) Applying the zeta transform to a union product operation, results in the pointwise multiplication of zeta transforms of the outputs, i.e., given f, g ∈ R[2V ] and X ∈ 2V , ζ(f ∗u g)[X] = (ζf ) (cid:12) (ζg)[X]. (7) All of the previous works which used either DFT or the zeta transform on a given tree decomposition (such as [12], and [16]), have one common central property that the recursion in the join nodes, can be presented by a formula using a union product operation. The union product and the subset convolution are complicated operations in comparison with pointwise multiplication or pointwise addition. That is why taking the zeta transform of a formula having union products makes the computation easier. As noted earlier in Theorem 1, taking the zeta transform of such a term, will result in a term having pointwise multiplication which is much easier to handle than the union product. After doing a computation over the zeta transformed values, we can apply the Mobius transform on the outcome to get the main result (based on Theorem 2). In other words, the direct computation has a mirror image using the zeta transforms of the intermediate values instead of the original ones. While the direct computation keeps track of exponentially many intermediate values, the computation over the zeta transformed values partitions into exponentially many branches, and they can be executed one after another. Later, we show that this approach improves the space complexity using only polynomial space instead of exponential space. 3 Counting the number of Hamiltonian cycles We are given a connected graph G = (V, E) and a nice tree decomposition τ of G of width w. If H is a Hamiltonian cycle, then the induced subgraph of H on τx (called H[Vx], where Vx is the union of all bags in τx) is a set of disjoint paths with endpoints in Bx (see Figure 1). Definition 8. A pseudo-edge is a pair of endpoints of a path of length ≥ 2 in H[Vx]. We use the (cid:104),(cid:105) notation for the pseudo-edges. E.g., in Figure 1, p = (cid:104)u, v(cid:105) is a pseudo-edge (it does not imply that there is an edge between u and v, it just says that there is a path of length at least two in H[Vx] where u and v are its endpoints). The (cid:104),(cid:105) notation is a symmetrical notation since our paths are undirected, i.e., (cid:104)u, v(cid:105) = (cid:104)v, u(cid:105). Each path is associated with a pseudo-edge. Lemma 3. The degree of all vertices in H[Vx] is at most 2. 6 M. Belbasi, M. Furer Fig. 1: H[Vx] is a set of paths with endpoints in Bx Proof. H[Vx] is a subgraph of the cycle H. Let Tx be the vertices contained in the bags associated with nodes in the subtree τx rooted at x which are not in Bx. Remember that vertices in pseudo-edges are vertices in Bx. Let X be the union of pseudo-edges (in Bx). Let [Bx]2 be the set of two-element subsets of Bx, and let X ⊆ [Bx]2. Let SX be the union of vertices involved in X. Then, SX is a subset of Bx. For any X, define YX to be the union of SX and Tx. Let Fx be the vertices of G which are introduced through Tx and are not present in the bag of the parent of x. Define fx[X] to be the number of sets of disjoint paths (except in their endpoints where they can share a vertex) whose pseudo-edge set is X (remember SX is the union of vertices involved in X) visiting vertices of Fx exactly once (it can also visit vertices which are not in Fx but we require them to visit at least vertices in Fx since they are not present in the proper ancestors of x). Computing fr[∅] gives us the number of possible Hamiltonian cycles in G. Now, we show how to compute the values of fx for all types of nodes. 3.1 Computing fx[X] In two rounds we will compute fx[X] efficiently. In the first round we will introduce the recursive formulas for any kind of nodes (when space usage is still exponential) and in the second round we will explain how to compute the zeta transformed values (in the next section, when the space usage drops to polynomial): -- Leaf node: Assume x is a leaf node. fx[X] = (cid:40) 1 0 if X = ∅, otherwise. (8) Since x is a leaf node, there is no path through Tx, so for all non-empty sets X of pseudo-edges, fx[X] is zero and for X = ∅, there is only one set of paths, which is empty. -- Forget node: Assume x is a forget node (forgetting vertex v) with a child c, where Bx = Bc \ {v}. Any pseudo-edge (cid:104)u, w(cid:105) ∈ X ⊆ [Bx]2 can define a path starting from u, going to v possibly through Tc and then going to w possibly through Tc. Here, either or both pieces of the path (from u to v, and/or from v to w) can consist of single edges. A Space-efficient Parametrized Algorithm for Hamiltonian Cycle by Dynamic Algebraization 7 (cid:88) (cid:88) (cid:104)u,w(cid:105)∈X Q⊆{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} fx[X] = Fig. 2: Forget node x forgetting vertex v with the child c. dQ fc[X \ {(cid:104)u, w(cid:105)} ∪ Q], (9) (cid:40) 1 0 where dQ = if (cid:104)u, v(cid:105) ∈ Q ∪ E and (cid:104)v, w(cid:105) ∈ Q ∪ E otherwise. -- Introduce vertex node: Assume x is an introduce vertex node (introducing vertex v) with a child c, where Bx = Bc ∪ {v}. The vertex v cannot be an endpoint of a pseudo-edge because paths have length at least two. (cid:40) fx[X] = fc[X] 0 if v /∈ SX , otherwise. (10) -- Join node: Assume x is a join node with two children c1 and c2, where Bx = Bc1 = Bc2. For any given X ⊆ Bx × Bx, X can be partitioned in two sets X(cid:48) and X \ X(cid:48) and each of them can be the set of pseudo-edges for one of the children. Fig. 3: Join node x with two chil- dren c1 and c2. The number of such paths associated with X through Tx is equal to the sum of the products of the number of corresponding paths associated with X(cid:48) and X \ X(cid:48) 8 M. Belbasi, M. Furer through Tc1 and Tc2 respectively. (cid:88) X(cid:48)⊆X fx[X] = fc1[X(cid:48)]fc2[X \ X(cid:48)] = (fc1 ∗R fc2)[X]. (11) Here we get subset convolution and we have to convert it to union product to be able to use zeta transfrom. We do this conversion in the next subsection. 3.2 Computing ζfx[X] In this subsection (the second round of computation), first we compute the relaxations of fx[X] for all kinds of nodes and then we apply the zeta transform to the relaxations. In the following section let {f i -- Leaf node: Assume x is a leaf node. Since fx[∅] = 1 and for any X (cid:54)= ∅ : fx[X] = 0, x}0≤i≤k be a relaxation of fx. we can choose f i x[X] = fx[X] for all i and X. Then (ζf i x)[X] = 1, for all i and X. (12) -- Forget node: Assume x is a forget node (forgetting vertex v) with a child c, where Bx = Bc \ {v}. Thus, (cid:88) (cid:88) f i x[X] = (cid:104)u,w(cid:105)∈X Q⊆{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} dQ f i(cid:48) c [X \ {(cid:104)u, w(cid:105)} ∪ Q], (13) where i(cid:48)(Q) = i−1+Q, i.e., i(cid:48)(Q) is the number of pseudo-edges in X \{(cid:104)u, w(cid:105)}∪Q. Now we apply zeta transform: (ζf i x)[X] = f i x[Y ] (cid:88) (cid:88) Y ⊆X (cid:88) (cid:104)u,w(cid:105)∈Y Q⊆{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} Y ⊆X (cid:88) (cid:88) (cid:88) = = = (cid:88) (cid:88) (cid:104)u,w(cid:105)∈X Q⊆{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} {(cid:104)u,w(cid:105)}⊆Y ⊆X dQ Q⊆{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} Y ⊆(X\{(cid:104)u,w(cid:105)}) dQ f i(cid:48)(Q) c [Y \ {(cid:104)u, w(cid:105)} ∪ Q] dQ f i(cid:48)(Q) c [Y \ {(cid:104)u, w(cid:105)} ∪ Q] (cid:88) (cid:88) f i(cid:48)(Q) c [Y ∪ Q] (14) Y ⊆(X\{(cid:104)u,w(cid:105)}) f i(cid:48)(Q) c [Y ∪ Q] by ζ-transforms, depending on (cid:104)u,w(cid:105)∈X We now express EQ =(cid:80) the size of Q. We use the abbreviation X(cid:48) = X \ {(cid:104)u, w(cid:105)} If Q = ∅, then (cid:88) EQ = f i−1 [Y ] = ζf i−1[X(cid:48)]. c Y ⊆X(cid:48) If Q = {(cid:104)u, v(cid:105)} or Q = {(cid:104)v, w(cid:105)}, then (cid:88) Y ⊆X(cid:48) EQ = c[Y ∪ Q] = ζf i f i c[X(cid:48) ∪ Q] − ζf i c[X(cid:48)]. (15) (16) A Space-efficient Parametrized Algorithm for Hamiltonian Cycle by Dynamic Algebraization 9 If Q = {(cid:104)u, v(cid:105),(cid:104)v, w(cid:105)}, then (cid:88) EQ = Y ⊆X(cid:48) = ζf i+1 c [Y ∪ Q] f i+1 c [X(cid:48) ∪ Q] − ζf i+1 c − ζf i+1 [X(cid:48) ∪ {(cid:104)v, w(cid:105)}] + ζf i+1 c [X(cid:48) ∪ {(cid:104)u, v(cid:105)}] [X(cid:48)]. c (17) With these sums computed, we can now express ζf i (cid:88) (ζf i x)[X] = x)[X] more concisely. ((d∅ − d{(cid:104)u,v(cid:105)} − d{(cid:104)v,w(cid:105)} + d{(cid:104)u,v(cid:105)},{(cid:104)v,w(cid:105)}) ζf i−1 c[X(cid:48) ∪ {(cid:104)v, w(cid:105)}] c[X(cid:48) ∪ {(cid:104)u, v(cid:105)}] + d{(cid:104)v,w(cid:105)} ζf i [X(cid:48) ∪ {(cid:104)u, v(cid:105),(cid:104)v, w(cid:105)}]). (cid:104)u,w(cid:105)∈X +d{(cid:104)u,v(cid:105)} ζf i +d{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} ζf i+1 c [X(cid:48)] c (18) Note that d∅ = 1 if {(cid:104)u, v(cid:105),(cid:104)v, w(cid:105)} ⊆ E, d{(cid:104)u,v(cid:105)} = 1 if (cid:104)v, w(cid:105) ∈ E, d{(cid:104)v,w(cid:105)} = 1 if (cid:104)u, v(cid:105) ∈ E, and d{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} is always 1, while otherwise dQ = 0. This implies that for every (cid:104)u, w(cid:105) in the previous equation at least one of the 4 coefficients is 0. Therefore, in each forget node, we have at most a 3X fold branching. -- Introduce vertex node: Assume x is an introduce vertex node (introducing vertex v) with a child c, where Bx = Bc ∪ {v}. Let Xv be the set of pseudo-edges having v as one their endpoints. Therefore, (cid:40) f i x[X] = (cid:88) Y ⊆X (ζf i x)[X] = f i x[Y ] = if v /∈ SX , otherwise. f i c[X] 0 (cid:88) Y ⊆(X\Xv) f i c[Y ] = (ζf i c)[X \ Xv]. (19) (20) i(cid:88) -- Join node: Assume x is a join node with two children c1 and c2, where Bx = Bc1 = Bc2. To compute fx on a join node, we can use Equation 11. In order to convert the subset convolution operation to pointwise multiplication, first we need to convert the subset convolution to union product and then we are able to use Theorem 1. To convert subset convolution to union product we introduce a relaxation of fx. Let f i x[X] =(cid:80)i c2 )[X] be a relaxation of fx. c1 ∗u f i−j j=0(f j (ζf i x)[X] = (ζf j c1)[X] · (ζf i−j c2 )[X], for 0 ≤ i ≤ w, (21) where w is the treewidth of τ . j=0 To summerize, we present the following algorithm for the Hamiltonian Cycle problem where a tree decomposition τ is given. Theorem 2. Given a graph G = (V, E) and a tree decomposition τ of G, we can compute the total number of the Hamiltonian Cycles of G in time O((4w)dnM (n log n)) and in space O(wdn log n) by using Algorithm 1, where w and d are the width and the depth of τ respectively, and M (n) is the time complexity to multiply two numbers which can be encoded by at most n bits. Proof can be found in appendix. 10 M. Belbasi, M. Furer Algorithm 1: Counting the total number of the possible Hamiltonian cycles in a graph given by a nice tree decomposition Input return procedure (ζf )(x, X, i): //(ζf )(x, X, i) is the representation of (ζf i : A nice tree decompoisition τ with root r : (ζf )(r,∅, 0) r [∅]. //f 0 x)[X] if x is a leaf node: return 1. if x is a forget node: //forgetting v return the value according to Equation 18. if x is an introduce vertex node: //introducing v return (ζf )(c, X \ Xv, i). j=0(ζf )(c1, X, j) · (ζf )(c2, X, i − j). if x is a join node: return(cid:80)i end procedure 4 The traveling Salesman problem In the previous section, we showed how to count the total number of possible Hamil- tonian cycles of a given graph. In this section, we discuss a harder problem. We know that the Hamiltonian Cycle problem is reducible to the traveling Salesman problem by setting all cost of edges to be 1. We could have just explained how to solve Traveling Salesman problem but we chose to first explain the easier one to help understanding the process. Now, we have most of the notations. First, we recap the formal definition of the traveling Salesman problem. Definition 9. Traveling Salesman. Given an undirected graph G = (V, E) with weighted edges, where for all {u, v} ∈ E, cu,v is the weight (= cost) of {u, v} (nonnegative inte- ger). In the traveling Salesman problem we are asked to find a cycle (if there is any) that visits all of the vertices exactly once (it is a Hamiltonian cycle) with minimum cost. As mentioned, the output should be a minimum cost Hamiltonian cycle. We have the same notations as before. Thus, we are ready to explain our algorithmic framework: The difference between counting the number of Hamiltonian cycles and finding the min- imum cost of a Hamiltonian cycle (answer to the Traveling salesman problem), is that we should work with lengths instead of the numbers of solutions. In order to solve this problem, we work with the ring of polynomials Z[x], where x is a variable. Our algo- i [X] is the number of solutions in τx associated with X with cost i, and W is the sum of the weights of all edges. The edge lengths have to be nonnegative integers as mentioned above. rithm computes the polynomial Px(y)[X] =(cid:80)W i [X]yi, where ax i=0 ax 4.1 Computing the Hamiltonian Cycles of All Costs To find the answer to the traveling salesman problem, we have find the first nonzero coefficient of Pr(x), where r is the root of the given nice tree decomposition. As we did for the Hamiltonian cycle problem, we show how compute this polynomial recursively for all kinds of node. A Space-efficient Parametrized Algorithm for Hamiltonian Cycle by Dynamic Algebraization 11 -- Leaf node: Assume x is a leaf node. Since we require leaf nodes to have empty bags, then Px(y)[X] = if X = ∅, otherwise. (22) (cid:40) 1 0 -- Forget node: Assume x is a forget node (forgetting vertex v) with a child c, where Bx = Bc \ {v}. (cid:88) (cid:88) (cid:40) Px(y)[X] = (cid:104)u,w(cid:105)∈X Q⊆{(cid:104)u,v(cid:105),(cid:104)v,w(cid:105)} dQ(Pc(y))[X \ {(cid:104)u, w(cid:105)} ∪ Q], (23) (cid:40) 1 0 where dQ = if (cid:104)u, v(cid:105) ∈ Q ∪ E and (cid:104)v, w(cid:105) ∈ Q ∪ E otherwise. -- Introduce vertex node: Assume x is an introduce vertex node (introducing vertex v) with a child c, where Bx = Bc ∪ {v}. Px(y)[X] = Pc(y)[X] 0 if v /∈ SX , otherwise. (24) -- Join node: Assume x is a join node with two children c1 and c2, where Bx = Bc1 = Bc2. fx[X] = Pc1(y)[X(cid:48)]Pc2(y)[X \ X(cid:48)]. (25) (cid:88) X(cid:48)⊆X We skip the zeta transform part because it is similar to the Hamiltonian Cycle case. Theorem 3. Given a graph G = (V, E) and a tree decomposition τ of G, we can solve the Traveling Salesman problem for G in time O(4w)d · poly(n) and in space O(Wdwn log n) where W is the sum of the weights, w and d are the width and the depth of the tree decomposition τ respectively. You can find the proof in appendix. 4.2 Conclusion In this work, we solved Hamiltonian Cycle and Traveling Salesman problems with poly- nomial space complexity where the running time is polynomial in size of the given graph and exponential in tree-depth. Our algorithms for both problems rely on modifying a DP approach such that instead of storing all possible intermediate values, we keep track of zeta transformed values which was first introduced in [16], and then in [12] for dynamic underlying sets. References 1. Stefan Arnborg, Jens Lagergren, and Detlef Seese, Problems easy for tree-decomposable graphs ex- tended abstract, International Colloquium on Automata, Languages, and Programming, Springer, 1988, pp. 38 -- 51. 2. Richard Bellman, Dynamic programming treatment of the travelling salesman problem, Journal of the ACM (JACM) 9 (1962), no. 1, 61 -- 63. 3. Andreas Bjorklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto, Fourier meets Mobius: fast subset convolution, Proceedings of the thirty-ninth annual ACM symposium on Theory of computing, ACM, 2007, pp. 67 -- 74. 12 M. Belbasi, M. Furer 4. Andreas Bjorklund, Petteri Kaski, and Ioannis Koutis, Directed Hamiltonicity and out-branchings via generalized Laplacians, 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, 2017, pp. 91:1 -- 91:14. 5. Hans L Bodlaender, A linear-time algorithm for finding tree-decompositions of small treewidth, SIAM Journal on computing 25 (1996), no. 6, 1305 -- 1317. 6. Hans L Bodlaender, Marek Cygan, Stefan Kratsch, and Jesper Nederlof, Deterministic single ex- ponential time algorithms for connectivity problems parameterized by treewidth, Information and Computation 243 (2015), 86 -- 111. 7. Hans L Bodlaender, John R Gilbert, Hj´almt`yr Hafsteinsson, and Ton Kloks, Approximating treewidth, pathwidth, and minimum elimination tree height, International Workshop on Graph- Theoretic Concepts in Computer Science, Springer, 1991, pp. 1 -- 12. 8. Hans L Bodlaender, John R Gilbert, Hj´almtyr Hafsteinsson, and Ton Kloks, Approximating treewidth, pathwidth, frontsize, and shortest elimination tree, Journal of Algorithms 18 (1995), no. 2, 238 -- 255. 9. Vincent Bouchitt´e, Dieter Kratsch, Haiko Muller, and Ioan Todinca, On treewidth approximations, Discrete Applied Mathematics 136 (2004), no. 2-3, 183 -- 196. 10. Radu Curticapean, Nathan Lindzey, and Jesper Nederlof, A tight lower bound for counting hamilto- nian cycles via matrix rank, Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, Society for Industrial and Applied Mathematics, 2018, pp. 1080 -- 1099. 11. Marek Cygan, Jesper Nederlof, Marcin Pilipczuk, Michal Pilipczuk, Joham MM van Rooij, and Jakub Onufry Wojtaszczyk, Solving connectivity problems parameterized by treewidth in single ex- ponential time, Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Symposium on, IEEE, 2011, pp. 150 -- 159. 12. Martin Furer and Huiwen Yu, Space saving by dynamic algebraization based on tree-depth, Theory of Computing Systems 61 (2017), no. 2, 283 -- 304. 13. Richard M Karp, Dynamic programming meets the principle of inclusion and exclusion, Operations Research Letters 1 (1982), no. 2, 49 -- 51. 14. Joachim Kneis, Daniel Molle, Stefan Richter, and Peter Rossmanith, A bound on the pathwidth of sparse graphs with applications to exact algorithms, SIAM Journal on Discrete Mathematics 23 (2009), no. 1, 407 -- 427. 15. Samuel Kohn, Allan Gottlieb, and Meryle Kohn, A generating function approach to the traveling salesman problem, Proceedings of the 1977 annual conference, ACM, 1977, pp. 294 -- 300. 16. Daniel Lokshtanov and Jesper Nederlof, Saving space by algebraization, Proceedings of the forty- second ACM symposium on Theory of computing, ACM, 2010, pp. 321 -- 330. 17. Jaroslav Nesetril and Patrice Ossona De Mendez, Tree-depth, subgraph coloring and homomorphism bounds, European Journal of Combinatorics 27 (2006), no. 6, 1022 -- 1041. 18. Micha(cid:32)l Pilipczuk and Marcin Wrochna, On space efficiency of algorithms working on structural decompositions of graphs, ACM Transactions on Computation Theory (TOCT) 9 (2018), no. 4, 18:1 -- 18:36. 19. Gian-Carlo Rota, On the foundations of combinatorial theory, I. Theory of Mobius functions, Zeitschrift fur Wahrscheinlichkeitstheorie und verwandte Gebiete 2 (1964), no. 4, 340 -- 368. 20. Richard P Stanley, Enumerative combinatorics. vol. 1, with a foreword by Gian-Carlo Rota. corrected reprint of the 1986 original, Cambridge Studies in Advanced Mathematics 49 (1997). 21. Virginia Vassilevska Williams, Multiplying matrices faster than Coppersmith-Winograd, Proceedings of the Forty-fourth Annual ACM Symposium on Theory of Computing (New York, NY, USA), STOC '12, ACM, 2012, pp. 887 -- 898. A Space-efficient Parametrized Algorithm for Hamiltonian Cycle by Dynamic Algebraization 13 A Appendix Here is the proof of Theorem 2. Proof. The correctness of the algorithm is shown in Section 3.1 and Section 3.2. Now, we show the running time and the space complexity of our algorithm. Running time: The only case that branching happens in where we are handling a forget node. We have at most w branches in forget nodes since the number of pseudo-edges in each bag is bounded by w + 1 because of Lemma 3. Furthermore, based on the formula for forget node, the two unordered pairs of (u, v) and (v, w) can contribute as an edge or a pseudo-edge (four possible cases). On the other hand the number of forget nodes in a path from the root to one leaf is bounded by the d (the depth of tree decomposition τ ). Also, the number of vertices is n and we work with numbers of size at most n! (number of paths) which can be represented by at most n log n bits. We handle multiplication of these numbers which happens in O(M (n log n)). All being said, the total running time is O((4w)dnM (n log n)). Space complexity: We keep the results for each strand at a time. The number of nodes in a path from the root to a leaf is bounded by the depth of the tree decomposition (d). Along the path, we keep track of bags (of size w) and number of disjoint paths (at most n! paths exist which can be shown by at most n log n bits). Therefore, the total space complexity is O(wdn log n). And here is the proof of Theorem 3. Proof. The correctness of the algorithm is shown in Section 3.1 and Section 3.2. Now, we show the running time and the space complexity of our algorithm. Running time: The running time analysis is very similar to the analysis done for Hamil- tonian Cycle. Space complexity: The space complexity analysis is also similar to the analysis done for Hamiltonian Cycle except here we have to keep track of the sum of the wights which at most is W. So there is a factor of W in the space complexity here.
1012.2202
2
1012
2010-12-13T08:22:20
Transforming a random graph drawing into a Lombardi drawing
[ "cs.DS" ]
The visualization of any graph plays important role in various aspects, such as graph drawing software. Complex systems (like large databases or networks) that have a graph structure should be properly visualized in order to avoid obfuscation. One way to provide an aesthetic improvement to a graph visualization is to apply a force-directed drawing algorithm to it. This method, that emerged in the 60's views graphs as spring systems that exert forces (repulsive or attractive) to the nodes. A Lombardi drawing of a graph is a drawing where the edges are drawn as circular arcs (straight edges are considered circular arcs of infinite radius) with perfect angular resolution. This means, that consecutive edges around a vertex are equally spaced around it. In other words, each angle between the tangents of two consecutive edges is equal to $2\pi/d$ where d is the degree of that specific vertex. The requirement of using circular edges in graphs when we want to provide perfect angular resolution is necessary, since even cycle graphs cannot be drawn with straight edges when perfect angular resolution is needed. In this survey, we provide an algorithm that takes as input a random drawing of a graph and provides its Lombardi drawing, giving a proper visualization of the graph.
cs.DS
cs
1 Transforming a random graph drawing into a Lombardi drawing Nicolaos Matsakis1 1 Department of Information and Computer Science, UC Irvine, CA, USA ∗ E-mail: [email protected] Abstract The visualization of any graph plays important role in various aspects, such as graph drawing software. Complex systems (like large databases or networks) that have a graph structure should be properly visualized in order to avoid obfuscation. One way to provide an aesthetic improvement to a graph visualization is to apply a force-directed drawing algorithm to it. This method, that emerged in the 60's views graphs as spring systems that exert forces (repulsive or attractive) to the nodes. The first force-directed drawing algorithm of Tutte [1] was aiming at providing a barycentric representation of the graph and it is suitable for getting a straight-line drawing of 3-connected planar graphs without crossings. Each vertex is gradually placed at the berycenter of its neighbour vertices. This method used no spring systems, though it can be easily understood that springs can be applied to the system getting the same result as that of the barycentric method. Unfortunately, Tutte's method usually gives bad angular resolutions. Many other force-directed methods have appeared since then. Eades' method [2] creates 2D layouts using spring systems and it is suitable for graphs with less than 30 nodes. Attractive forces are applied to adjacent vertices only and repulsive to all pairs of vertices (so we can view the edges as springs with zero rest length and the nodes as electrically charged identical particles). Of course, the exact type of the forces exerted is a very important aesthetic criterion. Eades sets logarithmic attractive forces and inverse square root repulsive forces. Fruchterman and Reingold [3] apply the notion of simulated annealing, in order to provide an even better 2D layout of less cumulative spring energy, compared to that of Eades. The main disadvantage is, again, that the algorithm is limited to graphs having less than 40 vertices. Hadany and Harel [4] provide a force-directed layout for much larger graphs of over 1000 vertices. In order to obtain that, they follow a multi-scale approach where they initially consider an abstraction of the graph, which is iteratively augmented by the graph details. Gajer, Goodrich and Kobourov [5] use a coarsening strategy which avoids quadratic space and time complexities. They use a vertex filtration which enables the algorithm to restrict the number of vertices relocated. They, also, introduce the idea of realizing the graph in high-dimensional Euclidean space. An excellent survey on various force-directed methods can be found in [6]. A Lombardi drawing of a graph is a drawing where the edges are drawn as circular arcs (straight edges are considered degenerate circular ones) with perfect angular resolution. This means, that consecutive edges around a vertex are equally spaced around it. In other words, each angle1 between the tangents of two consecutive edges is equal to 2π/d where d is the degree of that specific vertex. This kind of drawing took its name from the American artist Mark Lombardi, who mainly used this technique in his paintings. The requirement of using circular edges in graphs when we want to provide perfect angular resolution is necessary, since even cycle graphs cannot be drawn with straight edges when perfect angular resolution is needed. In this survey, we provide an algorithm that takes as input a random drawing of a graph and provides its Lombardi drawing. 1 every angle in this survey will be expressed in rads 2 Figure 1. The spring forces on the central vertex due to the connection with the 4 circular edges-springs, form a cumulative force equal to the sum of the spring forces of 4 straight spring-edges (dotted lines), each one having the same length as that of its respective circular arc. In the specific example, however, we can easily see that the cumulative force on the central vertex is not zero, something which means that our algorithm will move the central vertex to a position where P4 i=1 → Fi= 0 1 Lombardi Graphs We will use the spring-force layout of a graph. A very important property of a single vertex which is connected to a number of d vertices by circular edges is that, if the edges are regarded as circular springs, the total spring force exterted on the central vertex will be equal to the one exerted on it if the circular springs are replaced by straight ones, each one having the same length as the respective circular arc and a direction onto the tangent of each respective circular edge (as in figure 1). The reason behind this, is that each force is exerted instantly on the direction of each tangent. In figure 1 there is an example of a node having degree equal to 4. Whether we take the 4 circular edges or the 4 straight ones (of equal corresponding length) under account, the instant result on the move of the central vertex will be the same. We will use this relation extensively while forming the angular resolution around a vertex. Our procedure actually uses, initially, an already known force-directed method and, afterwards, starts fixing the angular resolution around each vertex of the current drawing. The target is to obtain a drawing with the least cumulative spring energy, which will, also, have perfect angular resolution. The type of force-directed method initially applied, depends on the number of nodes of G. Let's assume that this is not great enough (at most 40 vertices), so we can apply the barycentric method of Tutte. However, there are methods, as predescribed, for much greater numbers of nodes. After applying the barycentric method, we order the nodes of the graph according to a descending order of degree. We start by picking the first vertex in the order and choosing its neighbour vertex that is farthest away in straight distance from it2 (for example we pick vertex b in figure 2). We erase the current edge (circular or straight) between them and connect them with a straight edge (so in a case of a previous straight edge connection, we do not change anything). We continue in a clockwise order to the next adjacent edge (that is c in the example), which we erase and connect the 2 corresponding vertices (the central and its neighbour vertex) with a circular edge which has angle 2π/d with the previously formed edge 2the reason behind this is that the minimum total energy that we want to achieve forces us to connect initially the 2 farthest points in plane with a straight edge; any other edge gives greater length and this means greater energy 3 b a e c d Figure 2. The central vertex a has degree 4, so starting with neighbour vertex b and continuing in clockwise order, we arrange each new circular edge having angle equal to π/2 with the exactly previous one, until we reach again b where we stop. Bold (straight) edges refer to the previous edge visualization. (in anticlockwise order and we obviously refer to angles between tangents in the position of the central vertex). This is totally valid since any two points in plane can be connected with one circular arc, if we specify a tangent passing through one of them. We continue doing this procedure, creating equal angles between tangents, until we reach the very first edge, where we stop. It is obvious, now, that the Lombardi property has been applied on the central examined vertex. However, the zero cumulative spring force has been lost because the spring forces have changed, in both the direction and the length of the springs. So, we must fix that, by finding the expression of a spring force on a vertex when the spring is circular. Here is where the first observation is used. We must bring the central vertex to the position of zero cumulative spring force, leaving stable its neighbour vertices. So, our target is to minimize the energy of the spring system of this examined central vertex which is connected to d vertices under the invariance of the Lombardi property, which means that we are not allowed to alter the angles between the tangents of the edges and the x-axis, formed in the plane. In i=1 ti, where ti is the arc length of the i-th adjacent edge (starting from the one we beginned with in the previous step and continuing in clockwise order3). When we accomplice that and move the position of the central vertex to a position of mimimum total spring energy, we continue with the rest of the vertices in the descending order and then we repeat the whole algorithm from the beginning several times to gain convergence. The number of times may vary for each drawing, so we can just calculate the difference in the co-ordinates of every vertex between each 2 repetitions of the algorithm and stop where we have reached the desired accuracy, for each one of the vertices. other words we seek to minimize the sum of the circular springs' lengths which equals Pd 3so in our example t1 is the circular edge (straight edges are regarded as circular arcs of infinite radius) connecting a with vertex b 4 t x Figure 3. For any given arc length t, the corresponding chord length obeys the relation x = t ∗ sin(θ)/θ where θ > 0 is the angle between x and the tangent of the arc in the intersection point between the chord and the arc. 2 The Algorithm A basic trigonometric relation is that the length of a chord x is equal to x = t ∗ sin(θ)/θ (1) where t is the length of the arc that is defined between the 2 points of the chord and π/2 ≥ θ > 0 is the angle between the chord x and the tangent at any of the 2 intersection points of the defined cycle and the chord, as we can see in Figure 3. The Euclidean distance between any points (p1, p2) in plane (where p1 = (x1, y1), p2 = (x2, y2)) is given by the relation Since we seek minimization of the sum of arc lengths, while keeping the Lombardi property, we want D(p1, p2) = p(x1 − x2)2 + (y1 − y2)2 (2) to minimize the quantity d Xi=1 xi ∗ θi/sin(θi) (3) where xi refers to the distance between the central vertex and the i-th neighbour vertex (assuming a clockwise enumeration as indicated before from i = 1 to d) and θi is the angle between the tangent of a circular edge connecting the central vertex with the i-th vertex neighbour of it and the straight distance between the central vertex and the currently examined neighbour of it (0 < θ ≤ π/2). In order to avoid obfuscation with the co-ordinates we will refer to the distance xi as D from now on, associated with each specific central examined vertex. From (2),(3) we get: minx0,y0 d Xi=1 θi ∗p(xi − xo)2 + (yi − yo)2/sin(θi) (4) The Lombardi property of equally spaced tangents on arc edges must be preserved while moving the central vertex on plane. In other words, we move the central vertex trying to obtain Pd F i refers to the spring force exerted between the central vertex and the i-th neighbour vertex of it, assuming zero rest length on each spring. i=1 → → Fi= 0 where However, sin(θi) is equal to the distance between the i-th neighbour node's (stable) position and the tangent of the specific arc (see figure 4) divided by the new Euclidean distance between the 2 ver- tices (new position of central vertex and the stable position of its neighbour vertex) which is equal to 5 Figure 4. The central vertex is moved around trying to minimize the total cimulative spring force exterted on it and preserving the Lombardi property. Here we can see the central vertex moving to a new position along with one of its neighbours which stays stable. Of course the previous edge may have also been circular and not straight as here, which means that we should have used its tangent. Figure 5. The distance between point (xa, ya) and to the straight line defined on the line segment connecting points (x0, y0) and (xb, yb). ′ 0, y ′ p(xi − xo)2 + (yi − yo)2, where the co-ordinates (xo, yo) refer to the new position of the central vertex. 0). In order to avoid complicated equations we Assume that the central node's initial position is (x think of the tangent of the first formed edge as tantamount to the semiaxis Ox and since we preserve the Lombardi property while moving around the central vertex, all the tangents keep the same ordering in plane (e.g. each one moves in parallel to its previous arrangement). This fact helps us constructing the arrangement of the d tangents if we set the first one onto semiaxis Ox where we think of the new position of the central vertex on (0,0). Therefore, we obtain y = 0 for the first tangent{footnotewhich we call initial from now on, refering to each specific central examined vertex, y = tan(−(i−1)∗2π/d)x = tan(−2∗π/d)x for the second one (by setting i = 2) and so on, until we get to the d-th tangent. The only thing remaining is to identify the distance between each tangent and the corresponding neighbour vertex. In general, the distance between a straight line (identified by 2 points) and a point in plane, is given by the following equation, where the co-ordinates refer to figure 5: D = (xb − x0)(y0 − ya) − (x0 − xa)(yb − y0) In our case and since we define each tangent on a semiaxis starting at point (0,0) we surely know point p(xb − x0)2 + (yb − y0)2 (5) (x0, y0). Point (xa, ya) is the actual neighbour vertex i correlated with the specific tangent and point (xb, yb) can be obtained by setting xb = 1 and using the tangent form (yb/xb) = tan(−(i − 1) ∗ 2π/d) for the specific i, to obtain yb. The overall distance between the central node's new position and the i-th neighbour node's (stable) position is, then: 6 Using (6), we get for the sin(θi): D = − yi + xi ∗ tan(−(i − 1) ∗ 2π/d) p1 + tan2((i − 1)2π/d) sin(θi) = D p(xi − x0)2 + (yi − y0)2 Replacing (7) into (4), we take a relation solely depending on the central node's and i-th neighbour's coordinates. The sum of it, according to all neighbour vertices, can be minimized, moving the central vertex to a position of minimum total energy: (6) (7) (8) ) (9) minx0,y0 d Xi=1 D ∗ arcsin( √(xi−x0)2+(yi−y0)2 ) D √(xi−x0)2+(yi−y0)2 D which is equal to minx0,y0 d Xi=1 [(xi − x0)2 + (yi − y0)2] ∗ arcsin( D p(xi − x0)2 + (yi − y0)2 We note that D is defined in (6) and that there is no problem with the range of values of the arcsine function since 0 < θ ≤ π/2. After altering the position of the central vertex and moving it to a balancing position, we apply the exact same procedure on the next vertex of the descending order and so on until we reach the V -th vertex in the order. There, we have to repeat the whole procedure from the beginning since the positions of the vertices should have changed, as many times as it needs for convergence under a desired accuracy. Finally, we must note that each repetition of the algorithm on a different central vertex should be coming along a rotation of the Cartesian coordinates in order to place the straight distance between the old position of the central vertex and the farthest edge onto semiaxis 0x, as we have described before. So, each time we switch to another central vertex in the descending order we should place the first tangent onto the new 0x semiaxis by multiplying the coefficients of all tangents (the first point needed to describe them is always (0,0) regarding all of them which is not rotated obviously, so we only apply the transformation on each second point) by (cid:18) cos(φ) −sin(φ) cos(φ) (cid:19) sin(φ) which corresponds to the clockwise rotation matrix of the 2-dimensional Cartesian coordinates, where angle φ is the angle between the 2 semiaxes (intersected at (0,0) of the two initial tangents of any 2 consecutive examined central vertices). The pseudocode follows: repeat Apply a barycentric method to G=(V,E) Arrange the vertices of the graph according to descending order of degree; Let v = V and vi be the ordering; 7 //start fixing tangents //there are no tangents in the beginning; these are formed in the first iteration of the FOR procedure //and their direction stays unaltered unless we unmark them. for i = 1 to v do Find the neighbour vertex of vi which is farthest away in straight distance from it; Delete current edge between them and connect them with a straight edge, marking it with a tangent intersecting the central vertex; Change (Rotate) Cartesian co-ordinates in order to place this (initial) tangent onto semiaxis Ox; Get the next edge of the central vertex in clockwise order; start applying the Lombardi property around the central vertex for j = 1 to d-1 do Delete current edge between vi and j and connect them with a circular edge having angle 2jπ/d with the initial tangent; Mark the tangent on this circular edge intersecting the central vertex; j ← j + 1 end for Move the central vertex to a position of zero cumulative force on it according to equation (8) by not altering the directions of marked tangents in plane; When the position of the central vertex gives zero cumulative force according to (8), set i ← i + 1 and unmark all tangents; end for until the difference on the co-ordinates of each vertex converges 3 Conclusions We have sketched an algorithm for creating a Lombardi drawing of a graph, given a random drawing of the graph. However, the algorithm's convergence remains to be tested for various numbers of graph nodes, since force-directed methods, in general, experience different convergence attitudes, which are highly correlated with the number of nodes of the graphs they are applied on. Especially in our case, graphs with very high degrees on vertices should be checked for appropriate convergence. References 1. Tutte WT (1963) How to draw a graph. Proceedings London Mathematical Society 13: 743 -- 768. 2. Eades P (1984) A heuristic for graph drawing. Congressus Numerantium : 149-160. 3. Fruchterman TMJ, Reingold EM (1991) Graph drawing by force-directed placement. Softw, Pract Exper 21: 1129-1164. 4. Hadany R, Harel D (1999) A multi-scale algorithm for drawing graphs nicely. WG : 262-277. 5. Gajer P, Goodrich MT, Kobourov SG (2004) A multi-dimensional approach to force-directed layouts of large graphs. Comput Geom 29: 3-18. 6. Tamassia R (2010) Handbook of Graph Drawing and Visualization, Chapman Hall/CRC.
1807.00121
1
1807
2018-06-30T03:40:50
An optimal algorithm for 2-bounded delay buffer management with lookahead
[ "cs.DS" ]
The bounded delay buffer management problem, which was proposed by Kesselman et~al.\ (STOC 2001 and SIAM Journal on Computing 33(3), 2004), is an online problem focusing on buffer management of a switch supporting Quality of Service (QoS). The problem definition is as follows: Packets arrive to a buffer over time and each packet is specified by the {\em release time}, {\em deadline} and {\em value}. An algorithm can transmit at most one packet from the buffer at each integer time and can gain its value as the {\em profit} if transmitting a packet by its deadline after its release time. The objective of this problem is to maximize the gained profit. We say that an instance of the problem is $s$-bounded if for any packet, an algorithm has at most $s$ chances to transmit it. For any $s \geq 2$, Hajek (CISS 2001) showed that the competitive ratio of any deterministic algorithm is at least $(1 + \sqrt{5})/2 \approx 1.619$. It is conjectured that there exists an algorithm whose competitive ratio matching this lower bound for any $s$. However, it has not been shown yet. Then, when $s = 2$, B{\"o}hm et al.~(ISAAC 2016) introduced the {\em lookahead} ability to an online algorithm, that is the algorithm can gain information about future arriving packets, and showed that the algorithm achieves the competitive ratio of $(-1 + \sqrt{13})/2 \approx 1.303$. Also, they showed that the competitive ratio of any deterministic algorithm is at least $(1 + \sqrt{17})/4 \approx 1.281$. In this paper, for the 2-bounded model with lookahead, we design an algorithm with a matching competitive ratio of $(1 + \sqrt{17})/4$.
cs.DS
cs
An optimal algorithm for 2-bounded delay buffer management with lookahead Koji M. Kobayashi Abstract The bounded delay buffer management problem, which was proposed by Kesselman et al. (STOC 2001 and SIAM Journal on Computing 33(3), 2004), is an online problem focusing on buffer management of a switch supporting Quality of Service (QoS). The problem definition is as follows: Packets arrive to a buffer over time and each packet is specified by the release time, deadline and value. An algorithm can transmit at most one packet from the buffer at each integer time and can gain its value as the profit if transmitting a packet by its deadline after its release time. The objective of this problem is to maximize the gained profit. We say that an instance of the problem is s-bounded if for any packet, an algorithm has at most s chances to transmit it. For any s ≥ 2, Hajek (CISS 2001) showed that the competitive ratio of any deterministic algorithm is at least (1 + √5)/2 ≈ 1.619. It is conjectured that there exists an algorithm whose competitive ratio matching this lower bound for any s. However, it has not been shown yet. Then, when s = 2, Bohm et al. (ISAAC 2016) introduced the lookahead ability to an online algorithm, that is the algorithm can gain information about future arriving packets, and showed that the algorithm achieves the competitive ratio of (−1 + √13)/2 ≈ 1.303. Also, they showed that the competitive ratio of any deterministic algorithm is at least (1 + √17)/4 ≈ 1.281. matching competitive ratio of (1 + √17)/4. In this paper, for the 2-bounded model with lookahead, we design an algorithm with a 1 Introduction The online buffer management problem proposed by Aiello et al. [1] formulates the management of buffers to store arriving packets in a network switch with Quality of Service (QoS) support as an online problem. This problem has received much attention among online problems and has been studied for the last fifteen years, which leads to developing various variants of this problem (see comprehensive surveys [16, 28]). Kesselman et al. [23] proposed the bounded delay buffer management problem as one of the variants, whose definition is as follows: Packets arrive to a buffer over time. A packet p is specified by the release time r(p), value v(p) and deadline d(p). An algorithm is allowed to transfer at most one packet at each integer time. If the algorithm transmits a packet between its release time and deadline, it can gain its value as the profit. The objective of this problem is to maximize the gained profit. The performance of an online algorithm for this problem is evaluated using competitive analysis [11, 29]. If for any problem instance, the profit of an optimal offline algorithm OP T is at most c times that of an online algorithm A, then we say that the competitive ratio of A is at most c. We call a problem instance the s-bounded instance (or s-bounded delay buffer management problem) in which for any packet p, d(p) − r(p) + 1 ≤ s. For any s ≥ 2, Hajek [18] showed that the competitive ratio of any deterministic algorithm is at least (1 + √5)/2 ≈ 1.619. Also, it is conjectured that for any s ≥ 2, there exists a deterministic algorithm with a competitive ratio of (1 + √5)/2 (see, e.g. [16]), which has not been proved yet. 1 There is much research among online problems to reduce the competitive ratio of an online algorithm for the original problems by adding extra abilities to the algorithm. One of the major methods is called the lookahead ability, with which an online algorithm can obtain information about arriving packets in the near future. This ability is introduced to various online problems: The bin packing problem [17], the paging problem [2, 12], the list update problem [3], the scheduling problem [27] and so on. Then, Bohm et al. [10] introduced the lookahead ability to the bounded delay buffer management problem, that is, they gave an online algorithm for this problem an ability to obtain the information about future arriving packets and analyzed its performance. Previous Results and Our Results. Bohm et al. [10] studied the 2-bounded bounded delay buffer management problem with lookahead. They designed a deterministic algorithm whose As mentioned above, for the s-bounded delay model without lookahead, In this paper, we showed an optimal online algorithm for this problem, that is, its competitive competitive ratio is at most (−1 + √13)/2 ≈ 1.303. Also, they proved that the competitive ratio of any deterministic algorithm is at least (1 + √17)/4 ≈ 1.281. ratio is exactly (1 + √17)/4. Related Results. Hajek [18] showed that the competitive ratio of any deterministic algorithm is at least (1+√5)/2 ≈ 1.619 in the case of s ≥ 2. Independently, this bound was also shown in [13, 4, 30]. For s = ∞, Englert and Westermann [15] developed a deterministic online algorithm whose competitive ratio is at most 2√2 − 1 ≈ 1.829, which is the current best upper bound. For each s = 2 [23], 3 [5, 9], and 4 [10], an algorithm with a competitive ratio of (1 + √5)/2 was designed. For any s ≥ 5, an algorithm with a competitive ratio of larger than (1 + √5)/2 but less than 2 was shown [5, 9]. Moreover, in the case where an algorithm must decide which packet to transmit on the basis of the current buffer situation, called the memoryless case, some results were shown [5, 9, 15]. The agreeable deadline variant has also been studied. In this variant, the larger the release times of packets are, the larger their deadlines are. Specifically, for any packets p and p′, d(p) ≤ d(p′) if r(p) < r(p′). The lower bound of (1 + √5)/2 by Hajek [18] is applicable to this variant. Li et al. [25, 21] displayed an optimal algorithm, whose competitive ratio matches the lower bound. The case in which for any packet p, d(p) − r(p) + 1 = s has also been studied, called the s-uniform delay variant, which is a specialized variant of the agreeable deadline variant. The current best upper and lower bounds for this variant are (1 + √5)/2 [25, 21] and 1.377 [14], respectively. The research on randomized algorithms for the bounded delay buffer management problem has also been conducted extensively [13, 5, 9, 6, 19, 20, 21, 22]. In the case in which s is general, the current best upper and lower bounds are e/(e − 1) ≈ 1.582 [5, 9, 22] and 5/4 = 1.25 [13], respectively, against an oblivious adversary were shown. Upper and lower bounds of e/(e−1) [6, 22] and 4/3 ≈ 1.333 [6], respectively, against an adaptive adversary were shown. For any fixed s, lower bounds are the same with the bounds in the case in which s is general while upper bounds are 1/(1 − (1 − 1 s )s) [22] against the both adversaries. A generalization of the bounded delay buffer management problem has been studied, called the weighted item collection problem [7, 8, 22]. In this problem, an online algorithm does not know the deadline of each packet but knows the relative order of the deadlines of packets. Many other variants of the buffer management problem have been studied extensively (see e.g. [16, 28]). 2 Model Description We formally give the definition of the 2-bounded delay buffer management problem with lookahead, which is addressed in this paper. An input of this problem is a sequence of phases. Time begins 2 with zero and a phase occurs at an integer time. Each phase consists of three subphases. The first occurring subphase is the arrival subphase. At an arrival subphase, arbitrary many packets can arrive to a buffer. The buffer has no capacity limit and hence, all arriving packets can always be accepted to the buffer. A packet p is characterized by the release time, deadline and value, denoted by r(p), d(p) and v(p) respectively. Arrival times and deadlines are non-negative integers and values are positive reals. d(p) − r(p) ≤ 1 holds because we focus on 2-bounded instances. The second subphase is the transmission phase. At a transmission subphase, an algorithm can transmit at most one packet from its buffer if any packet. At the transmission subphase at a time t, the algorithm can obtain the information about packets arriving at time t + 1 using the lookahead ability. The third subphase is the expiration subphase. At an expiration subphase, a packet which has reached its deadline is discarded from its buffer. That is, at the expiration subphase at a time t, all the packets p in the buffer such that d(p) = t are discarded. The profit of an algorithm is the sum of the values of packets transmitted by the algorithm. The objective of this problem is to maximize the gained profit. Let VA(σ) denote the profit of an algorithm A for an input σ. Let OP T be an optimal offline algorithm. We say that the competitive ratio of an online algorithm ON is at most c if for any input σ, VOP T (σ) ≤ VON (σ)c. For ease of analysis, we assume that when OP T does not store any packet in its buffer, the input is over. It is easy to see that this assumption does not affect the performance analysis of an algorithm. 3 Matching Upper Bound 3.1 Notation and Definitions for Algorithm We give definitions before defining our algorithm CompareWithPartialOPT (CP ). For any integer time t, B(t) denotes the set of packets in CP 's buffer immediately before the arrival subphase at time t. That is, each packet p in the set is not transmitted before t, t > r(p) and t ≤ d(p). For integer times t, t′(≥ t) and t′′(≥ t′) and an input σ, let OP T ∗(t, t′, t′′) be an offline algorithm such that if the packets in OP T ∗(t, t′, t′′)'s buffer immediately before the arrival subphase at time t is equal to those in B(t), and the subinput of σ during time [t, t′] is given to OP T ∗(t, t′, t′′), that is, packets p such that r(p) ∈ [t, t′] arrive to OP T ∗(t, t′, t′′)'s buffer during time [t, t′], then OP T ∗(t, t′, t′′) is allowed to transmit packets only from time t to t′′ inclusive, and chooses the packets whose total profit is maximized. If there exist packets with the same value in OP T ∗(t, t′, t′′)'s buffer, OP T ∗(t, t′, t′′) follows a fixed tie breaking rule. Also, P (t, t′, t′′) denotes the set of t′′ − t + 1 packets transmitted by OP T ∗(t, t′, t′′) during time [t, t′′]. Note that for any t and t′(≥ t), the following relations hold because of the optimality of packets transmitted by OP T ∗(t, t′, t′′) during time [t, t′′]: and We define for any t and i, P (t, t′, t′) ⊆ P (t, t′ + 1, t′ + 1) P (t, t′, t′) ⊆ P (t, t′, t′ + 1) P (t + 1, t′, t′) ⊆ P (t, t′, t′). and mi(t) = P (t, t + i, t + i)\P (t, t + i − 1, t + i − 1) qi(t) = P (t, t + i, t + i + 1)\P (t, t + i, t + i). 3 (1) (2) (3) Also, we define P (t, t − 1, t − 1) = ∅. Furthermore, we describe each value in the algorithm definition for ease of presentation as follows: mi = mi(t) m′′ m′ i = mi(t − 1) i = mi(t − 2) qi = qi(t) q′ i = qi(t − 1) and In addition, and q′′ i = qi(t − 2). 1 + √17 R = 4 α = −3 + √17 2 . CP uses the internal variable st for holding the name of a packet which CP transmits at a time t. st′ =null holds at first for any integer t′. CP uses the two constants tmp1 and tmp2 if at time t, CP cannot decide which packet to transmit at t + 1 in Cases 1.2.3.4 and 2.2.2.3. On the other hand, once the name of a packet is set to st+1 at time t, CP certainly transmits the packet at t + 1. 3.2 Algorithm CompareWithPartialOPT (CP ) Initialize: For any integer time t′, st′ :=null. Consider the transmission subphase at a time t. If the buffer stores no packets, do nothing. Otherwise, do one of the following three cases and then transmit the packet whose name is set to st. Case 1 (st =null): Case 1.1 (d(m0) = t): st := m0. Case 1.2 (d(m0) 6= t): Case 1.2.1 (d(m1) = t): st := m1 and st+1 := m0. Case 1.2.2 (d(m1) = t + 1): st := m0 and st+1 := m1. Case 1.2.3 (d(m1) 6= t + 1): Case 1.2.3.1 (v(m0) ≥ v(m1) and v(q1) ≥ αv(m1)): st := q1 and st+1 := m0. Case 1.2.3.2 (v(m0) ≥ v(m1) and v(q1) < αv(m1)): st := m0 and st+1 := m1. Case 1.2.3.3 (v(m0) < v(m1) and v(q1)+v(m0)+v(m1) Case 1.2.3.4 (v(m0) < v(m1) and v(q1)+v(m0)+v(m1) v(m0)+v(m1) ≤ R): st := m0 and st+1 := m1. v(m0)+v(m1) > R): st := q1 and st+1 := tmp1. Case 2 (st =tmp1): Case 2.1 ( v(m′ v(q′ Case 2.2 ( v(m′ v(q′ 0)+v(m′ 1)+v(m′ 0)+v(m′ 1)+v(m′ 1)+v(m′ 0)+v(m′ 1)+v(m′ 0)+v(m′ 2) 1) ≤ R): st := m′ 2) 1) > R): 0 and st+1 := m′ 1. 4 Case 2.2.1 (d(m′ Case 2.2.2 (d(m′ 1): st := m′ Case 2.2.2.1 (q′ 1. 2)+v(m′ 1 and v(q′ Case 2.2.2.2 (q′ v(q′ Case 2.2.2.3 (Otherwise): st := m′ 2) = t + 1): st := m′ 2) 6= t + 1): 2 6= q′ 2 = q′ 1 and st+1 := m′ 2. 0)+v(m′ 1)+v(m′ 2) 1)+v(m′ 1)+v(m′ 0 and st+1 := tmp2. 2) ≤ R): st := m′ 1 and st+1 := m′ 2. 0 )+v(m′′ 1 )+v(m′′ 0 )+v(m′′ 1 )+v(m′′ Case 3 (st =tmp2): Case 3.1 ( v(m′′ v(q′′ Case 3.2 ( v(m′′ v(q′′ Case 3.2.1 (d(m′′ Case 3.2.2 (d(m′′ Case 3.2.3 (d(m′′ 1 )+v(m′′ 0 )+v(m′′ 1 )+v(m′′ 0 )+v(m′′ 2 )+v(m′′ 3 ) 2 ) ≤ R): st := m′′ 1 )+v(m′′ 2 )+v(m′′ 3 ) 2 ) > R): 1 )+v(m′′ 1 and st+1 := m′′ 2. 3 ) = t + 1): st := m′′ 3 ) 6= t + 1 and q′′ 3 ) 6= t + 1 and q′′ 2 and st+1 := m′′ 3. 1 ): st := m′′ 2. 2 and st+1 := m′′ 1 ): st := m′′ 3. 3 6= q′′ 3 = q′′ 3.3 Overview of the Analysis Consider a given input σ. Let τ be the time at which CP transmits the last packet. We partition the time sequence [0, τ ] into k sequences Ti(i = 1, . . . , k) to evaluate the competitive ratio of CP , in which k depends on σ and if Ti = (ti, t′ i), then ti ≤ t′ k = τ and for any j = 2, . . . , k, tj = t′ j−1 + 1. The size of each Ti depends on which case CP executes at each time. Specifically, it is defined as follows: Suppose that Ti = (t, t′) and then i, t1 = 0, t′ • If Case 1.1 is executed at t, then t′ = t. • If Case 1.2.1, 1.2.2, 1.2.3.1, 1.2.3.2 or 1.2.3.3 is executed at t, then t′ = t + 1. • If Case 1.2.3.4 is executed at t and Case 2.1, 2.2.1 or 2.2.2.2 at t + 1, then t′ = t + 2. • If Cases 1.2.3.4 and 2.2.2.1 are executed at t and t + 1, respectively, then t′ = t + 1. • If Cases 1.2.3.4 and 2.2.2.3 are executed at t and t + 1, respectively, and Case 3.1, 3.2.1 or 3.2.3 is executed at t + 2, then t′ = t + 3. • If Cases 1.2.3.4 and 2.2.2.3 are executed at t and t + 1, respectively, and Case 3.2.2 is executed at t + 2, then t′ = t + 2. For a time t, a packet whose release time is t and deadline is t + 1 is called a 2t-packet. On the other hand, we also partition the time sequence [0, τ ′] into k time sequences T ′ i (i = 1, . . . , k), in which τ ′ is the time at which OP T transmits the last packet. We will compare the total value of packets transmitted by CP during the time Ti with that by OP T during the time T ′ is i = (t, t′), in which if CP transmits defined as follows: Suppose that Ti = (t, t′). Then, we define T ′ a 2t−1-packet p at time t − 1 and OP T transmits p at time t, then t = t + 1 and otherwise, t = t. Moreover, if CP transmits a 2t′-packet p′ and OP T transmits p′ at time t′ + 1, then t′ = t′ + 1. Otherwise, t′ = t′. i . T ′ i We give the lemma about T ′ i . Lemma 3.1 A time t ∈ [0, τ ′] is contained in some T ′ j. Proof. We prove this lemma by contradiction and assume that a time t ∈ [0, τ ′] is not contained in any T ′ j. By the assumption of a given input, OP T transmits a packet at t. If CP transmits a packet at t, then t is contained in some Ti and t is contained in either T ′ i−1 by the definition of T ′. Thus, CP does not store any packet at t and does not transmit a packet. That is, no packets i or T ′ 5 arrive at t. A packet p transmitted by OP T at t is a 2t−1-packet. If not, CP can transmit p at t. Hence, CP transmits p at time t − 1. By the definition of CP , CP executes Case 1.2.3.2, 1.2.3.3, 2.2.2.2 or 3.2.3 and transmits p at t − 1, which is the last time of Ti. Therefore, t is contained in T ′ i by the definition of T ′, which contradicts the above assumption. For any i(∈ [1, k]), let Vi (V ′ Ti (T ′ i ). By definition, i ) denote the total value of packets transmitted by CP (OP T ) during By Lemma 3.1, Since we have using Lemma 3.7, VCP (σ) = VOP T (σ) ≤ k Xi=1 Vi. k Xi=1 V ′ i . i∈[1,k](cid:26) V ′ Vi(cid:27) , i VOP T (σ) VCP (σ) ≤ Pk i=1 V ′ i i=1 Vi ≤ max Pk V ′ i Vi ≤ R. Therefore, we have the following theorem: Theorem 3.2 The competitive ratio of CP is at most (1 + √17)/4. 3.4 Analysis To show Lemma 3.7, we first prove the following lemmas. Let V (t, t′, t′′) denote the total value of packets in P (t, t′, t′′). That is, V (t, t′, t′′) = Pp∈P (t,t′,t′′) v(p). Lemma 3.3 For integer times t and t′(≥ t), suppose that Ti = (t, t′) and a packet that CP trans- mits at t′ is not a 2t′ -packet. Then, V ′ i ≤ V (t, t′, t′). Proof. Suppose that Ti = (t, t′). First, we consider CP does not transmit a 2t−1-packet at time t − 1. Then, by definition, (4) Furthermore, all the 2t−1-packet, which arrive at t − 1, are stored in CP 's buffer at time t. Hence, since we discussed the 2-bounded instance in this paper, all the packets in OP T 's buffer at t are stored in CP 's buffer. Thus, by the optimality of OP T ∗(t, t′, t′) from Eq. (4), T ′ i = (t, t′). i ≤ V (t, t′, t′). V ′ Next, we consider the case in which CP transmits a 2t−1-packet p at t− 1. First, let us consider the case in which OP T does not transmit p at t. By definition, i = (t, t′). T ′ (5) 6 At time t, OP T 's buffer may store p but CP 's buffer does not. However, it does not affect a packet which OP T transmits at t whether p is stored in OP T 's buffer because OP T does not transmit p at t. Hence, by the optimality of OP T ∗(t, t′, t′) from Eq. (5), Second, we discuss the case in which OP T transmits p at t. By definition, V ′ i ≤ V (t, t′, t′). T ′ i = (t + 1, t′). Therefore, in which the second inequality follows from Eq. (3). V ′ i ≤ V (t + 1, t′, t′) ≤ V (t, t′, t′), Lemma 3.4 For integer times t and t′(≥ t), suppose that Ti = (t, t′) and a packet that CP trans- mits at t′ is a 2t′ -packet. Then, V ′ i ≤ V (t, t′, t′ + 1). Proof. Suppose that Ti = (t, t′). We have in a similar way to the proof of Lemma 3.3, either T ′ i = (t, t′) or T ′ i = (t + 1, t′). Thus, Hence, by Eq. (2), V ′ i ≤ V (t + 1, t′, t′) ≤ V (t, t′, t′). V ′ i ≤ V (t, t′, t′ + 1). Second, we consider the case in which OP T transmits a 2t′ -packet p′ at t′+1 which CP transmits i = (t + 1, t′ + 1). i = (t, t′ + 1). In the either case, we have in a similar way to the proof of Lemma 3.3, at t′. If CP transmits a 2t−1-packet p at t − 1 and OP T transmits p at t, then T ′ Otherwise, T ′ V ′ i ≤ V (t, t′ + 1, t′ + 1). Since OP T transmits a packet at time t′ + 1 which arrives at time t′, packets arriving at t′ + 1 does not matter to OP T . Thus, P (t, t′ + 1, t′ + 1) = P (t, t′, t′ + 1), which leads to V ′ i ≤ V (t, t′, t′ + 1). Lemma 3.5 Let t be an integer time. transmits m0(t) and m1(t) at times t and t + 1, respectively. If CP executes Case 2.2.2.1 at time t + 1, then OP T Proof. Suppose that Case 2.2.2.1 is executed at a time t + 1. Then, note that q1(t) 6= q2(t) by the condition of Case 2.2.2.1. First, let us consider the case in which r(q2(t)) ≤ t+1. By the definition of P , P (t, t+1, t+2) = {q1(t), m0(t), m1(t)}. However, q2(t) is neither m0(t) nor m1(t) by the definition of q2(t). Also, OP T ∗(t, t+2, t+3) obtains a higher profit by q2(t) in P (t, t+2, t+3) instead of q1(t) in P (t, t+1, t+2). That is, v(q1(t)) < v(q2(t)). Thus, V (t, t+1, t+2) < v(q2(t))+v(m0(t))+v(m1(t)), which contradicts the optimality of OP T ∗(t, t + 1, t + 2). 7 In the following, we consider the case in which r(q2(t)) ≥ t + 2. P (t, t + 2, t + 2) contains one packet which OP T ∗(t, t + 2, t + 2) transmits at time t + 2. Also, P (t, t + 2, t + 3) contains q2(t), which is not in P (t, t + 2, t + 2). OP T ∗(t, t + 2, t + 3) transmits q2(t) at or after t + 2. Furthermore, r(m2(t)) ≥ t + 2 because d(m2(t)) = t + 3 by the condition of Case 2.2.2. In a similar way to the proofs of Lemmas 3.3 and 3.4, we can show that packets in OP T 's buffer at t is included in ones in CP 's buffer at t. Therefore, OP T transmits q2(t) and m2(t) at or after t + 2 and transmits m0(t) and m1(t) at t and t + 1. Lemma 3.6 Let t be an integer time. If CP executes Case 3.2.2 at time t+2, then OP T transmits m0(t), m1(t) and m2(t) at times t, t + 1 and t + 2, respectively. Proof. We can show the proof of this lemma in a similar way to the proof of Lemma 3.5. Suppose that Case 2.2.2.3 is executed at a time t + 1 and Case 3.2.2 is executed at t + 2. Note that q1(t) = q2(t) by the condition of Case 2.2.2.3 and q1(t) 6= q3(t) by the condition of Case 3.2.2. If r(q2(t)) ≤ t + 2, then OP T ∗(t, t + 2, t + 3) can transmit q2(t) during time [t, t + 2] instead of q1(t) concerning P (t, t + 2, t + 3), which contradicts the optimality of OP T ∗(t, t + 2, t + 3). Thus, r(q2(t)) ≥ t+3. P (t, t+3, t+3) contains one packet transmitted by OP T ∗(t, t+3, t+3) at time t+3. Also, P (t, t+3, t+4) contains q3(t), which is not in P (t, t+3, t+3), and OP T ∗(t, t+3, t+4) transmits q3(t) at or after t + 3. Moreover, since d(m3(t)) = t + 4 by the condition of Case 2.2.2, r(m3(t)) ≥ t + 3. Therefore, OP T transmits q3(t) and m3(t) at or after t + 3 and transmits m0(t), m1(t) and m2 during time [t, t + 2]. We are ready to prove Lemma 3.7. Lemma 3.7 V ′ i /Vi ≤ R. Proof. Suppose that CP executes Case 1 at a time t and t is contained in Tj. Note that if CP executes Case 1.2.3.4 at t, then CP executes Case 2 at time t + 1. Moreover, if CP executes Case 2.2.2.3 at t + 1, then CP executes Case 3 at time t + 2. For ease of presentation, mi and qi denote mi(t) and qi(t), respectively. Before proceeding to the proof, we give some inequalities used often later. When CP executes Case 1.2.3.4 at t, by the condition of Case 1.2.3.4, v(m0) < v(m1) and When CP executes Case 2.2 at t + 1, v(q1) > (R − 1)(v(m0) + v(m1)). When CP executes Case 3.2 at t + 2, v(m2) > (R − 1)(v(m0) + v(m1)) + Rv(q1). v(m3) > (R − 1)(v(m0) + v(m1) + v(m2)) + Rv(q1). (6) (7) (8) (9) 8 When CP executes Case 2.2.2.3 at t + 1, v(m0) > (R − 1)(v(q2) + v(m1) + v(m2)) (by the condition of Case 2.2.2.3) = (R − 1)(v(q1) + v(m1) + v(m2)) > (R − 1)(v(q1) + v(m1)) + (R − 1)((R − 1)(v(m0) + v(m1)) + Rv(q1)) = (R2 − 1)v(q1) + (R2 − R)v(m1) + (R2 − 2R + 1)v(m0) > (R2 − 1)(R − 1)(v(m0 + v(m1)) + (R2 − R)v(m1) + (R2 − 2R + 1)v(m0) = (R3 − 3R + 2)v(m0) + (R3 − 2R + 1)v(m1). By rearranging this inequality, we have v(m0) > R3 − 2R + 1 −R3 + 3R − 1 v(m1). (by Eq. (8)) (by Eq. (7)) (10) Now we discuss the profit ratio for the execution of each case. When CP executes Case 1.1, CP j ≤ V (t, t, t) by Lemma 3.3. transmits m0 at t and Vj = v(m0) = V (t, t, t). On the other hand, V ′ Thus, V ′ j /Vj ≤ 1. When Case 1.2.1 or 1.2.2 is executed, CP transmits both m0 and m1 and Vj = v(m0)+ v(m1) = V (t, t + 1, t + 1). By Lemma 3.3, V ′ j ≤ V (t, t + 1, t + 1). Thus, V ′ j /Vj ≤ 1. We consider Case 1.2.3.1. CP transmits q1 and m0 at times t and t + 1, respectively, by definition. Thus, Vj = v(q1) + v(m0). Since P (t, t + 1, t + 1) = {m0, m1} by the definition of P , by Lemma 3.3, V ′ j ≤ V (t, t + 1, t + 1) = v(m0) + v(m1). Hence, V ′ j Vj ≤ v(m0) + v(m1) v(q1) + v(m0) ≤ v(m1) + v(m1) αv(m1) + v(m1) = 2 α + 1 = R, in which the second inequality follows from v(q1) ≥ αv(m1) and v(m0) ≥ v(m1), which is the condition of Case 1.2.3.1, and the last equality follows from the definitions of α and R. Let us consider Case 1.2.3.2. Since CP transmits m0 and m1 at t and t + 1, respectively, by definition, Vj = v(m0) + v(m1). P (t, t + 1, t + 1) = {m0, m1} and P (t, t + 1, t + 2) = {q1, m0, m1} by definition. If OP T does not transmit m1 at t + 2, we have using Lemma 3.3, V ′ j ≤ V (t, t + 1, t + 1) = v(m0) + v(m1). Thus, V ′ j /Vj ≤ 1. If OP T transmits m1 at t + 2, we have using Lemma 3.4, V ′ j ≤ V (t, t + 1, t + 2) = v(q1) + v(m0) + v(m1). By these inequalities, V ′ j Vj ≤ v(q1) + v(m0) + v(m1) v(m0) + v(m1) < αv(m0) + v(m0) + v(m0) v(m0) + v(m0) = α + 2 2 = R, 9 in which the second inequality follows from v(q1) < αv(m1) and v(m0) ≥ v(m1), which is the execution condition of Case 1.2.3.2, and the last equality is immediately from the definitions of α and R. We consider Case 1.2.3.3. Since CP transmits m0 and m1 at t and t + 1, respectively, Vj = v(m0) + v(m1). In a similar way to the proof of Case 1.2.3.2, if OP T does not transmit m1 at t + 2, it follows from Lemma 3.3 that Thus, V ′ j /Vj ≤ 1. If OP T transmits m1 at time t + 2, we have by Lemma 3.4, V ′ j ≤ V (t, t + 1, t + 1) = v(m0) + v(m1). V ′ j ≤ V (t, t + 1, t + 2) = v(q1) + v(m0) + v(m1). By the condition of Case 1.2.3.3, V ′ j Vj ≤ v(q1) + v(m0) + v(m1) v(m0) + v(m1) ≤ R. For the rest of the proof, suppose that CP executes Case 1.2.3.4 at t and next executes Case 2 at t + 1. Hence, CP transmits q1 at t. First, we consider the case in which Case 2.1 is executed at t + 1. By the definition of Case 2.1, CP transmits m0 and m1 at t + 1 and t + 2, respectively, and thus, Vj = v(q1) + v(m0) + v(m1). On the other hand, since P (t, t + 2, t + 2) = {m0, m1, m2} by definition, it follows from Lemma 3.3 that Thus, V ′ j ≤ V (t, t + 2, t + 2) = v(m0) + v(m1) + v(m2). V ′ j Vj ≤ v(m0) + v(m1) + v(m2) v(q1) + v(m0) + v(m1) ≤ R, which follows from the condition of Case 2.1. We discuss Case 2.2.1. Since CP transmits m1 and m2 at t + 1 and t + 2, respectively, by definition, Since P (t, t + 2, t + 2) = {m0, m1, m2}, we have using Lemma 3.3, Vj = v(q1) + v(m1) + v(m2). V ′ j ≤ V (t, t + 1, t + 1) = v(m0) + v(m1) + v(m2). 10 Hence, V ′ j Vj ≤ < = < = = v(m0) + v(m1) + v(m2) v(q1) + v(m1) + v(m2) v(m0) + v(m1) + (R − 1)(v(m0) + v(m1)) + Rv(q1) v(q1) + v(m1) + (R − 1)(v(m0) + v(m1)) + Rv(q1) R(v(m0) + v(m1)) + Rv(q1) (by Eq. (8)) R(v(q1) + v(m1)) − v(m0) + (R + 1)v(q1) R(v(m0) + v(m1)) + R(R − 1)(v(m0) + v(m1)) R(v(q1) + v(m1)) − v(m0) + (R + 1)(R − 1)(v(m0) + v(m1)) 2R2v(m0) R2(v(m0) + v(m1)) (by Eq. (7)) (R2 + R − 1)(v(q1) + v(m1)) − v(m0) 2(R2 + R − 1)v(m0) − v(m0) < (by Eq. (6)) 2R2 2R2 + 2R − 3 < = R. R2 R In Case 2.2.2.1, CP transmits m1 at t + 1 and hence, By Lemma 3.5, Thus, Vj = v(q1) + v(m1). V ′ j = v(m0) + v(m1). V ′ j Vj ≤ v(m0) + v(m1) v(q1) + v(m1) < < = v(m0) + v(m1) (R − 1)(v(m0) + v(m1)) + v(m1) v(m0) + v(m0) (R − 1)(v(m0) + v(m0)) + v(m0) = √5 − 1 < R. 2 R (by Eq. (7)) (by Eq. (6)) In Case 2.2.2.2, CP transmits m1 and m2 at t + 1 and t + 2, respectively, Vj = v(q1) + v(m1) + v(m2). By the definition of P , P (t, t + 2, t + 2) = {m0, m1, m2}. Since q2 = q1 by the condition of Case 2.2.2.2, P (t, t + 2, t + 3) = {q2, m0, m1, m2} = {q1, m0, m1, m2}. If OP T does not transmit m2 at t + 3, by Lemma 3.3, V ′ j ≤ V (t, t + 2, t + 2) = v(m0) + v(m1) + v(m2). Thus, V ′ j Vj ≤ v(m0) + v(m1) + v(m2) v(q1) + v(m1) + v(m2) < v(q1) + v(m0) + v(m1) + v(m2) v(q1) + v(m1) + v(m2) . If OP T transmits m2 at t + 3, by Lemma 3.4, V ′ j ≤ V (t, t + 2, t + 3) = v(q1) + v(m0) + v(m1) + v(m2). 11 Therefore, V ′ j Vj ≤ v(q1) + v(m0) + v(m1) + v(m2) v(q1) + v(m1) + v(m2) ≤ R, which is immediately from the condition of Case 2.2.2.2. In the following, suppose that CP executes Cases 2.2.2.3 and 3 at t + 1 and t + 2, respectively, which indicates that CP transmits m0 at t + 1. Let us consider the case in which Case 3.1 is executed at t + 2. Since CP transmits m1 and m2 at t + 2 and t + 3, respectively, Vj = v(q1) + v(m0) + v(m1) + v(m2). P (t, t + 4, t + 4) = {m0, m1, m2, m3} and thus we have using Lemma 3.3, V ′ j ≤ V (t, t + 4, t + 4) = v(m0) + v(m1) + v(m2) + v(m3). Thus, V ′ j Vj ≤ v(m0) + v(m1) + v(m2) + v(m3) v(q1) + v(m0) + v(m1) + v(m2) ≤ R, which is immediately from the condition of Case 3.1. We discuss Case 3.2.1 at the end of this proof and next consider Case 3.2.2. Since CP transmits m2 at t + 2, Moreover, by Lemma 3.6, Vj = v(q1) + v(m0) + v(m2). V ′ j = v(m0) + v(m1) + v(m2). Hence, V ′ j Vj ≤ < = < = < v(m0) + v(m1) + v(m2) v(q1) + v(m1) + v(m2) v(m0) + v(m1) + (R − 1)(v(m0) + v(m1)) + Rv(q1) v(q1) + v(m1) + (R − 1)(v(m0) + v(m1)) + Rv(q1) Rv(m0) + Rv(m1) + Rv(q1) (by Eq. (8)) Rv(m0) + (R − 1)v(m1) + (R + 1)v(q1) Rv(m0) + Rv(m1)) + R(R − 1)(v(m0) + v(m1)) Rv(m0) + (R − 1)v(m1) + (R + 1)(R − 1)(v(m0) + v(m1)) R2v(m0) + R2v(m1) (by Eq. (7)) (R2 + R − 1)v(m0)) + (R2 + R − 2)v(m1) R3 2R3 + R2 − 4R + 1 < 1.23 < R. (by Eq. (10)) In Case 3.2.3, CP transmits m2 and m3 at t + 2 and t + 3, respectively, and thus, Vj = v(q1) + v(m0) + v(m2) + v(m3). On the other hand, P (t, t+3, t+3) = {m0, m1, m2, m3}. Since q3 = q1 by the condition of Case 3.2.3, P (t, t + 3, t + 4) = {q3, m0, m1, m2, m3} = {q1, m0, m1, m2, m3}. If OP T does not transmit m3 at t + 4, by Lemma 3.3, V ′ j ≤ V (t, t + 3, t + 3) = v(m0) + v(m1) + v(m2) + v(m3). 12 Hence, V ′ j Vj ≤ v(m0) + v(m1) + v(m2) + v(m3) v(q1) + v(m0) + v(m2) + v(m3) < v(p) + v(m0) + v(m1) + v(m2) + v(m3) v(q1) + v(m0) + v(m2) + v(m3) . If OP T transmits m3 at t + 4, by Lemma 3.4, V ′ j ≤ V (t, t + 3, t + 4) = v(q1) + v(m0) + v(m1) + v(m2) + v(m3). Then, v(q1) + v(m0) + v(m1) + v(m2) + v(m3) > R(v(m0) + v(m1) + v(m2)) + (R + 1)v(q1) > R2(v(m0) + v(m1)) + (R2 + R + 1)v(q1) (by Eq. (8)) > R2(v(m0) + v(m1)) + (R2 + R + 1)(R − 1)(v(m0) + v(m1)) = (R3 + R2 − 1)(v(m0) + v(m1)) (by Eq. (9)) (by Eq. (7)) (11) Hence, we have V ′ j Vj ≤ < < v(q1) + v(m0) + v(m1) + v(m2) + v(m3) (by Eq. (11)) v(q1) + v(m0) + v(m2) + v(m3) (R3 + R2 − 1)(v(m0) + v(m1)) (R3 + R2 − 1)(v(m0) + v(m1)) − v(m1) (by Eq. (10)) R4 + R3 − R R4 + 2R3 − 4R + 1 < 1.23 < R. Finally we discuss Case 3.2.1. Since CP transmits m2 and m3 at t + 2 and t + 3, respectively, Vj = v(q1) + v(m0) + v(m2) + v(m3). Since P (t, t + 4, t + 4) = {m0, m1, m2, m3}, V ′ j ≤ V (t, t + 4, t + 4) = v(m0) + v(m1) + v(m2) + v(m3) by Lemma 3.3. In the same way as the proof of Case 3.2.2, V ′ j Vj ≤ < v(m0) + v(m1) + v(m2) + v(m3) v(q1) + v(m0) + v(m2) + v(m3) v(q1) + v(m0) + v(m1) + v(m2) + v(m3) v(q1) + v(m0) + v(m2) + v(m3) < R. References [1] W. Aiello, Y. Mansour, S. Rajagopolan and A. Ros´en, "Competitive queue policies for differ- entiated services," Journal of Algorithms, Vol. 55, No. 2, pp. 113–141, 2005. 13 [2] S. Albers, "On the influence of lookahead in competitive paging algorithms," Algorithmica, Vol. 18, No. 3, pp, 283–305, 1997. [3] S. Albers, "A competitive analysis of the list update problem with lookahead," Theoretical Computer Science, Vol. 197, No. 1–2, pp, 95–109, 1998. [4] N. Andelman, Y. Mansour and A. Zhu, "Competitive queueing policies for QoS switches," In Proc. of the 14th ACM-SIAM Symposium on Discrete Algorithms, pp. 761–770, 2003. [5] Y. Bartal, F. Chin, M. Chrobak, S. Fung, W. Jawor, R. Lavi, J. Sgall and T. Tich´y, "Online competitive algorithms for maximizing weighted throughput of unit jobs," In Proc. of the 21st International Symposium on Theoretical Aspects of Computer Science, pp. 187–198, 2004. [6] M. Bienkowski, M. Chrobak and L. Jez, "Randomized competitive algorithms for online buffer management in the adaptive adversary model," Theoretical Computer Science, Vol. 412, No. 39, pp. 5121–5131, 2011. [7] M. Bienkowski, M. Chrobak, C. Durr, M. Hurand, A. Jez, L. Jez and G. Stachowiak, "Col- lecting weighted items from a dynamic queue," Algorithmica, Vol. 65, No. 1, pp. 60–94, 2013, [8] M. Bienkowski, M. Chrobak, C. Durr, M. Hurand, A. Jez, L. Jez and G. Stachowiak, "A Φ-competitive algorithm for collecting items with increasing weights from a dynamic queue," Theoretical Computer Science, Vol. 475, pp. 92–102, 2013, [9] F. Y. L. Chin, M. Chrobak, S. P. Y. Fung, W. Jawor, J. Sgall and T. Tich´y, "Online competitive algorithms for maximizing weighted throughput of unit jobs," Journal of Discrete Algorithms, Vol. 4, No. 2, pp. 255–276, 2006, [10] M. Bohm, M. Chrobak, L. Jez, F. Li, J. Sgall and P. Vesel´y, "Online packet scheduling with bounded delay and lookahead," In Proc. of the 27th International Symposium on Algorithms and Computation, pp. 21:1–21:13, 2016. [11] A. Borodin and R. El-Yaniv, "Online computation and competitive analysis," Cambridge Uni- versity Press, 1998. [12] D. Breslauer, "On competitive on-line paging with lookahead," Theoretical Computer Science, Vol.209, No. 1–2, pp, 365–375, 1998, [13] F. Chin and S. Fung, "Online scheduling for partial job values: Does timesharing or random- ization help?," Algorithmica, Vol.37, pp, 149–164, 2003, [14] M. Chrobak, W. Jawor, J. Sgall and T. Tich´y, "Improved online algorithms for buffer man- agement in QoS switches," ACM Transactions on Algorithms, Vol.3, No.4, 2007. [15] M. Englert and M. Westermann, "Considering suppressed packets improves buffer management in quality of service switches," SIAM Journal on Computing, Vol.41, No.5, pp, 1166–1192, 2012. [16] M. Goldwasser, "A survey of buffer management policies for packet switches," ACM SIGACT News, Vol.41, No. 1, pp.100–128, 2010. [17] E. F. Grove, "Online bin packing with lookahead," In Proc. of the 6th ACM-SIAM Symposium on Discrete Algorithms, pp. 430–436, 1995. 14 [18] B. Hajek, "On the competitiveness of online scheduling of unit-length packets with hard dead- lines in slotted time," In Proc. of the 35th Conference on Information Sciences and Systems, pp. 434–438, 2001. [19] L. Jez, "Randomised buffer management with bounded delay against adaptive adversary," CoRR, abs/0907.2050, 2009. [20] L. Jez, "Randomized algorithm for agreeable deadlines packet scheduling," In Proc. of the 27th Symposium on Theoretical Aspects of Computer Science, pp. 489–500, 2010. [21] L. Jez, F. Li, J. Sethuraman and C. Stein, "Online scheduling of packets with agreeable deadlines," ACM Transactions on Algorithms, Vol. 9, No. 1, 2012. [22] L. Jez, "A Universal randomized packet scheduling algorithm," Algorithmica, Vol. 67, No. 4, pp. 498–515, 2013. [23] A. Kesselman, Z. Lotker, Y. Mansour, B. Patt-Shamir, B. Schieber and M. Sviridenko, "Buffer overflow management in QoS switches," SIAM Journal on Computing,Vol. 33, No. 3, pp. 563– 583, 2004. [24] A. Kesselman, Y. Mansour and R. van Stee, "Improved competitive guarantees for QoS buffer- ing," Algorithmica, Vol.43, No.1-2, pp. 63–80, 2005. [25] F. Li, J. Sethuraman and C. Stein, "An optimal online algorithm for packet scheduling with agreeable deadlines," In Proc. of the 16th ACM-SIAM Symposium on Discrete Algorithms, pp. 801–802, 2005. [26] F. Li, J. Sethuraman and C. Stein, "Better online buffer management," In Proc. of the 18th ACM-SIAM Symposium on Discrete Algorithms, pp. 199–208, 2007. [27] R. Motwani, V. Saraswat and E. Torng, "Online scheduling with lookahead: Multipass assem- bly lines," INFORMS Journal on Computing,Vol. 10, No. 3, pp. 331–340, 1998. [28] S. I. Nikolenko and K. Kogan, "Single and multiple buffer processing," In Encyclopedia of Algorithms, pp. 1–9, Springer, 2015. [29] D. Sleator and R. Tarjan, "Amortized efficiency of list update and paging rules," Communi- cations of the ACM,Vol. 28, No. 2, pp. 202–208, 1985. [30] A. Zhu, "Analysis of queueing policies in QoS switches," Journal of Algorithms, Vol. 53, pp. 137–168, 2004. 15
1508.03566
1
1508
2015-08-14T16:43:56
Analyzing the Performance of Lock-Free Data Structures: A Conflict-based Model
[ "cs.DS", "cs.DC" ]
This paper considers the modeling and the analysis of the performance of lock-free concurrent data structures. Lock-free designs employ an optimistic conflict control mechanism, allowing several processes to access the shared data object at the same time. They guarantee that at least one concurrent operation finishes in a finite number of its own steps regardless of the state of the operations. Our analysis considers such lock-free data structures that can be represented as linear combinations of fixed size retry loops. Our main contribution is a new way of modeling and analyzing a general class of lock-free algorithms, achieving predictions of throughput that are close to what we observe in practice. We emphasize two kinds of conflicts that shape the performance: (i) hardware conflicts, due to concurrent calls to atomic primitives; (ii) logical conflicts, caused by simultaneous operations on the shared data structure. We show how to deal with these hardware and logical conflicts separately, and how to combine them, so as to calculate the throughput of lock-free algorithms. We propose also a common framework that enables a fair comparison between lock-free implementations by covering the whole contention domain, together with a better understanding of the performance impacting factors. This part of our analysis comes with a method for calculating a good back-off strategy to finely tune the performance of a lock-free algorithm. Our experimental results, based on a set of widely used concurrent data structures and on abstract lock-free designs, show that our analysis follows closely the actual code behavior.
cs.DS
cs
Analyzing the Performance of Lock-Free Data Structures: A Conflict-based Model Aras Atalar, Paul Renaud-Goud and Philippas Tsigas Chalmers University of Technology {aarasgoudtsigas}@chalmers.se Abstract This paper considers the modeling and the analysis of the performance of lock-free concurrent data structures. Lock-free designs employ an optimistic conflict control mechanism, allowing several processes to access the shared data object at the same time. They guarantee that at least one concurrent operation finishes in a finite number of its own steps regardless of the state of the operations. Our analysis considers such lock-free data structures that can be represented as linear combinations of fixed size retry loops. Our main contribution is a new way of modeling and analyzing a general class of lock-free algorithms, achieving predictions of throughput that are close to what we observe in practice. We emphasize two kinds of conflicts that shape the performance: (i) hardware conflicts, due to concurrent calls to atomic primitives; (ii) logical conflicts, caused by simultaneous operations on the shared data structure. We show how to deal with these hardware and logical conflicts separately, and how to combine them, so as to calculate the throughput of lock-free algorithms. We propose also a common framework that enables a fair comparison between lock-free implementations by covering the whole contention domain, together with a better understanding of the performance impacting factors. This part of our analysis comes with a method for calculating a good back-off strategy to finely tune the performance of a lock-free algorithm. Our experimental results, based on a set of widely used concurrent data structures and on abstract lock-free designs, show that our analysis follows closely the actual code behavior. 5 1 0 2 g u A 4 1 ] S D . s c [ 1 v 6 6 5 3 0 . 8 0 5 1 : v i X r a Contents I II Introduction Related Work III Problem Statement III-A III-B Running Program and Targeted Platform . . . . . . . . . . . . . . . . . . . . . Examples and Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Immediate Upper Bounds . . . . . . . . . . . . . . . . . . . . . . . . III-B1 Conflicts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . III-B2 III-B3 Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IV Execution without hardware conflict IV-A IV-B IV-C Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Initial Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . IV-A1 IV-A2 Notations and Definitions . . . . . . . . . . . . . . . . . . . . . . . . Cyclic Executions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Throughput Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Expansion and Complete Throughput Estimation V-A V-B V-C Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Throughput Estimate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Several Retry Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Problem Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . V-C1 Wasted Retries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V-C2 V-C3 Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI Experimental Evaluation VI-A VI-B Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Synthetic Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-B1 Single retry loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-B2 Several retry loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . Treiber's Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-C Shared Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-D DeleteMin in Priority List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-E Enqueue-Dequeue on a Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-F VI-G Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VI-H Back-Off Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VII Conclusion References 1 2 3 3 3 5 5 5 6 6 6 6 7 9 16 19 19 20 21 21 22 23 23 23 23 23 25 25 27 27 28 30 31 33 33 I. Introduction 2 Lock-free programming provides highly concurrent access to data and has been increasing its footprint in industrial settings. Providing a modeling and an analysis framework capable of describing the practical performance of lock-free algorithms is an essential, missing resource necessary to the parallel programming and algorithmic research communities in their effort to build on previous intellectual efforts. The definition of lock-freedom mainly guarantees that at least one concurrent operation on the data structure finishes in a finite number of its own steps, regardless of the state of the operations. On the individual operation level, lock-freedom cannot guarantee that an operation will not starve. The goal of this paper is to provide a way to model and analyze the practically observed performance of lock-free data structures. In the literature, the common performance measure of a lock-free data structure is the throughput, i.e. the number of successful operations per unit of time. It is obtained while threads are accessing the data structure according to an access pattern that interleaves local work between calls to consecutive operations on the data structure. Although this access pattern to the data structure is significant, there is no consensus in the literature on what access to be used when comparing two data structures. So, the amount of local work (that we will refer as parallel work for the rest of the paper) could be constant ([MS96], [SL00]), uniformly distributed ([HSY10], [DLM13]), exponentially distributed ([Val94], [DB08]), null ([KH14], [LJ13]), etc., and more questionably, the average amount is rarely scanned, which leads to a partial covering of the contention domain. We propose here a common framework enabling a fair comparison between lock-free data structures, while exhibiting the main phenomena that drive performance, and particularly the contention, which leads to different kinds of conflicts. As this is the first step in this direction, we want to deeply analyze the core of the problem, without impacting factors being diluted within a probabilistic smoothing. Therefore, we choose a constant local work, hence constant access rate to the data structures. In addition to the prediction of the data structure performance, our model provides a good back-off strategy, that achieves the peak performance of a lock-free algorithm. Two kinds of conflict appear during the execution of a lock-free algorithm, both of them leading to additional work. Hardware conflicts occur when concurrent operations call atomic primitives on the same data: these calls collide and conduct to stall time, that we name here expansion. Logical conflicts take place if concurrent operations overlap: because of the lock-free nature of the algorithm, several concurrent operations can run simultaneously, but only one retry can logically succeed. We show that the additional work produced by the failures is not necessarily harmful for the system-wise performance. We then show how throughput can be computed by connecting these two key factors in an iterative way. We start by estimating the expansion probabilistically, and emulate the effect of stall time introduced by the hardware conflicts as extra work added to each thread. Then we estimate the number of failed operations, that in turn lead to additional extra work, by computing again the expansion on a system setting where those two new amounts of work have been incorporated, and reiterate the process; the convergence is ensured by a fixed-point search. We consider the class of lock-free algorithms that can be modeled as a linear composition of fixed size retry loops. This class covers numerous extensively used lock-free designs such as stacks [Tre86] (Pop, Push), queues [MS96] (Enqueue, Dequeue), counters [DLM13] (Increment, Decrement) and priority queues [LJ13] (DeleteMin). To evaluate the accuracy of our model and analysis framework, we performed experiments both on synthetic tests, that capture a wide range of possible abstract algorithmic designs, and on several reference implementations of extensively studied lock-free data structures. Our evaluation results reveal that our model is able to capture the behavior of all the synthetic and real designs for 3 all different numbers of threads and sizes of parallel work (consequently also contention). We also evaluate the use of our analysis as a tool for tuning the performance of lock-free code by selecting the appropriate back-off strategy that will maximize throughput by comparing our method with against widely known back-off policies, namely linear and exponential. The rest of the paper is organized as follows. We discuss related work in Section II, then the problem is formally described in Section III. We consider the logical conflicts in the absence of hardware conflicts in Section IV, while in Section V, we firstly show how to compute the expansion, then combine hardware and logical conflicts to obtain the final throughput estimate. We describe the experimental results in Section VI. II. Related Work Anderson et al. [ARJ97] evaluated the performance of lock-free objects in a single processor real- time system by emphasizing the impact of retry loop interference. Tasks can be preempted during the retry loop execution, which can lead to interference, and consequently to an inflation in retry loop execution due to retries. They obtained upper bounds for the number of interferences under various scheduling schemes for periodic real-time tasks. Intel [Int13] conducted an empirical study to illustrate performance and scalability of locks. They showed that the critical section size, the time interval between releasing and re-acquiring the lock (that is similar to our parallel section size) and number of threads contending the lock are vital parameters. Failed retries do not only lead to useless effort but also degrade the performance of successful ones by contending the shared resources. Alemany et al. [AF92] have pointed out this fact, that is in accordance with our two key factors, and, without trying to model it, have mitigated those effects by designing non-blocking algorithms with operating system support. Alistarh et al. [ACS14] have studied the same class of lock-free structures that we consider in this paper. The analysis is done in terms of scheduler steps, in a system where only one thread can be scheduled (and can then run) at each step. If compared with execution time, this is particularly appropriate to a system with a single processor and several threads, or to a system where the instructions of the threads cannot be done in parallel (e.g. multi-threaded program on a multi-core processor with only read and write on the same cache line of the shared memory). In our paper, the execution is evaluated in terms of processor cycles, strongly related to the execution time. In addition, the "parallel work" and the "critical work" can be done in parallel, and we only consider retry-loops with one Read and one CAS, which are serialized. In addition, they bound the asymptotic expected system latency (with a big O, when the number of threads tends to infinity), while in our paper we estimate the throughput (close to the inverse of system latency) for any number of threads. A. Running Program and Targeted Platform III. Problem Statement In this paper, we aim at evaluating the throughput of a multi-threaded algorithm that is based on the utilization of a shared lock-free data structure. Such a program can be abstracted by the Procedure AbstractAlgorithm (see Figure 1) that represents the skeleton of the function which is called by each spawned thread. It is decomposed in two main phases: the parallel section, represented on line 3, and the retry loop, from line 4 to line 7. A retry starts at line 5 and ends at line 7. As for line 1, the function Initialization shall be seen as an abstraction of the delay between the spawns of the threads, that is expected not to be null, even when a barrier is used. We then consider that the threads begin at the exact same time, but have different initialization times. The parallel section is the part of the code where the thread does not access the shared data structure; the work that is performed inside this parallel section can possibly depend on the value 4 Procedure AbstractAlgorithm 1 Initialization(); 2 while ! done do 3 4 5 6 7 Parallel_Work(); while ! success do current ← Read(AP); new ← Critical_Work(current); success ← CAS(AP, current, new); Figure 1: Thread procedure T0 T1 T2 T3 Figure 2: Execution with one wasted retry, and one inevitable failure Cycle that has been read from the data structure, e.g. in the case of processing an element that has been dequeued from a FIFO (First-In-First-Out) queue. In each retry, a thread tries to modify the data structure, and does not exit the retry loop until it has successfully modified the data structure. It does that by firstly reading the access point AP of the data structure, then according to the value that has been read, and possibly to other previous computations that occurred in the past, the thread prepares the new desired value as an access point of the data structure. Finally, it atomically tries to perform the change through a call to the Compare-And-Swap (CAS) primitive. If it succeeds, i.e. if the access point has not been changed by another thread between the first Read and the CAS, then it goes to the next parallel section, otherwise it repeats the process. The retry loop is composed of at least one retry, and we number the retries starting from 0, since the first iteration of the retry loop is actually not a retry, but a try. We analyze the behavior of AbstractAlgorithm from a throughput perspective, which is defined T0 T1 T2 T3 Cycle Figure 3: Execution with minimum number of failures as the number of successful data structure operations per unit of time. In the context of Proce- dure AbstractAlgorithm, it is equivalent to the number of successful CASs. 5 The throughput of the lock-free algorithm, that we denote by T, is impacted by several parameters. • Algorithm parameters: the amount of work inside a call to Parallel_Work (resp. Critical_Work) denoted by pw (resp. cw). • Platform parameters: Read and CAS latencies (rc and cc respectively), and the number P of processing units (cores). We assume homogeneity for the latencies, i.e. every thread experiences the same latency when accessing an uncontended shared data, which is achieved in practice by pinning threads to the same socket. B. Examples and Issues We first present two straightforward upper bounds on the throughput, and describe the two kinds of conflict that keep the actual throughput away from those upper bounds. 1) Immediate Upper Bounds: Trivially, the minimum amount of work rlw(-) in a given retry is rlw(-) = rc + cw + cc, as we should pay at least the memory accesses and the critical work cw in between. Thread-wise: A given thread can at most perform one successful retry every pw + rlw(-) units of time. In the best case, P threads can then lead to a throughput of P/(pw + rlw(-)). System-wise: By definition, two successful retries cannot overlap, hence we have at most 1 successful retry every rlw(-) units of time. Altogether, the throughput T is bounded by 1 rc + cw + cc , P pw + rc + cw + cc (cid:19) , i.e. (cid:18) T ≤ min ( 1 T ≤ rc+cw+cc pw+rc+cw+cc P if pw ≤ (P − 1)(rc + cw + cc) otherwise. (1) 2) Conflicts: Logical conflicts: Equation 1 expresses the fact that when pw is small enough, i.e. when pw ≤ (P −1)rlw(-), we cannot expect that every thread performs a successful retry every pw +rlw(-) units of time, since it is more than what the retry loop can afford. As a result, some logical conflicts, hence unsuccessful retries, will be inevitable, while the others, if any, are called wasted. However, different executions can lead to different numbers of failures, which end up with different throughput values. Figures 2 and 3 depict two executions, where the black parts are the calls to Initialization, the blue parts are the parallel sections, and the retries can be either unsuccessful -- in red -- or successful -- in green. We experiment different initialization times, and observe different synchronizations, hence different numbers of wasted retries. After the initial transient state, the execution depicted in Figure 3 comprises only the inevitable unsuccessful retries, while the execution of Figure 2 contains one wasted retry. We can see on those two examples that a cyclic execution is reached after the transient behavior; actually, we show in Section IV that, in the absence of hardware conflicts, every execution will become periodic, if the initialization times are spaced enough. In addition, we prove that the shortest period is such that, during this period, every thread succeeds exactly once. This finally leads us to define the additional failures as wasted, since we can directly link the throughput with this number of wasted retries: a higher number of wasted retries implying a lower throughput. CAS Read & cw Expansion Previously expanded CAS Figure 4: Expansion 6 Hardware conflicts: The requirement of atomicity compels the ownership of the data in an exclusive manner by the executing core. This fact prohibits concurrent execution of atomic instruc- tions if they are operating on the same data. Therefore, overlapping parts of atomic instructions are serialized by the hardware, leading to stalls in subsequently issued ones. For our target lock-free algorithm, these stalls that we refer to as expansion become an important slowdown factor in case threads interfere in the retry loop. As illustrated in Figure 4, the latency for CAS can expand and cause remarkable decreases in throughput since the CAS of a successful thread is then expanded by others; for this reason, the amount of work inside a retry is not constant, but is, generally speaking, a function depending on the number of threads that are inside the retry loop. 3) Process: We deal with the two kinds of conflicts separately and connect them together through the fixed-point iterative convergence. In Section V-A, we compute the expansion in execution time of a retry, noted e, by following a probabilistic approach. The estimation takes as input the expected number of threads inside the retry loop at any time, and returns the expected increase in the execution time of a retry due to the serialization of atomic primitives. In Section IV, we are given program without hardware conflict described by the size of the parallel section pw(+) and the size of a retry rlw(+). We compute upper and lower bounds on the throughput T, the number of wasted retries w, and the average number of threads inside the retry loop Prl. Without loss of generality, we can normalize those execution times by the execution time of a retry, and define the parallel section size as pw(+) = q + r, where q is a non-negative integer and r is such that 0 ≤ r < 1. This pair (together with the number of threads P) constitutes the actual input of the estimation. Finally, we combine those two outcomes in Section V-B by emulating expansion through work not prone to hardware conflicts and obtain the full estimation of the throughput. IV. Execution without hardware conflict We show in this section that, in the absence of hardware conflicts, the execution becomes periodic, which eases the calculation of the throughput. We start by defining some useful concepts: (f, P)- cyclic executions are special kind of periodic executions such that within the shortest period, each thread performs exactly f unsuccessful retries and 1 successful retry. The well-formed seed is a set of events that allows us to detect an (f, P)-cyclic execution early, and the gaps are a measure of the quality of the synchronization between threads. The idea is to iteratively add threads into the game and show that the periodicity is maintained. Theorem 1 establishes a fundamental relation between gaps and well-formed seeds, while Theorem 2 proves the periodicity, relying on the disjoint cases of Lemma 1, 3, and 4. Finally, we exhibit upper and lower bounds on throughput and number of failures, along with the average number of threads inside the retry loop. A. Setting 1) Initial Restrictions: 7 Remark 1. Concerning correctness, we assume that the reference point of the Read and the CAS occurs when the thread enters and exits any retry, respectively. Remark 2. We do not consider simultaneous events, so all inequalities that refer to time comparison are strict, and can be viewed as follows: time instants are real numbers, and can be equal, but every event is associated with a thread; also, in order to obtain a strict order relation, we break ties according to the thread numbers (for instance with the relation <). 2) Notations and Definitions: We recall that P threads are executing the pseudo-code described in Procedure AbstractAlgorithm, one retry is of unit-size, and the parallel section is of size pw(+) = q+r, where q is a non-negative integer and r is such that 0 ≤ r < 1. Considering a thread Tn which succeeds at time Sn; this thread completes a whole retry in 1 unit of time, then executes the parallel section of size pw(+), and attempts to perform again the operation every unit of time, until one of the attempt is successful. Definition 1. An execution with P threads is called (C, P)-cyclic execution if and only if (i) the execution is periodic, i.e. at every time, every thread is in the same state as one period before, (ii) the shortest period contains exactly one successful attempt per thread, (iii) the shortest period is 1 + q + r + C. Definition 2. Let S = (Ti, Si)i∈(cid:74)0,P−1(cid:75), where Ti are threads and Si ordered times, i.e. such that S0 < S1 < ··· < SP−1. S is a seed if and only if for all i ∈(cid:74)0, P − 1(cid:75), Ti does not succeed between S0 and Si, and starts a retry at Si. We define f (S) as the smallest non-negative integer such that S0 + 1 + q + r + f (S) > SP−1 + 1, i.e. f (S) = max (0,dSP−1 − S0 − q − re). When S is clear from the context, we denote f (S) by f. Definition 3. S is a well-formed seed if and only if for each i ∈(cid:74)0, P − 1(cid:75), the execution of thread Ti contains the following sequence: firstly a success beginning at Si, the parallel section, f unsuccessful retries, and finally a successful retry. Those definitions are coupled through the two natural following properties: Property 1. Given a (C, P)-cyclic execution, any seed S including P consecutive successes is a well-formed seed, with f (S) = C. Proof: Choosing any set of P consecutive successes, we are ensured, by the definition of a (f, P)- cyclic execution, that for each thread, after the first success, the next success will be obtained after f failures. The order will be preserved, and this shows that a seed including our set of successes is actually a well-formed seed. Property 2. If there exists a well-formed seed in an execution, then after each thread succeeded once, the execution coincides with an (f, P)-cyclic execution. Proof: By the definition of a well-formed seed, we know that the threads will first succeed in order, fails f times, and succeed again in the same order. Considering the second set of successes in a new well-formed seed, we observe that the threads will succeed a third time in the same order, after failing f times. By induction, the execution coincides with an (f, P)-cyclic execution. Together with the seed concept, we define the notion of gap that we will use extensively in the next subsection. The general idea of those gaps is that within an (f, P)-cyclic execution, the period is higher than P × 1, which is the total execution time of all the successful retries within the period. The difference between the period (that lasts 1 + q + r + f) and P, reduced by r (so that we obtain an integer), is referred as lagging time in the following. If the threads are numbered according to their order of success (modulo P), as the time elapsed between the successes of two given consecutive 8 TP−1 (2) G 0 T0 P−1X n=0 (1) G 1 T1 G(1) n T2 Figure 5: Gaps (1) G 2 threads is constant (during the next period, this time will remain the same), this lagging time can be seen in a circular manner (see Figure 5): the threads are represented on a circle whose length is the lagging time increased by r, and the length between two consecutive threads is the time between the end of the successful retry of the first thread and the begin of the successful retry of the second one. n between Tn and its kth predecessor (k) based on the gap with the first predecessor: More formally, for all (n, k) ∈(cid:74)0, P − 1(cid:75)2, we define the gap G 0 = S0 + q + r + f − SP−1 (1) G ; G n = Sn − Sn−1 − 1 (1) , which leads to the definition of higher order gaps: ( ∀n ∈(cid:74)1, P − 1(cid:75) ∀n ∈(cid:74)0, P − 1(cid:75) ; ∀k > 0 ; G(k) n = (1) j mod P . G nX j=n−k+1 For consistency, for all n ∈(cid:74)0, P − 1(cid:75), G Equally, the gaps can be obtained directly from the successes: for all k ∈(cid:74)1, P − 1(cid:75), (0) n = 0. ( G(k) n = Sn − Sn−k − k if n > k Sn − SP +n−k + 1 + q + r + f − k otherwise (2) Note that, in an (f, P)-cyclic execution, the lagging time is the sum of all first order gaps, reduced by r. Now we extend the concept of well-formed seed to weakly-formed seed. Definition 4. Let S = (Ti, Si)i∈(cid:74)0,P−1(cid:75) be a seed. S is a weakly-formed seed for P threads if and only if: (Ti, Si)i∈(cid:74)0,P−2(cid:75) is a well-formed seed for P − 1 threads, and the first thread succeeding after TP−2 is TP−1. (cid:17), for each n ∈(cid:74)0, P − 1(cid:75), G Property 3. Let S = (Ti, Si)i∈(cid:74)0,P−1(cid:75) be a weakly-formed seed. Denoting f = f (Ti, Si)i∈(cid:74)0,P−2(cid:75), the previous well-formed seed with P−1 threads, we know that for all n ∈(cid:74)1, P − 2(cid:75), n ≤ eG eG n , for all n ∈(cid:74)0, P − 1(cid:75) and k; hence (cid:16)(Ti, Si)i∈(cid:74)0,P−2(cid:75) 0 = eG 0, and if we note indeed eG Proof: We have SP−2 + 1 < SP−1 < Rf (1) 0 , which leads to G (1) n = G (1) P−1 + G the weaker property. (1) n , and G the gaps within (f) n < 1. (k) n (k) (k) (1) T0 T1 T2 Figure 6: Lemma 1 configuration 9 Lemma 1. Let S be a weakly-formed seed, and f = f (f+1) G n f (S0) = f + 1. < 1, then there exists later in the execution a well-formed seed S0 for P threads such that (cid:16)(Ti, Si)i∈(cid:74)0,P−2(cid:75) (cid:17). If, for all n ∈(cid:74)0, P − 1(cid:75), Proof: The proof is straightforward; S is actually a well-formed seed such that f (S) = f + 1. 0 − SP−1 < G 0 < 1, the first success of T0 after the success of TP−1 is its f + 1th retry. (1) Since Rf (f) n < 1. B. Cyclic Executions Theorem 1. Given a seed S = (Ti, Si)i∈(cid:74)0,P−1(cid:75), S is a well-formed seed if and only if for all n ∈(cid:74)0, P − 1(cid:75), 0 ≤ G Proof: Let S = (Ti, Si)i∈(cid:74)0,P−1(cid:75) be a seed. (⇐) We assume that for all n ∈(cid:74)0, P − 1(cid:75), 0 < G (f) n < 1, and we first show that the first successes occur in the following order: T0 at S0, T1 at S1, . . . , TP−1 at SP−1, T0 again at Rf 0. The first threads that are successful executes their parallel section after their success, then enters their second retry loop: from this moment, they can make the first attempt of the threads, that has not been successful yet, fail. Therefore, we will look at which retry of which already successful threads could have an impact on which other threads. We can notice that for all n ∈ (cid:74)0, P − 1(cid:75), if the first success of Tn occurs at Sn, then its next n = Sn + 1 + q + r + k, where k ≥ 0. More specifically, thanks attempts will potentially occur at Rk to Equation 2, for all n ≤ f, Rk n = SP +n−f + G n + k. Also, for all k ≤ f − n, (f) n − SP +n−f+k = − (SP +n−f+k − SP +n−f − k) + G(f) Rk n n − SP +n−f+k = G(f−k) Rk n = G(f) n − G , (k) P +n−f+k (3) and this implies that if k > 0, . n (f−k) n SP +n−f+k − Rk−1 We know, by hypothesis, that 0 < G n = 1 − G(f−k) < 1, equivalently 0 < 1 − G (4) < 1. Therefore Equation 3 states that if a thread Tn0 starts a successful attempt at SP +n−f+k, then this thread will make the kth retry of Tn fail, since Tn enters a retry while Tn0 is in a successful retry. And Equation 4 shows that, given a thread Tn0 starting a new retry at SP +n−f+k, the only retry of Tn that can make Tn0 fail on its attempt is the (k − 1)th one. There is indeed only one retry of Tn that can enter a retry before the entrance of Tn0, and exit the retry after it. T0 is the first thread to succeed at S0, because no other thread is in the retry loop at this time. Its next attempt will occur at R0 0, and all thread attempts that start before SP−f (included) cannot fail because of T0, since it runs then the parallel section. Also, since all gaps are positive, the threads T1 to TP−f will succeed in this order, respectively starting at times S1 to SP−f. (f−k) n 10 n Then, using induction, we can show that TP−f+1, . . . , TP−1 succeed in this order, respectively we show that it implies that TP−f+j+1 will succeed at SP−f+j+1. The successful attempt of TP−f+j But for each Tj0, this attempt was precisely the one that could have made TP−f+j+1 fail on its attempt at SP−f+j+1 (explanation of Equation 3). Given that all threads Tn, where n > P − f + j + 1, do not start any retry loop before SP−f+j+1, TP−f+j+1 will succeed at SP−f+j+1. By induction, (Pj) is starting at times SP−f+1, . . . , SP−1. For j ∈(cid:74)0, f − 1(cid:75), let (Pj) be the following property: for all n ∈(cid:74)0, P − f + j(cid:75), Tn starts a successful retry at Sn. We assume that for a given j, (Pj) is true, and at SP−f+j leads, for all j0 ∈(cid:74)0, j(cid:75), to the failure of the j0th retry of Tj−j0 (explanation of Equation 3). true for all j ∈(cid:74)0, f − 1(cid:75). Finally, when TP−1 succeeds, it makes the (f − 1− n)th retry of Tn fail, for all n ∈(cid:74)0, f − 1(cid:75); also . (Naturally, for all n ∈(cid:74)f, P − 1(cid:75), the next We can observe that for all n < P, j ∈(cid:74)0, P − 1 − n(cid:75), and all k ≥ j, Rk−j n+j − Rk n = Sn+j + k − j − (Sn + k) Rk−j n+j − Rk n = G hence for all n ∈(cid:74)1, f(cid:75), Rf−n n − Rf (n) 0 = G n > 0. n − Rf Rf−n As we have as well, for all n ∈(cid:74)f + 1, P − 1(cid:75), R0 the next potentially successful attempt for Tn is at Rf−n potentially successful attempt for Tn is at R0 n.) f, we obtain that among all the threads, 0. Following TP−1, T0 is consequently the next successful the earliest possibly successful attempt is Rf thread in its f th retry. To conclude this part, we can renumber the threads (Tn+1 becoming now Tn if n > 0, and T0 becoming TP−1), and follow the same line of reasoning. The only difference is the fact that TP−1 (according to the new numbering) enters the retry loop f units of time before SP−1, but it does not interfere with the other threads, since we know that those attempts will fail. (f) n = 0. This implies that There remains the case where there exists n ∈(cid:74)0, P − 1(cid:75) such that G (⇒) We prove now the implication by contraposition; we assume that there exists n ∈(cid:74)0, P − 1(cid:75) f = 0, thus we have a well-formed seed. 0 = G(n) n > 0. n > R0 (j) n+j, (5) such that G (f) n > 1 or G n < 0, and show that S is not a well-formed seed. (f) is negative; let n00 be the highest one. We assume first that an f th order gap is negative. As it is a sum of 1st order gaps, then there exists n0 such that G (1) n0 If n00 > 0, then either the threads T0, . . . ,Tn00−1 succeeded in order at their 0th retry, and then Tn00−1 makes Tn00 fail at its 0th retry (we have a seed, hence by definition, Sn00−1 < Sn00, and G (1) n00 < 0, thus Sn00−1 < Sn00 < Sn00−1 + 1 ), or they did not succeed in order at their first try. In both cases, S is not a well-formed seed. i)i∈(cid:74)0,P−1(cid:75), 0 = SP−1 − (q + 1 + f + r). Like S, S0 is a well-formed is negative, and we fall back into the previous case, which shows that S0 is not If n00 = 0, let us assume that S is a well-formed seed. Let also a new seed be S0 = (Ti, S0 where for all n ∈(cid:74)0, P − 2(cid:75), S0 (1) seed; however, G 1 a well-formed seed. This is absurd, hence S is not a well-formed seed. n+1 = Sn, and S0 n+k > 1}, and f0 = min{k ; G (k) those that concern the earliest thread, and among them the one with the lowest order. We assume now that every gap is positive and choose n0 defined by: n0 = min{n ; ∃k ∈ (cid:74)0, P − 1(cid:75) /G n0+k > 1}: among the gaps that exceed 1, we pick Let us assume that threads T0, . . . , TP−1 succeed at their 0th retry in this order, then T0, . . . , Tn0 complete their second successful retry loop at their f th retry, in this order. If this is not the case, then S is not a well-formed seed, and the proof is completed. According to Equation 5, we have, on the one (k) 11 n0+f0 −(cid:0)Rf n0+1−(Rf n0 + 1(cid:1) = G n0 = G n0+1−Rf0 (1) n0+1, thus Rf n0+1−1−Rf0 n0+f0 implying Rf−f0 (f0) hand, Rf0−1 (1) (1) n0 = G n0+1, which implies Rf0 n0 +1) = G n0+1; n0+f0 − 1. As n0+f0 − Rf0 (f0) and on the other hand, R0 n0 = G (f0−1) n0+f0 − G (1) (f0) n0+f0 < 1 by definition of f0 (and n0), we can derive that we know that G n0+1 = G n0 + 1) > Rf−f0 n0 + 1). We have assumed that Tn0 succeeds at its f th retry, which n0+1 − (Rf Rf n0 + 1. The previous inequality states then that Tn0+1 cannot be successful at its f th will end at Rf retry, since either a thread succeeds before Tn0+f0 and makes both Tn0+f0 and Tn0+1 fail, or Tn0+f0 succeeds and makes Tn0+1 fail. We have shown that S is not a well-formed seed. Lemma 2. Assuming r 6= 0, if a new thread is added to an (f, P)-cyclic execution, it will eventually succeed. n0+f0 − (Rf Proof: Let R0 P be the time of the 0th retry of the new thread, that we number TP . If this retry is successful, we are done; let us assume now that this retry is a failure, and let us shift the thread numbers (for the threads T0, . . . , TP−1) so that T0 makes TP fail on its first attempt. We distinguish two cases, (P ) 0 > R0 depending on whether G (P ) 0 > R0 is increasing on (cid:74)0, P − 1(cid:75) and P − S0}. For all k ∈(cid:74)0, n0(cid:75), we have We assume that G that G P − Sk = k + R0 P −(G P − Sk > 0 and Rk P − S0 < 1. Rk This shows that T0, . . . , Tn0, because of their successes at S0, . . . , Sn0, successively make 0th, . . . , 0 retries (respectively) of TP fail. The next attempt for TP is at Rn0+1 nth , which fulfills the following inequality: Rn0+1 0 = 0, hence let n0 = min{n ∈(cid:74)0, P − 1(cid:75) ; G P − S0 or not. P − S0. We know that n 7→ G (n) n < R0 − (Sn0 + 1) < Sn0+1 − (Sn0 + 1) since (k) k + S0 + k) = R0 P − Sk < R0 (k) k hence Rk P − S0− G (n) n (0) P P P Rn0+1 Rn0+1 P − Sn0+1 = (n0 + 1 + R0 − Sn0+1 > 0. P ) − (G (n0+1) n0+1 + S0 + n0 + 1) We consider now the reverse case by assuming that G Tn0+1 should have been the successful thread, but TP starts a retry before Sn0+1, and is therefore succeeding. P − S0. With the previous line of reasoning, we can show that T0, . . . , TP−1, because of their successes at S0, . . . , SP−1, successively make 0th, . . . , (P − 1)th retries (respectively) of TP fail. Then we are back in the same situation when T0 made TP fail for the first time (T0 makes TP fail), except that the success of T0 starts at 0 ≥ r. 0 = q + r + f − P > 0 and q, f and P are integers, we have that G S0 (P ) (P ) (P ) 0 = S0 + G 0 P − S0, which is absurd. S0 makes (P ) By the way, if we had G 0 > r, we would have G (P ) (P ) indeed R0 0 = r. P fail, therefore G 0 We define should be less than 1. Consequently, we are ensured that G 0 ≥ 1 + r > R0 (P ) (P ) 0 < R0 . As G $ k0 = P − S0 R0 r % ; also, for every k ∈(cid:74)1, k0(cid:75), r < R0 P − (S0 + (k0 + 1) × r): the cycle of successes of T0, . . . , TP−1 is executed k0 times. Then the situation is similar to the first case, and TP will succeed. P − (S0 + k × r) and r > R0 Lemma 3. Let S be a weakly-formed seed, and f = f > 1, and if the second success of TP−1 does not occur before the second success of Tf−1, then we can find in the execution a well-formed seed S0 for P threads such that f (S0) = f. (f+1) f (cid:16)(Ti, Si)i∈(cid:74)0,P−2(cid:75) (cid:17). If G Proof: T0 T1 T2 T3 Figure 7: Lemma 3 configuration 12 Let us first remark that, by the definition of a weakly-formed seed, all threads will succeed once, in order. Then two ordered groups of threads will compete for each of the next successes, until Tf−1 succeeds for the second time. second success of Tf−1. Let then S1 and S2 be the two groups of threads that are in competition, defined by Let e be the smallest integer of (cid:74)f, P − 1(cid:75) such that the second success of Te occurs after the S1 = {Tn ; n ∈(cid:74)0, f − 1(cid:75)} S2 = {Tn ; n ∈(cid:74)f, e − 1(cid:75)} ( For all n ∈(cid:74)0, e − 1(cid:75), we note We define σ, a permutation of (cid:74)0, e − 1(cid:75) that describes the reordering of the threads during the round of the second successes, such that, for all (i, j) ∈ (cid:74)0, e − 1(cid:75)2, σ (i) < σ (j) if and only if if Tn ∈ S1 if Tn ∈ S2 rank (n) = (n+1) n (n+1) n − 1 G G rank (i) < rank (j). . We also define a function that will help in expressing the σ−1 (k)'s: (cid:74)f, e − 1(cid:75) (cid:74)0, e − 1(cid:75) −→ m2 : We note that rank(cid:12)(cid:12)(cid:74)0,f−1(cid:75) is increasing, as well as rank(cid:12)(cid:12)(cid:74)f,e−1(cid:75). This shows that #{T' ∈ S2 ; σ (') ≤ 7−→ max {' ∈(cid:74)f, e − 1(cid:75) ; T' ∈ S2 ; σ (') ≤ k} . k} = m2 (k) − (f − 1). Consequently, if Tσ−1(k) ∈ S2, then k m2 (k) = #{T' ∈ S2 ; σ (') ≤ k} + f − 1 = #{T' ∈ S2 ; ' ≤ σ−1 (k)} + f − 1 = σ−1 (k) − f + 1 + f − 1 m2 (k) = σ−1 (k) . in S2, hence σ−1 (k) = k + 1 − (m2 (k) − f + 1) − 1 = f + k − m2 (k) − 1. Conversely, if Tσ−1(k) ∈ S1, among {Tσ(n) ; n ∈(cid:74)0, k(cid:75)}, there are exactly m2 (k) − f + 1 threads In both cases, among {Tσ(n) ; n ∈ (cid:74)0, k(cid:75)}, there are exactly m2 (k) − f + 1 threads in S2, and m1 (k) = k − (m2 (k) − f) threads in S1. We prove by induction that after this first round, the next successes will be, respectively, achieved by Tσ−1(0), Tσ−1(1), . . . , Tσ−1(e−1). In the following, by "kth success", we mean kth success after the first success of TP−1, starting from 0, and the Rj i 's denote the attempts of the second round. Let (PK) be the following property: for all k ≤ K, the kth success is achieved by Tσ−1(k) at Rf+k−σ−1(k) . We assume (PK) true, and we show that the (K +1)th success is achieved by Tσ−1(K+1) σ−1(k) at Rf+K+1−σ−1(K+1) σ−1(K+1) We first show that if Tσ−1(K) ∈ S1, then Rm1(K)−1 m2(K)+1 > Rf+K−σ−1(K) > Rm1(K) m2(K). σ−1(K) (6) . 13 On the one hand, Rf+K−σ−1(K) σ−1(K) Rf+K−σ−1(K) σ−1(K) On the other hand, = K − σ−1 (K) + Rf = K − σ−1 (K) + Rf = K + SP−1 + 1 + G = K + SP−1 + 1 + G σ−1(K) 0 + σ−1 (K) + G (σ−1(K)) (1) 0 + G σ−1(K) (σ−1(K)+1) σ−1(K) . (σ−1(K)) σ−1(K) f + G = (m2 (K) − f) + RK−(m2(K)−f) (m2(K)−f) m2(K) (m2(K)−f) = (m2 (K) − f) + K − (m2 (K) − f) + R0 m2(K) = (m2 (K) − f) + K − (m2 (K) − f) + SP−1 + 1 + (G = K + SP−1 + 1 + G f + G − 1. (m2(K)+1) m2(K) (f+1) f − 1) + G (m2(K)−f) m2(K) Rf+K−m2(K) m2(K) Rf+K−m2(K) m2(K) Therefore, Rf+K−σ−1(K) σ−1(K) − Rm1(K) Rf+K−σ−1(K) σ−1(K) − Rm1(K) −(cid:16) m2(K) = Rf+K−σ−1(K) σ−1(K) (σ−1(K)+1) σ−1(K) m2(K) = rank(cid:16) − Rf+K−m2(K) G − 1(cid:17) σ−1 (K)(cid:17) − rank (m2 (K)) . m2(K) (m2(K)+1) m2(K) = G In a similar way, we can obtain that if Tσ−1(K) ∈ S2, then m1(K) > Rf+K−σ−1(K) Rm2(K) (7) In addition, we recall that if Tσ−1(K) ∈ S2, σ−1 (K) = m2 (K), thus the second inequality of Equation 6 becomes an equality, and if Tσ−1(K) ∈ S1, σ−1 (K) = f + K − m2 (K) − 1, hence the second inequality of Equation 7 becomes an equality. Now let us look at which attempt of other threads Tσ−1(K) made fail. From now on, and until explicitly said otherwise, we assume that Tσ−1(K) ∈ S1. According to Equation 6, we have > Rm2(K)+1 m1(K)−1. σ−1(K) Rm1(K)−1 m2(K)+1 > m2(K)+j − Rm1(K)−1 Rm1(K)−j m2(K)+1 < (j−1) m2(K)+j < G Rf+K−σ−1(K) σ−1(K) m2(K)+j − Rf+K−σ−1(K) Rm1(K)−j Rm1(K)−j m2(K)+j − Rf+K−σ−1(K) σ−1(K) > < < Rm1(K) m2(K) Rm1(K)−j m2(K)+j − Rm1(K) m2(K) (j) m2(K)+j G This holds for every j ∈(cid:74)1, m1 (K)(cid:75), implying j ≤ f, since there could not be more than f threads in S1. Therefore, as by assumptions gaps of at most f th order are between 0 and 1, σ−1(K) 0 < Rm1(K)−j m2(K)+j − Rf+K−σ−1(K) σ−1(K) < 1; 14 showing that the success of Tσ−1(K) makes thread Tm2(K)+j fail on its attempt at Rm1(K)−j j ∈(cid:74)1, m1 (K)(cid:75). Since Tσ−1(K) ∈ S1, σ−1 (K) = m1 (K) − 1. Also, for all j ∈(cid:74)0, f − 1 − m1 (K)(cid:75), m2(K)+j, for all Rm2(K)−j m1(K)+j − Rf+K−σ−1(K) σ−1(K) Rm2(K)−j m1(K)+j − Rf+K−σ−1(K) σ−1(K) =(cid:16) = Rm2(K)−j m1(K)+j − Rm2(K)+1 m1(K)−1 Rm2(K)−j m1(K)−1 + (j + 1) + G (j+1) m1(K)+j = G (cid:17) −(cid:16) m1(K)−1 + (j + 1)(cid:17) Rm2(K)−j (j+1) m1(K)+j . m1(K)+j m2(K)+j m1(K)+j, for all j ∈(cid:74)0, f − 1 − m1 (K)(cid:75), As a result, Tσ−1(K) makes Tm1(K)+j fail on its attempt at Rm2(K)−j and the next attempt will occur at Rm2(K)−j+1 Altogether, the next attempt after the end of the success of Tσ−1(K) for Tm1(K)+j is Rm2(K)−j+1 , for all j ∈(cid:74)1, m1 (K)(cid:75). for j ∈(cid:74)0, f − 1 − m1 (K)(cid:75), and for Tm2(K)+j is Rm1(K)−j+1 Additionally, a thread will begin a new retry loop, the 0th retry being at R0 m2(K)+m1(K)+1 = f+K+1. We note that f + K + 1 could be higher than P − 1, referring to a thread whose number R0 n refers to the jth retry of Trank(n−P +1), after its first is more than P − 1. Actually, if n > P − 1, Rj indices, of S1 ∩ σ−1 ((cid:74)K + 1, e − 1(cid:75)) and S2 ∩ two successes. σ−1 ((cid:74)K + 1, e − 1(cid:75)) will (cid:74)0, f − 1 − m1 (K)(cid:75), thus if someone succeeds in S1, it will be Tm1(K). In the same way, for all j ∈(cid:74)1, m1 (K) + 1(cid:75), (j−1) m2(K)+j > 0, meaning that if someone succeeds in S2, it will be Tm2(K)+1. the two smallest then compete for being successful. Rm1(K)−j+1 m2(K)+j − Rm1(K) Rm2(K)−j+1 m1(K)+j − Rm2(K)+1 m1(K) = G Indeed, within S1, The two heads, (j) m1(K)+j > 0, m2(K)+1 = G for j ∈ m1(K)+j i.e. , Let us compare now those two candidates: m1(K) − Rm1(K) Rm2(K)+1 m2(K)+1 = m2 (K) + 1 − f + SP−1 + m1 (K) + G −(cid:16) −(cid:16) (cid:17) (m1(K)+1) m1(K) f + m2 (K) + 1 − f + G (cid:17) (m2(K)+1−f) m2(K)+1 (m2(K)+1−f) m2(K)+1 m1 (K) + R0 = SP−1 − 1 + G SP−1 + G (m1(K)+1) m1(K) (f+1) f −(cid:16) G − 1 + G m2(K)+1 − 1(cid:17) (m2(K)+2) = G (m1(K)+1) m1(K) m1(K) − Rm1(K) Rm2(K)+1 m2(K)+1 = rank (m1 (K)) − rank (m2 (K) + 1) . By definition, σ−1 (K + 1) is either m1 (K) or m2 (K) + 1 and corresponds to the next successful thread. We can follow the same line of reasoning in the case where Tσ−1(K) ∈ S2 and prove in this way that (PK+1) is true. (P0) is true, and the property spreads until (Pe−1), where all threads of S1 and S2 have been successful, in the order ruled by σ−1, i.e. Tσ−1(0), . . . , Tσ−1(e−1). And before those successes the threads Te−1 =Tσ−1(e−1), . . . , TP−1 have been successful as well. The seed composed of those successes is a well-formed seed. Given a thread, the gap between this thread and the next one in the new order could indeed not be higher than the gap in the previous order with its next thread. Also the f th order gaps remain smaller than 1. And as Te−1 succeeds the second time after f failures, it means that the new seed S00 is such that f (S00) = f. 15 T0 T1 T2 T3 Figure 8: Lemma 4 configuration Lemma 4. Let S be a weakly-formed seed, and f = f > 1 and if the second success of TP−1 occurs before the second success of Tf−1, then we can find in the execution a well-formed seed S0 for P threads such that f (S0) = f. (f+1) f (cid:16)(Ti, Si)i∈(cid:74)0,P−2(cid:75) (cid:17). If G f−1 − SP−1 = G Proof: Until the second success of TP−1, the execution follows the same pattern as in Lemma 3. Actually, the case invoked in the current lemma could have been handled in the previous lemma, but it would have implied tricky notations, when we referred to Trank(n−P +1). Let us deal with this case independently then, and come back to the instant where TP−1 succeeds for the second time. f−1 < 1. For the thread Tσ(j) to succeed at its kth retry after (f) We had 0 < R0 the first success of TP−1 and before Tf−1, it should necessary fill the following condition: j + 1 < f−1. This holds also for the second success of TP−1, which implies that σ(j) − SP−1 < j + 1 + G (f) Rk f−1, where h is the number of failures of TP−1 before its P 0 < SP−1 + 1 + q + r + h − SP−1 < P 0 + G (f) second success and P 0 is the number of successes between the two successes of TP−1. As G (f) f−1 < 1, and q, P 0 and h are non-negative integers, we have r < G To conclude, as any gap at any order is less than the gap between the two successes of TP−1, f−1 and h = P 0 − 1 − q. (f) (1) (n) n = r. With the new thread, the first order gaps are changed by decomposing G 0 formed seed succeeded previously as T0, . . . , TP 0−1. As explained before, for all (k, n) ∈(cid:74)0, P 0 − 1(cid:75)2, which is r < 1, we found a well-formed seed for P 0 threads. Finally any other thread will eventually succeed (see Lemma 2). We can renumber the threads such that TP 0 is the first thread that is not in the well-formed seed to succeed, and the threads of the well- (k) into G n < G (1) (1) 0 . All gaps can only be decreased, hence we have a new well-formed seed for P 0 and the new G G P 0 + 1 threads. We repeat the process until all threads have been encountered, and obtain in the end S0, a well-formed seed with P threads such that f (S0) = P − 1 − q, which is an optimal cyclic execution. Still, as Tf succeeds between two successes of TP−1 that are separated by r, we had, in the initial (1) (f) f < 1, we conclude that f−1 < 1 and G configuration: G (f+1) the lagging time was initially less than 2+ r. By hypothesis, we know that G > 1, which implies f that, before the entry of the new thread, the lagging time was 1 + r. In the final execution with one more thread, the lagging time is r and we have one more success in the cycle, thus f (S0) = f. Theorem 2. Assuming r 6= 0, if a new thread is added to an (f, P − 1)-cyclic execution, then all the threads will eventually form either an (f, P)-cyclic execution, or an (f + 1, P)-cyclic execution. < r. As, in addition, we have both G (P−1−f) P−1 Proof: According to Lemma 2, the new thread will eventually succeed. In addition, we recall that Properties 1 and 2 ensure that before the first success of the new thread, any set of P − 1 16 consecutive successes is a well-formed seed with P − 1 threads. We then consider a seed (we number the threads accordingly, and number the new thread as TP−1) such that the success of the new thread occurs between the success of TP−2 and T0; we obtain in this way a weakly-formed seed S = (Tn, Sn)n∈(cid:74)0,P−1(cid:75)&. We differentiate between two cases. Firstly, if for all n ∈ (cid:74)0, P − 1(cid:75), G < 1, according to Lemma 1, we can find later in the execution a well-formed seed S0 for P threads such that f (S0) = f + 1, hence we reach eventually Let us assume now that this condition is not fulfilled. There exists n0 ∈ (cid:74)0, P − 1(cid:75) such that an (f + 1, P)-cyclic execution. (f+1) > 1. G n0 Then two cases are feasible. If the second success of TP−1 occurs before the second success of Tf−1, then Lemma 3 shows that we will reach an (f, P)-cyclic execution. Otherwise, from Lemma 3, we conclude that an (f, P)-cyclic execution will still occur. > 1. We shift the thread numbers, such that n0 is now f, and we have then G (f+1) f (f+1) n C. Throughput Bounds Firstly we calculate the expression of throughput and the expected number of threads inside the retry loop (that is needed when we gather expansion and wasted retries). Then we exhibit upper and lower bounds on both throughput and the number of failures, and show that those bounds are reached. Finally, we give the worst case on the number of wasted retries. Lemma 5. In an (f, P)-cyclic execution, the throughput is T = P q + r + 1 + f . (8) Proof: By definition, the execution is periodic, and the period lasts q + r + 1 + f units of time. As P successes occur during this period, we end up with the claimed expression. Lemma 6. In an (f, P)-cyclic execution, the average number of threads Prl in the retry loop is given by Prl = P × f + 1 q + r + f + 1 . Proof: Within a period, each thread spends f + 1 units of time in the retry loop, among the q + r + f + 1 units of time of the period, hence the Lemma. Lemma 7. The number of failures is not less than f (-), where ( f (-) = P − q − 1 if q ≤ P − 1 0 otherwise , and accordingly, T ≤ ( P P +r P q+r+1 if q ≤ P − 1 otherwise. (9) Proof: According to Equation 8, the throughput is maximized when the number of failures is minimized. In addition, we have two lower bounds on the number of failures: (i) f ≥ 0, and (ii) P successes should fit within a period, hence q + 1 + f ≥ P. Therefore, if P − 1 − q < 0, T ≤ P/(q + r + 1 + 0), otherwise, T ≤ = P P q + r + 1 + P − 1 − q . P + r Remark 3. We notice that if q > P − 1, the upper bound in Equation 9 is actually the same as the immediate upper bound described in Section III-B1. However, if q ≤ P − 1, Equation 9 refines the immediate upper bound. Lemma 8. The number of failures is bounded by f ≤ f (+) = (P − 1 − q − r) + (cid:18) (cid:22)1 2 q (P − 1 − q − r)2 + 4P 17 (cid:19)(cid:23) , and accordingly, the throughput is bounded by T ≥ P q + r + 1 + f (+) . also have G (P ) n = ' + r. Proof: We show that a necessary condition so that an (f, P)-cyclic execution, whose lagging time is ', exists, is f × (' + r) < P. According to Property 1, any set of P consecutive successes is a well-formed seed with P threads. Let S be any of them. As we have f failures before success, Theorem 1 ensures that for all n ∈(cid:74)0, P − 1(cid:75), G n < 1. We recall that for all n ∈(cid:74)0, P − 1(cid:75), we nX P−1X = f × P−1X On the one hand, we have P−1X (1) j mod P G(f) n = j=n−f+1 G(1) n=0 n=0 (f) G On the other hand, PP−1 n=0 G n n=0 n = f × (' + r). G(f) P−1X n <PP−1 n=0 (f) n=0 1 = P. Altogether, the necessary condition states that f × (' + r) < P, which can be rewritten as f × (q + 1 + f − P + r) < P. The proof is complete since minimizing the throughput is equivalent to maximizing the number of failures. Lemma 9. For each of the bounds defined in Lemmas 7 and 8, there exists an (f, P)-cyclic execution that reaches the bound. Proof: According to Lemmas 7 and 8, if an (f, P)-cyclic execution exists, then the number of failures is such that f (-) ≤ f ≤ f (+). We show now that this double necessary condition is also sufficient. We consider f such that f (-) ≤ f ≤ f (+), and build a well-formed seed S = (Ti, Si)i∈(cid:74)0,P−1(cid:75). For all n ∈(cid:74)0, P − 1(cid:75), we define Si as (cid:18) q + 1 + f − P + r (cid:18) q + 1 + f − P + r We first show that f (S) = f. By definition, f (S) = max (0,dSP−1 − S0 − q − re); we have then Sn = n × (cid:25)(cid:19) (cid:19) (cid:19) + 1 P . (cid:24) (cid:24) (cid:24) (cid:18) (cid:18) (cid:18) 0, 0, 0, f (S) = max = max f (S) = max P + 1 (P − 1) × (P − 1 − q − r) + (q + 1 + f − P + r) − q + 1 + f − P + r f − q + 1 + f − P + r − q − r (cid:25)(cid:19) P . (cid:25)(cid:19) P Firstly, we know that q + 1 + f − P ≥ 0, thus if f = 0, then the second term of the maximum is not positive, and f (S) = 0 = f. Secondly, if f > 0, then according to Lemma 7, (q +1+ f − P + r)/P < 1/f ≤ 1. As we also have (q +1+ f − P + r)/P ≥ 0, we conclude that f (S) =l f − q+1+f−P +r m = f. P 18 G(f) n = Additionally, for all n ∈(cid:74)0, P − 1(cid:75), (  n ×(cid:16) q+1+f−P +r n ×(cid:16) q+1+f−P +r ( = P P Sn − Sn−f − f if n > f Sn − SP +n−f + 1 + q + r otherwise + 1(cid:17) − (n − f) ×(cid:16) q+1+f−P +r + 1(cid:17) − (P + n − f) ×(cid:16) q+1+f−P +r + 1(cid:17) − f + 1(cid:17) + 1 + q + r P = f × q+1+f−P +r −(P − f) − (q + 1 + f − P + r) + f × q+1+f−P +r P + 1 + q + r P P n = f × w + r G(f) P As w ≤ 0 and f ≤ 0, G seed that leads to an (f, P)-cyclic execution. n < 1. Theorem 1 implies that S is a well-formed (f) We have shown that for all f such that f (-) ≤ f ≤ f (+) there exists an (f, P)-cyclic execution; in n > 0. Since f ≤ f (+), G (f) particular there exist an (f (+), P)-cyclic execution and an (f (-), P)-cyclic execution. Corollary 1. The highest possible number of wasted repetitions is l√ P = q + 1. Proof: P − 1m and is achieved when − f (-)(cid:23) . The highest possible number of wasted repetitions w(P) with P threads is given by Let a and h be the functions respectively defined as a(P) = q+1−P +r, which implies a0(P) = −1, Let us first assume that a(P) > 0. In this case, q ≤ P − 1, hence f (-) = 0. We have q (cid:22)1 w(P) = f (+) − f (-) = (cid:18) −a(P) + (cid:19) and h(P) = (−a(P) +pa(P)2 + 4P)/2 − f (-), so that w(P) = bh(P)c. 2pa(P)2 + 4P 2h0(P) = 1 + −2a(P) + 4 2h0(P) = 2 × 2 − a(P) +pa(P)2 + 4P 2pa(P)2 + 4P a(P)2 + 4P 2 Therefore, h0(P) is negative if and only if pa(P)2 + 4P < a(P) − 2. It cannot be true if a(P) < 2. h0(P) = (cid:16) If a(P) ≥ 2, then the previous inequality is equivalent to a(P)2 + 4P < a(P)2 − 4a(P) + 4, which can be rewritten in q + 1 + r < 1, which is absurd. We have shown that h is increasing in ]0, q + 1]. Let us now assume that a(P) ≤ 0. In this case, q > P − 1, hence f (-) = P − q − 1, and /2 − r. Assuming h0(P) to be positive leads to the same absurd inequality q + 1 + r < 1, which proves that h is decreasing on [q + 2, +∞[. Also, the maximum number of wasted repetitions is achieved as P = q + 1 or P = q + 2. Since the maximum number of wasted repetitions is w(q + 1). In addition, √ √ (cid:16)−(r + 1) + (cid:16)−r + r2 + 4P r2 + (cid:17) = h(q + 2), (cid:17) √ 4P (cid:17) > 1 2 r2 + 4P √ (cid:17) 4P < h(q + 1) < √ P − r 2 < h(q + 1) < √ P − 1 ≤ h(q + 1) < 1 2 √ P √ P (cid:17) a(P) +pa(P)2 + 4P (cid:16)−r + h(q + 1) = 1 2 (cid:16)−r + √ 1 2 We conclude that the maximum number of wasted repetitions is l√ P − 1m. 19 V. Expansion and Complete Throughput Estimation A. Expansion Interference of threads does not only lead to logical conflicts but also to hardware conflicts which impact the performance significantly. We model the behavior of the cache coherency protocols which determine the interaction of overlapping Reads and CASs. By taking MESIF [GH09] as basis, we come up with the following assumptions. When executing an atomic CAS, the core gets the cache line in exclusive state and does not forward it to any other requesting core until the instruction is retired. Therefore, requests stall for the release of the cache line which implies serialization. On the other hand, ongoing Reads can overlap with other operations. As a result, a CAS introduces expansion only to overlapping Read and CAS operations that start after it, as illustrated in Figure 4. As a remark, we ignore memory bandwidth issues which are negligible for our study. Furthermore, we assume that Reads that are executed just after a CAS do not experience expansion (as the thread already owns of the data), which takes effect at the beginning of a retry following a failing attempt. Thus, read expansions need only to be considered before the 0th retry. In this sense, read expansion can be moved to parallel section and calculated in the same way as CAS expansion is calculated. To estimate expansion, we consider the delay that a thread can introduce, provided that there is already a given number of threads in the retry loop. The starting point of each CAS is a random variable which is distributed uniformly within an expanded retry. The cost function d provides the amount of delay that the additional thread introduces, depending on the point where the starting point of its CAS hits. By using this cost function we can formulate the expansion increase that each new thread introduces and derive the differential equation below to calculate the expansion of a CAS. Lemma 10. The expansion of a CAS operation is the solution of the following system of equations:  e0 (Prl) = cc × (cid:17) = 0 (cid:16) P e (0) rl cc 2 + e (Prl) rc + cw + cc + e (Prl) , (0) rl where P expansion begins. is the point where Proof: We compute e (Prl + h), where h ≤ 1, by assuming that there are already Prl threads in the retry loop, and that a new thread attempts to CAS during the retry, within a probability h. 20 e (Prl + h) = e (Prl) + h× 0 Z rlw(+) d (t) = e (Prl) + h×(cid:16)Z rc+cw−cc rlw(+) dt d (t) Z rc+cw rlw(+) dt d (t) Z rc+cw+e(Prl) rlw(+) dt d (t) Z rlw(+) rlw(+) dt d (t) = e (Prl) + h×(cid:16)Z rc+cw rc+cw+e(Prl) rc+cw−cc 0 + rc+cw + + rlw(+) dt(cid:17) rlw(+) dt(cid:17) cc t Z rc+cw+e(Prl) rlw(+) dt rc+cw−cc + 2 + e (Prl) × cc e (Prl + h) = e (Prl) + h× cc2 rc+cw This leads to obtain e (Prl + h) − e (Prl) h = e0 (Prl) = cc × rlw(+) 2 + e (Prl) × cc cc2 rlw(+) cc 2 + e (Prl) rc + cw + cc + e (Prl) . . When making h tend to 0, we finally B. Throughput Estimate There remains to combine hardware and logical conflicts in order to obtain the final upper and lower bounds on throughput. We are given as an input an expected number of threads Prl inside the retry loop. We firstly compute the expansion accordingly, by solving numerically the differential equation of Lemma 10. As explained in the previous subsection, we have pw(+) = pw + e, and rlw(+) = rc + cw + e + cc. We can then compute q and r, that are the inputs (together with the total number of threads P) of the method described in Section IV. Assuming that the initialization times of the threads are spaced enough, the execution will superimpose an (f, P)-cyclic execution. Thanks to Lemma 6, we can compute the average number of threads inside the retry loop, that we note by hf(Prl). A posteriori, the solution is consistent if this average number of threads inside the retry loop hf(Prl) is equal to the expected number of threads Prl that has been given as an input. Several (f, P)-cyclic executions belong to the domain of the possible outcomes, but we are interested in upper and lower bounds on the number of failures f. We can compute them through Lemmas 7 and 8, along with their corresponding throughput and average number of threads inside the retry loop. We note by h(+)(Prl) and h(-)(Prl) the average number of threads for the lowest number of failures and highest one, respectively. Our aim is finally to find P , such that h(+)(P . If several solutions exist, then we want to keep the smallest, since the retry loop stops to expand when a stable state is reached. Note that we also need to provide the point where the expansion begins. It begins when we start to have failures, while reducing the parallel section. Thus this point is (2P −1)rlw(-) (resp. (P −1)rlw(-)) for the lower (resp. upper) bound on the throughput. (+) rl and h(-)(P (-) rl and P (+) rl ) = P (-) rl ) = P (-) rl (+) rl 21 Theorem 3. Let (xn) be the sequence defined recursively by x0 = 0 and xn+1 = h(+)(xn). If pw ≥ rc + cw + cc, then (+) rl = lim P n→+∞ xn. Proof: First of all, the average number of threads belongs to ]0, P[, thus for all x ∈ [0, P], 0 < h(+)(x) < P. In particular, we have h(+)(0) > 0, and h(+)(P) < P, which proves that there exist one fixed point for h(+). In addition, we show that h(+) is a non-decreasing function. According to Lemma 6, 1 + f (-) q + r + f (-) + 1 , h(+)(Prl) = P × (cid:23) (cid:22) pw + e where all variables except P depend actually on Prl. We have and r = pw + e rlw(-) + e rlw(-) + e q = − q, hence, if pw ≥ rlw(-), q and r are non-increasing as e is non-decreasing, which is non-decreasing with Prl. Since f (-) is non-decreasing as a function of q, we have shown that if pw ≥ rlw(-), h(+) is a non-decreasing function. Finally, the proof is completed by the theorem of Knaster-Tarski. The same line of reasoning holds for h(-) as well. As a remark, w point out that when pw < rlw(-), we scan the interval of solution, and have no guarantees about the fact that the solution is the smallest one; still it corresponds to very extreme cases. C. Several Retry Loops We consider here a lock-free algorithm that, instead of being a loop over one parallel section and one retry loop, is composed of a loop over a sequence of alternating parallel sections and retry loops. We show that this algorithm is equivalent to an algorithm with only one parallel section and one retry loop, by proving the intuition that the longest retry loop is the only one that fails and hence expands. 1) Problem Formulation: In this subsection, we consider an execution such that each spawned thread runs Procedure Combined in Figure 9. Each thread executes a linear combination of S independent retry loops, i.e. operating on separate variables, interleaved with parallel sections. We note now as rlw(+) parallel section, respectively, for each i ∈ (cid:74)1, S(cid:75). As previously, qi and ri are defined such that the size of a retry of the ith retry loop and the size of the ith i = (qi + ri) × rlw(+) , where qi is a non-negative integer and ri is smaller than 1. and pw(+) pw(+) i i i Procedure Combined 1 Initialization(); 2 while ! done do 3 4 5 6 7 8 for i ← 1 to S do Parallel_Work(i); while ! success do current ← Read(AP[i]); new ← Critical_Work(i,current); success ← CAS(AP, current, new); Figure 9: Thread procedure with several retry loops The Procedure Combined executes the retry loops and parallel sections in a cyclic fashion, so we can normalize the writing of this procedure by assuming that a retry of the 1st retry loop is the longest one. More precisely, we consider the initial algorithm, and we define i0 as 22 i0 = min argmaxi∈(cid:74)1,S(cid:75) rlw(+) i . We then renumber the retry loops such that the new ordering is i0, . . . , S, 1, . . . , i0 − 1, and we add in Initialization the first parallel sections and retry loops on access points from 1 to i0 -- according to the initial ordering. One success at the system level is defined as one success of the last CAS, and the throughput is defined accordingly. We note that in steady-state, all retry loops have the same throughput, so the throughput can be computed from the throughput of the 1st retry loop instead. Lemma 11. Unsuccessful retry loops can only occur in the 1st retry loop. 2) Wasted Retries: Proof: iX i0=1 iX i0=1 We note (tn)n∈[1,+∞[ the sequence of the thread numbers that succeeds in the 1st retry loop, and (sn)n∈[1,+∞[ the sequence of the corresponding time where they exit the retry loop. We notice that by construction, for all n ∈ [1, +∞[, sn < sn+1. Let, for i ∈(cid:74)2, S(cid:75) and n ∈ [1, +∞[, (Pi,n) be the following property: for all i0 ∈(cid:74)2, i(cid:75), and for all n0 ∈(cid:74)1, n(cid:75), the thread Ttn0 succeeds in the ith retry loop at its first attempt. We assume that for a given (i, n), (Pi+1,n) and (Pi,n+1) is true, and show that (Pi+1,n+1) is true. As the threads Ttn and Ttn+1 do not have any failure in the first i retry loops, their entrance time in the i + 1th retry loop is given by sn + (rlw(+) i0 + pw(+) i0 ) + pw(+) i+1 = X1 and sn+1 + (rlw(+) i0 + pw(+) i0 ) + pw(+) i+1 = X2, respectively. Thread Ttn does not fail in the i + 1th retry loop, hence exits at 1 = sn + X2 − sn+1 < X2. i+1 < X1 + rlw(+) X1 + rlw(+) As the previous threads Tn−1, . . . ,T1 exits the ith retry loop before Tn, and next threads Tn0, where n0 > n + 1, enters this retry loop after Tn+1, this implies that the thread Ttn+1 succeeds in the i + 1th retry loop at its first attempt, and (Pi+1,n+1) is true. retry loop since there is no other thread to compete with. Therefore, for all i ∈ (cid:74)2, S(cid:75), (Pi,1) is Regarding the first thread that succeeds in the first retry loop, we know that he successes in any true. Then we show by induction that all (P2,n) is true, then all (P3,n), etc., until all (PS,n), which concludes the proof. Theorem 4. The multi-retry loop Procedure Combined is equivalent to the Procedure Abstract- Algorithm, where pw(+) = pw(+) 1 + i + rlw(+) i and rlw(+) = rlw(+) 1 . (cid:16)pw(+) SX i=2 (cid:17) Proof: According to Lemma 11 there is no failure in other retry loop than the first one; therefore, all retry loops have a constant duration, and can thus be considered as parallel sections. 23 3) Expansion: The expansion in the retry loop starts as threads fail inside this retry loop. When threads are launched, there is no expansion, and Lemma 11 implies that if threads fail, it should be inside the first retry loop, because it is the longest one. As a result, there will be some stall time in the memory accesses of this first retry loop, i.e. expansion, and it will get even longer. Failures will thus still occur in the first retry loop: there is a positive feedback on the expansion of the first retry loop that keeps this first retry loop as the longest one among all retry loops. Therefore, in accordance to Theorem 4, we can compute the expansion by considering the equivalent single-retry loop procedure described in the theorem. VI. Experimental Evaluation We validate our model and analysis framework through successive steps, from synthetic tests, capturing a wide range of possible abstract algorithmic designs, to several reference implementations of extensively studied lock-free data structure designs that include cases with non-constant parallel section and retry loop. A. Setting We have conducted experiments on an Intel ccNUMA workstation system. The system is composed of two sockets, that is equipped with Intel Xeon E5-2687W v2 CPUs with frequency band 1.2-3.4. GHz The physical cores have private L1, L2 caches and they share an L3 cache, which is 25 MB. In a socket, the ring interconnect provides L3 cache accesses and core-to-core communication. Due to the bi-directionality of the ring interconnect, uncontended latencies for intra-socket communication between cores do not show significant variability. Our model assumes uniformity in the CAS and Read latencies on the shared cache line. Thus, threads are pinned to a single socket to minimize non-uniformity in Read and CAS latencies. In the experiments, we vary the number of threads between 4 and 8 since the maximum number of threads that can be used in the experiments are bounded by the number of physical cores that reside in one socket. In all figures, y-axis provides the throughput, which is the number of successful operations completed per millisecond. Parallel work is represented in x-axis in cycles. The graphs contain the high and low estimates (see Section IV), corresponding to the lower and upper bound on the wasted retries, respectively, and an additional curve that shows the average of them. As mentioned before, the latencies of CAS and Read are parameters of our model. We used the methodology described in [DGT13] to measure latencies of these operations in a benchmark program by using two threads that are pinned to the same socket. The aim is to bring the cache line into the state used in our model. Our assumption is that the Read is conducted on an invalid line. For CAS, the state of the cache line could be exclusive, forward, shared or invalid. Regardless of the state of the cache line, CAS requests it for ownership, that compels invalidation in other cores, which in turn incurs a two-way communication and a memory fence afterwards to assure atomicity. Thus, the latency of CAS does not show negligible variability with respect to the state of the cache line, as also revealed in our latency benchmarks. As for the computation cost, the work inside the parallel section is implemented by a dummy for-loop of Pause instructions. B. Synthetic Tests 1) Single retry loop: For the evaluation of our model, we first create synthetic tests that emulate different design patterns of lock-free data structures (value of cw) and different application contexts (value of pw). As described in the previous subsection, in the Procedure AbstractAlgorithm, the 24 Figure 10: Synthetic program cw = 50, threads = 4cw = 50, threads = 6cw = 50, threads = 8cw = 100, threads = 4cw = 100, threads = 6cw = 100, threads = 8cw = 200, threads = 4cw = 200, threads = 6cw = 200, threads = 8cw = 600, threads = 4cw = 600, threads = 6cw = 600, threads = 8cw = 1600, threads = 4cw = 1600, threads = 6cw = 1600, threads = 840006000800010000120004000600080001000012000400060008000100001200050007000900011000500070009000110005000700090001100040006000800040006000800040006000800020003000400020003000400020003000400010001500100015001000150010002000300001000200030004000020004000600001000200030000200040000200040006000010002000300040005000020004000600002500500075001000002500500075001000005000100001500005000100001500020000050001000015000200000100002000030000010000200003000040000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageReal 25 amount of work in both the parallel section and the retry loop are implemented as dummy loops, whose costs are adjusted through the number of iterations in the loop. Generally speaking, in Figure 10, we observe two main behaviors: when pw is high, the data structure is not contended, and threads can operate without failure. When pw is low, the data structure is contended, and depending on the size of cw (that drives the expansion) a steep decrease in throughput or just a roughly constant bound on the performance is observed. The position of the experimental curve between the high and low estimates, depends on cw. It can be observed that the experimental curve mostly tends upwards as cw gets smaller, possibly because the serialization of the CASs helps the synchronization of the threads. Another interesting fact is the waves appearing on the experimental curve, especially when the number of threads is low or the critical work big. This behavior is originating because of the variation of r with the change of parallel work, a fact that is captured by our analysis. Figure 11: Multiple retry loops with 8 threads 2) Several retry loops: We have created experiments by combining several retry loops, each operating on an independent variable which is aligned to a cache line. In Figure 11, results are compared with the model for single retry loop case where the single retry loop is equal to the longest retry loop, while the other retry loops are part of the parallel section. The distribution of fails in the retry loops are illustrated and all throughput curves are normalized with a factor of 175 (to be easily seen in the same graph). Fails per success values are not normalized and a success is obtained after completing all retry loops. C. Treiber's Stack The lock-free stack by Treiber [Tre86] is one of the most studied efficient data structures. Pop and Push both contain a retry loop, such that each retry starts with a Read and ends with CAS on the shared top pointer. In order to validate our model, we start by using Pops. From a stack which is cw1=50cw1=200cw1=400cw1=10000102030400510150.02.55.07.5cw2=50cw2=400cw2=100002000400060000250050007500100000500010000150000100002000030000Parallel Work + Small Retry Loop (cycles)Norm. SuccessFails RL1/SuccessFails RL2/SuccessTotal Fails / SuccessLowHighAverage 26 Figure 12: Pop on Treiber's stack initiated with 50 million elements, threads continuously pop elements for a given amount of time. We count the total number of pop operations per millisecond. Each Pop first reads the top pointer and gets the next pointer of the element to obtain the address of the second element in the stack, before attempting to CAS with the address of the second element. The access to the next pointer of the first element occurs in between the Read and the CAS. Thus, it represents the work in cw. This memory access can possibly introduce a costly cache miss depending on the locality of the popped element. To validate our model with different cw values, we make use of this costly cache miss possibility. We allocate a contiguous chunk of memory and align each element to a cache line. Then, we initialize the stack by pushing elements from contiguous memory either with a single or large stride to disable the prefetcher. When we measure the latency of cw in Pop for single and large stride cases, we obtain the values that are approximately 50 and 300 cycles, respectively. As a remark, 300 cycles is the cost of an L3 miss in our system when it is serviced from the local main memory module. To create more test cases with larger cw, we extended the stack implementation to pop multiple elements with a single operation. Thus, each access to the next element could introduce an additional L3 cache miss while popping multiple elements. By doing so, we created cases in which each thread pops 2, 3, etc. elements, and cw goes to 600, 900, etc. cycles, respectively. In Figure 12, comparison of the experimental results from Treiber's stack and our model is provided. As a remark, we did not implemented memory reclamation for our experiments but one can implement a stack that allows pop and push of multiple elements with small modifications using hazard pointers [Mic04]. Pushing can be implemented in the same way as single element case. A cw = 50, threads = 6cw = 300, threads = 6cw = 600, threads = 6cw = 900, threads = 6cw = 1200, threads = 6cw = 1500, threads = 640006000800010000120002000300040005000600070002000300040001000150020002500300010001500200025001000150020000100020003000400002500500075000500010000150000500010000150002000005000100001500020000250000100002000030000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageReal 27 if t = NULL then return EMPTY; Algorithm 1: Multiple Pop 1 Pop (multiple) 2 while true do 3 4 5 6 7 8 9 10 11 12 13 14 RetireNodes (t, multiple); hp* = t; if top != t then break; hp++; next = t.next; t = Read(top); for multiple do if CAS(&top, t, next) then break; Pop requires some modifications for memory reclamation. It can be implemented by making use of hazard pointers just by adding the address of the next element to the hazard list before jumping to it. Also, the validity of top pointer should be checked after adding the pointer to the hazard list to make sure that other threads are aware of the newly added hazard pointer. By repeating this process, a thread can jump through multiple elements and pop all of them with a CAS at the end. D. Shared Counter In [DLM13], the authors have implemented a "scalable statistics counters" relying on the following idea: when contention is low, the implementation is a regular concurrent counter with a CAS; when the counter starts to be contended, it switches to a statistical implementation, where the counter is actually incremented less frequently, but by a higher value. One key point of this algorithm is the switch point, which is decided thanks to the number of failed increments; our model can be used by providing the peak point of performance of the regular counter implementation as the switch point. We then have implemented a shared counter which is basically a Fetch-and-Increment using a CAS, and compared it with our analysis. The result is illustrated in Figure 13, and shows that the parallel section size corresponding to the peak point is correctly estimated using our analysis. E. DeleteMin in Priority List We have applied our model to DeleteMin of the skiplist based priority queue designed in [LJ13]. DeleteMin traverses the list from the beginning of the lowest level, finds the first node that is not logically deleted, and tries to delete it by marking. If the operation does not succeed, it continues with the next node. Physical removal is done in batches when reaching a threshold on the number of deleted prefixes, and is followed by a restructuring of the list by updating the higher level pointers, which is conducted by the thread that is successful in redirecting the head to the node deleted by itself. We consider the last link traversal before the logical deletion as critical work, as it continues with the next node in case of failure. The rest of the traversal is attributed to the parallel section as the threads can proceed concurrently without interference. We measured the average cost of a traversal under low contention for each number of threads, since traversal becomes expensive with 28 (a) 4 threads (b) 6 threads (c) 8 threads Figure 13: Increment on a shared counter more threads. In addition, average cost of restructuring is also included in the parallel section since it is executed infrequently by a single thread. We initialize the priority queue with a large set of elements. As illustrated in Figure 14, the smallest pw value is not zero as the average cost of traversal and restructuring is intrinsically included. The peak point is in the estimated place but the curve does not go down sharply under high contention. This presumably occurs as the traversal might require more than one steps (link access) after a failed attempt, which creates a back-off effect. F. Enqueue-Dequeue on a Queue In order to demonstrate the validity of the model with several retry loops, and that the results covers a wider spectrum of application and designs from the ones we focused in our model, we studied the following setting: the threads share a queue, and each thread enqueues an element, executes the parallel section, dequeues an element, and reiterates. We consider the queue implementation by Michael and Scott [MS96], that is usually viewed as the reference queue while looking at lock-free queue implementations. Dequeue operations fit immediately into our model but Enqueue operations need an adjustment due to the helping mechanism. Note that without this helping mechanism, a simple queue implementation would fit directly, but we also want to show that the model is malleable, i.e. the fundamental behavior remains unchanged even if we divert slightly from the initial assumptions. We consider an equivalent execution that catches up with the model, and use it to approximate the performance of the actual execution of Enqueue. cw = 0, threads = 450001000015000010002000300040005000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageRealcw = 0, threads = 6400080001200016000020004000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageRealcw = 0, threads = 850007500100001250015000020004000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageReal 29 (a) 4 threads (b) 6 threads (c) 8 threads Figure 14: DeleteMin on a priority list Enqueue is composed of two steps. Firstly, the new node is attached to the last node of the queue via a CAS, that we denote by CASA, leading to a transient state. Secondly, the tail is redirected to point to the new node via another CAS, that we denote by CASB, which brings back the queue into a steady state. A new Enqueue can not proceed before the two steps of previous success are completed. The first step is the linearization point of operation and the second step could be conducted by a different thread through the helping mechanism. In order to start a new Enqueue, concurrent Enqueues help the completion of the second step of the last success if they find the queue in the transient state. Alternatively, they try to attach their node to the queue if the queue is in the steady state at the instant of check. This process continues until they manage to attach their node to the queue via a retry loop in which state is checked and corresponding CAS is executed. The flow of an Enqueue is determined by this state checks. Thus, an Enqueue could execute multiple CASB (successful or failing) and multiple CASA (failing) in an interleaved manner, before succeeding in CASA at the end of the last retry. If we assume that both states are equally probable for a check instant which will then end up with a retry, the number of CAS s that ends up with a retry are expected to be distributed equally among CASA and CASB for each thread. In addition, each thread has a successful CASA (which linearizes the Enqueue) and a CASB at the end of the operation which could either be successful or failed by a concurrent helper thread. We imitate such an execution with an equivalent execution in which threads keep the same relative ordering of the invocation, return from Enqueue together with same result. In equivalent execution, threads alternate between CASA and CASB in their retries, and both steps of successful operation is cw = 50, threads = 425005000750010000125001000200030004000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageRealcw = 50, threads = 650007500100001250010002000300040005000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageRealcw = 50, threads = 85000750010000125002000400060008000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageReal 30 (a) 4 threads (b) 6 threads (c) 8 threads Figure 15: Enqueue-Dequeue on Michael and Scott queues conducted by the same thread. The equivalent execution can be obtained by thread-wise reordering of CAS s that leads to a retry and exchanging successful CASB s with the failed counterparts at the end of an Enqueue, as the latter ones indeed fail because of this success of helper threads. The model can be applied to this equivalent execution by attributing each CASA-CASB couple to a single iteration and represent it as a larger retry loop since the successful couple can not overlap with another successful one and all overlapping ones fail. With a straightforward extension of the expansion formula, we accomodate the CASA in the critical work which can also expand, and use CASB as the CAS of our model. In addition, we take one step further outside the analysis by including a new case, where the parallel section follows a Poisson distribution, instead of being constant. pw is chosen as the mean to generate Poisson distribution instead of taking it constant. The results are illustrated in Figure 15. Our model provides good estimates for the constant pw and also reasonable results for the Poisson distribution case, although this case deviates from (/extends) our model assumptions. The advantage of regularity, which brings synchronization to threads, can be observed when the constant and Poisson distributions are compared. In the Poisson distribution, the threads start to fail with larger pw, which smoothes the curve around the peak of the throughput curve. G. Discussion In this subsection we discuss the adequacy of our model, specifically the cyclic argument, to capture the behavior that we observe in practice. Figure 16 illustrates the frequency of occurrence of cw = 225, threads = 42000400060000200040006000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageConstantPoissoncw = 225, threads = 63000400050006000700002000400060008000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageConstantPoissoncw = 225, threads = 82000300040005000600070008000030006000900012000Parallel Work (cycles)Throughput (ops/msec)CaseLowHighAverageConstantPoisson 31 Figure 16: Consecutive Fails Frequency a given number of consecutive fails, together with average fails per success values and the throughput values, normalized by a constant factor so that they can be seen on the graph. In the background, the frequency of occurrence of a given number of consecutive fails before success is presented. As a remark, the frequency of 6+ fails is gathered with 6. We expect to see a frequency distribution concentrated around the average fails per success value, within the bounds computed by our model. While comparing the distribution of failures with the throughput, we could conjecture that the bumps come from the fact that the failures spread out. However, our model captures correctly the throughput variations and thus strips down the right impacting factor. The spread of the distribution of failures indicates the violation of a stable cyclic execution (that takes place in our model), but in these regions, r actually gets close to 0, as well as the minimum of all gaps. The scattering in failures shows that, during the execution, a thread is overtaken by another one. Still, as gaps are close to 0, the imaginary execution, in which we switch the two thread IDs, would create almost the same performance effect. This reasoning is strengthened by the fact that the actual average number of failures follows the step behavior, predicted by our model. This shows that even when the real execution is not cyclic and the distribution of failures is not concentrated, our model that results in a cyclic execution remains a close approximation of the actual execution. H. Back-Off Tuning Together with the analysis comes a natural back-off strategy: we estimate the pw corresponding to the peak point of the average curve, and when the parallel section is smaller than the corresponding cw = 4000, threads = 602468010000200003000040000Parallel Work (cycles)0.250.500.75Consecutive Fail FrequencyCaseAv. Fails per SuccessModel AverageNormalized Throughput 32 (a) 8 threads (b) 4 threads Figure 17: Comparison of back-off schemes for Poisson Distribution pw, we add a back-off in the parallel section, so that the new parallel section is at the peak point. We have applied exponential, linear and our back-off strategy to the Enqueue/Dequeue experiment specified above. Our back-off estimate provides good results for both types of distribution. In Figure 17 (where the values of back-off are steps of 115 cycles), the comparison is plotted for the Poisson distribution, which is likely to be the worst for our back-off. Our back-off strategy is better than the other, except for very small parallel sections, but other back-off strategies should be tuned for each value of pw. We obtained the same shapes while removing the distribution law and considering constant values. The results are illustrated in Figure 18. (a) 8 threads (b) 4 threads Figure 18: Comparison of back-off schemes for constant pw cw = 225, threads = 8300040005000600070000250050007500Parallel Work (cycles)Throughput (ops/msec)TypeExponentialLinearNewNoneValue012481632cw = 225, threads = 420004000600080001000010002000300040005000Parallel Work (cycles)Throughput (ops/msec)TypeExponentialLinearNewNoneValue012481632cw = 225, threads = 8300040005000600070000250050007500Parallel Work (cycles)Throughput (ops/msec)TypeExponentialLinearNewNoneValue012481632cw = 225, threads = 4200040006000800010002000300040005000Parallel Work (cycles)Throughput (ops/msec)TypeExponentialLinearNewNoneValue012481632 33 VII. Conclusion In this paper, we have modeled and analyzed the performance of a general class of lock-free algorithms, and have so been able to predict the throughput of such algorithms, on actual executions. The analysis rely on the estimation of two impacting factors that lower the throughput: on the one hand, the expansion, due to the serialization of the atomic primitives that take place in the retry loops; on the other hand, the wasted retries, due to a non-optimal synchronization between the running threads. We have derived methods to calculate those parameters, along with the final throughput estimate, that is calculated from a combination of these two previous parameters. As a side result of our work, this accurate prediction enables the design of a back-off technique that performs better than other well-known techniques, namely linear and exponential back-offs. As a future work, we envision to enlarge the domain of validity of the model, in order to cope with data structures whose operations do not have constant retry loop, as well as the framework, so that it includes more various access patterns. The fact that our results extend outside the model allows us to be optimistic on the identification of the right impacting factors. Finally, we also foresee studying back-off techniques that would combine a back-off in the parallel section (for lower contention) and in the retry loops (for higher robustness). References [AF92] [ACS14] Dan Alistarh, Keren Censor-Hillel, and Nir Shavit. Are lock-free concurrent algorithms practically wait- free? In David B. Shmoys, editor, Symposium on Theory of Computing (STOC), pages 714 -- 723. ACM, June 2014. Juan Alemany and Edward W. Felten. Performance issues in non-blocking synchronization on shared- memory multiprocessors. In Norman C. Hutchinson, editor, Proceedings of the ACM Symposium on Principles of Distributed Computing (PoDC), pages 125 -- 134. ACM, 1992. [ARJ97] James H. Anderson, Srikanth Ramamurthy, and Kevin Jeffay. Real-time computing with lock-free shared objects. ACM Transactions on Computer Systems (TOCS), 15(2):134 -- 165, 1997. [DB08] Kristijan Dragicevic and Daniel Bauer. A survey of concurrent priority queue algorithms. In Proceedings of the International Parallel and Distributed Processing Symposium (IPDPS), pages 1 -- 6, April 2008. [GH09] [DGT13] Tudor David, Rachid Guerraoui, and Vasileios Trigonakis. Everything you always wanted to know about synchronization but were afraid to ask. In Michael Kaminsky and Mike Dahlin, editors, Proceedings of the ACM Symposium on Operating Systems Principles (SOSP), pages 33 -- 48. ACM, November 2013. [DLM13] Dave Dice, Yossi Lev, and Mark Moir. Scalable statistics counters. In Guy E. Blelloch and Berthold Vöcking, editors, Proceedings of the ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 43 -- 52. ACM, July 2013. James R. Goodman and Herbert Hing Jing Hum. Mesif: A two-hop cache coherency protocol for point-to- point interconnects. Technical report, University of Auckland, November 2009. [HSY10] Danny Hendler, Nir Shavit, and Lena Yerushalmi. A scalable lock-free stack algorithm. Journal of Parallel and Distributed Computing (JPDC), 70(1):1 -- 12, 2010. Intel. Lock scaling analysis on Intel R(cid:13) Xeon R(cid:13) processors. Technical Report 328878-001, Intel, April 2013. [Int13] [KH14] Alex Kogan and Maurice Herlihy. The future(s) of shared data structures. In Magnús M. Halldórsson and Shlomi Dolev, editors, Proceedings of the ACM Symposium on Principles of Distributed Computing (PoDC), pages 30 -- 39. ACM, July 2014. Jonatan Lindén and Bengt Jonsson. A skiplist-based concurrent priority queue with minimal memory contention. In Roberto Baldoni, Nicolas Nisse, and Maarten van Steen, editors, Proceedings of the International Conference on Principle of Distributed Systems (OPODIS), volume 8304 of Lecture Notes in Computer Science, pages 206 -- 220. Springer, December 2013. [Mic04] Maged M. Michael. Hazard pointers: Safe memory reclamation for lock-free objects. IEEE Transactions [LJ13] on Parallel and Distributed Systems (TPDS), 15(6):491 -- 504, 2004. [MS96] Maged M. Michael and Michael L. Scott. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In James E. Burns and Yoram Moses, editors, Proceedings of the ACM Symposium on Principles of Distributed Computing (PoDC), pages 267 -- 275. ACM, May 1996. Nir Shavit and Itay Lotan. Skiplist-based concurrent priority queues. In Proceedings of the International Parallel and Distributed Processing Symposium (IPDPS), pages 263 -- 268, May 2000. [SL00] [Tre86] R. Kent Treiber. Systems programming: Coping with parallelism. International Business Machines Incorporated, Thomas J. Watson Research Center, 1986. [Val94] J. D. Valois. Implementing Lock-Free Queues. In Proceedings of International Conference on Parallel and Distributed Systems (ICPADS), pages 64 -- 69, December 1994. 34
1704.03664
3
1704
2018-11-26T13:15:28
Approximating Optimization Problems using EAs on Scale-Free Networks
[ "cs.DS", "cs.NE", "cs.SI" ]
It has been observed that many complex real-world networks have certain properties, such as a high clustering coefficient, a low diameter, and a power-law degree distribution. A network with a power-law degree distribution is known as scale-free network. In order to study these networks, various random graph models have been proposed, e.g. Preferential Attachment, Chung-Lu, or Hyperbolic. We look at the interplay between the power-law degree distribution and the run time of optimization techniques for well known combinatorial problems. We observe that on scale-free networks, simple evolutionary algorithms (EAs) quickly reach a constant-factor approximation ratio on common covering problems We prove that the single-objective (1+1)EA reaches a constant-factor approximation ratio on the Minimum Dominating Set problem, the Minimum Vertex Cover problem, the Minimum Connected Dominating Set problem, and the Maximum Independent Set problem in expected polynomial number of calls to the fitness function. Furthermore, we prove that the multi-objective GSEMO algorithm reaches a better approximation ratio than the (1+1)EA on those problems, within polynomial fitness evaluations.
cs.DS
cs
Approximating Optimization Problems using EAs on Scale-Free Networks Ankit Chauhan, Tobias Friedrich, and Francesco Quinzan Hasso Plattner Institute, Potsdam, Germany Abstract. It has been observed that many complex real-world networks have certain prop- erties, such as a high clustering coefficient, a low diameter, and a power-law degree dis- tribution. A network with a power-law degree distribution is known as scale-free network. In order to study these networks, various random graph models have been proposed, e.g. Preferential Attachment, Chung-Lu, or Hyperbolic. We look at the interplay between the power-law degree distribution and the run time of op- timization techniques for well known combinatorial problems. We observe that on scale-free networks, simple evolutionary algorithms (EAs) quickly reach a constant-factor approxima- tion ratio on common covering problems We prove that the single-objective (1 + 1) EA reaches a constant-factor approximation ratio on the Minimum Dominating Set problem, the Minimum Vertex Cover problem, the Minimum Connected Dominating Set problem, and the Maximum Independent Set problem in expected polynomial number of calls to the fitness function. Furthermore, we prove that the multi-objective Gsemo algorithm reaches a better approxi- mation ratio than the (1 + 1) EA on those problems, within polynomial fitness evaluations. Keywords: Evolutionary algorithms, covering problems, power-law bounded networks. 1 Introduction Bio-inspired randomized search heuristics, such as evolutionary algorithms, are well-suited to ap- proach combinatorial optimization problems. These algorithms have been extensively analyzed on artificial pseudo-Boolean functions (see e.g. Droste et al. [1], and Jansen and Wegener [2]) as well as on some combinatorial optimization problems (see e.g. Giel and Wegener [3], Neumann [4], and Neumann and Wegener [5]). The standard approach to perform theoretical analyses is the average-case black-box complexity: The run time is estimated by counting the expected number of calls to the valuation oracle or fitness function. In recent years, a significant effort has been made to study the run time of EAs on combinatorial optimization problems. The performance of single-objective population-based EAs on the Minimum Vertex Cover problem is studied in Oliveto et al. [6,7]. They show that these algorithms achieve arbitrarily bad approximation guarantee on this problem. In contrast, Friedrich et al. [8] prove that multi-objective EAs can obtain an optimal solution in expected polynomial time on this instance. Back et al. [9] study the performance of a simple a single-objective evolutionary algorithm for the Maximum Independent set problem and claim its superiority by experimental observations. Similarly, Peng [10] analyzes a single objective EA on this problem and proves that it reaches a ((∆(G) + 1)/2)-approximation within expected O(cid:0)n4(cid:1) fitness evaluations, where n is the number of nodes in a given graph G, and ∆(G) its maximum node degree. These analyses, as well as those for the Minimum Vertex Cover problem, do not require any assumptions on the topology of G. Power-law bounded networks. A wide range of real-world networks, such as the internet graph, the web, power grids, protein-protein interaction graphs, and social networks exhibit properties such as high clustering coefficient (see Kumar et al. [11]), small diameter (see Leskovech et al. [12]), and approximate power-law degree distribution (see Faolutsos et al. [13]). Various models have been proposed to capture, and possibly explain, these properties (see e.g. Newman [14] and Watts and Strogatz [15]). 2 One of the most significant contributions in this sense is that of Brach et al. [16]. Many real- world networks approximately exhibit a power-law degree distribution. That is, the number of nodes of degree k is approximately proportional to k−β, for k sufficiently large, where β > 1 is a constant inherent to the network. Networks with this property are commonly referred to as scale- free. Brach et al. [16] define a deterministic condition that captures the behavior of the degree distribution of such networks. This condition requires an upper-bound on the number of nodes with degree δ(v) ∈(cid:2)2i, 2i+1(cid:1), for all i = 0, · · · , ⌊log(n)−1⌋+1. This property is commonly referred to as PLB. Carrying out run time analysis of EAs on networks that exhibit this property may give a better understanding of their performance in practice. Our contribution. We study various well-known NP-hard graph covering problems, and prove that simple EAs perform well, if the underlying graph exhibits the PLB property. Specifically, we study the Minimum Dominating Set problem, the Minimum Vertex Cover problem, the Maximum Independent Set problem, and the minimum Connected Dominating Set problem. We prove that for these problems a single-objective EA reaches a constant-factor approximation ratio within expected polynomial fitness evaluations. We prove that a multi-objective EA reaches a better approximation guarantee, given more time budget. The paper is organized as follows. In Section 2 we define the algorithms and give some basic definitions and technical tools. In Section 4 we study the Minimum Dominating Set problem, both in the single- and multi-objective case. The results for the Minimum Vertex Cover problem follows directly from the analysis for the Minimum Dominating Set problem and are presented in Section 4. The Minimum Connected Dominating Set problem is discussed in Section 6. We conclude with the analysis for the Maximum Independent Set problem, in Section 7. 2 Preliminaries In this paper, we only study undirected graphs G = (V, E) without loops, where V is the set of nodes and E is the set of edges. We always use n to denote V and m to denote E. We use δ(v) to denote the degree of each node v ∈ V , and we let ∆(G) be the maximum degree of G. Moreover, given a pseudo-Boolean array x we denote with x1 the number of ones in the input string. Otherwise, we use the well-known mathematical and graph theoretic notations, e.g., we use A to denote the size of any set A. We use the following definition of ǫ-approximation. Definition 1. Consider a problem P on a graph G = (V, E) let U be a possible solution, and denote with opt an optimal solution of P. If P is a minimization problem, we say that U is an ǫ-approximation if it holds that U / opt ≤ ǫ. If P is a maximization problem, we say that U is an ǫ-approximation if it holds that opt / U ≤ ǫ. We consider both single- and multi-objective optimization. Whereas in the single-objective case the algorithm searches for the global optimum, in the latter the algorithm searches for a set of optimal solutions. Such solutions are part of the Pareto front. Consider any two points x′ = (x′ 1, . . . , x′ Rm. We say that x′ dominates x′′, in symbols x′ ≻ x′′, if it holds that x′ With this notion of dominance, we define the Pareto front as follows. m) and x′′ = (x′′ 1 , . . . , x′′ m) in the m-dimensional space i for all i = 1, . . . , m. i ≥ x′′ Definition 2. Consider a function f : X ⊆ Rn → Rm, with X being a compact set in the metric space Rn. Consider the set Y := {y ∈ Rm y = f (x), x ∈ X}, and denote with ≻ the standard partial order on Y . The Pareto front is defined as P(Y ) = {y′ ∈ Y {y′′ ≻ y′, y′′ 6= y′} = ∅}. 2.1 Algorithms The (1+1) EA is a randomized local search heuristic inspired by the process of biological evolution (cf. Algorithm 1). Initially, an individual x is sampled uniformly at random (u.a.r.). An offspring y is then generated, by flipping all bits of x independently with probability 1/n. The fitness values 3 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 // perform mutation create offspring y by flipping each bit of x independently w.p. 1/n; // perform selection if f (y) ≤ f (x) then x ← y; return x; Algorithm 2: The Gsemo. input: a fitness function f : 2V → R≥0; output: an (approximate) global minimum of the function f ; // sample initial solution choose x ∈ {0, 1}n uniformly at random; P ← P ∪ {x}; while convergence criterion not met do // perform mutation choose x ∈ P uniformly at random; create y by flipping each bit of x independently w.p. 1/n; // perform selection if f (y) is not dominated by f (z), for all points z ∈ P then P ← P ∪ {y}; delete all solutions z ∈ P s.t. f (z) is dominated by f (y); return P ; of x and y are then compared. If the value f (y) is less than or equal to f (x), then x is discarded and y is preserved in memory; otherwise y is discarded and x is preserved in memory. Note that this algorithms are defined for minimization problems. However, symmetric definitions hold for maximization problems. The Gsemo is a multi-objective evolutionary algorithm (cf. Algorithm 2). As in the case of the (1 + 1) EA, an initial solution is chosen u.a.r. from the objective space and stored it in the Pareto front P . An element x is then chosen u.a.r. from P and a new solution y is generated by flipping each bit of x independently w.p. 1/n. If y is not strongly dominated by any other solution in P , then y is stored in the Pareto front, and all elements which are strongly dominated by y are discarded. Otherwise, the population remains unchanged. 2.2 The Multiplicative Drift theorem. In the case of the (1 + 1) EA, for any fitness function f : {0, 1}n → R≥0, we describe its run time as a Markov chain {Xt}t≥0, where Xt is the f -value reached at time step t. Following this convention, we perform parts of the analyses with the Multiplicative Drift Theorem (see Doerr et 4 al. [17]), a strong tool to analyze the run time of evolutionary algorithms such as the (1 + 1) EA. Intuitively, this theorem gives an estimate for the expected value of the run time of the (1 + 1) EA, provided that the change of the average value of the process {Xt}t≥0 is within a multiplicative factor of the previous solution. More formally, the following theorem holds. Theorem 3 (Multiplicative Drift). Let S ⊆ R be a finite set of positive numbers with minimum smin. Let {X (t)}t∈N be a random variables over S ∪ {0}. Let T be the random variable that denotes the first point in time t ∈ N for which X (t) = 0. Suppose that there exists a real number δ > 0 such that holds for all s ∈ S with P r[X (t) = s] > 0. Then for all s0 ∈ S with P r[X (0) = s0] > 0, we have E[X (t) − X (t+1) X (t) = s] ≥ δs E[T X (0) = s0] ≤ 1 + ln(s0/smin) δ . A proof of this result is given in Doerr et al. [17, Theorem 3]. 3 Power-Law Bounded Networks In many real-world networks the degree distribution approximately follows a power-law. We frame this concept with the following definitions (see Brach et al. [16]). Definition 4 (PLB Network). An undirected graph G = (V, E) is a power-law bounded network, if there exists parameters 1 < β = O(1) and t ≥ 0 s.t. the number of nodes v with δ(v) ∈ [2d, 2d+1) is at most c1n(t + 1)β−1 2d+1−1 (i + t)−β, Xi=2d for all d ≥ 0, and with c1 > 0 a universal constant. Definition 4 intuitively captures the general idea that vertices with bounded degree can be grouped into sets with cardinality upper-bounded by a power-law. Again, we remark that this property is deterministic. We say a graph is a PLB networks if it is power-law bounded as in Definition 4. We prove that PLB networks have the property that feasible solutions of various covering prob- lems yield a constant-factor approximation ratio. To this end, we consider the following definition. Definition 5. Consider an undirected graph G = (V, E). We say that a set D ⊆ V is dominating if every node of V \ D is adjacent to at least one node of D. Dominating sets play an important role in our analysis, because the sum of the degree of their nodes always yields constant-factor approximation with respect (w.r.t.) to their cardinality, on PLB networks with bounded parameters β, t. More formally, the following lemma holds. Lemma 6. Let G = (V, E) be a PLB network with parameters 2 < β = O (1), t ≥ 0, and a universal constant c1. Denote with D a dominating set of G. Define the constants a := Then it holds β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 Pv∈D(δ(v) + 1) D and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) ≤ 2ab + 1 = Θ (1) . 5 Proof Define the following constants d≥k := {v ∈ V : δ(v) ≥ k} and γ := min{k ∈ N : d≥k ≤ D}. Then d≥k is the number of nodes of G with degree at least k, and γ is the smallest index k by which the nodes of G with degree at least 2k is at most D. We first prove an upper-bound on the numerator, in terms of γ. From Definition 5 it holds ⌈log(n−1)⌉ 2j+1−1 δ(v) ≤ c1n(t + 1)β−1 Xv∈D ≤ 2c1n(t + 1)β−1 2j+1 (i + t)−β Xi=2j 2⌈log(n−1)⌉+1−1 (i + t)1−β Xj=γ Xi=2γ ≤ 2c1n(t + 1)β−1Z 2⌈log(n−1)⌉+1−1 ≤ 2c1n(t + 1)β−1 (2γ + t)2−β 2γ . β − 2 (x + t)1−βdx (1) We continue by computing a lower-bound on D in terms of γ. Again, from Definition 5 we have that it holds 2⌈log(n−1)⌉+1−1 D ≥ nγ = c1n(t + 1)β−1 (i + t)−β Xi=2γ ≥ c1n(t + 1)β−1Z 2γ+1 1 −(cid:16) t+2 ≥ c1n(t + 1)β−1 2γ t+1(cid:17)1−β β − 1 (x + t)−βdx (2γ + t)1−β. (2) We combine the upper-bound on the numerator Pv∈D δ(v) + 1 given in (1), together with the lower bound on D as in (2), to obtain that it holds Pv∈D(δ(v) + 1) D ≤ 2 β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 (2γ + t) + 1. (3) We conclude by giving an upper-bound for 2γ + t. From the definition of dominating set (see Definition 5) it holds Pv∈D δ(v) ≥ n/2. Combining this observation with (1), it holds n 2 ≤ 2c1n(t + 1)β−1 (2γ + t)2−β , β − 2 from which it follows that 2γ + t ≤(cid:20)4c1 (t + 1)β−1 β − 2 1 β−2 . (cid:21) The claim follows by substituting (4) in (3). (4) (cid:3) Note that Lemma 6 uses a parameter β > 2. From a practical point of view this assumption is not restrictive, since most real-world networks fulfill this requirement. However, for β < 2 one may define a degenerate PLB network for which our analysis fails. Lemma 6 can be readily used used to prove approximation guarantees for the Minimum Domi- nating Set problem - i.e. the problem of searching for a minimum dominating set. In the following, 6 however, we show that this lemma can be used to derive approximation guarantees for other common covering problems. Given a graph G = (V, E), a connected dominating set is any dominating set C ⊆ V s.t. the nodes of C induce a connected sub-graph of G. From Lemma 6 the following result readily follows. Corollary 7. Let G = (V, E) be a PLB network with parameters 2 < β = O (1), t ≥ 0, and a universal constant c1. Denote with C a connected dominating set of G. Define the constants β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) a := Then it holds Pv∈C (δ(v) + 1) C ≤ 2ab + 1 = Θ (1) . Finally, we apply Lemma 6 to independent sets. Given a graph G = (V, E), an independent set M ⊆ V consists of vertices of G, no two of which are adjacent. A maximum independent set is any independent set of maximum size. It is not true, in general, that an independent set is a dominating set. However, a maximum independent set is always a dominating set. Hence, the following corollary holds. Corollary 8. Let G = (V, E) be a PLB network with parameters 2 < β = O (1), t ≥ 0, and a universal constant c1. Denote with M∗ a maximum independent set of G. Define the constants β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) a := Then it holds Pv∈M∗ (δ(v) + 1) M∗ ≤ 2ab + 1 = Θ (1) . 4 The Minimum Dominating Set Problem We study the minimum dominating set problem (MDS): For a given graph G = (V, E), find a dominating set of V (see Definition 5) of minimum cardinality. In this section, we denote with opt any optimal solution to the MDS. Given a graph G = (V, E) with V = n, we consider an indexing i : V → {1, . . . , n} of the vertices. We represent any set of nodes S ⊆ V with a pseudo-Boolean array (x1, . . . , xn) of length n and s.t. xi = 1 if and only if the i-th node of G is in S. 4.1 Single-objective optimization. We search for a minimum dominating set by minimizing the following single-objective function F (x) = nu(x) + x1, (5) where u(x) is the number of non-dominated nodes, and x1 is the number of 1s in the input string. Note that u(x) = 0 if and only if the solution x is a dominating set. We prove the main result of this section, by giving an upper-bound on the run time of the (1 + 1) EA until a dominating set is found. We then use Lemma 6 to give an upper-bound on the approximation ratio achieved by this solution. Theorem 9. Let G = (V, E) be a PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants 7 a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the (1 + 1) EA finds a (2ab + 1)-approximation of the MDS after expected O (n log n) fitness evaluations. In particular, the (1 + 1) EA is a Θ(1)-approximation algorithm for the MDS on PLB networks. Proof We first observe that because of the weights on the fitness, the algorithm initially searches for a dominating set and then tries to minimize it. Furthermore, no step that reduces the number of dominated nodes is accepted. We estimate the expected run time until a feasible solution is found, and conclude by proving that any feasible solution reaches the desired approximation guarantee. To estimate the run time we use the Multiplicative Drift theorem (see Theorem 3), by defining {X (t)}t≥0 as the process X (t) = u(xt) for all t ≥ 0. Suppose that the current solution xt is not a dominating set - i.e. u(xt) > 0. Then there exists a node v ∈ V s.t. by adding it to the current solution, the fitness u(xt) decreases by 1. Since the probability of performing a single chosen bit-flip is at least 1/en, then it holds E[Xt − Xt−1 Xt] ≥ Xt en . Following the notation of Theorem 3, we can trivially set S = {1, . . . , n} and obtain that the run time until a feasible solution is found is upper-bounded as O (n log n). We conclude by proving that the (1 + 1) EA reaches the desired approximation guarantee. Denote with x∗ the first dominating set reached by the (1 + 1) EA. We observe that any optimal solution opt dominates all nodes of G. It follows that it holds x∗ opt ≤ Pv∈opt(δ(v) + 1) opt ≤ 2ab + 1, where the last inequality in 6 follows from Lemma 6. The claim follows. (6) (cid:3) 4.2 Multi-objective optimization. We approach MDS with the multi-objective Gsemo (cf. Algorithm 2). In this case, we use the following bi-objective fitness function f = (u(x), x1), (7) where u(x) is the number of non-dominated nodes, and x1 the number of 1s in the input string. We prove that the Gsemo fins a good approximation of the MDS in polynomial time, when optimizing a fitness as in (7). Useful in the analysis is the following lemma. Lemma 10. Let G = (V, E) be a graph, and let Sk := {v1, . . . , vk} be a sequence of nodes s.t. vj has the maximum degree in the complete sub-graph induced by the nodes of G that are not dominated by {v1, . . . , vj−1}. Let nk be the number of nodes in V that are not dominated by Sk. Then it holds for all 0 < k ≤ n. nk ≤ n(cid:18)1 − 1 opt(cid:19)k , 8 Proof We prove this by induction on k. For the base case, we set k = 1. Since the number of non-dominated nodes is n, there exists a node v ∈ V s.t. v dominates at least n/opt nodes in the graph. Otherwise, opt is not an optimal solution. Thus, the number of non-dominated nodes by S1 is at most n1 ≤ n − n opt = n(cid:18)1 − 1 opt(cid:19) . For the inductive step, suppose that the statement holds for k = i. Again, since opt is the size of the minimum dominating set, by the pigeon-hole principle there exists a node V \ Si s.t. Si ∪ {v} dominates at least ni/ opt many nodes. Therefore, it holds that ni+1 ≤ ni − ni opt = ni(cid:18)1 − 1 opt(cid:19) = n(cid:18)1 − 1 opt(cid:19)i+1 . The claim follows. (cid:3) We use the lemma above to analyze the run time and approximation guarantee of the Gsemo on MDS. The following theorem holds. Theorem 11. Let G = (V, E) be a PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the Gsemo finds an ln(2ab + 1)-approximation for the MDS after expected O(cid:0)n3(cid:1) fitness evaluations. In particular, Gsemo is a Θ(1)-approximation algorithm for the MDS on PLB net- works. Proof The proof consists of two parts. We first estimate the expected run time until the solution 0n - i.e. the empty set - is added to the Pareto front (Phase 1), and then we estimate the time until the desired approximation is reached from that solution (Phase 2). (Phase 1) To analyze the first part of the process, we denote with x∗ the individual in the Pareto front with the minimum number of 1s, at a given time step. Since the total number of elements in the Pareto front is upper-bounded by n + 1, the probability of choosing x∗ for mutation is at least 1/(n + 1) at each iteration. Once x∗ is selected for mutation, then the probability of performing a single bit-flip and remove one element to x∗ is at least x∗1 /(en). Therefore, the expected waiting time to reach the solution 0n is upper-bounded as (n + 1) en j n Xj=1 = O(cid:0)n2 log n(cid:1) . (Phase 2) We now give an upper bound on the run time until the desired approximation is reached, assuming that the solution 0n has been found. From Lemma 10, it follows that there exists a node v1 ∈ V s.t. after adding this node to 0n the number of non-dominated nodes is at most n1 := u ({v1}) ≤ n(cid:18)1 − 1 opt(cid:19) . With an argument similar to the one presented to analyze the first part of the process, in expected O(cid:0)n2(cid:1) time an individual with fitness value (n1, 1) can be added to the solution. If {v1} is not an optimal solution, then by Lemma 10 there exists a node v2 ∈ V \ {v1} s.t. n2 := u ({v1, v2}) ≤ n(cid:18)1 − 1 opt(cid:19)2 . 9 solution with fitness (n1, 1) was added. Similarly, an individual with fitness (ni, i) can be added to Hence, an individual (n2, 2) can be added to the current population within expected O(cid:0)n2(cid:1), after a the current population within expected O(cid:0)n2(cid:1), after a solution with fitness (ni−1, i−1) was added. We can iterate this process as indicated in Lemma 10, until a dominating set Sk = {v1, . . . , vk} ⊆ V is found. nk := u (Sk) ≤ n(cid:18)1 − 1 opt(cid:19)k . (8) Note that there are at most n nodes that can be added to the solution 0n as described above. 10 that is a dominating set. Hence after a total of O(cid:0)n3(cid:1) fitness evaluations the Gsemo reaches a solution Sk as in Lemma Again, from the definition of minimum dominating set it holds n ≤ Pv∈opt δ(v) + 1. Combining We conclude by showing that the solution Sk yields the desired approximation guarantee. this observation with (8), we can estimate k by solving the inequality Sk opt ≤ n opt(cid:18)1 − 1 opt(cid:19)k ≤ Pv∈opt(δ(v) + 1) opt (cid:18)1 − 1 opt(cid:19)k . (9) We combine (9) with Lemma 6 to obtain that 1 ≤ (2ab + 1) exp(cid:18)− k opt(cid:19) . By taking the logarithm on both sides, we get k ≤ opt ln(2ab + 1) and we can conclude that the cardinality of Sk is at least Sk ≤ opt ln(2ab + 1). The claim follows. (cid:3) 5 The Minimum Vertex Cover Problem Given a graph G = (V, E), a vertex cover is a set S ⊆ V of vertices s.t. each edge in E is adjacent to at least one node in S. The minimum vertex cover problem (MVC) consists of finding a vertex cover of minimum size. In this section, we denote with opt any optimal solution to the MVC, and we use intuitive bit-string representation based on vertices, as discussed in Section 4. 5.1 Single-objective optimization. We study the run time and approximation guarantee for the (1 + 1) EA. Since any vertex cover is also a dominating set, then one can approach the MVC by minimizing a fitness function as in (5). Moreover, the following run time analysis follows directly from Theorem 9. Corollary 12. Let G = (V, E) be a PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the (1 + 1) EA finds a (2ab)-approximation of the MVC in expected O (n log n) fitness eval- uations. In particular, the (1 + 1) EA is a Θ(1)-approximation algorithm for the MVC on PLB networks. 10 5.2 Multi-objective optimization. We prove that the multi-objective Gsemo yields an improved approximation guarantee then the (1 + 1) EA, at the cost of a higher number of expected fitness evaluations. Again, since a vertex cover is also a dominating set, then this problem can be approached by minimizing a two-objectives function as in (7). Hence, the following run time analysis for the Gsemo readily follows from Theorem 11. Theorem 13. Let G = (V, E) be a PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the Gsemo finds an (ln(2ab) + 1)-approximation solution of MVC in expected O(cid:0)n3(cid:1) fit- ness evaluations. In particular, Gsemo is a Θ(1)-approximation algorithm for the MVC on PLB networks. 6 The Minimum Connected Dominating Set Problem Given a graph G = (V, E), recall that a connected dominating set is a set D ⊆ V of vertices that dominates every node v ∈ V , and the nodes u ∈ D induce a connected sub-graph on G. The minimum connected dominating set problem (CDS) consists of finding a connected dominating set C ⊆ V of minimum size. In this section, we denote with opt any optimal solution to the CDS. Throughout this section, we use intuitive bit-string representation based on vertices, as discussed in Section 4. 6.1 Single-objective optimization. We study the optimization process for the CDS with the (1 + 1) EA. We approach this problem by minimizing following fitness function. F (x) = n2(u(x) + w(x) − 1)+x1, (10) where u(x) is the number of non-dominated nodes, and w(x) is the number of connected compo- nents in the sub-graph induced by the chosen solution. Note that any connected dominating set C yields u(C) + w(C) − 1 = 0. We search for a solution to the CDS by minimzing F (x). It can be observed that a sub-graph induced by any subset D ⊆ V that is represented by the input string x is a connected dominating set if and only if u(x) = 0 and w(x) = 1. Because of the weights on the fitness function, the (1 + 1) EA tends to reach a feasible solution first, and then it removes unnecessary nodes. The argument for the theorem below is similar to that given in Theorem 9: We first show that the (1 + 1) EA reaches a locally optimal solution in O (n log n) fitness evaluations, and then we use the PLB property to show that any such solution gives the desired approximation ratio (see Corollary 7). The following theorem holds. Theorem 14. Let G = (V, E) be a PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the (1 + 1) EA finds a (2ab)-approximation of the CDS in expected O (n log n) fitness eval- uations. In particular, the (1 + 1) EA is a Θ(1)-approximation algorithm for the CDS on PLB networks. Proof To estimate the run time we use the multiplicative Drift theorem (see Theorem 3). Define the function f (x) = u(x) + w(x) − 1, with u(x) and w(x) as in (10), and let xt be a solution found at time step t. Suppose that the current solution xt is not feasible. Then with probability atl east 1/en a node is added to xt s.t. the value f (xt) decreases by 1. Hence, if we define {Xt}t≥0 as the process Xt = u(xt) for all t ≥ 0, then it holds 11 E[Xt − Xt−1 Xt] ≥ Xt en . Following the notation of Theorem 3, we set S = {1, . . . , n} to obtain that the run time until a feasible solution is found is upper-bounded as O (n log n). We conclude by proving that the (1 + 1) EA reaches the desired approximation guarantee. Denote with x∗ the first feasible solution reached by the (1 + 1) EA. We observe that any optimal solution opt dominates all nodes of G. It follows that it holds x∗ opt ≤ Pv∈opt(δ(v) + 1) opt ≤ 2ab + 1, with the last inequality in (11) following from Corollary 7. The claim follows. (11) (cid:3) 6.2 Multi-objective optimization. As in the case of the MDS and the MVC, we again analyze the run time of the Gsemo. We search for a solution of the CDS by minimizing the following multi-objective fitness F (x) = (u(x) + w(x), x1), (12) with u(x) and w(x) as described earlier in this section. The following result is useful for the run time analysis. Lemma 15. Let G = (V, E) be a connected graph, and consider the function f (x) := u(x) + w(x), with u(x), w(x) as in (12). Let Sk := {v1, . . . , vk} be a set of nodes of G s.t. vj := arg max {f (Sk \ {vk}) − f (Sk)} , u∈V \{v1,...,vj−1} for all j = 1, . . . , k. Then there exists a node v ∈ V \ Sk s.t. it holds that f (Sk ∪ {v}) ≤ f (Sk) − f (Sk) opt + 1. A proof of the lemma above is given by Guha and Khuller [18, Theorem 3.3], where it is used to analyze the performance of a greedy algorithm. The following theorem holds. Theorem 16. Let G = (V, E) be a connected PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the Gsemo finds a ln(2eab + e)-approximation for the CDS after expected O(cid:0)n3(cid:1) fitness evaluations. In particular, the Gsemo is a Θ(1)-approximation algorithm for the CDS on PLB networks. 12 Proof The hereby presented argument is similar to the one given in Theorem 11. Since the function x1 is an objective, then there are at most n + 1 individuals in the Pareto front, at each point during the iteration. Using this knowledge, and following an argument as in (Phase 1) in Theorem 11, one can prove that the solution 0n is added to the Pareto front after expected n Xj=1(cid:18) j e(n + 1)n(cid:19)−1 = O(cid:0)n2 log n(cid:1) fitness evaluations. Once the empty set is reached, the Gsemo iteratively generates solutions with increasing cardinality, until a good approximation of a minimum dominating set is reached. Define f (x) = u(x) + w(x), and denote with Sj = {v1, . . . , vj} a sequence of nodes s.t. vj := arg max {f (Sk \ {vk}) − f (Sk)} , u∈V \{v1,...,vj−1} until a connected dominated set Sk is reached (see Lemma 15). Again, selecting an individual for mutation and adding a chosen node to it occurs after expected O(cid:0)n2(cid:1) fitness evaluations. Since there are at most n nodes that can be added to the empty set 0n, then after expected O(cid:0)n3(cid:1) fitness evaluations the Gsemo reaches a solution Sk that is a dominating set. We conclude by showing that Sk yields the desired approximation guarantee. From Lemma 15 it holds 1 1 opt(cid:19)k f (Sk) ≤ f (S0)(cid:18)1 − opt(cid:19)k ≤ f (S0)(cid:18)1 − ≤ (f (S0) − opt)(cid:18)1 − = (n + 1 − opt)(cid:18)1 − 1 + opt(cid:19)j Xj=0(cid:18)1 − + opt 1 −(cid:18)1 − opt(cid:19)k opt(cid:19)k + opt. + opt 1 opt(cid:19)k! k−1 1 1 Note also that from Corollary 7 it holds n + 1 − opt opt ≤ Px∈opt(δ(x) + 1) opt ≤ 2ab + 1, and the following chain of inequalities also holds 1 ≤ f (Sk) opt ≤ (2ab + 1)(cid:18)1 − 1 opt(cid:19)k + opt . (13) If we solve (13) w.r.t. k, then it follows that k ≤ opt ln(2eab + e). Since k = Sk, then we conclude that Sk / opt ≤ ln(2eab + e), and the claim follows. (cid:3) 7 The Maximum Independent Set Problem For a given graph G = (V, E), recall that an independent set is a subset S ⊆ V s.t. no two nodes u, v ∈ S are adjacent. The maximum independent set problem (MIS) consists of finding an independent set S ⊆ V of maximum cardinality. In this section, we denote with opt any solution for the MIS. In this section, we use a standard bit-string representation based on vertices, as discussed in Section 4. 7.1 Single-objective optimization. 13 To implement the (1 + 1) EA, we use the fitness function proposed by Back et al. [9], which is defined as follows: n n F (x) = x1 − n xj eij, xi Xi=1 Xj=1 (14) where eij is 1 if there is an edge between vi and vj, and it is 0 otherwise. In this case, the objective j=1 xjeij = 0 if and only if the solution is an independent set. Because of the weight n, the (1 + 1) EA reaches a feasible solution first and then it adds nodes to it, to maximize the fitness. of the (1 + 1) EA is to maximize F (x). Note that it holds thatPn i=1 xiPn In order to perform the analysis for the (1 + 1) EA, we use the following definition of local optimality. Definition 17. Let G = (V, E) be a graph, and let F be as in (14). We say that a set of nodes S ⊆ V is a 3-local optimum of it holds for all U ⊆ S and T ⊆ V \ S s.t. U ∪ T ≤ 3. F ((S \ U ) ∪ T ) ≤ F (S) Definition 17 captures the notion of optimality up to three bit-flips. Using this definition, we prove the following result. Theorem 18. Let G = (V, E) be a connected PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Define the constants a := β − 1 β − 2"1 −(cid:18) t + 2 t + 1(cid:19)1−β#−1 and b :=(cid:20)4c1 (t + 1)β−1 β − 1 1 β−2 . (cid:21) Then the (1 + 1) EA finds an (ab + 1/2)-approximation for the MIS after expected O(cid:0)n4(cid:1) fitness evaluations. In particular, the (1 + 1) EA is a Θ(1)-approximation algorithm for the MIS on PLB networks. Proof We first perform a run time analysis for the (1 + 1) EA, until a 3-local optimum is found (see Definition 17), and then we prove that any such solution yields the desired approximation guarantee. To perform the run time analysis, we divide the optimization process in two phases. In (Phase 1) the (1 + 1) EA searches for a feasible solution, whereas in (Phase 2) it searches for a 3-local optimum, given that a feasible solution has been found. (Phase 1) Let x0 be the initial solution of the (1 + 1) EA and assume that x0 is not feasible. Since the empty set is always an independent set, then we can use an argument as in Theorem 9 (Phase 1) to conclude that the (1 + 1) EA reaches a feasible solution after O (n log n) fitness evaluations. (Phase 2) After a feasible solution is reached, then (1 + 1) EA searches for a 3-local optimum, within the portion of the search space that consists of feasible solutions. In this phase the (1 + 1) EA maximizes the function x1. We call favorable any move up to a 3-bit flip that yields an improvement on x1. The probability that the (1 + 1) EA performs a favorable move is 1/(en)3. Hence, it is always possible to obtain an improvement on the fitness of at least 1, after expected a linear number of favorable moves the (1 + 1) EA reaches a 3-local optimum. It follows that the O(cid:0)n3(cid:1) fitness evaluations, unless the current solution is a 3-local optimum. Note that after at most (1 + 1) EA finds a 3-local optimum as in Definition 17 after expected O(cid:0)n4(cid:1) fitness evaluations. To prove that 3-local optima reach the desired approximation guarantee, we present an argu- ment similar to that of Khanna et al. [19]. Let S be a 3-local optimum, and define I := S ∩ opt. Since we cannot add a node outside of S to get the bigger independent set (see Definition 17), then every node in S has at least one incoming edge from V \ S. Moreover, because of the local optimality of S, there are at most S \ I nodes in opt \ I that have exactly one edge coming 14 from S. Thus, opt − S nodes in opt \ I must have at least two outgoing edges to S. This implies that the minimum number of edges between S and opt \ I is S − I + 2(opt − S). If we denote with E(S, opt \ I) the set of all edges between S and opt \ I, then it holds 2 opt S ≤ S − I + 2(opt − S) S ≤ E(S, opt \ I) S ≤ Pv∈S(δ(v) + 1) S . (15) From the definition of 3-local optimum it follows that S is a maximum independent set. Hence, we apply Corollary 8 to (15) and conclude that opt / S ≤ ab + 1/2, as claimed. (cid:3) 7.2 Multi-objective optimization. We also consider the multi-objective case for MIS. As in the previous sections, we consider the bi-objective function f = (x1 , u(x)), with u(x) defined as u(x) = − xi n Xi=1 n Xj=1 xjeij, where eij is 1 if there is an edge between vi and vj, and it is 0 otherwise. The Gsemo attempts to maximize both objectives simultaneously. To perform the run time analysis of Gsemo, we use an argument similar to that of Halld´orsson and Radhakrishnan [20] for the greedy algorithm. Theorem 19. Let G = (V, E) be a graph. For any node v ∈ V , denote with N (v) the set of nodes adjacent to v. Let Sk := {v1, . . . , vk} be a sequence of k nodes s.t. vj is the node with smallest degree i=1 (N (vi) ∪ vi) = ∅. i=1 (N (vi) ∪ vi)(cid:17), and with Sk−1 in the complete sub-graph induced by V \(cid:16)Sj−1 Then Sk is a maximum independent set. Furthermore, it holds Sk ≥ V (cid:18)Pv∈V δ(v) V + 1(cid:19)−1 . A proof of Theorem 19 is given in Halld´orsson and Radhakrishnan [20, Theorem 1]. We also consider a lemma that allows to obtain an upper-bound on the average degree of a PLB network G. The following lemma holds. Lemma 20. Let G = (V, E) be a PLB network with parameters β > 2, t ≥ 0, and with universal constant c1. Then it holds δ(v) ≤ 2c1n(t + 1)β−1 Xv∈V i(i + t)−β. ∆(G) Xi=1 A proof of Lemma 20 is given in more general terms in Brach et al. [16, Lemma 3.2]. We use Theorem 19 and Lemma 20 to prove the following theorem. Theorem 21. Let G = (V, E) be a connected PLB network with parameters β > 2, t ≥ 0 and with a universal constant c1. Then the Gsemo finds a (cid:16) 2c1(β+t−1) (β−1)(β−2) + 1(cid:17)-approximation of the MIS after expected O(cid:0)n3(cid:1) fitness evaluations. In particular, the Gsemo is a Θ(1)-approximation algorithm for the MIS on PLB networks. Proof This argument is similar to the one given in Theorem 11 and Theorem 16. Following an argument as in (Phase 1) in Theorem 11, and as in Theorem 16, one can prove that the solution 0n is added to the Pareto front after expected n Xj=1(cid:18) j e(n + 1)n(cid:19)−1 = O(cid:0)n2 log n(cid:1) fitness evaluations. Note that the empty set is trivially an independent set. Once 0n is reached, the Gsemo iteratively adds nodes vj as in Theorem 19 to the current solution, until a maximum independent set is found. Again, since the population size is at most n+1, then selecting a particular 15 fitness at least that of a set Sk = {v1, . . . , vk}, that consists of a sequence of k nodes s.t. vj has solution and adding a chosen node to it occurs after expected O(cid:0)n2(cid:1) fitness evaluations. Hence, after expected O(cid:0)n3(cid:1) fitness evaluations the (1 + 1) EA reaches a maximum independent set with minimum degree in the complete sub-graph induced by the nodes V \(cid:16)Sj−1 i=1 (N (vi) ∪ vi)(cid:17), as in We conclude by proving that Sk = {v1, . . . , vk} yields the desired approximation guarantee, using the PLB property. Let di be the number of nodes adjacent the node vi. From Lemma 20 it holds Lemma 20. ∆(G) Xv∈V δ(v) ≤ 2c1n(t + 1)β−1 Xi=1 ≤ 2c1n(t + 1)β−1Z ∆(G) 1 i(i + t)−β x(x + t)−βdx ≤ 2c1n(β + t − 1) (β − 1)(β − 2) . We combine this chain of inequalities with Theorem 19 to conclude that Sk ≥ V (cid:20)Pv∈V δ(v) V + 1(cid:21)−1 ≥ n(cid:20) 2c1(β + t − 1) (β − 1)(β − 2) + 1(cid:21)−1 . Hence, it follows that and the claim follows. 8 Conclusion opt Sk ≤ n Sk ≤ 2c1(β + t − 1) (β − 1)(β − 2) + 1, (cid:3) In this paper, we look at the approximation ratio and run time analysis of commonly studied evolutionary algorithms, for well known NP-complete covering problems, on power-law bounded networks with exponent β > 2 (see Definition 4). We consider the single-objective (1 + 1) EA (see Algorithm 1) and the multi-objective Gsemo (see Algorithm 2). We prove in Section 4, that the (1+1) EA reaches a constant-factor approximation ratio for the Minimum Dominating Set problem within O (n log n) fitness evaluations on power-law bounded networks. Furthermore, we obtain and improved approximation guarantee for the Gsemo. In Section 4, we discuss similar bounds for the Minimum Vertex Cover problem. We show that the (1 + 1) EA and the Gsemo reach constant-factor approximation ratios in expected polynomial fitness evaluations for the Minimum Connected Dominating Set and Maximum Independent Set problems, in Section 6 and Section 7. In all cases, we observe that the (1 + 1) EA and the Gsemo reach a constant-factor approxima- tion ratio in polynomial time. This suggests that EAs implicitly exploit the topology of real-world networks to reach a better solution quality than theoretically predicted in the general case. References 1. S. Droste, T. Jansen, I. Wegener, On the analysis of the (1+1) evolutionary algorithm, Theoretical Computer Science 276 (2002) 51 -- 81. 2. T. Jansen, I. Wegener, Evolutionary algorithms - how to cope with plateaus of constant fitness and when to reject strings of the same fitness, IEEE Transactions on Evolutionary Computation 5 (2001) 589 -- 599. 16 3. O. Giel, I. Wegener, Evolutionary algorithms and the maximum matching problem, in: Proc. of STACS, 2003, pp. 415 -- 426. 4. F. Neumann, Expected runtimes of a simple evolutionary algorithm for the multi-objective minimum spanning tree problem, European Journal of Operational Research 181 (2007) 1620 -- 1629. 5. F. Neumann, I. Wegener, Randomized local search, evolutionary algorithms, and the minimum span- ning tree problem, Theoretical Computer Science 378 (2007) 32 -- 40. 6. P. S. Oliveto, J. He, X. Yao, Analysis of population-based evolutionary algorithms for the vertex cover problem, in: Proc. of CEC, 2008, pp. 1563 -- 1570. 7. P. S. Oliveto, J. He, X. Yao, Evolutionary algorithms and the vertex cover problem, in: Proc. of CEC, 2007, pp. 1870 -- 1877. 8. T. Friedrich, N. Hebbinghaus, F. Neumann, J. He, C. Witt, Approximating covering problems by randomized search heuristics using multi-objective models, in: Proc. of GECCO, 2007, pp. 797 -- 804. 9. T. Back, S. Khuri, An evolutionary heuristic for the maximum independent set problem, in: Proc. of WCCI, 1994, pp. 531 -- 535. 10. X. Peng, Performance analysis of (1+1) EA on the maximum independent set problem, in: Proc. of ICCCS, 2015, pp. 448 -- 456. 11. R. Kumar, P. Raghavan, S. Rajagopalan, A. Tomkins, Trawling the web for emerging cyber- communities, Computer Networks 31 (1999) 1481 -- 1493. 12. J. Leskovec, J. Kleinberg, C. Faloutsos, Graphs over time: Densification laws, shrinking diameters and possible explanations, in: Proc. of KDD, 2005, pp. 177 -- 187. 13. M. Faloutsos, P. Faloutsos, C. Faloutsos, On power-law relationships of the internet topology, in: Proc. of SIGCOMM, 1999, pp. 251 -- 262. 14. M. E. J. Newman, The structure and function of complex networks, SIAM Review 45 (2003) 167 -- 256. 15. D. J. Watts, S. H. Strogatz, Collective dynamics of 'small-world' networks, Nature 393 (1998) 440 -- 442. 16. P. Brach, M. Cygan, J. Lacki, P. Sankowski, Algorithmic complexity of power law networks, in: Proc. of SODA, 2016, pp. 1306 -- 1325. 17. B. Doerr, D. Johannsen, C. Winzen, Multiplicative drift analysis, Algorithmica 64 (4) (2012) 673 -- 697. 18. S. Guha, S. Khuller, Approximation algorithms for connected dominating sets, Algorithmica 20 (1998) 374 -- 387. 19. S. Khanna, R. Motwani, M. Sudan, U. Vazirani, On syntactic versus computational views of approx- imability, SIAM Journal on Computing 28 (1998) 164 -- 191. 20. M. M. Halld´orsson, J. Radhakrishnan, Greed is good: Approximating independent sets in sparse and bounded-degree graphs, Algorithmica 18 (1) (1997) 145 -- 163.
1101.0021
1
1101
2010-12-29T23:32:39
Popular b-matchings
[ "cs.DS" ]
Suppose that each member of a set of agents has a preference list of a subset of houses, possibly involving ties and each agent and house has their capacity denoting the maximum number of correspondingly agents/houses that can be matched to him/her/it. We want to find a matching $M$, for which there is no other matching $M'$ such that more agents prefer $M'$ to $M$ than $M$ to $M'$. (What it means that an agent prefers one matching to the other is explained in the paper.) Popular matchings have been studied quite extensively, especially in the one-to-one setting. We provide a characterization of popular b-matchings for two defintions of popularity, show some $NP$-hardness results and for certain versions describe polynomial algorithms.
cs.DS
cs
Popular b-Matchings Katarzyna Paluch Institute of Computer Science, Wrocław University 1 Introduction In the paper we study popular b-matchings, which in other words are popular many-to-many matchings. The problem can be best described in graph terms: We are given a bipartite graph G = (A ∪ H, E), a capacity function on vertices b : A ∪ H → N and a rank function on edges r : E → N. A stands for the set of agents and H for the set of houses. Each member of a set of agents a ∈ A has a preference list Pa of a subset Ha of houses H. For a ∈ A and h ∈ H edge e = (a, h) belongs to E iff h is on Pa and r((a, h)) = i reads that h belongs to (one of) a's ith choices. We say that a prefers h1 to h2 (or ranks h1 higher than h2) if r((a, h1)) < r((a, h2)). If r(e1) < r(e2) we say that e1 has a higher rank than e2. If there exist a ∈ A and h1, h2 ∈ Ha, h1 6= h2 such that r(e1 = (a, h1)) = r(e2 = (a, h2)), then we say that e1, e2 belong to a tie and graph G contains ties. Otherwise we say that G does not contain ties. A b-matching M of G is such a subset of edges that degM (v) ≤ b(v) for every v ∈ A ∪ H, meaning that every vertex v has at most b(v) edges of M incident with it. Let r denote the greatest rank (i.e. the largest number) given to any edge of E. With each agent a and each b-matching M we associate a signature denoted as sigM (a), which is an r-tuple (x1, x2, . . . , xr) such that xi (1 ≤ i ≤ r) is equal to the number of edges of rank i matched to a in a b-matching M. We introduce a lexicographic order ≻ on signatures as follows. We will say that (x1, x2, . . . , xr) ≻ (y1, y2, . . . , yr) if there exists j such that 1 ≤ j ≤ r and for each 1 ≤ i ≤ j − 1 there is xi = yi and xj > yj. We say that an agent a prefers b-matching M ′ to M if sigM ′(a) ≻ sigM (a). M ′ is more popular than M, denoted by M ′ ≻ M, if the number of agents that prefer M ′ to M exceeds the number of agents that prefer M to M ′. Definition 1 A b-matching M is popular if there exists no b-matching M ′ that is more popular than M. The popular b-matching problem is to determine if a given triple (G, b, r) admits a popular b-matching and find one if it exists. Previous work The notion of popularity was first introduced by Gardenfors [3] in the one-to-one and two-sided context, where two-sided means that both agents and houses express their preferences over the other side and a matching M is popular if there is no other matching M ′ such that more participants (i.e. agents plus houses) prefer M ′ to M than M to M ′. (He used the term of a majority 1assignment.) He proved that every stable matching is a popular matching if there are no ties. One-sided popular matchings were first studied in the one-to-one setting by Abraham et al. in [1]. They proved that a popular matching needn't exist and decribed fast polynomial algorithms to compute a popular matching, if it exists. The dynamic scenario, in which agents and houses can come and leave the graph and agents can change their preference lists, is examined in [2]. Mestre [16] considered a version in which every agent has an associated weight, reflecting an agent's priority. Manlove and Sng in [13] extended an algorithm from [1] to the one-to-many setting (notice that this not equivalent to the many-to-one setting.) In [17], in turn, the version, in which agents have weights, houses have arbitrary capacities, every agent has capacity one and there are no ties, is examined. Mahdian [12] showed for the one-to-one case without ties that a popular matching exists with high probability when preference lists are random, and the number of houses is a small multiplicative factor larger than the number of agents. Instances when a popular matching does not exist were dealt with by McCutchen ([14]), who defined two notions of a matching that is, in some sense, as popular as possible, namely a leastunpopularity- factor matching and a least-unpopularity-margin matching and proved that computing either type of matching is N P -hard, even if there are no ties, by Huang et al. [6] and by Kavitha et al. [10]. Kavitha and Nasre [8] gave an algorithm to compute an optimal popular matching for various interpretations of optimality. McDermid and Irving [15] gave a characterisation of the set of popular matchings for the one-to-one version without ties, which can be exploited to yield algorithms for related problems. Our contribution We provide a characterization of popular b-matchings and prove that the popular b-matching problem is N P -hard even when agents use only two ranks and have capacity at most 2 and houses have capacity one. This in particular answers the question about many-to-one popular match- ings asked in [13]. Next we modify the notion of popularity and consider so-called weakly popular b-matchings. We give their characterization and show that finding a weakly popular b-matching or reporting that it does not exist is N P -hard even if all agents use at most three ranks, there are no ties and houses have capacity one. We construct polynomial algorithms for the versions in which agents use two ranks. 2 Characterization First we introduce some terminology and recall a few facts from the matching theory. By a path P we will mean a sequence of edges. Usually a path P will be denoted as (v1, v2, . . . , vk), where v1, . . . , vk are vertices from the graph, not necessarrily all different, and for each i (1 ≤ i ≤ k−1) (vi, vi+1) ∈ E and no edge of G occurs twice in P . We will sometimes treat a path as a sequence of edges and sometimes as a set of edges. If M is a b-matching and degM (v) < b(v) we will say that v is unsaturated, if degM (v) = v(v) we say that v is saturated. If b(v) = 1, then we will also use the terms matched and unmatched instead of saturated and unsaturated. If e ∈ M we will call it an M-edge and otherwise -- a non-M-edge. By M (v) we mean the set {v′ : (v, v′) ∈ M }. A path is said to be alternating (with respect to M) or M-alternating if its edges are alternately M-edges and non-M-edges. An alternating path is said to be (M-)augmenting if its end vertices are unsaturated and its first and last edges are non-M-edges. For two sets Z1, Z2 Z1 ⊕ Z2 is defined as (Z1 \ Z2) ∪ (Z2 \ Z1). If M is a b-matching and P is an alternating with respect to M path such that its beginning edge (v1, v2) is an M-edge or v1 is unsaturated and its ending edge (vk−1, vk) is an M-edge or vk is unsaturated, then M ⊕ P is a also a b-matching and if P is additionally augmenting, then M ⊕ P has more edges than M and is said to have larger size or greater cardinality than M. A b-matching of maximum size is called a maximum b-matching. We will also need a notion of an even path: a path (a1, h1, a2, h2, . . . , v), where v denotes either hk or ak+1, is defined to be even and denoted Pe(a1, v) if it is alternating, (a1, h1) is a non-M-edge and for each i, 2 ≤ i ≤ k edges (hi−1, ai), (ai, hi) have the same rank. If this path is written in the reverse e (v, a1). By writing (Pe(a, h), a′) we mean a path that consists of an even path order we denote it by P r Pe(a, h) and edge (h, a′). 2 Theorem 1 A b-matching M is popular iff graph G does not contain a path of one of the following four types: 1. (Pe(a1, hk−1), ak, hk, ak+1), where (1) the path is alternating and (2) a1 is unsaturated or there exists an edge e in M (a) such that r(e) > r(a1, h1), (3) r(hk−1, ak) > r(ak, hk) and (4) agents a1, ak, ak+1 are pairwise different or a1 6= ak, a1 = ak+1 and r(a1, h1) < r(a1, hk), 2. (Pe(a1, a), P r e (a, a′ that r(e) > r(a1, h1), (2) a′ r(e′) > r(a′ 1) and (3) agents a1, a, a′ 1, h′ 1 are pairwise different, 1)), where (1) a1 is unsaturated or there exists an edge e in M (a1) such 1) such that 1 is unsaturated or there exists an edge e′ in M (a′ 3. Pe(a1, h), (1) a1 is unsaturated or there exists an edge e in M (a) such that r(e) > r(a1, h1) and (2) h is unsaturated, 4. (Pe(a1, hk), a1), where the path is alternating and r(hk, a1) > r(a1, h1). Proof. Suppose the graph contains a path P1 of the first type. (notice that e /∈ P1), otherwise let P ′ sigM (a1), sigM ′ (ak) ≻ sigM (ak), sigM (ak+1) ≻ sig′ we have sig′ M (a) = sigM (a). Therefore M ′ is more popular than M. 1 = P1. M ′ = M ⊕ P ′ If a1 is saturated let P ′ 1 = P1 ∪ e 1 is a b-matching such that sigM ′(a1) ≻ M (ak+1) and for each a different from a1, ak, ak+1 If the graph contains a path of the second type, we proceed analogously. Suppose the graph contains a path P3 of the third type. If a1 is saturated let P ′ 3 = P3. M ′ = M ⊕ P ′ 3 = P3 ∪ e, otherwise 3 is a b-matching such that sigM ′(a1) ≻ sigM (a1) and for each a different let P ′ from a1 we have sig′ M (a) = sigM (a). Therefore M ′ is more popular than M. Suppose now that there exists a b-matching M ′ which is more popular than M. This means that the set A1 of agents who prefer M ′ to M outnumbers the set A2 of agents who prefer M to M ′. For each a ∈ A1 we build a path Pa in the following way. We will use only edges of M ⊕ M ′. We start with an edge (a, h1) ∈ M ′ \ M having the highest possible rank (i.e. lowest possible number). Now assume that our so far built path Pa ends with hi. If hi is unsaturated in M, we end. Otherwise we a (a′ ∈ A1). (The set consider edges (hi, ai) belonging to M \M ′ and not already used by other paths P ′ of such unused edges is nonempty as hi is saturated in M and thus there are at least as many M-edges as M ′-edges incident with hi and each time we arrive at hi while building some path Pa (a ∈ A1) we use one M-edge and one M ′-edge.) If among these edges, there is such one that ai ∈ A1 we add it to Pa and stop. Otherwise if there is such one that ai ∈ A2 we add it to Pa and stop. Otherwise we add any unused edge (hi, ai) to Pa. ai has the same signature in M and in M ′. Therefore there exists an edge (ai, hi+1) ∈ M ′ \ M having the same rank as (hi, ai) and there exists an unused edge of this kind because the number of edges in M incident with ai is the same as the number of edges in M ′ incident with ai (as ai has the same signature in both b-matchings), we add this edge to Pa. Clearly we stop building Pa at some point because we either arrive at an unsaturated vertex h ∈ H or at a vertex of A1 ∪ A2, which may be a itself. Suppose there exists a ∈ A1 such that Pa ends on a. Since we have started from an edge e of M ′(a) \ M (a) having the highest rank, the ending edge of Pa must have a lower rank than e, hence Pa is a path of the fourth type. If there exists a path Pa ending on an unsaturated vertex, it is of type three. If there exists a ∈ A1 such that Pa ends on a1 ∈ A1, a1 6= a, then let e = (h′, a1) denote the ending edge of Pa. Since a1 ∈ A1 the edge of M (a1) \ M ′(a1) having the highest rank, let us call it e′ has a higher rank than e. Suppose e′ = (a1, h). If there exists an edge e3 = (h, a) ∈ M \ M ′, path Pa ∪ e′ ∪ e3 forms a path of type (1). Otherwise there exists an edge e3 = (h, a2) ∈ M \ M ′, where a2 6= a and of course a2 6= a1 and path Pa ∪ e′ ∪ e3 also forms a path of type (1). If none of the above paths exists, each Pa ends on some agent a2 ∈ A2. Because A2 3 outnumbers A1 there exist a1, a′ These paths are edge-disjoint and together form a path of type (2). 1 ∈ A1, a1 6= a′ 1 and a2 ∈ A2 such that Pa1 and Pa′ 1 both end on a2. ✷ Theorem 2 The problem of deciding whether a given triple (G, b, r) has a popular b-matching is N P - hard, even if all edges are of one of two ranks, each applicant a ∈ A has capacity at most 2 and each house h ∈ H has capacity 1. Proof. We prove the theorem by showing a polynomial reduction of the exact 3-cover problem to the popular b-matching problem. In the exact 3-cover problem we have a finite set K and a family : i = 1, 2, . . . , m} of subsets of K such that Ti = 3 for 1 ≤ i ≤ m. We want to Σ = {Ti establish if there exists J ⊆ {1, 2, . . . , m} such that {Sj}j∈J forms a partition of K. The exact 3- cover problem is NP-complete even when each element of K belongs to either two o three sets of Σ and the underlining graph is planar [5], [4]. Given an instance of the exact 3-cover problem, we construct the following graph G = (A ∪ H, E). We have a vertex vk ∈ H for each element k ∈ K, with b(vk) = 1. For each set Ti we have 5 vertices ai1, ai2, ai3, ai4 , ai5 ∈ A with b(aij ) = 1 for j 6= 4 and b(ai4) = 2 and 2 vertices hi, h′ i) = 1. Additionally we have m − K/3 vertices g1, g2, . . . gm−K/3 ∈ H having capacity 1. The subgraph of G corresponding to a set Ti is shown in Figure1. Each vertex vk is connected by a rank one edge with one of vertices ai1, ai2, ai3 for each i such that k ∈ Ti. Each vertex ai5 is connected with each vertex of {g1, g2, . . . gm−K/3} by a rank one edge. i ∈ H with b(hi) = b(h′ Suppose there exists J which is an exact 3-cover of K. We build a popular b-matching M as follows. For each Tj = {j1, j2, j3} such that j ∈ J we add edges (vj1, aj1), (vj2, aj2), (vj3 , aj3) to a b-matching M. For each i = 1, 2, . . . , m we add edges (ai4, hi), (ai4 , h′ i) to M and for each i /∈ J we add an edge (ai5, g), where g is some vertex of {g1, g2, . . . gm−K/3}. We claim that M is popular. Since all vertices of H are saturated, there does not exist a path of type 3 from Theorem 1. Each vertex ai4 is saturated and matched via one rank one edge and one rank two edge. If some vertex aij is unsaturated, then it has no M-edges incident with it. Therefore it cannot belong to a path of type 4. If it is saturated, then it is matched via a rank one edge and cannot belong to a path of type 4. If ai1 is unsaturated and its rank one edge is (ai1, v1), then v1 is matched via a rank one edge to has only one rank one edge incident with it. Thus ai1 cannot some ai′ be a beginning of a path of type 1. If ai1 has no rank one M-edge incident with it, then i /∈ J and ai5 is saturated. Therefore path (ai1, hi, ai4, h′ i, ai5) is not a path of type 2. If ai5 is unmatched, then ai1, ai2, ai3 are saturated and thus path (ai5 , h′ i, ai4, hi, ai1) is not a path of type 2. Also unmatched ai5 does not belong to any path of type 1. where j ∈ {1, 2, 3} and ai′ j j i, ai5, g1, ai′ Next we show, that if there is no exact 3-cover of K, then G has no popular b-matching. First let us notice that if a b-matching M of G is popular, then all vertices of H are saturated in M. Next we can see that each edge (ai4, h′ i) belongs to every popular b-matching of G, for if it does not belong to some b-matching M, then path (ai4, h′ is a vertex matched to g1, is of type 1 from Theorem 1. Also in every popular b-matching M ai4 must be saturated. For if edge (ai4, hi) does not belong to M, then hi is matched to a vertex of {ai1, ai2, ai3 }, say ai1. Then path (ai4, hi, ai1 , vs, ai′ ) , where vs is a neighbour of ai1 and ai′ is matched to vs, is a path of type 1 from Theorem 1. If there is no exact 3-cover of K, then for some i only two or one vertices of {ai1, ai2, ai3 } will be matched via a rank one edge. The number of such i clearly surpasses m − K/3. Suppose that ai1 is not matched via a rank one edge and ai2, ai3 are. Then if path (ai1 , hi, ai4 , h′ i, ai5) is not to be a path of type 2, ai5 must be saturated. But only m − K/3 vertices of {ai5 : i = 1, 2, . . . m} can be saturated. ), where ai′ 5 5 j j 4 v_3 v_7 v_11 1 a_i1 1 1 a_i2 a_i3 2 2 2 h_i 2 a_i4 1 h'i 1 g_s h_i h_i a_i4 a_i4 h'i a_i5 a_i5 a_i5 g_2 1 g_1 h'_i 2 Figure 1: Solid lines denote edges of rank 1 and dotted lines edges of rank 2. In the second and third part of the figure thick lines indicate M-edges. The second part describes the situation when Ti = {3, 7, 11} belongs to an exact 3-cover J and the third part the situation when i /∈ J. ✷ 3 Weakly popular b-matchings Instead of just checking whether an agent prefers one b-matching to the other, we might also want to assess how much he/she prefers one to the other. Before defining a loss/gain factor of an agent we introduce the following. For a set E′ = {e1, e2, . . . , ek} of edges incident with a, let s(E′) denote a d-tuple (x1, x2, . . . , xd) such that xi = r(eji) if 1 ≤ i ≤ k and xi = r+1 if i > k, where ej1, ej2, . . . , ejk are edges of E′ ordered so that r(eij ) ≤ r(eij+1) for 1 ≤ j ≤ k − 1 and d = max{deg(a) : a ∈ A}. For two d-tuples d1 = (x1, . . . , xd), d2 = (y1, y2, . . . , yd) we define their difference as d1 − d2 = Σd i=1signum(xi − yi), where signum(x) = 1, 0, or −1 if correspondingly x > 0, x = 0 or x < 0. Now we define a loss/gain factor of agent a with respect to b-matchings M, M ′ as fa(M, M ′) = s(M \ M ∩ M ′) − s(M ′ \ M ∩ M ′). Also we define a loss/gain factor for two b-matchings: f (M, M ′) = Σa∈Afa(M, M ′). We will say that a b-matching M is more weakly popular than a b-matching M ′ if f (M, M ′) > 0 and a b-matching M ′ will be called weakly popular if there does not exist a b-matching M ′ that is more weakly popular than M. Theorem 3 A b-matching M is weakly popular iff graph G does not contain a path of type (1), (3) or (4) from Theorem 1. The proof is similar to that of Theorem 1. Theorem 4 The problem of deciding whether a given triple (G, b, r) admits a weakly popular b- matching is N P -hard, even if all edges are of one of three ranks, each applicant a ∈ A has capacity at most 3, each house h ∈ H has capacity 1 and there are no ties. Proof. We will reduce the 3-SAT problem to the Weakly Popular b-matching problem. assume we have a formula F that uses k variables p1, p2, . . . , pk and has the form: (q1,1 ∨ q1,2 ∨ q1,3) ∧ . . . ∧ 5 p'_{i,1} 1 b_{i,1} p_{i,1} 1 g_{i,3} 1 p'_{i,3} a_{i,1} a_{i,,6} b_{i,3} 1 p_{i,3} g_{i,1} h_j a_{i,2} p_{i,2} 1 a_{i,3} c_{j,1} c_{j,2} c_{j,3} a_{i,4} a_{i,5} b_{i,2} 1 g_{i,2} p'_{i,2} p_{1,k} p'_{4,s} p_{7,t} Figure 2: A subgraph corresponding to variable pi such that r(i) = 3 and a subgraph corresponding to the exemplary 1st clause. (qn,1 ∨ qn,2 ∨ qn,3), where each qj1,j2 (1 ≤ j1 ≤ n, 1 ≤ j2 ≤ 3) represents either pi or pi (meaning not pi) for some i. For each pi let r(pi) denote the number of times pi occurs in F and r′(pi) -- the number of times pi occurs in F . Let r(i) = max{r(pi), r′(pi)}. We construct the following graph G = (A∪H, E). For each variable pi we have the following vertices that will belong to H: pi,1, pi,2, . . . , pi,r(i) and p′ i,r(i) and bi,1, . . . , bi,r(i) and gi,1, . . . , gi,r(i). For each of the n clauses we have one additional house hi. For each variable pi we have 2r(i) agents ai,1, . . . , ai,2r(i), each of capacity 3. For each odd j agent ai,j is connected via a rank one edge with pi,(j+1)/2 and for each even j agent ai,j is connected via a rank one edge with p′ i,j/2. Agents ai,j, ai,j+1 for each odd j are connected via rank two edges with bi,(j+1)/2 for each odd j and agents ai,j, ai,(j+1) mod 2r(i) for each even j are connected via rank three edges to gi,j/2 for each even j. For each clause we have 3 agents: ci,1, ci,2, ci,3, each of capacity 2. All of them are connected via a rank two edge with hi. If the 1st clause is of the form, say (p1 ∨ not p4 ∨ p7), then c1,1 is connected via a rank one edge with p1,j for some j, c1,2 with p′ 4,j for some j and c1,3 with p1,j for some j. No vertex pi,j or p′ i,j is connected to two clause vertices. The construction is illustrated in Figure2. i,1, . . . , p′ If F is true when pi = f (pi) (1 ≤ i ≤ k) for some function f : {p1, . . . , pk} → {0, 1}, we build the following b-matching M. If f (pi) = 1 (1 ≤ i ≤ k), we add to M all rank one, two and three edges incident with agents ai,j such that j is even, otherwise M will contain all rank one, two and three edges incident with agents ai,j such that j is odd. Since F is true, in the first clause we have f (p1) = 1 ∨ f (p4) = 0 ∨ f (p7) = 1. Suppose that f (p4) = 0, then we add to M a rank one edge incident with c1,2, we are able to do so, because at the moment all vertices p′ 4,j are unmatched. We also add to M a rank two edge incident with c1,2. We proceed in this way for every clause. At the end for every rank one edge (a, h) such that a and h are unsaturated we add it to M. One can check that thus built M is weakly popular. Suppose there exists a weakly popular b-matching M. We will show that there exists a function f : {p1, . . . , pk} → {0, 1} such that F is true when pi = f (pi) (1 ≤ i ≤ k). The key observation 6 a_{i,3} a_{i,,6} a_{i,4} a_{i,5} b_{i,2} b_{i,3} g_{i,2} Figure 3: Thick lines indicate M-edges. If we match gi,2 to ai,4, we get a path (ai,5, gi,2, ai,4, bi,2, ai,3), which is of type (1). is that for any variable pi either all houses pi,j will be matched to agents ai,j or all houses p′ i,j will be matched to agents ai,j. We show this as follows. We notice that in the subgraph corresponding to variable pi either all agents ai,j for even j are matched to houses bi,j/2 or all agents ai,j for odd j are matched to houses bi,(j+1)/2. Figure 3 shows what happens when it is not the case. Then there exist two agents ai,j, ai,j+1 such that both are not matched via a rank two edge and the graph contains a path of type 2, which means that M is not weakly popular. Suppose that all agents ai,j such that j is even are matched via a rank two edge. Then they must also be matched via a rank one edge. For suppose that ai,2 is not matched to p′ i,1) is either a beginning of a path of type (1) or is a path of type (3). Thus all houses p′ i,j are matched to agents ai,j. We set f (pi) = 1. Next, let us consider clauses. Suppose the 1st clause is of the form (p1 ∨ not p4 ∨ p7) and ci,1 is matched to hi. Then ci,1 must also matched to some p1,j, because otherwise (ci,2, hi, ci,j, p1,j) is a beginning of a path of type 1 or 3, which shows that the 1st clause is satisfied under function f . ✷ i,1. Then (ai,1, bi,1, ai,2, p′ Theorem 5 The problem of deciding whether a given triple (G, b, r) admits a weakly popular b- matching is N P -hard, even if each applicant a ∈ A has at most 3 edges of rank 1 incident with him/her and at most 1 edge of rank 2 and capacity at most 4 and each house h ∈ H has capacity 1. The proof is by reducing the 3-exact cover problem to the problem from the theorem. 4 Polynomial algorithms We start with the case when there are no ties and each agent uses at most two ranks, houses have arbitrary capacities. We are going to need an algoritm for the following problem. We have a bipartite graph G = (A ∪ H, E),b : A ∪ A → N such that b(a) = 1 for every a ∈ A, a partition of A into A1, A2, . . . , Ap and a nonnegative integer ki for each 1 ≤ i ≤ p. We want to find a maximum b-matching M of G such that for each 1 ≤ i ≤ p the number of vertices of Ai matched in M is at least ki or ascertain that such a matching does not exist. Here we will use the term of a matching instead of a b-matching. Let Mmax denote any maximum matching of G. Clearly if a matching satisfying our require- ments exists (further on we will call such a matching a partition matching), Σp i=1ki must not surpass Mmax. Suppose that matching M is of maximum cardinality but it matches less than ki vertices of Ai. Then if the solution to our problem exists, there is in the graph a sequence P1, P2, . . . , Ps of edge-disjoint alternating paths such that each Pj = (aj, . . . , a′ j) begins with a non-M-edge and ends 7 with an M-edge, a1 is of Ai and is unmatched in M, as is of Ai′ such that M matches more than ki′ vertices of Ai′ and for each j ≤ s − 1 vertices a′ j and aj+1 are of the same set At for some t and they either denote the same vertex or aj+1 is unmatched in M. Let us call such a sequence an improving sequence. (To see that an improving sequence exists, let M ′ denote any partition matching and con- sider M ⊕ M ′. Since in M ′ at least ki vertices are matched there exists in M ⊕ M ′ an alternating path 1 /∈ Ai. If a′ 1 beginning with an unmatched in Ai vertex and ending on some vertex a′ P ′ 1 ∈ At and At is such that M matches exactly kt vertices of At, then there exists an alternating path P ′ 2 (edge-disjoint from P ′ 1 or at a vertex a2 ∈ At unmatched in M and ending on a vertex a3 inAs such that t 6= s and i 6= s. Proceeding in this way we obtain an improving sequence.) The algorithm for this problem can be then described as follows. 1) beginning either at a′ Algorithm Partition Matching Input: graph G = (A∪H, E), b : A∪H → N, a partition of A into A1, A2, . . . , Ap, a sequence of nonnegative integers (k1, k2, . . . , kp) Output: b-matching M of maximum cardinality that for each 1 ≤ i ≤ p matches at least ki vertices of Ai, or a report that such a matching does not exist. Find any maximum b-matching M of G. while M does not satisfy requirements: Find an improving sequence P . If P does not exist write "does not exist" and halt. Otherwise M := M ⊕ P . We need the above algorithm for the following. Suppose agents Ah = {a1, a2, . . . , ak} have all a rank two edge incident with house h that has capacity c < k (and has no rank one edges incident with it). Then we are able to match only p agents of Ah to h. If we match a2 to h, then a2 should also be matched to a rank one house, because otherwise for any a1 not matched to h, path (a1, h, a2, h′) (where h′ is a rank one house for a2) forms a beginning of a path of type 1 or a path of type 3. Thus we should find such a M1 matching among rank one edges that p agents of Ah are matched in M1. Algorithm A Input: graph G = (A ∪ H, E), function b : A ∪ H → N, a partition of E = E1 ∪ E2 Output: a weakly popular b-matching M or a report that it does not exist Let G1 = (A ∪ H, E1) and b1 be defined as b1(a) = 1 for a ∈ A and b1(h) = b(h). Let G2 = (A ∪ H, E2) and b2 be defined as b2(a) = 1 for a ∈ A and b2(h) = b(h) − degE1 (h) for h ∈ H. If in G2 every h ∈ H satisfies: degE2 (h) ≤ b2(h), then find a maximum b2-matching M2 of G2, a max. b1-matching M1 of G1 and output M = M1 ∪ M2. Otherwise let H ′ = (h1, h2, . . . , hp) denote all houses h ∈ H such that degE2 (h) > b2(h). For each hi ∈ H ′ build Ai = NG2 (hi), where NG2 (hi) denotes the set of neighbours of hi in G2. Set ki = b2(hi). Set Ap+1 = A \ S1≤i≤p Ai and kp+1 = 0. Using algorithm Partition Matching for the input: G1, b1, the partition of A into A1, . . . , Ap+1 and (k1, . . . , kp+1) compute a partition matching M1. If it does not exist write "does not exist" and halt. Otherwise for each i, 1 ≤ i ≤ p let A′ each a ∈ Ap+1 add (a, h), such that (a, h) ∈ E2, to M2. Output M = M1 ∪ M2. i ⊆ Ai denote the set of agents that are matched in M1. For each a ∈ A′ i add (a, hi) to M2. For 8 2 1 2 1 2 1 2 1 1 2 2 2 1 Figure 4: The graph on the left has a weakly popular b-matching and the one on the right has not.(Houses have capacity 1.) Theorem 6 Algorithm A solves the Weakly Popular b-Matching problem for the cases when b(a) = 2 for each a ∈ A, each agent uses 2 ranks and there are no ties. Proof. Suppose that algorithm A computes a b-matching M. To prove that it is weakly popular, it suffices by Theorem 3 to show that the graph does not contain a path of type (1), (3) or (4). Since M is of maximum cardinality, the graph does not contain a path of type 3 and since there are no ties, the graph does not contain a path of type 4. The graph does not contain a path of type 1 either, because, if such a path existed, then it would have the form (a1, h1, a2, h2, a3) such that a1 is unsaturated in M, edges (a1, h1), (h1, a2) are of rank 2 and edges (a2, h2), (h2, a3) are of rank 1. However M has the property that if agent a is matched with a rank 2 edge, then he/she is also matched with a rank 1 edge. On the other hand if algorithm A fails to compute a weakly popular b-matching, then it is because an appropriate partition matching does not exist. First let us notice that if a weakly popular b-matching exists, then it is of maximum cardinality. Next we can show, that if in the graph G a weakly popular b-matching M exists, then there exists a weakly popular b matching M ′ such that M ′ contains some maximum b1-matching of G1, where b1 and G1 are as in the description of Algorithm A. For assume, that a weakly popular b-matching M restricted to rank one edges (called M1) is not a maximum b1- matching of G1. Then in G1 there exists an M1-augmenting path, which must be of the form (a, h), where a is not matched in M1 and h is not saturated in M1. Since M is weakly popular h is saturated in M. Therefore there exists a′ such that (a′, h) ∈ M and (a′, h) ∈ E2. It is not difficult to see that M \ {(a′, h)} ∪ {(a, h)} must also be a weakly popular b-matching of G. We can proceed in this way until we have a weakly popular b-matching of G that contains a maximum b1-matching of G1. Thus if there exists a weakly popular b-matching M of G, then there exists such a weakly popular b-matching M ′ that M ′ restricted to rank two edges is a maximum b2-matching of G2. If for some h we have degE2(h) > b2(h), then in any maximum b2-matching of G2 exactly b2(h) vertices of NG2(h) will be matched and the remaining degE2 (h) − b2(h) vertices of G2(h) will be unmatched. Therefore for such h there will always be in G a path (a, h, a′) such that a, a′ ∈ NG2(h) and a is not matched in G2. So if such a path is not to become a beginning od a path of type 1, each a′ that is matched in G2 should also be matched in G1. Therefore if there exists a weakly popular b-matching of G, there exists an appropriate partition matching of G1. ✷ Next we are going to deal with the case when ties are allowed among rank two edges and each agent has capacity 2 . Suppose that a function b : A ∪ H → N is such that b(a) = 1 for each a ∈ A and M is a maximum b-matching. Then a vertex v ∈ A ∪ H will be called an O-vertex if there exists an odd-length alternating path from un unmatched (in M) vertex v0 to v and an E-vertex if there exists an even-length alternating path from un unmatched (in M) vertex v0 to v. All other vertices will be called U-vertices (unreachable via an alternating path from un unmatched vertex). By the Gallai-Edmonds decomposition theorem O-, E- and U-vertices forms a partition of A ∪ H, which is 9 A2 A3 A4 A9 A8 A1 A6 A5 A10 A7 Figure 5: Thick lines indicate M2-edges. Houses have capacity 1. All agents except for A8 are O-vertices. Agent A8 is a U-vertex. Here two sets will belong to a partition of A: {A1, A2, A3, A4, A5, A6} and {A9, A10}. d({A9, A10} = 1. independent of a particular maximum b-matching M. (See [11], [7] for example.) We will need an algorithm for the following problem. The input is as for Algorithm Partition Matching and additionally for each i, 1 ≤ i ≤ p we have a family Zi of subsets of Ai, each Z ∈ Zi having cardinality ki. We want to find a maximum matching M of G such that for each 1 ≤ i ≤ p vertices of Ai matched in M contain some Z ∈ Zi (such a matching is going to be called a z-partition matching) or ascertain that such a matching does not exist. Let us first explain what we need this for. Suppose a maximum matching M2 on some subgraph of G2 looks as shown in Figure 5. Then if we want to avoid creating paths of type (1), we should have that agents A2, A3, A4, A7, A10 have a rank one M1-edge incident with them. Notice that we do not have to worry about A8. If agents Z0 = {A1, A3, A6, A4, A9} have a rank one M1-edge incident with them, then we can change M2, so that it will still be maximum and will saturate vertices of Z0 and the graph will not contain a path of type 1. With each subset Ai of the partition of A there will be associated a graph G′ i) and a function b2 (such that b(a) = 1 for each a ∈ A.) We define Zi so that it contains each Z ⊆ Ai such that there exists a maximum b2-matching M of G′ i having the property that vertices of Ai matched in M form the set Z. Notice that all sets in Zi have the same cardinality. For each A′ i ⊆ Ai define d(A′ i, ∃Z∈ZiB ⊆ Z}. Suppose that in Ai, the set of matched in the current b1-matching M1 vertices equals A′ i) = max{B : B ⊆ A′ i = (Ai ∪ Hi, E′ i. Then let si = A′ i − d(A′ i). Lemma 1 For each A′ i ⊆ Ai, we can compute d(A′ i) in polynomial time. i. Let B′ ⊆ A′ i) = B. Otherwise check if there exists in G′ Proof. It suffices to compute the largest subset B ⊆ A such that there exists a maximum b2-matching M of G′ i, that matches all vertices of B. To this end, first compute any maximum b2-matching M of G′ i, set B = B′ and d(A′ i an alternating path P = (a1, h1, a2, h2, . . . , an) such that a1 ∈ A′ i. If P exists, set M = M ⊕ P . This way new M is clearly of maximum cardinality (as P is of even length) and B′ has increased by one. Repeat computing an alternating path of this type as long as possible. At the end B′ will be our desired set B. ✷ i denote vertices matched in M. If B′ = M or B′ = A′ i \ B′ and an /∈ A′ If Ai of the partition of A is such that si > 0 we will say that it is excessive and if it such that i) < Z, where Z ∈ Zi, we will say that it is deficient. Notice that a set can be both excessive d(A′ and deficient. If a set is neither deficient nor excessive, then we call it equal. Suppose we have a maximum b1-matching M1 of G1, but it is not a z-partition matching. Then in the partition of A there is at least one deficient set. We define a z-improving sequence as a sequence 10 P1, P2, . . . , Ps of edge-disjoint alternating paths such that each Pj = (aj, . . . , a′ j) begins with a non- M1-edge and ends with an M1-edge, a1 is from a deficient set, as is from an excessive set, for each j ≤ s − 1 vertices a′ j and aj+1 are of the same equal set At of the partition of A (they can denote the same vertex) and for each j ≤ s − 1 if a′ j} ∪ {aj+1} ∈ Zt. Lemma 2 A z-improving sequence, if exists, can be found in polynomial time. j ∈ At, then A′ t \ {a′ Lemma 3 If z-improving sequence (with respect to any maximum b1-matching of G1) does not exist, then G1 does not contain a z-partition matching. Algorithm for computing a z-partition matching looks exactly as algorithm for a partition match- ing, only it finds a z-improving sequence instead of an improving sequence. Algorithm A' is similar to Algorithm A, but it computes a different partition of A′. The partition in Algorithm A' is established as follows. First we compute a maximum b2-matching M ′ 2 of G2. Next we find the (E, O, U )-partition of A into O−, E− and U-vertices. Two O-vertices a1, a2 of A will belong to one set of partition of A iff there exists h ∈ H such that there exists an M ′ 2-alternating path (a). Additional set, from a1 to h and from a2 to h. For such a set Ai we will have ki = Pa∈Ai say (p + 1)th of the partition will be formed by the remaining agents of A and we will have kp+1 = 0. degM ′ 2 References [1] D.J. Abraham, R.W. Irving, T. Kavitha, and K. Mehlhorn. Popular matchings. SIAM Journal on Computing, 37:1030-1045, 2007. [2] D.J. Abraham, T. Kavitha: Voting Paths. SIAM J. Discrete Math. 24(2): 520-537 (2010). [3] P. Gardenfors: Match making: Assignments based on bilateral preferences. Behavioural Sci- ences, 20 (1975), pp. 166-173. [4] G. Cornuejols. General factors of graphs. J. Comb. Theory, Ser.B 45(2):185-198 (1988). [5] M.E. Dyer and A.M.Friese, Planar 3DM is NP-complete. J.Algorithms 7 (1986), 174-184. [6] C.-C. Huang, T. Kavitha, D. Michail, and M. Nasre. Bounded unpopularity matchings. In Pro- ceedings of SWAT 2008: the 12th Scandinavian Workshop on Algorithm Theory, volume 5124 of Lecture Notes in Computer Science, pages 127-137. Springer, 2008. [7] R.W. Irving, T. Kavitha, K. Mehlhorn, D. Michail, and K. Paluch. Rank-maximal matchings. ACM Transactions on Algorithms, 2(4):602-610, 2006. [8] T. Kavitha and M. Nasre. Optimal popular matchings. In Proceedings of Match-UP 2008: Work- shop on Matching Under Preferences - Algorithms and Complexity, held at ICALP 2008, pages 46-54, 2008. [9] T. Kavitha and C.D. Shah. Efficient algorithms for weighted rank-maximal matchings and related problems. In Proceedings of ISAAC 2006: the Seventeenth International Symposium on Algo- rithms and Computation, volume 4288 of Lecture Notes in Computer Science, pages 153-162. Springer, 2006. 11 [10] Telikepalli Kavitha, Julián Mestre, Meghana Nasre: Popular Mixed Matchings. ICALP (1) 2009: 574-584. [11] L.Lovasz, M.D.Plummer: Matching Theory. Ann. Discrete Math. 29, North-Holland, Amster- dam, 1986. [12] M. Mahdian. Random popular matchings. In Proceedings of EC 06: the 7th ACM Conference on Electronic Commerce, pages 238-242. ACM, 2006. [13] D.F. Manlove and C.T.S. Sng. Popular matchings in the Capacitated House Allocation problem. In Proceedings of ESA 06: the 14th Annual European Symposium on Algorithms, volume 4168 of Lecture Notes in Computer Science, pages 492-503. Springer, 2006. [14] R.M. McCutchen. The least-unpopularity-factor and least-unpopularity-margin criteria for matching problems with one-sided preferences. In Proceedings of LATIN 2008: the 8th Latin- American Theoretical INformatics symposium, volume 4957 of Lecture Notes in Computer Sci- ence, pages 593-604. Springer, 2008. [15] E. McDermid and R.W. Irving. Popular Matchings: Structure and Algorithms. COCOON 2009: 506-515. [16] J. Mestre. Weighted popular matchings. In Proceedings of ICALP 06: the 33rd International Col- loquium on Automata, Languages and Programming, volume 4051 of Lecture Notes in Computer Science, pages 715-726. Springer, 2006. [17] C.T.S. Sng and D.F. Manlove. Popular matchings in the weighted capacitated house allocation problem. J. Discrete Algorithms 8(2): 102-116 (2010) 12
1007.5450
1
1007
2010-07-30T13:49:18
Known Algorithms on Graphs of Bounded Treewidth are Probably Optimal
[ "cs.DS", "cs.CC", "cs.DM" ]
We obtain a number of lower bounds on the running time of algorithms solving problems on graphs of bounded treewidth. We prove the results under the Strong Exponential Time Hypothesis of Impagliazzo and Paturi. In particular, assuming that SAT cannot be solved in (2-\epsilon)^{n}m^{O(1)} time, we show that for any e > 0; {\sc Independent Set} cannot be solved in (2-e)^{tw(G)}|V(G)|^{O(1)} time, {\sc Dominating Set} cannot be solved in (3-e)^{tw(G)}|V(G)|^{O(1)} time, {\sc Max Cut} cannot be solved in (2-e)^{tw(G)}|V(G)|^{O(1)} time, {\sc Odd Cycle Transversal} cannot be solved in (3-e)^{tw(G)}|V(G)|^{O(1)} time, For any $q \geq 3$, $q$-{\sc Coloring} cannot be solved in (q-e)^{tw(G)}|V(G)|^{O(1)} time, {\sc Partition Into Triangles} cannot be solved in (2-e)^{tw(G)}|V(G)|^{O(1)} time. Our lower bounds match the running times for the best known algorithms for the problems, up to the e in the base.
cs.DS
cs
Known Algorithms on Graphs of Bounded Treewidth are Probably Optimal Daniel Lokshtanov∗ D´aniel Marx† Saket Saurabh‡ May 28, 2018 Abstract We obtain a number of lower bounds on the running time of algorithms solving problems on graphs of bounded treewidth. We prove the results under the Strong Exponential Time Hypothesis of Impagliazzo and Paturi. In particular, assuming that SAT cannot be solved in (2 − ǫ)nmO(1) time, we show that for any ǫ > 0; • INDEPENDENT SET cannot be solved in (2 − ǫ)tw(G)V (G)O(1) time, • DOMINATING SET cannot be solved in (3 − ǫ)tw(G)V (G)O(1) time, • MAX CUT cannot be solved in (2 − ǫ)tw(G)V (G)O(1) time, • ODD CYCLE TRANSVERSAL cannot be solved in (3 − ǫ)tw(G)V (G)O(1) time, • For any q ≥ 3, q-COLORING cannot be solved in (q − ǫ)tw(G)V (G)O(1) time, • PARTITION INTO TRIANGLES cannot be solved in (2 − ǫ)tw(G)V (G)O(1) time. Our lower bounds match the running times for the best known algorithms for the problems, up to the ǫ in the base. 1 Introduction It is well-known that many NP-hard graph problems can be solved efficiently if the treewidth (tw(G)) of the input graph G is bounded. For an example, an expository algorithm to solve VERTEX COVER and INDEPENDENT SET running in time O∗(4tw(G)) is described in the algorithms textbook by Kleinberg and Tardos [15] (the O∗ notation suppresses factors polynomial in the input size), while the book of Niedermeier [20] on fixed-parameter algorithms presents an algorithm with running time O∗(2tw(G)). Similar algorithms, with running times on the form O∗(ctw(G)) for a constant c, are known for many other graph problems such as DOMINATING SET, q-COLORING and ODD CYCLE TRANSVERSAL [1, 9, 10, 27]. Algorithms for graph problems on bounded treewidth graphs have found many uses as subroutines in approximation algorithms [7, 8], parameterized algorithms [6, 19, 26], and exact algorithms [12, 23, 28]. In this paper, we show that any improvement over the currently best known algorithms for a number of well-studied problems on graphs of bounded treewidth would yield a faster algorithm for SAT. In particular, we show if there exists an ǫ > 0 such that • INDEPENDENT SET can be solved in O∗((2 − ǫ)tw(G)) time, or • DOMINATING SET can be solved in O∗((3 − ǫ)tw(G)) time, or • MAX CUT can be solved in O∗((2 − ǫ)tw(G)) time, or ∗Department of Informatics, University of Bergen, Norway. [email protected] †School of Computer Science, Tel Aviv University, Tel Aviv, Israel. [email protected] ‡The Institute of Mathematical Sciences, India. [email protected] 1 • ODD CYCLE TRANSVERSAL can be solved in O∗((3 − ǫ)tw(G)) time, or • there is a q ≥ 3 such that q-COLORING can be solved in O∗((q − ǫ)tw(G)) time, or • PARTITION INTO TRIANGLES can be solved in O∗((2 − ǫ)tw(G)) time, then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. Here n is the number of variables in the input formula to SAT. Such an algorithm would violate the Strong Exponential Time Hypothesis (SETH) of Impagliazzo and Paturi [13]. Thus, assuming SETH, the known algorithms for the mentioned problems on graphs of bounded treewidth are essentially the best possible. To show our results we give polynomial time many-one reductions that transform n-variable boolean formulas φ to instances of the problems in question. Such reductions are well-known, but for our results we need to carefully control the treewidth of the graphs that our reductions output. A typical reduction creates n gadgets corresponding to the n variables; each gadget has a small constant number of vertices. In most cases, this implies that the treewidth can be bounded by O(n). However, to prove the a lower bound of the form O∗((2 − ǫ)tw(G)), we need that the treewidth of the constructed graph is (1 + o(1))n. Thus we can afford to increase the treewidth by at most one per variable. For lower bounds above O∗((2 − ǫ)tw(G)), we need even more economical constructions. To understand the difficulty, consider the DOMINATING SET problem, here we want to say that if DOMINATING SET admits an algorithm with running time O∗((3 − ǫ)tw(G)) = O∗(2log(3−ǫ)tw(G)) for some ǫ > 0, then we can solve SAT on input formulas with n-variables in time O∗((2 − δ)n) for some δ > 0. Therefore by naıvely equating the exponent in the previous sentence we get that we need to construct an instance for DOMINATING SET whose treewidth is essentially n log 3. In other words, each variable should increase treewidth by less than one. The main challenge in our reductions is to squeeze out as many combinatorial possibilities per increase of treewidth as possible. In order to control the treewidth of the graphs we construct, we upper bound the pathwidth (pw(G)) of the constructed instances and use the fact that for any graph G, tw(G) ≤ pw(G). Thus all of our lower bounds also hold for problems on graphs of bounded pathwidth. Complexity Assumption: The Exponential Time Hypothesis (ETH) and its strong variant (SETH) are conjectures about the exponential time complexity of k-SAT. The k-SAT problem is a restriction of SAT, where every clause in input boolean formula φ has at most k literals. Let sk = inf{δ : k-SAT can be solved in 2δn time}. The Exponential Time Hypothesis conjectured by Impagliazzo, Paturi and Zane [14] is that s3 > 0. In [14] it is shown that ETH is robust, that is s3 > 0 if and only if there is a k ≥ 3 such that sk > 0. In the same year it was shown that assuming ETH the sequence {sk} increases infinitely often [13]. Since SAT has a O∗(2n) time algorithm, {sk} is bounded by above by one, and Impagliazzo and Paturi [13] conjecture that 1 is indeed the limit of this sequence. In a subsequent paper [3], this conjecture is coined as SETH. While ETH is now a widely believed assumption, and has been used as a starting point to prove running time lower bounds for numerous problems [5, 4, 11, 18, 17], SETH remains largely untouched (with one exception [21]). The reason for this is two-fold. First, the assumption that limk→∞ sk = ∞ is a very strong one. Second, when proving lower bounds under ETH we can utilize the Sparsification Lemma [14] which allows us to reduce from instances of 3-SAT where the number of clauses is linear in the number of variables. Such a tool does not exist for SETH, and this seems to be a major obstruction for showing running time lower bounds for interesting problems under SETH. We overcome this obstruction by circumventing it – in order to show running time lower bounds for algorithms on bounded treewidth graphs sparsification is simply not required. We would like to stress that our results make sense, even if one does not believe in SETH. In particular, our results show that one should probably wait with trying to improve the known algorithms for graphs of bounded treewidth until a faster algorithm for SAT is around. Related Work. Despite of the importance of fast algorithms on graphs of bounded treewidth or path- width, there is no known natural graph problem for which we know an algorithm outperforming the 2 naıve approach on bounded pathwidth graphs. For treewidth, the situation is slightly better: Alber et al. [1] gave a O∗(4tw(G)) time algorithm for DOMINATING SET, improving over the natural O∗(9tw(G)) algorithm of Telle and Proskurowski [25]. Recently, van Rooij et al. [27] observed that one could use fast subset convolution [2] to improve the running time of algorithms on graphs of bounded treewidth. Their results include a O∗(3tw(G)) algorithm for DOMINATING SET and a O∗(2tw(G)) time algorithm for PARTITION INTO TRIANGLES. Interestingly, the effect of applying subset convolution was that the running time for several graph problems on bounded treewidth graphs became the same as the running time for the problems on graphs of bounded pathwidth. In [27], van Rooij et al. believe that their algorithms are probably optimal, since the running times of their algorithms match the size of the dynamic programming table, and that improving the size of the table without losing time should be very difficult. Our results prove them right: improving their algorithm is at least as hard as giving an improved algorithm for SAT. 2 Preliminaries In this section we give various definitions which we make use of in the paper. Let G be a graph with vertex set V (G) and edge set E(G). A graph G′ is a subgraph of G if V (G′) ⊆ V (G) and E(G′) ⊆ E(G). For subset V ′ ⊆ V (G), the subgraph G′ = G[V ′] of G is called a subgraph induced by V ′ if E(G′) = {uv ∈ E(G) u, v ∈ V ′}. By N (u) we denote (open) neighborhood of u in graph G that is the set of all vertices adjacent to u and by N [u] = N (u) ∪ {u}. Similarly, for a subset D ⊆ V , we define N [D] = ∪v∈DN [v]. A tree decomposition of a graph G is a pair (X , T ) where T is a tree and X = {Xi i ∈ V (T )} is a collection of subsets of V such that: 1. Si∈V (T ) Xi = V (G), 2. for each edge xy ∈ E(G), {x, y} ⊆ Xi for some i ∈ V (T ); 3. for each x ∈ V (G) the set {i x ∈ Xi} induces a connected subtree of T . The width of the tree decomposition is maxi∈V (T ){Xi − 1}. The treewidth of a graph G is the minimum width over all tree decompositions of G. We denote by tw(G) the treewidth of graph G. If in the definition of treewidth we restrict the tree T to be a path then we get the notion of pathwidth and denote it by pw(G). For our purpose we need an equivalent definition of pathwidth via mixed search games. In a mixed search game, a graph G is considered as a system of tunnels. Initially, all edges are contaminated by a gas. An edge is cleared by placing searchers at both its end-points simultaneously or by sliding a searcher along the edge. A cleared edge is re-contaminated if there is a path from an uncleared edge to the cleared edge without any searchers on its vertices or edges. A search is a sequence of operations that can be of the following types: (a) placement of a new searcher on a vertex; (b) removal of a searcher from a vertex; (c) sliding a searcher on a vertex along an incident edge and placing the searcher on the other end. A search strategy is winning if after its termination all edges are cleared. The mixed search number of a graph G, denoted by ms(G), is the minimum number of searchers required for a winning strategy of mixed searching on G. Takahashi, Ueno and Kajitani [24] obtained the following relationship between pw(G) and ms(G), which we use for bounding the pathwidth of the graphs obtained in reduction. Proposition 1 ([24]). For a graph G, pw(G) ≤ ms(G) ≤ pw(G) + 1. An instance to SAT will always consists of a boolean formula φ = C1 ∧ · · · ∧ Cm over n variables {v1, . . . , vn} where each clause Ci is OR of one or more literals of variables. We also denote a clause Ci by the set {ℓ1, ℓ2, . . . , ℓc} of its literals and denote by Ci the number of literals in Ci. An assignment τ to the variables is an element of {0, 1}n, and it satisfies the formula φ if for every clause Ci there is literal that is assigned 1 by τ . We say that a variable vi satisfies a clause Cj if there exists a literal corresponding to vi in {ℓ1, ℓ2, . . . , ℓc} and it is set to 1 by τ . A group of variables satisfy a clause Cj if there is a variable that satisfies the clause Cj. All the sections in this paper follows the following pattern: definition of the problem; statement of the lower bound; construction used in the reduction; correctness of the reduction; and the upper bound on the pathwidth of the resultant graph. 3 3 Independent Set An independent set of a graph G is a set S ⊆ V (G) such that G[S] contains no edges. In the INDEPEN- DENT SET problem we are given a graph G and the objective is to find an independent set of maximum size. Theorem 1. If INDEPENDENT SET can be solved in O∗((2 − ǫ)tw(G)) for some ǫ > 0 then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. i i j 1, cp′ 2 . . . cp′ i . . . p2m c having c vertices each, and connect cpi with cp′ Construction. Given an instance φ to SAT we construct a graph G as follows. We assume that every clause has an even number of variables, if not we can add a single variable to all odd size clauses and force this variable to false. First we describe the construction of clause gadgets. For a clause C = {ℓ1, ℓ2, . . . , ℓc} we make a gadget bC as follows. We take two paths, CP = cp1, cp2 . . . , cpc and CP ′ = cp′ i for every i. For each literal ℓi we make a vertex ℓi in bC and make it adjacent to cpi and cp′ i. Finally we add two vertices cstart and cend, such that cstart is adjacent to cp1 and cend is adjacent to cpc. Observe that the size of the maximum independent set of bC is c + 2. Also, since c is even, any independent set of size c + 2 in bC must contain at least one vertex in C = {ℓ1, ℓ2, . . . , ℓc}. Finally, notice that for any i, there is an independent set of size c + 2 in bC that contains ℓi and none of ℓj for j 6= i. We first construct a graph G1. We make n paths P1, . . . , Pn, each path of length 2m. Let the vertices of the path Pi be p1 . The path Pi corresponds to the variable vi. For every clause Ci of φ we make a gadget bCi. Now, for every variable vi, if vi occurs positively in Cj, we add an edge between p2j and the literal corresponding to vi in bCj. If vi occurs negatively in Cj, we add an edge between p2j−1 and the literal corresponding to vi in bCj. Now we construct the graph G as follows. We take n + 1 copies of G1, call them G1, . . . Gn+1. For every i ≤ n we connect Gi and Gi+1 by connecting p2m in Gi with p1 j in Gi+1 for every j ≤ n. This concludes the construction of G. Lemma 1. If φ is satisfiable, then G has an independent set of size (mn + Pi≤m Ci + 2)(n + 1). Proof. Consider a satisfying assignment to φ. We construct an independent set I in G. For every variable vi if vi is set to true, then pick all the vertices on odd positions from all copies of Pi, that is p1 i , p5 i i , p6 and so on. If vi is false then pick all the vertices on even positions from all copies of Pi, that is p2 i and so on. It is easy to see that this is an independent set of size mn(n + 1) containing vertices from all the paths. We will now consider the gadget bCj corresponding to a clause Cj. We will only consider the copy of bCj in G1 as the other copies can be dealt identically. Let use choose a true literal ℓa in Cj and let vi be the corresponding variable. Consider the vertex ℓa in bCj. If vi occurs positively in Cj then vi is true. Then I does not contain p2j i , the only neighbour of ℓa outside of bCj. On the other hand if vi occurs negatively in Cj then vi is false. In this case I does not contain p2j−1 , the only neighbour of ℓa outside of bCj. There is an independent set of size Cj + 2 in bC that contains ℓa and none out of ℓb, b 6= a. We add this independent set to I and proceed in this manner for every clause gadget. By the end of the process (Pi≤m Ci + 2)(n + 1) vertices from clause gadgets are added to I, yielding that the size of I is (mn + Pi≤m Ci + 2)(n + 1), concluding the proof. Lemma 2. If G has an independent set of size (2mn + Pi≤m Ci + 2)(n + 1), then φ is satisfiable. Proof. Consider an independent set of G of size (mn + Pi≤m Ci + 2)(n + 1). The set I can contain at most m vertices from each copy of Pi for every i ≤ n and at most Cj + 2 vertices from each copy of the gadget Cj. Since I must contain at least these many vertices from each path and clause gadget in order to contain at least (mn + Pi≤m Ci + 2)(n + 1) vertices, it follows that I has exactly m vertices in each copy of each path Pi and exactly Cj + 2 vertices in each copy of each clause gadget bCj. For a fixed j, consider the n + 1 copies of the path Pj. Since Pj in Gi is attached to Pj in Gi+1 these n + 1 i , p3 i , p4 i i 4 cstart cp′ 1 bCj cp1 cpc ℓ1 ℓc cend p2j−1 1 p2j 1 PSfrag replacements P1 Pn Figure 1: Reduction to INDEPENDENT SET: clause gadget bCj attached to the n paths representing the variables. p2j−1 n p2j n copies of Pi together form a path P having 2m(n + 1) vertices. Since I ∩ P = m(n + 1) it follows that I ∩ P must contain every second vertex of P , except possibly in one position where I ∩ P skips two vertices of P . There are only n paths and n + 1 copies of G1, hence the pigeon-hole principle yields that in some copy Gy of G1, I contains every second vertex on every path Pi. From now onwards we only consider such a copy Gy. In Gy, for every i ≤ n, I contains every second vertex of Pi. We make an assignment to the variables of φ as follows. If I contains all the odd numbered vertices of Pi then vi is set to true, otherwise I contains all the even numbered vertices of Pi and vi is set to false. We argue that this assignment satisfies φ. Indeed, consider any clause Cj, and look at the gadget bCj. We know that I contains Cj + 2 vertices from bCj and hence I must contain a vertex ℓa in corresponding to a literal of Cj. Suppose ℓa is a literal of vi. Since I contains ℓa, if ℓa occurs positively in Cj, then I can not contain p2j i and hence vi is true. Similarly, if ℓa occurs negatively in Cj then I can not contain p2j−1 and hence vi is false. In both cases vi satisfies Cj and hence all clauses of φ are satisfied by the assignment. i Lemma 3. pw(G) ≤ n + 4. i Proof. We give a mixed search strategy to clean G using n + 3 searchers. For every i we place a searcher on the first vertex of Pi in G1. The n searchers slide along the paths P1, . . . Pn in m rounds. In round j each searcher i starts on p2j−1 . Then, for every variable vi that occurs positively in Cj, the searcher i slide forward to p2j . Observe that at this point there is a searcher on every neighbour of the gadget bCj. i This gadget can now be cleaned with 3 additional searchers. After bCj is clean, the additional 3 searchers are removed, and each of the n searchers on the paths P1, . . . Pn slide forward along these paths, such that searcher i stands on p2(j+1) . At that point, the next round commences. When the searchers have cleaned G1 they slide onto the first vertex of P1 . . . Pn in G2. Then they proceed to clean G2, . . . , Gn+1 in the same way that G1 was cleaned. Now applying Proposition 1 we get that pw(G) ≤ n + 4. i 5 PSfrag replacements p3 1 p3 1 p1 1 p3 1 P1 g1 g′ 1 p1 p Pp gp p3 1 g′ p p3 1 p3 p xS x′ S x Figure 2: Reduction to DOMINATING SET: group gadget bB. The set S is shown by the circled vertices. The construction, together with Lemmata 1, 2 and 3 proves Theorem 1. 4 Dominating Set A dominating set of a graph G is a set S ⊆ V (G) such that V (G) = N [S]. In the DOMINATING SET problem we are given a graph G and the objective is to find a dominating set of minimum size. Theorem 2. If DOMINATING SET can be solved in O∗((3 − ǫ)pw(G)) time for some ǫ > 0 then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. i, both of which are neighbours to p1 i , p2 i . To each path Pi we attach two guards gi and g′ Construction. Given ǫ < 1 and an instance φ to SAT we construct a graph G as follows. We first chose an integer p depending only on ǫ. Exactly how p is chosen will be discussed in the proof of Theorem 2. We group the variables of φ into groups F1, F2, . . . , Ft, each of size at most β = ⌊log 3p⌋. Hence t = ⌈n/β⌉. We now proceed to describe a "group gadget" bB, which is central in our construction. To build the group gadget bB we make p paths P1, . . . , Pp, where the path Pi contains the vertices p1 i , p2 i and p3 i and p3 i . When the gadgets are attached to each other, the guards will not have any neighbours outside of their own gadget bB, and will ensure that at least one vertex out of p1 i are chosen in any minimum size dominating set of G. Let P be a vertex set containing all the vertices on the paths P1, . . . , Pp. For every subset S of P that picks exactly one vertex from each path Pi we make two vertices xS and x′ S, where xS is adjacent to all vertices of P \ S (all those vertices that are on paths and not in S) and x′ S is only adjacent to xS. We conclude the construction of bB by making all the vertices x′ S (for every set S) adjacent to each other, that is making them into a clique, and adding a guard x adjacent to x′ S for every set S. Essentially x′ S's together with x forms a clique and all the neighbors of x reside in this clique. We construct the graph G as follows. For every group Fi of variables we make m(2pt + 1) copies i for 1 ≤ j ≤ m(2pt + 1). For every fixed i ≤ t we connect the gadgets in a path-like manner. In particular, for every j < m(2pt + 1) and every ℓ ≤ p . Now we make two new of the gadget bB, call them bBj bB1 i , bB2 we make an edge between p3 i . . . , bBm(2pt+1) i , p2 i and p3 i ℓ in the gadget bBj i with p1 ℓ in the gadget bBj+1 i 6 bcℓ j bBx 1 bBx t h h′ PSfrag replacements Figure 3: Reduction to DOMINATING SET: arranging the group gadgets. Note that x = mℓ + j, thus bcℓ is attached to vertices in bBx 1 , . . . , bBx t . j j in bBm(2pt+1) i j in bB1 i in a path-like manner. i , bB2 i . . . , bBm(2pt+1) i for every i ≤ t, j ≤ p and to p3 vertices h and h′, with h adjacent to h′, p1 for every i ≤ t, j ≤ p. That is, for all 1 ≤ i ≤ t, h is adjacent to first and last vertices of "long paths" obtained after connecting the gadgets bB1 For every 1 ≤ i ≤ t, and to every assignment of the variables in the group Fi, we designate a subset S of P in the gadget bB that picks exactly one vertex from each path Pj. Since there are at most 2β different assignments to the variables in Fi, and there are 3p ≥ 2β such sets S, we can assign a unique set to each assignment. Of course, the same set S can correspond to one assignment of the group F1 and some another assignment of the group F2. Recall that the clauses of φ are C1, . . . , Cm. For every clause Cj we make 2pt + 1 vertices bcℓ j will be connected to the gadgets bBmℓ+j for every 1 ≤ i ≤ t. In particular, for every assignment of the variables in the group Fi that satisfy the clause Cj, we consider the subset S of P that corresponds to the assignment. For every 0 ≤ ℓ < 2n + 1, we make x′ j. The best way to view this is that every clause Cj has 2pt + 1 private gadgets, bBj , in every group of gadgets corresponding to Fi's. Now we have 2pt + 1 vertices corresponding to the clause Cj, one each for one gadget from each group gadgets corresponding to Fi's. This concludes the construction of G. j, one for each 0 ≤ ℓ < 2pt + 1. The vertex bcℓ adjacent to bcℓ , . . . , bBm2pt+j S in bBmℓ+j i , bBm+j i i i i Lemma 4. If φ has a satisfying assignment, then G has a dominating set of size (p + 1)tm(2pt + 1) + 1. Proof. Given a satisfying assignment to φ we construct a dominating set D of G that contains the vertex h and exactly p + 1 vertices in each gadget bBj i . For each group Fi of variables we consider the set S which corresponds to the restriction of the assignment to the variables in Fi. From each gadget bBj i we add the set S to D and also the vertex x′ S to D. It remains to argue that D is indeed a dominating set. Clearly the size is bounded by (p + 1)tm(2pt + 1) + 1, as the number of gadgets is tm(2pt + 1). For a fixed i ≤ t and j consider the vertices on the path Pj in the gadgets bBℓ i for every ℓ ≤ m(2pt + 1). Together these vertices form a path of length 3m(2pt + 1) and every third vertex of this 7 path is in S. Thus, all vertices on this path are dominated by other vertices on the path, except for the first and last one. Both these vertices, however, are dominated by h. Now, fix some i ≤ t and l ≤ m(2pt + 1) and consider the gadget bBℓ i . Since D contains some vertex on the path Pj, we have that for every j both gj and g′ j are dominated. Furthermore, for every set S∗ not equal to S that picks exactly one vertex from each Pj, vertex xS∗ is dominated by some vertex on some Pj-namely by all vertices in S \ S∗ 6= ∅. The last assertion follows since xS∗ is connected to all the vertices on paths except S∗. On the other hand, xS is dominated by x′ S also dominates all the other vertices x′ S∗ for S∗ 6= S and the guard x. The only vertices not yet accounted for are the vertices bcℓ j for every j ≤ m and ℓ < 2pt + 1. Fix a j and a ℓ and consider the clause Cj. This clause contains a literal set to true, and this literal corresponds to a variable in the group Fi for some i ≤ t. Of course, the assignment to Fi satisfies Cj. Let S be the set corresponding to this assignment of Fi. By the construction of D, the dominating set contains x′ S in bBmℓ+j Lemma 5. If G has a dominating set of size (p + 1)tm(2pt + 1) + 1, then φ has a satisfying assignment. j. This concludes the proof. S is adjacent to bcℓ S, and x′ and x′ i Proof. Let D be a dominating set of G of size at most (p + 1)tm(2pt + 1) + 1. Since D must dominate h′, hence without loss of generality we can assume that D contains h. Furthermore, inside every gadget bBℓ i , D must dominate all the guards, namely gj and g′ j for every j ≤ p, and also x. Thus D contains at least p + 1 vertices from each gadget bBℓ i which in turn implies that D contains exactly p + 1 vertices from each gadget bBℓ j for every j and in addition dominate x with only p + 1 verticesis if D has one vertex from each Pj, j ≤ p and in addition contains some vertex in N [x]. Let S be D ∩ P in bBℓ i . Observe that xS is not dominated by D ∩ S. The only vertex in N [x] that dominates xS is x′ i . The only way D can dominate gj and g′ S and hence D contains x′ S. i and S′ be D ∩ P in bBℓ+1 , 1 ≤ r ≤ m. Consider a gadget bBℓ . Observe that if S contains pa Now we want to show that for every 1 ≤ i ≤ t there exists one 0 ≤ ℓ ≤ 2tp such that for fixed i, D ∩ P is same in all the gadgets bBmℓ+r . Let S be D ∩ P in bBℓ then we must have b ≤ a. We call a consecutive pair bad if for some j ≤ p, D contains pa j in bBℓ+1 and b < a. Hence for a fixed i, we can at most have 2p consecutive bad pairs. Now we mark all the bad pairs that occur among the gadgets corresponding to some Fi. This way we can mark only 2tp bad pairs. Thus, by the pigeon hole principle, there exists an ℓ ∈ {0, . . . , 2tp} such that there are no bad pairs in bBmℓ+r i and its follower, bBℓ+1 j in bBℓ j in bBℓ+1 We make an assignment φ by reading off D ∩ P in each gadget bBmℓ+1 . In particular, for every group Fi, we consider S = D ∩ P in the gadget bBmℓ+1 . This set S corresponds to an assignment of Fi, and this is the assignment of Fi that we use. It remains to argue that every clause Cr is satisfied by this assignment. for all 1 ≤ i ≤ t and 1 ≤ r ≤ m. j in bBℓ i and pb i and pb i i i i i i i i ℓ. We know that it is dominated by some x′ Consider the vertex bcr . The set S corresponds to an assignment of Fi that satisfies the clause Cr. Because D ∩ P remains unchanged in all gadgets from bBmℓ+1 , this is exactly the assignment φ restricted to the group Fi. This concludes the proof. S in a gadget bBmℓ+r to bBmℓ+r i i i j and p3 Lemma 6. pw(G) ≤ tp + O(3p) Proof. We give a mixed search strategy to clean the graph with tp + O(3p) searchers. For a gadget bB we call the vertices p1 j , 1 ≤ j ≤ p, as entry vertices and exit vertices respectively. We search the graph in m(2tp + 1) rounds. In the beginning of round ℓ there are searchers on the entry vertices of the gadgets bBℓ i for every i ≤ t. Let 1 ≤ a ≤ m and 0 ≤ b < 2tp + 1 be integers such that ℓ = a + mb. We place a searcher on bcb a. Then, for each i between 1 and p in turn we first put searchers on all vertices of bBℓ i and then remove all the searchers from bBℓ i except for the ones standing on the exit vertices. After all gadgets bBℓ a. To commence t have been cleaned in this manner, we can remove the searcher from bcb 1 . . . bBℓ 8 the next round, the searchers slide from the exit positions of bBℓ for every i. In total, at most tp + V ( bB) + 1 ≤ tp + O(3p) searchers are used simultaneously. This together with Proposition 1 give the desired upperbound on the pathwidth. i to the entry positions of bBℓ+1 i Proof (of Theorem 2). Suppose DOMINATING SET can be solved in O∗((3 − ǫ)pw(G))= O∗(3λpw(G)) log 3 for some δ′ < 1. time, where λ = log3(3−ǫ) < 1. We choose p large enough such that λ· Given an instance of SAT we construct an instance of DOMINATING SET using the above construction and the chosen value of p. Then we solve the DOMINATING SET instance using the O∗(3λpw(G)) time algorithm. Correctness is ensured by Lemmata 4 and 5. Lemma 6 yields that the total time taken is upper bounded by O∗(3λpw(G)) ≤ O∗(3λ(tp+f (λ))) ≤ O∗(3λ log 3 ) ≤ O∗(2δ′′n) =O∗((2 − δ)n), for some δ′′, δ < 1. This concludes the proof. ⌊p log 3⌋ ) ≤ O∗(3δ′ n np p ⌊p log 3⌋ = δ′ 5 Max Cut A cut in a graph G is a partition of V (G) into V0 and V1. The cut-set of the cut is the set of edges whose one end point is in V0 and the other in V1. We say that an edge is crossing this cut if it has one endpoint in V0 and one in V1, that is, the edge is in the cut-set. The size of the cut is the number of edges in G which are crossing this cut. If the edges of G have positive integer weights then the weight of the cut is the sum of the weights of edges which are crossing the cut. In the MAX CUT problem we are given a graph G together with an integer t and asked whether there is a cut of G of size at least t. In the WEIGHTED MAX CUT problem every edge has a positive integer weight and the objective is to find a cut of weight at least t. Theorem 3. If MAX CUT can be solved in O∗((2 − ǫ)pw(G)) for some ǫ > 0 then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. Construction. Given an instance φ of SAT we first construct an instance Gw of WEIGHTED MAX CUT as follows. We later explain how to obtain an instance of unweighted MAX CUT from here. We start with making a vertex x0. Without loss of generality, we will assume that x0 ∈ V0 in every solution. We make a vertex bvi for each variable vi. For every clause Cj we make a gadget as follows. We make a path bPj having 4Cj vertices. All the edges on bPj have weight 3n. Now, we make the first and last vertex of bPj adjacent to x0 with an edge of weight 3n. Thus the path bPj plus the edges from the first and last vertex of bPj to x0 form an odd cycle bCj. We will say that the first, third, fifth, etc, vertices are on odd positions on bPj while the remaining vertices are on even positions. For every variable vi that appears positively in Cj we select a vertex p at an even position (but not the last vertex) on bPj and make bv adjacent to p and p's successor on bPj with edges of weight 1. For every variable vi that appears negatively in Cj we select a vertex p at an odd position on bPj and make bv adjacent to p and p's successor on bPj with edges of weight 1. We make sure that each vertex on bPj receives an edge at most once in this process. There are more than enough vertices on bPj to accommodate all the edges incident to vertices corresponding to variables in the clause Cj. We create such a gadget for each clause and set t = 1 + (12n + 1)Pm Lemma 7. If φ is satisfiable, then Gw has a cut of weight at least t. Proof. Suppose φ is satisfiable. We put x0 in V0 and for every variable vi we put bvi in V1 if vi is true and bvi in V0 if vi is false. For every clause Cj we proceed as follows. Let us choose a true literal of Cj and suppose that this literal corresponds to a vertex pj on bPj. We put the first vertex on bPj in V1, the second in V0 and then we proceed along bPj putting every second vertex into V1 and V0 until we reach pj. The j of pj on bPj is put into the same set as pj. Then we continue along cPj putting every second successor p′ vertex in V1 and V0. Notice that even though Cj may contain more than one literal that is set to true, we j=1 Cj. This concludes the construction. 9 For every clause Cj all edges on the path bPj except for pjp′ only select one vertex pj from the path bPj and put pj and its successor on the same side of the partition. It remains to argue that this cut has weight at least t. j are crossing, and the two edges to x0 from the first and last vertex of bPj are crossing as well. These edges contribute 12nCj to the weight of the cut. We know that pj corresponds to a literal that is set to true, and this literal corresponds to a variable vi. If vi occurs positively in Cj then vi ∈ V1 and pj is on an even position of bPj. Thus both pj and his successor p′ j are crossing, contributing 2 to the weight of the cut. For each of the remaining variables vi′ appearing in Cj, one of the two neighbours of bvi′ on bPj appear in V0 and one in V1, so exactly one edge from vi′ to bPj is crossing. Thus the total weight of the cut is t = Pm Lemma 8. If Gw has a cut of weight at least t, then φ is satisfiable. j are in V0 and hence both vipj and vip′ j=1 12nCj + Cj + 1 = m + (12n + 1)Pm j=1 Cj. This completes the proof. Proof. Let (V0, V1) be a cut of G of maximum weight, hence the weight of this cut is at least t. Without loss of generality, let x0 ∈ V0. For every clause Cj at least one edge of the odd cycle bCj is not crossing. If more than one edge of this cycle is not crossing, then the total weight of the cut edges incident to the path bPj is at most 3n(4Cj − 1) + 2n < 12Cj. In this case we could change the partition (V0, V1) such that all edges of bPj are crossing and the first vertex of bPj is in V1. Using the new partition the weight of the crossing edges in the cycle bCj is at least 12Cj and the edges not incident to bPj are unaffected by the changes. This contradicts that (V0, V1) was a maximum weight cut. Thus it follows that exactly one edge of bCj is not crossing. Given the cut (V0, V1) we set each variable vi to true if bvi ∈ V1 and vi to false otherwise. Consider a clause Cj and a variable vi that appears in Cj. Let uv be the edge of bC ′ j that is not crossing. If there is a variable bvi adjacent to both u and v, then it is possible that both bviu and bviv are crossing. For every other variable vi′ in Cj, at most one of the edges from bvi′ to bPj is crossing. Thus, the weight of the edges that are crossing in the gadget bCj is at most (12n + 1)Cj + 1. Hence, to find a cut-set of weight at least t in G, we need to have crossing edges in bCj with sum of their weights exactly equal to 12nCj + Cj + 1. It follows that there is a vertex bvi adjacent to both u and v such that both bviu and bviv are crossing. If vi occurs in Cj positively then u is on an even position and hence, u ∈ V0. Since bviu is crossing it follows that vi is true and Cj is satisfied. On the other hand, if vi occurs in Cj negated then u is on an odd position and hence, u ∈ V1. Since bviu is crossing it follows that vi is false and Cj is satisfied. As this holds for each clause individually, this concludes the proof. For every edge e ∈ E(Gw), let we be the weight of e in Gw. We construct an unweighted graph G from Gw by replacing every edge e = uv by we paths from u to v on three edges. Let W be the sum of the edge weights of all edges in Gw. Lemma 9. G has a cut of size 2W + t if and only if Gw has a cut of weight at least t. Proof. Given a partition of V (Gw) we partition V (G) as follows. The vertices of G that also are vertices of V (G) are partitioned in the same way as in V (Gw). On each path of length 3, if the endpoints of the path are in different sets we can partition the middle vertices of the path such that all edges are cut. If the endpoints are in the same set we can only partition the middle vertices such that 2 out of the 3 edges are cut. The reverse direction is similar. Lemma 10. pw(G) ≤ n + 5. Proof. We give a search strategy to clean G with n + 5 searchers. We place one searcher on each vertex bvi and one searcher on x0. Then one can search the gadgets cHj one by one. In Gw it is sufficient to use 2 searchers for each cHj, whereas in G after the edges have been replaced by multiple paths on three edges, we need 4 searchers. This combined with Proposition 1 gives the desired upper bound on the pathwidth of the graph. 10 The construction, together with Lemmata 7, 8, 9 and 10 proves Theorem 3. 6 Graph Coloring A q-coloring of G is a function µ : V (G) → [q]. A q-coloring µ of G is proper if for every edge uv ∈ E(G) we have µ(u) 6= µ(v). In the q-COLORING problem we are given as input a graph G and the objective is to decide whether G has a proper q-coloring. In the LIST COLORING problem, every vertex v is given a list L(v) ⊆ [q] of admissible colors. A proper list coloring of G is a function µ : V (G) → [q] such that µ is a proper coloring of G that satisfies µ(v) ∈ L(v) for every v ∈ V (G). In the q-LIST COLORING problem we are given a graph G together with a list L(v) ⊆ [q] for every vertex v. The task is to determine whether there exists a proper list coloring of G. A feedback vertex set of a graph G is a set S ⊆ V (G) such that G \ S is a forest; we denote by fvs(G) the size of the smallest such set. It is well-known that tw(G) ≤ fvs(G) + 1. Unlike in the other sections, where we give lower bounds for algorithms parameterized by pw(G), the following theorem gives also a lower bound for algorithms parameterized by fvs(G). Such a lower bound follows very naturally from the construction we are doing here, but not from the constructions in the other sections. It would be interesting to explore whether it is possible to prove tight bounds parameterized by fvs(G) for the problems considered in the other sections. Theorem 4. If q-COLORING can be solved in O∗((q − ǫ)fvs(G)) or O∗((3 − ǫ)pw(G)) time for some ǫ > 0, then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. Construction. We will show the result for LIST COLORING first, and then give a simple reduction that demonstrates that q-COLORING can be solved in O∗((q −ǫ)fvs(G)) time if and only if q-LIST COLORING can. Depending on ǫ and q we choose a parameter p. Now, given an instance φ to SAT we will construct a graph G with a list L(v) for every v, such that G has a proper list-coloring if and only if φ is satisfiable. Throughout the construction we will call color 1-red, color 2-white and color 3-black. We start by grouping the variables of φ into t groups F1, . . . , Ft of size ⌊log qp⌋. Thus t = ⌈ ⌊log qp⌋ ⌉. We will call an assignment of truth values to the variables in a group Fi a group assignment. We will say that a group assignment satisfies a clause Cj of φ if Cj contains at least one literal which is set to true by the group assignment. Notice that Cj can be satisfied by a group assignment of a group Fi, even though Cj also contains variables that are not in Fi. For each group Fi, we make a set Vi of p vertices v1 i . The vertices in Vi get full lists, that is, they can be colored by any color in [q]. The coloring of the vertices in Vi will encode the group assignment of Fi. There are qp ≥ 2Fi possible colorings of Vi. Thus, to each possible group assignment of Fi we attach a unique coloring of Vi. Notice that some colorings of Vi may not correspond to any group assignments of Fi. i , . . . , vp n For each clause Cj of φ, we make a gadget bCj. The main part of bCj is a long path bPj that has one vertex for each group assignment that satisfies bCj. Notice that there are at most tqp possible group assignments, and that q and p are constants independent of the input φ. The list of every vertex on bPj to the start and end of bPj respectively, is {red, white, black}. We attach two vertices pstart and the two vertices are not counted as vertices of the path bPj itself. The list of pstart is {white}. If V ( bPj ) is even, then the list of pend is {black}. The intention is that to properly color bPj one needs to use the color red at least once, and that once is sufficient. The position of the red colored vertex on the path bPj encodes how the clause Cj is satisfied. For every vertex v on bPj we proceed as follows. The vertex v corresponds to a group assignment to Fi that satisfies the clause Cj. This assignment in turn corresponds to a coloring of the vertices of Vi. Let this coloring be µi. We build a connector whose role is to enforce that v can be red only if coloring is {white}, whereas if V ( bPj ) is odd then the list of pend and pend j j j j j 11 w3 w4 {red, 3} {red, 2, 3, 4} w v {red, 2} {red, 2} vl i vl i w2 w3 w4 w2 w3 w4 {red, 3} {red, 4} {red, 2} w {red, 2, 3, 4} {red, 2} {red, 2} {red, 3} w′ 2 w′ 3 w′ 4 {red, 2} {red, 4} w {red, 2, 3, 4} v v Figure 4: Reduction to q-COLORING: the way the connector connects a vertex vl "bad color" x ∈ [q] \ {µi(vl i with v for a particular i)}. The left side shows the case x = red = 1, the right side x = 2 (q = 4). µi appears on Vi. To build the connector, for each vertex vl following. i ∈ Vi and color x ∈ [q] \ {µi(vl i)} we do the • If x is red, then we add one vertex wy for every color y except for red. We make wy adjacent to vl i and the list of wy is {red, y}. Then we add a vertex w which is adjacent to all vertices wy and v, and whose list is all of [q]. • If x is not red, we add two vertices wy and w′ adjacent to vl Finally we add a vertex w adjacent to w′ y adjacent to wy. The list of wy is {x, red} while the list of w′ y for all y and to v. The list of w is all of [q]. i and w′ y for each color y except for red. We make wy y is {y, red}. Notice that in the above construction we have reused the names w, wy and w′ y for many different vertices: in each connector, there is a separate vertex w for each vertex vl i)}. Build- ing a connector for each vertex v on bPj concludes the construction of the clause gadget bCj, and creating one such gadget for each clause concludes the construction of G. The following lemma summarizes the most important properties of the connector: Lemma 11. Consider the connector corresponding a vertex v on bPj and coloring µi of Vi. i ∈ Vi and color x ∈ [q]\{µi(vl 1. Any coloring on Vi and any color c ∈ {white, black} on v can be extended to the rest of the connector. 2. Coloring µi on Vi and any color c ∈ {red, white, black} on v can be extended to the rest of the connector. 3. In any coloring of the connector, if v is red, then µi appears on Vi. Proof. 1. For each vertex vl i ∈ Vi and color x ∈ [q] \ {µi(vl i)} we do the following. i, and a vertex w with list [q] adjacent to wy for every y 6= red. If vl • If x is red then in the construction of bCj we added a vertex wy with list {y, red} for every color y 6= red adjacent to vl i is colored red, then we color each vertex wy with y and w with red. Notice that w is adjacent to v, but v is colored either white or black, so it is safe to color w red. If, on the other hand, vl i is not colored red, we can color wy red for every y. Then all the neighbours of w have been colored with red, except for v which has been colored white or black. Thus it is safe to color w with the color out of black and white which was not used to color v. 12 • If x is not red, then in the construction of bCj we added two vertices wy and w′ y for each color y except for red, and also added a vertex w. The vertices wy are adjacent to vl i and for every y 6= red y is adjacent to wy. Finally w is adjacent to al the vertices w′ the vertex w′ y and to v. For every y the list of wy is {x, red} while the list of w′ i is colored with x, then we let wy take color red and w′ y take color y for every y 6= red. We color w with red. In the case that vl y be colored red for every y 6= red. Finally, all the neighours of w except for v have been colored red, while v is colored with either black or white. According to the color of v we can either color w black or white. i is colored with a color different from x, we let wy be colored with x and w′ y is {y, red}. The list of w is [q]. If vl 2. We can assume that v is red, otherwise we are done by the previous statement. For each vertex vl i ∈ Vi and color x ∈ [q] \ {µi(vl i)} we do the following. • If x is red then in the construction of bCj we added a vertex wy with list {y, red} for every color y 6= red adjacent to vl i′ is not colored red by µi, we can color wy red for every y. Then all the neighbours of w including v have been colored with red and it is safe to color w with white. i, and a vertex w with list [q] adjacent to wy for every y 6= red. Since vl • If x is not red, then in the construction of bCj we added two vertices wy and w′ except for red, and also added a vertex w. The vertices wy are adjacent to vl the vertex w′ y is adjacent to wy. Finally w is adjacent to all the vertices w′ the list of wy is {x, red} while the list of w′ with a color different from x we let wy be colored with x and w′ Finally, all the neighours of w including v have been colored red so it is safe to color w white. y for each color y i and for every y 6= red y and to v. For every y y is {y, red}. The list of w is [q]. Since µi colors vl i y be colored red for every y 6= red. 3. Suppose for contradiction that v is red, but some vertex vl i ∈ Vi has been colored with a color x 6= µi(vl i). There are two cases. If x is red, then in the construction we added vertices wy adjacent to vl i for every color y 6= red. Also we added a vertex w adjacent to v and to wy for each y 6= red. The list of wy is {red, y} and hence wy must have been colored y for every y 6= red. But then w is adjacent to v which is colored red, and to wy which is colored y for every y 6= red. Thus vertex w has all colors in its neighborhood, a contradiction. In the case when x is not red, then in the construction we added two vertices wy and w′ i and had {x, red} as its list. Since vl i is colored x, all the wy vertices must be colored red. For every y 6= red, we have that w′ y is adjacent to wy and has {red, y} as its list. Hence for every y 6= red the vertex w′ y is colored with y. But, in the construction we also added a vertex w adjacent to v and to w′ y for each y 6= red. Thus again, vertex w has all colors in its neighbourhood, a contradiction. y for each y 6= red. Each wy was adjacent to vl Lemma 12. If φ is satisfiable, then G has a proper list-coloring. Proof. Starting from a satisfying assignment of φ we construct a coloring γ of G. The assignment to φ corresponds to a group assignment to each group Fi. Each group assignment corresponds to a coloring of Vi. For every i, we let γ color the vertices of Vi using the coloring corresponding to the group assignment of Fi. Now we show how to complete this coloring to a proper coloring of G. Since the gadgets bCj are pairwise disjoint, and there are no edges going between them, it is sufficient to show that we can complete the coloring for every gadget bCj. Consider the clause Cj. The clause contains a literal that is set to true, and this literal belongs to a variable in the group Fi. The group assignment of Fi satisfies the clause Cj. Thus, there is a vertex v on bPj that corresponds to this assignment. We set γ(v) as red (that is, γ colors v red), pstart is colored with its only admissible color, namely black if V ( bPj) is even and white if V ( bPj) is odd. The remaining vertices of bPj are colored alternatingly white or black. By Lemma 11(2), the coloring can be extended to every vertex of the connector between is colored white and pend j j 13 pstart j bPj pend j PSfrag replacements v1 1 vp 1 V1 v1 t vp t Vt Figure 5: Reduction to q-COLORING. The t groups of vertices V1, . . . , Vt represent the t groups of variables F1, . . . , Ft (each of size ⌈log qp⌉). Each vertex of the clause path bPj is connected to one group Vi via a connector. Vi and v: the coloring appearing on Vi is the coloring µi corresponding to the group assignment Fi. For every other vertex u on bPj, the color of u is black or white, thus Lemma 11(1) ensures that the coloring can be extended to any connector on u. As this procedure can be repeated to color the gadget bCj for every clause Cj, we can complete γ to a proper list-coloring of G. Lemma 13. If G has a proper list-coloring γ, then φ is satisfiable. Proof. Given γ we construct an assignment to the variables of φ as follows. For every group Fi of variables, if γ colors Vi with a coloring that corresponds to a group assignment of Fi then we set this assignment for the variables in Fi. Otherwise we set all the variables in Fi to false. We need to argue that this assignment satisfies all the clauses of φ. Consider a clause Cj and the corresponding gadget bCj. By a simple parity argument, bPj can not be colored using only the colors black and white. Thus, some vertex v on bPj is colored red. The vertex v corresponds to a group assignment of some group Fi that satisfies bCj. As v is red, Lemma 11(3) implies that Vi is colored with the coloring µi that corresponds to this assignment. The construction then implies that our chosen assignment satisfies Cj. As this is true for every clause, this concludes the proof. Observation 1. The vertices Si≤t Vi form a feedback vertex set of G. Furthermore, pw(G) ≤ pt + 4 Proof. Observe that after removing Si≤t Vi, all that is left are the gadgets bCj which do not have any edges between each other. Each such gadget is a tree and hence Si≤t Vi form a feedback vertex set of G. If we place a searcher on each vertex of Si≤t Vi it is easy to see that each gadget bCj can be searched with 4 searchers. The pathwidth bound on G follows using Proposition 1. Lemma 14. If q-LIST COLORING can be solved in O∗((q − ǫ)fvs(G)) time for some ǫ < 1, then SAT can be solved in O∗((2 − δ)n) time for some δ < 1. Proof. Let O∗((q − ǫ)fvs(G))= O∗(qλfvs(G)) time, where λ = logq(q − ǫ) < 1. We choose a sufficiently large p such that δ′ = λ p p−1 < 1. Given an instance φ of SAT we construct a graph G using the construction above, and run the assumed q-LIST COLORING. Correctness follows from Lemmata 12 and 13. By Observation 1 the graph G has a feedback vertex set of size p⌈ ⌊p log q⌋ ⌉. The choice of p implies that n + p ≤ δ′ n log q + p ≤ δ′′n, n ⌉ ≤ λp λp⌈ ⌊p log q⌋ n (p − 1) log q 14 for some δ′′ < 1. Hence SAT can be solved in time O∗(2δ′′ n) =O∗((2 − δ)n), for some δ > 0. Finally, observe that we can reduce q-LIST-COLORING to q-COLORING by adding a clique Q = {q1, . . . , qc} on q vertices to G and making qi adjacent to v when i /∈ L(v). Any coloring of Q must use q different colors, and without loss of generality qi is colored with color i. Then one can complete the coloring if and only if one can properly color G using a color from L(v) for each v. We can add the clique Q to the feedback vertex set-this increases the size of the minimum feedback vertex set by q. Since q is a constant independent of the input, this yields Theorem 4. 7 Odd Cycle Transversal An equivalent formulation of MAX CUT is to delete the minimum number of edges to make the graph bipartite. We can also consider the vertex deletion version of the problem. An odd cycle transversal of a graph G is a subset S ⊆ V (G) such that G \ S is bipartite. In the ODD CYCLE TRANSVERSAL problem we are given a graph G together with an integer k and asked whether G has an odd cycle transversal of size k. Theorem 5. If ODD CYCLE TRANSVERSAL can be solved in O∗((3 − ǫ)pw(G)) time for ǫ > 0, then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. Construction. Given ǫ > 0 and an instance φ of SAT we construct a graph G as follows. We chose an integer p based just on ǫ. Exactly how p is chosen will be discussed at the end of this section. We start by grouping the variables of φ into t groups F1, . . . , Ft of size at most ⌊log 3p⌋. Thus t = ⌈ ⌊log 3p⌋ ⌉. We will call an assignment of truth values to the variables in a group Fi a group assignment. We will say that a group assignment satisfies a clause Cj of φ if Cj contains at least one literal which is set to true by the group assignment. Notice that Cj can be satisfied by a group assignment of a group Fi, even though Cj also contains variables that are not in Fi. n Now we describe an auxiliary gadget which will be very useful in our construction. For two vertices u and v by adding an arrow from u to v we will mean adding a path ua1a2a3v on four edges starting in u and ending in v. Furthermore, we add four vertices b1, b2, b3 and b4 and edges ub1, b1a1, a1b2, b2a2, a2b3, b3a3, a3b4, b4v, and b4v. Denote the resulting graph A(u, v). None of the vertices in A(u, v) except for u and v will receive any further neighbours throughout the construction of G. The graph A(u, v) has the following properties, which are useful for our construction. • The unique smallest odd cycle transversal of A(u, v) is {a1, a3}. We call this the passive odd cycle transversal of the arrow. • In A(u, v) \ {a1, a3}, u and v are in different connected components. • The set {a2, v} is a smallest odd cycle transversal of A(u, v) \ {u}. We call this the active odd cycle transversal of the arrow. The intuition behind an arrow from u to v is that if u is put into the odd cycle transversal, then v can be put into the odd cycle transversal "for free." When the active odd cycle transversal of the arrow is picked, we say the arrow is active, otherwise we say the arrow is passive. To construct G we make t · p paths, {Pi,j} for 1 ≤ i ≤ t, 1 ≤ j ≤ p. Each path has 3m(tp + 1) vertices, and the vertices of Pi,j are denoted by pℓ i,j for 1 ≤ ℓ ≤ 3m(tp + 1). For a fixed i, the paths {Pi,j : 1 ≤ j ≤ p} correspond to the set Fi of variables. For every 1 ≤ i ≤ t, 1 ≤ j ≤ p and 1 ≤ ℓ < 3m(tp + 1) we add three vertices aℓ i,j adjacent to each other. We also add the edges aℓ i,j and qℓ i,j, bℓ One can think of the vertices of the paths {Pi,j} layed out as rows in a matrix, where for every fixed i,j : 1 ≤ i ≤ t, 1 ≤ j ≤ p}. We group the colums three by three. 1 ≤ ℓ ≤ 3m(tp+1) there is a column {pℓ i,jpℓ i,j and bℓ i,jpℓ+1 i,j . 15 In particular, For every i ≤ t and 0 ≤ ℓ < m(tp + 1) we define the sets P ℓ , b3ℓ+2 1 ≤ j ≤ p}, Aℓ Qℓ , a3ℓ+2 , a3ℓ+3 : 1 ≤ j ≤ p}. i = {a3ℓ+1 i,j , q3ℓ+3 : 1 ≤ j ≤ p}, Bℓ i = {b3ℓ+1 , q3ℓ+2 i,j i,j i,j i,j i = {q3ℓ+1 i,j i,j i,j i = {p3ℓ+1 , b3ℓ+3 : i,j : 1 ≤ j ≤ p} and , p3ℓ+2 , p3ℓ+3 i,j i,j i,j For every i ≤ t and 0 ≤ ℓ < m(tp + 1) we make two new sets Lℓ i and Rℓ i are independent sets of size 5p, and we add all the edges possible between Lℓ i . We make all the vertices in Aℓ i and from Rℓ i, and we make all vertices in Bℓ i adjacent to all vertices of Rℓ i we pick brℓ i and Rℓ Lℓ i we pick a special vertex blℓ Lℓ vertices of Lℓ rℓ+1 i , except for ℓ = m(tp + 1) − 1. We will say that a subset S of P ℓ good. The idea is that there are 3p ≥ 2h good subsets of P ℓ correspond to good subsets of P ℓ has length 2p + 1. We select a vertex on X ℓ arrow from u to a vertex of X ℓ of exactly one arrow. i which picks exactly one vertex from Pi,j for every 1 ≤ j ≤ p is i , so we can make group assignments of Fi i,S. The cycle X ℓ i,S i \ S we add an i,S is the endpoint i,S. For every vertex u ∈ P ℓ i,S. We add arrows in such a way that every vertex of X ℓ i . For every good subset S of P ℓ i we add a cycle X ℓ i,S and call it xℓ i of new vertices. Both i and Rℓ i. From i adjacent to all i adjacent to i. We make lℓ For every i ≤ t and 0 ≤ ℓ < m(tp + 1) we make a cycle Y ℓ i corresponds to a good subset S of P ℓ i of length 3p, notice that the length of i . For each good subset S of i,S of the cycle X ℓ i,S to the vertex in Y ℓ i which corresponds to S. the cycle is odd. Every vertex of Y ℓ P ℓ i we add an arrow from xℓ We say that a good subset of P ℓ i if for every 1 ≤ j ≤ t, the distance along Pi,j between the vertex of S on Pi,j and the vertex of S′ on Pi,j is divisible by 3. Informally, S and S′ are equal if they look identical when we superimpose P ℓ i . To every group assignment of variables Fi we designate a good subset of P ℓ i for every ℓ. We designate good subsets in such a way that good subsets corresponding to the same group assignment are equal. is equal with a good subset S′ of P ℓ′ i i onto P ℓ′ Finally, for every clause Ch, 1 ≤ h ≤ m, we will add tp + 1 cycles. That is, for every 0 ≤ r ≤ tp we add a cycle bC r j . The cycle contains one vertex for every i ≤ t and group assignment to Fi, and potentially one dummy vertex to make it have odd length. Going around the cycle counterclockwise we first encounter all the vertices corresponding to group assignments of F1, then all the vertices cor- responding to group assignments of F2, and so on. For i ≤ t and every good subset S of P rm+j that corresponds to a group assignment of Fi that satisfies Cj we add an arrow from xrm+j to the vertex on bC r j that corresponds to the same group assignment of Fi as S does. This concludes the construction of G. i,S i The intention behind the construction is that if φ is satisfiable, then a minimum odd cycle transversal of G can pick: • One vertex from each triangle {aℓ i,j, bℓ i,j, qℓ i,j} for each 1 ≤ i ≤ t, 1 ≤ j ≤ p, 1 ≤ ℓ < 3m(tp + 1). There are tp(3m(tp + 1) − 1) such triangles in total. • One vertex from {p3ℓ+1 , p3ℓ+2 i,j are tpm(tp + 1) such triples. i,j , p3ℓ+3 i,j } for each 1 ≤ i ≤ t, 1 ≤ j ≤ p, 0 ≤ ℓ < m(tp + 1). There • Two vertices from every arrow added, without counting the starting point of the arrow. For each i ≤ t and 0 ≤ ℓ < m(tp + 1) there are 2p3p arrows ending in some cycle X ℓ i,S. Hence there are 2p3ptm(tp + 1) such arrows. For every i ≤ t and 0 ≤ ℓ < m(tp + 1) there are 3p arrows ending in the cycle Y ℓ i . Hence there are 3ptm(tp + 1) such arrows. For every clause Cj there are m arrows added for every group assignment that satisfies that clause. Let µ be the sum over all clauses of the number of group assignments that satisfy that clause. The total number of arrows added is then mµ+(2p+1)3ptm(tp+1). Thus the odd cycle transversal can pick 2mµ+2(2p+1)3ptm(tp+1) vertices from arrows. • One vertex xℓ i,S for every i ≤ t and 0 ≤ ℓ < m(tp + 1). There are tm(tp + 1) choices for i and ℓ. We let the α be the value of the total budget, that is the sum of the items above. Lemma 15. If φ is satisfiable, then G has an odd cycle transversal of size α. 16 Proof. Given a satisfying assignment γ to φ we construct an odd cycle transversal Z of G of size α together with a partition of V (G) \ Z into L and R such that every edge of G \ Z goes between a vertex in L and a vertex in R. The assignment to φ corresponds to a group assignment of each Fi for 1 ≤ i ≤ t. For every 1 ≤ i ≤ t and 0 ≤ ℓ < m(tp + 1) we add to Z the good subset S of P ℓ i that corresponds to the group assignment of Fi. Notice that for each fixed i, the sets picked from P ℓ i are equal for any ℓ, ℓ′. At this point we have picked one vertex from {p3ℓ+1 i,j } for each 1 ≤ i ≤ t, 1 ≤ j ≤ p, 0 ≤ ℓ < m(tp + 1). i and P ℓ′ , p3ℓ+3 , p3ℓ+2 i,j i,j For every fixed 1 ≤ i ≤ t, 1 ≤ j ≤ p there are three cases. If p1 i,j into L. If p3 i,j ∈ Z we put p1 i,j /∈ Z we put pℓ i,j ∈ Z we put p2 i,j into L and p3 i,j i,j into R. i,j into the same set out of {L, R} as i,j into L and p2 i,j ∈ Z we put p1 into R. If p2 Now, for every 4 ≤ ℓ ≤ 3m(tp + 1) such that pℓ pℓ′ i,j where 1 ≤ ℓ′ ≤ 3 and ℓ ≡ ℓ′ mod 3. i,j into R and p3 For every 1 ≤ i ≤ t, 0 ≤ ℓ ≤ m(tp + 1) we put Lℓ i, b ∈ Bℓ of pairwise adjacent vertices such that a ∈ Aℓ a has a neighbour a′ in P ℓ on Pi,j. Thus, there are three cases; i and b has a neighbour b′ in P ℓ i into L and Rℓ i , and q ∈ Qℓ i into R. For every triple of a, b, q i, we proceed as follows. The vertex i . There is a j such that b′ is the successor of a′ • a′ ∈ Z and b′ ∈ L, we put a in R, q in L and b in Z. • a′ ∈ R and b′ ∈ Z, we put a in Z, q in R and b in L. • a′ ∈ L and b′ ∈ R, we put a in R, q in Z and b in L. i,S for good subsets S of P ℓ For every 1 ≤ i ≤ t, 0 ≤ ℓ ≤ m(tp + 1) there are many arrows from vertices in P ℓ i to vertices on cycles X ℓ i is in Z we add the active odd cycle transversal of the arrow to Z, otherwise we add the passive odd cycle transversal of the arrow to Z. In either case the remaining vertices on the arrow form a forest, and therefore we can insert the remaining vertices of the arrow into L and R according to which sets out of {L, R, Z} u and v are in. i . For each arrow, if its endpoint in P ℓ i,S we put xℓ For every 1 ≤ i ≤ t, 0 ≤ ℓ ≤ m(tp + 1) there is exactly one set S such that the cycle X ℓ i,S only has passive arrows pointing into it. This is exactly the set S which corresponds to the restriction of γ to Fi. Each cycle X ℓ i,S′ that has at least one arrow pointing into them already contain at least one vertex in Z-the endpoint of the active arrow pointing into the cycle. Thus we can partition the remaining vertices of X ℓ i,S′ into L and R such that no edge has both endpoints in L or both endpoints in R. For the cycle X ℓ i,S into L and R such that no edge has both endpoints in L or both endpoints in R. We add the active odd cycle transversal in the arrow from into Z. For all other good subsets S′ we add the passive odd cycle transversal in the xℓ i,S to the cycle Y ℓ i arrow from xℓ i contains one vertex in Z and the remaining vertices of Y ℓ i,S into Z and partition the remaining vertices of X ℓ into Z. Thus each cycle Y ℓ i,S to the cycle Y ℓ i i can be distributed into L and R. For every arrow that goes from a vertex xℓ h we add the active odd cycle transversal of the arrow to Z if xℓ i,S ∈ Z and add the passive odd cycle transversal to Z otherwise. Again the remaining vertices on each arrow can easily be partitioned into L and R such that no edge has both endpoints in L or both endpoints in R. This concludes the construction of Z. Since we have put the vertices into Z in accordance to the budget described in the construction it follows that Z ≤ α. All that remains to show, is that for each 1 ≤ h ≤ m and 0 ≤ r < n + 1, the cycle bC r h has at least one active arrow pointing into it. i,S into a cycle bC r The cycle bC r h corresponds to the clause Ch. The clause Ch is satisfied by γ and hence it is satisfied by the restriction of γ to a group Fi. This restriction is a group assignment of Fi and hence it corresponds to a good subset S of P rm+h , which happens to be exactly Z ∩ P rm+h ∈ Z and since the restriction of γ to Fi satisfies Ch there is an arrow pointing from xrm+h h. Since this arrow is active, this concludes the proof. . Thus xrm+h and into bC r i,S i,S i i Lemma 16. If G has an odd cycle transversal of size α, then φ is satisfiable. 17 Proof. Let Z be an odd cycle transversal of G of size α. Since G \ Z is bipartite, the vertices of G \ Z can be partitioned into L and R such that every edge of G \ Z has one endpoint in L and the other in R. Given Z, L and R, we construct a satisfying assignment to φ. Every arrow in G must contain at least two vertices in Z, not counting the startpoint of the arrow. Let ~Z be a subset of Z containing two vertices from each arrow, but no arrow start point. Observe that no two arrows have the same endpoint, and therefore ~Z is exactly two times the number of arrows in G. Let Z ′ = Z \ ~Z. We argue that for any 1 ≤ i ≤ t and 0 ≤ ℓ < m(tp+1) we have Z ′∩(Lℓ i, Aℓ i, Rℓ i, Bℓ 4p. Observe that no vertices in Lℓ contain any vertices of ~Z. Suppose for contradiction that Z ′ ∩ (Lℓ Then there is a vertex in bl ∈ Lℓ br ∈ R. Furthermore, there is a 1 ≤ j ≤ p such that , a3ℓ+3 i \ Z ′, and a vertex br ∈ Rℓ Z ′ ∩ {p3ℓ+1 i or P ℓ , a3ℓ+2 , a3ℓ+1 , p3ℓ+2 , p3ℓ+3 , b3ℓ+1 , b3ℓ+2 i , Qℓ i,j i,j i,j i,j i,j i,j i,j i,j i ∪Aℓ i ∪Rℓ i ∪Bℓ i ∪Qℓ i ) ≥ i are endpoints of arrows, and hence they do not i ) < 4p. i \ Z ′. Without loss of generality, bl ∈ L and i ∪ Qℓ i ∪ Bℓ i ∪ P ℓ i ∪ Rℓ i ∪ Aℓ i ∪P ℓ , b3ℓ+3 i,j , q3ℓ+1 i,j , q3ℓ+2 i,j , q3ℓ+3 i,j } < 4. i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j i,j , c3ℓ+1 , b3ℓ+1 , c3ℓ+3 , b3ℓ+3 , c3ℓ+2 , b3ℓ+2 , p3ℓ+3 , p3ℓ+2 i ∪ Bℓ i ∪ Qℓ or b3ℓ+2 Since {a3ℓ+1 i,j }, {a3ℓ+2 i,j } and {a3ℓ+3 Hence, there are two cases to consider either (1) {p3ℓ+1 i,j } form triangles and must contain a vertex from Z ′ each, it follows that each of these triangles contain exactly one vertex from Z ′, i,j } = ∅. Since bl ∈ L and br ∈ R, bl is adjacent to all vertices of Aℓ and that Z ′ ∩ {p3ℓ+1 , p3ℓ+3 i,j and i,j it follows that Aℓ br is adjacent to all vertices of Bℓ {p3ℓ+1 i,j } ⊆ R and p3ℓ+2 and hence either a3ℓ+2 tradiction. The second case is similar, either a3ℓ+1 or b3ℓ+1 Z ′ ∩ (Lℓ ∈ R or (2) ∈ L have both endpoints in the same set out of {L, R}, a con- i,j p3ℓ+1 have both endpoints in the same set out of {L, R}, a contradiction. We conclude that i ∪ Aℓ ∈ L. In the first case observe that either a3ℓ+2 i,j p3ℓ+3 i,j \ Z ′ ⊆ R and Bℓ , p3ℓ+3 ∈ L and hence either a3ℓ+1 i,j } ⊆ L and p3ℓ+2 i,j p3ℓ+2 i,j i ∪ Rℓ i,j i,j p3ℓ+2 i,j \ Z ′ ⊆ L. ∈ R or b3ℓ+1 ∈ R or b3ℓ+2 i ) ≥ 4p. For any 1 ≤ i ≤ t and 0 ≤ ℓ < m(tp + 1), Y ℓ i contains a vertex in Z. i i contains no vertices of Z ′ it contains a vertex from ~Z and there is an active arrow pointing into i . Since the arrow is i,S ∈ Z ′. Hence for any 1 ≤ i ≤ t and i,S ∈ Z ′ or at least one If Y ℓ Y ℓ i . The starting point of this arrow is a vertex xℓ active and xℓ 0 ≤ ℓ < m(tp + 1) we have that either there is a good subset S of P ℓ vertex of Y ℓ i i,S is not the endpoint of any arrow, we know that xℓ i,S for some good subset S of P ℓ is an odd cycle so Y ℓ i such that xℓ The above arguments, together with the budget constraints, imply that for every 1 ≤ i ≤ t and i ) = 1, i . Let i,S has odd length, and hence it must contain some vertex from Z. On the i,S cannot contain any vertices from ~Z. 0 ≤ ℓ < m(tp+1), we have Z ′∩(Lℓ i ∪Qℓ where the union is taken over all good subsets S of P ℓ S = Z ′ ∩ P ℓ other hand, all the arrows pointing into X ℓ Thus X ℓ i,S contains a vertex from Z ′, and by the budget constraints this must be xℓ i∪P ℓ i . It follows Z ′ ∩ P ℓ i ) = 4p and that Z ′∩S{xℓ i is a good subset of P ℓ i,S are passive, so X ℓ i . The cycle X ℓ i,S}∪V (Y ℓ is in Z ′. i ∪ P ℓ i∪Bℓ i ∪Rℓ i ∪Aℓ i,S. i,j i,j i i i i i i i,j, pℓ+1 i,j , pℓ+2 i,j , bl⌊ℓ/3⌋+1 nor br⌊ℓ/3⌋+1 , br⌊ℓ/3⌋ , br⌊ℓ/3⌋+1 } ⊆ R. There are two cases. Either pℓ Now, consider three consecutive vertices pℓ for some 1 ≤ i ≤ t, 1 ≤ j ≤ p, 1 ≤ ℓ ≤ 3m(tp + 1) − 2. We prove that at least one of them has to be in Z. Suppose not. We know that neither bl⌊ℓ/3⌋ are in Z. Thus, without loss of generality {bl⌊ℓ/3⌋ } ⊆ L and {br⌊ℓ/3⌋ i,j ∈ L or pℓ+1 i,j ∈ R. In the first case we obtain a contradiction since either aℓ i,j ∈ L. In the second case we get a contradiction since either aℓ+1 i,j ∈ L. Hence for any three consecutive vertices on Pi,j, at least one of them is in Z. Since the budget constraints ensure that there are at most V (Pi,j)/3 vertices in Pi,j ∩ Z it follows from the pigeon hole principle, that there is an 0 ≤ r < n + 1 such that for any 1 ≤ i ≤ t and 1 ≤ h ≤ m and 1 ≤ h′ ≤ m the set P rm+h ∩ Z. Here equality is in the sense of equality of good subsets of P ℓ i . i,j ∈ R and pℓ+1 i,j ∈ R or bℓ ∩ Z equals P rm+h′ i,j ∈ L and pℓ+3 i,j ∈ R or bℓ+1 For every 1 ≤ i ≤ t, P rm+1 ∩ Z corresponds to a group assignment of Fi, then we set the variables in Fi to this assignment. Otherwise we set all the variables ∩ Z is a good subset of P rm+1 ,bl⌊ℓ/3⌋+1 . If P rm+1 i i i i i i i 18 in Fi to false. We need to argue that every clause Ch is satisfied by this assignment. Consider the cycle bC r h. Since it is an odd cycle, it must contain a vertex from Z, the budget constraints and the discussion above implies that this vertex is from ~Z. Hence there must be an active arrow pointing into bC r h. The starting point of this active arrow is a vertex xmr+h . The set S corresponds to a group assignment of Fi that satisfies Ch. Since the arrow is active xmr+h ∈ Z ′, and by the discussion above we have that P mr+h ∩ Z ′ and S is equal to P mr+1 ∩ Z ′ and hence the assignment to the variables of Fi satisfies Ch. Since this holds for all clauses, this concludes the proof. for some i and good subset S of P mr+h ∩ Z ′ = S. Now, S = P mr+h i,S i,S i i i i Lemma 17. pw(G) ≤ t(p + 1) + 10p3p. i,j Proof. We show how to search the graph using at most t(p + 1) + 10p3p searchers. The strategy consists of m(tp + 1) rounds numbered from round 0 to round m(tp + 1) − 1. Each round has t stages, numbered from 1 to t. In the beginning of round k there is a searcher on p3k+1 i for every 1 ≤ i ≤ t, 1 ≤ j ≤ p. Let r and 1 ≤ h ≤ m be integers such that k + 1 = rm + h.Recall, that as we go around bC r h counterclockwise we first encounter vertices corresponding to group assignments of F1, then to assignments of F2 and so on. In the beginning of round k we place a searcher on the first vertex on bC r h that corresponds to an assignment of F1. If bC r h contains a dummy vertex, we place a searcher on this vertex as well. These two searchers will remain on their respective vertices throughout the round. In the beginning of stage s of round k we will assume that the vertices on the cycle bC r h corresponding to group assignments of Fs′, s′ < s have already been cleaned, and in the beginning of every stage s > 1, there is a searcher standing on the first vertex corresponding to a group assignment of Fs. s , Qk In stage s of round k, we place searchers on all vertices of P k and brk s , Bk s , Rk s and all s , on all vertices of arrows starting or ending in such h corresponding to group assignments of Fs. In total this amounts to less s , Ak s , Y k s , Lk s,S for every good subset S of P k vertices of cycles X k cycles, and on all vertices of bC r than 10p3p vertices. s In the last part of stage s of round k, we place searchers on p3(k+1)+1 for every 1 ≤ j ≤ p and on brk+1 . Then we remove all the searchers that were placed out in the first part of phase s except for the searcher on the last vertex on bC r h corresponding to a group assignment of Fs. Unless s = 1 there is also a searcher on the last vertex on bC r h corresponding to a group assignment of Fs−1. We remove this searcher, and the next stage can commence. In the end of the last stage of round k we remove all the searchers from bC r h. Then the last stage can commence. At any point in time, at most t(p + 1) + 10p3p searchers are placed on G. s,j Proof (of Theorem 5). Suppose ODD CYCLE TRANSVERSAL can be solved in O∗((3 − ǫ)pw(G)) time for ǫ < 1. Then there is an ǫ′ < 1 such that O∗((3 − ǫ)pw(G)) ≤ O∗(3ǫ′pw(G)). We chose p large enough such that ǫ′ · p+1 p−1 = δ′ < 1. Given an instance of SAT we construct an instance of ODD CYCLE TRANSVERSAL using the above construction and the chosen value of p. Then we solve the ODD CYCLE TRANSVERSAL instance using the O∗((3 − ǫ)pw(G)) time algorithm. Correctness is ensured by Lemmata 15 and 16. Lemma 17 yields that the total time taken is upper bounded by O∗((3 − ǫ)pw(G)) ≤ O∗(3ǫ′pw(G)) ≤ O∗(3ǫ′(t(p+1)+f (ǫ′))) ≤ O∗(3ǫ′⌈ (p−1) log 3 ) ≤ O∗(3δ′ n log 3 ) ≤ O∗(2δ′n) =. O∗((2 − δ)n) for δ < 1. ⌊p log 3⌋ ⌉(p+1)) ≤ O∗(3ǫ′ n(p+1) ⌊p log 3⌋ ) ≤ O∗(3ǫ′ n(p+1) n 8 Partition Into Triangles A triangle packing in a graph G is a collection of pairwise disjoint vertex sets S1, S2, . . . St in G such If V (G) = Si≤t Si then that Si induces a triangle in G for every i. The size of the packing is t. the collection S1 . . . St is a partition of G into triangles. In the TRIANGLE PACKING problem we are given a graph G and an integer t and asked whether there is a triangle packing in G of size at least 19 t. In the PARTITION INTO TRIANGLES problem we are given a graph G and asked whether G can be partitioned into triangles. Notice that since PARTITION INTO TRIANGLES is the special case of TRIANGLE PACKING when the number of triangles is the number of vertices divided by 3, the bound of Theorem 6 holds for TRIANGLE PACKING as well. Theorem 6. If PARTITION INTO TRIANGLES can be solved in O∗((2 − ǫ)pw(G)) for ǫ > 0 then SAT can be solved in O∗((2 − δ)n) time for some δ > 0. Construction. first show the lower bound for TRIANGLE PACKING and then modify our construction to also work for the more restricted PARTITION INTO TRIANGLES problem. Given an instance φ of SAT we construct a graph G as follows. For every variable vi we make a path Pi on 2m(n + 1) + 1 vertices. We denote the l'th vertex of Pi by pl i. For every i we add a set Ti of 2m(n + 1) vertices, and let the l'th vertex of Ti be denoted tl i. For every 1 ≤ l ≤ 2m(n + 1) we add the edges tl i and tl ipl+1 ipl . i For every clause Cj we add n + 1 gadgets corresponding to the clause. 0 ≤ r ≤ n we do the following. First we add the vertices bcr j t2(mr+j) vi that occurs in Cj positively we add the edges bcr j t2(mr+j)−1 and bdr occurs in Cj negated we add the edges bcr i clause Cj concludes the construction of G. Lemma 18. If φ satisfiable, then G has a triangle packing of size mn(n + 1) + m(n + 1). j and bdr and bdr j t2(mr+j)−1 i i In particular, for every j bdr j and the edge bcr j. For every variable j t2(mr+j) . For every variable vi that . Doing this for every r and every i i i , p2l i , p2l , p2l−1 i , p2l+1 Proof. Consider a satisfying assignment to φ. For every variable vi that is set to true and integer 1 ≤ l ≤ m(n + 1) we add {t2l−1 i } to the triangle packing. For every variable vi that is set to false and integer 1 ≤ l ≤ m(n + 1) we add {t2l } to the triangle packing. For every clause Cj there is a literal set to true. Suppose this literal corresponds to the variable vi. Notice that if vi occurs positively in Cj, then vi is set to true, and if it occurs negatively it is set to false. For each 0 ≤ r ≤ n, if vi occurs positively in Cj, then t2(mr+j) } to the triangle packing. On the other hand, if vi occurs negated in Cj then t2(mr+j)−1 has not yet been used in any triangle, so we can add {bcr } to the triangle packing. In total mn(n+1)+m(n+1) triangles are packed. has not yet been used in any triangle, so we can add {bcr j , t2(mr+j)−1 j , t2(mr+j) j , bdr j , bdr i i i i i j and bdr j also contains bdr Lemma 19. If G has a triangle packing of size mn(n + 1) + m(n + 1), then φ satisfiable. Proof. Observe that for any j and r, every triangle that contains bcr j and vice versa. Furthermore, if we remove all the vertices bcr j for every j and r from G we obtain a disconnected graph with n connected components, G[Ti ∪ V (Pi)] for every i. Thus, the only way to pack mn(n + 1) + m(n + 1) triangles in G is to pack mn(n + 1) triangles in each component G[Ti ∪ V (Pi)] and in addition make sure that every pair (bcr The only way to pack mn(n + 1) triangles in a component G[Ti ∪ V (Pi)] is to use every second triangle of the form {tl }, except possibly at one point where two triangles on this form are skipped. By the pigeon hole principle there is an 0 ≤ r ≤ n such that for every i, every second triangle of the form {t2mr+l } for 1 ≤ l ≤ 2m is used. We make an assignment to the variables of φ as follows. For every i such that {t2mr+1 } is used, vi is set to true, and otherwise {t2mr+2 } is used in the packing and vi is set to false. We prove that this assignment satisfies φ. j ) is used in some triangle in the packing. , p2mr+l+1 , p2mr+l+1 , p2mr+1 , p2mr+2 , p2mr+3 , p2mr+l i, pl+1 j , bdr i, pl i i i i i i i i i i j , bdr i or t2(mr+j)−1 for some i. If it contains t2(mr+j) For every j, the pair (bcr t2(mr+j) i since the triangle packing contains every second triangle of the form {t2mr+l i 1 ≤ l ≤ 2m, it follows that the triangle packing contains {t2mr+1 , p2mr+1 j , bdr set to true. By an identical argument, if the triangle containing the pair (bcr vi occurs negated in Cj and vi is set to false. This concludes the proof. j ) is used in some triangle in the packing. This triangle either contains , then vi occurs positively in Cj. Furthermore, , p2mr+l+1 } for } and hence vi is then , p2mr+l , p2mr+l+1 j ) contains t2(mr+j)−1 i i i i i i i 20 We now modify the construction to work for PARTITION INTO TRIANGLES instead of TRIANGLE PACKING. Given the graph G as constructed from φ, we construct a graph G′ as follows. For every 1 ≤ i ≤ n and 1 ≤ l ≤ m(n + 1) we make a clique Ql i are all i and to t2l−1 . For every i < n and and 1 ≤ l ≤ m(n + 1) we make all vertices of Ql adjacent to t2l i adjacent to all vertices of Ql i+1. Suppose that 2n + 2 is p modulo 3 for some p ∈ {0, 1, 2}. We remove p vertices from Ql i on four vertices. The vertices of Ql n for every l ≤ m(n + 1). i Lemma 20. G has a triangle packing of size t if and only if G′ can be partitioned into triangles. Proof. In the forward direction, consider a triangle packing of size t in G as constructed in Lemma 18. We can assume that the triangle packing has this form, because by Lemma 19 we have that φ is satisfi- able. i i i and t2l−1 For every fixed 1 ≤ l ≤ m(n + 1), we proceed as follows. We know that there exists an i such that is used in and both t2l i i and t2l−1 the packing. For each such i′, we make a triangle containing the unused vertex out of t2l two vertices of Ql are used in the packing. For every i′ 6= i, exactly one out of t2l i and t2l−1 i′. Then we "clean up" Ql n as follows. 1, . . . , Ql 3. Continue in this fashion until arrive at Ql In particular, we start with the yet unused vertices of Ql 2. Now Ql 1. There are two of them. Make a triangle containing these two vertices and one vertex of Ql 2 has one unused vertex left. Make a triangle containing this vertex and the two unused vertices of Ql i. At this point we have used 0, 1 or 2 vertices of Ql i−1. The case when we have used 0 vertices of Ql i also covers the case that i = 1. If we only used 0 or 1 vertices of Ql i, then we add a triangle that contains 3 vertices of Ql i, then their number is either 1 or 2. We make a triangle containing these vertices and 1 or 2 of the unused vertices of Ql i+1. Now we proceed to Ql n. Since the total number of vertices in Sj≤n Ql j is 4n − p, we know that 2n − 2 of these vertices are used for triangles with vertices of G, and 2n + 2 − p is divisible by 3 the process described above will partition all the unused vertices of Sj≤n Ql i+1 and continue in this manner until we reach Ql i a triangle containing some vertices in Ql i. If there are still unused vertices in Ql j into triangles. In the reverse direction, we argue that in any partitioning of G′ into triangles, exactly t triangles must lie entirely within G. In fact, we argue that for any l ≤ m(n + 1) exactly n − 1 vertices out of Si≤n{t2l } are used in triangles containing vertices from Si≤n Ql i. j. Furthermore, for each i ≤ n the vertex p2l Pick 1 ≤ j ≤ m and r such that l = mr + j. Exactly one out of Si≤n{t2l j and bdr } is in a triangle i must be in a triangle either containing t2l i or } are used in triangles containing vertices from j or some vertex in } are used in triangles containing vertices i. Thus in the packing, exactly 3t vertices in G′ are contained in triangles completely inside with bcr i . Hence, at most n − 1 vertices out of Si≤n{t2l i , t2l−1 t2l Si≤n Ql i or t2l−1 i. Furthermore, any triangle containing t2l i. Hence exactly n − 1 vertices out of Si≤n{t2l Si≤n Ql from Si≤n Ql G, and hence G has a triangle packing of size t. } must either contain p2l i i , t2l−1 i , t2l−1 i , t2l−1 i , bcr i i i i To complete the proof for PARTITION INTO TRIANGLES we need to bound the pathwidth of G′. Lemma 21. pw(G′) ≤ n + 10. Proof. We give a search strategy for G′ that uses n + 10 searchers. The strategy consists of m(n + 1) rounds and each round has n stages. In the beginning of round l, 1 ≤ l ≤ m(n + 1), there are searchers n searchers placed, one on each vertex p2l−1 for every i. Let r and 1 ≤ j ≤ m be integers such that l = mr +j. We place one searcher on bcr j. These two searchers will stay put throughout the duration of this round. In stage i of round l we place searchers on all vertices of Ql i+1. Then we place searchers on t2l−1 i and p2l+1 i, t2l−1 , t2l i . We then proceed to the next stage. At the end of the round we remove the searchers from bcr i and p2l j and bdr . At the end of stage i we remove the searchers from Ql for every i, and the next round can commence. j and one on bdr i and Ql i , p2l , t2l i i i i j . Notice that now, there are searchers on p2l+1 Lemmata 18,19,20 and 21 prove Theorem 6. i 21 9 Conclusion We have showed that for a number of basic graph problems, the best known algorithms parameterized by treewidth are optimal in the sense that base of the exponential dependence on treewidth is best possible. Recall that for DOMINATING SET and PARTITION INTO TRIANGLES, this running time was obtained quite recently using the new technique of fast subset sum convolutions [27]. Thus it could have been a real possibility that the running time is improved for some other problems as well. The results are proved under the Strong Exponential Time Hypothesis (SETH). While this hypothesis is relatively recent and might not be accepted by everyone, our results at least make a connection between rather specific graph problems and the very basic issue of better SAT algorithms. Our results suggest that one should not try to find better algorithms on bounded treewidth graphs for the problems considered in the paper: as this would disprove SETH, such an effort is better spent on trying to disprove SETH directly in the domain of satisfiability. Finally, we suggest the following open questions for future work: • Can we prove similar tight lower bounds under the restriction that the graph is planar? Or is it possible to find improved algorithms on bounded treewidth planar graphs? • Can we prove tight lower bounds for problems parameterized not by treewidth, but by something else? Naturally, one should look at problems where the algorithm or the the running time suggests that the best known algorithm is optimal. Possible candidates are the O(2k) time algorithm for STEINER TREE with k terminals [2], the O(2k) time randomized algorithm for k-PATH [29], and the O(2k) (resp., O(3k)) time algorithms for EDGE BIPARTIZATION (resp., ODD CYCLE TRANSVERSAL) [16, 22]. • For the q-COLORING problem, we were able to prove lower bounds parameterized by the feedback vertex set number. Can we prove such bounds for the other problems as well? References [1] J. Alber and R. Niedermeier. Improved tree decomposition based algorithms for domination-like problems. In LATIN, pages 613–628, 2002. [2] A. Bjorklund, T. Husfeldt, P. Kaski, and M. Koivisto. Fourier meets mobius: fast subset convolu- tion. In STOC, pages 67–74, 2007. [3] C. Calabro, R. Impagliazzo, and R. Paturi. The complexity of satisfiability of small depth circuits. In IWPEC, pages 75–85, 2009. [4] J. Chen, X. Huang, I. A. Kanj, and G. Xia. On the computational hardness based on linear FPT- reductions. J. Comb. Optim., 11(2):231–247, 2006. [5] J. Chen, X. Huang, I. A. Kanj, and G. Xia. Strong computational lower bounds via parameterized complexity. J. Comput. Syst. Sci., 72(8):1346–1367, 2006. [6] E. D. Demaine, F. V. Fomin, M. T. Hajiaghayi, and D. M. Thilikos. Subexponential parameterized algorithms on bounded-genus graphs and -minor-free graphs. J. ACM, 52(6):866–893, 2005. [7] E. D. Demaine and M. Hajiaghayi. The bidimensionality theory and its algorithmic applications. Comput. J., 51(3):292–302, 2008. [8] D. Eppstein. Diameter and treewidth in minor-closed graph families. Algorithmica, 27(3):275–291, 2000. [9] S. Fiorini, N. Hardy, B. A. Reed, and A. Vetta. Planar graph bipartization in linear time. Discrete Applied Mathematics, 156(7), 2008. 22 [10] J. Flum and M. Grohe. Parameterized Complexity Theory. Springer, Berlin, 2006. [11] F. Fomin, P. Golovach, D. Lokshtanov, and S. Saurabh. Algorithmic lower bounds for problems parameterized by clique-width. In SODA, pages 493–502, 2010. [12] F. V. Fomin, S. Gaspers, S. Saurabh, and A. A. Stepanov. On two techniques of combining branch- ing and treewidth. Algorithmica, 54(2):181–207, 2009. [13] R. Impagliazzo and R. Paturi. On the complexity of k-sat. J. Comput. Syst. Sci., 62(2):367–375, 2001. [14] R. Impagliazzo, R. Paturi, and F. Zane. Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512–530, 2001. [15] J. Kleinberg and E. Tardos. Algorithm Design. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2005. [16] D. Lokshtanov, S. Saurabh, and S. Sikdar. Simpler parameterized algorithm for oct. In IWOCA, pages 380–384, 2009. [17] D. Marx. Can you beat treewidth? In FOCS, pages 169–179, 2007. [18] D. Marx. On the optimality of planar and geometric approximation schemes. In FOCS, pages 338–348, 2007. [19] D. Molle, S. Richter, and P. Rossmanith. Enumerate and expand: Improved algorithms for con- nected vertex cover and tree cover. Theory Comput. Syst., 43(2):234–253, 2008. [20] R. Niedermeier. Invitation to fixed-parameter algorithms, volume 31 of Oxford Lecture Series in Mathematics and its Applications. Oxford University Press, Oxford, 2006. [21] M. Patras¸cu and R. Williams. On the possibility of faster sat algorithms. In Proc. 21st ACM/SIAM Symposium on Discrete Algorithms (SODA), 2010. To appear. [22] B. Reed, K. Smith, and A. Vetta. Finding odd cycle transversals. Operations Research Letters, 32(4):299–301, 2004. [23] A. D. Scott and G. B. Sorkin. Linear-programming design and analysis of fast algorithms for max 2-csp. Discrete Optimization, 4(3-4):260–287, 2007. [24] A. Takahashi, S. Ueno, and Y. Kajitani. Mixed searching and proper-path-width. Theor. Comput. Sci., 137(2):253–268, 1995. [25] J. A. Telle and A. Proskurowski. Practical algorithms on partial k-trees with an application to domination-like problems. In WADS, pages 610–621, 1993. [26] D. M. Thilikos, M. J. Serna, and H. L. Bodlaender. Cutwidth i: A linear time fixed parameter algorithm. J. Algorithms, 56(1):1–24, 2005. [27] J. M. M. van Rooij, H. L. Bodlaender, and P. Rossmanith. Dynamic programming on tree decom- positions using generalised fast subset convolution. In ESA, pages 566–577, 2009. [28] J. M. M. van Rooij, J. Nederlof, and T. C. van Dijk. Inclusion/exclusion meets measure and conquer. In ESA, pages 554–565, 2009. [29] R. Williams. Finding paths of length k in o*(2k) time. Inf. Process. Lett., 109(6):315–318, 2009. 23
1710.10026
1
1710
2017-10-27T08:37:26
A note on faithful coupling of Markov chains
[ "cs.DS", "math.PR" ]
One often needs to turn a coupling $(X_i, Y_i)_{i\geq 0}$ of a Markov chain into a sticky coupling where once $X_T = Y_T$ at some $T$, then from then on, at each subsequent time step $T'\geq T$, we shall have $X_{T'} = Y_{T'}$. However, not all of what are considered couplings in literature, even Markovian couplings, can be turned into sticky couplings, as proved by Rosenthal through a counter example. Rosenthal then proposed a strengthening of the Markovian coupling notion, termed as faithful coupling, from which a sticky coupling can indeed be obtained. We identify the reason why a sticky coupling could not be obtained in the counter example of Rosenthal, which motivates us to define a type of coupling which can obviously be turned into a sticky coupling. We show then that the new type of coupling that we define, and the faithful coupling as defined by Rosenthal, are actually identical. Our note may be seen as a demonstration of the naturalness of the notion of faithful coupling.
cs.DS
cs
A note on faithful coupling of Markov chains Debojyoti Dey1, Pranjal Dutta2, and Somenath Biswas1 1Department of Computer Science and Engineering, Indian Institute of Technology Kanpur, 2Chennai Mathematical Institute, Chennai-603103. Kanpur-208016. October 2017 Abstract One often needs to turn a coupling (Xi, Yi)i≥0 of a Markov chain into a sticky coupling where once XT = YT at some T , then from then on, at each subsequent time step T ′ ≥ T , we shall have XT ′ = YT ′ . However, not all of what are considered couplings in literature, even Markovian couplings, can be turned into sticky couplings, as proved by Rosenthal [Ro97] through a counter example. Rosenthal then proposed a strengthening of the Markovian coupling notion, termed as faithful coupling, from which a sticky coupling can indeed be obtained. We identify the reason why a sticky coupling could not be obtained in the counter example of Rosenthal, which motivates us to define a type of coupling which can obviously be turned into a sticky coupling. We show then that the new type of coupling that we define, and the faithful coupling as defined by Rosenthal [Ro97], are actually identical. Our note may be seen as a demonstration of the naturalness of the notion of faithful coupling. 1 Introduction First, we recall certain basic definitions and fix our notations. For a random variable X, we denote its distribution as D(X). Let M be a finite Markov chain on the state space Ω, and with the transition matrix P . Following [No97], we abbreviate the Markov chain (Xi)i≥0, with D(X0) = λ and D(Xi+1) = D(Xi)P for i ≥ 0, as Markov(λ, P ). A coupling of the Markov chain M is a process (Xi, Yi)i≥0, with each Xi, Yi taking values in Ω and evolving on a common probability space, where (Xi)i≥0 satisfies the property that, for i ≥ 0, D(Xi+1) = D(Xi)P and similarly, (Yi)i≥0 satisfies, for i ≥ 0, D(Yi+1) = D(Yi)P . Remark A: The definition of Markov chain coupling, as given in [LPW09], says that both (Xi)i≥0 and (Yi)i≥0 are Markov chains with transition matrix P . The reason we prefer the above weaker definition is because in literature we find processes considered as couplings that do not satisfy 1 the stronger notion of [LPW09], but do satisfy our above definition. A Markov chain (Xi)i≥0 with transition matrix P , by definition, satisfies the property (π) that for i ≥ 0, conditioned on Xi = l, Xi+1 has the distribution P (l, ·) and is indepedent of X0, . . . , Xi−1. As we shall see in the next section, there is a Markovian coupling (Xi, Yi)i≥0, where (Xi)i≥0 does not satisfy the property (π), although Xi's do evolve (under certain conditions) as per the transition matrix P . Let D(X0) be µ and D(Y0) be ν. In the above, since each pair, Xi and Yi, i ≥ 0, is defined on the same probability space, the two random variables, Xi, Yi, for each i ≥ 0, are coupled, and so we have, from the above definition of Markov chain coupling, and Proposition 4.7 of [LPW09]: kµP i − νP ikTV = kD(Xi) − D(Yi)kTV ≤ Pr(Xi 6= Yi) (1) (Here, k · kTV denotes the total variational distance between two distributions.) Let us suppose that a coupling of M has the 'now-equals-forever' property ([Ro97]), namely, if Xn = Yn for some n, then for all j ≥ n, Xj = Yj. Then, if T is defined as the random time (2) (3) we get from the relation (1) T def = inf{iXi = Yi} kD(Xi) − D(Yi)kTV ≤ Pr(Xi 6= Yi) = Pr(T > i) as the two events (Xi 6= Yi) and (T > i) imply each other, making use of the 'now-equals- forever'propery. As such, the applicability of the inequality (3) is limited as most couplings of Markov chains will not have the 'now-equals-forever' property. The way that is often resorted to to tackle this problem is to define a new process (Zi)i≥0 as follows: ([Ro97]) Zi = (cid:26) Xi Yi if i ≤ T otherwise (4) where T is as in (2) above. If it so happens that (Zi)i≥0 = Markov(µ, P ) then, since (Zi, Yi)i≥0 is a coupling of the Markov chain satisfying 'now-equals-forever' property, we have kµP i − νP ikTV = kD(Zi) − D(Yi)kTV ≤ Pr(T > i) The construction of (Zi) has been evocatively termed as sticking and the resultant new coupling as a sticky coupling [HM17]. Definition 1 (Markovian coupling of a Markov chain) A coupling (Xi, Yi)i≥0 of a Markov chain M on state space Ω, and with its transition matrix as P , where D(X0) = µ and def= D(Y0) = ν, for given µ and ν, is said to be a Markovian coupling if (Wi)i≥0, with Wi (Xi, Yi) is itself a Markov chain on state space Ω × Ω, with a specified joint distribution of D(X0) and D(Y0) as the distribution D(W0). In other words, there is a (Ω × Ω, Ω × Ω) 2 transition matrix, say Q, such that for some distribution θ0 on Ω × Ω, satisfying that its def= θi−1Q, the two marginals are µ = D(X0) and ν = D(Y0), we will have, for i ≥ 1, with θi marginals of θi will be µP i, that is, D(Xi) and νP i, that is D(Yi). Remark B: We note that the defintion above is specific to a joint distribution of (X0, Y0). The reason for the specificity is that in the example given by Rosenthal ([Ro97]) of a Markovian coupling for which sticking fails, as we note in the next section, the ability to evolve the two copies as per the transition matrix P crucially depends on the initial coupling of X0 and Y0. As noted in [HM17], it has been stated at times that sticking will work for all Markovian couplings. However, this is not correct, Rosenthal [Ro97] provides a counter example. He then provides a stronger version of Markovian couplings, termed as faithful couplings, for which it is proved that sticking will provably result in a coupling of M where (Zi)i≥0, as defined in (4) above, will indeed be Markov(µ, P ). We discuss Rosenthal's counterexample in Section 2 and identify what we consider to be the reason why the sticking operation fails there. This reason then motivates us in defining a stronger version of Markovian coupling (Section 3) for which it is easy to see that the sticking will indeed work. We then prove that the new notion of coupling that we define is actually equivalent to the notion of faithful coupling. 2 Rosenthal's counterexample In his example, Rosenthal [Ro97] considers the Markov chain M with state space Ω = {0, 1}, and with the transition matrix P defined as: P = 0 1 0 1/2 1/2 1 1/2 1/2 (Xi), (Yi), i ≥ 0 are defined as follows: 1. Each of D(X0), D(Y0) is the uniform distribution on the state space {0, 1}, 2. Each D(Yi), i > 0 is also the uniform distribution, whereas for i ≥ 0, Xi+1 def = Xi ⊕ Yi, ⊕ being the exclusive-or operation. Thus, the joint evolution of the two copies (Xi, Yi) of the chain, on the state space Ω × Ω, that is, {(0, 0), (0, 1), (1, 0), (1, 1)} is governed by the following transition matrix Q: Q = (0, 0) 1/2 0 0 1/2 (0, 1) 1/2 0 0 1/2 (1, 0) (1, 1) 0 1/2 1/2 0 0 1/2 1/2 0 (0, 0) (0, 1) (1, 0) (1, 1) 3 Convention: The distribtion of a random variable X on Ω = {0, 1} is specified as the vector [Pr(X = 0) Pr(X = 1)] and similarly, the distribution of a random variable W on Ω × Ω as the vector [Pr(W = (0, 0)) Pr(W = (0, 1)) Pr(W = (1, 0)) Pr(W = (1, 1))] We note that for any distribution σ 1 − p], Ω = {0, 1}, σP will be the uniform distribution. We also note that for the trivial coupling θ, of [1/2 1/2], which is [1/4 1/4 1/4 1/4], θQ will again be θ. Therefore, with the joint distribution θ of D(X0) and D(Y0), Q indeed defines a Markovian coupling of the Markov chain M . 1/2] and [1/2 def = [p 3/8 1/8 1/8 1/8 1/8]. The marginals of the latter distributions are [3/4 Remark C: We also note that there are other joint distributions of the same D(X0) and D(Y0), for which Q will not be a Markovian coupling: consider θ′ def 3/8), θ′Q = [3/8 1/2] respectively. Thus, if we use the joint distribution θ′ of the same two initial distributions, while Q evolves Yi's (understandably) as per P , it does not evolve Xi's as per P . Hence with the initial joint distribution θ′, Q fails to be a Markovian coupling of M . This is why we felt that it is necessary to make explicit the initial joint distribution in the definition of Markovian coupling of a Markov chain. 1/4] and [1/2 = [3/8 Rosenthal proves that although Q is a Markovian coupling of M with θ as the initial joint distribution, the result of the sticking operation will fail to evolve M correctly: with T defined as in (2) and Zi's as defined in (4), Pr(Z0 = 1, Z1 = 0) = Pr(T = 0, Y0 = 1, Y1 = 0, X0 = 1) + Pr(T > 0, X0 = 1, Y0 = 0, X1 = 0) = 1/8 + 0 = 1/8 However, had Zi's been evolving as per P with the same initial distribution as the uniform distribution, the probability above would have been 1/4, and not 1/8. Hence, sticking fails. We see that sticking failed with T = 0. As it happens, sticking will fail here for every value of T (except, of course, for T = ∞). The reason is provided by the Proposition below. We need the following definition: Definition 2 For a state space Ω with s an element in it, δs denotes the distribution on Ω in which the probability of s is 1, and (therefore,) all the other states have probability 0. Proposition 3 Let M be a Markov chain with Ω as its state space and P as its transition matrix, and let Q be a transition matrix for the state space Ω × Ω that defines a Markovian 4 coupling (Wi = (Xi, Yi))i≥0 of M where D(X0) = µ and D(Y0) = ν, where the initial joint distribution used is θ0. This Markovian coupling of M can be turned into a sticky coupling using the sticking operation if the following condition holds: for every s ∈ Ω, defining η0 as the unique joint distribution on Ω × Ω with δs and δs as its two marginals, and further defining ηi+1 as ηiQ, for each i ≥ 0, we have that for each ηi, i ≥ 0, will be a joint distribution that has δsP i and δsP i as its marginals. On the other hand, if Q does not satisfy the condition, then the Q-defined Markovian coupling, in general, cannot be turned into a sticky coupling. Proof Sketch. The condition ensures that both (Xi)i≥0 and (Yi)i≥0 of the Markovian coupling of M satisfy the strong Markov property (Theorem 1.4.2, [No97]) with respect to the stopping time T , as defined in (2). Therefore, conditioned on T = m and XT = YT = s, each of (XT +n)n≥0 and (YT +n)n≥0 will be Markov(δs, P ) and the former will be independent of X0, X1, . . . , XT and the latter will be independent of Y0, Y1, . . . , YT . Thus, (XT +n)n≥0 and (YT +n)n≥0 can replace each other. Because of this, sticking is guaranteed to work as (Xi)i≥0 and (X0, X1, . . . , XT , YT +1, . . .) will be indistinguishable. We now show that the counter example of Rosenthal does not satify the condition as stated in the statement of the proposition. As we have seen that the Markovian coupling there cannot be turned into a sticky coupling, the counter example proves the second part of the Proposition. Let us suppose that T = m and XT = YT = 0. Conditioned on these 0]. The only joint distribution with these two distributions events, D(XT ) = D(YT ) = [1 0]. The joint distribution of XT +1 and YT +1 will be given by as marginals is [1 [1 0], which is not [1/2 1/2] = D(XT )P . Thus, Q fails to ensure that, conditioned as above, D(XT +1) = δ0P . On the other hand, D(YT +1) = δ0P , and so (XT +n)n≥0 and (YT +n)n≥0 are different and cannot replace each other, as required for the sticking operation to work. 0]. This gives D(XT +1) as [1 1/2 (cid:3) 0 0 0]Q, which is [1/2 0 0 0 3 Strong Markovian coupling We saw in Section 2 that sticking fails for Q because it does not evolve (Xi)i≥0 as per P for certain joint distributions. Therefore, the following definition of a type of coupling of Markov chains immediately suggests itself to correct the defect: Definition 4 (Strong Markovian coupling) A coupling of a finite Markov chain M with state space Ω and transition matrix P is a strong Markovian coupling if there is a transition matrix Q from Ω × Ω to Ω × Ω such that for every pair of distributions µ and ν, each on Ω, and for every joint distribution θ of µ and ν, θQ will be a joint distribution of µP and νP . From this definition it follows that: 5 Claim 5 Let Q be a strong Markovian coupling of a finite Markov chain M with state space Ω and transition matrix P , and for two random variables X0 and Y0 on Ω let D(X0), D(Y0) be µ and ν respectively, and let θ0 be any joint distribution of µ and ν. If we define θi+1 as θiQ, for i ≥ 0, and Xi+1 and Yi+1 as two random variables whose distributions are respectively the two marginals of θi+1 then 1. (Xi)i≥0 will be Markov(µ, P ) and (Yi)i≥0 will be Markov(ν, P ). Consequently, 2. D(Xi) = µP i and D(Yi) = νP i, for i ≥ 0, 3. Both (Xi)i≥0 and (Yi)i≥0 will satisfy the strong Markov property, and therefore, the coupling Q of M can be turned into a valid sticky coupling through sticking. We see next that the strong Markovian coupling is actually equivalent to the familiar notion of faithful coupling which is defined as: Definition 6 (Faithful coupling [Ro97]) A Markov coupling of a finite Markov chain M , with Ω as its state space and P as its transition matrix, is a faithful coupling given by a Markov chain (Wi)i≥0 = (Xi, Yi)i≥0, on state space Ω × Ω, with transition matrix Q, if Q satisfies, for all i, j, i′, j′ ∈ Ω, the following Q((i, j), (i′, j′)) = P (i, i′), and Xj ′∈Ω Q((i, j), (i′, j′)) = P (j, j′) Xi′∈Ω Equivalently, for all t ≥ 0 and all i, j, i′, j′ ∈ Ω Pr(Xt+1 = i′Xt = i, Yt = j) = P (i, i′), and Pr(Yt+1 = j′Xt = i, Yt = j) = P (j, j′) Remark D: This kind of coupling has been termed in [LPW09], as well as in [MU05], as Markovian coupling; however, we follow the terminology of [HM17] for reasons given therein. It is to be noted that most coupling constructions of Markov chains turn out to be faithful couplings, as the various coupling examples in [LPW09] demonstrate. Proposition 7 A Markov chain coupling is faithful if and only if it is a strong Markovian coupling. The two lemmas below prove the two directions of the above proposition. 6 Lemma 8 Every faithful coupling of a Markov chain M is a strong Markovian coupling. Proof. Let M be a Markov chain with state space Ω and transition matrix P . Let the transition matrix Q, giving transition probabilities from Ω × Ω to Ω × Ω, define a faithful coupling of the Markov chain M . Let µ and ν be two distributions on Ω, and let θ be a joint distribution of µ and ν. We need to prove that µP and νP are the two marginals of θQ. In particular, we need to show: For all x ∈ Ω,Xy∈Ω (θQ)(x, y) = (µP )(x) For all y ∈ Ω,Xx∈Ω (θQ)(x, y) = (νP )(y) and, We prove (5) as follows: (5) (6) θ(u, v)Q((u, v), (x, y)) θ(u, v)Xy∈Ω Q((u, v), (x, y)) (θQ)(x, y) Xy∈Ω = Xy∈Ω X(u,v)∈Ω×Ω = X(u,v)∈Ω×Ω = X(u,v)∈Ω×Ω = Xu∈Ω = Xu∈Ω P (u, x)Xv∈Ω θ(u, v) θ(u, v)P (u, x), because Q defines a faithful coupling P (u, x)µ(u), θ being the joint ditribution of µ and ν = (µP )(x) In a similar manner we can prove (6). (cid:3) For the other direction, we prove Lemma 9 Every strong Markovian coupling of a Markov chain M is a faithful coupling of M . Proof. Let M be a Markov chain with state space Ω and transition matrix P . Let the transition matrix Q, giving transition probabilities from Ω × Ω to Ω × Ω, define a strong Markovian coupling of the Markov of M . For any (u, v) ∈ Ω × Ω, consider the probabilty 7 distribution δ(u,v). This distribution is the joint distribution δu and δv, both defined on Ω. (The definition of δx as in Definition 2.) δuP is the uth row of P , namely, P (u, ·). Similarly, δvP will be the vth row of P , namely, P (v, ·), and δ(u,v)Q will be the (u, v)th row of Q, that is, Q((u, v), ·). As Q defines a strong Markovian coupling of M , we have that Q((u, v), ·) will be the joint distribution of P (u, ·) and P (v, ·). From this condition, we get for any x, u, v ∈ Ω: Similarly, for any y, u, v ∈ Ω, we get Q((u, v), (x, y)) = P (u, x) Xy∈Ω Q((u, v), (x, y)) = P (v, y) Xx∈Ω (7) (8) As (7) and (8) are precisely the conditions to be met by Q to be a faithful coupling, we conclude that Q defines a faithful coupling of M . (cid:3) 4 Concluding remarks We have seen that it is sufficient for a Markovian coupling to have the faithfulness property in order to be turned to a sticky coupling. Is the faithfulness property also a necessary property? It may be that there is a Markovian coupling of a Markov chain M which evolves two copies of the chain correctly for a pair of initial distributions µ, ν of M , using a joint distribution of the pair, and satisfies the condition in the statement of Proposition 3, but it either does not work for some other joint distribution of the same pair µ and ν, or, does not satisfy the condition for some other pair of initial distributions of M . Such a Markovian coupling can be turned into a sticky coupling for the µ, ν pair, but will not be strongly Markovian, and hence will not be a faithful coupling of M . One feels that even if such an example exists, it is unlikely to be a natural example. Faithfulness appears to be the only natural strengthening of the Markovian coupling notion that ensures that the sticking operation will work. References [HM17] Hirscher, Timo and Anders Martinsson, Segregating Markov chains, manuscript, arXiv:1510.036661v2 [math.PR], 2017. [MU05] Mitzenmacher, Michael and Eli Upfal, Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Cambridge University Press, 2005. [No97] Norris, J.R., Markov Chains, Cambridge University Press, 1997. Paperbackk edition 1998, 15th printing 2009. 8 [LPW09] Levin, David A., Yuval Peres and Elizabeth L. Wilmer, Markov Chains and Mix- ing Times, American Mathematical Society, 2009. [Ro97] Rosenthal, Jeffrey S., Faithful Couplings of Markov Chains: Now Equals Forever, Advances in Applied Mathematics, Vol. 18, pp. 372 -- 381, 1997. 9
1009.1697
1
1009
2010-09-09T07:41:22
One method of storing information
[ "cs.DS" ]
Formulate the problem as follows. Split a file into n pieces so that it can be restored without any m parts (1<=m<=n). Such problems are called problems secret sharing. There exists a set of methods for solving such problems, but they all require a fairly large number of calculations applied to the problem posed above. The proposed method does not require calculations, and requires only the operations of the division of the file into equal (nearly equal) parts and gluing them in a certain order in one or more files.
cs.DS
cs
Учреждение образов ания «Гомельский инженерный институт Министерств а по чрезвычайным ситуациям Респ ублики Беларусь» Об одном методе хранения информации Автор: кандидат физ.-мат . наук, Титов Олег Владимирович 2010 2 3 4 5 7 8 9 11 12 Содержание Введение Постан овка задачи Описание метода Подобные схемы Числовые характеристики схем Приложения метода Оптимизация метода Литература 3 Введение В современном мире одними из самых актуальных задач являют ся за- дачи передачи и хранения информации. В данном исследов ании рассматрив ается новый метод распределенного хранения информации. Роль и в ажность системы хранения определяются п остоянно возрас- тающей ценностью информации в современном обществе, возможность дос- туп а к данным и уп равления ими является необходимым условием для вы- полнения любых задач. Безвозвратн ая п отеря данных может привести к фат альным последст - виям. Утраченные вычислительные ресурсы можно восст ановить, а утрачен- ные данные, при отсут ствии грамотно сп роектиров анной и внедренной сис- темы резервиров ания, уже не подлежат восст ановлению. Разработка разного рода «распределенных файловых систем» в н а- стоящее время является одной из энергично развиваемых областей информа- тики. Но большинство т аки х систем работ ает на основе изготовления множе - ства п олных копий данных, хранимых в разных мест ах, и обеспечения раз- личных механизмов синхронизации этих данных. Автор исследов ания предлагает метод хранения информации, когда информация разделяет ся н а маленькие «кусочки» и сохраняется на различ- ных носителях. Предложенный автором способ позволяет восстан авлив ать исходн ую информацию имея не все «кусочки», а лишь их некоторое количе- ство. В отличие от современных си стем хранения информации, этот способ не требует полного дубли ров ания всех данных н а разных носителях. Так же мы можем хранить все «кусочки» в открытом доступе на разных носителях, так как имея лишь один «кусочек» невозможно восст ановить все данные . По- следний факт позволяет исп ользовать в качестве носителей информации раз- личные службы хранения файлов в Интернет. Такой подход гораздо н адежнее и безоп аснее, чем хранить информа- цию на своем собственном компьютере или н а удаленном сервере, который может повредиться в любой момент. Это особенно актуально в связи с тем, что количество пользов ательских данных возраст ает с каждым годом в ге о- метрической прогрессии. 4 Постановка задачи Сформулируем задачу следующим образом. Задача. Разбить файл н а n ч астей таким образом, чтобы его можно бы- ло восстан овить имея любые m ч астей (1 ≤ m ≤ n). Такие задачи назыв аются задачами разделения секрет а [1, 2, 3, 4]. Су- ществует мн ожество методов решения таких задач, но в се они требуют дос- таточно большого количества вычислений применительно к поставленной выше задаче. Наша пост ановка задачи отлич ается от классической задачи разделения секрета. Отличия заключ аются в следующем: 1) главная н аша задача — восстановить и сходный файл, имея п о крайне мере m частей, тогда как в классической задаче разделения секрет а главная задач а — невозможность восст ановить секрет при наличии меньше, чем m частей. Другими слов ами в нашей задаче не и сключена возможность восст а- новления исходного файла п ри наличии меньшего, чем m ч астей; 2) в классической задаче разделение секрет а мы под секретом п онима- ем число, находящееся в определенном диап азоне возможных значений, а в нашей постан овке задачи мы имеем ввиду произвольный набор данных пред - ст авленных как один файл. Предложенный автором метод не требует проведения вычислений, а требуются только операции разделения файла на равные (почти равные) час- ти и их склеивание в определенном порядке в один или несколько файлов. R= )1 5 Описание метода Пусть у нас имеет ся и сходный файл. Требует ся п олучить н абор из n файлов (будем в дальнейшем назыв ать такие файлы модулями) таки х, что имея любые m модулей мы можем восст ановить исходный файл. mn 1  элементов (под эле- Разобьём исходный фай л на: R  НОД mnn ,( )1  ментами будем понимать непересекающиеся ч асти исходного файла равного (почти равного) размера). Таким образом мы п олучаем, что н аш и сходный файл состоит из R элементов, каждому из которых можн о присвоить поряд - ковый номер от 1 до R. Так как и сходный файл можно восстан овить имея любые m модулей, то каждый из R элементов должен н аходиться в n – m +1 модулей. Тогда хотя бы в одном из m любых модулей будет содержаться необходимый нам эле - мент. Наполнять модули элементами будем следующим образом: построим mn 1  таблиц у, в которой n строк (количество модулей) и K  mnn НОД )1 ,(  столбцов (количество элементов н аходящихся в каждом модуле). Каждый из R элементов должен встречаться в таблице n – m +1 раз, при этом он должен находиться в различных строках т аблицы. Можно зап олнять т аблиц у ставя номера элементов в каждом столбце по n – m +1 раз, н ачиная с первого столбца сверху вниз и затем переходить к следующему столбц у. И т ак п ока не зап олнится вся т аблица. Пример. Разбить файл н а 5 частей таким образом, чтобы его можно было восст ановить имея любые 3 ч асти. Так как НОД(5, 5 – 3+1)=1, то R = 5 и K = 3. Построим т аблиц у, как описано выше. 1 2 4 1: 2: 1 3 4 3: 1 3 5 4: 2 3 5 5: 2 4 5 Т.е. первый модуль состоит из элементов 1, 2, 4; второй модуль состоит из элементов 1, 3, 4 и т.д. Понятно, что общее количество ячеек в таблице делится на n и n – m +1, зн ачит, таблица имеет НОК(n, n – m +1) ячеек. Тогда столбцов в mnn НОК ,( )1 mn 1   таблице K= элементов количество а , = НОД n ) 1m-n,( n  mnn НОК ,( n  = . НОД n ) 1m-n,( mn 1   Легко получить формулу н ахождения н омера элемент а в т аблице по его координат ам: 6 n i ( )1     *, j iN ,( ) 1    mn 1  где i – номер строки (1≤ i ≤ n), j – номер столбца (1 ≤ j ≤ K). Набор из n модулей, из m любых которых можно восст ановить исход - ный файл, будем назыв ать схемой (n, m). j * [x] – наибольшее целое число, не превосходящее x. 7 Подобные схемы Пусть дан а схема (n1, m1), построим схему (n2, m2), в которой n2 = pn1 и n2 – m2 +1 = p (n1 –m1+1), где p — рациональное , положительное число, такое что n2 и m2 целые. Тогда m2 =1 – p + pm1, или n n . 1 2  m m 1 1   1 2 Схемы (n1, m1) и (n2, m2), для которых выполняется равенство n , будем назыв ать п одобными. 2  m 1  2 Для подобных схем (n1, m1) и (n2, m2) выполняют ся следующие равен- . Следов ательн о, n = p и 2 n 1 n = 2 n 1 n 1 m  1 или m 2 m 1 m 2 m 1     1 1 1 1  p 1 ства: K 1 ( 2 2       )1 R 1 ))1 НОД НОД mn mn mnp 1 1 ( )1       1 1 2 2 2 2 mnn mnn mnp pn ( , , ( ( ,    1 1 1 2 2 2 n n pn 1 2 2 НОД mnn mnp mnn НОД pn НОД ( )1 ( , ( ))1 ( , )1       1,1 2 2 1 2 2 2 Значит, у подобных схем используют ся одни и те же элементы и разме - ры модулей совпадают. Более того, если n1<n2 и схемы (n1, m1) и (n2, m 2) по- добны, то множество модулей схемы (n1, m 1) являет ся п одмножеством мно- жеств а модулей схемы (n2, m2). НОД )1 K R   2 2  2   Пример. Схемы (6, 4), (4, 3) и (2, 2) п одобны. Схему (n, m) будем назыв ать базовой, если для любой подобной схемы (n1,m1) имеем n≤n1. Очевидно, что схема (n, m) является базовой тогда и толь- ко тогда, когда НОД(n, m – 1) = 1. 8 Числовые характеристики схем Для анализа эффективности различных схем введем числовые характе - ристики схем. Избыточность – отношение размеров всех n модулей к размеру исход - ного файла. Обозначим избыточность через ,( mnZ ). KnmnZ  mn ,( ) .1   R Ясн о, что чем меньше избыточность схемы, тем меньше информации (сумма размеров в сех модулей) придётся рассылать и сохранять. Введём следующую чи словую характеристику п оказыв ающую н а сколько маленькие модули по отношению к исходному фай лу. Т.е. отноше - ние размера одного модуля к размеру и сходного файла. Обозн ачим эту ха- рактери стику через . ,( mnml ) mnml ,( )  K R  mn  n  1 1  1 . m  n Надёжность – вероятность того, что и сходный файл будет восстанов - лен. Будем считать, что вероятности получения каждого модуля равны p. Обозн ачим надёжность через . ,( mnP ) n  mi  n   mi  . где , т.е. i i ) ) in  in  p p 1( 1( pC i n iP )( n pC i n n iP ,)( mnP ,( ) mnP ,( )     Рассчитаем н аименьшее число модулей для восст ановления исходного файла. В каждом модуле содержится K элементов. Каждый элемент встречает - ся в т аблице n – m +1 раз. Значит имея один модуль мы получ аем элементов и з т аблицы. В т аблице содержится элемен-  mnK  mnR ( )1 )1 ( тов. Найдём отношение общего количеств а элементов в таблице к количеству элементов, которое мы получ аем имея один модуль . Таким образом мы полу- чим минимальн ое количество модулей. Обозн ачим это значение через ,( mnD ). )  mnD ,( mnR )1 (    mnK ( )1      Если схемы (n1, m1) и (n2, m2) подобны, то выполняют ся следующие равенства: n  mn    R    K  .        1 mnml , ( 1 1 mnD ( , 1 1 ) ) mnml ( , ) 2 2 . mnD ( , ) 2 2 ,   Используя описанный выше метод мы можем решить следующие зада- Приложения метода 9 чи.    1 Задача 1. Пусть у нас имеет ся n носителей информации равного объё - ма. Требуется сохранить на них как можно больше информации и в любой момент времени восст ановить её, при этом мы знаем, что одновременно мо- гут выйти из строя не более t носителей. Самый простой способ – записать одн у и ту же информацию на в се но- сители. Однако, зн ая что одновременно могут выйти из строя не более t но- сителей мы можем и спользов ать схему (n, m), где m = n – t, записывая на ка- ждый носитель по одному модулю. Подсчитаем на сколько процентов возрастёт объём сохраняемой ин- формации по сравнению со способом, когда мы сохраняем на каждый носи - тель одн у и ту же информацию. KR  Pr1  K Пример. Пусть у нас имеет ся 3 носителя информации равного объёма. Одновременно может выйти не более одного н осителя. Используем схему (3, 3 – 1). Тогда записыв ая н а первый носитель пер- вый модуль , на второй — второй, а н а третий — третий, мы всегда сможем восст ановить исходн ую информацию при выходе из строя одного из н осите- лей. m 1  mn  %100 %100 . 23 1%100  . %50%100 Pr1     2 2 Значит, в нашем примере мы можем сохранить на 50% больше инфор- мации. Задача 2. Пусть у н ас есть файл, который требует ся сохранить в раз- личных файловых хранилищах в интернете. Предположим, что из n ресурсов, на которые мы сохраняли файл, мы всегда можем получить доступ к m ре - сурсам. Требует ся в любой момент времени иметь доступ к сохранённому файлу. Самый п ростой способ — сохранить исходный файл во в сех n файло- вых хранилищах.. Так как нам в сегда доступны любые m файловых хранилищ, то мы можем использов ать схему (n, m) и на каждый ресурс сохранять по одному модулю. Подсчитаем сколько трафика (количество пересылаемой информации) мы экономим используя предложенный метод. m KR   Pr2 %100    n R %100 .  1 Пример. Пусть н ам требует ся сохранить файл в 5-ти файловых хра- нилищах, при этом в сегда доступны любые 3 из них. Используя схему (5, 3), в каждое хранилище запи сыв аем по одному модулю. При необходимости восст ановить файл, мы скачиваем из любых доступных 3–х хранилищ моду- ли и восстан авлив аем файл. Экономия трафика составляет %40%100  . Pr2  10 13  5  2%100  5 Оптимизация метода Введем следующую н умерацию модулей. Первый модуль так и ост аётся первым, вторым модулем назовем n – m + 2 модуль, третьим модулем н азовем 2(n – m + 1) +1 и т.д. Общая формула новой н умерации: f(i) = (n – m +1) (i – 1) +1 mod n (для базовой схемы). Для произвольной схемы формула будет следующей: 11 (      n i ( f i )(  , mn ,(  )1 mod )1  mn i )1 1)1 (  НОД     n  где i =1, 2, … , n; f(i) — новый номер модуля. Подобная н умерация даёт н ам следующие преимущества: 1) Каждый последующий модуль в сегда состоит из элементов, кото- рых не было в предыдущем. 2) Имея D(n, m) любых последов ательных модулей, мы всегда восста- новим исходный файл. Т.к. R  n , то перест авим элементы в модулях т аким образом, чтобы первые элементы в сех модулей содержали все R элементов. Аналогично на втором, третьем и т.д. месте каждого модуля, тогда даже если мы получим только н ачало, середин у или конец каждого модуля, мы сможем восст ано- вить исходный файл. Пример. Преобразуем рассмотренный пример схемы (5, 3) по приве- денным выше п равилам. Нач альный вари ант После п реобразования 1: 1 2 4 1: 1 2 4 2: 2 3 5 2: 1 3 4 3: 3 4 1 3: 1 3 5 4: 4: 4 5 2 2 3 5 5: 5 1 3 5: 2 4 5 5 5       . D )3,5( 2     135 3  Таким образом, для восст ановления исходного файла нам дост аточно получить любые 2 последов ательных модуля. 12 Литература 1. Adi Shamir, "How to share a secret" // Communicat ions of the ACM , 22(11), p. 612–613, 1979. 2. Brickell E. F., Davenport D. M. On the classification of Ideal Secret Shar- ing Schemes. // J. Cryptology. V. 4, 1991. P. 123–134. 3. Блейкли Г. Р., Кабатян ский Г. А. Обобщенные идеальные схемы, разделяющие секрет, и матроиды // Проблемы передачи информации. Т. 33, вып. 3, 1997. С. 102–110. 4. Seymour P. O. On Secret–Sharing Matroids. // J. Comb. Theory. Se r. B. V. 56, 1992. P. 69– 73. 5. Blakley G. R. Safeguarding cryptographic keys // Proc. AFIPS 1979 Na- tional Computer Confe rence. V. 48. N . Y., 1979. P. 313–317. 6. Мак–Вильямс Ф . Дж., Слоэн Н. Дж. А. Теория кодов, исправляющи х ошибки. М.: Связь, 1979. 7. Csirmaz L. The size of a share must be large // J. Cryptology. V. 10, No 4, 1997. P. 223–232.
1804.02895
1
1804
2018-04-09T10:20:52
Characterizing Star-PCGs
[ "cs.DS", "cs.DM", "math.CO" ]
A graph $G$ is called a pairwise compatibility graph (PCG, for short) if it admits a tuple $(T,w, d_{\min},d_{\max})$ of a tree $T$ whose leaf set is equal to the vertex set of $G$, a non-negative edge weight $w$, and two non-negative reals $d_{\min}\leq d_{\max}$ such that $G$ has an edge between two vertices $u,v\in V$ if and only if the distance between the two leaves $u$ and $v$ in the weighted tree $(T,w)$ is in the interval $[d_{\min}, d_{\max}]$. The tree $T$ is also called a witness tree of the PCG $G$. The problem of testing if a given graph is a PCG is not known to be NP-hard yet. To obtain a complete characterization of PCGs is a wide open problem in computational biology and graph theory. In literature, most witness trees admitted by known PCGs are stars and caterpillars. In this paper, we give a complete characterization for a graph to be a star-PCG (a PCG that admits a star as its witness tree), which provides us the first polynomial-time algorithm for recognizing star-PCGs.
cs.DS
cs
Characterizing Star-PCGs Mingyu Xiao1 and Hiroshi Nagamochi2 1 School of Computer Science and Engineering, University of Electronic Science and 2 Department of Applied Mathematics and Physics, Graduate School of Informatics, Technology of China, China, [email protected] Kyoto University, Japan, [email protected] Abstract. A graph G is called a pairwise compatibility graph (PCG, for short) if it admits a tuple (T, w, dmin, dmax) of a tree T whose leaf set is equal to the vertex set of G, a non-negative edge weight w, and two non-negative reals dmin ≤ dmax such that G has an edge between two vertices u, v ∈ V if and only if the distance between the two leaves u and v in the weighted tree (T, w) is in the interval [dmin, dmax]. The tree T is also called a witness tree of the PCG G. The problem of testing if a given graph is a PCG is not known to be NP-hard yet. To obtain a com- plete characterization of PCGs is a wide open problem in computational biology and graph theory. In literature, most witness trees admitted by known PCGs are stars and caterpillars. In this paper, we give a com- plete characterization for a graph to be a star-PCG (a PCG that admits a star as its witness tree), which provides us the first polynomial-time algorithm for recognizing star-PCGs. Key words. rithm; Graph Algorithm; Graph Theory Pairwise Compatibility Graph; Polynomial-time Algo- 1 Introduction Pairwise compatibility graph is a graph class originally motivated from com- putational biology. In biology, the evolutionary history of a set of organisms is represented by a phylogenetic tree, which is a tree with leaves representing known taxa and internal nodes representing ancestors that might have led to these taxa through evolution. Moreover, the edges in the phylogenetic tree may be assigned weights to represent the evolutionary distance among species. Given a set of taxa and some relations among the taxa, we may want to construct a phylogenetic tree of the taxa. The set of taxa may be a subset of taxa from a large phyloge- netic tree, subject to some biologically-motivated constraints. Kearney, Munro and Phillips [12] considered the following constraint on sampling based on the observation in [10]: the pairwise distance between any two leaves in the sample phylogenetic tree is between two given integers dmin and dmax. This motivates the introduction of pairwise compatibility graphs (PCGs). Given a phylogenetic tree T with an edge weight w and two real numbers dmin and dmax, we can construct a graph G each vertex of which is corresponding to a leaf of T so that there is an edge between two vertices in G if and only if the corresponding two leaves of T are at a distance within the interval [dmin, dmax] in T . The graph G is called the PCG of the tuple (T, w, dmin, dmax). Nowadays, PCG becomes an interesting graph class and topic in graph theory. Plenty of structural results have been developed. It is straightforward to construct a PCG from a given tuple (T, w, dmin, dmax). However, the inverse direction seems a considerably hard task. Few methods have been known for constructing a corresponding tuple (T, w, dmin, dmax) from a given graph G. The inverse problem attracts certain interests in graph algo- rithms, which may also have potential applications in computational biology. It has been extensively studied from many aspects after the introduction of PCG [3,6,7,9,19,18]. A natural question was whether all graphs are PCGs. This was proposed as a conjecture in [12], and was confuted in [18] by giving a counterexample of a bipartite graph with with 15 vertices. Later, a counterexample with eight vertices and a counterexample of a planar graph with 20 vertices were found [9]. It has been checked that all graphs with at most seven vertices are PCGs [3] and all bipartite graphs with at most eight vertices are PCGs [14]. In fact, it is even not easy to check whether a graph with a small constant number of vertices is a PCG or not. Whether recognizing PCGs is NP-hard or not is currently open. Some references conjecture the NP-hardness of the problem [7,9]. A generalized version of PCG recognition is shown to be NP-hard [9]. PCG also becomes an interesting graph class in graph theory. It contains the well-studied graph class of leaf power graphs (LPGs) as a subset of instances such that dmin = 0, which was introduced in the context of constructing phylogenies from species similarity data [8,13,15]. Another natural relaxation of PCG is to set dmax = ∞. This graph class is known as min leaf power graph (mLPG) [6], which is the complement of LPG. Several other known graph classes have been shown to be subclasses of PCG, e.g., disjoint union of cliques [2], forests [11], chordless cycles and single chord cycles [19], tree power graphs [18], threshold graphs [6], triangle-free outerplanar 3-graphs [16], some particular subclasses of split matrogenic graphs [6], Dilworth 2 graphs [5], the complement of a forest [11] and so on. It is also known that a PCG with a witness tree being a caterpillar also allows a witness tree being a centipede [4]. A method for constructing PCGs is derived [17], where it is shown that a graph G consisting two graphs G1 and G2 that share a vertex as a cut-vertex in G is a PCG if and only both G1 and G2 are PCGs. How to recognize PCGs or construct a corresponding phylogenetic tree for a PCG has become an interesting open problem in this area. To make a step toward this open problem, we consider PCGs with a witness tree being a star in this paper, which we call star-PCGs. One motivation why we consider stars is that: in the literature, most of the witness trees of PCGs have simple graph structures, such as stars and caterpillars [7]. It is also fundamental to consider the problem of characterizing subclasses of PCGs derived from a specific topology of trees. Although stars are trees with a rather simple topology, star-PCG recognition is 2 not easy at all. It is known that threshold graphs are star-PCGs (even in star- LPG and star-mLPG) and the class of star-PCGs is nearly the class of three- threshold graphs, a graph class extended from the threshold graphs [6]. However, no complete characterization of star-PCGs and no polynomial-time recognition of star-PCGs are known. In this paper, we give a complete characterization for a graph to be a star-PCG, which provides us the first polynomial-time algorithm for recognizing star-PCGs. The main idea of our algorithm is as follows. Without loss of generality, we always rank the leaves of the witness star TV (and the corresponding vertices in the star-PCG G) according to the weight of the edges incident on it. When such an ordering of the vertices in a star-PCG G is given, we can see that all the neighbors of each vertex in G must appear consecutively in the ordering. This motivates us to define such an ordering to be "consecutive ordering." To check if a graph is a star-PCG, we can first check if the graph can have a consecutive ordering of vertices. Consecutive orderings can be computed in polynomial time by reducing to the problem of recognizing interval graphs. However, this is not enough to test star-PCGs. A graph may not be a star-PCG even if it has a consecutive ordering of vertices. We further investigate the structural properties of star-PCGs on a fixed consecutive ordering of vertices. We find that three cases of non-adjacent vertex pairs, called gaps, can be used to characterize star-PCGs. A graph is a star-PCG if and only if it admits a consecutive ordering of vertices that is gap-free (Theorem 3). Finally, to show that whether a given graph is gap- free or not can be tested in polynomial time (Theorem 4), we also use a notion of "contiguous orderings." All these together contribute to a polynomial-time algorithm for our problem. The paper is organized as follows. Section 2 introduces some basic notions and notations necessary to this paper. Section 3 discusses how to test whether a given family S of subsets of an element set V admits a special ordering on V , called "consecutive" or "contiguous" orderings and proves the uniqueness of such orderings under some conditions on S. This uniqueness plays a key role to prove that whether a given graph is a star-PCG or not can tested in polynomial time. Section 4 characterizes the class of star-PCGs G = (V, E) in terms of an ordering σ of the vertex set V , called a "gap-free" ordering, and shows that given a gap- free ordering of V , a tuple (T, w, dmin, dmax) that represents G can be computed in polynomial time. Section 5 first derives structural properties on a graph that admits a "gap-free" ordering, and then presents a method for testing if a given graph is a star-PCG or not in polynomial time by using the result on contiguous orderings to a family of sets. Finally Section 6 makes some concluding remarks. Due to the space limitation, some proofs are moved to Appendix. 2 Preliminaries For two integers a and b, let [a, b] denote the set of integers i with a ≤ i ≤ b. For a sequence σ of elements, let σ denote the reversal of σ. A sequence obtained by concatenating two sequences σ1 and σ2 in this order is denoted by (σ1, σ2). 3 Families of Sets. Let V be a set of n ≥ 1 elements. We call a subset S ∈ V trivial in V if S ≤ 1 or S = V . We say that a set X has a common element with a set Y if X ∩ Y 6= ∅. We say that two subsets X, Y ⊆ V intersect (or X intersects Y ) if three sets X ∩ Y , X \ Y , and Y \ X are all non-empty sets. A partition {V1, V2, . . . , Vk} of V is defined to be a collection of disjoint non-empty subsets Vi of V such that their union is V , where possibly k = 1. Let S ⊆ 2V be a family of m subsets of V . A total ordering u1, u2, . . . , un of elements in V is called consecutive to S if each non-empty set S ∈ S consists of elements with consecutive indices, i.e., S is equal to {ui, ui+1, . . . , ui+S−1} for some i ∈ [1, n − S − 1]. A consecutive ordering u1, u2, . . . , un of elements in V to S is called contiguous if any two sets S, S′ ∈ S with S′ ⊆ S start from or end with the same element along the ordering, i.e., S′ = {uj, uj+1, . . . , uj+S ′−1} and S = {ui, ui+1, . . . , ui+S−1} satisfy j = i or j + S′ = i + S. Graphs. Let a graph stand for a simple undirected graph. A graph (resp., bipartite graph) with a vertex set V and an edge set E (resp., an edge set E between two vertex sets V1 and V2 = V \ V1) is denoted by G = (V, E) (resp., (V1, V2, E)). Let G be a graph, where V (G) and E(G) denote the sets of vertices and edges in a graph G, respectively. For a vertex v in G, we denote by NG(v) the set of neighbors of a vertex v in G, and define degree degG(v) to be the NG(v). We call a pair of vertices u and v in G a mirror pair if NG(v)\{u} = NG(u)\{v}. Let X be a subset of V (G). Define NG(X) to be the set of neighbors of X, i.e., NG(X) = {u ∈ NG(v) \ X v ∈ X}. Let G − X denote the graph obtained from G by removing vertices in X together with all edges incident to vertices in X, where G − {v} for a vertex v may be written as G − v. Let G[X] denote the graph induced by X, i.e., G[X] = G − (V (G) \ X). Let T be a tree. A vertex v in T is called an inner vertex if degeT (v) ≥ 2 and is called a leaf otherwise. Let L(T ) denote the set of leaves. An edge incident to a leaf in T is called a leaf edge of T . A tree T is called a star if it has at most one inner vertex. Weighted Graphs. An edge-weighted graph (G, w) is defined to be a pair of a graph G and a non-negative weight function w : E(G) → ℜ+. For a subgraph G′ of G, let w(G′) denote the sum Pe∈E(G′) w(e) of edge weights in G′. Let (T, w) be an edge-weighted tree. For two vertices u, v ∈ V (T ), let dT,w(u, v) denote the sum of weights of edges in the unique path of T between u and v. PCGs. For a tuple (T, w, dmin, dmax) of an edge-weighted tree (T, w) and two non-negative reals dmin and dmax, define G(T, w, dmin, dmax) to be the simple graph (L(T ), E) such that, for any two distinct vertices u, v ∈ L(T ), uv ∈ E if and only if dmin ≤ dT,w(u, v) ≤ dmax. Note that G(T, w, dmin, dmax) is not necessarily connected. A graph G is called a pairwise compatibility graph (PCG, for short) if there ex- ists a tuple (T, w, dmin, dmax) such that G is isomorphic to the graph G(T, dmin, dmax), where we call such a tuple a pairwise compatibility representation (PCR, for short) of G, and call a tree T in a PCR of G a pairwise compatibility tree (PCT, 4 for short) of G. The tree T is called a witness tree of G. We call a PCG G a star- PCG if it admits a PCR (T, w, dmin, dmax) such that T is a star. Fig. 1 illustrates examples of star-PCGs and PCRs of them. Although phylogenetic trees may not have edges with weight 0 or degree-2 vertices by some biological motivations [4], our PCTs do not have these constraints. This relaxation will be helpful for us to analyze structural properties of PCGs from graph theory. Furthermore, it is easy to get rid of edges with weight 0 or degree-2 vertices in a tree by contracting an edge. Lemma 1. Every PCG admits a PCR (T, w, dmin, dmax) such that 0 < dmin < dmax and w(e) > 0 for all edges e ∈ E(T ). v1 v2 v3 v4 (a) v1 v2 v1 v2 v3 v4 v5 v4 v5 v6 v7 v8 v3 (d) v8 v7 v6 v5 v* 2 2 3 3 5 5 6 6 v1 v2 v3 v4 dmin=8 v5 v6 dmax=9 v7 v8 (b) (c) v* 1 2 3 4 5 v1 v2 dmin=4 v3 v4 dmax=8 v5 (e) Fig. 1. Illustration of examples of star-PCG. (a) A connected and bipartite star-PCG G1 = (V1, V2, E), where ordering σa = v1, v2, v3, v4, v8, v7, v6, v5 is not gap-free to G1. (b) G1 in (a) with a gap-free ordering σb = v1, v2, . . . , v8. (c) A PCR (T, w, dmin = 8, dmax = 9) of G1 in (b). (d) A connected and non-bipartite star-PCG G2. (e) A PCR (T, w, dmin = 4, dmax = 8) of G2 in (d). 3 Consecutive/Contiguous Orderings of Elements Let S ⊆ 2V be a family of m subsets of a set V of n ≥ 1 elements in this section. Let V (S) denote the union of all subsets in S, and π(S) denote the partition {V1, V2, . . . , Vp} of V (S) such that u, v ∈ Vi for some i if and only if S has no set S with {u, v} ∩ S = 1. An auxiliary graph HS for S is defined to be the graph (S, ES ) that joins two sets S, S′ ∈ S with an edge SS′ ∈ ES if and only if S and S′ intersect. 5 3.1 Consecutive Orderings of Elements Observe that when S admits a consecutive ordering of V (S), any subfamily S′ ⊆ S admits a consecutive ordering of V (S′). We call a non-trivial set C ⊆ V a cut to S if no set S ∈ S intersects C, i.e., each S ∈ S satisfies one of S ⊇ C, S ⊆ C and S ∩ C = ∅. We call S cut-free if S has no cut. Theorem 1. For a set V of n ≥ 1 elements and a family S ⊆ 2V of m ≥ 1 sets, a consecutive ordering of V to S can be found in O(nm2) time, if one exists. Moreover if S is cut-free, then a consecutive ordering of V to S is unique up to reversal. 3.2 Contiguous Orderings of Elements We call two elements u, v ∈ V equivalent in S if no set S ∈ S satisfies {u, v} ∩ S = 1. We call S simple if there is no pair of equivalent elements u, v ∈ V . Define XS to be the family of maximal sets X ⊆ V such that any two vertices in X are equivalent and X is maximal subject to this property. A non-trivial set S ∈ S is called a separator if no other set S′ ∈ S contains or intersects S, i.e., each S′ ∈ S satisfies S′ ⊆ S or S′ ∩ S = ∅. We call S separator-free in S if S has no separator. Theorem 2. For a set V of n ≥ 1 elements and a family S ⊆ 2V of m ≥ 1 sets, a contiguous ordering of V to S can be found in O(nm2) time, if one exists. Moreover all elements in each set X ∈ XS appear consecutively in any contiguous ordering of V to S, and a contiguous ordering of V to S is unique up to reversal of the entire ordering and arbitrariness of orderings of elements in each set X ∈ XS. 4 Star-PCGs Let G = (V, E) be a graph with n ≥ 2 vertices, not necessarily connected. Let MG denote the set of mirror pairs {u, v} ⊆ V in G, i.e., NG(u) \ {v} = NG(v) \ {u}, where u and v are not necessarily adjacent. Let TV be a star with a center v∗ and L(T ) = V . An ordering of V is defined to be a bijection σ : V → {1, 2, . . . , n}, and we simply write a vertex v with σ(v) = i with vi. For an edge weight w in TV , we simply denote w(v∗vi) by wi. When G is a star-PCG of a tuple (TV , w, dmin, dmax), there is an ordering σ of V such that w1 ≤ w2 ≤ · · · ≤ wn. Conversely this section derives a necessary and sufficient condition for a pair (G, σ) of a graph G and an ordering σ of V to admit a PCR (TV , w, dmin, dmax) of G such that w1 ≤ w2 ≤ · · · ≤ wn. For an ordering σ of V , a non-adjacent vertex pair {vi, vj} with i < j in G is called a gap (with respect to edges e1, e2 ∈ E) if there are edges e1, e2 ∈ E that satisfy one of the following: (g1) e1 = vivj′ and e2 = vivj′′ such that j′ < j < j′′ (or e1 = vi′ vj and e2 = vi′′ vj such that i′ < i < i′′), as illustrated in Fig. 2(a); 6 v1 vn v1 e2 vi e1 vj'' vj vj' vj' vi e1 e2 vn vi' v1 vi' e1 vj vi e1 (a) (b) vi' (c) vn vj' e2 vj e2 vj' Fig. 2. Illustration of a gap {vi, vj } in an ordered graph G = (V = {v1, v2, . . . , vn}, E): (a) e1 = vivj′ and e2 = vivj′′ such that j ′ < j < j ′′, (b) e1 = vivi′ and e2 = vj vj′ such that j ′ < i and j < i′, (c) e1 = vivi′ and e2 = vj vj′ such that i′ < j and i < j ′, where possibly j ′ ≤ i′ or i′ < j ′. (g2) e1 = vivi′ and e2 = vjvj′ such that j′ < i and j < i′, as illustrated in Fig. 2(b); and (g3) e1 = vivi′ and e2 = vjvj′ such that i′ < j and i < j′, as illustrated in Fig. 2(c). We call an ordering σ of V gap-free in G if it has no gap. Clearly the reversal of a gap-free ordering of V is also gap-free. We can test if a given ordering is gap-free or not in O(n4) time by checking the conditions (a)-(c) for each non-adjacent vertex pair {vi, vj} in G. Fig. 1(a) and (b) illustrate the same graph G1 with different orderings σa = u1, u2, . . . , u8 and σb = v1, v2, . . . , v8, where σa is not gap-free while σb is gap- free. We have the following result, which implies that a graph G = (V, E) is a star-PCG if and only if it admits a gap-free ordering of V . Theorem 3. For a graph G = (V, E), let σ be an ordering of V . Then there is a PCR (TV , w, dmin, dmax) of G such that w1 ≤ w2 ≤ · · · ≤ wn if and only if σ is gap-free. The necessity of this theorem is relatively easy to prove (see Lemma 9 in the Appendix). Next we consider the sufficiency of Theorem 3, which is implied by the next lemma. Lemma 2. For a graph G = (V, E), let σ = v1, v2, . . . , vn be an gap-free order- ing of V . There is a PCR (TV , w, dmin, dmax) of G such that w1 ≤ w2 ≤ · · · ≤ wn. Such a set {w1, w2, . . . , wn, dmin, dmax} of weights and bounds can be obtained in O(n3) time. Note that when two vertices u and v are not adjacent in a PCG G, there are two reasons: one is that the distance between them in the PCR (T, w, dmin, dmax) is smaller than dmin, and the other is that the distance is larger than dmax. Before we try to assign some value to each wi, we first detect this by coloring edges in the complete graph KV = (V, E ∪ E) on the vertex set V obtained from a graph G by adding an edge between each non-adjacent vertex pair in G, where E = (cid:0)V 2(cid:1) \ E. 7 For a function c : E ∪ E → {red, green, blue}, we call an edge e with c(e) = red (resp., green and blue) a red (resp., green and blue) edge, and let Ered (resp., Egreen and Eblue) denote the sets of red (resp., green and blue) edges. We denote by Nred(v) the set of neighbors of a vertex v via red edges. We define Ngreen(v) and Nblue(v) analogously. A coloring of G = (V, E) is defined to be a function c : E∪E → {red, green, blue} such that Egreen = E. When an ordering σ of V is fixed, we simply write (i, j) ∈ red (resp., (i, j) ∈ green and (i, j) ∈ blue) if an edge vivj ∈ E ∪ E is a red (resp., green and blue) edge. For (G, σ) and a coloring c of G, we wish to determine weights wi, i − 1, 2, . . . , n and bounds dmin and dmax so that the next holds: w1 ≤ w2 ≤ · · · ≤ wn; dmin ≤ wi + wj ≤ dmax for (i, j) ∈ red; wi + wj < dmin for (i, j) ∈ green; and wi + wj > dmax for (i, j) ∈ blue. To have such a set {w1, . . . , wn, dmin, dmax} of values for an ordering σ and a coloring c of G, the coloring c must satisfy the following conditions: each vi ∈ V admits integers a(i), b(i) ∈ [1, n] such that Nred(vi) = {vj 1 ≤ j ≤ a(i) − 1} \ {vi} and Nblue(vi) = {vj b(i) + 1 ≤ j ≤ n} \ {vi}, where a(i) = 1 if Nred(vi) = ∅; b(i) = n if Nblue(vi) = ∅; and Ngreen(vi) = V \ (Nred(vi) ∪ Nblue(vi) ∪ {vi}) = {vj a(i) ≤ j ≤ b(i)} \ {vi} \ {vi}, and Ngreen(vi) = ∅ if b(i) < a(i). Such a coloring c of G is called proper to (G, σ). Lemma 3. For a graph G = (V, E) and a gap-free ordering σ of V , there is a coloring c of G that is proper to (G, σ), which can be found in in O(n2) time. Define integers ired and iblue as follows. ired = (cid:26) the largest index i such that i < a(i) if Ered 6= ∅, iblue = (cid:26) the smallest index i such that b(i) < i if Eblue 6= ∅, if Eblue = ∅. if Ered = ∅, 0 n + 1 In other words, ired 6= 0 is the largest i with (i, i + 1) ∈ red, and ired < n, whereas iblue 6= n + 1 is the smallest i with (i − 1, i) ∈ blue, and iblue > 1. Given a graph G, a gap-free ordering σ = v1, v2, . . . , vn of V , and a coloring c proper to (G, σ), we can find the set {a(i), b(i) i = 1, 2, . . . , n} ∪ {ired, iblue} of indices in O(n2) time. We also compute the set MG of all mirror pairs in O(n3) time. Equipped with above results, we can prove the sufficiency of Theorem 3 by designing an O(n)-time algorithm that assigns the right values to weights w1, w2, . . . , wn in TV . The details can be found in Appendix E. 5 Recognizing Star-PCGS Based on Theorem 3, we can test whether a graph G = (V, E) is a star-PCG or not by generating all n! orderings of V . In this section, we show that testing whether a graph has a gap-free ordering of V can be tested in polynomial time. 8 Theorem 4. Whether a given graph G = (V, E) with n vertices has a gap-free ordering of V can be tested in O(n6) time. In a graph G = (V, E), let Et denote the union of edge sets of all cycles G(v) of length 3 in G, V t denote the set of end-vertices of edges in Et, and N t denote the set of neighbors u ∈ NG(v) of a vertex v ∈ V such that uv ∈ Et. v1 v2 vired-1 vired vn vn-1 viblue+1 viblue u1 u2 u3 u4 u5 V'1 u6 u7 vired+1 viblue-1 (a) G u19 u18 u17 u16 u15 V'2 u14 u13 u12 u8 u9 u10 u11 (b) G Fig. 3. (a) A disconnected graph G = (V, E), (b) A connected non-bipartite graph G = (V, E), where the edges between two vertices in V ∗ = {u7, u8, u9, u10, u11, u12, u13, u14} are not depicted. Lemma 4. For a graph G = (V, E) with a gap-free ordering σ = v1, v2, . . . , vn of V and a coloring c proper to σ, let V1 = {vi 1 ≤ i ≤ ired}, V2 = {vi iblue ≤ i ≤ n}, and V ∗ = {vi ired − 1 ≤ i ≤ iblue + 1}. Then (i) If two edges vivj and vi′ vj′ with i < j and i′ < j′ cross (i.e., i < i′ < j < j′ or i′ < i < j′ < j), then they belong to the same component of G; (ii) It holds ired +1 ≤ iblue −1. The graph G[V ∗] is a complete graph, and G−V ∗ is a bipartite graph between vertex sets V1 and V2; (iii) Every two vertices vi, vj ∈ V1 ∩ NG(V ∗) with i < j satisfy viblue −1 ∈ NG(vi) ∩ V ∗ ⊆ NG(vj ) ∩ V ∗ ⊆ V ∗ \ {vired+1}; and Every two vertices vi, vj ∈ V2 ∩ NG(V ∗) with i < j satisfy vired+1 ∈ NG(vj) ∩ V ∗ ⊆ NG(vi) ∩ V ∗ ⊆ V ∗ \ {viblue−1}. We call the complete graph G[V ∗] in Lemma 4(ii) the core of G. Based on the next lemma, we can treat each component of a disconnected graph G separately to test whether G is a star-PCG or not. Lemma 5. Let G = (V, E) be a graph with at least two components. (i) If G admits a gap-free ordering of V , then each component of G admits a gap-free ordering of its vertex set, and there is at most one non-bipartite component in G; and 9 (ii) Let G′ = (V ′ 1 , V ′ 1, v′ 2 , E′) be a bipartite component of G, and G′′ = G − V (G′). 2 and G′′ Assume that G′ admits a gap-free ordering v′ admits a gap-free ordering v1, v2, . . . , vq of V2. Then there is an index k such that {{v′ 2 }. Moreover, the ordering v′ 1, v′ p of V is gap-free to G. k, v1, v2, . . . , vq, v′ 1, v′ 2, . . . , v′ k+2, . . . , v′ p}} = {V ′ k+2, . . . , v′ 2, . . . , v′ 2, . . . , v′ k+1, v′ p of V ′ 1 ∪ V ′ k+1, v′ k}, {v′ 1 , V ′ Proof. (i) Let G admit a gap-free ordering of V . Any induced subgraph G such as a component of G is a star-PCG, and a gap-free ordering of its vertex set by Theorem 3. By Lemma 4(i), at most one component H containing a complete graph with at least three vertices can be non-bipartite, and the remaining graph G − V (H) must be a collection of bipartite graphs. (ii) Immediate from the definition of gap-free orderings. ⊓⊔ We first consider the problem of testing if a given connected bipartite graph is a star-PCG or not. We reduce this to the problem of finding contiguous ordering to a family of sets. For a bipartite graph G = (V1, V2, E), define Si to be the family {NG(v) v ∈ Vj} for the j ∈ {1, 2} − {i, j}, where even if there are distinct vertices u, v ∈ Vj with NG(u) = NG(v), Si contains exactly one set S = NG(u) = NG(v). For the example of a connected bipartite graph G1 = (V1, V2, E) in Fig. 1(a), we have S1 = {{v3, v4}, {v1, v2, v3, v4}}, and S2 = {{v5, v6}, {v5, v6, v7, v8}}. Lemma 6. Let G = (V1, V2, E) be a connected bipartite graph with E ≥ 1. Then family Si is separator-free for each i = 1, 2, and G has a gap-free ordering of V if and only if for each i = 1, 2, family Si admits a contiguous ordering σi of Vi. For any contiguous ordering σi of Vi, i = 1, 2, one of orderings (σ1, σ2) and (σ1, σ2) of V is a gap-free ordering to G. Note that S1+ S2+ V (S1)+ V (S2) = O(n). By Theorem 2, a contiguous ordering of V (Si) for each i = 1, 2 can be computed in O(V (Si)Si2) = O(n3) time. Fig. 1(a) illustrates an ordering σa = v1, v2, v3, v4, v8, v7, v6, v5 of V (G1) of a connected bipartite graph G1 = (V1, V2, E), where σa consists of a contiguous ordering σ1 = v1, v2, v3, v4 of V1 and a contiguous ordering σ2 = v8, v7, v6, v5 of V2. Although σa is not gap-free in G, the other ordering σb of V (G1) that consists of σ1 and the reversal of σ2 is gap-free, as illustrated in Fig. 1(b). Finally we consider the case where a given graph G is a connected and non- bipartite graph. Fig. 1(d) illustrates a connected and non-bipartite star-PCG whose maximum clique is not unique. 1 , v∗ 2 be two adjacent vertices in V t. Let V ∗ = {v∗ Lemma 7. For a connected non-bipartite graph G = (V, E) with V t 6= ∅, and let v∗ 2 )), 1)\V ∗. Assume that G has a gap-free ordering V ′ 1 = NG(v∗ σ of V and a proper coloring c to σ such that v∗ 2 = viblue−1. Then: 2 )\V ∗, and V ′ 2} ∪ (NG(v∗ 2 = NG(v∗ 1) ∩ NG(v∗ 1, v∗ (i) A maximal clique Kv∗ 2 is uniquely given as G[V ∗]. The graph G[V ∗] is the core of the ordering σ, and G − V ∗ is a bipartite graph (V1, V2, E′); and 2 of G that contains edge v∗ 1 ,v∗ 1 = vired+1, v∗ 1 , v∗ 10 (ii) Let Si denote the family {NG(v) v ∈ Vj } for {i, j} = {1, 2}, and S = S1 ∪ S2 ∪ {V ∗}. Then S is a separator-free family that admits a contiguous ordering σ of V , and any contiguous ordering σ of V is a gap-free ordering to G. For example, when we choose vertices v∗ 2 = u14 in the connected non-bipartite graph G = (V, E) in Fig. 3(b), we have V ∗ = {u7, u8, u9, u10, u11, u12, u13, u14}, S1 = {{u1, u2}, {u2, u3, u4}, {u3, u4, u5}, {u3, u4, u5, u6, u7, u8}, {u5, u6, u7, u8, u9, u10, u11}}, and S2 = {{u19}, {u18, u19}, {u16, u17, u18}, {u13, u14, u15, u16, u17}, {u10, u11, u12, u13, u14, u15, u16}}. 1 = u7 and v∗ For a fixed V ∗ in Lemma 7, we can test whether the separator-free family S in Lemma 7(ii) is constructed from V ∗ in O(V (S)S2) = O(n3) time by Theorem 2, since S + V (S) = O(n) holds. It takes O(n4) time to check a given ordering is gap-free or not. To find the right choice of a vertex pair v∗ 1 = vired+1 and v∗ 2 = viblue−1 of some gap-free ordering σ of V , we need to try O(n2) combinations of vertices to construct V ∗ according to the lemma. Then we can find a gap-free ordering of a given graph, if one exists in O(n6) time, proving Theorem 4. By Theorems 3 and 4, we conclude that whether a given graph with n vertices is a star-PCG or not can be tested in O(n6) time. 6 Concluding Remarks Pairwise compatibility graphs were initially introduced from the context of phy- logenetics in computational biology and later became an interesting graph class in graph theory. PCG recognition is a hard task and we are still far from a complete characterization of PCG. Significant progresses toward PCG recogni- tion would be interesting from a graph theory perspective and also be helpful in designing sampling algorithms for phylogenetic trees. In this paper, we give the first polynomial-time algorithm to recognize star-PCGs. Although stars are trees of a simple topology, it is not an easy task to recognize star-PCGs. For further study, it is an interesting topic to study the characterization of PCGs with witness trees of other particular topologies. References 1. S. Booth and S. Lueker, Testing for the consecutive ones property, interval graphs, and graph planarity using PQ-tree algorithms, J. Comput. Syst. Sci., 13 (1976) 335–379 2. A. Brandstadt, On leaf powers, Technical report, University of Rostock, 2010. 3. T. Calamoneri, D. Frascaria, and B. Sinaimeri, All graphs with at most seven vertices are pairwise compatibility graphs, The Computer Journal, 56(7) (2013) 882–886 4. T. Calamoneri, A. Frangioni, and B. Sinaimeri, Pairwise compatibility graphs of caterpillars, The Computer Journal, 57(11) (2014) 1616–1623 11 5. T. Calamoneri and R. Petreschi, On pairwise compatibility graphs having Dilworth number two, Theoret. Comput. Sci., 524 (2014) 34–40 6. T. Calamoneri, R. Petreschi, and B. Sinaimeri, On the pairwise compatibility prop- erty of some superclasses of threshold graphs, Discrete Math. Algorithms Appl., 5(2) (2013), article 360002 7. T. Calamoneri and B. Sinaimeri, Pairwise compatibility graphs: A survey, SIAM Review 58(3)(2016) 445–460 8. Z.-Z. Chen, T. Jiang, and G. Lin, Computing phylogenetic roots with bounded degrees and errors, SIAM J. Comput., 32 (2003) 864–879 9. S. Durocher, D. Mondal, and Md. S. Rahman, On graphs that are not PCGs, Theoret. Comput. Sci., 571 (2015) 78–87 10. J. Felsenstein, Cases in which parsimony or compatibility methods will be posi- tively misleading, Systematic Zoology, 27 (1978) 401–410 11. Md. I. Hossain, S. A. Salma, Md. S. Rahman, and D. Mondal, A necessary condition and a sufficient condition for pairwise compatibility graphs, J. Graph Algorithms Appl. 21(3) (2017) 341–352 12. P. E. Kearney, J. I. Munro, and D. Phillips, Efficient generation of uniform samples from phylogenetic trees, in Algorithms in Bioinformatics, G. Benson and R. Page, eds., LNCS 2812, Springer, Berlin, Heidelberg, 2003, 177–189 13. G. Lin, P. E. Kearney, and T. Jiang, Phylogenetic k-root and Steiner k-root, in Algorithms and Computation, G. Goos, J. Hartmanis, J. van Leeuwen, D. T. Lee, and S.-H. Teng, eds., LNCS 1969, Springer, Berlin, Heidelberg, 2000, 539–551 14. S. Mehnaz and Md. S. Rahman, Pairwise compatibility graphs revisited, in Pro- ceedings of the 2013 International Conference on Informatics, Electronics Vision (ICIEV), 2013, 1–6 15. N. Nishimura, P. Ragde, and D. M. Thilikos, On graph powers for leaf-labeled trees, J. Algorithms, 42 (2002) 69–108 16. S. A. Salma, Md. S. Rahman, and Md. I. Hossain, Triangle-free outerplanar 3- graphs are pairwise compatibility graphs, J. Graph Algorithms Appl., 17 (2013) 81–102 17. M. Xiao and H. Nagamochi, Some reduction operations to pairwise 2017, 1, compatibility http://www-or.amp.i.kyoto-u.ac.jp/members/nag/Technical report/TR2017-003.pdf 2017-003, December graphs, Technical report 18. M. N. Yanhaona, Md. S. Bayzid, and Md. S. Rahman, Discovering pairwise com- patibility graphs. Discrete Math., Alg. and Appl. 2(4)(2010) 607–624 19. M. N. Yanhaona, K. S. M. T. Hossain, and Md. S. Rahman, Pairwise compatibility graphs, in: WALCOM 2008, 2008, 222–233 12 Appendix A Proof of Lemma 1 Lemma 1 Every PCG admits a PCR (T, w, dmin, dmax) such that 0 < dmin < dmax and for all edges e ∈ E(T ). Proof. Since the case where a given PCG G has at most two vertices is trivial, we assume that G has at least three vertices. Let (T, w′, d′ max) be a PCR of G, where each path between two leaves in T contains exactly two leaf edges since L(T ) = V (G) ≥ 3. We increase some values of w′(e), e ∈ E(T ) and d′ min and d′ max so that the resulting tuple satisfies the lemma. For two positive reals max, let w(e) := w′(e) + δ for each leaf edge δ and ε < minuv6∈E dT,w′ (u, v) − d′ e ∈ E(T ), w(e) := w′(e) for all non-leaf edges e ∈ E(T ), dmin := d′ min + 2δ, and dmax := d′ max + 2δ + ε. We observe that (T, w, dmin, dmax) is a PCR of G satisfying the lemma because each path between two leaves in T contains exactly ⊓⊔ two leaf edges min, d′ B Proof of Theorem 1 First we prove the time complexity of the theorem. A graph H with n ≥ 1 vertices is called an interval graph if each vertex v ∈ V (H) can represented by an ordered pair (av, bv) of reals av ≤ bv so that two vertices u, v ∈ V (H) are adjacent if and only if there is a real c such that two intervals au ≤ c ≤ bu and av ≤ c ≤ bv. It is know that testing if a given graph H is an interval graph and finding such a representation (av, bv), v ∈ V (H), if one exists can be done in O(V (H) + E(H)) time [1]. Given a family S ⊆ 2V , we see that S admits a consecutive ordering if and only if the auxiliary graph HS for S is an interval graph by the definition of HS. The time to construct HS from S is O(nm2) since we can check in O(n) time whether two sets S, S′ ∈ S intersect, i.e., vertices S, S′ ∈ V (H) are adjacent in H. Clearly V (H) = S = m and E(H) ≤ S2 = O(m2). Then testing if HS is an interval graph and finding a representation (av, bv), v ∈ V (H) can be done in O(n + m2) time. In total, it takes O(nm2) time to find a consecutive ordering for S, if one exits. Next we prove that a consecutive ordering of V to a cut-free family S is unique up to reversal. Assume that S admits another consecutive ordering τ 6∈ {σ, σ} to derive a contradiction that S would have a cut. Since τ 6∈ {σ, σ}, some two elements a, b ∈ V appear consecutively in σ, but another element c ∈ V \ {a, b} appears in the subsequence τab of τ between a and b. Hence a = vk, b = vk+1 and c = vp for σ = v1, v2, . . . , vn, where k+1 < p is assumed without loss of generality and c = vp is chosen from τab so that the index p is maximized. We claim that the set C = {vk+1, vk+2, . . . , vp} is a cut to S. To derive a contradiction, C intersects a set S ∈ S, where S = {vs, vs+1, . . . , vt} for s ≤ k < k + 1 ≤ t < p or k + 1 < s ≤ p < t by the consecutiveness of S in σ. In the former, S with a, b ∈ S contains τab, implying c = vp ∈ S, a contradiction. In the latter, S is 13 contained in τab, since a, b 6∈ S and c ∈ S, implying that vt with p < t belongs to τab, a contradiction to the choice of c = vp. C Proof of Theorem 2 To prove Theorem 2, we show that an instance (V, S) of the problem of finding a contiguous ordering of V to S can be modified to an instance (V, S′) of the problem of finding a consecutive ordering of V to S′ by introducing some new subsets of V . A set S ∈ S is called minimal (resp., maximal) if S contains no proper subset (resp., superset) of S. Define Smin (resp., Smax) to be the family of minimal (resp., maximal) sets in S. Theorem 2 follows from (iv) and (v) of the next lemma. Lemma 8. For a set V of n ≥ 1 elements, let S ⊆ 2V \ {∅} be a family with m ≥ 1 sets. (i) If some set B ∈ Smax contains at least three sets from Smin, then S cannot have a contiguous ordering of V ; (ii) Assume that S is separator-free. Let X be a maximal set of elements any two of which are equivalent. Then the elements in X appear consecutively in any contiguous ordering of V to S; (iii) Assume that S is simple and separator-free. Let S′ denote the family obtained from S by adding a new set SA,B = B \ A for each pair of sets A ∈ Smin and B ∈ Smax such that A ( B and B \ A 6∈ S. Then S′ is cut-free and any consecutive ordering of V to S′ is a contiguous ordering of V to S; and (iv) Assume that S is separator-free. Then a contiguous ordering of V to S can be found in O(nm2) time, if one exists. Moreover all elements in each set X ∈ XS appear consecutively in any contiguous ordering of V to S, and a contiguous ordering of V to S is unique up to reversal of the entire ordering and arbitrariness of orderings of elements in each set X ∈ XS; and (v) A contiguous ordering of V to S can be found in O(nm2) time, if one exists. Proof. (i) Let three sets Ai ∈ Smin, i = 1, 2, 3 be contained in some set B ∈ Smax. Note that each Ai is a proper subset of B, and no set Ai is contained in any other set Aj with j 6= i. Hence in any contiguous ordering of V to S, at least one of the three sets Ai, i = 1, 2, 3 cannot share the first element in B or the last element in B. This means that S cannot have a contiguous ordering of V . (ii) To derive a contradiction, assume that there is a contiguous ordering u1, u2, . . . , un of V to S wherein the indices of elements X are not consecutive, i.e., there are elements ui, uj, uk ∈ V with i < j < k and a set S ∈ S such that {ui, uj, uk} ∩ S = {uj}. Since S is separator-free, there is a set S′ ∈ S that intersects S or contains S. Since any two elements in X are equivalent, it holds that either X ⊆ S′ or X ∩ S′ = ∅. If S′ intersects S, then S′ \ S 6= ∅ means that S′ ⊇ X and S′ would contain S too since the indices of elements in S′ are 14 consecutive in the ordering. Hence S′ always contains S, and it also contains X, where S′ \ S ⊇ X. Now S does not contain the first element or the last element of S′ in the ordering. This contradicts that the ordering is contiguous to S. (iii) For any two sets A ∈ Smin and B ∈ Smax such that A ⊆ B and B \A 6= ∅, the set B \ A must consist of elements with consecutive indices in a contiguous ordering of V to S. Hence after adding such a set B \ A to S, the contiguous ordering of V to S is a consecutive ordering of V to S′. We show that any consecutive ordering of V to S′ is a contiguous ordering of V to S′. Assume that, for a consecutive ordering u1, u2, . . . , un of V to S′, there are sets X, Y ∈ S′ such that X ⊆ Y = {ui, ui+1, . . . , ui+Y −1} but X does not contain any of ui and ui+Y −1. Let AX ∈ Smin be a set such that AX ⊆ X and let BY ∈ Smax be a set such that Y ⊆ BY . Note that S′ contains BY \AX , where ui, ui+Y −1 ∈ BY \AX . However BY \ AX does not consist of elements with consecutive indices in a the consecutive ordering u1, u2, . . . , un, a contradiction. Hence any consecutive ordering of V to S′ is a contiguous ordering of V to S′. We next prove that S′ is cut-free. Let C be a non-trivial subset of V , and assume that no set S intersects C. Since C ≥ 2 and S is simple, there is a set S ∈ S such that S ∩ C 6= ∅ 6= C \ S. If S \ C 6= ∅, then S would intersect C. Hence S \ C. If each set S′ ∈ S with S′ ∩ (V \ C) 6= ∅ is disjoint with C, then this would contradict that S is separator-free. Hence there is a set S′ ∈ S with S′ ∩ (V \ C) 6= ∅ and S′ ⊇ C. After the above procedure, the resulting family S′ contains a set S′′ such that S \S′′ 6= ∅ and S′′ ⊆ S′ \S, where C ∩S′′ ⊇ C \S 6= ∅, C \ S′′ ⊇ S \ S′′ 6= ∅, and S′′ \ C ⊇ S′ ∩ (V \ C) 6= ∅. Therefore S′′ intersects C. This proves that S′ is cut-free. (iv) Let S0 ⊆ 2V be a given separator-free family with m ≥ 1 subsets. First we compute the family XS0 of all maximal subsets. This takes O(nm2) time. By (ii) of this lemma, all elements in each X ∈ XS0 appear consecutively in any contiguous ordering of V . Next we construct a simple family S from S0 as follows. For each set X ∈ XS0, we choose one element vX from X and replace X with X \ {uX } in the family. Note that the resulting family S is simple and separator-free and S ≤ S0. If S0 admits a contiguous ordering of V then so does S. For the family S, we then compute the families Smin and Smax and construct a bipartite graph B = (Smin, Smax, E∗) such that for each pair of sets A ∈ Smin, B ∈ Smax, AB ∈ E∗ if and only if A ⊆ B. This also can be done in O(nm2) time. Now testing whether there is a set B ∈ Smax satisfying the condition (i) of this lemma can be done in O(m2n) time, because a set B ∈ Smax contains three sets in Smin if and only if the degree of vertex B ∈ Smax in B is at least 3. When there exists such a set B ∈ Smax, we conclude that S0 does not admits any contiguous ordering of V . Assume that no set B ∈ Smax satisfies the condition (i) of this lemma, and construct from S the cut-free family S′ in (iii) of this lemma, where we see that S′ ≤ S + 2Smax ≤ 3m. By Theorem 1 applied to S′, we can find a consecutive ordering σ of V (S′) to the cut-free family S′ in O(m2n) time, if one exists, where σ is unique up to reversal. By (iii) of this lemma,, the ordering σ is contiguous to S. All contiguous orderings of V to the input separator-free family S0 can be obtained by replacing the representative 15 element vX in σ for each set X ∈ XS0 with an arbitrary ordering of X. Therefore a contiguous ordering σ∗ of V to S0 can be found in O(nm2) time, if one exists, and σ∗ is unique up to reversal and arbitrariness of orderings of elements in each set X ∈ XS0 . (v) Given a family S ⊆ 2V , we can test in O(nm) time if a set X ∈ S is a cut of S, i.e., X does not intersect any other set S ∈ S \ {X}. Then the family CS of all cuts of S can be found in O(nm2) time, where CS ≤ 2n since CS is a laminar. Note that any inclusion-wise maximal set in CS is a separator of S. For each cut X ∈ CS, let C(X) denote the family of sets Y ∈ CS such that Y ( X and Y is maximal, i.e., no other set S ∈ CS satisfies Y ( S ( X. For each set X ∈ CS, let S[X] denote the family of sets S ∈ S with S ⊆ X, and ShXi denote the family obtained from S[X] by contracting each set Y ∈ C(X) into a single element vY , ignoring all sets S ∈ S with S ⊆ Y , where V (ShXi) = X − PY ∈C(X)(Y − 1) and ShXi = S[X] − PT ∈C(X) S[Y ]. We easily see that PX∈CS V (ShXi) ≤ n + CS ≤ 3n, and PX∈CS ShXi ≤ m. Observe that, for each set X ∈ CS, the family ShXi is separator-free, and S[X] admits a contiguous ordering of V if and only if ShXi admits a contiguous ordering of V (ShXi) and S[Y ] for each set Y ∈ C(X) admits a contiguous ordering of V (S[Y ]). To construct a contiguous ordering of V to S, we choose each set X ∈ CS in a non-decreasing order of size X, where contiguous orderings σ[Y ] for families S[Y ] with sets Y ∈ C(X) are available by induction. We then find a contiguous ordering σhXi for family ShXi in O(V (ShXi)ShXi2) time, if one exists by (iv) of this lemma, and construct a contiguous ordering σ[X] for S[X] by replacing the element vY in σhXi with ordering σ[Y ] for each set Y ∈ C(X) in O(n) time. Since PX∈CS V (ShXi)ShXi2 = O(nm2), we can find a contiguous ordering of V to S in O(nm2) time, if one exists. ⊓⊔ D The Necessity of Theorem 3 The necessity of Theorem 3 is given by the following lemma. Lemma 9. For a graph G = (V, E), let σ = v1, v2, . . . , vn be an ordering of V . If σ is not gap-free, then there is no PCR (TV , w, dmin, dmax) of G such that w1 ≤ w2 ≤ · · · ≤ wn. Proof. Let (G, σ) admit a PCR (TV , w, dmin, dmax) with w1 ≤ w2 ≤ · · · ≤ wn. To derive a contradiction, assume that σ has a gap {vi, vj} with i < j. If it satisfies the condition (g1) with respect to edges e1 = vivj′ and e2 = vivj′′ such that j′ < j < j′′ (or e1 = vi′ vj and e2 = vi′′ vj such that i′ < i < i′′), then dmin ≤ wi + wj′ ≤ wi + wj ≤ wi + wj′′ ≤ dmax (or dmin ≤ wi′ + wj ≤ wi + wj ≤ wi′′ + wj ≤ dmax), which implies vivj ∈ E, i.e., vi and vj must be adjacent in G, a contradiction. If the gap satisfies the condition (g2) with respect to edges e1 = vivi′ and e2 = vj vj′ such that j′ < i and j < i′, then dmin ≤ wj′ + wj ≤ wi + wj ≤ wi + wi′ ≤ dmax, again implying that vi and vj must be adjacent, a contradiction. Analogously with the case where the gap 16 satisfies the condition (g3) with respect to edges e1 = vivi′ and e2 = vjvj′ such that i′ < j and i < j′, where dmin ≤ wi + wi′ ≤ wi + wj ≤ wj′ + wj ≤ dmax ⊓⊔ would imply that vi and vj are adjacent in G. E Proof of Lemma 2: The Sufficiency of Theorem 3 For the sufficiency of Theorem 3, we prove Lemma 2 by designing an O(n)-time algorithm that assigns the right values to weights w1, w2, . . . , wn in TV . We start with proving Lemma 3. Lemma 3 For a graph G = (V, E), let σ = v1, v2, . . . , vn be an ordering of V . For a graph G = (V, E) and a gap-free ordering σ of V , there is a coloring c of G that is proper to (G, σ), which can be found in in O(n2) time. Proof. First we assign color green all edges in E. Since (G, σ) has no gap in the condition (g1), the neighbor set NG(vi) of each vertex vi ∈ V is given by a set {vai, vai+1, . . . , vbi} \ {vi} of vertices with consecutive indices. Next we assign color red to all edges vj vi ∈ E with j < ai and color blue to all edges vivk ∈ E with bi < k. It suffices to show that no edge vivj ∈ E with i < j is assigned two colors at the same time, in such a way that either (i) color red from vi and color blue from vj; or (ii) color blue from vi and color red from vj. When (i) (resp., (ii)) occurs, there are edges vivi′ ∈ E and vj′ vj ∈ E such that j′ < i < j < i′ (resp., i′ < j and i < j′), which means that {vi, vj} would be a gap in the condition (g2) (resp., (g3)), a contradiction. Hence the above procedure constructs a coloring c proper to (G, σ). We easily see that the procedure can be implemented to run in O(n2) time. ⊓⊔ By the lemma, we consider the case where a given graph G = (V, E) with an ordering σ of V admits a coloring c of G proper to (G, σ). By the definition of indices a(i), b(i), ired and iblue for a coloring c of G, we easily observe the following property. Lemma 10. For a graph G = (V, E) with n ≥ 2, an ordering σ = v1, v2, . . . , vn of V and a coloring c of G proper to (G, σ), the following holds. (i) Every two indices i and j with 1 ≤ i < j ≤ n satisfy a(j) ≤ a(i) and b(j) ≤ b(i); (ii) It holds that ired + 1 ≤ iblue − 1, (i, j) ∈ red for i < j ≤ ired, (i, j) ∈ blue for iblue ≤ i < j, and (i, j) ∈ green for ired < i < j < iblue. (iii) Each index p ∈ [1, ired] satisfies p + 2 ≤ ired + 2 ≤ a(ired) ≤ a(p); and (iv) Each index q ∈ [iblue, n] satisfies b(q) ≤ b(iblue) ≤ iblue − 2 ≤ q − 2. Proof. (i) Let 1 ≤ i < j ≤ n. If a(i) < a(j), then (i, a(i)) ∈ green while (j, a(i)) ∈ red, contradicting that coloring c is proper to σ. If b(i) < b(j), then (b(j), j) ∈ green while (b(j), i) ∈ blue, contradicting that coloring c is proper to σ. 17 (ii) By definition, ired ≤ n − 1 and iblue ≥ 2. Then if ired = 0 or iblue = n + 1, then ired + 2 ≤ iblue holds. When Ered, Eblue 6= ∅, the index ired is the largest i with (i, i + 1) ∈ red, while ired is the smallest i with (i − 1, i) ∈ blue. See Fig. 5 for an illustration of a star TV . The former implies that (j, ired + 1) ∈ red for all j ≤ ired. Hence if (i − 1, i) ∈ blue then ired + 1 ≤ i − 1, indicating that ired + 1 ≤ iblue − 1, as required. For every ired < i < j, it holds (i, j) 6∈ red by the definition of ired, and for every i < j < iblue, it holds (i, j) 6∈ blue by the definition of iblue. This means that (i, j) ∈ red for i < j ≤ ired, (i, j) ∈ blue for iblue ≤ i < j, and (i, j) ∈ green for ired < i < j < iblue. (iii) By choice of p, it holds that p + 2 ≤ ired + 2. By this and (i), it holds that a(ired) ≤ a(p). By definition of ired, it holds that ired + 2 ≤ a(ired). (iv) Analogous with (iii). ⊓⊔ v* wired w1 wired-1 . . . wired+1 . . . wiblue-1 wi . . . wiblue wiblue+1 . . . wn v1 vired-1 vired vired+1 vi viblue-1 viblue viblue+1 vn Fig. 4. Illustration of a star TV with weights wi = w(v∗vi) of edge v∗vi ∈ E(T ). We determine a real value to each weight wi, where the value may be nega- tive. Recall that we can convert the weights of leaf edges into positive values if necessary without changing the tree in a PCR. For some p, q ∈ [1, n] with p < q, suppose that weights wi with p+1 ≤ i ≤ q−1 and bounds dmin and dmax have been determined so that (a) wp+1 ≤ wp+2 ≤ · · · ≤ wq−1; (b) wj < wj+1 for {vj, vj+1} 6∈ MG with j ∈ [p + 1, q − 2]; (c) wj + wk > dmin for (j, k) ∈ green with p + 1 ≤ j < k ≤ q − 1, wj + wk < dmin for (j, k) ∈ red with p + 1 ≤ j < k ≤ q − 1, wh + wj < dmax for (h, j) ∈ green with p + 1 ≤ h < j ≤ q − 1, wh + wj > dmax for (h, j) ∈ blue with p + 1 ≤ h < j ≤ q − 1. Hence for distinct i, i′ ∈ [p + 1, q − 1], it holds dmin > wi + wi′ if (i, i′) ∈ red; dmin < wi + wi′ < dmax if (i, i′) ∈ green; and wi + wi′ > dmax if (i, i′) ∈ blue. With the next lemma, we start with weights wi with p + 1 ≤ i ≤ q − 1 and bounds dmin and dmax for p = ired and q = iblue. 18 Lemma 11. For a graph G = (V, E) with n ≥ 2 and an ordering σ = v1, v2, . . . , vn of V , let c be a coloring c of G proper to (G, σ). For p = ired and q = iblue, there is a set {wp+1, wp+2, . . . , wq−1, dmin, dmax} of weights and bounds that satisfies condition (a)-(c). Proof. Since (i, j) ∈ green for all ired < i < j < iblue by Lemma 10(i), we can easily find required weights wi for all i with ired < i < iblue so that dmin < wi + wi′ < dmax for all i, i′ with ired < i < i′ < iblue. For example, such weights wi and bounds dmin and dmax can be obtained as follows. dmin := 0; wired+1 := 1; for i = ired + 2, ired + 3, . . . , iblue − 1 do if {vi, vi+1} ∈ MG then wi+1 := wi else wi := wi+1 + 1 end if; dmax := 2wiblue−1 + 1. Then without changing the determined values to wp+1, wp+2, . . . , wq−1, we determine wp or wq so that the above condition holds for (p := p − 1, q) or (p, q := q + 1). ⊓⊔ v* v* wp wp+1 . . . wa(p)-1 . . . α wa(p) . . . wp wp+1 . . . p+1 ired p a(p)-1 a(p) q-1 q p+1 ired p (a) wa(p)-1 . . . β δ wa(p) . . . a(p)-1 a(p) q-1 q (b) Fig. 5. Illustration of a process of determining weight wp, where vertex vi is indicated with its index i: (a) Case (ii) where {vp, vp+1} 6∈ MG and a(p + 1) = a(p) ≤ q − 1; (b) Case (iii) where {vp, vp+1} 6∈ MG and a(p + 1) < a(p) ≤ q − 1. We can determine values to weights wired , wired−1, . . . , w1 in this order as follows. Lemma 12. For a graph G = (V, E) with n ≥ 2 and an ordering σ = v1, v2, . . . , vn of V , let c be a coloring c of G proper to (G, σ). For p ≤ ired and q ≥ iblue, 19 assume that a set {wp+1, wp+2, . . . , wq−1, dmin, dmax} of weights and bounds sat- isfies conditions (a)-(c). When p ≥ 1, let weight wp be determined such that wp+1 wp+1 − α/2 if {vp, vp+1} ∈ MG, if {vp, vp+1} 6∈ MG and a(p + 1) = a(p) ≤ q − 1, where α = wp+1 + wa(p) − dmin (> 0), wp+1 − β − δ/2 if {vp, vp+1} 6∈ MG and a(p + 1) < a(p) ≤ q − 1, where β = wp+1 + wa(p)−1 − dmin (> 0) and δ = wa(p) − wa(p)−1 (> 0), min{wp+1, dmin−wq−1}−1 otherwise, i.e., {vp, vp+1} 6∈ MG and q ≤ a(p). wp =   Then the set {wp, wp+1, wp+2, . . . , wq−1, dmin, dmax} of weights and bounds sat- isfies conditions (a)-(c) for p′ = p − 1 and q. Proof. We distinguish the four cases. (i) {vp, vp+1} ∈ MG: Since {vp, vp+1} ∈ MG and wp = wp+1, we see that for each i ∈ [p + 2, q] with (p, i) ∈ green (resp., (p, i) ∈ red, blue) dmin < wp + wi = wp+1 + wi < dmax (resp., wp + wi = wp+1 + wi < dmin and wp + wi = wp+1 + wi > dmax). To show that conditions (a)-(c) hold for (p′ := p − 1, q), it suffices to show that (p, p + 1) ∈ red and wp + wp+1 < dmin. If p = ired then ired would be larger than the current p since {vp, vp+1} ∈ MG. Hence p < ired, which implies that p + 2 ≤ red + 1 and (p, p + 1), (p + 1, p + 2) ∈ red. Since red + 2 ≤ iblue by Lemma 10(ii), Then wp+1 and wp+2 have been determined so that wp+1 + wp+2 < dmin since condition (c) holds. Therefore wp + wp+1 ≤ wp+1 + wp+2 < dmin since condition (a) holds. (ii) {vp, vp+1} 6∈ MG and a(p + 1) = a(p) ≤ q − 1: Fig. 5(a) illustrates the case where {vp, vp+1} 6∈ MG and a(p + 1) = a(p) ≤ q − 1. Since condition (a) holds and a(p) ≤ q − 1, it holds that wp+1 ≤ · · · ≤ wa(q)−1 ≤ wa(q) ≤ wq−1. Since a(p + 1) = a(p), we see that (p, a(p) − 1), (p + 1, a(p) − 1) ∈ red and (p, a(a)), (p+1, a(p)) ∈ green. Since condition (c) holds for (p+1, a(p)) ∈ green, we see that α = wp+1 + wa(p) − dmin is positive. To show that conditions (a)-(c) hold for (p′ := p − 1, q), it suffices to show that wp < wp+1; wp + wa(p) > dmin; and wp + wa(p)−1 < dmin. Since α > 0, we have wp = wp+1 − α/2 < wp+1. We next see that wp + wa(p) = (wp+1 − α/2) + wa(p) = dmin + α/2 > dmin, as required. Finally we observe that wp + wa(p)−1 < wp+1 + wa(p)−1 < dmin since condition (c) holds for (p + 1, a(p) − 1) ∈ red. (iii) {vp, vp+1} 6∈ MG and a(p + 1) < a(p) ≤ q − 1: Fig. 5(b) illustrates the case where {vp, vp+1} 6∈ MG and a(p + 1) < a(p) ≤ q − 1 As in (ii), we see that wp+1 ≤ · · · ≤ wa(q)−1 ≤ wa(q) ≤ wq−1. Since a(p + 1) < a(p), we see that (p, a(p)−1) ∈ red and (p+1, a(p)−1) ∈ green. This means that {va(p)−1, va(p)} 6∈ MG, where wa(q)−1 < wa(q) by condition (b) and δ = wa(p) − wa(p)−1 is positive. Since condition (c) holds for (p + 1, a(p) − 1) ∈ green, β = wp+1 + wa(p)−1 − dmin is positive. To show that conditions (a)-(c) hold for (p′ := p − 1, q), it suffices to show that wp < wp+1; wp + wa(p) > dmin; and wp + wa(p)−1 < dmin. Since β, δ > 0, we have wp = wp+1 − β − δ/2 < wp+1. We next see that wp + wa(p) = (wp+1 − β − δ/2) + (wa(p)−1 + δ) = dmin + δ/2 > dmin, as required. Finally we 20 observe that wp + wa(p)−1 = (wp+1 − β − δ/2) + wa(p)−1 = dmin − δ/2 < dmin, as required. (iv) {vp, vp+1} 6∈ MG and q ≤ a(p): Since q ≤ a(p), (p, i) ∈ red for all i ∈ [p+ 1, q−1]. As in (ii), we see that wp+1 ≤ · · · ≤ wq−1. To show that conditions (a)-(c) hold for (p′ := p−1, q), it suffices to show that wp < wp+1; and wp+wq−1 < dmin. Obviously wp = min{wp+1, dmin − wq−1} − 1 ≤ wp+1 − 1 < wp+1, as required. Finally we observe that wp + wq−1 ≤ (dmin − wq−1 − 1)+ wq−1 = dmin − 1 < dmin, ⊓⊔ as required. Analogously with the process of computing weights wired , wired−1, . . . , w1 by Lemma 12, we can choose weights wiblue , wiblue+1, . . . , wn in this order as follows. Lemma 13. For a graph G = (V, E) with n ≥ 2 and an ordering σ = v1, v2, . . . , vn of V , let c be a coloring c of G proper to (G, σ). For p ≤ ired and q ≥ iblue, assume that a set {wp+1, wp+2, . . . , wq−1, dmin, dmax} of weights and bounds sat- isfies conditions (a)-(c). When q ≤ n, let weight wq be determined such that wq−1 wq−1 + α/2 wq−1 + β + δ/2 if {vq−1, vq} ∈ MG, if {vq−1, vq} 6∈ MG and p + 1 ≤ b(q) = b(q − 1), where α = dmax − (wb(p) + wq−1) (> 0), if {vq−1, vq} 6∈ MG and p + 1 ≤ b(q) < b(q − 1), where β = dmax − (wb(p)+1 + wq−1) (> 0) and δ = wb(q)+1 − wb(q) (> 0), max{wq−1, dmax −wq−1}+1 otherwise, i.e., {vq−1, vq} 6∈ MG and b(q) ≤ p. wq =   Then the set {wp+1, wp+2, . . . , wq−1, wq, dmin, dmax} of weights and bounds sat- isfies conditions (a)-(c) for p and q′ := q + 1. Proof. Analogously with the proof of Lemma 12. ⊓⊔ We are ready to prove Lemma 2. Given a graph G = (V, E) with an gap- free ordering σ = v1, v2, . . . , vn of V , a coloring c of G proper to (G, σ) can be obtained in O(n2) time by Lemma 3. For the coloring c, we first comput MG, indices a(i), b(i), i = 1, 2, . . . , n and ired and iblue for in O(n3) time. Based on these, we can determine weights wi with ired < i < iblue in O(n) time by the method in the proof of Lemma 11. Finally we determine weights wi with 1 ≤ i ≤ ired and iblue ≤ i ≤ n in O(n) time by Lemmas 12 and 13, respectively. This gives a PCR (TV , w, dmin, dmax) of G such that w1 ≤ w2 ≤ · · · ≤ wn in O(n3) time. This proves Lemma 2. F Proof of Lemma 4 Lemma 4 For a graph G = (V, E) with a gap-free ordering σ = v1, v2, . . . , vn of V and a coloring c proper to σ, let V1 = {vi 1 ≤ i ≤ ired}, V2 = {vi iblue ≤ i ≤ n}, and V ∗ = {vi ired − 1 ≤ i ≤ iblue + 1}. Then 21 (i) If two edges vivj and vi′ vj′ with i < j and i′ < j′ cross (i.e., i < i′ < j < j′ or i′ < i < j′ < j), then they belong to the same component of G; (ii) It holds ired +1 ≤ iblue −1. The graph G[V ∗] is a complete graph, and G−V ∗ is a bipartite graph between vertex sets V1 and V2; and (iii) Every two vertices vi, vj ∈ V1 ∩ NG(V ∗) with i < j satisfy viblue −1 ∈ NG(vi) ∩ V ∗ ⊆ NG(vj ) ∩ V ∗ ⊆ V ∗ \ {vired+1}; and Every two vertices vi, vj ∈ V2 ∩ NG(V ∗) with i < j satisfy vired+1 ∈ NG(vj) ∩ V ∗ ⊆ NG(vi) ∩ V ∗ ⊆ V ∗ \ {viblue−1}. Proof. (i) Let edges e = vivj , e′ = vi′ vj′ ∈ E cross, where i < i′ < j < j′. If e and e′ belong to different components of G, then {vi′ , vj} would a gap with respect to edges e and e′. (ii) Immediate from Lemma 10(ii). (iii) We show that every two vertices vi, vj ∈ V1 ∩ NG(V ∗) with i < j satisfy viblue−1 ∈ NG(vi) ∩ V ∗ ⊆ NG(vj) ∩ V ∗ ⊆ V ∗ \ {vired+1} (the other case can be treated symmetrically). For this, it suffices to show that, for any vertex vi ∈ V1 with NG(vi) ∩ V ∗ 6= ∅, (a) it holds viblue−1 ∈ NG(vi); and (b) for any vertex v ∈ NG(vj ) ∩ V ∗ with vj ∈ V1 and i < j, it holds that v ∈ NG(vi). In (a), otherwise {vi, viblue−1} would be a gap with respect to edges viv and vviblue−1 for any vertex v ∈ NG(vi) ∩ V ∗. In (b), otherwise {vj, v} would be a ⊓⊔ gap with respect to edges viv and vjviblue−1. G Proof of Lemma 6 Lemma 6 Let G = (V1, V2, E) be a connected bipartite graph with E ≥ 1. Then family Si is separator-free for each i = 1, 2, and G has a gap-free ordering of V if and only if for each i = 1, 2, family Si admits a contiguous ordering σi of Vi. For any contiguous ordering σi of Vi, i = 1, 2, one of orderings (σ1, σ2) and (σ1, σ2) of V is a gap-free ordering to G. Proof. Since G is connected, we see that, for each i = 1, 2, the family Si is separation-free. The only if part: Let v1, v2, . . . , vk, vk+1, . . . , vn be a gap-free ordering of V to G, where V1 = {v1, v2, . . . , vk} and V2 = {vk+1, . . . , vn}. Since there is no gap, for each vertex v ∈ V2, the neighbors in NG(v) appear consecutively as a subsequence of v1, v2, . . . , vk. Also for any two vertices u, v ∈ V2 such that NG(u) is a proper subset of NG(v), the subsequence vi, vi+1, . . . , vj for NG(u) must contain the first vertex or the last vertex in the subsequence vh, vh+1, . . . , vp for NG(v). This is because otherwise vh, vp 6∈ NG(u) would imply that {u, vh} (or {u, vp}) is a gap with respect to edges e1 = uvi and e1 = vvh (or e1 = uvj and e1 = vvp). Therefore v1, v2, . . . , vk is a contiguous ordering of V1 to S1. Analogously with V2 and S2. 22 The if part: Assume that for each i = 1, 2, the family Si has a contiguous ordering σi of Vi. Note that any set X ∈ XSi, i = 1, 2 is either contained in NG(v) or disjoint with NG(v) for each vertex v ∈ Vj , j 6= i. By Theorem 2 applied to Si, the vertices in each maximal set X ∈ XSi appear consecutively in any contiguous ordering of V (Si). Also a contiguous ordering of V (Si) is unique up to reversal and choice of an ordering of each set X ∈ XSi . This means that an ordering σ = (σ1, σ2) or (σ1, σ2) of V is gap-free if and only if any ordering obtained from σ by changing an ordering of vertices in each set X ∈ XS1 ∪ XS2 . Therefore, to see if G admits a gap-free ordering of V , we only need to check if ⊓⊔ at least one of (σ1, σ2) and (σ1, σ2) is gap-free in G. H Proof of Lemma 7 2 be two adjacent vertices in V t. Let V ∗ = {v∗ Lemma 7 For a connected non-bipartite graph G = (V, E) with V t 6= ∅, and let 1, v∗ v∗ 2 )), 1)\V ∗. Assume that G has a gap-free ordering V ′ 1 = NG(v∗ σ of V and a proper coloring c to σ such that v∗ 2 = viblue−1. Then: 2 )\V ∗, and V ′ 1 = vired+1, v∗ 2} ∪ (NG(v∗ 2 = NG(v∗ 1, v∗ 1 ) ∩ NG(v∗ (i) A maximal clique Kv∗ 2 is uniquely given as G[V ∗]. The graph G[V ∗] is the core of the ordering σ, and G − V ∗ is a bipartite graph (V1, V2, E′); and 2 of G that contains edge v∗ 1 , v∗ 1 ,v∗ (ii) Let Si be the family {NG(v) v ∈ Vj} for {i, j} = {1, 2}, and S = S1 ∪ S2 ∪ {V ∗}. Then S is a separator-free family that admits a contiguous ordering σ of V , and any contiguous ordering σ of V is a gap-free ordering to G. Proof. (i) By Lemma 5(ii), we see that {vi ired + 1 < i < iblue − 1} ⊆ NG(vired+1) ∩ NG(viblue −1). On the other hand, by Lemma 5(ii), vertex vired+1 (resp., viblue−1) is not adjacent to any vertex in V2 (resp., V1) in G. Hence {vired+1, viblue−1}∪(NG(vired+1)∩NG(viblue −1)) induces uniquely a maximal clique that contains vired+1 and viblue −1. Hence the clique is the core of the gap-free or- dering of V . By Lemma 4(ii), G − V ∗ is a bipartite graph (V1, V2, E′). (ii) Since G is connected, we see that Si is separation-free. First we prove that S admits a contiguous ordering of V . Any set S ∈ S with S ∩ V ∗ 6= ∅ satisfies one of the following: - vired+1 6∈ S and viblue−1 ∈ S ∈ S2; - viblue−1 6∈ S and vired+1 ∈ S ∈ S1; and - vired+1, viblue−1 ∈ S = V ∗. This means that any two sets S, S′ ∈ S with S ⊆ S′ belong to the same family Si. Hence any gap-free ordering σ of V to G is a contiguous ordering of V to S, as discussed in the proof of the only if part of Lemma 6. Next we prove that any contiguous ordering σ of V to S is a gap-free ordering of V in G. Since G is connected, each Si is separator-free in V (Si). We see that S = S1 ∪ S2 ∪ {V ∗} is separator-free in V even if V (S1) ∩ V (S2) 6= ∅. Note that any set X ∈ XS is either contained in NG(v) or disjoint with NG(v) for each 23 vertex v ∈ Vj, j 6= i. By Theorem 2 applied to S, the vertices in each maximal set X ∈ XS appear consecutively in any contiguous ordering of V (S). Also a contiguous ordering of V (S) is unique up to reversal and choice of an ordering of each set X ∈ XS. This means that an ordering σ of V is gap-free if and only if any ordering obtained from σ by changing an ordering of vertices in each set X ∈ XS. Therefore any contiguous ordering σ of V to S is a gap-free ordering ⊓⊔ of V in G. 24
1411.6756
5
1411
2015-04-24T08:40:05
Fast Algorithms for Parameterized Problems with Relaxed Disjointness Constraints
[ "cs.DS" ]
In parameterized complexity, it is a natural idea to consider different generalizations of classic problems. Usually, such generalization are obtained by introducing a "relaxation" variable, where the original problem corresponds to setting this variable to a constant value. For instance, the problem of packing sets of size at most $p$ into a given universe generalizes the Maximum Matching problem, which is recovered by taking $p=2$. Most often, the complexity of the problem increases with the relaxation variable, but very recently Abasi et al. have given a surprising example of a problem --- $r$-Simple $k$-Path --- that can be solved by a randomized algorithm with running time $O^*(2^{O(k \frac{\log r}{r})})$. That is, the complexity of the problem decreases with $r$. In this paper we pursue further the direction sketched by Abasi et al. Our main contribution is a derandomization tool that provides a deterministic counterpart of the main technical result of Abasi et al.: the $O^*(2^{O(k \frac{\log r}{r})})$ algorithm for $(r,k)$-Monomial Detection, which is the problem of finding a monomial of total degree $k$ and individual degrees at most $r$ in a polynomial given as an arithmetic circuit. Our technique works for a large class of circuits, and in particular it can be used to derandomize the result of Abasi et al. for $r$-Simple $k$-Path. On our way to this result we introduce the notion of representative sets for multisets, which may be of independent interest. Finally, we give two more examples of problems that were already studied in the literature, where the same relaxation phenomenon happens. The first one is a natural relaxation of the Set Packing problem, where we allow the packed sets to overlap at each element at most $r$ times. The second one is Degree Bounded Spanning Tree, where we seek for a spanning tree of the graph with a small maximum degree.
cs.DS
cs
Fast Algorithms for Parameterized Problems with Relaxed Disjointness Constraints∗ Ariel Gabizon† Daniel Lokshtanov‡ Micha l Pilipczuk§ June 18, 2018 Abstract In parameterized complexity, it is a natural idea to consider different generalizations of classic problems. Usually, such generalization are obtained by introducing a "relaxation" variable, where the original problem corresponds to setting this variable to a constant value. For instance, the problem of packing sets of size at most p into a given universe generalizes the Maximum Matching problem, which is recovered by taking p = 2. Most often, the complexity of the problem increases with the relaxation variable, but very recently Abasi et al. have given a surprising example of a problem - r-Simple k-Path - that can be solved by a randomized algorithm with running time O∗(2O(k log r r )). That is, the complexity of the problem decreases with r. In this paper we pursue further the direction sketched by Abasi et al. Our main contribution is a derandomization tool that provides a deterministic counterpart of the main technical result of Abasi et al.: the O∗(2O(k log r r )) algorithm for (r, k)-Monomial Detection, which is the problem of finding a monomial of total degree k and individual degrees at most r in a polynomial given as an arithmetic circuit. Our technique works for a large class of circuits, and in particular it can be used to derandomize the result of Abasi et al. for r-Simple k-Path. On our way to this result we introduce the notion of representative sets for multisets, which may be of independent interest. Finally, we give two more examples of problems that were already studied in the literature, where the same relaxation phenomenon happens. The first one is a natural relaxation of the Set Packing problem, where we allow the packed sets to overlap at each element at most r times. The second one is Degree Bounded Spanning Tree, where we seek for a spanning tree of the graph with a small maximum degree. 1 Introduction Many of the combinatorial optimization problems studied in theoretical computer science are idealized math- ematical models of real-world problems. When the simplest model is well-understood, it can be enriched to better capture the real-world problem one actually wants to solve. Thus it comes as no surprise that many of the well-studied computational problems generalize each other: the Constraint Satisfaction Problem generalizes Satisfiability, the problem of finding a spanning tree with maximum degree at most d generalizes Hamiltonian Path, while the problem of packing sets of size 3 generalizes packing sets of size 2, also known as the Maximum Matching problem. By definition, the generalized problem is computationally harder than the original. However it is sometimes the case that the most difficult instances of the generalized problem are actually instances of the original problem. In other words, the "further away" an instance of the generalized problem is from being an instance of the original, the easier the instance is. Abasi et. al [1] initiated the study of this phenomenon in parameterized complexity (we refer the reader to the textbooks [6, 7, 9, 19] for an introduction to parameterized complexity). In particular, they study the r-Simple k-Path problem. Here the input is a graph G, and integers k and r, and ∗The research leading to these results has received funding from the European Community's Seventh Framework Programme (FP7/2007-2013) under grant agreement number 257575 and 240258. Mi. Pilipczuk is currently holding a post-doc position at Warsaw Center of Mathematics and Computer Science and is supported by Polish National Science Centre grant DEC- 2013/11/D/ST6/03073. †Department of Computer Science, Technion, Israel, [email protected]. ‡Department of Informatics, University of Bergen, Norway, [email protected]. §Institute of Informatics, University of Warsaw, Poland, [email protected]. 1 the objective is to determine whether there is an r-simple k-path in G, where an r-simple k-path is a sequence v1, v2, . . . , vk of vertices such that every pair of consecutive vertices is adjacent and no vertex of G is repeated more than r times in the sequence. Observe that for r = 1 the problem is exactly the problem of finding a simple path of length k in G. On the other hand, for r = k the problem is easily solvable in polynomial time, as one just has to look for a walk in G of length k. Thus, gradually increasing r from 1 to k should provide a sequence of computational problems that become easier as r increases. Abasi et al. [1] confirm this intuition by giving a randomized algorithm for r-Simple k-Path with running time O(r2k/rnO(1)). In this paper we continue the investigation of algorithms for problems with a relaxation parameter r that interpolates between an NP-hard and a polynomial time solvable problem. We show that in several interesting cases one can get a sequence of algorithms with better and better running times as the relaxation parameter r increases, essentially providing a smooth transition from the NP hard to the polynomial time solvable case. Our main technical contribution is a new algorithm for the (r, k)-Monomial Detection problem. Here the input is an arithmetic circuit C that computes a polynomial f of degree k in n variables x1, . . . , xn. The task is to determine whether the polynomial f has a monomial Πn i , such that 0 ≤ ai ≤ r for every i ≤ n. The main result of Abasi et al. [1] is a randomized algorithm for (r, k)-Monomial Detection with running time O(r2k/rCnO(1)), and their algorithm for r-Simple k-Path is obtained using a reduction to (r, k)-Monomial Detection. We give a deterministic algorithm for the problem with running time rO(k/r)CnO(1) in the case when the circuit C is non-canceling. Formally, this means that the circuit contains only variables at its leaves (i.e., no constants) and only addition and multiplication gates (i.e, no subtraction gates). Informally, all monomials of the polynomials computed at intermediate gates of C contribute to the polynomial computed by C. i=1xai i=1xai i=1xai i is defined as Pn Comparing our algorithm with the algorithm of Abasi et al. [1], our algorithm is slower by a constant factor in the exponent of r, and only works for non-cancelling circuits. However our algorithm is deterministic (while the one by Abasi et al. is randomized) and also works for the weighted variant of the problem, while the one by Abasi et al. does not. In the weighted variant each variable xi has a non-negative integer weight wi, and the weight of a monomial Πn i=1 wiai. The task is to determine whether there exists a monomial Πn i , such that 0 ≤ ai ≤ r for every i ≤ n, and if so, to return one of minimum weight. As a direct consequence we obtain the first deterministic algorithm for r-Simple k-Path with running time rO(k/r)CnO(1), and the first algorithm with such a running time for weighted r-Simple k-Path. The significance of an in-depth study of (r, k)-Monomial Detection, is that it is the natural "relaxation parameter"-based generalization of the fundamental Multi-linear Monomial Detection problem. The Multi-linear Monomial Detection problem is simply (r, k)-Monomial Detection with r = 1. A multitude of parameterized problems reduce to Multi-linear Monomial Detection [4, 6, 11, 14, 24]. Thus, obtaining good algorithms (r, k)-Monomial Detection is an important step towards efficient algorithms for relaxation parameter-variants of these problems. For some problems, such as k-Path, efficient algorithms for the relaxation parameter variant (i.e r-Simple k-Path) follow directly from the algorithms for (r, k)- Monomial Detection. In this paper we give two more examples of fundamental problems for which efficient algorithms for (r, k)-Monomial Detection lead to efficient algorithms for their "relaxation parameter"- variant. Our first example is the (r, p, q)-Packing problem. Here the input is a family F of sets of size q over a universe of size n, together with integers r and p. The task is to find a subfamily A ⊆ F of size at least p such that every element of the universe is contained in at most r sets in A. Observe that (r, p, q)-Packing is the relaxation parameter variant of the classic Set Packing problem ((r, p, q)-Packing with r = 1). We give an algorithm for (r, p, q)-Packing with running time 2O(pq· log r r )FnO(1). For r = 1 our algorithm matches the best known algorithm [4] for Set Packing, up to constants in the exponent, and when r grows our algorithm is significantly faster than 2pqFnO(1). Just as for r-Simple k-Path, our algorithm also works for weighted variants of the problem. We remark that (r, p, q)-Packing was also studied by Fernau et al. [8] from the perspective of kernelization. Our second example is the Degree-Bounded Spanning Tree problem. Here, we are given as input a graph G and integer d, and the task is to determine whether G has a spanning tree T whose maximum degree does not exceed d. For d = 2 this problem is equivalent to Hamiltonian Path, and hence the problem is NP-complete in general, but for d = n − 1 it boils down to checking the connectedness of G. Thus, Degree- Bounded Spanning Tree can be thought of as a relaxation parameter variant of Hamiltonian Path. The problem has received significant attention in the field of approximation algorithms: there are classic results of Goemans [13] and of Singh and Lau [22] that give additive approximation algorithms for the problem and its 2 weighted variant. From the point of view of exact algorithms, the currently fastest exact algorithm, working for any value of d, is due to Fomin et al. [10] and has running time O(2n+o(n)). In this work, we give a randomized algorithm for Degree-Bounded Spanning Tree with running time 2O(n log d d ), by reducing the problem to an instance of (r, k)-Monomial Detection. Thus, our algorithm significantly outperforms the algorithm of Fomin et al. [10] for all super-constant d, and runs in polynomial time for d = Ω(n). Interestingly, the instance of (r, k)-Monomial Detection that we create crucially uses subtraction, since the constructed circuit computes the determinant of some matrix. Thus we are not able to apply our algorithm for non- cancelling circuits, and have to resort to the randomized algorithm of Abasi et al. [1] instead. Obtaining a deterministic algorithm for Degree-Bounded Spanning Tree that would match the running time of our algorithm, or extending the result to the weighted setting, remains as an interesting open problem. Our methods. The starting point for our algorithms is the notion of representative sets. If A is a family of sets, with all sets in A having the same size p, we say that a subfamily A′ ⊆ A q-represents A if for every set B of size q, whenever there exists a set A ∈ A such that A is disjoint from B, then there also exists a set A′ ∈ A′ such that A′ is disjoint from B. Representative sets were defined by Monien [16], and were recently used to give efficient parameterized algorithms for a number of problems [11, 12, 20, 21, 25, 26], including k-Path [11, 12, 21], Set Packing [21, 25, 26] and Multi-linear Monomial Detection [11]. It is therefore very tempting to try to use representative sets also for the relaxation parameter variants of these problems. However, it looks very hard to directly use representative sets in this setting. On a superficial level the difficulty lies in that representative sets are useful to guarantee disjointedness, while the solutions to the relaxation parameter variants of the considered problems may self-intersect up to r times. We overcome this difficulty by generalizing the notion of representative sets to multisets. When taking the union of two multisets A and B, an element that appears a times in A and b times in B will appear a + b times in the union A + B. Thus, if two regular sets A and B are viewed as multisets, they are disjoint if and only if no element appears more than once in A + B. We can now relax the notion of disjointedness and require that no element appears more than r times in A + B. Specifically, if A is a family of multisets, with all multisets in A having the same size p (counting duplicates), we say that a subfamily A′ ⊆ A q-represents A if the following condition is satisfied. For every multiset B of size q, whenever there exists an A ∈ A such that no element appears more than r times in A + B, there also exists an A′ ∈ A′ such that no element appears more than r times in A′ + B. The majority of the technical effort in the paper is spent on proving that every family A of multisets has a relatively small q-representative family A′ in this new setting, and to give an efficient algorithm to compute A′ from A. The formal statement of this result can be found in Corollary 3.8. On the way to develop our algorithm for computing representative sets of multisets, we give a new con- struction of a pseudo-random object called lopsided universal sets. Informally speaking, an (n, p, q)-lopsided universal set is a set of strings such that, when focusing on any k , p + q locations, we see all patterns of hamming weight p. These objects have been of interest for a while in mathematics and theoretical computer science under the name Cover Free Families (Cf. [5]). We give, for the first time, an explicit construction of an (n, p, q)-lopsided universal set whose size is only polynomially larger than optimal for all p and q. See Theorem 4.9 in Section 4 for a formal statement. Both our algorithm for computing representative sets of multisets, and the new construction of lopsided universal sets may be of independent interest. In Section 2 we give the necessary definitions and set up notational conventions. In Outline of the paper. Section 3 we give our construction of representative sets for multisets. This construction requires an auxiliary tool called minimal separating families. The construction of representative sets for multisets in Section 3 assumes that an appropriate construction of minimal separating families is given as a black box, while the construction of minimal separating families is deferred to Section 4. Our new construction of lopsided universal sets is a corollary of the construction of minimal separating families, and is also explained in Section 4. In Section 5 we use the new construction for representative sets of multisets to give efficient algorithms for (r, k)- Monomial Detection, (r, p, q)-Packing and r-Simple k-Path. In Section 6 we present our algorithm for Degree-Bounded Spanning Tree. Finally, we conclude by discussing open problems and directions for future research in Section 7. 3 2 Preliminaries Notation. Throughout the paper, we use the notation Ok to hide kO(1) terms. We denote [n] = {1, 2, . . . , n}. For sets A and B, by { A → B } we denote the set of all functions from A to B. The notation , is used to introduce new objects defined by formulas on the right hand side. Hashing families. Recall that, for an integer t ≥ 1, we say that a family of functions H ⊆ { [n] → [m]} is a t-perfect hash family, if for every C ⊆ [n] of size C = t there is f ∈ H that is injective on T . Alon, Yuster and Zwick [3] used a construction of Moni Naor (based on ideas from Naor et al. [18]) to hash a subset of size t into a world of size t2 using a very small set of functions: Theorem 2.1 ([3] based on Naor). For integers 1 ≤ t ≤ n, a t-perfect hash family H ⊆ { [n] → [t2]} of size tO(1) · log n can be constructed in time O(tO(1) · n · log n) We will also use the following perfect hash family given by Naor, Schulman and Srinivasan [18]. Theorem 2.2 ([18]). For integers 1 ≤ t ≤ n, a t-perfect hash family H ⊆ { [k2] → [t]} of size et+O(log2 t)·log k can be constructed in time O(et+O(log2 t) · k · log k). Separating families. We will be interested in constructing families of perfect hash functions that, in ad- dition to being injective on a set C, have the property of sending another large set D to an output disjoint from the image of C. We call such a family of functions a separating family. Definition 2.3 (Separating family). Fix integers t, k, s, n such that 1 ≤ t ≤ n. For disjoint subsets C, D ⊆ [n], we say that a function h : [n] → [s] separates C from D if • h is injective on C; and • there are no collisions between C and D. That is, h(C) ∩ h(D) = ∅. A family of functions H ⊆ { [n] → [s]} is (t, k, s)-separating if for every disjoint subsets C, D ⊆ [n] with We say that H is (t, k, s)-separating with probability γ if for any fixed C and D with sizes as above, a C = t and D ≤ k − t, there is a function h ∈ H that separates C from D. function h chosen uniformly at random from H separates C from D with probability at least γ. For us, the most important case of separating families is when the range size is C + 1. In this case we use the term minimal separating family. It will also be convenient to assume in the definition that C is mapped to the first C elements in the range. Definition 2.4 (Minimal separating family). A family of functions H ⊆ { [n] → [t + 1]} is (t, k)-minimal separating if for every disjoint subsets C, D ⊆ [n] with C = t and D ≤ k − t, there is a function h ∈ H such that • h(C) = [t]. • h(D) ⊆ {t + 1}. 3 Multiset separators and representative sets The purpose of this section is to formally define and construct representative sets for multisets. We will use, as an auxiliary result, an efficient construction of a small separating family. Theorem 3.1. Fix integers n, t, k such that 1 ≤ t ≤ min(n, k). Then a (t, k)-minimal separating family of size Ok((k/t)2t · 2O(t) · log n) can be constructed in time Ok((k/t)2t · 2O(t) · n · log n). We defer the proof of Theorem 3.1 to Section 4, and now we shall use it as a blackbox in order to provide a construction of representative sets for multisets. The primary tool for this is what we call a multiset separator (see Definition 3.2). Informally, a multiset separator is a not too large set of 'witnesses' for the fact that two multisets of bounded size do not jointly contain too many repetitions per element. 4 Notation for multisets. Fix integers integers n, r, k ≥ 1. We use [r]0 to denote {0, . . . , r}. An r-set is a multiset A where each element of [n] appears at most r times. It will be convenient to think of A as a vector in [r]n 0 , where Ai denotes the number of times i appears in A. We denote by A the number of elements in A counting repetitions. That is, A = Pn i=1 Ai. We refer to A as the size of A. An (r, k)-set is an r-set A ∈ [r]n 0 , where the number of elements with repetitions is at most k. That is, A ≤ k. For two multisets A, B over [n], 0 we denote the "complement" of r-set A, that is, Ai = r − Ai for all i ∈ [n]. By A + B we denote the "union" of A and B, that is, (A + B)i = Ai + Bi for all i ∈ [n]. Suppose now that A and B are (r, k)-sets. We say that A and B are (r, k)-compatible if A + B is also an (r, k)-set, and A + B = k. That is, the total number of elements with repetitions in A and B together is k and any specific element i ∈ [n] appears in A and B together at most r times. With the notation above at hand, we can define the central object needed for our algorithms. 0 . We say that A ≤ B when Ai ≤ Bi for all i ∈ [n]. By A ∈ [r]n Fix r-sets A, B ∈ [r]n 0 that are (r, k)-compatible, there exists F ∈ F such that A ≤ F ≤ B. Definition 3.2 (Multiset separator). Let F be a family of r-sets. We say that F is an (r, k)-separator if for any (r, k)-sets A, B ∈ [r]n Construction of multiset separators. The following theorem shows how an (r, k)-separator can be con- structed from a minimal separating family. Theorem 3.3. Fix integers n, r, k such that 1 < r ≤ k, and let t , ⌊2k/r⌋. Suppose a (t, k)-minimal separating family H ⊆ { [n] → [t + 1]} can be constructed in time f (r, k, n). Then an (r, k)-separator F of size H · (r + 1)t can be constructed in time Ok(f (r, k, max(n, t)) · (r + 1)t). Proof. In the proof we will assume that n ≥ t, since otherwise we can apply the same construction for n increased to t, and at the end remove from each multiset of the obtained F all the elements from [t]\ [n]. Note that thus we apply the construction of a minimal separating family to the set of size max(n, t), rather than n. Also, observe that from the assumption that r > 1 it follows that t ≤ k. h : [n] → [t + 1] in H, and for each w = (w1, . . . , wt) ∈ [r]t all j ∈ [t] and all i ∈ [n] with h(i) = j, we put F h,w Let F consist of all the constructed r-sets F h,w Let H be the constructed (t, k)-minimal separating family of functions from [n] to [t + 1]. For each 0 . For i = r/2. 0, we construct the following r-set F h,w ∈ [r]n i = wj . For all i ∈ [n] with h(i) = t + 1, we put F h,w . Thus we have that i F = H · (r + 1)t, Fix (r, k)-compatible (r, k)-sets A, B ∈ [r]n and F clearly can be constructed in time as claimed in the theorem statement. We are left with proving that F is indeed an (r, k)-separator. 0 . Let U be the set of all elements that appear in A or in B, that is, U = {i ∈ [n] Ai > 0 or Bi > 0}. Denote by C0 ⊆ U the sets of elements in A and B that appear more than r/2 times in one of the sets, that is, C0 = {i ∈ [n] Ai > r/2 or Bi > r/2}. Note that since A and B are (r, k)-sets, we have that C0 ≤ ⌊2k/r⌋ = t. Let C be a superset of C0 of size exactly t, constructed by augmenting C0 with arbitrary elements of U \ C0 up to size t, and if there is not enough of them, then by additionally augmenting it with the remaining number of arbitrary elements of [n] \ U . Note that this is always possible since t ≤ n. Let D = U \ C. Since A and B are (r, k)-compatible, we have that U ≤ k and from the construction of C it follows that D ≤ k − t. Therefore, there exists some h ∈ H that separates C from D. For j ∈ [t], let ij be the unique element of C mapped to j under h. Choose wj ∈ [r]0 such that Aij ≤ wj ≤ r − Bij ; such wj exists since A and B are (r, k)-compatible. Let w = (w1, . . . , wt). We claim that A ≤ F h,w ≤ B. For i ∈ C, the choice of w guarantees that Ai ≤ F h,w i = ⌊r/2⌋, and from the definition of D we have that D∩ C0 = ∅. So for such i it holds that Ai ≤ ⌊r/2⌋ ≤ Bi. Finally, for i /∈ C ∪ D we have that Ai = 0 and Bi = r, so surely Ai ≤ F h,w i ≤ Bi. i ≤ Bi. For i ∈ D we have F h,w By combining Theorems 3.1 and 3.3 we immediately obtain the following construction. Corollary 3.4. Fix integers n, r, k such that 1 < r ≤ k. Then an (r, k)-separator F of size Ok(r6k/r · 2O(k/r) · log n) can be constructed in time Ok(r6k/r · 2O(k/r) · n · log n) 5 Proof. Let t , ⌊2k/r⌋. By Theorem 3.1, a (t, k)-minimal separating family H ⊆ { [n] → [t + 1]} of size Ok((k/t)2t · 2O(t) · log n) can be constructed in time Ok((k/t)2t · 2O(t) · n · log n) from Theorem 3.1. Using this construction in Theorem 3.3, we obtain an (r, k)-separator F such that F = H · (r + 1)t = Ok(r6k/r · 2O(k/r) · log n). Moreover, from Theorem 3.3 it follows that F can be constructed in time Ok(r6k/r · 2O(k/r) · n · log n). Multisets over a weighted universe. Before proceeding, we discuss the issue of how the considered multisets will be equipped with weights. For simplicity, we assume that the universe {1, . . . , n} is weighted, that is, each element i ∈ {1, . . . , n} is assigned an integer weight w(i). We define the weight of a multiset as the sum of the weights of its elements counting repetitions. Formally, for A ∈ [r]n 0 we have w(A) = n X i=1 Ai · w(i). Whenever we talk about a weighted family of multisets, we mean that the universe [n] is equipped with a weight function and the weights of the multisets are defined as in the formula above. Let us remark that the results to follow can be also extended to a more general setting where each multiset is assigned its own weight that is not directly related to its elements. However, for concreteness we now focus on the simpler case. We discuss briefly the generalization in Section 5, where we argue that our tools can be also used to solve the edge-weighted variant of r-Simple k-Path. Representative sets for multisets. We are ready to define the notion of a representative set for a family of multisets. Definition 3.5 (Representative sets for multisets). Let P be a weighted family of (r, k)-sets. We say that a subfamily P ⊆ P represents P if for every (r, k)-set Q the following holds. If there exists some P ∈ P of weight w that is (r, k)-compatible with Q, then there also exists some P ′ ∈ P of weight w′ ≤ w that is (r, k)-compatible with Q. The following definition and lemma show that having an (r, k)-separator is sufficient for constructing representative sets. Definition 3.6. Let P be a weighted family of r-sets and let F be a family of (r, k)-sets. The weighted family TrimF (P) ⊆ P is defined as follows: For each F ∈ F, and for each 1 ≤ i ≤ k, check if there exists some P ∈ P with P = i and P ≤ F . If so, insert into TrimF (P) some P ∈ P that is of minimal weight among those with P = i and P ≤ F . Lemma 3.7. Let F be an (r, k)-separator and let P be a weighted family of (r, k)-sets. Then TrimF (P) represents P. Proof. Fix an (r, k)-set Q and suppose there is an (r, k)-set P ∈ P that is (r, k)-compatible with P . In particular, we have P = k − Q. Since F is an (r, k)-separator, there exists F ∈ F such that P ≤ F ≤ Q. As P ≤ F , when constructing TrimF (P) we must have inserted into it an (r, k)-set P ′ ∈ P of size k − Q such that P ′ ≤ F and w(P ′) ≤ w(P ). Therefore P ′ ≤ Q, which implies that P ′ + Q is an (r, k)-set. As P ′ + Q = k, we have that P ′ and Q are (r, k)-compatible. We can now combine Lemma 3.7 with the construction of an (r, k)-separator from Corollary 3.4, and thus obtain a construction of a small representative family for a weighted family of multisets. Corollary 3.8. There exists a deterministic algorithm that, given a weighted family P or (r, k)-sets, runs in time Ok(P · r6k/r · 2O(k/r) · n log n) and returns returns a family P ⊆ P that represents P and has size Ok(r6k/r · 2O(k/r) · log n). Proof. Let F be the (r, k)-separator of size Ok(r6k/r·2O(k/r)·log n) given by Corollary 3.4; recall that F can be computed in time Ok(r6k/r · 2O(k/r) · n log n). We compute P = TrimF (P) which represents P by Lemma 3.7. The construction of TrimF (P) amounts to going over all pairs of r-sets P ∈ P and F ∈ F and checking whether P ≤ F . Thus, the computation takes time at most Ok(P · F· n) = Ok(P · r6k/r · 2O(k/r) · n log n). 6 4 Construction of a separating family The purpose of this section is to prove Theorem 3.1, that is, to construct a small separating family of functions. First, we need to introduce some auxiliary results. Hitting combinatorial rectangles. We first recall the notion of a hitting set for combinatorial rectangles. For a sequence of integers (m1, m2, . . . , mt), by Qi∈[t][mi] we denote [m1] × [m2] × . . . × [mt]. Definition 4.1. Let R ⊆ Qi∈[t][mi] be a set of the form R1 × . . .× Rt, where Ri ⊆ [mi] for all i ∈ [t]. We say that R is a combinatorial rectangle with sidewise density γ, if for every i ∈ [t] we have that Ri ≥ γ · mi. A set H ⊆ Qi∈[t][mi] is a hitting set for rectangles with sidewise density γ if for every set R ⊆ Qi∈[t][mi] that is a combinatorial rectangle of sidewise density γ, it holds that R ∩ H 6= ∅. Linial et al. [15] gave the following construction of a hitting set for combinatorial rectangles. Theorem 4.2 ([15]). A hitting set H ⊆ [m]t for rectangles with sidewise density 1/3 of size H = 2O(t)·mO(1) can be constructed in time 2O(t) · mO(1). We need a hitting set for combinatorial rectangles in a universe where the coordinates are from domains of different sizes. We show that Theorem 4.2 can be adapted to this setting. Corollary 4.3. Suppose m1, . . . , mt ≤ m. Then a hitting set H ⊆ Qi∈[t][mi] for rectangles with sidewise density 1/2 of size H = 2O(t) · mO(1) can be constructed in time 2O(t) · mO(1). Proof. For the purpose of the proof it will be convenient to redefine [a] as {0, . . . , a− 1}. Let m′ = 3m. Define mapping π : [m′]t → Qi∈[t][mi] as follows: π(a1, a2, . . . , at) = (a1 mod m1, a2 mod m2, . . . , at mod mt). Observe that if Ri ⊆ [mi] is such that Ri ≥ mi/2, and R′ i ⊆ [m′] is the set of all elements of [m′] whose i ≥ m′/3. This follows from the fact that m′ = 3m ≥ 3mi. remainders modulo mi belong to Ri, then R′ Therefore, if R ⊆ Qi∈[t][mi] is a combinatorial rectangle with sidewise density 1/2, then R′ , π−1(R) ⊆ [m′]t is a combinatorial rectangle with sidewise density 1/3. Let H ′ ⊆ [m′]t be the hitting set for combinatorial rectangles with sidewise density 1/3 given by Theorem 4.2. Moreover, let H , π(H ′); hence we have that H ≤ H ′ = 2O(t) · mO(1). We have that H ′ ∩ R′ 6= ∅, so also H ∩ R = π(H ′) ∩ π(R′) ⊇ π(H ′ ∩ R′) 6= ∅. Since R was chosen arbitrarily, we infer that H is a hitting set for combinatorial rectangles with sidewise density 1/2. Pairwise independent families. Another component in our construction is a family of ǫ-pairwise inde- pendent functions. Definition 4.4. A family of functions H ⊆ { [n] → [m] } is ǫ-pairwise independent if for all x, y ∈ [n] and a, b ∈ [m], it holds that Pf ←H(f (x) = a ∧ f (y) = b) − 1/m2 ≤ ǫ. The constructions of [17] and [2] imply the following construction of an ǫ-pairwise independent family of functions (cf. [3, Section 4]). Theorem 4.5 ([2, 17]). Fix any m ≤ n. Then a 1/m2-pairwise independent family H ⊆ { [n] → [m]} of size mO(1) · log n can be constructed in time O(mO(1) · n · log n). We now use Theorem 4.5 to construct a small family that separates one element from k other elements with non-negligible probability. Lemma 4.6. Fix integers k, n with 1 ≤ k ≤ n. Then a family Hk,4k ⊆ { [n] → [4 · k]} that is (1, k, 4 · k)- separating with probability 1/2 and has size kO(1) · log n can be constructed in time kO(1) · n · log n. 7 Proof. Let H ⊆ { [n] → [4k]} be the family of 1/(4k)2-pairwise independent functions, given by Theorem 4.5. Fix sets C = {a} and D = {b1, . . . , bk−1} we want to separate. For j ∈ [k−1], let Xj be a random variable that is equal to one if f (a) = f (bj) and to zero otherwise, where f is chosen uniformly at random from H. From the 1/4k-pairwise independence of H, we have that E(Xj ) = P(Xj = 1) ≤ 4k · (1/(4k)2 + 1/(4k)2) ≤ 1/(2k). Let us define X = Pk−1 j=1 Xj, so that we have E(X) ≤ (k− 1)/(2k) < 1/2. Note that X is precisely the number of collisions between C and D. From Markov's inequality, we have that P(X ≥ 1) ≤ 1/2. So with probability at least 1/2 over the choice of f ∈ H, C and D are separated by f . The next claim follows from the well-known theorem that the geometric mean of non-negative numbers is never larger than their arithmetic mean. Proposition 4.7. Let k1, . . . , kt be non-negative real numbers such that k1 + . . . + kt ≤ k. Then Qt (k/t)t. i=1 ki ≤ The main construction. We are ready to proceed to the main construction. Proof of Theorem 3.1. Fix disjoint subsets C, D ⊆ [n] with C = t and D ≤ k − t. Recall that we want to construct a family of functions H ⊆ { [n] → [t + 1]}, such that for any C and D as above, there exists h ∈ H that separates C from D. It will be convenient to present the family by constructing h adaptively given C and D. That is, for arbitrarily chosen C and D, we will adaptively construct a function h that separates C from D. Function h will be constructed by taking a number of choices, where each choice is taken among a number of possibilities. The final family H will comprise all h that can be obtained using any such sequence of choices; thus, the product of the numbers of possibilities will limit the size of H. As C and D are taken arbitrarily, it immediately follows that such H separates every pair (C, D). 1. Let H0 ⊆ { [n] → [k2]} be the k-perfect hash family given by Theorem 2.1. Choose f0 ∈ H0 that is injective on C ∪ D - there are kO(1) · log n choices for this stage. From now on, we identify C and D with their images in [k2] under f0. 2. Let H1 ⊆ { [k2] → [t]} be the t-perfect hash family given by Theorem 2.2. Choose a function f1 ∈ H1 that is injective on C - there are et+O(log2 t) · log k choices for this stage. For i ∈ [t], we denote from now on by ci the (unique) element of C with f1(ci) = i. Moreover, elements mapped to i under f1 will be denoted by Bi, and we will think of them as the i-th bucket. 3. Choose non-negative integers k1, . . . , kt such that ki is the number of elements a ∈ D with f1(a) = i. Note that k1 + . . . + kt ≤ k − t, so the number of choices for this stage is at most (cid:0)k t(cid:1) ≤ (ek/t)t. i · log k. 4. For i ∈ [t], let Hki,4ki ⊆ { [k2] → [4 · ki]} be family given by Lemma 4.6. That is, Hki,4ki is (1, ki, 4· ki)- separating with probability 1/2 and has size mi = kO(1) Let R be the set of all vectors (h1, . . . , ht) such that for all i ∈ [t], hi is an element of Hki,4ki that separates ci from Di. Identify [mi] with Hki,4ki by ordering the functions in Hki,4ki arbitrarily. Observe that R is a combinatorial rectangle of sidewise density 1/2 in Qi∈[t][mi]. Note that for all i ∈ [t], mi ≤ m for some m = kO(1). Let H be the hitting set for combinatorial rectangles with sidewise density 1/2 given by Corollary 4.3. Choose an element (h1, . . . , ht) ∈ H ∩ R. As H = 2O(t) · kO(1), there are 2O(t) · kO(1) choices for this stage. For i ∈ [t], apply hi to partition bucket Bi into buckets Bi,1, . . . ,Bi,4ki; that is, element a ∈ [n] is put into bucket Bf1(a),hf1(a)(a). Since (h1, . . . , ht) ∈ R, we thus have that each ci is mapped to a separate bucket from all elements of Di. 5. For each i ∈ [t], choose the unique index ji ∈ [4ki] such that ci was mapped to bucket Bi,ji . Construct the final function h by mapping all the elements of Bi,ji to i, and mapping all the elements of Bi,j ′ for j ′ 6= ji to t + 1, for all i ∈ [t]. The number of choices for this stage is 4t · Qt i=1 ki ≤ (4k/t)t, where the inequality follows from Proposition 4.7. 8 To sum up, the number of different functions enumerated in all the above stages is at most kO(1) · log n · et+O(log2 t) · log k · (ek/t)t · 2O(t) · kO(1) · (4k/t)t = (k/t)2t · 2O(t) · kO(1) · log n = Ok((k/t)2t · 2O(t) · log n). Similarly, going over the construction times of the different components used in the above stages, we get that the family can be constructed in time O(kO(1) · n · log n · et+O(log2 t) · k · log k · (ek/t)t · 2O(t) · kO(1) · (4k/t)t) = O((k/t)2t · 2O(t) · kO(1) · n · log n) = Ok((k/t)2t · 2O(t) · n · log n). Informally speaking, an (n, p, q)-lopsided universal set is a set of strings such that, Lopsided universal sets. when focusing on any k , p + q locations, we see all patterns of hamming weight p. Universal set families, and in particular the lopsided ones, have important applications in the determinization of parameterized algorithms that use the technique of color coding; cf. [12]. Definition 4.8. An (n, p, q)-lopsided universal set is a family of subsets F ⊆ [n] such that for every disjoint subsets A, B ⊆ [n] with A = p and B = q there exists F ∈ F with A ⊆ F and F ∩ B = ∅. p(cid:1)· √p · q · k · log n A probabilistic argument shows the existence of (n, p, q)-lopsided universal sets of size (cid:0)k (cf. Lemma 52 in [5]). Fomin, Lokshtanov and Saurabh [12] used the technique of [18] to construct an (n, p, q)- log log(k)(cid:1) · log n. Consider the case p = o(q): For simplicity of discussion, lopsided universal set of size (cid:0)k let us focus on the (cid:0)k p(cid:1) ≤ (e· k/p)p term in the probablistic construction and omit log n terms. In this case the 2O(cid:0) p(cid:1). Bshouty [5] gives a better construction for such p achieving size roughly kp+2 (see Lemma 53 in [5]). We remark that Bshouty [5] referred to this object as a cover free family. As a corollary of the last section we obtain an explicit construction of size (k/p)O(p). log log(k)(cid:1) term of [12] is much larger than (cid:0)k k k p(cid:1) · 2O(cid:0) Theorem 4.9. Fix integers p, q and n such that k = p + q ≤ n. Then an (n, p, q)-lopsided universal set of size Ok((k/p)2·p · 2O(p) · log n) can be constructed in time Ok((k/p)2·p · 2O(p) · n · log n). Proof. Let H ⊆ { [n] → [p + 1]} be the (p, k)-minimal separating family of size Ok((k/p)2p · 2O(p) · log n) given by Theorem 3.1. For each h ∈ H, construct set Fh = h−1([p]), and let F , {Fh h ∈ H}. The definition of a minimal separating family immediately implies that F is an (n, p, q)-lopsided universal set, and the time needed for the construction follows from Theorem 3.1. 5 Algorithmic applications In this section we present applications of our construction of representative sets for multisets to the design of deterministic algorithms for problems with relaxed disjointness constraints. We first give some useful auxiliary tools, and then present algorithms for three problems: r-Simple k-Path, (r, p, q)-Packing, (r, k)-Monomial Detection. Let us remark that the algorithms for the first two problems follow from the algorithm for the (more general) last problem. Nevertheless, we find it more didactic to present the applications in increasing order of difficulty. Throughout this section, r always denotes an integer in the range 1 < r < k. 5.1 Algorithmic preliminaries The following simple observation will be used in all of our algorithmic applications. Lemma 5.1. Let P be a family of (r, k)-sets that constains a multiset P of size k and weight w. Then any P ⊆ P that represents P contains a multiset P ′ of size k and weight w′ ≤ w. Proof. Take B = ∅. Then P and B are (r, k)-compatible. So there must exist P ′ ∈ P that is (r, k)-compatible with B and has weight at most w. As P ′ + B = k, we have P ′ = k. 9 The following simple fact is immediate and will be used implicitly. Proposition 5.2. If A′′ represents A′ and A′ represents A, then A′′ represents A. We now show that representative sets behave robustly under union of families. Lemma 5.3. Suppose A and B are two weighted families of (r,k)−sets, and suppose further that A represents A and B represents B. Then A ∪ B represents A ∪ B. Proof. Take any (r, k)-set D such that there exists C ∈ A∪B that is (r, k)-compatible with D. If C ∈ A, then there exists C ′ ∈ A with w(C ′) ≤ w(C) such that C ′ is (r, k)-compatible with D. Then also C ′ ∈ A ∪ B and we are done. The reasoning for the case when C ∈ B is symmetric. Finally, we introduce operation • that extends the considered weighted family of (r, k)-sets. This is the crucial ingredient in the classic technique of iteratively extending the current family by a new object, and then shrinking the size of the family by taking a representative subfamily. Definition 5.4. We say that (r, k)-sets A and B are (r, k)-consistent, if A + B ≤ k and Ai + Bi ≤ r for all i ∈ [n]. (Note that this is a weaker definition than being (r, k)-compatible, where it is required that A+B = k.) Let A and B be weighted families of (r, k)-sets. We define the weighted family A • B as follows: A • B , {A + B A ∈ A, B ∈ B, A and B are (r, k)-consistent}. In particular, for an element i ∈ [n], we denote A • i , {A + {i} A ∈ A,A < k, Ai < r}. Lemma 5.5. Suppose A and B are two weighted families of (r,k)−sets, and suppose further that A represents A and B represents B. Then A • B represents A • B. Proof. Fix an (r, k)-set D such that there exists C ∈ A • B that is (r, k)-compatible with D. Hence, we have that C = A + B for some A ∈ A and B ∈ B that are (r, k)-consistent. In particular, A is (r, k)-compatible with B + D. Hence, there exists A′ ∈ A with w(A′) ≤ w(A) that is (r, k)-compatible with B + D. In other words, A′ + B + D is an (r, k)-set of size A′ + B + D = k. It follows that B is (r, k)-compatible with A′ + D. Hence, there exists B′ ∈ B with w(B′) ≤ w(B) that is (r, k)-compatible with A + D. Again, for this B′ we have that A′ + B′ + D is an (r, k)-set of size k. Therefore, A′ + B′ is an (r, k)-set of size at most k and weight not larger than the weight of A + B. In other words, A′ and B′ are (r, k)-consistent, and therefore A′ + B′ ∈ A′ • B′. As A′ + B′ is (r, k)-compatible with D and w(A′ + B′) ≤ w(A + B), we are done. 5.2 r-Simple k-Path We first introduce some notation for defining the r-Simple k-Path problem. Let G be a directed graph on n vertices. A k-path in G is a simple walk P = v1 → v2 → . . . → vk in G, that is, all vertices traversed by the walk are pairwise different An r-simple k-path is a walk P = v1 → v2 → . . . → vk in G such that no vertex is repeated more than r times. In case the vertex set of G is equipped with a weight function, the weight of an r-simple k-path P is defined as the weight of the multiset of vertices traversed by P , where each vertex is taken the number of times equal to the number of its visits on P . r-Simple k-Path Input: Directed graph G = (V, E), weight function w : V → R, integers r and k. Parameters: r, k Question: Determine whether there exists an r-simple k-path in G, and if so then return one of minimal possible weight. Theorem 5.6. r-Simple k-Path can be solved in deterministic time Ok(r12k/r · 2O(k/r) · n3 · log n). Proof. Identify the vertex set V with [n]. For u ∈ [n] and i ∈ [k], let Pi,u denote the set of r-simple paths in G that have length i and end in u. Note that an element P of such a set Pi,u can be viewed as an (r, k)-set when we ignore the order of vertices in the path. We can thus view the sets Pi,u as families of (r, k)-sets. 10 We will compute, using a dynamic programming algorithm, for each u ∈ [n] and i ∈ [k], a set Pi,u ⊆ Pi,u that represents Pi,u and has size at most Ok(r6k/r · 2O(k/r) · log n). By Lemma 5.1, a minimal-weight r-simple k-path in G can be recovered by taking a minimum-weight multiset among families Pk,u, for u ∈ [n]. In particular, if all these sets are empty, then no r-simple k-path exists in G. Thus, such an algorithm can be used to solve r-Simple k-Path. We proceed with the algorithm description. For i = 1 and u ∈ [n], family P1,u simply contains only the length-one path u. Assume that we have computed families Pi,u for every u ∈ [n]. We describe the computation of Pi+1,v for a fixed v ∈ [n], together with its running time. 1. We compute P ′ , S(u,v)∈E Pi,u • v. Clearly, we have that P ′ ≤ n · Ok(r6k/r · 2O(k/r) · log n). We now claim that P ′ represents Pi+1,v. Note first that Pi+1,v = S(u,v)∈E Pi,u • v. By Lemma 5.5, for any Pi,u•v represents S(u,v)∈E Pi,u•v = Pi+1,v. u ∈ [n], Pi,u•v represents Pi,u•v. Therefore, P ′ = S(u,v)∈E Computing P ′ directly from the definition requires time Ok(Pu∈[n] Pi,u) = Ok(n· r6k/r · 2O(k/r) · log n). 2. Now, using the algorithm of Corollary 3.8, compute a set Pi+1,v that represents P ′ and has size Pi+1,v = Ok(r6k/r · 2O(k/r) · log n). This takes time Ok(P ′· r6k/r · 2O(k/r)· n log n) = Ok(n2· r12k/r · 2O(k/r)· log n). Since during each of k steps of the algorithm, this procedure is applied to every vertex v ∈ [n], we conclude that the running time of the algorithm is Ok(r12k/r · 2O(k/r) · n3 · log n), as claimed. We have considered the r-Simple k-Path problem where the weights are on the vertices. One could also consider the edge weighted variant where every edge has a weight and the weight of a walk is the sum of the weight of the edges on the walk (counting multiplicities of edges). One can reduce this variant to the vertex weighted variant as follows. Let G be the input graph, we make a new graph G′ from G. Here each edge uv of G is replaced by a new vertex xuv with u being the only in-neighbor and v being the only out-neighbor of xuv. The weight of xuv is set to the weight of the edge uv. The weight of the vertices of G′ that correspond to the vertices of G is set to 0. An r-simple k-path in G corresponds to an r-simple (2k + 1)-path in G′ of the same weight. On the other hand, a minimum weight r-simple (2k + 1)-path in G′ must start and end in vertices corresponding to vertices of G, since these have weight 0. Such r-simple (2k + 1)-paths in G′ correspond to an r-simple k-path in G of the same weight. Thus we can run the algorithm for Theorem 5.6 on G′, obtaining an algorithm for the edge weighted variant with running time rO(k/r)nO(1). 5.3 (r, p, q)-Packing We say that P ⊆ [n] is a q-set if P = q. We say that a family of q-sets A = {P1, . . . , Pt} is an r-packing if every element j ∈ [n] appears in at most r of the q-sets in A. The (r, p, q)-Packing problem asks whether a given family of q-sets contains an r-packing. Again, in case universe [n] is equipped with a weight function, we can say that a family of q-sets is weighted by setting the weight of a q-set to be the total weight of its elements. The weight of an r-packing is defined as the sum of weights of its sets. (r, p, q)-Packing Input: Weighted family F of q-sets, integers r, p, q Parameters: r, p, q Question: Determine whether there exists a subfamily A ⊆ F with A = p that is an r-packing, and if so then return such A of minimal total weight. Theorem 5.7. Let k , p · q. Then (r, p, q)-Packing can be solved in deterministic time Ok(F · r12k/r · 2O(k/r) · n log2 n). Proof. Let F be the input family of q-sets. For 0 ≤ i ≤ p, denote by Pi the set of r-packings of size i in F . Note that an element A = {P1, . . . , Pi} of Pi can be viewed as an (r, k)-set: We think of A as the multiset A = P1 + . . . + Pi. We know that this multiset has size at most p · q = k and every element j ∈ [n] appears in A at most r times. We will compute, for each 0 ≤ i ≤ p, a subfamily Pi ⊆ Pi that represents Pi and has size at most Ok(r6k/r · 2O(k/r) · log n). By Lemma 5.1, a minimum-weight r-packing in F can be recovered by 11 taking a minimum-weight element of Pp. In particular, if Pp is empty, then no r-packing exists in F . Thus, such an algorithm can be used to solve (r, p, q)-Packing. We proceed with the algorithm description. For i = 0, we take P0 = P0 = {∅}. Assume we have computed Pi for some 0 ≤ i < p. We describe the computation of Pi+1. 1. We compute P ′ , Pi•F . Clearly, we have that P ′ ≤ F· Pi ≤ F·Ok(r6k/r ·2O(k/r)·log n). We claim that P ′ represents Pi+1. Note first that Pi+1 = Pi • F . Hence, by Lemma 5.5, P ′ = Pi • F represents Pi • F = Pi+1. Computing P ′ directly from the definition requires time Ok(F· Pi·n) = Ok(F·r6k/r·2O(k/r)·n log n). 2. Now, using the algorithm of Corollary 3.8, compute a set Pi+1 that represents P ′ and has size Pi+1 = Ok(r6k/r·2O(k/r)·log n). This takes time Ok(P ′·r6k/r·2O(k/r)·n log n) = Ok(F·r12k/r·2O(k/r)·n log2 n). Since we repeat this procedure p times, the claimed running time follows In Theorem 5.7 we gave an algorithm for (r, p, q)-Packing where every element has a weight and the weight of a set is equal to the sum of the weights of the elements. A related variant is one where a weight function w : F → N is given as input. That is, every set P ∈ F has its own weight w(P ), and the weight of a subfamily A ⊆ F is the sum of the weights of the sets in A. We will call this the set weighted (r, p, q)-Packing problem. The set weighted problem can be reduced to the original by adding for every set P ∈ F a new element eP of weight w(P ), inserting eP into P and giving eP weight w(P ). Note that P is the only set in the new instance that contains eP . All elements corresponding to the elements of the instance of set weighted (r, p, q)-Packing are given weight 0. All sets in the new instance have size q + 1, and r-packings in the new instance correspond to r-packings in the original instance with the same weight. Thus we can apply the algorithm of Theorem 5.7 on the new instance in order to solve the instance of set weighted (r, p, q)-Packing. This yields an algorithm for set weighted (r, p, q)-Packing with running time FrO(k/r)nO(1). 5.4 (r, k)-Monomial Detection 1 ··· X dn In this subsection we consider polynomials from ring Z[X1, . . . , Xn]. We say a monomial X d1 n is an if for all i ∈ [n], we have di ≤ r. We say the monomial is an (r, k)-monomial if the above r-monomial holds and the total degree of the monomial is k. Let C be an arithmetic circuit computing a polynomial f (X1, . . . , Xn) ∈ Z[X1, . . . , Xn]. We say C is non-canceling if it contains only variables at its leaves (i.e., no constants), and only addition and multiplication gates (i.e., no substractions). For a non-canceling circuit C, we define C to be the number of multiplication and addition gates plus the number of leaves (each containing a variable). We assume the fan-in of a non-canceling circuit is two, i.e., each multiplication and addition gate has at most two wires coming in. (This will simply be convenient for bounding the running time as a function of C.) (r, k)-Monomial Detection Input: A non-canceling circuit C computing a polynomial f (X1, . . . , Xn) ∈ Z[X1, . . . , Xn], integers r, k. Parameters: r, k Question: Determine if there exists an (r, k)-monomial in f with non-zero coefficient and if so, then return such a monomial. Theorem 5.8. Given a non-canceling circuit C computing a polynomial f (X1, . . . , Xn) ∈ Z[X1, . . . , Xn], (r, k)-Monomial Detection can be solved in deterministic time Ok(C · r18k/r · 2O(k/r) · n log3 n). Proof. For each gate s of C, let fs be the polynomial computed at s. Define Ps to be the set of r-monomials of total degree at most k that appear in fs with nonzero coefficient. We can view Ps as a family of (r, k)-sets: An r-monomial M = X d1 n of total degree at most k corresponds to the (r, k)-set where each j ∈ [n] appears dj times (in this case, we put uniform weights on the elements of universe [n]). We present an algorithm that computes, for every gate s of C, a subfamily Ps ⊆ Ps of size Ok(r6k/r · 2O(k/r) · log n) that represents Ps. Let sout be the output gate of C. By Lemma 5.1, if f contains an r-monomial of total degree k, then Psout will contain such a monomial. Hence, to solve (r, k)-Monomial Detection it suffices to check whether Psout is nonempty. 1 ··· X dn 12 We compute the sets Ps from bottom to top. For s being an input gate containing variable Xi, we simply put Ps = Ps = {{i}}. Take then any non-input gate s, and suppose we have computed Ps1 and Ps2 for the gates s1 and s2 having wires into s. 1. If s is an addition gate, then we define P ′ , Ps1 ∪ Ps2 . We claim that P ′ represents Ps: Since C is non-canceling, the set of monomials that appear in fs with a nonzero coefficient is simply the union of the sets of monomials of appearing in fs1 and in fs2. In particular, Ps = Ps1 ∪Ps2 . Therefore, by Lemma 5.3 we infer that P ′ = Ps1 ∪ Ps2 represents Ps. Note that P ′ ≤ Ps1 + Ps2 = Ok(r6k/r · 2O(k/r) · log n) and P ′ can be computed in time Ok( Ps1 · Ps2 · n) = Ok(r12k/r · 2O(k/r) · n log2 n). 2. If s is a multiplication gate, then we define P ′ , Ps1 • Ps2 . Since C is non-canceling, the set of monomials appearing in fs is exactly the set of all products of a monomial appearing in fs1 and a monomial appearing in fs2 . In particular, Ps is exactly the set of these products that are also (r, k)- monomials. When viewed as a multiset, the product of monomials M1 and M2 is the multiset M1 + M2. Thus, we have that Ps = Ps1 • Ps2 and therefore, using Lemma 5.5, we infer that P ′ = Ps1 • Ps2 represents Ps. Note that P ′ ≤ Ps1 · Ps2 = Ok(r12k/r · 2O(k/r) · log2 n) and P ′ can be computed in time Ok( Ps1 · Ps2 · n) = Ok(r12k/r · 2O(k/r) · n log2 n). 3. Now, using the algorithm of Corollary 3.8, compute subfamily Ps of size Ok(r6k/r · 2O(k/r) · log n) that represents P ′. This takes time Ok(P ′ · r6k/r · 2O(k/r) · n log n) = Ok(r18k/r · 2O(k/r) · n log3 n). Since the above procedure is applied to every gate of C, the claimed running time follows. We remark that, after a trivial modification, the algorithm above can equally easily solve also a weighted variant of (r, k)-Monomial Detection, where each variable is equipped with a weight and we are interested in extracting a monomial of minimum total weight, defined as the sum of the weights of variables times their degrees. It is not hard to reduce the problems r-Simple k-Path and (r, p, q)-Packing, considered in the previous sections, to this variant; we leave the details to the reader. 6 Low degree monomials and low degree spanning trees Let G be a simple, undirected graph with n vertices. Let T be the family of spanning trees of G; In particular, if G is not connected then T = ∅. With every edge e ∈ E(G) we associate a variable ye. The Kirchhoff's polynomial of G is defined as: KG((ye)e∈E(G)) = X T ∈T Y e∈E(T ) ye. Thus, KG is a polynomial in Z[(ye)e∈E(G)]. Let v1, v2, . . . , vn be an arbitrary ordering of V (G). The Laplacian of G is an n × n matrix LG = [aij ], where aij =   ye Pe incident to vi −yvivj 0 if i = j, if i 6= j and vivj ∈ E(G), if i 6= j and vivj /∈ E(G). Observe that LG is symmetric and the entries in every column and in every row of LG sum up to zero. Then it can be shown that all the first cofactors of LG, i.e., the determinants of matrix LG after removing a row and a column with the same indices, are equal. Let NG be this common value; then NG is again a polynomial over variables (ye)e∈E(G). The Kirchhoff's Matrix Tree Theorem, in its general form, states that these two polynomials coincide. Theorem 6.1 (Matrix Tree Theorem). KG = NG. We remark that the Matrix Tree Theorem is usually given in the more specific variants, where all variables ye are replaced with 1; then the theorem expresses the number of spanning trees of G in terms of the first cofactors of LG. However, the proof can be easily extended to the above, more general form; see for instance [23]. Observe that Theorem 6.1 provides a polynomial-time algorithm for evaluating KG over a given field and vector of values of variables (ye)e∈E(G). Indeed, we just need to construct matrix LG, remove, say, the first row and the first column, and compute the determinant. We now present how this observation can be used to design a fast exact algorithm for the Degree-Bounded Spanning Tree problem. 13 Theorem 6.2. The Degree-Bounded Spanning Tree problem can be solved in randomized time O∗(dO(n/d)) with false negatives. Proof. Associate every vertex v of the given graph G with a distinct variable xv. Let KG ∈ Z[(xv)v∈V (G)] be a polynomial defined as KG with every variable yuv, for uv ∈ E(G), evaluated to xuxv. Then it follows that KG((xv)v∈V (G)) = X T ∈T Y v∈V (G) xdegT (v) v . Observe also that K G is 2(n− 1)-homogenous, that is, all the monomials of K G have their total degrees equal to 2(n − 1). Thus, graph G admits a spanning tree with maximum degree at most d if and only if polynomial KG contains a (d, 2(n − 1))-monomial. Using Theorem 6.1 we can construct a nO(1)-sized circuit evaluating KG. Hence, verifying whether KG contains a (d, 2(n − 1))-monomial boils down to applying the algorithm of Abasi et al. [1] for (r, k)-Monomial Detection with r = d and k = 2(n − 1). This algorithm runs in randomized time O∗(dO(n/d)) and can only produce false negatives. Let us repeat that in the proof of Theorem 6.2 we could not have used Theorem 5.8 instead of the result of Abasi et al. [1], because the constructed circuit is not non-cancelling. Derandomizing the algorithm and extending it to the weighted setting remains hence open. Interestingly, the running time of the algorithm of Theorem 6.2 is essentially optimal, up to the log d factor in the exponent. A similar lower bound for r-Simple k-Path was given by Abasi et al. [1]. Theorem 6.3. Unless ETH fails, there exists a constant s > 0 such that for no fixed integer d ≥ 2 the Degree-Bounded Spanning Tree problem with the degree bound d can be solved in time O∗(2sn/d). Proof. It is known (see e.g. [6]) that, assuming ETH, there exists a constant s > 0 such that the Hamiltonian Path problem cannot be solved in time O∗(2sn) on n-vertex graphs. Consider the following reduction from Hamiltonian Path to Degree-Bounded Spanning Tree with the degree bound d: given an instance G of Hamiltonian Path, create G′ by attaching to every vertex v ∈ V (G) a set of d − 2 degree-1 vertices, adjacent only to v. Since the new vertices have to be leaves in every spanning tree of G′, it follows that every spanning tree T ′ of G′ is in fact a spanning tree of G with all the vertices of V (G′) \ V (G) attached as leaves. In particular, G′ admits a spanning tree with maximum degree d if and only if G admits a spanning tree with maximum degree 2, i.e., a hamiltonian path. Observe that V (G′) = (d − 1) · V (G). Hence, if there was an algorithm solving Degree-Bounded Spanning Tree with the degree bound d in time O∗(2sn/d), then by composing the reduction with the algorithm we would be able to solve Hamiltonian Path on an n-vertex graph in time O∗(2s(d−1)n/d) ≤ O∗(2sn), thus contradicting ETH. 7 Conclusions In this paper we considered relaxation parameter variants of several well studied problems in parameterized complexity and exact algorithms. We proved, somewhat surprisingly, that instances with moderate values of the relaxation parameter are significantly easier than instances of the original problems. We hope that our work, together with the result of Abasi et al. [1] breaks the ground for a systematic investigation of relaxation parameters in parameterized complexity and exact algorithms. We conclude with mentioning some of the most natural concrete follow up questions to our work. • We gave a determinstic algorithm for non-cancelling (r, k)-Monomial Detection with running time 2O(k log r r )CnO(1), while Abasi et al. [1] gave a randomized algorithm with such a running time for (r, k)- Monomial Detection without the non-cancellation restriction. Is there a determinstic algorithm for (r, k)-Monomial Detection with running time 2O(k log r r )CnO(1)? • Does there exist a deterministic algorithm with running time 2O(n log r Tree? Note that a deterministic algorithm with running time 2O(k log r Detection immediately imply such an algorithm for Degree-Bounded Spanning Tree. r ) for Degree-Bounded Spanning r )CnO(1) for (r, k)-Monomial 14 • Is there a 2O(k log r r )nO(1) time algorithm for the problem where we are given as input a graph G, integers k and d, and asked whether G contains a subtree T on at least k vertices, such that the maximum degree of T is at most d? Observe that for k = n this is exactly the Degree-Bounded Spanning Tree problem. • Is it possible to obtain polynomial kernels for problems with relaxation parameters with smaller and smaller size bounds as the relaxation parameter increases? • Are the log r (or log d) factors in the exponents of our running time bounds necessary? For example, is there an algorithm for r-Simple k-Path with running time 2O(k/r)nO(1)? Or a 2O(n/d) time algorithm for Degree Bounded Spanning Tree? Acknowledgements The first author thanks Fedor V. Fomin for hosting him at a visit in the University of Bergen where this research was initiated. References [1] H. Abasi, N. H. Bshouty, A. Gabizon, and E. Haramaty. On r-Simple k-Path. In MFCS 2014 (Part II), pages 1–12, 2014. [2] N. Alon, O. Goldreich, J. Hastad, and R. Peralta. Simple construction of almost k-wise independent random variables. Random Struct. Algorithms, 3(3):289–304, 1992. [3] N. Alon, R. Yuster, and U. Zwick. Color coding. In Encyclopedia of Algorithms. 2008. [4] A. Bjorklund, T. Husfeldt, P. Kaski, and M. Koivisto. Narrow sieves for parameterized paths and packings. CoRR, abs/1007.1161, 2010. [5] N. H. Bshouty. Testers and their applications. In ITCS 2014, pages 327–352, 2014. [6] M. Cygan, F. V. Fomin, D. Lokshtanov, L. Kowalik, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh. Parameterized Algorithms. Springer, 2015. In press. [7] R. G. Downey and M. R. Fellows. Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, 2013. [8] H. Fernau, A. L´opez-Ortiz, and J. Romero. Kernelization algorithms for packing problems allowing overlaps. In TAMC 2015, pages 415–427, 2015. [9] J. Flum and M. Grohe. Parameterized Complexity Theory. Texts in Theoretical Computer Science. An EATCS Series. Springer-Verlag, Berlin, 2006. [10] F. V. Fomin, F. Grandoni, D. Lokshtanov, and S. Saurabh. Sharp separation and applications to exact and parameterized algorithms. Algorithmica, 63(3):692–706, 2012. [11] F. V. Fomin, D. Lokshtanov, F. Panolan, and S. Saurabh. Representative sets of product families. In ESA 2014, pages 443–454, 2014. [12] F. V. Fomin, D. Lokshtanov, and S. Saurabh. Efficient computation of representative sets with applications in parameterized and exact algorithms. In SODA 2014, pages 142–151, 2014. [13] M. X. Goemans. Minimum bounded degree spanning trees. In FOCS 2006, pages 273–282, 2006. [14] I. Koutis. Faster algebraic algorithms for path and packing problems. In ICALP 2008, pages 575–586, 2008. [15] N. Linial, M. Luby, M. E. Saks, and D. Zuckerman. Efficient construction of a small hitting set for combinatorial rectangles in high dimension. Combinatorica, 17(2):215–234, 1997. 15 [16] B. Monien. How to find long paths efficiently. In Analysis and design of algorithms for combinato- rial problems (Udine, 1982), volume 109 of North-Holland Math. Stud., pages 239–254. North-Holland, Amsterdam. [17] J. Naor and M. Naor. Small-bias probability spaces: Efficient constructions and applications. SIAM J. Comput., 22(4):838–856, 1993. [18] M. Naor, L. J. Schulman, and A. Srinivasan. Splitters and near-optimal derandomization. In FOCS 1995, pages 182–191, 1995. [19] R. Niedermeier. Invitation to fixed-parameter algorithms, volume 31 of Oxford Lecture Series in Mathe- matics and its Applications. Oxford University Press, Oxford, 2006. [20] R. Y. Pinter, H. Shachnai, and M. Zehavi. Deterministic parameterized algorithms for the graph motif problem. In MFCS 2014 (II), pages 589–600, 2014. [21] H. Shachnai and M. Zehavi. Representative families: A unified tradeoff-based approach. In ESA 2014, pages 786–797, 2014. [22] M. Singh and L. C. Lau. Approximating minimum bounded degree spanning trees to within one of optimal. J. ACM, 62(1):1:1–1:19, 2015. [23] W. T. Tutte. Graph Theory. Cambridge University Press, 2001. [24] R. Williams. Finding paths of length k in O∗(2k) time. Inf. Process. Lett., 109(6):315–318, 2009. [25] M. Zehavi. Deterministic parameterized algorithms for matching and packing problems. CoRR, abs/1311.0484, 2013. [26] M. Zehavi. Solving parameterized problems by mixing color coding-related techniques. CoRR, abs/1410.5062, 2014. 16
1312.0194
1
1312
2013-12-01T09:05:14
Some Combinatorial Problems on Binary Matrices in Programming Courses
[ "cs.DS", "math.CO" ]
The study proves the existence of an algorithm to receive all elements of a class of binary matrices without obtaining redundant elements, e. g. without obtaining binary matrices that do not belong to the class. This makes it possible to avoid checking whether each of the objects received possesses the necessary properties. This significantly improves the efficiency of the algorithm in terms of the criterion of time. Certain useful educational effects related to the analysis of such problems in programming classes are also pointed out.
cs.DS
cs
Some Combinatorial Problems on Binary Matrices in Programming Courses Krasimir Yankov Yordzhev South-West University "N. Rilsky", Blagoevgrad, Bulgaria e-mail: [email protected]; [email protected] Abstract The study proves the existence of an algorithm to receive all elements of a class of binary matrices without obtaining redundant elements, e. g. without obtaining binary matrices that do not belong to the class. This makes it possible to avoid checking whether each of the objects received possesses the necessary properties. This significantly improves the efficiency of the algorithm in terms of the criterion of time. Certain useful educational effects related to the analysis of such problems in programming classes are also pointed out. Key words: stimulation of students' interest, motivation to study, education in pro- gramming, binary matrix, S-permutation matrices, combinatorial algorithms 2010 Mathematics Subject Classification: 97P50, 68R05, 05B20 1 Introduction The stimulation of students' interest and motivation a certain discipline or branch of science is a matter of combining a variety of methods. The present study discusses two techniques which experience has shown to be quite efficient in programming classes: 1. Emphasizing the fact that the solution to a mathematical problem for all values of the parameters is yet to be discovered (for example problems 1 and 2 below), students can be given an assignment to write a program solving the problem in certain specific cases, e. g. not for all the possible values of the parameters. In section 2 two problems such as the ones described above will be formulated so that the students can write a program for relatively small values of the parameters n and k. 2. It is also possible to point out that a particular problem may be solved by applying an algorithm that is more efficient as compared with standard algorithms which excelling students do not normally find difficult to apply. Section 3 offers a specific example how to apply this technique. The present study is thus especially useful for students educated to become program- mers as well as for their instructors and lecturers. 1 The paper discusses certain combinatorial problems on binary matrices. For the classification of all non defined concepts and notations as well as for common assertion which have not been proved here, we recommend sources [1, 6, 7, 10, 14]. 2 Some mathematical problems whose solution for all values of the parameters has not been discovered and certain results related to these problems A binary (or boolean, or (0,1)-matrix ) is a matrix whose all elements belong to the set B = {0, 1}. With Bn we will denote the set of all n × n binary matrices. Using the notation from [15], we will call Λk n-matrices all n × n binary matrices in each row and each column of which there are exactly k in number 1's. Problem 1 Find out the number of all n × n binary matrices containing exactly k ele- ments equal to 1 in each row and each column, e.g. the number of all Λk n-matrices. n-matrices with λ(n, k). Let us denote the number of all Λk Problem 1 has not been solved for all values of the parameters. That is there is no known formula to calculate the λ(n, k) for all n and k. There are formulas for the calcu- lation of the function λ(n, k) for each n for relatively small values of k; more specifically, for k = 1, k = 2 and k = 3. We do not know formula to calculate the function λ(n, k) for k > 3 and for all positive integer n. It is easy to prove the following well-known formula: In [13] is offered the formula: λ(n, 1) = n! λ(n, 2) = X 2x2+3x3+···+nxn=n (n!)2 xr!(2r)xr n Y r=2 (1) (2) One of the first recursive formulas for the calculation of λ(n, 2) appeared in [2] (see also [5, p. 763]): λ(n, 2) = 1 2 n(n − 1)2 (cid:2)(2n − 3)λ(n − 2, 2) + (n − 2)2λ(n − 3, 2)(cid:3) ; n ≥ 4 λ(1, 2) = 0, λ(2, 2) = 1, λ(3, 2) = 6 Another recursive formula for the calculation of λ(n, 2) occurs in [4] : λ(n, 2) = (n − 1)nλ(n − 1, 2) + λ(1, 2) = 0, λ(2, 2) = 1 (n − 1)2n 2 λ(n − 2, 2) ; n ≥ 3 2 (3) (4) The following recursive system for the calculation of λ(n, 2) is put forward in [11]: λ(n + 1, 2) = n(2n − 1)λ(n, 2) + n2λ(n − 1, 2) − π(n + 1) ; n ≥ 2 π(n + 1) = = n2(n−1)2 λ(1, 2) = 0, π(1) = π(2) = π(3) = 0, λ(2, 2) = 1, π(4) = 9 [8(n − 2)(n − 3)λ(n − 2, 2) + (n − 2)2λ(n − 3, 2) − 4π(n − 1)] ; n ≥ 4 4 (5) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) where π(n) identifies the number of a special class of Λ2 n-matrices. The following formula in an explicit form for the calculation of λ(n, 3) is offered in [8]. λ(n, 3) = n!2 6n X (−1)β(β + 3γ)!2α3β α!β!γ!26γ (6) where the sum is done as regard all (n+2)(n+1) solutions in nonnegative integers of the equation α+β+γ = n. As it is noted in [7] formula (6) does not give us good opportunities to study behavior of λ(n, 3). 2 Let n be a positive integer and let A ∈ B n2 is a n2 × n2 binary matrix. With the help of n − 1 horizontal lines and n − 1 vertical lines A has been divided into n2 of number non-intersecting n × n square sub-matrices Akl, 1 ≤ k, l ≤ n, e. g. A =   A11 A12 A21 A22 ... ... An1 An2 · · · A1n · · · A2n ... ... · · · Ann   . (7) The sub-matrices Akl, 1 ≤ k, l ≤ n will be called blocks. Adding one more condition, we can make the problem 1 more complicated: Problem 2 Find out the number µ(n, k) of all n2 × n2 binary matrices that have k elements equal to 1 in each row, each column, and each n × n block. As demonstrated in [3], problem 2 has to do with the solution of a variety of combi- natorial problems associated with the Sudoku riddles. Problem 2 is solved in [3] for k = 1 and in [9] other methods are used to prove that No formula has been put forward for the calculation of the function µ(n, k) when µ(n, 1) = (n!)2n (8) k > 1. 3 S-permutation matrices A matrix A ∈ B n2 is called S-permutation if in each row, each column, and each block, of A there is exactly one 1. Let the set of all n2 × n2 S-permutation matrices be denoted by Σn2. 3 Two matrices A = (aij) ∈ Σn2 and B = (bij ) ∈ Σn2, 1 ≤ i, j ≤ n2 will be called disjoint, if there are not elements with one and the same indices aij and bij such that aij = bij = 1. The following obvious proposition is given in [3]: Proposition 1 [3] Square n2 × n2 matrix P with elements of Z n2 = {1, 2, . . . , n2} is Sudoku matrix if and only if there are matrices A1, A2, . . . , An2 ∈ Σn2 , each two of them are disjoint and such that P can be given in the following way: P = 1 · A1 + 2 · A2 + · · · + n2 · An2 ✷ Let us analyze the following programming task: Task 1 Write a program to obtain all S-permutation n2 × n2 matrices for a specific positive integer n. Experience shows that the majority of students do not fined it difficult to solve a task such as the one offered above. Unfortunately, the solutions they normally suggest are not very efficient. Below we present of the most common solutions given by students: It is easy to observe that if we remove the condition to have only one 1 for each block of the n2 × n2 binary matrices, the task above can be transformed into a task for the obtaining of all permutations of the integers from 1 to n2. This combinatorial task is often discussed in programming classes and a clear-cut solution can be found in a number of study books, such as [12]. Let π = hp1, p2, . . . , pmi be a permutation of the integers from 1 to m. Then we obtain the m × m binary matrix B = (bij) ∈ Bm, such that bij = 1 if and only if pi = j, 1 ≤ i, j ≤ m. It is clear that the matrix B obtained in this case has one 1 in each row and each column. This is where the name of such matrices comes from: permutation matrices. This gives us the following algorithm for the solution to task 1: Algorithm 1 Obtaining all S-permutation matrices. 1. Obtain all the permutations of integers from 1 to n2; 2. For each permutation π = hp1, p2, . . . , pn2 i obtained in step 1, obtain the binary n2 , such that αij = 1 if and only if pi = j. In all other cases matrix A = (αij ) ∈ B αij = 0, 1 ≤ i, j ≤ n2; 3. For each matrix obtained in step 2, check whether each block has only one 1. If (true) then the matrix is S-permutation, if (false) then we remove this matrix from the list. Unfortunately, algorithm 1 entails the obtaining of a variety of redundant matrices and a lot of time is wasted to check whether these meet the conditions (step 3). The total number of the permutation matrices obtained in algorithm 1 is n2!, while according to formula (8) the number of the S-permutation matrices is (n!)2n. But it is not difficult to see that n2! > (n!)2n when n ≥ 2. Importantly, the program implementation in step 3 of 4 algorithm 1 is also significantly aggravated and requires certain efforts and mathematical competence. When n = 2, we have 22! = 24, (2!)2·2 = 16; when n = 3, we have 32! = 362 880, (3!)2·3 = 46 656; when n = 4, we have 42! = 20 922 789 888 000, (4!)2·4 = 110 075 314 176, n2! (n!)2n increases etc. It is possible to prove that as n increases, the value of expression as well. This proves the inadequate efficiency of algorithm 1. The present study will demonstrate that there is an algorithm for the obtaining of all S-permutation matrices which bypasses the redundant, non S-permutation matrices. This reduces the iterations in the algorithm to the absolute minimum and each iteration bypasses the checking whether the matrix obtained is S-permutation. Such an algorithm is obviously more efficient and takes less time to apply than algorithm 1. It is based on theorem 1 proven below: Let denote with Πn the set of all (2n)×n matrices, which we shortly call Πn matrices, in which every row is a permutation of all elements of Zn = {1, 2, . . . , n}. It is obvious that Πn = (n!)2n (9) We will give a little bit more complicated definition of the term disjoint about Πn matrices. Let C = (cij) and D = (dij ) be two Πn matrices. We say that C and D are disjoint, if there are not natural numbers s, t ∈ {1, 2, . . . n} such that ordered pair hcst, cn+t si has to be equal to the ordered pair hdst, dn+t si. Theorem 1 There is a bijective map from Πn to Σn2 and the pair of disjoint matrices of Πn corresponds to the pair of disjoint matrices of Σn2 . Proof. Let P = (pij )2n×n ∈ Πn. We obtain the unique matrix of Σn2 from P with the help of the following algorithm: Algorithm 2 Obtaining just one matrix of Σn2 if there is given P = (pij)2n×n ∈ Πn. 1. for s = 1, 2, . . . , n do 2. for t = 1, 2, . . . , n do begin 3. k := pst; 4. l := pn+t s; 5. Obtain n × n matrix Ast = (aij)n×n such that akl = 1 и aij = 0 in all other occasions; end; 6. Obtain matrix A according to formula (7); 5 Let s ∈ Zn = {1, 2, . . . , n}. Since ordered n-tuple hps1, ps2, . . . , psni which is s-th row of the matrix P is a permutation, then in every row of n × n2 matrix Rs = (cid:2) As1 As2 · · · Asn (cid:3) there is only one 1. For every j = 1, 2, . . . , n Asj is binary n × n matrix in this case. Analogously for every t ∈ Zn because ordered n-tuple hpn+t 1, pn+t 2, . . . , pn+t ni which is (n + t)-th row of P is a permutation, then in every column of n2 × n matrix Ct =   A1t A2t ... Ant   there is only one 1, where Ait, i = 1, 2, . . . , n is a binary n × n matrix. Hence, the matrix A which is obtained with the help of algorithm 2 is Σn2 matrix. Since for every P ∈ Πn with the help of algorithm 2 is obtained unique element of Σn2, then this algorithm is a description of the map ϕ : Πn → Σn2. It is easy to see that if there are given different elements of Πn, with the help of algorithm 2 we can obtain different elements of Σn2. Hence, ϕ is an injection. But according to formulas (8) and (9) Σn2 = Πn, from where it follows that ϕ is a bijection. Analyzing algorithm 2 we take the conclusion that P and Q are disjoint matrices of Πn if and only if ϕ(P ) and ϕ(Q) are disjoint matrices of Σn2 according to the above given definitions. The theorem is proved. ✷ As an entailment of theorem 1, the following algorithm is received for the obtaining of all S-permutation matrices, which, based on the arguments above, can be claimed to be considerably more efficient than algorithm 1 for the same problem. Algorithm 3 Getting of all S-permutation matrices. 1. Obtain all the permutations of integers from 1 to n2; 2. With the help of all permutations obtained in step 1, obtain all Πn matrices; 3. From each Πn matrix obtained in step 2, obtain the next S-permutation matrix with the help of algorithm 2. References [1] M. Aigner Combinatorial theory. Springer-Verlag, 1979. [2] H. Anand, V. C. Dumir, H. Gupta A combinatorial distribution problem. Duke Math. J. 33 (1966), 757-769. [3] G. Dahl Permutation Matrices Related to Sudoku. Linear Algebra and its Appli- cations, 430 (2009), 2457-2463. 6 [4] I. Good, J. Grook The enumeration of arrays and generalization related to con- tingency tables. Discrete Math, 19 (1977), 23-45. [5] H. Gupta, G. L. Nath Enumeration of stochastic cubes. Notices of the Amer. Math. Soc. 19 (1972) A-568. [6] P. Lancaster Theory of Matrices. Academic Press, NY, 1969. [7] R. P. Stanley Enumerative combinatorics. V.1, Wadword & Brooks, California, 1986. [8] M. L. Stein, P. R. Stein Enumeration of stochastic matrices with integer ele- ments. Los Alamos Scientific Laboratory Report LA-4434, 1970. [9] K. Yordzhev On a Relationship Between the S-permutation Matrices and the Bipartite Graphs. (to appear). [10] В. И. Баранов, Б. С. Стечкин Экстремальные номбинаторные задачи и их приложения. Москва, Наука, 1989 [11] К. Я. Йорджев Комбинаторни задачи над бинарни матрици. Математика и математическо образование, 24 (1995), 288-296. [12] П. Наков, П. Добриков Програмиране=++Алгоритми. Трето издание, София 2005, ISBN 954-9805-06-X. [13] В. Е. Тараканов Комбинаторные задачи на бинарных матрицах. Комбинаторный анализ, Москва, изд-во МГУ, 1980, вып.5, 4-15. [14] В. Е. Тараканов Комбинаторные задачи и (0,1)-матрицы. Москва, Наука, 1985. [15] В. С. Шевелев Редуцированные латинские прямоугольники и квадратные матрицы с одинаковыми суммами в строках и столбцах. Дискретная мате- матика, том 4, вып. 1, 1992, 91-110. Associate Professor Dr. Krasimir Yankov Yordzhev South-West University "N. Rilsky" 2700 Blagoevgrad, Ivan Mihaylov Str. 66 Bulgaria e-mail: [email protected]; [email protected] Некоторые комбинаторные задачи с бинарными матрицами на курсах программирования Исследование доказывает существование алгоритма для получения всех элемен- тов класса бинарных матриц без получения избыточных элементов, т.е. без получе- ния бинарных матриц, которые не принадлежат к этому классу. Это дает возмож- ность избежать проверки, обладает ли каждый из полученных объектов требуемы- ми свойствами. Так во много раз улучшается эффективность алгоритма в связи с 7 критерием времени. Обращается внимание на выгоды из рассмотреных задач для обучения по программированию. Ключевые слова: стимулирование интерес студентов, мотивация к обуче- нию, подготовка в области программирования, бинарная матрица, S-матрица пе- рестановок, комбинаторный алгоритм Доц. д-р Красимир Я. Йорджев Юго-западный университет "Неофит Рилски" 2700 Благоевград, ул. "Иван Михайлов" № 66 Болгария e-mail: [email protected]; [email protected] 8
1601.05557
2
1601
2016-05-09T06:55:09
A New Approach for Testing Properties of Discrete Distributions
[ "cs.DS", "cs.IT", "cs.IT", "math.ST", "math.ST" ]
In this work, we give a novel general approach for distribution testing. We describe two techniques: our first technique gives sample-optimal testers, while our second technique gives matching sample lower bounds. As a consequence, we resolve the sample complexity of a wide variety of testing problems. Our upper bounds are obtained via a modular reduction-based approach. Our approach yields optimal testers for numerous problems by using a standard $\ell_2$-identity tester as a black-box. Using this recipe, we obtain simple estimators for a wide range of problems, encompassing most problems previously studied in the TCS literature, namely: (1) identity testing to a fixed distribution, (2) closeness testing between two unknown distributions (with equal/unequal sample sizes), (3) independence testing (in any number of dimensions), (4) closeness testing for collections of distributions, and (5) testing histograms. For all of these problems, our testers are sample-optimal, up to constant factors. With the exception of (1), ours are the {\em first sample-optimal testers for the corresponding problems.} Moreover, our estimators are significantly simpler to state and analyze compared to previous results. As an application of our reduction-based technique, we obtain the first {\em nearly instance-optimal} algorithm for testing equivalence between two {\em unknown} distributions. Moreover, our technique naturally generalizes to other metrics beyond the $\ell_1$-distance. Our lower bounds are obtained via a direct information-theoretic approach: Given a candidate hard instance, our proof proceeds by bounding the mutual information between appropriate random variables. While this is a classical method in information theory, prior to our work, it had not been used in distribution property testing.
cs.DS
cs
A New Approach for Testing Properties of Discrete Distributions Ilias Diakonikolas∗ Daniel M. Kane University of Southern California University of California, San Diego [email protected]. [email protected]. May 10, 2016 Abstract We study problems in distribution property testing: Given sample access to one or more unknown discrete distributions, we want to determine whether they have some global property or are ǫ-far from having the property in ℓ1 distance (equivalently, total variation distance, or "statistical distance"). In this work, we give a novel general approach for distribution testing. We describe two techniques: our first technique gives sample–optimal testers, while our sec- ond technique gives matching sample lower bounds. As a consequence, we resolve the sample complexity of a wide variety of testing problems. Our upper bounds are obtained via a modular reduction-based approach. Our approach yields optimal testers for numerous problems by using a standard ℓ2-identity tester as a black- box. Using this recipe, we obtain simple estimators for a wide range of problems, encompassing most problems previously studied in the TCS literature, namely: (1) identity testing to a fixed distribution, (2) closeness testing between two unknown distributions (with equal/unequal sam- ple sizes), (3) independence testing (in any number of dimensions), (4) closeness testing for collections of distributions, and (5) testing histograms. For all of these problems, our testers are sample-optimal, up to constant factors. With the exception of (1), ours are the first sample- optimal testers for the corresponding problems. Moreover, our estimators are significantly sim- pler to state and analyze compared to previous results. As an important application of our reduction-based technique, we obtain the first nearly instance-optimal algorithm for testing equivalence between two unknown distributions. The sample complexity of our algorithm depends on the structure of the unknown distributions – as opposed to merely their domain size – and is much better compared to the worst-case optimal ℓ1-tester in most natural instances. Moreover, our technique naturally generalizes to other metrics beyond the ℓ1-distance. As an illustration of its flexibility, we use it to obtain the first near-optimal equivalence tester under the Hellinger distance. Our lower bounds are obtained via a direct information-theoretic approach: Given a candi- date hard instance, our proof proceeds by bounding the mutual information between appropriate random variables. While this is a classical method in information theory, prior to our work, it had not been used in distribution property testing. Previous lower bounds relied either on the birthday paradox, or on moment-matching and were thus restricted to symmetric properties. Our lower bound approach does not suffer from any such restrictions and gives tight sample lower bounds for the aforementioned problems. ∗Part of this work was performed while the author was at the University of Edinburgh. Research supported by EPSRC grant EP/L021749/1, a Marie Curie Career Integration Grant, and a SICSA grant. 1 Introduction 1.1 Background The problem of determining whether an unknown object fits a model based on observed data is of fundamental scientific importance. We study the following formalization of this problem: Given samples from a collection of probability distributions, can we determine whether the distributions in question satisfy a certain property? This is the prototypical question in statistical hypothesis testing [NP33, LR05]. During the past two decades, this question has received considerable attention by the TCS community in the framework of property testing [RS96, GGR98], with a focus on discrete probability distributions. The area of distribution property testing [BFR+00, BFR+13] has developed into a mature re- search field with connections to information theory, learning and statistics. The generic inference problem in this field is the following: given sample access to one or more unknown distributions, determine whether they have some global property or are "far" (in statistical distance or, equiva- lently, ℓ1 norm) from having the property. The goal is to obtain statistically and computationally efficient testing algorithms, i.e., algorithms that use the information-theoretically minimum sample size and run in polynomial time. See [GR00, BFR+00, BFF+01, Bat01, BDKR02, BKR04, Pan08, Val11, DDS+13, ADJ+11, LRR11, ILR12, CDVV14, VV14, DKN15b, DKN15a, ADK15, CDGR16] for a sample of works and [Rub12, Can15] for two recent surveys. In this work, we give a new general approach for distribution testing. We describe two novel techniques: our first technique yields sample–optimal testers, while our second technique gives matching sample lower bounds. As a consequence, we resolve the sample complexity of a wide variety of testing problems. All our upper bounds are obtained via a collection of modular reductions. Our reduction-based method provides a simple recipe to obtain optimal testers under the ℓ1-norm (and other metrics), by applying a randomized transformation to a basic ℓ2-identity tester. While the ℓ2-norm has been used before as a tool in distribution testing [BFR+00], our reduction-based approach is conceptually and technically different than previous approaches. We elaborate on this point in Section 1.4. We use our reduction-based approach to resolve a number of open problems in the literature (see Section 1.3). In addition to pinning–down the sample complexity of a wide range of problems, a key contribution of our algorithmic approach is methodological. In particular, the main conceptual message is that one does not need an inherently different statistic for each testing problem. In contrast, all our testing algorithms follow the same pattern: They are obtained by applying a simple transformation to a basic statistic – one that tests the identity between two distributions in ℓ2-norm – in a black-box manner. Following this scheme, we obtain the first sample-optimal testers for many properties. Importantly, our testers are simple and, in most cases, their analysis fits in a paragraph. As our second main contribution, we provide a direct, elementary approach to prove sample complexity lower bounds for distribution testing problems. Given a candidate hard instance, our proof proceeds by bounding the mutual information between appropriate random variables. Our analysis leads to new, optimal lower bounds for several problems, including testing closeness (under various metrics), testing independence (in any dimension), and testing histograms. Notably, proving sample complexity lower bounds by bounding the mutual information is a classical approach in information theory. Perhaps surprisingly, prior to our work, this method had not been used in distribution testing. Previous techniques were either based on the birthday paradox or on moment- matching [RRSS09, Val11], and were thus restricted to testing symmetric properties. Our technique circumvents the moment-matching approach, and is not restricted to symmetric properties. 1 1.2 Notation We write [n] to denote the set {1, . . . , n}. We consider discrete distributions over i=1 pi = 1. We use the notation pi to denote the probability of element i in distribution p. [n], which are functions p : [n] → [0, 1] such thatPn A pseudo-distribution over a finite set S is any function p : S → [0, 1]. For a distribution p : [n] → [0, 1] and a set S ⊆ [n], we will denote by (pS) the conditional distribution on S and by p[S] the pseudo-distribution obtained by restricting p on the set S. The ℓ1 (resp. ℓ2) norm of a (pseudo-)distribution is identified with the ℓ1 (resp. ℓ2) norm of i . The ℓ1 (resp. ℓ2) distance between (pseudo-)distributions p and q is defined as the the ℓ1 (resp. ℓ2) norm of the vector of the corresponding vector, i.e., kpk1 =Pn their difference, i.e., kp − qk1 =Pn i=1 pi and kpk2 =qPn i=1 pi − qi and kp − qk2 =pPn i=1 p2 i=1(pi − qi)2. 1.3 Our Contributions The main contribution of this paper is a reduction–based framework to obtain testing algorithms, and a direct approach to prove lower bounds. We do not aim to exhaustively cover all possible applications of our techniques, but rather to give some selected results that are indicative of the generality and power of our methods. More specifically, we obtain the following results: 1. We give an alternative optimal ℓ1-identity tester against a fixed distribution, with sample com- plexity O(√n/ǫ2), matching the recently obtained tight bound [VV14, DKN15b]. The main advan- tage of our tester is its simplicity: Our reduction and its analysis are remarkably short and simple in this case. Our tester straightforwardly implies the "χ2 versus ℓ1" guarantee recently used as the main statistical test in [ADK15]. 2. We design an optimal tester for ℓ1-closeness between two unknown distributions in the standard and the (more general) unequal-sized sample regimes. For the standard regime (i.e., when we draw the same number of samples from each distribution), we recover the tight sample complexity of O(max(n2/3/ǫ4/3, n1/2/ǫ2)), matching [CDVV14]. Importantly, our tester straightforwardly extends to unequal-sized samples, giving the first optimal tester in this setting. Closeness testing with unequal sized samples was considered in [AJOS14] that gives sample upper and lower bounds with a polynomial gap between them. Our tester uses m1= Ω(max(n2/3/ǫ4/3, n1/2/ǫ2)) samples from one /ǫ2,√n/ǫ2)) from the other. This tradeoff is sample-optimal distribution and m2 = O(max(nm−1/2 (up to a constant factor) for all settings, and improves on the recent work [BV15] that obtains the same tradeoff under the additional assumption that ǫ > n−1/12. In sharp contrast to [BV15], our algorithm is extremely simple and its analysis fits in a few lines. 1 3. We study the problem of ℓ1-testing closeness between two unknown distributions in an instance- optimal setting, where the goal is to design estimators whose sample complexity depends on the (unknown) structure of the sampled distributions – as opposed to merely their domain size. We obtain the first algorithm for this problem: Our tester uses O(min m>0 (m + kq<1/mk0 · kq<1/mk2/ǫ2 + kqk2/3/ǫ2)) samples from each of the distributions p, q on [n]. Here, q<1/m denotes the pseudo-distribution obtained from q by removing the domain elements with mass ≥ 1/m, and kq<1/mk0 is the number of elements with mass < 1/m. (Observe that since kq<1/mk2 ≤ 1/√m, taking m = min(n, n2/3/ǫ4/3) attains the complexity of the standard ℓ1-closeness testing algorithm to within logarithmic factors.) An important distinction between our algorithm and the instance-optimal identity testing algorithm of [VV14] is that the sample complexity of the latter depends on the structure of the explicitly known 2 distribution, while ours depends on parameters of the unknown distributions. Roughly speaking, the [VV14] algorithm knows a priori when to stop drawing samples, while ours "discovers" the right sample complexity adaptively while obtaining samples. As an illustration of our technique, we give an alternative algorithm for the identity testing problem in [VV14] whose analysis fits in two short paragraphs. The sample complexity of our alternative algorithm is O(kqk2/3/ǫ2), where q is the explicit distribution, matching the bound of [VV14] up to logarithmic factors. 4. We show that our framework easily generalizes to give near-optimal algorithms and lower bounds for other metrics as well, beyond the ℓ1-norm. As an illustration of this fact, we describe an algorithm and a nearly-matching lower bound for testing closeness under Hellinger distance, H 2(p, q) = (1/2)k√p − √qk2 2, one of the most powerful f -divergences. This question has been studied before: [GMV09] gave a tester for this problem with sample complexity O(n2/3/ǫ4). The sample complexity of our algorithm is O(min(n2/3/ǫ4/3, n3/4/ǫ)), and we prove a lower bound of Ω(min(n2/3/ǫ4/3, n3/4/ǫ)). Note that the second term of n3/4/ǫ in the sample complexity differs from the corresponding ℓ1 term of n1/2/ǫ2. 5. We obtain the first sample-optimal algorithm and matching lower bound for testing indepen- dence over ×d i=1[ni]. Prior to our work, the sample complexity of this problem remained open, even for the two-dimensional case. We prove that the optimal sample complexity of indepen- dence testing (upper and lower bound) is Θ(maxj((Qd i=1 ni)1/3/ǫ4/3)). Previ- ous testers for independence were suboptimal up to polynomial factors in n and 1/ǫ, even for d = 2. Specifically, Batu et al. [BFF+01] gave an independence tester over [n] × [m] with sam- ple complexity eO(n2/3m1/3) · poly(1/ǫ), for n ≥ m. On the lower bound side, Levi, Ron, and Rubinfeld [LRR11] showed a sample complexity lower bound of Ω(√nm) (for all n ≥ m), and Ω(n2/3m1/3) (for n = Ω(m log m)). More recently, Acharya et al. [ADK15] gave an upper bound of O(((Qd i=1 ni)/ǫ2), which is optimal up to constant factors for the very special case that all the ni's are the same. In summary, we resolve the sample complexity of this problem in any dimension d, up to a constant factor, as a function of all relevant parameters. i=1 ni)1/2 +Pd (Qd i=1 ni)1/2/ǫ2, n1/3 j In fact, in the unknown-weights case, the problem is identical. 6. We obtain the first sample-optimal algorithms for testing equivalence for collections of distribu- tions [LRR11] in the sampling and the oracle model, improving on [LRR11] by polynomial factors. In the sampling model, we observe that the problem is equivalent to (a variant of) two-dimensional independence testing. In the known-weights case, the problem is equivalent to two-dimensional independence testing, where the algorithm is given explicit access to one of the marginals (say, the marginal on [m]). For this setting, we give a sample-optimal tester with sample size O(max(√nm/ǫ2, n2/3m1/3/ǫ4/3))1. In the query model, we give a sample-optimal closeness tester for m distributions over [n] with sample complexity O(max(√n/ǫ2, n2/3/ǫ4/3)). This bound is independent of m and matches the worst-case optimal bound for testing closeness between two unknown distributions. 7. As a final application of our techniques, we study the problem of testing whether a distribution belongs in a given "structured family" [ADK15, CDGR16]. We focus on the property of being a k-histogram over [n], i.e., that the probability mass function is piecewise constant with at most k known interval pieces. This is a natural problem of particular interest in model selection. For k = 1, the problem is tantamount to uniformity testing, while for k = Ω(n) it can be seen to be equivalent to testing closeness between two unknown distributions over a domain of size Ω(n). We 1It should be noted that, while this is the same form as the sample complexity for independence testing in two dimensions, there is a crucial difference. In this setting, the parameter m represents the support size of the marginal that is explicitly given to us, rather than the marginal with smaller support size. 3 design a tester for the property of being a k-histogram (with respect to a given set of intervals) with sample complexity O(max(√n/ǫ2, n1/3k1/3/ǫ4/3)) samples. We also prove that this bound is information-theoretically optimal, up to constant factors. 1.4 Prior Techniques and Overview of our Approach In this section, we provide a detailed intuitive explanation of our two techniques, in tandem with a comparison to previous approaches. We start with our upper bound approach. It is reasonable to expect that the ℓ2-norm is useful as a tool in distribution property testing. Indeed, for elements with "small" probability mass, estimating second moments is a natural choice in the sublinear regime. Alas, a direct ℓ2-tester will often not work for the following reason: The error coming from the "heavy" elements will force the estimator to draw too many samples. In their seminal paper, Batu et al. [BFR+00, BFR+13] gave an ℓ2-closeness tester and used it to obtain an ℓ1-closeness tester. To circumvent the aforementioned issue, their ℓ1-tester has two stages: It first explicitly learns the pseudo-distribution supported on the heavy elements, and then it applies the ℓ2-tester on the pseudo-distribution over the light elements. This approach of combining learning (for the heavy elements) and ℓ2-closeness testing (for the light elements) is later refined by Chan et al. [CDVV14], where it is shown that it inherently leads to a suboptimal sample complexity for the testing closeness problem. Motivated by this shortcoming, it was suggested in [CDVV14] that the use of the ℓ2-norm may be insufficient, and that a more direct approach may be needed to achieve sample-optimal ℓ1-testers. This suggestion led researchers to consider different approaches to ℓ1-testing (e.g., appropriately rescaled versions of the chi-squared test [ADJ+12, CDVV14, VV14, BV15, ADK15]) that, although shown optimal for a couple of cases, lead to somewhat ad-hoc estimators that come with a highly-nontrivial analysis. Our upper bound approach postulates that the inefficiency of [BFR+00, BFR+13] is due to the explicit learning of the heavy elements and not to the use of the ℓ2-norm. Our approach provides a simple and general way to essentially remove this learning step. We achieve this via a collection of simple reductions: Starting from a given instance of an ℓ1-testing problem A, we construct a new instance of an appropriate ℓ2-testing problem B, so that the answers to the two problems for these instances are identical. Here, problem A can be any of the testing problems discussed in Section 1.3, while problem B is always the same. Namely, we define B to be the problem of ℓ2-testing closeness between two unknown distributions, under the promise that at least one of the distributions in question has small ℓ2-norm. Our reductions have the property that a sample-optimal algorithm for problem B implies a sample-optimal algorithm for A. An important conceptual consequence of our direct reduction-based approach is that problem B is of central importance in distribution testing, since a wide range of problems can be reduced to it with optimal sample guarantees. We remark that sample-optimal algorithms for problem B are known in the literature: a natural estimator from [CDVV14], as well as a similar estimator from [BFR+00] achieve optimal bounds. The precise form of our reductions naturally depends on the problem A that we start from. While the details differ based on the problem, all our reductions rely on a common recipe: We randomly transform the initial distributions in question (i.e., the distributions we are given sample access to) to new distributions (over a potentially larger domain) such that at least one of the new distributions has appropriately small ℓ2-norm. Our transformation preserves the ℓ1-norm, and is such that we can easily simulate samples from the new distributions. More specifically, our transformation is obtained by drawing random samples from one of the distributions in question to discover its heavy bins. We then artificially subdivide each heavy bin into multiple bins, so that the resulting distribution becomes approximately flat. This procedure decreases the ℓ2-norm while increasing the domain size. By balancing these two quantities, we obtain sample-optimal testers for a wide variety of properties. 4 In summary, our upper bound approach provides reductions of numerous distribution testing problems to a specific ℓ2-testing problem B that yield sample-optimal algorithms. It is tempting to conjecture that optimal reductions in the opposite direction exist, which would allow translating lower bounds for problem B to tight lower bounds for other problems. We do not expect optimal reductions in the opposite direction, roughly because the hard instances for many of our problems are substantially different from the hard instances for problem B. This naturally brings us to our lower bound approach, explained below. Our lower bounds proceed by constructing explicit distributions D and D′ over (sets of) distribu- tions, so that a random distribution p drawn from D satisfies the property, a random distribution p from D′ is far from satisfying the property (with high probability), and it is hard to distin- guish between the two cases given a small number of samples. Our analysis is based on classical information-theoretic notions and is significantly different from previous approaches in this context. Instead of using techniques involving matching moments [RRSS09, Val11], we are able to directly prove that the mutual information between the set of samples drawn and the distribution that p was drawn from is small. Appropriately bounding the mutual information is perhaps a technical exercise, but remains quite manageable only requiring elementary approximation arguments. We believe that this technique is more flexible than the techniques of [RRSS09, Val11] (e.g., it is not restricted to symmetric properties), and may prove useful in future testing problems. Remark 1.1. We believe that our reduction-based approach is a simple and appealing framework to obtain tight upper bounds for distribution testing problems in a unifying manner. Since the dissemination of an earlier version of our paper, Oded Goldreich gave an excellent exposition of our approach in the corresponding chapter of his upcoming book [Gol16b]. 1.5 Organization The structure of this paper is as follows: In Section 2, we describe our reduction-based approach and exploit it to obtain our optimal testers for a variety of problems. In Section 3, we describe our lower bound approach and apply it to prove tight lower bounds for various problems. 2 Our Reduction and its Algorithmic Applications In Section 2.1, we describe our basic reduction from ℓ1 to ℓ2 testing. In Section 2.2, we apply our reduction to a variety of concrete distribution testing problems. 2.1 Reduction of ℓ1-testing to ℓ2-testing The starting point of our reduction-based approach is a "basic tester" for the identity between two unknown distributions with respect to the ℓ2- norm. We emphasize that a simple and natural tester turns out to be optimal in this setting. More specifically, we will use the following simple lemma (that follows, e.g., from Proposition 3.1 in [CDVV14]): Lemma 2.1. Let p and q be two unknown distributions on [n]. There exists an algorithm that on input n, ǫ > 0, and b ≥ max{kpk2,kqk2} draws O(bn/ǫ2) samples from each of p and q, and with probability at least 2/3 distinguishes between the cases that p = q and kp − qk1 > ǫ. Remark 2.2. We remark that Proposition 3.1 of [CDVV14] provides a somewhat stronger guar- antee than the one of Lemma 2.1. Specifically, it yields a robust ℓ2-closeness tester with the following performance guarantee: Given O(bn/ǫ2) samples from distributions p, q over [n], where b ≥ max{kpk2,kqk2}, the algorithm distinguishes (with probability at least 2/3) between the cases that kp − qk2 ≤ ǫ/(2√n) and kp − qk2 ≥ ǫ/√n. The soundness guarantee of Lemma 2.1 follows from the Cauchy-Schwarz inequality. 5 Observe that if kpk2 and kqk2 are both small, the algorithm of Lemma 2.1 is in fact sample- efficient. For example, if both are O(1/√n), its sample complexity is an optimal O(√n/ǫ2). On the other hand, the performance of this algorithm degrades as kpk2 or kqk2 increases. Fortunately, there are some convenient reductions that simplify matters. To begin with, we note that it suffices that only one of kpk2 and kqk2 is small. This is essentially because if there is a large difference between the two, this is easy to detect. Lemma 2.3. Let p and q be two unknown distributions on [n]. There exists an algorithm that on input n, ǫ > 0, and b ≥ min{kpk2,kqk2} draws O(bn/ǫ2) samples from each of p and q and, with probability at least 2/3, distinguishes between the cases that p = q and kp − qk1 > ǫ. Proof. The basic idea is to first test if kpk2 = Θ(kqk2), and if so to run the tester of Lemma 2.1. To test whether kpk2 = Θ(kqk2), we estimate kpk2 and kqk2 up to a multiplicative constant factor. It is known [GR00, BFF+01] that this can be done with O(√n) = O(min(kpk2,kqk2)n) samples. If kpk2 and kqk2 do not agree to within a constant factor, we can conclude that p 6= q. Otherwise, we use the tester from Lemma 2.1, and note that the number of required samples is O(kpk2n/ǫ2). In our applications of Lemma 2.3, we take the parameter b to be equal to our upper bound on min{kpk2,kqk2}. In all our algorithms in Section 2.2 this upper bound will be clear from the context. If both our initial distributions have large ℓ2-norm, we describe a new way to reduce them by splitting the large weight bins (domain elements) into pieces. The following key definition is the basis for our reduction: S that are equal to i. Thus,Pn Definition 2.4. Given a distribution p on [n] and a multiset S of elements of [n], define the split distribution pS on [n +S] as follows: For 1 ≤ i ≤ n, let ai denote 1 plus the number of elements of i=1 ai = n +S. We can therefore associate the elements of [n +S] to elements of the set B = {(i, j) : i ∈ [n], 1 ≤ j ≤ ai}. We now define a distribution pS with support B, by letting a random sample from pS be given by (i, j), where i is drawn randomly from p and j is drawn randomly from [ai]. We now show two basic facts about split distributions: Fact 2.5. Let p and q be probability distributions on [n], and S a given multiset of [n]. Then: (i) We can simulate a sample from pS or qS by taking a single sample from p or q, respectively. (ii) It holds kpS − qSk1 = kp − qk1. Fact 2.5 implies that it suffices to be able to test the closeness of pS and qS, for some S. In particular, we want to find an S so that kpSk2 and kqSk2 are small. The following lemma shows how to achieve this: Lemma 2.6. Let p be a distribution on [n]. Then: (i) For any multisets S ⊆ S′ of [n], kpS ′k2 ≤ kpSk2, and (ii) If S is obtained by taking Poi(m) samples from p, then E[kpSk2 Proof. Let ai equal one plus the number of copies of i in S, and a′ copies of i in S′. We note that pS = (i, j) with probability pi/ai. Therefore, for (i) we have that i equal one plus the number of 2] ≤ 1/m. (pi/ai)2 = p2 i /ai ≥ p2 i /a′ i = kpS ′k2 2. nXi=1 For claim (ii), we note that the expected squared ℓ2-norm of pS is Pn ]. We note that ai is distributed as 1 + X where X is a Poi(mpi) random variable. Recall that if Y is a random variable distributed as Poi(λ), then E[zY ] = eλ(z−1). Taking an integral we find that i=1 p2 i E[a−1 i kpSk2 2 = nXi=1 aiXj=1 nXi=1 6 E [1/(1 + X)] = E(cid:20)Z 1 Therefore, we have that E[kpSk2 proof. 0 zX dz(cid:21) =Z 1 2] ≤ Pn 0 E[zX ]dz =Z 1 i /(mpi) = (1/m)Pn 0 i=1 p2 eλ(z−1)dz = (1 − e−λ)/λ ≤ 1/λ. i=1 pi = 1/m. This completes the 2.2 Algorithmic Applications 2.2.1 Testing Identity to a Known Distribution We start by applying our framework to give a simple alternate optimal identity tester to a fixed distribution in the minimax sense. In this case, our algorithm is extremely easy, and provides a much simpler proof of the known optimal bound [VV14, DKN15b]: Proposition 2.7. There exists an algorithm that given an explicit distribution q supported on [n] and O(√n/ǫ2) independent samples from a distribution p over [n] distinguishes with probability at least 2/3 between the cases where p = q and kp − qk1 ≥ ǫ. Proof. Let S be the multiset where S contains ⌊nqi⌋ copies of i. Note that S ≤ Pn i=1 nqi = n. Note also that qS assigns probability mass at most 1/n to each bin. Therefore, we have that kqSk2 = O(1/√n). It now suffices to distinguish between the cases that pS = qS and the case that kpS − qSk1 ≥ ǫ. Using the basic tester from Lemma 2.3 for b = O(1/√n), we can do this using O(2nb/ǫ2) = O(√n/ǫ2) samples from pS. This can be simulated using O(√n/ǫ2) samples from p, which completes the proof. Remark 2.8. We observe that the identity tester of Proposition 2.7 satisfies a stronger guarantee: More specifically, it distinguishes between the cases that χ2(p, q) :=Pn i=1(pi−qi)2/qi ≤ ǫ2/10 versus kp− qk1 ≥ ǫ. Hence, it implies Theorem 1 of [ADK15]. This can be seen as follows: As explained in Remark 2.2, the basic tester of Lemma 2.1 from [CDVV14] is a robust tester with respect to the ℓ2- norm. Thus, the tester of Proposition 2.7 distinguishes between the cases that kpS−qSk2 ≤ ǫ/(2√n) and kpS − qSk2 ≥ ǫ/√n. The desired soundness follows from the fact kp − qk1 = kpS − qSk1 and the Cauchy-Schwarz inequality. The desired "chi-squared" completeness property follows from the easily verifiable (in)equalities χ2(p, q) = χ2(pS, qS) and χ2(pS, qS) ≥ n · kpS − qSk2 2. Remark 2.9. After the dissemination of an earlier version of this paper, inspired by our work, Goldreich [Gol16a] reduced testing identity to a fixed distribution to its special case of uniformity testing, via a refinement of the above idea. Unfortunately, this elegant idea does not seem to generalize to other problems considered here. 2.2.2 Testing Closeness between two Unknown Distributions We now turn to the prob- lem of testing closeness between two unknown distributions p, q. The difficulty of this case lies in the fact that, not knowing q, we cannot subdivide into bins in such a way as to guarantee that kqSk2 = O(1/√n). However, we can do nearly as well by first drawing an appropriate number of samples from q, and then using them to provide our subdivisions. Proposition 2.10. There exists an algorithm that given sample access to two distributions p and q over [n] distinguishes with probability 2/3 between the cases p = q and kp − qk1 > ǫ using O(max(n2/3/ǫ4/3,√n/ǫ2)) samples from each of p and q. Proof. The algorithm is as follows: 7 Algorithm Test-Closeness Input: Sample access to distributions p and q supported on [n] and ǫ > 0. Output: "YES" with probability at least 2/3 if p = q, "NO" with probability at least 2/3 if kp − qk1 ≥ ǫ. 1. Let k = min(n, n2/3ǫ−4/3). 2. Define a multiset S by taking Poi(k) samples from q. 3. Run the tester from Lemma 2.3 to distinguish between pS = qS and kpS − qSk1 ≥ ǫ. To show correctness, we first note that with high probability we have S = O(n). Furthermore, by Lemma 2.6 it follows that the expected squared ℓ2 norm of qS is at most 1/k. Therefore, with probability at least 9/10, we have that S = O(n) and kqSk2 = O(1/√k). The tester from Lemma 2.3 distinguishes between pS = qS and kpS−qSk1 ≥ ǫ with O(nk−1/2/ǫ2) samples. By Fact 2.5, this is equivalent to distinguishing between p = q and kp− qk1 ≥ ǫ. Thus, the total number of samples taken by the algorithm is O(k + nk−1/2/ǫ2) = O(max(n2/3ǫ−4/3,√n/ǫ2)). We consider a generalization of testing closeness where we have access to different size samples from the two distributions, and use our technique to provide the first sample-optimal algorithm for the entire range of parameters: Proposition 2.11. There exists an algorithm that given sample access to two distributions, p and q over [n] distinguishes with probability 2/3 between the cases p = q and kp − qk1 > ǫ given m1 /ǫ2,√n/ǫ2)) samples from each of p and q. samples from q and an additional m2 = O(max(nm−1/2 1 Proof. The algorithm is as follows: Algorithm Test-Closeness-Unequal Input: Sample access to distributions p and q supported on [n] and ǫ > 0. Output: "YES" with probability at least 2/3 if p = q, "NO" with probability at least 2/3 if kp − qk1 ≥ ǫ. 1. Let k = min(n, m1). 2. Define a multiset S by taking Poi(k) samples from q. 3. Run the tester from Lemma 2.3 to distinguish between pS = qS and kpS − qSk1 ≥ ǫ. To show correctness, we first note that with high probability we have S = O(n). Furthermore, by Lemma 2.6 it follows that the expected squared ℓ2-norm of qS is at most 1/k. Therefore, with probability at least 9/10, we have that S = O(n) and kqSk2 = O(1/√k). The tester from Lemma 2.3 distinguishes between pS = qS and kpS−qSk1 ≥ ǫ with O(nk−1/2/ǫ2) samples. By Fact 2.5, this is equivalent to distinguishing between p = q and kp−qk1 ≥ ǫ. In addition to the m1 samples from q, we had to take O(nk−1/2/ǫ2) = O(m2) samples from each of p and q. 8 2.2.3 Nearly Instance–Optimal Testing In this subsection, we provide near-optimal testers for identity and closeness in the instance-optimal setting. We start with the simpler case of testing identity to a fixed distribution. This serves as a warm-up for the more challenging case of two unknown distributions. Note that the identity tester of Proposition 2.7 is sample-optimal only for a worst-case choice of the explicit distribution q. (It turns out that the worst case corresponds to q being the uniform distribution over [n].) Intuitively, for most choices of q, one can actually do substantially better. This fact was first formalized and shown in [VV14]. In the following proposition, we give a very simple tester with a compact analysis whose sample complexity is essentially optimal as a function of q. The basic idea of our tester is the following: First, we partition the domain into categories based on the approximate mass of the elements of q, and then we run an ℓ2-tester independently on each category. Proposition 2.12. There exists an algorithm that on input an explicit distribution q over [n], a parameter ǫ > 0, and O(kqk2/3/ǫ2) samples from a distribution p over [n] distinguishes with probability at least 2/3 between the cases where p = q and kp − qk1 ≥ ǫ. Proof. For j = 0, . . . , k with k = ⌈2 log2(10n/ǫ)⌉, let Sj ⊆ [n] be the set of coordinates i ∈ [n] so that qi ∈ (2−j−1, 2−j]. Let S∞ be the set of coordinates i ∈ [n] so that qi < 2−k−1 ≤ ǫ/(10n). We note that if kp − qk1 > ǫ, then kp[Sj] − q[Sj]k1 ≫ ǫ/ log(n/ǫ) for some j. We claim that it suffices to design a tester that distinguishes between the cases that p[Sj] = q[Sj] and kp[Sj] − q[Sj]k1 ≫ ǫ/ log(n/ǫ) with probability at least 2/3. Repeating such a tester O(log log(n/ǫ)) times amplifies its probability of success to 1 − 1/ log2(n/ǫ). By a union bound over j, all such testers are correct with probability at least 2/3. To show completeness, note that if p = q, then p[Sj] = q[Sj] for all j, and therefore all testers output "YES". For soundness, if kp − q 1 ≥ ǫ, there exists a j such that kp[Sj] − q[Sj]k1 ≫ ǫ/ log(n/ǫ), and therefore the corresponding tester returns "NO". To test whether kp[Sj] − q[Sj]k1 ≫ ǫ/ log(n/ǫ) versus p[Sj] = q[Sj], we proceed as follows: We first use O(log2(n/ǫ)/ǫ2) samples to approximate kp[Sj]k1 to within additive error ǫ/(10 log(n/ǫ)). If kq[Sj]k1 is not within the range of possible values, we determine that p[Sj] 6= q[Sj]. Otherwise, we consider the conditional distributions (pSj), (qSj) and describe a tester to distinguish between the cases that (pSj) = (qSj) and k(pSj)− (qSj)k1 ≫ ǫ/(log(n/ǫ)kq[Sj]k1). Note that we can assume that kq[Sj]k1 ≫ ǫ/ log(n/ǫ), otherwise there is nothing to prove. We note that this necessarily fails to happen if j = ∞. Let mj = Sj. We have that kq[Sj]k1 = Θ(mj2−j) and k(qSj)k2 = Θ(m−1/2 ). Therefore, using the tester from Lemma 2.3, we can distinguish between (pSj) = (qSj) and k(pSj) − (qSj)k1 ≫ ǫ′ := ǫ/(log(n/ǫ)kq[Sj]k1) using O(k(qSj)k2 · mj/ǫ′2) = O(m5/2 j 4−j log2(n/ǫ)/ǫ2). samples from (pSj). The probability that a sample from p lies in Sj is kp[Sj]k1 ≫ kq[Sj]k1 ≫ mj2−j. Using rejection sampling, we can get a sample from (pSj) using O(2j/mj) samples from p. Therefore, the number of samples from p needed to make the above determination is O(m3/2 j 2−j log2(n/ǫ)/ǫ2). In summary, we have described a tester that distinguishes between p = q and kp− qk1 > ǫ with j sample complexity polylog(n/ǫ) · O((1 + maxj(m3/2 j 2−j))/ǫ2). We note that kqk2/3 ≥ max j Pi∈Sj i !3/2 q2/3 ≥ max j (mj2−2j/3)3/2 = max j (m3/2 j 2−j). Therefore, the overall sample complexity is O(kqk2/3polylog(n/ǫ)/ǫ2) as desired. 9 We now show how to use our reduction-based approach to obtain the first nearly instance- optimal algorithm for testing closeness between two unknown distributions. Note that the algorithm of Proposition 2.12 crucially exploits the a priori knowledge of the explicit distribution. In the setting where both distributions are unknown, this is no longer possible. At a high-level, our adaptive closeness testing algorithm is similar to that of Proposition 2.12: We start by partitioning [n] into categories based on the approximate mass of one of the two unknown distributions, say q, and then we run an ℓ2-tester independently on each category. A fundamental difficulty in our setting is that q is unknown. Hence, to achieve this, we will need to take samples from q and create categories based on the number of samples coming from each bin. To state our result, we need the following notation: Definition 2.13. Let q be a discrete distribution and x > 0. We denote by q<x the pseudo- distribution obtained from q by setting the probabilities of all domain elements with probability at least x to 0. The main result of this subsection is the following: Proposition 2.14. Given sample access to two unknown distributions, p, q over [n] and ǫ > 0, there exists a computationally efficient algorithm that draws an expected O(min m>0 (m + kq<1/mk0kq<1/mk2/ǫ2 + kqk2/3/ǫ2)) samples from each of p and q, and distinguishes with probability 2/3 between p = q and kp−qk1 ≥ ǫ. Before we proceed with the proof of Proposition 2.14 some comments are in order. First, note that since kq<1/mk2 ≤ 1/√m, taking m = min(n, n2/3/ǫ4/3) attains the complexity of the standard ℓ1-closeness testing algorithm to within logarithmic factors. (It should be noted that the logarithmic factors in the above proposition can be removed by combining the required ℓ2-testers into a single tester, using as a test statistic a linear combination of the individual test statistics.) We now illustrate with a number of examples that the algorithm of Proposition 2.14 performs substantially better than the worst-case optimal ℓ1-closeness tester in a number of interesting cases. First, consider the case that the distribution q is essentially supported on relatively heavy bins. It is easy to see that the sample complexity of our algorithm will then be roughly proportional to kqk2/3/ǫ2. We remark that this bound is essentially optimal, even for the easier setting that q had been given to us explicitly. As a second example, consider the case that q is roughly uniform. In this case, we have that kqk2 will be small, and our algorithm will have sample complexity O(√n/ǫ2). Finally, consider the case that the bins of the distribution q can be partitioned into two classes: they have mass either approximately 1/n or approximately x > 1/n. For this case, our above algorithm will need O(min(x−1 + √n/ǫ2, nx−1/2/ǫ2)) samples. (This follows by taking m = 2/x in the first case, and m = 1 in the second case.) We remark that this sample bound can be shown to be optimal for such distributions (up to the logarithmic factor in the O). Also note that the aforementioned sample upper bound is strictly better than the worst-case bound of n2/3/ǫ4/3, unless x equals n−2/3ǫ4/3. We are now ready to give the proof of Proposition 2.14. Proof. We begin by describing and analyzing a testing algorithm that attains the stated sample complexity for a given value of m. We then show how to adapt this algorithm to complete the proof. 10 For the case of fixed m, our algorithm is given in the following pseudo-code: Algorithm Test-Closeness-Adaptive Input: Sample access to distributions p and q supported on [n] and m, ǫ > 0. Output: "YES" with probability at least 2/3 if p = q, "NO" with probability at least 2/3 if kp − qk1 ≥ ǫ. 1. Let C be a sufficiently large constant. Draw Cm log2(n) independent samples from q. 2. Divide [n] into B def = O(log(m log(n))) categories in the following way: A bin is in category S−∞ if at most log(n) of the samples from the previous step landed in the bin. Otherwise, if a samples landed in the bin, place it in category S⌊log2(a)⌋. 3. Let pS and qS be the distributions over categories for p and q. Use the standard ℓ1-tester to test whether pS = qS versus kpS − qSk1 ≥ ǫ/C with error probability at most 1/10. If they are unequal, return "NO". 4. Approximate the probability mass q(S−∞) up to additive accuracy ǫ/C. If it is less than 2ǫ/C, ignore this category in the following. 5. For each category Sa that is non-empty (and not S−∞ thrown out by the last step): (a) Approximate q(Sa) to within a factor of 2 with error probability at most 1/(100B). (b) Verify that p(Sa) is within a factor of 2 of this approximation. Otherwise, return "NO". (c) Approximate k(qSa)k2 to within a factor of 2 with error probability 1/(100B). (d) Draw samples from p and q until they each have at least CSak(qSa)k2B3/ǫ2 many samples from Sa. (e) Use these samples along with the ℓ2-tester of Lemma 2.3 to distinguish between the cases (pSa) = (qSa) and k(pSa) − (qSa)k1 ≥ ǫ/(CBq(Sa)) with error probability at most 1/(100B). 6. In the latter case, return "NO". Otherwise, return "YES". To analyze the above algorithm, we note that it suffices to assume that all of the intermediate tests for which the hypotheses are satisfied, return the correct results. We also note that it suffices to consider the case that m ≤ n/ǫ2 (as otherwise the empirical distribution is already an O(m)-sample algorithm). We start by noting that with high probability over the samples taken in Step 1, for any bin i with q(i) = x the number of samples drawn from this bin is at most xCm log3(n), and if x > 1/m the number of samples is at least xCm log(n). Furthermore, if x < 1/(Cm), i lies in category S−∞ with high probability. We assume throughout the rest of this analysis that this event holds for all bins. We now prove correctness. Assuming that all intermediate tests are correct, it is easy to see that if the algorithm returns "NO", then p and q must be unequal. We need to argue the converse. If our algorithm returns "YES", it must be the case that 11 • kpS − qSk1 < ǫ/C. • For each a with Sa non-empty, except for possibly S−∞, we have that k(pSa) − (qSa)k1 < ǫ/(CBq(Sa)). We claim that if this holds, then kp − qk1 < ǫ. This is because, after modifying p by at most ǫ/C, we may keep the restrictions to each category the same and make it so that pS = qS. Once this is true, it will be the case that kp − qk1 =Xa q(Sa)k(pSa) − (qSa)k1 < ǫ/C. This completes the proof of correctness. It remains to analyze the sample complexity. Step 1 clearly takes at most an appropriate number of samples. Step 3 requires at most O(B/ǫ2) samples, which is sufficient for our purposes. For Step 5, we may analyze the number of samples required for each category, Sa separately. Note that approximating k(qSa)k2 to within a factor of 2 requires at most O(kq[Sa]k−1 log(B)) samples. If a ≥ 0 and Sa in non-empty, it will consist of at least one bin of mass at least (1/(Cm)), so the sample complexity will be sufficiently small. For a = −∞, kq[Sa]k−1 2 ≤ kq[Sa]k0kq[Sa]k2, and this is within our desired sample complexity bound. We note that CSak(qSa)k2B3/ǫ2 samples are indeed enough to run our ℓ2-tester. We can 2 obtain this many samples by taking at most polylog(n/ǫ)Sak(qSa)k2/q(Sa)/ǫ2 = polylog(n/ǫ)Sakq[Sa]k2/ǫ2 samples from each of p and q. Now, if a > 0, all bins in Sa have mass xpolylog(n) for some appropriate value of x. We will then have that Sakq[Sa]k2 = xSa3/2polylog(n) ≤ kq[Sa]k2/3polylog(n) ≤ kqk2/3polylog(n), which is sufficient. Finally, for a = −∞, the number of samples required is polylog(n/ǫ)Sakq[Sa]k2/ǫ2 ≤ polylog(n/ǫ) · kq<1/mk0 · kq<1/mk2/ǫ2. This completes the proof fo the case of a fixed value of m. In order to obtain the minimum over all m we proceed as follows: First, since the product kq<1/mk0 · kq<1/mk2 is decreasing in m, the minimum is attained (up to a constant factor) by taking m to be the smallest power of 2 so that m > kqk2/3/ǫ2 + kq<1/mk0kq<1/mk2/ǫ2. Therefore, it suffices to iterate the above procedure taking m to be increasingly large powers of 2 until the algorithm terminates with O(mpolylog(n/ǫ)) samples. This completes the proof. 2.2.4 Testing Closeness in Hellinger Distance In this subsection, we use our reduction- based approach to obtain a nearly sample-optimal algorithm for testing closeness of two unknown distributions with respect to the Hellinger distance. We prove: Proposition 2.15. There exists an algorithm that given sample access to two distributions p and q supported on [n] draws O(min(n2/3/ǫ4/3, n3/4/ǫ)) samples from each and distinguishes between the cases p = q and H 2(p, q) ≥ ǫ with probability at least 2/3. 12 Proof. First, note that an O(n2/3/ǫ4/3) upper bound follows immediately from the upper bound on ℓ1-testing and the fact that kp − qk1 ≥ H 2(p, q). To prove the O(n3/4/ǫ) lower bound, we use ideas similar to those in our adaptive closeness tester from the previous subsection. In particular, let m = n3/4/ǫ. We take O(m) samples from q to divide [n] into O(log(m)) categories so with high probability we have: (i) in all but one category, each bin in the category has the same mass under q up to polylog(m) factors, and (ii) all bins in the remaining category have mass at most 1/m. We can then verify using O(n3/4/ǫ) samples that either pS 6= qS or that kpS − qSk1 < ǫ/100. In the former case, we output "NO", while in the latter case it suffices to distinguish for each category between the cases that p = q on that category, and that the contribution of that category to H 2(p, q) is at least ǫ/(C log(m)), for C some sufficiently large constant. Suppose that we have a category S so that for each bin in S the mass of this bin under q is within a polylog factor of x. Then, H 2(p[S], q[S]) < polylog(m)kp[S] − q[S]k2 2/x. Therefore, it suffices to distinguish between the cases p[S] = q[S] and kp[S] − q[S]k2 2 ≥ xǫ/polylog(m). This can be done as follows: We define the distribution p′ by taking a sample from p, leaving it where it is if the sample lies in S, and randomly and uniformly placing it in one of N new bins (for some very large N ) otherwise. Defining q′ similarly, we note that kp′ − q′k2 = kp[S] − q[S]k2 + O(1/√N ). Therefore, we can distinguish between p = q and kp[S] − q[S]k2 > δ using O(kq[S]k2/δ2) samples with our standard ℓ2-tester. In summary, the number of samples required to perform this test is polylog(m)kq[S]k2/(xǫ) ≤ O(n1/2x/(xǫ)) = O(n1/2/ǫ). Finally, we need to consider the case of the last category. Here, we use that kp[S] − q[S]k1 ≥ H 2(p[S], q[S]), and therefore it suffices to distinguish between p[S] = q[S] and kp[S] − q[S]k1 > ǫ. Equivalently, it suffices to distinguish between (pS) = (qS) and k(pS) − (qS)k1 > ǫ/q(S). This can be achieved using O(max(n2/3q(S)4/3/ǫ4/3, n1/2q(S)2/ǫ2)) samples from the conditional distributions. This is at most O(max(n2/3q(S)1/3/ǫ4/3, n1/2q(S)/ǫ2)) samples from the original distribution. Since q(S) < n/m = n1/4ǫ, this quantity is at most which completes the proof. O(n3/4/ǫ) , Independence Testing In this subsection we study the problem of testing independence 2.2.5 of a d-dimensional discrete distribution p. More specifically, we want to design a tester that distin- guishes between the case that p is a product distribution versus ǫ-far from any product distribution, in ℓ1-norm. We start by giving an optimal independence tester for the two-dimensional case, and then handle the case of arbitrary dimension. Our algorithm for testing independence in two dimensions is as follows: 13 Algorithm Test-Independence-2D Input: Sample access to a distribution p on [n] × [m] with n ≥ m and ǫ > 0. Output:"YES" with probability at least 2/3 if the coordinates of p are independent, "NO" with probability at least 2/3 if p is ǫ-far from any product distribution on [n] × [m]. 1. Let k = min(n, n2/3m1/3ǫ−4/3). 2. Let S1 be a multiset in [n] obtained by taking Poi(k) samples from p1 = π1(p). Let S2 be a multiset in [m] obtained by taking Poi(m) samples from p2 = π2(p). Let S be the multiset of elements of [n] × [m] so that 1 + {Number of copies of (a, b) in S} = (1 + {Number of copies of a in S1})(1 + {Number of copies of b in S2}). 3. Let q be the distribution on [n]× [m] obtained by taking (x1, y1), (x2, y2) independent samples from p and returning (x1, y2). Run the tester from Lemma 2.3 to distinguish between the cases pS = qS and kpS − qSk1 ≥ ǫ. For correctness, we note that by Lemma 2.6, with probability at least 9/10 over our samples from S1 and S2, all of the above hold: (i) S1 = O(n) and S2 = O(m), and (ii) k(p1)S1k2 2 = O(1/k), k(p2)S2k2 2 = O(1/m). We henceforth condition on this event. We note that the distribution q is exactly p1 × p2. Therefore, if the coordinates of p are independent, then p = q. On the other hand, since q has independent coordinates, if p is ǫ-far from any product distribution, kp− qk1 ≥ ǫ. Therefore, it suffices to distinguish between p = q and kp − qk1 ≥ ǫ. By Fact 2.5, this is equivalent to distinguishing between pS = qS and kpS − qSk1 ≥ ǫ. This completes correctness. We now analyze the sample complexity. We first draw samples when picking S1 and S2. With high probability, the corresponding number of samples is O(m+k) = O(max(n2/3m1/3ǫ−4/3,√nm/ǫ2)). Next, we note that qS = (p1)S1 × (p2)S2. Therefore, by Lemma 2.3, the number of samples drawn in the last step of the algorithm is at most O(nmkqSk2/ǫ2) = O(nmk(p1)S1 × (p2)S2k2/ǫ2) = O(nmk(p1)S1k2k(p2)S2k2/ǫ2) = O(nmk−1/2m−1/2/ǫ2) = O(max(n2/3m1/3ǫ−4/3,√nm/ǫ2)). Drawing a sample from q requires taking only two samples from p, which completes the analysis. In the following proposition, we generalize the two-dimensional algorithm to optimally test independence in any number of dimensions. Proposition 2.16. Let p be a distribution on ×d i=1[ni]. There is an algorithm that draws Omax j  dYi=1 ni!1/2 /ǫ2, n1/3 j dYi=1 ni!1/3 /ǫ4/3 samples form p and with probability at least 2/3 distinguishes between the coordinates of p being independent and p being ǫ-far from any such distribution. Roughly speaking, our independence tester in general dimension uses recursion to reduce to the 2-dimensional case, in which case we may apply Test-Independence-2D. For the details, see the full version. 14 j (Qd Proof. We can assume that all ni ≥ 2, for otherwise removing that term does not affect the problem. We first note that the obvious generalization of Test-Independence-2D (that is, draw min(ni, maxj n1/3 i=1 ni)1/3/ǫ4/3) samples from the i-th marginal and use them to subdivide the domain in that dimension; then run the basic ℓ2-closeness tester between pS and the product of the marginals) allows us for any constant d to distinguish between p having independent coordinates and kp − p∗k1 > ǫ, where p∗ is the product of the marginals of p, with arbitrarily small constant probability of failure. This generalization incurs an additional 2O(d) factor in the sample complexity, hence is not optimal for super-constant d. To obtain the optimal sample complexity, we will use the aforementioned algorithm for d = 2, 3 along with a careful recursion to reduce the dimension. Our sample-optimal independence tester in d dimensions is as follows: First, let us assume for simplicity that the maximum in the sample complexity is attained by the second term with j = 1. Then, we use the algorithm Test-Independence-2D to distinguish between the cases that the first coordinate is independent of the others from the case that p is at least ǫ/2-far from the product of the distributions on the first coordinate and the distribution on the remaining coordinates. If it is not, we return "NO". Otherwise, we recursively test whether or not the coordinates (p2, . . . , pd) are independent versus at least ǫ/2-far from the product of their marginals, and return the result. We note that if (p2, . . . , pd) is ǫ/2-close to the product distribution on p2, . . . , pd, and if p is ǫ/2-close to the product distribution on its first coordinate with the remaining coordinates, then p is ǫ-close to the product of its marginals. We next deal with the remaining case. We let N =Qd i=1 ni. We first partition [N ] into sets Si nj ≤ √N . We do this by greedily adding elements to a single set S1 for 1 ≤ i ≤ 3 so that Qj∈Si until the product is more than √N . We then remove the most recently added element, place it in S2, and place all remaining elements in S3. This clearly satisfies the desired property. We let pSi be the distribution of p ignoring all but the coordinates in Si. We use the obvious independence tester in three dimensions to distinguish whether the pSi are independent versus p differing from the product by at least ǫ/4. In the latter case, we return "NO". In the former, we recursively distinguish between pSi having independent coordinates versus being ǫ/4-far from the product of its marginals for each i and return "NO" unless all three pass. i=1 ni)1/2/ǫ2, n1/3 In order to analyze the sample complexity, we note that our d-dimensional independence tester i=1 ni)1/3/ǫ4/3)) samples on the highest level call to the 2 or 3- dimensional version of the tester. It then needs to make O(1) recursive calls to the high-dimensional i=1 ni)1/2 and error at i=1 ni)1/3/ǫ2) samples, which is well uses O(max((Qd version of the algorithm on distributions with support of size at most (Qd most ǫ/4. These recursive calls take a total of at most O((Qd within our desired bounds. j (Qd 2.2.6 Testing Properties of Collections of Distributions In this subsection, we consider the model of testing properties of collections of distributions [LRR11] in both the sampling and query models. We begin by considering the sampling model, as this is closely related to independence testing. In fact, in the unknown-weights case, the problem is identical. In the known-weights case, the problem is equivalent to independence testing, where the algorithm is given explicit access to one of the marginals (say, the distribution on [m]). For this setting, we give a tester with sample complexity O(max(√nm/ǫ2, n2/3m1/3/ǫ4/3)). We also note that this bound can be shown the be optimal. Formally, we prove the following: Proposition 2.17. There is an algorithm that given sample access to a distribution p on [n] × [m] and an explicit description of the marginal of p on [m] distinguishes between the cases that the coordinates of p are independent and the case where p is ǫ-far from any product distribution on 15 [n] × [m] with probability at least 2/3 using O(max(√nm/ǫ2, n2/3m1/3/ǫ4/3)) samples. Proof. The algorithm is as follows: Algorithm Test-Collection-Sample-Model Input: Sample access to a distribution p on [n]× [m] with ǫ > 0, and an explicit description of the marginal of p on [m]. Output:"YES" with probability at least 2/3 if the coordinates of p are independent, "NO" with probability at least 2/3 if p is ǫ-far from any product distribution on [n] × [m]. 1. Let k = min(n, n2/3m1/3ǫ−4/3). 2. Let S1 be a multiset in [n] obtained by taking Poi(k) samples from p1 = π1(p). Let S2 be a multiset in [m] obtained by taking ⌊m(p2)i⌋ copies of i. Let S be the multiset of elements of [n] × [m] so that 1 + {Number of copies of (a, b) in S} = (1 + {Number of copies of a in S1})(1 + {Number of copies of b in S2}). 3. Let q be the distribution on [n]× [m] obtained by taking (x1, y1), (x2, y2) independent samples from p and returning (x1, y2). Run the tester from Lemma 2.3 to distinguish between the cases pS = qS and kpS − qSk1 ≥ ǫ. For the analysis, we note that k(p2)S2k2 = O(1/√m) and with probability at least 9/10, it holds k(p1)S1k2 = O(1/√k). Therefore, we have that k(p1 × p2)Sk2 = O(1/√km). Thus, the ℓ2-tester of Lemma 2.3 draws O(nm1/2k−1/2/ǫ2) = O(max(√nm/ǫ2, n2/3m1/3/ǫ4/3)) samples and the sample complexity is bounded as desired. Next, we consider the query model. In this model, we are essentially guaranteed that the distri- bution on [m] is uniform, but are allowed to extract samples conditioned on a particular value of the second coordinate. Equivalently, there are m distributions q1, . . . , qm on [n].. We wish to distinguish between the cases that the qi's are identical and the case where there is no distribution q so that 1 i=1 kq− qik1 ≤ ǫ. We show that we can solve this problem with O(max(√n/ǫ2, n2/3/ǫ4/3)) sam- ples for any m. This is optimal for all m ≥ 2, even if we are guaranteed that q1 = q2 = . . . = q⌊m/2⌋ and q⌊m/2+1⌋ = . . . = qm. mPm Proposition 2.18. There is an algorithm that given sample access to distributions q1, . . . , qm on [n] distinguishes between the cases that the qi's are identical and the case where there is no distribution q so that 1 i=1 kq−qik1 ≤ ǫ with probability at least 2/3 using O(max(√n/ǫ2, n2/3/ǫ4/3)) samples. mPm Proof. The algorithm is as follows: 16 Algorithm Test-Collection-Query-Model Input: Sample access to a distribution q1, . . . , qm on [n] with ǫ > 0. Output:"YES" with probability at least 2/3 if the qi are identical, "NO" with probability at least 2/3 if there is no distribution q so that 1 mPm i=1 kq − qik1 ≤ ǫ. 1. Let C be a sufficiently large constant. 2. Let q∗ denote the distribution obtained by sampling from a uniformly random qi. 3. For k from 0 to ⌈log2(m)⌉: (a) Select 25k/4C uniformly random elements i ∈ [m]. (b) For each selected i, use the ℓ1-closeness tester to distinguish between q∗ = qi and kq∗ − qik1 > 2k−1ǫ with failure probability at most C −26−k. (c) If any of these testers returned "NO", return "NO". 4. Return "YES". To analyze this algorithm, we note that with probability 9/10 all the testers we call whose hypotheses are satisfied output correctly. Therefore, if all qi are equal, they are equal to q∗, and thus our algorithm returns "YES" with appropriately large probability. On the other hand, if for any q we have that 1 i=1 kq − qik1 > ǫ, then in particular 1 i=1 kq∗ − qik1 > ǫ. Note that 1 m mPm kq∗ − qik1 ≤ ǫ/2 + O Xk mXi=1 mPm mPm m {i : kq∗ − qik ≥ 2k−1ǫ}2kǫ ! . Therefore, since 1 i=1 kq∗ − qik1 > ǫ, we have that for some k it holds {i : kq∗ − qik ≥ 2k−1ǫ} = Ω(m2−5k/4). For this value of k, there is at least a 9/10 probability that some i with this property was selected as one of our C25k/4 that were used, and then assuming that the appropriate tester returned correctly, our algorithm will output "NO". This establishes correctness. The total sample O(max(√n/ǫ2, n2/3/ǫ4/3)). complexity of this algorithm is easily seen to be Pk 25k/4k · O(√n/ǫ24−k + n2/3/ǫ4/32−4k/3) = 2.2.7 Testing k-Histograms Finally, sample-optimal algorithm for the property of being a k-histogram with known intervals. in this subsection we use our framework to design a Let I be a partition of [n] into k intervals. We wish to be able to distinguish between the cases where a distribution p has constant density on each interval versus the case where it is ǫ-far from any such distribution. We show the following: Proposition 2.19. Let I be a partition of [n] into k intervals. Let p be a distribution on [n]. There exists an algorithm which draws O(max(√n/ǫ2, n1/3k1/3/ǫ4/3)) independent samples from p and distinguishes between the cases where p is uniform on each of the intervals in I from the case where p is ǫ-far from any such distribution with probability at least 2/3. Proof. First, we wish to guarantee that each of the intervals has reasonably large support. We can achieve this as follows: For each interval I ∈ I we divide each bin within I into ⌈n/(kI)⌉ bins. Note that this increases the number of bins in I by at most n/k, hence doing this to each interval in I at most doubles the total size of the domain. Therefore, after applying this operation we get a distribution over a domain of size O(n), and each of the k intervals in I is of length Ω(n/k). 17 Next, in order to use an ℓ2-closeness tester, we want to further subdivide bins using our ran- domized transformation. To this end, we let m = min(k, n1/3k1/3/ǫ4/3) and take Poi(m) samples from p. Then, for each interval Ii ∈ I, we divide each bin in Ii into ⌊nai/(kIi)⌋+ 1 new bins, where ai is the number of samples that were drawn from Ii. Let I ′ i denote the new interval obtained from Ii. Note that after this procedure the total number of bins is still O(n) and that the number of bins i is now Ω((n/k)(ai + 1)). Let p′ be the distribution obtained from p under this transformation. in I ′ Let q′ be the distribution obtained by sampling from p′ and then returning a uniform random bin i as the sample. We claim that the ℓ2-norm of q′ is small. In particular the from the same interval I ′ squared ℓ2-norm will be the sum over intervals I ′ in our new partition (that is, after the subdivisions described above) of O(p(I ′)2/((n/k)(ai + 1))). Recall that 1/(ai + 1) has expectation at most 2 = O(k/(nm)). We can now apply the tester from Lemma 2.3 to distinguish between the cases where p′ = q′ 1/(mp(I ′)). This implies that the expected squared ℓ2-norm of q′ is at mostPI ′ O(p(I ′)/(nm/k)) = O(k/(nm)). Therefore, with large constant probability, we have that kq′k2 and kp′ − q′k1 > ǫ with O(n1/2k1/2m−1/2/ǫ2) = O(max(√n/ǫ2, n1/3k1/3/ǫ4/3)) samples. We have that p′ = q′ if and only if p is flat on each of the intervals in I, and kp′ − q′k1 > ǫ if p is ǫ-far from any distribution which is flat on I. This final test is sufficient to make our determination. 3 Sample Complexity Lower Bounds We illustrate our lower bound technique by proving tight information-theoretic lower bounds for testing independence (in any dimension), testing closeness in Hellinger distance, and testing his- tograms. 3.1 Lower Bound for Two-Dimensional Independence Testing Theorem 3.1. Let n ≥ m ≥ 2 be integers and ǫ > 0 a sufficiently small universal constant. Then, any algorithm that draws samples from a distribution p on [n] × [m] and, with probability at least 2/3, distinguishes between the case that the coordinates of p are independent and the case where p is ǫ-far from any product distribution must use Ω(max(√nm/ǫ2, n2/3m1/3/ǫ4/3)) samples. We split our argument into two parts proving each of the above lower bounds separately. 3.1.1 The Ω(√nmǫ−2) Lower Bound We start by proving the easier of the two bounds. It should be noted that this part of the lower bound can essentially be obtained using known results. We give a proof using our technique, in part as a guide to the somewhat more complicated proof in the next section, which will be along similar lines. First, we note that it suffices to consider the case where n and m are each sufficiently large since Ω(ǫ−2) samples are required to distinguish the uniform distribution on [2]×[2] from the distribution which takes value (i, j) with probability (1 + (2δi,j − 1)ǫ)/2. Our goal is to exhibit distributions D and D′ over distributions on [n] × [m] so that all dis- tributions in D have independent coordinates, and all distributions in D′ are ǫ-far from product distributions, so that for any k = o(√nm/ǫ2), no algorithm given k independent samples from a random element of either D or D′ can determine which family the distribution came from with greater than 90% probability. Although the above will be our overall approach, we will actually analyze the following gen- eralization in order to simplify the argument. First, we use the standard Poissonization trick. In particular, instead of drawing k samples from the appropriate distribution, we will draw Poi(k) samples. This is acceptable because with 99% probability, this is at least Ω(k) samples. Next, we relax the condition that elements of D′ be ǫ-far from product distributions, and simply require that 18 they are Ω(ǫ)-far from product distributions with 99% probability. This is clearly equivalent upon accepting an additional 1% probability of failure, and altering ǫ by a constant factor. Finally, we will relax the constraint that elements of D and D′ are probability distributions. Instead, we will merely require that they are positive measures on [n] × [m], so that elements of D are product measures and elements of D′ are Ω(ǫ)-far from being product measures with probability at least 99%. We will require that the selected measures have total mass Θ(1) with probability at least 99%, and instead of taking samples from these measures (as this is no longer as sensible concept), we will use the points obtained from a Poisson process of parameter k (so the number of samples in a given bin is a Poisson random variable with parameter k times the mass of the bin). This is sufficient, because the output of such a Poisson process for a measure µ is identical to the outcome of drawing Poi(kµk1k) samples from the distribution µ/kµk1. Moreover, the distance from µ to the nearest product distribution is kµk1 times the distance from µ/kµk1 to the nearest product distribution. We are now prepared to describe D and D′ explicitly: • We define D to deterministically return the uniform distribution µ with µ(i, j) = 1 nm for all (i, j) ∈ [n] × [m]. • We define D′ to return the positive measure ν so that for each (i, j) ∈ [n] × [m] the value nm each with probability 1/2 and independently over different pairs nm or 1−ǫ ν(i, j) is either 1+ǫ (i, j). It is clear that kµk1,kνk1 = Θ(1) deterministically. We need to show that the relevant Poisson processes return similar distributions. To do this, we consider the following procedure: Let X be a uniformly random bit. Let p be a measure on [n] × [m] drawn from either D if X = 0 or from D′ if X = 1. We run a Poisson process with parameter k on p, and let ai,j be the number of samples drawn from bin (i, j). We wish to show that, given access to all ai,j's, one is not able to determine the value of X with probability more than 51%. To prove this, it suffices to bound from above the mutual information between X and the set of samples (ai,j)(i,j)∈[n]×[m]. In particular, this holds true because of the following simple fact: Lemma 3.2. If X is a uniform random bit and A is a correlated random variable, then if f is any function so that f (A) = X with at least 51% probability, then I(X : A) ≥ 2 · 10−4. Proof. This is a standard result in information theory, and the simple proof is included here for the sake of completeness. We begin by showing that I(X : f (A)) ≥ 2 · 10−4. This is because the conditional entropy, H(Xf (A)), is the expectation over f (A) of h(q) = −q log(q)−(1−q) log(1−q), where q is the probability that X = f (A) conditional on that value of f (A). Since E[q] ≥ 51% and since h is concave, we have that H(Xf (A)) ≤ h(0.51) < log(2) − 2 · 10−4. Therefore, we have that I(X : f (A)) = H(X) − H(Xf (A)) ≥ log(2) − (log(2) − 2 · 10−4) = 2 · 10−4. The lemma now follows from the data processing inequality, i.e., the fact that I(X : A) ≥ I(X : f (A)). In order to bound I(X : {ai,j}) from above, we note that the ai,j's are independent conditional on X, and therefore that I(X : (ai,j)(i,j)∈[n]×[m]) ≤ X(i,j)∈[n]×[m] I(X : ai,j). (1) By symmetry, it is clear that all of the ai,j's are the same, so it suffices to consider I(X : a) for a being one of the ai,j. We prove the following technical lemma: 19 Lemma 3.3. For all (i, j) ∈ [n] × [m], it holds I(X : ai,j) = O(k2ǫ4/(m2n2)). The proof of this lemma is technical and is deferred to Appendix A. The essential idea is that we condition on whether or not λ := k/(nm) ≥ 1. If λ < 1, then the probabilities of seeing 0 or 1 samples are approximately the same, and most of the information comes from how often one sees exactly 2 samples. For λ ≥ 1, we are comparing a Poisson distribution to a mixture of Poisson distributions with the same average mean, and we can deal with the information theory by making a Gaussian approximation. By Lemma 3.3, (1) yields that I(X : (ai,j)(i,j)∈[n]×[m]) = O(k2ǫ4/mn) = o(1). In conjunction with Lemma 3.2, this implies that o(√mn/ǫ2) samples are insufficient to reliably distinguish an element of D from an element of D′. To complete the proof, it remains to show that elements of D are all product distributions, and that most elements of D′ are far from product distributions. The former follows trivially, and the latter is not difficult. We show: Lemma 3.4. With 99% probability a sample from D′ is Ω(ǫ)-far from being a product distribution. Proof. For this, we require the following simple claim: Claim 3.5. Let µ be a measure on [n] × [m] with marginals µ1 and µ2. If kµ − µ1 × µ2/kµk1k1 > ǫkµk1, then µ is at least ǫkµk1/4-far from any product measure. Proof. By normalizing, we may assume that kµk1 = 1. Suppose for the sake of contradiction that for some measures ν1, ν2 it holds kµ − ν1 × ν2k1 ≤ ǫ/4. Then, we must have that kµi − νik1 ≤ ǫ/4. This means that kµ − µ1 × µ2k1 ≤ kµ − ν1 × ν2k1 + kν1 × ν2 − µ1 × ν2k1 + kµ1 × ν2 − µ1 × µ2k1 ≤ ǫ/4 + kν2k1kµ1 − ν1k1 + kµ1k1kµ2 − ν2k1 ≤ ǫ/4(3 + ǫ/4) ≤ ǫ , which yields the desired contradiction. In light of the above claim, it suffices to show that with 99% probability over the choice of ν from D′ we have kν − ν1 × ν2/kνkk1 = Ω(ǫ). For this, we note that when n and m are sufficiently large constants, with 99% probability we have that: (i) kνk1 − 1 ≤ ǫ/10, (ii) ν1 has mass in the range [(1 − ǫ/10)/n, (1 + ǫ/10)/n] for at least half of its points, and (iii) ν2 has mass in the range [(1 − ǫ/10)/m, (1 + ǫ/10)/m] for at least half of its points. If all of these conditions hold, then for at least a quarter of all points the mass assigned by ν1 × ν2/kνk1 is between (1 − ǫ/2)/(nm) and (1 + ǫ/2)/(nm). In such points, the difference between this quantity and the mass assigned by ν is at least ǫ/(2mn). Therefore, under these conditions, we have that This completes the proof. kν − ν1 × ν2/kνk1k1 ≥ (nm/4)(ǫ/(2mn)) = ǫ/8 = Ω(ǫ). 3.1.2 The Ω(n2/3m1/3ǫ−4/3) Lower Bound In this subsection, we prove the other half of the lower bound. As in the proof of the previous subsection, it suffices to exhibit a pair of distributions D,D′ over measures on [n] × [m], so that with 99% probability each of these measures has total mass Θ(1), the measures from D are product measures and those from D′ are Ω(ǫ)-far from being product measures, and so that if a Poisson process with parameter k = o(n2/3m1/3/ǫ−4/3) is used to draw samples from [n] × [m] by way of a uniformly random measure from either D or D′, it is impossible to reliably determine which distribution the measure came from. We start by noting that it suffices to consider only the case where k ≤ n/2, since otherwise the bound follows from the previous subsection. We define the distributions over measures as follows: 20 • When generating an element from either D or D′, we generate a sequence c1, . . . , cn, where ci is 1/k with probability k/n and 1/n otherwise. Furthermore, we assume that the ci's are selected independently of each other. • Then D returns the measure µ where µ(i, j) = ci/m. • The distribution D′ generates the measure ν, where ν(i, j) = 1/(km) if ci = 1/k and otherwise ν(i, j) is randomly either (1 + ǫ)/(nm) or (1 − ǫ)/(nm). It is easy to verify that with 99% probability that kµk1,kνk1 = Θ(1). It is also easy to see that D only generates product measures. We can show that D′ typically generates measures far from product measures: Lemma 3.6. With 99% probability a sample from D′ is Ω(ǫ)-far from being a product distribution. Proof. If ν is a random draw from D′ and ν2 is second marginal distribution, it is easy to see that with high probability it holds ν2(j)/kνk1 ∈ [(1 − ǫ/3)/m, (1 + ǫ/3)/m] for at least half of the j ∈ [m]. Also, with high probability, for at least half of the i ∈ [n] we have that ν1(i) ∈ [(1 − ǫ/3)/n, (1 + ǫ/3)/n]. For such pairs (i, j), we have that ν(i, j) − ν1(i)ν2(j)/kνk1 ≥ ǫ/(4nm), and thus The lemma follows by Claim 3.5. kν − ν1 × ν2/kνk1k1 ≥ (nm/4)(ǫ/4nm) ≥ ǫ/16 = Ω(ǫ). It remains to show that the Poisson process in question is insufficient to distinguish which distribution the measure came from with non-trivial probability. As before, we let X be a uniformly random bit, and let µ be a measure drawn from either D if X = 0 or D′ if X = 1. We run the Poisson process and let ai,j be the number of elements drawn from bin (i, j). We let Ai be the vector (ai,1, ai,2, . . . , ai,m). It suffices to show that the mutual information I(X : A1, A2, . . . , An) is small. Note that the Ai's are conditionally independent on X (though that ai,j's are not, because ai,1 and ai,2 are correlated due to their relation to ci). Therefore, we have that I(X : A1, A2, . . . , An) ≤ nXi=1 I(X : Ai) = nI(X : A) , (2) by symmetry where A = Ai. To complete the proof, we need the following technical lemma: Lemma 3.7. We have that I(X : A) = O(k3ǫ4/(n3m)). Morally speaking, this lemma holds because if all the c's were 1/n, we would get a mutual information of roughly O(k2ǫ4/(n2m)), by techniques from the last section. However, the possibility that c = 1/k adds sufficient amount of "noise" to somewhat decrease the amount of available information. The formal proof is deferred to Appendix A. Combining (2) and the above lemma, we obtain that I(X : A1, . . . , An) = O(k3ǫ4/(n2m) = o(1). This completes the proof. 21 3.2 Lower Bound for Hellinger Closeness Testing We prove that our upper bound for Hellinger distance closeness is tight up to polylogarithmic factors. Proposition 3.8. Any algorithm that given sample access to distributions p and q on [n] that distin- guishes between p = q and H 2(p, q) > ǫ with probability at least 2/3 must take Ω(min(n2/3/ǫ4/3, n3/4/ǫ)) samples. Proof. The proof of this lower bound follows our direct information-theoretic approach. We let X be randomly either 0 or 1. We then describe a distribution of pairs of pseudo-distributions p, q on [n] so that if X = 0 then p = q and if X = 1, H 2(p, q) ≫ ǫ with 99% probability, and so that kpk1,kqk1 = Θ(1) with 99% probability. We then show that the mutual information between X and the output of Poi(k) samples from each of p and q is o(1) for k = o(min(n2/3/ǫ4/3, n3/4/ǫ)). We begin by describing this distribution. For i = 1, . . . , n − 1 with probability min(k/n, 1/2) we set pi = qi = 1/(2k), otherwise if X = 0, we set pi = qi = ǫ/n, and if X = 1 randomly set either pi = 2ǫ/n, qi = 0 or pi = 0, qi = 2ǫ/n. pn = qn = 1/3. First, we note that X = 0, we have p = q and if X = 1, H 2(p/kpk1, q/kqk1) ≫ ǫ with high Let ai, bi be the number of samples drawn from bin i under p and q respectively. We wish to probability. Furthermore, kpk1,kqk1 = Θ(1) with high probability. bound I(X : a1, b1, . . . , an, bn) from below. By conditional independence, this is I(X : ai, bi) . Xi Note that I(X : an, bn) = 0, otherwise the distribution on (X, ai, bi) is independent of i, so we will analyze it ignoring the subscript i. It is not hard to see that if k = o(n/ǫ), I(X : a, b) =Xi,j =Xi,j Pr((a, b) = (i, j)X = 0) + Pr((a, b) = (i, j)X = 1) (cid:19) O(cid:18)(Pr((a, b) = (i, j)X = 0) − Pr((a, b) = (i, j)X = 1))2 (O(kǫ/n)max(2,i+j))2 i!j!Ω(min(k/n, 1)(1/(2))i+j ) = O(max(1, n/k))(ǫk/n)4. If k = o(n), this is O(ǫ4k3/n3), so the total mutual information with the samples is O(ǫ4k3/n2), which is o(1) if k = o(n2/3/ǫ4/3). Note that n2/3/ǫ4/3 is smaller than n3/4/ǫ if and only if it is less than n, so the lower bound in proved in this case. Otherwise, if k > n and k = o(n3/4/ǫ), then the mutual information is O(n(ǫk/n)4) = O(ǫ4k4/n3) = o(1), proving the other case of our bound. i=1 ni/ǫ2 and n1/3 i (cid:16)Qd j=1 nj(cid:17)1/3 lower bounds, namelyqQd N =Qd 3.3 Lower Bound for High Dimensional Independence Testing We need to show two /ǫ4/3. We can obtain both of these from the lower bound constructions from the 2-variable case. In particular, for the first bound, we have shown that it takes this many samples to distinguish between the uniform distribution on i=1 ni inputs (which is a product distribution), from a distribution that assigns probability (1 ± ǫ)/N randomly to each input (which once renormalized is probably Ω(ǫ)-far from being a product distribution). For the latter bound, we think of [n1]×···× [nd] as [ni]× ([n1]×··· [ni−1]× [ni+1] × ··· × [nd]), and consider the lower bound construction for 2-variable independence testing. It then takes at least n1/3 i N 1/3/ǫ4/3 samples to reliably distinguish a "YES" instance from a "NO" instance. Note that in a "YES" instance the first and second coordinates are independent and 22 the distribution on the second coordinate is uniform. Therefore, in a "YES" instance we have a d-dimensional product distribution. On the other hand, a "NO" instance is likely Ω(ǫ)-far from any distribution that is a product distribution over just this partition of the coordinates, and therefore Ω(ǫ) far from any d-dimensional product distribution. This completes the proof. In particular, 3.4 Lower Bound for k-Histograms We can use the above construction to show that our upper bound for k-histograms is in fact tight. if we rewrite [n] as [k] × [n/k] and let the intervals be given by the subsets [n/k] × {i} for 1 ≤ i ≤ k, we need to show that Ω(max(√n/ǫ2, n1/3k1/3/ǫ4/3)) samples are required from a distribution p on [k] × [n/k] to dis- tinguish between the coordinates of p being independent with the second coordinate having the uniform distribution, and p being ǫ-far from any such distribution. We note that in the lower bound distributions given for each part of our lower bound constructions for the independence tester, the "YES" distributions all had uniform marginal over the second coordinate. Therefore, the same hard distributions give a lower bound for testing k-histograms of Ω(max(√n/ǫ2, k2/3(n/k)1/3/ǫ4/3)) = Ω(max(√n/ǫ2, n1/3k1/3/ǫ4/3)). This completes the proof. Acknowledgment. We would like to thank Oded Goldreich for numerous useful comments and insightful conversations that helped us improve the presentation of this work. We are grate- ful to Oded for his excellent exposition of our reduction-based technique in his recent lecture notes [Gol16b]. References [ADJ+11] J. Acharya, H. Das, A. Jafarpour, A. Orlitsky, and S. Pan. Competitive closeness testing. Journal of Machine Learning Research - Proceedings Track, 19:47–68, 2011. [ADJ+12] J. Acharya, H. Das, A. Jafarpour, A. Orlitsky, S. Pan, and A. Suresh. Competitive classification and closeness testing. In COLT, 2012. [ADK15] J. Acharya, C. Daskalakis, and G. Kamath. Optimal testing for properties of distribu- tions. CoRR, abs/1507.05952, 2015. [AJOS14] J. Acharya, A. Jafarpour, A. Orlitsky, and A. T. Suresh. Sublinear algorithms for outlier detection and generalized closeness testing. In 2014 IEEE International Symposium on Information Theory, pages 3200–3204, 2014. [Bat01] T. Batu. Testing Properties of Distributions. PhD thesis, Cornell University, 2001. [BDKR02] T. Batu, S. Dasgupta, R. Kumar, and R. Rubinfeld. The complexity of approximating entropy. In ACM Symposium on Theory of Computing, pages 678–687, 2002. [BFF+01] T. Batu, E. Fischer, L. Fortnow, R. Kumar, R. Rubinfeld, and P. White. Testing random variables for independence and identity. In Proc. 42nd IEEE Symposium on Foundations of Computer Science, pages 442–451, 2001. [BFR+00] T. Batu, L. Fortnow, R. Rubinfeld, W. D. Smith, and P. White. Testing that distri- In IEEE Symposium on Foundations of Computer Science, pages butions are close. 259–269, 2000. [BFR+13] T. Batu, L. Fortnow, R. Rubinfeld, W. D. Smith, and P. White. Testing closeness of discrete distributions. J. ACM, 60(1):4, 2013. 23 [BKR04] T. Batu, R. Kumar, and R. Rubinfeld. Sublinear algorithms for testing monotone and unimodal distributions. In ACM Symposium on Theory of Computing, pages 381–390, 2004. [BV15] [Can15] B. B. Bhattacharya and G. Valiant. Testing closeness with unequal sized samples. CoRR, abs/1504.04599, 2015. C. L. Canonne. A survey on distribution testing: Your data is big. but is it blue? Electronic Colloquium on Computational Complexity (ECCC), 22:63, 2015. [CDGR16] C. L. Canonne, I. Diakonikolas, T. Gouleakis, and R. Rubinfeld. Testing shape restric- tions of discrete distributions. In 33rd Symposium on Theoretical Aspects of Computer Science, STACS, pages 25:1–25:14, 2016. [CDVV14] S. Chan, I. Diakonikolas, P. Valiant, and G. Valiant. Optimal algorithms for testing closeness of discrete distributions. In SODA, pages 1193–1203, 2014. [DDS+13] C. Daskalakis, I. Diakonikolas, R. Servedio, G. Valiant, and P. Valiant. Testing k-modal distributions: Optimal algorithms via reductions. In SODA, pages 1833–1852, 2013. [DKN15a] I. Diakonikolas, D. M. Kane, and V. Nikishkin. Optimal algorithms and lower bounds for testing closeness of structured distributions. In 56th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2015, 2015. [DKN15b] I. Diakonikolas, D. M. Kane, and V. Nikishkin. Testing Identity of Structured Distribu- tions. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, 2015. [GGR98] O. Goldreich, S. Goldwasser, and D. Ron. Property testing and its connection to learning and approximation. Journal of the ACM, 45:653–750, 1998. [GMV09] S. Guha, A. McGregor, and S. Venkatasubramanian. Sublinear estimation of entropy and information distances. ACM Trans. Algorithms, 5(4):35:1–35:16, November 2009. [Gol16a] O. Goldreich. The uniform distribution is complete with respect to testing identity to a fixed distribution. Electronic Colloquium on Computational Complexity (ECCC), 23:15, 2016. [Gol16b] O. Goldreich. Lecture Notes on Property Testing of Distributions. Available at http://www.wisdom.weizmann.ac.il/ oded/PDF/pt-dist.pdf, March, 2016. [GR00] [ILR12] [LR05] O. Goldreich and D. Ron. On testing expansion in bounded-degree graphs. Technical Report TR00-020, Electronic Colloquium on Computational Complexity, 2000. P. Indyk, R. Levi, and R. Rubinfeld. Approximating and Testing k-Histogram Distri- butions in Sub-linear Time. In PODS, pages 15–22, 2012. E. L. Lehmann and J. P. Romano. Testing statistical hypotheses. Springer Texts in Statistics. Springer, 2005. [LRR11] R. Levi, D. Ron, and R. Rubinfeld. Testing properties of collections of distributions. In ICS, pages 179–194, 2011. 24 [NP33] J. Neyman and E. S. Pearson. On the problem of the most efficient tests of statis- tical hypotheses. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 231(694-706):289–337, 1933. [Pan08] L. Paninski. A coincidence-based test for uniformity given very sparsely-sampled dis- crete data. IEEE Transactions on Information Theory, 54:4750–4755, 2008. [RRSS09] S. Raskhodnikova, D. Ron, A. Shpilka, and A. Smith. Strong lower bounds for approxi- mating distribution support size and the distinct elements problem. SIAM J. Comput., 39(3):813–842, 2009. [RS96] R. Rubinfeld and M. Sudan. Robust characterizations of polynomials with applications to program testing. SIAM J. on Comput., 25:252–271, 1996. [Rub12] R. Rubinfeld. Taming big probability distributions. XRDS, 19(1):24–28, 2012. [Val11] [VV14] P. Valiant. Testing symmetric properties of distributions. 40(6):1927–1968, 2011. SIAM J. Comput., G. Valiant and P. Valiant. An automatic inequality prover and instance optimal identity testing. In FOCS, 2014. A Omitted Proofs from Section 3 A.1 Proof of Lemma 3.3 We note that I(X : a) =Xℓ O Pr(a = ℓ)(cid:18)1 − Pr(a = ℓX = 0) Pr(a = ℓX = 1)(cid:19)2! . A simple computation yields that Pr(a = ℓX = 0) = e−k/mn (k/mn)ℓ ℓ! , Pr(a = ℓX = 1) =(cid:18)e−k/mn (k/mn)ℓ ℓ! (cid:19) e−kǫ/mn(1 + ǫ)ℓ + ekǫ/mn(1 − ǫ)ℓ 2 ! . Expanding the above out as a Taylor series in ǫ we note that the odd degree terms cancel. We condition based on the size of k/mn. First, we analyze the case that k/mn ≤ 1. Therefore, we can see that if ℓ ≤ 2 and for 2ǫ−1 ≥ ℓ ≥ 2, e−kǫ/mn(1 + ǫ)ℓ + ekǫ/mn(1 − ǫ)ℓ 2 e−kǫ/mn(1 + ǫ)ℓ + ekǫ/mn(1 − ǫ)ℓ 2 (3) ! = 1 + O(cid:16)ǫ2(k/mn)2−ℓ(cid:17) , ! = 1 + O(cid:0)ǫ2ℓ2(cid:1) . 25 Hence, we have that I(X : a) ≤ O(ǫ4(k/mn)2) + 2ǫ−1 Xℓ=2 Pr(a = ℓ)O(ǫ4ℓ4) + Pr(a > 2ǫ−1) = O(ǫ4(k/mn)2) + O(ǫ4E[a(a − 1) + a(a − 1)(a − 2)(a − 3)]) + (ǫk/(mn))1/ǫ = O(ǫ4(k/mn)2), where in the last step we use that E[a(a − 1) + a(a − 1)(a − 2)(a − 3)] = (k/mn)2 + (k/mn)4, and the last term is analyzed by case analysis based on whether or not ǫ > (mn)−1/8. For λ = k/mn ≥ 1, we note that the probability that a − λ > √λ log(mn) is o(1/(mn)). So, it suffices to consider only ℓ at least this close to λ. We note that for ℓ in this range, e±λǫ(1 ∓ ǫ)ℓ = exp(±ǫ(λ − ℓ) + O(λǫ2)) = 1 ± ǫ(λ − ℓ) + O(λǫ2). This implies that which completes the proof. (cid:18)1 − Pr(a = ℓX = 0) Pr(a = ℓX = 1)(cid:19)2 = O(λ2ǫ4), A.2 Proof of Lemma 3.7 As before, I(X : A) =Xv O Pr(A = v)(cid:18)1 − Pr(A = vX = 0) Pr(A = vX = 1)(cid:19)2! . (4) We break this sum up into pieces based on whether or not v1 ≥ 2. If v1 < 2, note that Pr(A = vci = 1/k, X = 0) = Pr(A = vci = 1/k, X = 1). Therefore, (cid:18)1 − Pr(A = vX = 0) Pr(A = vX = 1)(cid:19)2 ≤(cid:18)1 − Pr(A = vX = 0, ci = 1/n) Pr(A = vX = 1, ci = 1/n)(cid:19)2 . Hence, the contribution coming from all such v is at most Pr(A1 = 1ci = 1/n)) max v1=1 O(cid:18)1 − Pr(A = vX = 0, ci = 1/n) Pr(A = vX = 1, ci = 1/n)(cid:19)2 +O(cid:18)1 − Pr(A = 0X = 0, ci = 1/n) Pr(A = 0X = 1, ci = 1/n)(cid:19)2 . Note that the ai,j are actually independent of each other conditionally on both X and ci. We have by Equation (3) that if v1 = 1, and Pr(A = vX = 0, ci = 1/n) Pr(A = vX = 1, ci = 1/n) = exp(cid:0)O(ǫ2k2n−2m−1 + ǫ2kn−1m−1)(cid:1) , Pr(A = 0X = 0, ci = 1/n) Pr(A = 0X = 1, ci = 1/n) = exp(cid:0)O(ǫ2k2n−2m−1)(cid:1) . We have that Pr(A1 = 1ci = 1/n) is the probability that a Poisson statistic with parameter k/n(1 + O(ǫ)) gives 1, which is O(k/n). Therefore, the contribution to I(X : A) coming from these terms is O(ǫ4k4n−4m−2 + ǫ4k3n−3m−2) = o(kn−2) + o(n−1) = o(n−1). 26 Next, we consider the contribution coming from terms with v1 ≥ 2. We note that Pr(A = v, ci = 1/kX = x) is (for either x = 0 or x = 1) ke−1 n (m)−v1 However, Pr(A = v, ci = 1/nX = x) is at most 1 vi! . mYi=1 ((1 + ǫ)k/nm)v1 1 vi! . mYi=1 This is at most 2k/n times Pr(A = v, ci = 1/kX = x). Therefore, we have that Pr(A = v)(cid:18)1 − Pr(A = vX = 0) Pr(A = vX = 1)(cid:19)2 Pr(A = vX = 0, ci = 1/n) Pr(A = vX = 1, ci = 1/n)(cid:19)2 . = O(k/n) Pr(A = vci = 1/n)(cid:18)1 − mYi=1 1 vi! Pr(A = vX = 0, ci = 1/n) = e−k/n(k/nm)v1 Note that and Pr(A = vX = 1, ci = 1/n) ≥ e−k(1+ǫ)/n(k/nm)v1 1 vi! ≫ Pr(A = vX = 0, ci = 1/n). mYi=1 Therefore, Pr(A = vci = 1/n)(cid:18)1 − Pr(A = vX = 0, ci = 1/n) Pr(A = vX = 1, ci = 1/n)(cid:19)2 Xv = Θ(I(A : Xci = 1/n)). Finally, we have that I(X : Aci = 1/n) ≤ mXj=1 I(X : ai,jci = 1/n) = O(k2ǫ4/(n2m)) , by Equation (4). This means that the contribution from these terms to I(X : A) is at most and the proof is complete. O(k3ǫ4/(n3m)) , 27
1503.02413
1
1503
2015-03-09T09:59:58
Stochastic Service Placement
[ "cs.DS", "cs.NI", "cs.PF" ]
Resource allocation for cloud services is a complex task due to the diversity of the services and the dynamic workloads. One way to address this is by overprovisioning which results in high cost due to the unutilized resources. A much more economical approach, relying on the stochastic nature of the demand, is to allocate just the right amount of resources and use additional more expensive mechanisms in case of overflow situations where demand exceeds the capacity. In this paper we study this approach and show both by comprehensive analysis for independent normal distributed demands and simulation on synthetic data that it is significantly better than currently deployed methods.
cs.DS
cs
Stochastic Service Placement Galia Shabtai, Danny Raz, and Yuval Shavitt [email protected], [email protected], [email protected] Tel-Aviv University and Technion Abstract. Resource allocation for cloud services is a complex task due to the diversity of the services and the dynamic workloads. One way to address this is by overprovisioning which results in high cost due to the unutilized resources. A much more economical approach, relying on the stochastic nature of the demand, is to allocate just the right amount of resources and use additional more expensive mechanisms in case of overflow situations where demand exceeds the capacity. In this paper we study this approach and show both by comprehensive analysis for independent normal distributed demands and simulation on synthetic data that it is significantly better than currently deployed methods. 1 Introduction The recent rapid development of cloud technology gives rise to "many-and- diverse" services being deployed in datacenters across the world. The allocation of the available resources in the various locations to these services has a critical impact on the ability to provide a ubiquitous cost-effective high quality service. There are many challenges associated with optimal service placement due to the large scale of the problem, the need to obtain state information, and the geographical spreading of the datacenters and users. One intriguing problem is the fact that the service resource requirement changes over time and is not fully known at the time of placement. A popular way of addressing this important problem is over-provisioning, that is allocating resources for the peak demand. Clearly, this is not a cost effective approach as much of the resources are unused most of the time. An alternative approach is to model the service requirement as a stochastic process with known parameters (these parameters can be inferred from historical data). Much of the previous work that used stochastic demand modeling [1,2,3,4] attempted to minimize the probability of an overflow event and not the cost of this overflow. Their solution was based on solving the Stochastic Bin Packing (SBP) problem, where the goal is to pack a given set of random items to a minimum number of bins such that each bin overflow probability will not exceed a given value.1 Thus, in these works there is no distinction between cases with marginal and substantial overflow of the demand, and under this modeling one again prepares 1 [3,4] also looked at the online SBP problem, where the items (services in our case) are assigned to some bin (datacenter) as they arrive. for the worst and tries to prevent an overflow. However, in reality it is not cost effective to allocate resources according to the worst case scenario. Instead, one often wishes to minimize the cost associated with periods of insufficient resource availability, which is commonly dealt with by either diverting the service request to a remote location or dynamically buying additional resources. In both cases, the cost associated with such events is proportional to the amount of unavailable resources. Thus, our aim is to minimize the expected overflow of the demand over time. We deviate from previous work in two ways. First, We look at a stochastic packing problem where the number of bins is given, e.g., a company already has two datacenters where services can be placed, and one would like to place services in these two datacenters optimally. Second, as we mentioned before, we look at a more practical optimality criterion where we do not wish to optimize the probability of an overflow, but instead its expected deviation. To better understand this, assume that the resource we are optimizing is the bandwidth consumption of the service in a datacenter where we have a prebooked bandwidth for each datacenter. Since we are dealing with stochastic bandwidth demand, with some probability the traffic will exceed the prebooked bandwidth and will result with expensive overpayment that depends on the amount of oversubscribed traffic. Obviously, in such a case minimizing the probability of oversubscription may not give the optimal cost, and what we need to minimize is the expected deviation from the prebooked bandwidth, thus we term our problem SP-MED (stochastic packing with minimum expected deviation). We analyze the case of independent normal distribution and develop algo- rithms for the optimal partition between two or more datacenters that need not be identical. We prove the correctness of our algorithm by separating the prob- lem into two: one dealing with the continuous characteristics of the stochastic objective function and the other dealing with the discrete nature of the combi- natorial algorithm. This approach results in a clean and elegant algorithm and proof. In fact, our proof technique reveals that the algorithms we developed hold for a large family of optimization criteria, and thus may be applicable for other opti- mization problems. In particular we study two other natural cost functions that correspond to minimizing overflow probability (rather than expected overflow deviation). We show that these cost functions also fall into our general frame- work, and therefore the same algorithm works for them as well! As will become clear later the requirements from the cost functions we have are quite natural, and we believe our methods will turn useful for many other applications. 2 Related work Early work on VM placement (e.g., [5,6,7]) models the problem as a deter- ministic bin packing problem, namely, for every service there is an estimate of its deterministic demand. Stochastic bin packing was first suggested by Klein- berg, Rabani and Tardos [1] for statistical multiplexing. [1] mostly considered Bernoulli-type distributions. Goel and Indyk [2] further studied Poisson and ex- ponential distributions. Wang, Meng and Zhang [3] suggested to model real data with the normal distribution. Thus, the input to their stochastic packing problem is n independent services each with demand requirement distributed according to a distribution X (i) that is normal with mean µ(i) and variance V (i). The output is some partition of the services to bins in a way that minimizes a target function that differs from problem to problem. A naive approach to such a problem is to reduce it to classical bin packing as follows: for the i'th service define the effective size as the number e(i) such that the probability that X (i) is larger than e(i) is small; then solve the classical bin packing problem (or a variant of it) with item sizes e(1), . . . , e(n). However, [3] showed this approach can be quite wasteful, mostly because it adds extra space per service and not per bin. To demonstrate the issue, think about unbiased, in- dependent coin tosses. The probability one coin toss significantly deviates from its mean is 1, while the probability 100 independent coin tosses significantly deviate from the mean is exponentially small. When running independent trials there is a smoothing effect that considerably reduces the chance of high devi- ations. This can also be seen from the fact that the standard deviation of n n times the standard deviation of one independent, identical processes is only process, and so the standard deviation grows much slower than the number of processes. √ Breitgand and Epstein [4], building on [3], suggest an algorithm for stochas- tic bin packing that takes advantage of this smoothing effect. The algorithm assumes all bins have equal capacity. The algorithm first sorts the processes by their variance to mean ratio (VMR), i.e., V (1) µ(n) . Then the algorithm finds the largest prefix of the sorted list such that allocating that set of services to the first bin makes the probability the first bin overflows at most p. The algorithm then proceeds bin by bin, each time allocating a prefix of the remaining services on the sorted list to the next bin. [4] show that if we allow fractional solutions, i.e., we allow splitting services between bins, the algorithm finds an optimal solution, and also show an online, integral version that gives a 2-approximation to the optimum. µ(2) ≤ . . . ≤ V (n) µ(1) ≤ V (2) 3 The risk unbalancing principle: A bird's overview of our technique In this bird's overview we focus on the SP-MED problem, and in the next section we generalize it to a much wider class of cost functions. As mentioned above we are given k bins with capacities c1, . . . , ck. We are looking for a solution that minimizes the expected deviation. As before, we study the case where the stochastic demands are independent and normally distributed. We develop a new general framework to analyze this problem that also sheds light on previous work. We first observe that an optimal fractional solution to SP-MED is also op- timal for any two bins. This is true because the cost function is the sum of the deviation of the two bins. i∈I µ(i) and variance V1 =(cid:80) distributed with mean µ1 =(cid:80) µ = (cid:80)n i=1 µ(i) and V = (cid:80)n expected deviation of all the bins, and changing the internal allocation of two bins only affects them and not the other bins. Thus, one possible approach to achieve an optimal solution, is by repeatedly improving the internal division of two bins. However, offhand, there is no reason to believe such a sequence of local improvements efficiently converges to the optimal solution. Surprisingly, this is indeed the case. Therefore, we first focus on the two bin case. Later (in Appendix A) we will see that solving the k = 2 case implies a solution to the general case of arbitrary k. We recall that if we have n independent normally distributed services with mean and variance (µ(i), V (i)), and we allocate the services with indices in I ⊆ [n] to the first bin, and the rest to the second bin, then the first bin is normally i∈I V (i), while the second one is normally distributed with mean µ− µ1 and variance V − V1 where i=1 V (i). We wish to minimize the total expected Let us define the function Dev : [0, 1] × [0, 1] → R such that Dev(a, b) is the total expected deviation when bin one is distributed with mean aµ and variance bV and bin two with mean (1− a)µ and variance (1− b)V . Figure 1 (left) depicts Dev(a, b) for two bins with equal capacity. Dev has a reflection symmetry around the a = b line, that corresponds to the fact that we can change the order of the bins as long as they have equal capacity and remain with a solution of the same cost (see Appendix G.2 for a proof of a similar symmetry for the case of different capacity bins). The points (0, 0) and (1, 1) correspond to allocating all the services to a single bin, and indeed the expected deviation there is maximal. 2 ) is a saddle point (see Appendix G.3 for a proof). Figure 1 (middle) shows a zoom in around this saddle point. There are big mountains in the lower left and upper right quarters that fall down to the saddle point, and also valleys going down from the saddle point to the bottom right and top left. Going back to Figure 1 (left) we see that for every fixed b the function is convex in a, with a single minimum point, and all these minimum points form the two valleys mentioned above. The point ( 1 2 , 1 µ , b(i) = V (i) service i with the pair (a(i) = µ(i) We now go back and consider the input(cid:8)(µ(i), V (i))(cid:9)n and [n] \ I, the expected deviation of this partition is Dev((cid:80) Thus, the n input points induce 2n possible solutions PI = ((cid:80) i=1. We can represent V ). If we split the input to the sets I i∈I b(i)). i∈I b(i)) for each I ⊆ [n], and our task is to find the partition I that minimizes Dev. Sorting the services by their VMR, is equivalent to sorting the vectors P (i) = (a(i), b(i)) by their angle with the a axis. If the sorted list is P (1), . . . , P (n) with increasing angles, looking for a solution in a partition that breaks the sorted sequence to two consecutive parts finds a solution among (0, 0), P (1), P (1) + P (2), . . . , P (1) + . . . + P (n) = (1, 1). If we connect a line between two consecutive points in the above sequence we get the sorted path, connecting (0, 0) with (1, 1). A crucial observation is that all the 2n possible solutions PI lie on or above that sorted path. See Lemma 1 for a rigorous statement and proof and Figure 1 (right) for an example. The fact that the sorted path always lies beneath all i∈I a(i),(cid:80) i∈I a(i),(cid:80) Fig. 1. The left figure depicts Dev(a, b) when µ = 160, V = 6400 and c1 = c2 = 100. The middle figure is a zoom in around the saddle point ( 1 2 ). The white lines represent the zero level sets of the partial derivatives. The right figure depicts Dev(a, b) with the 210 possible partitions represented in orange. The bottom sorted path (that sorts services by their VMR in increasing order) and the upper sorted path (that sorts services by their VMR in decreasing order), together with their integral points, are in black. Notice that all partition points are confined by both sorted paths. 2 , 1 possible solutions is independent of the target function, and only depends on the fact that we deal with the normal distribution. Actually, this is true for any distribution where allocating a subset of services to a bin amounts to adding the corresponding means and variances. A second crucial observation, proved in Theorem 1, is that the optimal frac- tional solution lies on the sorted path. In fact, the proof shows this is a general phenomenon that holds for many possible target functions. What we need from the cost function Dev we are trying to minimize is: -- Dev has a symmetry of reflection around a line that passes through a saddle point (a(cid:48), 1 2 ). -- For every fixed b, Dev is strictly uni-modal in a (i.e., has a unique minimum in a). We call the set of solutions {(m(b), b)} the valley. The saddle point lies on the valley. 2 and b ≥ 1 -- Dev restricted to the valley is strictly monotone for b ≤ 1 maximum at the saddle point that is obtained when b = 1 2 . 2 with a To see why these conditions suffice, consider an arbitrary fractional solution (a, b). By the symmetry property we may assume without loss of generality that b ≤ 1 2 . If (a, b) is left to the valley, we can improve the solution by keeping b and moving a towards the valley, until we either hit the sorted path or the valley. If we hit the valley first, we can improve the expected deviation, by going down the valley until we hit the sorted path. A similar argument applies when (a, b) is right to the valley. The conclusion is that we can always find another fractional solution that is better than (a, b) and lies on the sorted path. Thus, quite surprisingly, we manage to decouple the question to two separate and almost orthogonal questions. The first question is what is the behavior of the function Dev over its entire domain. Notice that Dev is a function of only (cid:8)(µ(i), V (i))(cid:9) at all. We study Dev using analytic tools. The second question is two variables, independent of n. This question does not depend on the input what is the geometric structure of the set of feasible points, and here we inves- tigate the input, completely ignoring the target function Dev. For this question we use geometric intuition and combinatorial tools. In Appendix B we prove our three cost functions fall into the above frame- work. The discussion above also gives an intuitive geometric interpretation of the results in [4,3]. We believe the framework is also applicable to many other target functions. There is an intuitive explanation why the optimal fractional solution lies on the sorted path. Sorting services by their VMR essentially sorts them by their risk, where risk is the amount of variance per one unit of expectation. Partition- ing the sorted list corresponds to putting all the low risk services in one bin, and all the high risk services in the other. We call this the risk unbalancing principle. Intuitively, we would like to give the high risk services as much spare capacity as possible, and we achieve that by grouping all low risk services together and giving them less spare capacity. In contrast, balancing risk amounts to taking the point ( 1 2 ) (for the case where the two bins have equal capacities). Having the geometric picture in mind, we immediately see that this saddle point is not optimal, and can be improved by taking the point on the valley that intersects the sorted path. 2 , 1 The technique also applies to bins having different capacities that previous work did not analyze, and reveals that we should allocate low risk services to the bin with the lower capacity. This follows from a neat geometric argument that when c1 < c2 the optimal fractional solution lies on the sorted path (that sorts services by their VMR in increasing order) and not the upper sorted path (that sorts services by their VMR in decreasing order). See Section 5.2 and Theorem 1 for more details. If we have k bins, we should sort the bins by their capacity and the services by their VMR, and then allocate consecutive segments of the sorted list of services to the bins, with lower risk services allocated to smaller capacity bins. This double-sorting again intuitively follows from the risk unbalancing principle, trying to preserve as much spare capacity to the high risk services.2 We prove the double-sorting algorithm in Appendix A. Finally, we are left with the question of finding the right partition of the sorted list. With two bins one can simply try all n partition points. However, (cid:1) = Θ(nk−1) possible partition points. We show a with k bins there are (cid:0) n k−1 dynamic programming algorithm that finds the best partition in poly(n) time. The optimal solution can probably be found much faster and we have candidate 2 In a similar vein if we have total capacity c to split between two bins, it is always better to make the bin capacities unbalanced as much as possible, i.e., the minimum expected deviation decreases as c2 − c1 increases. In particular the best choice is having a single bin with capacity c and the worst choice is splitting the capacities evenly between the two bins. Obviously, in practice there might be other reasons to have several bins, but if there is tolerance in each bin capacity it is always better to minimize the number of bins. We give a precise statement and proof in Appendix J. algorithms that work well in practice and we are currently working on formally proving their correctness. 4 Formal treatment i=1, specifying the bin capacities, and values(cid:8)(µ(i), V (i))(cid:9)n The input to the problem consists of k and n, specifying the number of bins and services, integers {ci}k where the demand distribution X (i) of service i is normal with mean µ(i) and variance V (i). X (i) are independent. The output is a partition of [n] to k disjoint sets S1, . . . , Sk ⊆ [n], where Sj includes indices of services that needs to be allo- cated to bin j. Our goal is to find a partition minimizing a given cost function D(S1, . . . , Sk). The optimal (integral) partition is the partition with minimum cost among all possible partitions. variance, i.e., c =(cid:80)k j=1 cj, µ =(cid:80)n i=1 µ(i) and V =(cid:80)n i=1, √ i∈Sj i∈Sj V (i). The We let c denote the total capacity, µ the total demand and V the total i=1 V (i). The value c − µ represents the total spare capacity we have. The (total) standard deviation is V which represents the standard deviation of the input had all services σ = been put into a single bin. We let ∆ denote the spare capacity in units of the standard deviation, i.e., ∆ = c−µ with mean µ(i) and variance V (i) is normal with mean (cid:80) µ(i) and variance (cid:80) V (i). Consider a partition S1, . . . , Sk. Then, the demand distribution of bin j is normal with mean µj = (cid:80) standard deviation of bin j is σj = (cid:112)Vj and its spare capacity in units of its µ(i) and variance Vj = (cid:80) We remind the reader that the sum of independent normal distributions σ . We assume that c (cid:62) µ. standard deviation is ∆j = cj−µj . Following previous work, we assume that for every i, µ(i) ≥ 0 and V (i) is small enough compared with (µ(i))2 so that the probability of getting negative demand in service i is negligible. j=1 aj ≤ 1 and (cid:80)k−1 j=1 aj and bk = 1 −(cid:80)k−1 s.t., (cid:80)k−1 let ak = 1 −(cid:80)k−1 j = 1, . . . , k and we define σj =(cid:112)Vj =(cid:112)bjσ (where σ = (cid:80)k−1 j=1 aj ≤ 1 and(cid:80)k−1 Next we normalize everything with regard to the total mean µ and the total variance V . The input to the function D are two vectors a1, . . . , ak−1, b1, . . . , bk−1 j=1 bj ≤ 1. We think of the vectors a1, . . . , ak−1 and b1, . . . , bk−1 as representing the fraction of mean and variance each bin takes. We j=1 bj be the fraction of the last bin (that takes all the remaining mean and variance). We let µj = ajµ and Vj = bjV for V ) and ∆j = cj−µj . The function D is defined over all tuples a1, . . . , ak−1, b1, . . . , bk−1 ∈ [0, 1] s.t., j=1 bj ≤ 1. There are kn possible partitions that correspond to the kn (possibly) different tuple values. We call a tuple integral if it is induced by some partition. Our goal is to approximate the integral solution minimizing D over all integral inputs. In this notation the cost function is D(a1, . . . , ak−1; b1, . . . , bk−1). σj √ σj 4.1 What do we require form a cost function? We can handle a wide variety of cost functions. Specifically, we require the fol- lowing from the cost function: 1. In any solution to a k-bin problem, the allocation for any two bins is also optimal. Formally, if S1, . . . , Sk is optimal for a k-bin problem, then for any j and j(cid:48), the partition Sj, Sj(cid:48) is optimal for the two-bin problem defined by the services in Sj ∪Sj(cid:48) and capacities cj, cj(cid:48). We remark that this is a natural condition that is true for almost any cost function we know. For k = 2 we require that: 2. D(a, b) = D(1 − a − c2−c1 µ , 1 − b). When c1 = c2 this simply translates to D(a, b) = D(1 − a, 1 − b) and there is no difference between allocating the set S1 to the first bin or to the second one. 3. For every fixed b ∈ [0, 1], D(a, b) has a unique minimum on a ∈ [0, 1], at some point a = m(b), i.e. D is decreasing at a < m(b) and increasing at a > m(b). We call the points on the curve {(m(b), b)} the valley. 2 ), 1 4. D has a unique maximum over the valley at the point (m( 1 the symmetry above this point is ( 1 is increasing for b ≤ 1 2 ). In fact by 2µ , 1 2 ). This means that D(m(b), b) 2 and decreasing for b ≥ 1 2 . 2 − c2−c1 4.2 Three cost functions We have already seen SP-MED, which minimizes the expected deviation. Previ- ous work on SBP (stochastic bin packing) studied the worst overflow probability of a bin. We define SP-MWOP to be the problem that minimizes the worst overflow probability of a bin. Another natural problem is what we call SP-MOP that minimizes the probability that some bin overflows. The three cost functions are related but behave differently. For example, SP-MWOP is not differentiable but the other two are. It is relatively simple to find the valley in SP-MED and SP-MWOP but we are not aware of any explicit description of the valley in SP-MOP. Nevertheless, it is remarkable that all three cost functions fall into our frame- work and we prove that in Appendix B. The proof is not always simple, and we have used Lagrange multipliers and the log concavity of the cumulative distribu- tion function of the normal distribution for proving this for SP-MOP. It follows that all the machinery we develop in the paper holds for these cost functions. 5 The two bin case We first consider the two bin case (k = 2). We shall later see (in Appendix A) that solving the k = 2 case is key for solving the general problem for any k > 2. As explained before we decouple the question to one about the function D and another about the structure of the integral points. 5.1 The sorted path We now consider the input (µ(1), V (1)), . . . , (µ(n), V (n)). We represent service i with the pair (a(i) = µ(i) V ). If we split the input to the sets I µ , b(i) = V (i) and [n] \ I, then the first bin is normally distributed with mean µ(cid:80) and variance V (cid:80) i∈I a(i),(cid:80) PI = ((cid:80) i∈I a(i) i∈I b(i). Thus, the n input points induce 2n possible solutions i∈I b(i)) for each I ⊆ [n] and we call each such point an integral point. Sorting the services by their VMR, is equivalent to sorting the vectors P (i) = (a(i), b(i)) by the angle they make with the a axis. Definition 1. (The sorted path) Sort the services by their VMR in increasing order and calculate the P (1), P (2), . . . , P (n) vectors. For i = 1, . . . , n define P [i] bottom = P (1) + P (2) + . . . + P (i) and, up = P (n) + P (n−1) + . . . + P (n−i+1), P [i] and also define P [0] bottom = P [0] up = (0, 0). The bottom sorted path is the curve that is formed by connecting P [i] bottom with a line, for i = 0, . . . , n− 1. The upper sorted path is the curve with a line, for i = 0, . . . , n− 1. We and P [i+1] that is formed by connecting P [i] sometimes abbreviate the bottom sorted path and call it the sorted path. up and P [i+1] bottom up The integral point P [i] bottom on the bottom sorted path corresponds to allocat- ing the i services with the lowest VMR to the first bin and the rest to the second. On the other hand, the integral point P [i] up on the upper sorted path corresponds to allocating the i services with the highest VMR to the first bin and the rest to the second. A crucial, yet simple, observation (proven in Appendix D): Lemma 1. All the integral points lie within the polygon confined by the bottom sorted path and the upper sorted path. Lemma 1 is a key lemma of the paper. Unfortunately, we had to omit the proof because of lack of space. We recommend the reader to look at the simple proof that appears in Appendix D. In fact, Lemma 2. The set of fractional points coincides with the polygon confined by the bottom sorted path and the upper sorted path. 5.2 The sorting algorithm n,(cid:8)(µ(i), V (i))(cid:9)n We now present the algorithm for the k = 2 case. The algorithm for the general case of arbitrary k is presented in Appendix A. The algorithm gets as input i=1 , c1, c2 and outputs a partition S1, S2 of [n] minimizing cost. We keep all notation as before. The algorithm works as follows: The sorting algorithm: 2 bins -- Sort the bins by their capacity such that c1 ≤ c2. -- Sort the services by their VMR such that v(1) -- Calculate the points P [0] = (0, 0), P [1], . . . , P [n] = (1, 1) on the sorted path. -- Calculate D(P [i]) for each 0 ≤ i ≤ n and find the index i∗ such that the -- Let S1 = {1, . . . , i∗} and S2 = [n] \ S1. Output (S1, S2). point P [i∗] achieves the minimal cost among all points P [i]. µ(2) ≤ ··· ≤ v(n) µ(n) . µ(1) ≤ v(2) The optimal fractional point is the fractional point that minimizes cost. In Section 3 we said, and soon will prove, that the optimal solution allocates low risk services to one bin and the rest to the other. However, offhand, it is not clear whether to allocate the smaller risk services to the lower capacity bin or the higher capacity bin. In fact, offhand, it is not clear whether the optimal solution is on the lower sorted path or the upper sorted path, and it might even depend on the input. Remarkably, we prove that it always lies on the bottom sorted path, meaning that it is always better to allocate low risk services to the smaller capacity bin and high risk services to the higher capacity bin. We gave an intuitive explanation to this phenomenon in Section 3. We prove Theorem 1 in Appendix E. Theorem 1. The optimal fractional point lies on the bottom sorted path. The optimal fractional solution splits at most one service between two bins. 6 Simulation results In this section we present our simulation results for the two bin and k bin cases. We run our simulation on bins with equal capacity. We compare the sorting algorithms for SP-MED, SP-MWOP and SP-MOP to an algorithm we call BM (Balanced Mean). The algorithm goes through the list, item by item, and allo- cates each item to the bin which is less occupied, which is a natural benchmark and also much better than other naive solutions like first-fit and first-fit decreas- ing. 3 We show simulation results on synthetic data. We first generate our stochastic i=1 for n = 100 and for n = 500. Our sample space is a mixture of three populations: all items have the same mean (we fixed it at input (cid:8)((cid:101)µ(i),(cid:101)σ(i))(cid:9)n (cid:101)µ(i) = 500) but 50% had standard deviation picked uniformly from [0, 0.1 ·(cid:101)µ(i)], 25% had standard deviation picked uniformly from [0.1 ·(cid:101)µ(i), 0.5 ·(cid:101)µ(i)] and 25% had standard deviation picked uniformly from [0.5 ·(cid:101)µ(i), 0.9 ·(cid:101)µ(i)]. 1 ≤ l ≤ 500 using the normal distribution N [(cid:101)µ(i),(cid:101)V (i)] and from this we inferred parameters µ(i), V (i), best explaining the sample as a normal distribution. Both We then randomly generated 500 sample values x(i) for each 1 ≤ i ≤ n and l 3 At first, we also wanted to compare our algorithm with variants of the algorithms considered in [3,4] for the SBP problem. In both papers, the authors consider the algorithms First Fit and First Fit Decreasing [8] with item size equal to the effective size, which is the mean value of the item plus an extra value that guarantees an overflow probability be at most some given value p. Their algorithm chooses an existing bin when possible, and otherwise opens a new bin. However, when the number of bins is fixed in advance, taking effective size rather than size does not change much. For a new item (regardless of its size or effective size) we keep choosing the bin that is less occupied, but this time we measure occupancy with respect to effective size rather than size. Thus, if elements come in a random order, the net outcome of this is that the two bins are almost balanced and a new item is placed in each bin with almost equal probability. Fig. 2. Average cost of the sorting algorithm and the BM algorithm for SP-MED, SP-MWOP and SP-MOP with two bins. The x axis measures c µ . Fig. 3. Average cost of the BM algorithm divided by average cost of the sorting algo- rithm for SP-MED, SP-MWOP and SP-MOP with 2 bins. The x axis measures c µ . the sorting algorithm and the BM algorithm got as input (cid:8)(µ(i), V (i))(cid:9)n i=1, as well as c1 = . . . = ck = c k and output their partition. To check the suggested partitions, we viewed each sample x(i) as represent- ing an item instantiation in a different time slot. We then computed the cost function. For example, for SP-MED, the deviation value for bin j at time slot l l (cid:26) (cid:27) (cid:80) (cid:80)n i∈Sj l −cj x(i) i=1 µ(i) is: max 0, 100 , i.e., the deviation is measured as a percent of the total mean value µ. We generated 20 such lists and calculated the average cost for these 20 input lists for each algorithm. We run the experiment for different values of c. Figure 2 shows the 2 bins average cost of both algorithms for SP-MED, SP- MWOP and SP-MOP as a function of c µ . As expected, the average cost decreases as the value c µ increases, i.e. as the total spare capacity increases. We also see that the sorting algorithm out-performs BM. Figure 3 shows the average cost of the BM algorithm divided by the average cost of the sorting algorithm for the three problems, again as a function of c µ . Figure 4 shows the 4 bins average cost and cost ratio of both algorithms for SP-MED as a function of c µ for n = 100 and n = 500. As we saw in the two bins case, the average cost decreases as the value c µ increases. We can also see that the average deviation for n = 100 is higher than the deviation for n = 500. However, the ratio between the BM algorithm average cost and the sorting algorithms average cost for n = 100 is lower than the ratio we get for n = 500. Still, in both n values, the sorting algorithm out-performs the BM. Fig. 4. The left figure depicts the average cost of the sorting algorithm and the BM algorithm for SP-MED with four bins, both for n = 100 and for n = 500. The right figure depicts the average cost of the BM algorithm divided by the average cost of the sorting algorithm for n = 100 and for n = 500. The x axis measures c µ . References 1. Kleinberg, J., Rabani, Y., Tardos, ´E.: Allocating bandwidth for bursty connections. SIAM Journal on Computing 30 (2000) 191 -- 217 2. Goel, A., Indyk, P.: Stochastic load balancing and related problems. In: Foundations of Computer Science, 1999. 40th Annual Symposium on, IEEE (1999) 579 -- 586 3. Wang, M., Meng, X., Zhang, L.: Consolidating virtual machines with dynamic bandwidth demand in data centers. In: INFOCOM, 2011 Proceedings IEEE, IEEE (2011) 71 -- 75 4. Breitgand, D., Epstein, A.: Improving consolidation of virtual machines with risk- aware bandwidth oversubscription in compute clouds. In: INFOCOM, 2012 Pro- ceedings IEEE, IEEE (2012) 2861 -- 2865 5. Ajiro, Y., Tanaka, A.: Improving packing algorithms for server consolidation. In: Int. CMG Conference. (2007) 399 -- 406 6. Bobroff, N., Kochut, A., Beaty, K.: Dynamic placement of virtual machines for managing sla violations. In: Integrated Network Management, 2007. IM'07. 10th IFIP/IEEE International Symposium on, IEEE (2007) 119 -- 128 7. Mehta, S., Neogi, A.: Recon: A tool to recommend dynamic server consolidation in multi-cluster data centers. In: Network Operations and Management Symposium, 2008. NOMS 2008. IEEE, IEEE (2008) 363 -- 370 8. Johnson, D.: Computers and intractability-a guide to the theory of np-completeness (1979) A The general case We now analyze the general k bin case using the results we have obtained for the two-bin case. We first show the optimal factional solution is obtained by first sorting the bins by their capacities and the services by their VMR ratio, and then partitioning the sorted list to k consecutive parts. Assume the bins are sorted by their capacity, c1 ≤ c2 ≤ . . . ≤ ck. A fractional solution is called sorted if for every j < j(cid:48) and every two services i and i(cid:48) such that service i (resp. i(cid:48)) is allocated to bin j (resp. j(cid:48)) it holds that the VMR of service i is at most that of service i(cid:48). Theorem 2. The optimal fractional solution is sorted. Proof. Assume there is an optimal solution S1, . . . , Sk that is not sorted. I.e., there exist j < j(cid:48) and i, i(cid:48) such that service i (resp. i(cid:48)) is allocated to bin j (resp. j(cid:48)) and the VMR of service i is strictly larger than that of service i(cid:48). By Theorem 1 the sorted fractional solution for the problem defined by bins j and j(cid:48) is strictly better than the one offered by the solution S1, . . . , Sk. This means the solution is not optimal for bins j and j(cid:48) - in contradiction to item (1) in Section 4.1. The fact that with two bins and different capacities c1 < c2, low risk services should be allocated to the smaller capacity bin (See Theorem 1 and the discussion before it) implies also that for k bins lower risk services should be allocated to lower capacity bins. Next we present an algorithmic framework for the problem: The double sorting algorithm framework -- Sort the bins by their capacity c1 ≤ c2 ≤ . . . ≤ ck. -- Sort the services by their VMR v(1) -- Use a partitioning algorithm to find k − 1 partition points (cid:96)0 = 0 ≤ (cid:96)1 < . . . (cid:96)k−1 ≤ (cid:96)k = n and output S1, . . . , Sk where Sj = {(cid:96)j−1 + 1, . . . , (cid:96)j}. µ(2) ≤ ··· ≤ v(n) µ(n) . µ(1) ≤ v(2) -- Allocate the services in Sj to bin number j (with capacity cj). The algorithmic framework is not complete since it does not specify how to find the partition points on the sorted path. With two bins there is only one partition point, and we can check all possible n − 1 integral partition points. (cid:1) possible partition points, and checking all partition With k bins there are(cid:0) n k−1 points may be infeasible. We now describe a dynamic programming algorithm that solves the problem, and works under very general conditions. Finding an optimal integral partition For each 1 ≤ t ≤ log k, 1 ≤ i < i(cid:48) ≤ n and j = 1, . . . , k keep the two values P artition(2t, i, i(cid:48), j) and D(2t, i, i(cid:48), j) that are defined as follows: -- Base case t = 1: P artition(2, i, i(cid:48), j) is the best integral partition point for the two bin problem with inputs Xi, . . . , Xi(cid:48) and capacities cj, cj+1. D(2, i, i(cid:48), j) is its corresponding expected deviation. -- Induction step. Suppose we have built the tables for t, we show how to build the tables for t + 1. We let Dev(2t+1, i, i(cid:48), j) be (cid:8)D(2t, i, i(cid:48)(cid:48) − 1, j) + D(2t, i(cid:48)(cid:48), i(cid:48), j + 2t)(cid:9) min i≤i(cid:48)(cid:48)≤i(cid:48) and we let P artition(2t+1, i, i(cid:48), j) be the partition point that obtains the minimum in the above equation. The optimal partition to k bins (assuming k is a power of two) can be recovered from the tables. For example for 4 bins P artition(4, 1, n, 1) returns the middle point (cid:96)2 of the partition, and the partition points within each half are obtained by (cid:96)1 = P artition(2, 1, (cid:96)2 − 1, 1) and (cid:96)3 = P artition(2, (cid:96)2, n, 3). It can be seen (by a simple induction) that P artition(2t, i, i(cid:48), j) gives the middle point of the optimal integral solution on the sorted path to the problem of dividing Xi, . . . , Xi(cid:48) to 2t bins with capacities cj, cj+1, . . . , cj+2t−1. It can also be verified that the running time of the algorithm is O(n3k log k). We analyze the error the integral solution we find has compared with the optimal fractional solution. The error analysis builds upon the error analysis of the two bin case. Start with an optimal fractional solution π. By Theorem 2 we know π is sorted. π defines some sorted fractional solution to the problem defined by the first two bins. By the remark after Theorem 3 we know that one of the integral points to the left or to the right of the fractional solution has a very close deviation to that of π, and we fix the first partition point accordingly to make it integral. Now assume after fixing j stages we hold some fractional solution π(j) that is integral on the first j partition points and possibly fractional on the rest. We look at bins j + 1 and j + 2 and find an integral partition point (to the left or to the right of the next fractional partition point) that is almost as good as the fractional one. Doing the above for j = 1, . . . , k − 1 we end up with an integral solution whose deviation is close to that of the optimal fractional solution, where the error bound in Theorem 3 is multiplied by a factor of k − 1. We remark that this also shows an efficient way of converting an optimal fractional solution to an integral solution close to it. The algorithm is quite general and works whenever we can solve the k = 2 case, and therefore may be seen as a reduction from arbitrary k to the k = 2 case. The main point we want to stress is that even in this generality the complexity is polynomial. The main disadvantage of the algorithm is that it runs in about n3 time. For specific cases (such as SP-MED and SP-MOP and probably other natural variants) the optimal solution may be probably found much faster, and we are currently working on proving the correctness of an almost linear algorithm. B Three cost functions B.1 Stochastic Packing with Minimum Expected Deviation (SP-MED) In Appendix G.1 we prove the expected deviation of bin j (j = 1, . . . , k), denoted by DevSj , is DevSj = σj[φ(∆j) − ∆j(1 − Φ(∆j))], where φ is the probability density function (pdf) of the standard normal distri- bution and Φ is its cumulative distribution function (CDF).4 Denoting g(∆) = φ(∆) − ∆(1 − Φ(∆)) we see that DevSj = σj g(∆j). With two bins Dev is a function from [0, 1]2 to R and Dev(a, b) = σ1g(∆1) + σ2g(∆2) where the first bin has mean aµ and variance bV , the second bin has mean (1 − a)µ and variance (1 − b)V and σj, ∆j are defined as above. Lemma 3. Dev respects conditions (1)-(4) of Section 4.1. Proof. We go over the conditions one by one. item (1): Let S1, . . . , Sk be an optimal solution. Suppose there are j and j(cid:48) for which Sj, Sj(cid:48) are not the optimal solution for the two-bin problem defined by the services in Sj ∪ Sj(cid:48) and capacities cj, cj(cid:48). Change the allocation of the solution S1, . . . , Sk on bins j and j(cid:48) to an optimal solution for the two bin problem. This change improves the expected total deviation of the two bins while not affecting the expected deviation of any other bin. In total we get a better solution, in contradiction to the optimality of S1, . . . , Sk. item (2): In Appendix G.2 we prove Dev(a, b) = Dev(1− a− c2−c1 µ , 1− b). We remark that for c1 = c2 this simply says we can switch the names of the first and second bin. ] ≥ 0. It follows that for any 0 < b < 1, Dev(a) is convex and has a unique minimum. The unique point (m(b), b) on the valley is the one where ∆1 = ∆2. item (3): In Appendix G.3 we calculate ∂2Dev ∂a2 = µ2 [ φ(∆2) σ2 + φ(∆1) σ1 item (4): We first explicitly determine what Dev restricted to the valley is as a function D(b) = Dev(m(b), b) of b. As Dev(a, b) = σ1g(∆1) + σ2g(∆2) and on the valley ∆1 = ∆2 we see that on the valley Dev(a, b) = (σ1 + σ2)g(∆1). However, σ1 + σ2 also simplifies to c1−aµ . Altogether, + c2−(1−a)µ = c−µ ∆1 ∆2 ∆1 4 A quick background on the normal distribution is given in Appendix F. ∆1 ∂∆1 ∂b = ∂Dev ∂∆1 is a function of ∆1 = −(c− µ) φ(∆1) we conclude that on the valley Dev(a, b) = (c − µ) g(∆1) alone. Now it is a straight forward calculation that ∂Dev(∆1) < 0. 2 and positive when b ≥ 1 is negative when b ≤ 1 Also ∂∆1 2 (see Appendix ∂b · ∂∆1 ∂b , we see that D(b) is increasing for b ≤ 1 G.3 and G.3). As ∂D 2 2 − c2−c1 and decreasing for b ≥ 1 2µ , b = 1 2 ) lies on the valley and is a maximum point for Dev restricted to the valley. We remark that we could simplify the proof by using Lagrange multipliers (as we do in Lemma 8). However, since here it is easy to explicitly find Dev restricted to the valley we prefer the explicit solution. Later, we will not be able to explicitly find the restriction to the valley and we use instead Lagrange multipliers that solves the problem with an implicit description of the valley. 2 as claimed. The saddle point (a = 1 ∆2 1 Lemma 4. The difference between the expected deviation in the integral point found by the sorting algorithm and the optimal integral (or fractional) point for SP-MED is at most n · µ. In particular, when L = o(cid:0)n(cid:1) and α is a constant, the error is o(cid:0)µ(cid:1). · 1 α · L 1√ 2πe Proof. We know from Theorem 3 that the difference is at most min{∇D(ξ1),∇D(ξ2)} L n , where ξ1 ∈ [O1, OP Tf ], ξ2 ∈ [OP Tf , O2] and O1 and O2 are the two points on the bottom sorted path between which OP Tf lies. Using the partial derivatives calculated in Appendix G.3 we see that ∇(σ2g)(∆2) (cid:54) µ (1 − Φ(∆2)) + √ 2 σ 1 − b φ(∆2) ≤ µ + √ 2 σ 1 − b φ(∆2). Moreover, √ σ 1−b 2 √ φ(∆2) = σ 2 1−b 1 ∆2 ∆2φ(∆2) and a simple calculation shows . By our 1√ that the function ∆φ(∆) maximizes at ∆ = 1 with value at most assumption that ∆j ≥ 0 for every j, we get that 2πe √ 2 σ 1 − b φ(∆2) (cid:54) √ 2 σ 1 − b √ σ 1 − b c2 − (1 − a)µ 1√ 2πe (cid:54) √ V 2πe 2 1 c2 − (1 − a)µ . 1 c1−aµ . √ V 2πe 2 Applying the same argument on O2 shows the error can also be bounded by However, (c1 − aµ) + (c2 − (1− a)µ) = c− µ which is the total spare capacity, and at least one of the bins takes spare capacity that is at least half of that, namely c−µ 2 . Since the error is bounded by either term, we can choose the one where the spare capacity is at least c−µ 2 and we therefore see that the error is at c−µ . Since we assume c− µ ≥ αµ for some constant α > 0, the error most µ ≤ µ which completes the proof. V√ αµ . As we assume V ≤ µ2, V is at most √ V 2πe 2 2 1 2πe This shows the approximation factor goes to 1 and linearly (in the number of services) fast. Thus, from a practical point of view the theorem is very satisfying. B.2 Stochastic Packing with Min Worst Overflow Probability (SP-MWOP) ues(cid:8)(µ(i), V (i))(cid:9)n The SP-MWOP problem gets as input integers k and n, specifying the number of bins and services, integers c1, . . . , ck, specifying the bin capacities and val- i=1, specifying that the demand distribution X (i) of service i is normal with mean µ(i) and variance V (i). A solution to the problem is a parti- tion of [n] to k disjoint sets S1, . . . , Sk ⊆ [n] that minimizes the worst overflow probability. The SP-MWOP problem is a natural variant of SBP. For a given partition let OF Pj (for j = 1, . . . , k) denote the overflow probability of bin j. Let W OF P j=1 {OF Pj}. In the denote the worst overflow probability, i.e., W OF P = maxk SBP problem we are given n normal distributions and wish to pack them into few bins such that the OF P ≤ k for some given parameter p. Suppose we solve the SBP problem for a given p and know that k bins suffice. We now ask ourselves what is the minimal W OF P achieved with the k bins (this probability is clearly at most p but can also be significantly smaller). We also ask what is the partition that achieves this minimal worst overflow probability. The problem SP-MOP does exactly that. OF Pj = 1 − Φ(∆j) where ∆j = cj−µj In Appendix H.1 we prove the overflow probability of bin j (j = 1, . . . , k), is . Thus, σj W OF P = {1 − Φ(∆j)} . k max j=1 With two bins W OF P is a function from [0, 1]2 to R and W OF P (a, b) = max{1 − Φ(∆1), 1 − Φ(∆2)} where the first bin has mean aµ and variance bV , the second bin has mean (1 − a)µ and variance (1 − b)V and σj, ∆j are defined as above. Lemma 5. W OF P respects conditions (1)-(4) of Section 4.1. Proof. We go over the conditions one by one. item (1): Let S1, . . . , Sk be an optimal solution. Suppose there are j and j(cid:48) for which Sj, Sj(cid:48) are not the optimal solution for the two-bin problem defined by the services in Sj ∪ Sj(cid:48) and capacities cj, cj(cid:48). Change the allocation of the solution S1, . . . , Sk on bins j and j(cid:48) to an optimal solution for the two bin problem. This change improves the worst overflow probability of the two bins while not affecting the overflow probability of any other bin. In total we get a better solution, in contradiction to the optimality of S1, . . . , Sk. item (2): The same proof as in Appendix G.2 shows W OF P (a, b) = W OF P (1− a − c2−c1 µ , 1 − b). ∂a (a, b) = µ√ bσ item (3): Fix b. Denote OF P1(a, b) = OF PS1 (aµ, bV ) = 1− Φ(∆1). It is a sim- · φ(∆1) > 0. Similarly, if OF P2(a, b) ple calculation that ∂OF P1 denotes the overflow probability in the second bin when the first bin has to- · φ(∆2) < 0. Thus, tal mean aµ and total variance bV , then ∂OF P2 OF P1 is monotonically increasing in a and OF P2 is monotonically decreas- ing in a, and therefore there is a unique minimum for OF P (a, b) (when b is fixed and a is free) that is obtained when OF P1(a, b) = OF P2(a, b), i.e., when ∆1 = ∆2. −µ√ 1−bσ ∂a = item (4): We first explicitly determine what W OF P restricted to the valley is as a function D(b) = W OF P (m(b), b) of b. From before we know that on the valley ∆1 = ∆. Therefore, following the same reasoning as in the SP-MED case, D(b) = c − µ σ 1√ √ b + . 1 − b It follows that D(b) is monotonically decreasing in b for b ≤ 1 2 and increasing otherwise. The maximal point is obtained in the saddle point that is the center of the symmetry. Lemma 6. The difference between minimal worst overflow probability in the integral point found by the sorting algorithm and the optimal integral (or frac- tional) point for SP-MWOP is at most O( L αn ). In particular, when L = o(cid:0)n(cid:1) and α is a constant, the difference is o(cid:0)1(cid:1). Proof. We know from Theorem 3 that the difference is at most min{∇D(ξ1),∇D(ξ2)} L n , where ξ1 = (a1, b1) ∈ [O1, OP Tf ], ξ2 = (a2, b2) ∈ [OP Tf , O2] and O1 and O2 are the two points on the bottom sorted path between which OP Tf lies, and notice that even though W OF P is not differentiable when ∆1 = ∆2, it is differentiable everywhere else. We now use the partial derivatives calculated in Appendix G.3. We also replace φ(∆2) c2−(1−a)µ and similarly for the other term. We get: with ∆2φ(∆2) σ2 (cid:26) (cid:27) L . , ) 1 2b2 µ 1 ∆2φ(∆2) · ( ),∆1φ(∆1) · ( µ , min 2(1 − b1) c2 − (1 − a1)µ ∆φ(∆) maximizes at ∆ = 1 with value at most c1 − a2µ n . Also, (c1 − a2µ) + 2πe (c2 − (1 − a1)µ) = c − µ − (a2 − a1)µ ≥ c − µ L 2 µ, where α is the total space capacity, and a constant by our assumption. Hence, at least one of the α . Also, for that term, the spare capacity terms is maximal, and therefore it takes at least half of the variance. Altogether, the difference is at most O( L c1−a2µ is at most 4 1√ n ≥ α αn ) which completes the proof. µ c2−(1−a1)µ , µ B.3 Stochastic Packing with Minimum Overflow Probability (SP-MOP) (cid:8)(µ(i), V (i))(cid:9)n The total overflow probability is OF P = 1 −(cid:81)k The SP-MOP problem gets as input integers k and n, specifying the number of bins and services, integers c1, . . . , ck, specifying the bin capacities and values i=1, specifying that the demand distribution X (i) of service i is normal with mean µ(i) and variance V (i). A solution to the problem is a partition of [n] to k disjoint sets S1, . . . , Sk ⊆ [n] that minimizes the overflow probability. j=1(1 − OF Pj) where as we computed before (in Appendix H.1) OF Pj = 1 − Φ(∆j). With two bins OF P is a function from [0, 1]2 to R and OF P (a, b) = 1− Φ(∆1)Φ(∆2) where the first bin has mean aµ and variance bV , the second bin has mean (1 − a)µ and variance (1 − b)V and σj, ∆j are defined as above. Lemma 7. OF P respects conditions (1)-(3) of Section 4.1. Proof. We go over the conditions one by one. item (1): Let S1, . . . , Sk be an optimal solution. Suppose there are j and j(cid:48) for which Sj, Sj(cid:48) are not the optimal solution for the two-bin problem defined by the services in Sj ∪ Sj(cid:48) and capacities cj, cj(cid:48). Change the allocation of the solution S1, . . . , Sk on bins j and j(cid:48) to an optimal solution for the two bin problem. This change improves (1 − OF Pj)(1 − OF Pj(cid:48)) while not affecting the overflow probability of any other bin. In total we get a better solution, in contradiction to the optimality of S1, . . . , Sk. item (2): The same proof as in Appendix G.2 shows OF P (a, b) = OF P (1 − a − c2−c1 µ , 1 − b). item (3): Fix b. ∂2OF P ∂2a = µ2[ φ(∆1)Φ(∆2) + ∆1 σ2 1 In particular ∂2OF P a ∈ [0..1] and has a unique minimum a = m(b). ∆2 σ2 2 φ(∆2)Φ(∆1) + 2 σ1σ2 φ(∆1)φ(∆2)]. ∂2a > 0 and for every fixed b, OF P (a, b) is convex over . Proving there exists a unique maximum over the valley is more challenging. We wish to find all extremum points of the cost function D (OF P in our case) over the valley {(m(b), b)}. Define m(a, b) = a−m(b). Then we wish to maximize D(a, b) subject to m(a, b) = 0. Before, we computed the restriction D(b) of the cost function over the valley and found its extremum points. However, here we do not know how to explicitly find D(b). Instead, we use Lagrange multipliers that allow working with the implicit form m(a, b) = 0 without explicitly finding D(b). We prove a general result: Lemma 8. If a cost function D is differentiable twice over [0, 1] × [0, 1] and respects conditions (1)-(4) of Section 4.1, and if for every b ∈ [0, 1], D(a, b) is strictly convex for a ∈ [0, 1], then any extremum point of D over the valley must have zero gradient at Q, i.e., ∇(D)(Q) = 0. Proof. The valley is defined by the equation m(a, b) = ∂D multipliers we find that at any extremum point Q of D over the valley, ∂a (a, b). Using Lagrange ∇(D)(Q) = λ∇m(Q). For some real value λ. However, ∇(D)(Q) = ( ∂D ∂a (Q), ∂D ∂b (Q)) = (0, ∂D ∂b (Q)), because Q is on the valley. H Also, as for every fixed b, D(a, b) is strictly convex, we have that ∂m ∂a (Q) = ∂2D ∂2a (Q) > 0. Therefore, we conclude that λ = 0. This implies that ∂D ∇(D)(Q) = 0. ∂b (Q) = 0. Hence, With that we prove: Lemma 9. OF P respects condition (4) of Section 4.1. Proof. Let Q = (a, b) be an extremum point of OF P over the valley. We look at the range b ∈ [0.. 1 2 is obtained by the symmetry. Then, by Lemma 8: 2 ), b ≥ 1 φ(∆1)Φ(∆2) φ(∆1)Φ(∆2) ∂∆1 ∂a ∂∆1 ∂b = −φ(∆2)Φ(∆1) = −φ(∆2)Φ(∆1) ∂∆2 ∂a ∂∆2 ∂b . , and Dividing the two equations we get ∂∆1 ∂a ∂∆2 ∂b = ∂∆2 ∂a ∂∆1 ∂b . Plugging the partial derivatives of ∆i by a and b, we get the equation (cid:114) b ∆1 ∆2 = 1 − b . As b ≤ 1 2 , b < 1 − b and we conclude that at Q ∆1 < ∆2. However, using the log-concavity of the normal c.d.f function Φ we prove in Appendix I that: Lemma 10. ∂OF P ∂a = 0 at a point Q = (a, b) with b ≤ 1 2 implies ∆1 ≥ ∆2. Together, this implies that the only extremum point of OF P over the valley is at b = 1 2 . However, at b = 0, the best is to fill the largest bin to full capacity with variance 0, and thus, OF P (m(0), 0) = 1 − Φ(∆) where ∆ = c−µ σ . On the other hand, at b = 1 ). As (c1 − aµ) + (c2 − (1− a)µ) = c− µ, either c1 − aµ or c2 − (1− a)µ is at most c−µ √ ) ≤ Φ( c−µ and therefore Φ( σ ). )Φ( 2 ) ≥ OF P (m(0), 0) and there is a unique maximum We conclude that OF P (a, 1 point on the valley and it is obtained at b = 1 2 . 2 ) = 1 − Φ( c1−aµ√ 2 c−µ 2σ ) = Φ( c−µ√ 2 , OF P (a = m( 1 )Φ( c2−(1−a)µ√ 2 c2−(1−a)µ ) ≤ Φ( 2 ), 1 √ 2 c1−aµ σ 1 2 σ 1 2 σ σ 2σ √ 2 C Bounding the approximation error of the sorting algorithm √ (cid:80) i P (i) ≥ (1, 1) = 2 (by the triangle inequality) and(cid:80) We assume that no input service is too dominant. Recall that we represent service i with the point P (i) = (a(i), b(i)) and P (1) + P (2) + . . . + P (n) = (1, 1). Thus, i P (i) ≤ 2 (because the length of the longest increasing path from (0, 0) to (1, 1), is obtained by the path going from (0, 0) to (1, 0) and then to (1, 1)). Hence, the average length of an input point P (i) is somewhere between n . Our assumption states that no element takes more than L times its "fair" share, i.e., that for every i, P (i) ≤ L √ n and 2 n . With that we prove: 2 Theorem 3. Let OP Tf be the fractional optimal solution. If D is differentiable, the difference between the cost on the integral point found by the sorting al- gorithm and the cost on the optimal integral (or fractional) point is at most min{∇D(ξ1),∇D(ξ2)} L n , where ξ1 ∈ [O1, OP Tf ], ξ2 ∈ [OP Tf , O2] and O1 and O2 are the two points on the bottom sorted path between which OP Tf lies. Proof. Suppose we run the sorting algorithm on some input. Let OP Tint be the integral optimal solution, OP Tf the fractional optimal solution and OP Tsort the integral point the sorting algorithm finds on the bottom sorted path. We wish to bound D(OP Tsort)− D(OP Tint) and clearly it is at most D(OP Tsort)− D(OP Tf ). We now look at the two points O1 and O2 on the bottom sorted path between which OP Tf lies (and notice that as far as we know it is possible that OP Tsort is none of these points). Since D(OP Tf ) ≤ D(OP Tsort) ≤ D(O1) and D(OP Tf ) ≤ D(OP Tsort) ≤ D(O2) the error the sorting algorithm makes is at most min{D(O1) − D(OP Tf ), D(O2) − D(OP Tf )} . We now apply the mean value theorem and use our assumption that for every i, P (i) ≤ L n . We define a new system constant, relative spare capacity, denoted by α which equals c−µ µ , i.e., it expresses the spare capacity as a fraction of the total mean. We assume that the system has some constant (possibly small) relative spare ca- pacity. Also, we only consider solutions where each bin is allocated services with total mean not exceeding its capacity. Equivalently, we only consider solutions where ∆j ≥ 0 for every 1 ≤ j ≤ k. We will later see that under these conditions the sorting algorithm solves all three cost functions with a small error going fast to zero with n. We remark that in fact the proof shows something stronger: the deviation of any (not necessarily optimal) fractional solution on the bottom sorted path, is close to the deviation of the integral solution to the left or to the right of it on the bottom sorted path. D Proof of Lemma 1 is(cid:80)i τ where P [i] τ Proof. We introduce some notation. Let τ = τ1, . . . , τn be a sequence of n ele- ments that is a reordering of {1, . . . , n}. We associate with τ the n partial sums P [1] τ , . . . , P [n] is the integral point that is the sum of the first i points according to the sequence τ . We also define P [0] and P [n] necting P [i] τ = (0, 0) τ = (1, 1). The curve connecting τ is the curve that is formed by con- with a line, for i = 0, . . . , n − 1. j=1 P (τj ), i.e., P [i] τ τ and P [i+1] τ τ Assume that in the sequence τ = τ1, . . . , τn there is some index i such that the VMR of P (τi) is larger than the VMR of P (τi+1). Consider the sequence τ(cid:48) that is the same as τ except for switching the order of τi and τi+1. I.e., τ(cid:48) = τ1, . . . , τi−1, τi+1, τi, τi+2, . . . , τn. We claim that the curve connecting τ(cid:48) lies beneath the curve connecting τ . To see that notice that both curves are the same up to the point P [i−1] . There, the two paths split. τ adds P (τi) and then P (τi+1) while τ(cid:48) first adds P (τi+1) and then P (τi). Then the two curves coincide and overlap all the way to (1, 1). In the section where the two paths differ, the two different paths form a parallelogram with P (τi) and P (τi+1) as two neighboring edges of the parallelogram. As the angle P (τi+1) has with the a axis is smaller than the angle P (τi) has with the a axis, the curve connecting τ(cid:48) goes beneath that of τ . To finish the argument, let PI be an arbitrary integral point for some I ⊆ [n]. Look at the sequence τ that starts with the elements of I followed by the elements of [n]\I in an arbitrary order. Notice that PI lies on the curve connecting τ . Now run a bubble sort on τ , each time ordering a pair of elements by their VMR. Notice that the process terminates with the sequence that sorts the elements by their VMR and the curve connecting the final sequence is the bottom sorted path. Thus, we see that the bottom sorted path lies beneath the curve connecting τ , and in particular PI lies above the bottom sorted path. A similar argument shows PI lies underneath the upper sorted path. E Proof of Theorem 1: The optimal solution is on the bottom sorted path Proof. Consider an arbitrary fractional point (a0, b0) lying strictly inside the polygon confined by the upper and bottom sorted paths. If b0 ≤ 1 2 , then by keeping b = b0 constant and changing a till it reaches the valley we strictly decrease cost (because D is strictly monotone in this range). Now, when changing a we either hit the bottom sorted path or the valley. If we hit the bottom sorted path, we found a point on the bottom sorted path with less cost and we are done. If we hit the valley, we can go down the valley until we hit the bottom sorted path and again we are done (as D is strictly monotone on the valley). 2 we recall two facts that we already know: If b0 ≥ 1 -- The point (1− a0, 1− b0) = ϕ(a0, b0) is fractional (since (a0, b0) is fractional -- By the reflection symmetry we know that D(a0, b0) = D(1 − a0 − ζ, 1 − b0) and ϕ maps fractional points to fractional points), and, where ζ = c2−c1 µ ≥ 0. Now, (1−a0−ζ, 1−b0) has b coordinate that is at most 1 2 . Also (1−a0−ζ, 1−b0) lies to the left of the fractional point (1 − a0, 1 − b0) (since ζ > 0) and therefore it lies above the bottom sorted path. We therefore see that the point (a0, b0) has a corresponding fractional point with the same cost and with b coordinate at most 1 2 . Applying the argument that appears in the first paragraph of the proof we conclude that there exists some point on the bottom sorted path with less cost, and conclude the proof. F Standard Normal Distribution The probability density function of the standard normal distribution (that has mean 0 and variance 1) is φ(x) = 1√ 2π tion is Φ(x) = 1√ 2π −xφ(x). The second derivative is φ(cid:48)(cid:48)(x) = −φ(x) + x2φ(x) = (x2 − 1)φ(x). 2 dt. Clearly, Φ(cid:48)(x) = φ(x). Also, φ(cid:48)(x) = − x√ (cid:82) x −∞ e− t2 2 and the cumulative distribution func- e− x2 e− x2 2π 2 = G SP-MED G.1 Expected Deviation of a single bin √ By definition the expected deviation of a single bin is DevSj = 1 σj j dx. Doing the variable change t = x−µj and then the variable change − (x−µj )2 2σ2 cj)e y = −t2 2 we get: (cid:82) ∞ cj 2π (x − σj (cid:90) −∞ cj − µj DevSj = (µj − cj)[1 − Φ( σj = −σj∆j[1 − Φ(∆j)] + )] − σj√ 2π j = σj[φ(∆j) − ∆j(1 − Φ(∆j))]. e− 1 eydy − 1 2 ( cj−µj 2 ∆2 )2 σj σj√ 2π Denoting g(∆) = φ(∆) − ∆[1 − Φ(∆)] we see that DevSj = σjg(∆j). G.2 Symmetry Claim. Dev(a, b) = Dev(1 − a − c2−c1 µ , 1 − b). √ √ 1 − b σ, ∆1(a, b) = c1−aµ σ2(b) b σ, σ2(b) = . We know that Dev(a, b) = σ1(b)g(∆1(a, b))+σ2(b)g(∆2(a, b)). Proof. Let us define σ1(b) = ∆2(a, b) = c2−(1−a)µ To prove the claim it is enough to show that the following four equations hold: σ1(b) = σ2(1 − b), σ2(b) = σ1(1 − b), ∆1(a, b) = ∆2(1 − a + c1−c2 ∆2(a, b) = ∆1(1 − a + c1−c2 µ , 1 − b) and µ , 1 − b). √ 1 − b σ = σ2(b) and similarly σ2(1 − b) = σ1(b). Also, Indeed, σ1(1 − b) = σ1(b) and ∆2(1 − a − c2 − c1 µ , 1 − b) = c2 − (1 − (1 − a + c1−c2 µ ))µ σ2(1 − b) A similar check shows that ∆1(1 − a − c2−c1 µ , 1 − b) = ∆2(a, b). G.3 The partial derivatives of Dev √ √ √ = c1−aµ 1 − bσ. We let ∆1 = c1−µ1 The system has absolute constants µ and V , σ = bσ and . In σ2 = this notation, Dev(a, b) = σ1 g(∆1) + σ2 g(∆2). We calculate the g derivatives. Since g(∆) = φ(∆)+∆Φ(∆)−∆ we have that g(cid:48)(∆) = φ(cid:48)(∆)+Φ(∆)+∆φ(∆)−1 = −∆φ(∆)+Φ(∆)+∆φ(∆)−1 = −(1−Φ(∆)) and g(cid:48)(cid:48)(∆) = φ(∆). As Φ(∆) ≤ 1, g(cid:48)(∆) ≤ 0 and g is monotonically decreasing. As g(cid:48)(cid:48)(∆) > 0, g is convex. and ∆2 = c2−µ2 = c2−(1−a)µ V . We let σ1 = σ1 σ2 σ1 σ2 Deriving by a We have: ∂∆1 ∂a = − µ σ1 and ∂∆2 ∂a = µ σ2 . Also, ∂Dev ∂a ∂g(∆1) (a, b) = σ1 = −σ1 ∂∆1 µ σ1 ∂∆1 ∂a + σ2 ∂g(∆2) ∂∆2 ∂a ∂∆2 µ σ2 [Φ(∆1) − 1] + σ2 [Φ(∆2) − 1] = µ [Φ(∆2) − Φ(∆1)] Since Φ is monotonic, a zero value is achieved when ∆1 = ∆2. Deriving again by a: ∂2Dev ∂a2 = µ [ ∂Φ(∆2) ∂∆2 ∂∆2 ∂a − ∂Φ(∆1) ∂∆1 ∂∆1 ∂a ] = µ2 [ φ(∆2) σ2 + φ(∆1) σ1 ] Since ∂2Dev ∂a2 (cid:62) 0, it follows that for any 0 < b < 1, Dev(a) is convex and hence ∆1 = ∆2 is a minimum point in this range. Deriving by b We have: ∂σ1 ∂b = ∆2 ∂∆2 2(1−b) . Now, √ ∂b = σ 2 and ∂σ2 ∂b = − σ √ 1−b 2 b . Also, ∂∆1 ∂b = − ∆1 2b and ∂Dev ∂b = = ∂g(∆1) ∂∆1 ∂σ1 g(∆1) + σ1 ∂b φ(∆1)√ σ 2 b − φ(∆2)√ 1 − b [ ] = Deriving a second time we get: ∂∆1 ∂b V 2 [ + ∂σ2 ∂b φ(∆1) σ1 g(∆2) + σ2 − φ(∆2) ] σ2 ∂g(∆2) ∂∆2 ∂∆2 ∂b ∂2Dev ∂b2 = = σ 2 σ 4 [ [ 1√ b √ φ(∆1) b b ∂φ(∆1) ∂∆1 ∂∆1 ∂b 1 − 1) + √ − 1 2b b √ φ(∆2) (1 − b) (∆2 φ(∆1) − (∆2 1 − b 1√ 1 − b 2 − 1)] ∂φ(∆2) ∂∆2 ∂∆2 ∂b − √ 1 2(1 − b) 1 − b φ(∆2) ] The Mixed Derivative ∂2Dev ∂b∂a = ∂ ∂b ∂Dev ∂a = [ µ[Φ(∆2) − Φ(∆1)] ] = µ [ ∂Φ(∆2) ∂∆2 − ∂Φ(∆1) ∂∆1 ∂∆1 ∂b ] = µ [φ(∆2) 2(1 − b) + φ(∆1) ∆1 2b ] = µ [ 1 2b ∆1φ(∆1) + ∆2φ(∆2)] ∂∆2 ∂b 1 2(1 − b) ∂ ∂b ∆2 The saddle point The Hessian of the function Dev contains the second order partial derivatives of Dev, i.e., it is a 2 × 2 matrix H, (cid:32) ∂2Dev (cid:33) H(a, b) = ∂a2 (a, b) ∂2Dev ∂a∂b (a, b) ∂2Dev ∂2Dev ∂b∂a (a, b) ∂b2 (a, b) H is symmetric and therefore at any point (a, b) the matrix H(a, b) has two real eigenvalues. Now, assume the first order derivatives of Dev vanish at some point (a0, b0). If the Hessian at that point (a0, b0) has negative determinant, then the product of these two eigenvalues is negative, and hence one is positive and the other negative. It then follows that the point (a0, b0) is a saddle point of Dev. 2 ) which is the center of the reflection symmetry. We know that at this point ∆1 = ∆2 and σ1 = σ2. If then follows that: We now compute the Hessian at the point (a0, b0) = ( 1 2D , 1 2 − c2−c1 (cid:19) (cid:18) 2 √ H(a0, b0) = 2 µ2 φ(∆1) 2 µ∆1φ(∆1) σ √ 2 µ∆1φ(∆1) 2 σ φ(∆1) [∆2 1 − 1] We can now compute the determinant: det[H(a0, b0)] = ∂2Dev (a0, b0) ∂a2 √ 2 µ2 φ(∆1) ∂2Dev ∂b2 √ = 2 = −4µ2[φ(∆1)]2 < 0. σ (a0, b0) − [ ∂2Dev ∂a∂b (a0, b0)]2 1 − 1] − 4µ2∆2 1 [φ(∆1)]2 2 σ φ(∆1) [∆2 As det[H(a0, b0)] < 0 and the partial derivatives of the first order vanish at (a0, b0) we conclude that (a0, b0) is a saddle point. H SP-MWOP H.1 Expected overflow probability of a single bin √ The overflow probability of bin j, denoted by OF PSj is OF PSj (µj, Vj) = 1 σj Substituting t = x−µj we get σj OF PSj (µj, Vj) = 1√ 2π e− t2 2 dt = 1 − Φ( cj − µj σj ) = 1 − Φ(∆j). (cid:90) ∞ cj−µj σj (cid:82) ∞ cj e 2π − (x−µj )2 2σ2 j dx. I SP-MOP I.1 Proof of Lemma 10 Proof. The condition ∂OF P ∂a = 0 is equivalent to σ1 σ2 2 , b < 1 − b and σ1 < σ2. Hence, φ(∆1) Φ(∆1) = As b < 1 · φ(∆2) Φ(∆2) φ(∆1) Φ(∆1) < φ(∆2) Φ(∆2) . Denote h(∆) = φ(∆) Φ(∆) . We will prove that h is monotone decreasing, and this implies that ∆1 > ∆2. To see that h is monotone decreasing define H(∆) = ln(Φ(∆)). Then h = H(cid:48). Therefore, h(cid:48) = H(cid:48)(cid:48). However, Φ is log-concave, hence H(cid:48)(cid:48) < 0. We conclude that h(cid:48) < 0 and h is monotone decreasing. J Unbalancing bin capacities is always better Suppose we are given a capacity budget c and we have the freedom to choose capacities c1, c2 that sum up to c for two bins. Which choice is the best? Off- hand, it is possible that for each input there is a different choice of c1 and c2 that minimizes the expected deviation. In contrast, we show that the minimum expected deviation always decreases as the difference c2 − c1 increases. Lemma 11. Given a capacity budget c, the minimum expected deviation de- creases as c2 − c1 increases. In particular the best choice is having a single bin with capacity c and the worst choice is splitting the capacities evenly between the two bins. Proof. Recall that ∆1(a, b) = c1−aµ √ reduce c1 by c and increase c2 by c, we get and ∆2(a, b) = c2−(1−a)µ 1−b . Therefore, if we √ σ b σ c1 − c − aµ √ c1 − (a − c µ )µ √ σ b = = ∆1(a − c µ , b). ∆1(a, b) = b Similarly, ∆2(a, b) = ∆2(a− c σ µ , b). Let Devc1,c2(a, b) denote the expected devi- ation with bin capacities c1, c2. As Dev(a, b) = σ1(b)g(∆1(a, b))+σ2(b)g(∆2(a, b)) we see that Devc1−c,c2+c(a, b) = Devc1,c2(a − c µ , b), i.e., the graph is shifted left by c µ . Notice that the bottom sorted path does not depend on the bin capacities and is the same in both cases. Let (a, b) be the optimal fractional solution for bin capacities c1, c2. We know that (a, b) is on the bottom sorted path. Let a = a− c µ . We know that Devc1−c,c2+c(a, b) = Devc1,c2 (a, b). The point (a, b) lies to the left of the bottom sorted path and therefore above it. As the optimal solution for bin capacities c1 − c, c2 + c is also on the bottom sorted path and is strictly better than any internal point, we conclude that the expected deviation for bin capacities c1 − c, c2 + c is strictly smaller than the expected deviation for bin capacities c1, c2. An immediate corollary is the trivial fact that putting all the capacity budget in one bin is best. Obviously, this is not always possible nor desirable, but if there is tolerance in each bin capacity, we recommend minimizing the number of bins.
1301.2626
1
1301
2013-01-11T23:01:15
Active Self-Assembly of Algorithmic Shapes and Patterns in Polylogarithmic Time
[ "cs.DS", "cs.CC", "cs.CG" ]
We describe a computational model for studying the complexity of self-assembled structures with active molecular components. Our model captures notions of growth and movement ubiquitous in biological systems. The model is inspired by biology's fantastic ability to assemble biomolecules that form systems with complicated structure and dynamics, from molecular motors that walk on rigid tracks and proteins that dynamically alter the structure of the cell during mitosis, to embryonic development where large-scale complicated organisms efficiently grow from a single cell. Using this active self-assembly model, we show how to efficiently self-assemble shapes and patterns from simple monomers. For example, we show how to grow a line of monomers in time and number of monomer states that is merely logarithmic in the length of the line. Our main results show how to grow arbitrary connected two-dimensional geometric shapes and patterns in expected time that is polylogarithmic in the size of the shape, plus roughly the time required to run a Turing machine deciding whether or not a given pixel is in the shape. We do this while keeping the number of monomer types logarithmic in shape size, plus those monomers required by the Kolmogorov complexity of the shape or pattern. This work thus highlights the efficiency advantages of active self-assembly over passive self-assembly and motivates experimental effort to construct general-purpose active molecular self-assembly systems.
cs.DS
cs
Active Self-Assembly of Algorithmic Shapes and Patterns in Polylogarithmic Time∗ Damien Woods1,2 Ho-Lin Chen1,2,7 Scott Goodfriend3 Nadine Dabby4 Erik Winfree1,4,5,6 Peng Yin1,5,6,8 Computer Science1 , Center for Mathematics of Information2 , Department of Chemical Engineering3 , Department of Computation and Neural Systems4 , Department of Bioengineering5 , Center for Biological Circuit Design6 , Caltech, Pasadena, CA 91125, U.S.A. Present address: Department of Electrical Engineering, National Taiwan University7 Present address: Wyss Institute for Biologically Inspired Engineering, 3 Blackfan Circle, Boston, MA 024458 Abstract We describe a computational model for studying the complexity of self-assembled structures with active molecular components. Our model captures notions of growth and movement ubiquitous in biological systems. The model is inspired by biology’s fantastic ability to assemble biomolecules that form systems with complicated structure and dynamics, from molecular motors that walk on rigid tracks and proteins that dynamically alter the structure of the cell during mitosis, to embryonic development where large-scale complicated organisms efficiently grow from a single cell. Using this active self-assembly model, we show how to efficiently self-assemble shapes and patterns from simple monomers. For example, we show how to grow a line of monomers in time and number of monomer states that is merely logarithmic in the length of the line. Our main results show how to grow arbitrary connected two-dimensional geometric shapes and patterns in expected time that is polylogarithmic in the size of the shape, plus roughly the time required to run a Turing machine deciding whether or not a given pixel is in the shape. We do this while keeping the number of monomer types logarithmic in shape size, plus those monomers required by the Kolmogorov complexity of the shape or pattern. This work thus highlights the efficiency advantages of active self-assembly over passive self-assembly and motivates experimental effort to construct general-purpose active molecular self-assembly systems. ∗Supported by NSF grants CCF-1219274, CCF-1162589, and 0832824—the Molecular Programming Pro ject, an NSF Graduate Fellowship, and The Caltech Center for Biological Circuit Design. 3 1 0 2 n a J 1 1 ] S D . s c [ 1 v 6 2 6 2 . 1 0 3 1 : v i X r a 1 Figure 1: (a) Increase in mass in embryonic mouse [29], cow [49], and human [45]. Gray lines highlight a time interval of exponential growth in each species. (b) An abstract example of exponential growth showing insertion and state change. 1 Introduction We propose a model of computation that takes its main inspiration from biology. Embryonic development showcases the capability of molecules to compute efficiently. A human zygote cell contains within it a compact program that encodes the geometric structure of an organism with roughly 1014 cells, that have a wide variety of forms and roles, with each such cell containing up to tens of thousands of proteins and other molecules with their own intricate arrangement and functions. As shown in Figure 1(a), early stages of embryonic development demonstrate exponential [45] growth rates in mass and number of cells over time, showing remarkable time efficiency. Not only this, but the developmental path from a single cell to a functioning organism is an intricately choreographed, and incredibly robust, temporal and spatial manufacturing process that operates at the molecular scale. Development is probably the most striking example of the ubiquitous process of molecular self-assembly, where relatively simple components (such as nucleic and amino acids, lipids, carbohydrates) organize themselves into larger systems with extremely complicated structure and dynamics (cells, organs, humans). To capture the potential for exponential growth during development, an abstract model must allow for growth by insertion and rearrangement of elements as well as for local state changes that store information that guides the process, as shown for example in Figure 1(b). Molecular programming, where nanoscale engineering is thought of as a programming task, provides our second motivation. The field has progressed to the stage where we can design and synthesize a range of programable self-assembling molecular systems, all with relatively simple laboratory techniques. For example, short DNA strands that form ‘tiles’ can be self-assembled into larger DNA tile crystals [79] that are algorithmically-patterned as counters or Sierpinski triangles [61, 8, 31, 9]. This form of passive self-assembly is theoretically capable of growing arbitrarily complex algorithmically described shapes and patterns. Indeed, the theory of algorithmic self-assembly serves as a guide to tell us what kinds of structures are possible, and interesting, to implement with DNA tiles. DNA origami can be used to create uniquely addressable shapes and patterns upon which ob jects can be localized within six nanometer resolution [62]. These DNA tile and origami systems are 2 0510152025303540455010−810−710−610−510−410−310−210−1100time (in days)log(mass in grams) mouse embryo eyecow embryohuman embryo(a)(b) static, in the sense that after formation their structure is essentially fixed. However, DNA nanotechnology has seen increased interest in the fabrication of active nanostructures that have the ability to dynamically change their structure [11]. Examples include DNA-based walkers [10, 34, 35, 46, 52, 66, 67, 71, 81, 82], DNA origami that reconfigure [6, 36, 48], and simple structures called molecular motors that transition between a small number of discrete states [15, 22, 28, 33, 42, 44, 47, 72, 73, 83, 84]. In these systems the interplay between structure and dynamics leads to behaviors and capabilities that are not seen in static structures, nor in other well-mixed chemical reaction network type systems. Here we suggest a model to motivate engineering of molecular structures that have complicated active dynamics of the kind seen in living biomolecular systems. Our model combines features seen in passive DNA-based tile self-assembly, molecular motors and other active systems, molecular circuits that evolve according to well-mixed chemical kinetics, and even reaction-diffusion systems. The model is designed to capture the interplay between molecular structure and dynamics. In our model, simple molecular components form assemblies that can grow and shrink, and individual components undergo state changes and move relative to each other. The model consists of a two-dimensional grid of monomers. A specified set of rules, or a program, directs adjacent monomers to interact in a pairwise fashion. Monomers have internal states, and a pair of adjacent monomers can change their state with a single rule application. Monomers can appear and disappear from the grid. So far, the model can be thought of as a cellular automaton of a certain kind (that is, a cellular automaton where rules are applied asynchronously and are nondeterministic, and there is a notion of a growth front). An additional rule type allows monomers to move relative to each other. The movement rule is locally applied but propagates movement throughout the system in very non-local fashion. This geometric and mechanical feature distinguishes our model, the nubot model, from previous molecular models and cellular automata, and, as we show in this paper, crucially underlies its construction efficiency. The system evolves as a continuous time Markov process, with rules being applied to the grid asynchronously and in parallel using standard chemical kinetics, modeling the distributed nature of molecular reactions. The model can carry out local state changes on a grid, so it can easily simulate Turing machines, walkers and cellular automata-like systems. We show examples of other simple programs such as robotic molecular arms that can move distance n in expected time O(log n), something that can not be done by cellular automata. By using a combination of monomer movement, appearance, and state change we show how to build a line of monomers in time that is merely logarithmic in the length of the line, something that is provably impossible in the (passive) abstract tile assembly model [2]. We go on to efficiently build a binary counter (a program that counts builds an n × log2 n rectangle while counting from 0 to n − 1), within time and number of monomer states that are both logarithmic in n, where n is a power of 2. We build on these results to show that the model is capable of building wide classes of shapes exponentially faster than passive self-assembly. We show how to build a computable shape of size ≤ n × n in time polylogarithmic in n, plus roughly the time 3 needed to simulate a Turing machine that computes whether or not a given pixel is in the final shape. Our constructions are not only time efficient, but efficient in terms of their program-size: requiring at most polylogarithmic monomer types in terms of shape size, plus that required by the Kolmogorov complexity of the shape. For shapes of size ≤ n × n that require a lot (i.e. > n) of time and space to compute their pixels on a Turing machine, the previous computable shape construction requires (temporary) growth well beyond the shape boundary. One can ask if there are interesting structures that we can build efficiently, but yet keep all growth “in-place”, that is, confined within the boundary. It turns out that colored patterns, where the color of each pixel in the pattern is computable by a polynomial time Turing machine, can be computed extremely efficiently in this way. More precisely, we show that n × n colored patterns are computable in expected time O(log(cid:96)+1 n) and using O(s + log n) states, where each pixel’s color is computable by a program-size s Turing machine that runs in polynomial time in the length of the binary description of pixel indices (specifically, in time O(log(cid:96) n) where (cid:96) is O(1)). Thus the entire pattern completes with only a linear factor slowdown in Turing machine time (i.e. log n factor slowdown). Furthermore this entire construction is initiated by a single monomer and is carried out using only local information in an entirely distributed and asynchronous fashion. Essentially, our constructions serve to show that shapes and patterns that are expo- nentially larger than their description length can be fabricated in polynomial time, with a linear number of states, in their description length, besides the states that are required by the Kolmogorov complexity of the shape. Our active self-assembly model is intentionally rather abstract, however our results show that it captures some of the features seen in the biological development of organisms (exponential growth—with and without fast communication over long distances, active yet simple components) as well those seen in many of the active molecular systems that are currently under development (for example, DNA walkers, motors and a variety of active systems that exploit DNA strand displacement). Also, the proof techniques we use, at a very abstract level, are informed by natural processes. In the creation of a line, a simple analog of cell division is used; division is also used in the construction of a binary counter along with a copying (with minor modifications) process to create new counter rows; in the assembly of arbitrary shapes we use analogs of protein folding and scaffold-based tissue engineering; for the assembly of arbitrary patterns we were inspired by biological development where growth and patterning takes places in a bounded region (e.g. an egg or womb) and where many parts of the development of a single embryo occur in an independent and seemingly asynchronous fashion. Section 2 contains the detailed definition of our nubot model, which is followed by a number of simple and intuitive examples in Section 3. Section 4 gives a polynomial time algorithm for simulating nubots rule applications, showing that the non-local movement rule is in a certain sense tractable to simulate and providing a basis for a software simulator we have developed. In Section 5 we show how to grow lines and squares in time logarithmic 4 in their size. This section includes a number of useful programming techniques and analysis tools for nubots. In Sections 6 and 7 we give our main results: building arbitrary shapes and patterns, respectively, in polylogarithmic time in shape/pattern size (plus the worst-case time for a Turing machine to compute a single pixel) and using only a logarithmic number of states (plus the Kolmogorov complexity of the shape/pattern). Section 8 contains a number of directions for future work. 1.1 Related work Although our model takes inspiration from natural and artificial active molecular processes, it posesses a number of features seen in a variety of existing theoretical models of computation. We discuss some such related models here. The tile assembly model [75, 76, 63] formalizes the self-assembly of molecular crystals [61] from square units called tiles. This model takes the Wang tiling model [74], which is a model of plane-tilings with square tiles, and restricts it by including a natural mechanism for the growth of a tiling from a single seed tile. Self-assembly starts from a seed tile that is contained in a soup of other tiles. Tiles with matching colors on their sides may bind to each other with a certain strength. A tile can attach itself to a partially-formed assembly of tiles if the total binding strength between the tile and the assembly exceeds a prescribed system parameter called the temperature. The assembly process proceeds as tiles attach themselves to the growing assembly, and stops when no more tile attachments can occur. Tile assembly is a computational process: the exposed edges of the growing crystal encode the state information of the system, and this information is modified as a new tiles attach themselves to the crystal. In fact, tile assembly can be thought of as a nondeterministic asynchronous cellular automaton, where there is a notion of a growth starting from a seed. Tile assembly formally couples computation with shape construction, and the shape can be viewed as the final output of the tile assembly “program”. The model is capable of universal computation [75] (Turing machine simulation) and even intrinsic universality [26] (there is a single tile set that simulates any tile assembly system). Tiles can efficiently encode shapes, in the sense that there is a close link between the Kolmogorov complexity of an arbitrary, scaled, connected shape and the number of tile types required to assemble that shape [69]. There have been a wide selection of results on clarifying what shapes can and can not be constructed in the tile assembly model, with and without resource constraints on time and the number of required tile types (e.g. see surveys [55, 24]), showing that the tile assembly model demonstrates a wide range of computational capabilities. There have been a number of interesting generalizations of the tile assembly model. These include the two-handed, or hierarchical, tile assembly model where whole assemblies can bind together in a single step [3, 18, 14], the geometric model where the sides of tiles have jigsaw-piece like geometries [30], rotatable and flipable polygon and polyomino tiles [19], and models where temperature [3, 38, 70], concentration [12, 16, 39, 23] or mixing stages [18, 20] are programmed. All of these models could be classed as passive in the sense 5 that after some structure is grown, via a crystal-like growth process, the structure does not change. Active tile assembly models include the activatable tile model where tiles pass signals to each other and can change their internal ‘state’ based on other tiles that join to the assembly [53, 54, 37]. This interesting generalization of the tile assembly model is essentially an asynchronous nondeterministic cellular automaton of a certain kind, and may indeed be implementable using DNA origami tiles with strand displacement signals [53, 54]. There are also models of algorithmic self-assembly where after a structure grows, tiles can be removed, such as the kinetic tile-assembly model [77, 78, 17] (which implements the chemical kinetics of tile assembly) and the negative-strength glue model [25, 59, 56], or the RNAse enzyme model [1, 57, 21]. Although these models share properties of our model including geometry and the ability of tile assemblies to change over time, they do not share our notion of movement, something that is fundamental to our model and sets it apart from models that can be described as asynchronous nondeterministic cellular automata. As a model of computation, stochastic chemical reaction networks are computationally universal in the presence of non-zero, but arbitrarily low, error [7, 68]. Our model crucially uses ideas from stochastic chemical reaction networks. In particular our update rules are all unimolecular or bimolecular (involving at most 1 or 2 monomers per rule) and our model evolves in time as a continuous time Markov process; a notion of time we have borrowed from the stochastic chemical reaction network model [32]. Our active-self assembly model is capable of building and reconfiguring structures. The already well-established field of reconfigurable robotics is concerned with systems composed of a large number of (usually) identical and relatively simple robots that act cooperatively to perform a range of tasks beyond the capability of any particular special-purpose robot. Individual robots are typically capable of independent physical movement and collectively share resources such as power and computation [51, 64, 80]. One standard problem is to arrange the robots in some arbitrary initial configuration, specify some desired target configuration, and then have the robots collectively carry out the required reconfiguration from source to target. Crystalline reconfigurable robots [13, 64] have been studied in this way. This model consists of unit-square robots that can extend or contract arms on each of four sides and attach or detach from neighbors. For this model, Aloupis et al [5] give an algorithm for universal reconfiguration between a pair of connected shapes that works in time merely logarithmic in shape size. As pointed out by Aloupis et al in a subsequent paper [4], this high-speed reconfiguration can lead to strain on individual components, but they show that if each robot can displace at most a constant number of other robots, and reach at most constant velocity, then there is an optimal Θ(n) parallel time reconfiguration √ algorithm (which also has the desired property of working “in-place”). Reif and Slee [60] also consider physicaly constrained movement, giving an optimal Θ( n) reconfiguration algorithm where at most constant acceleration, but up to linear speed, is permitted. Like our nubot model, these models and algorithms implement fast parallel reconfiguration. However, here we intentionally focus on growth and reconfiguration algorithms that use very few states (typically logarithmic in assembly size) to model the fact that molecules are simple 6 and ‘dumb’—however, in reconfigurable robotics it is typically the case that individual robots can store the entire desired configuration. Our model also has other properties that don’t always make sense for macro-scale robots such as growth and shrinkage (large numbers of monomers can be created and destroyed), a presumed unlimited fuel source, asynchronous independent rule updates and Brownian motion-style agitation. Nevertheless we think it will make interesting future work to see what ideas and results from reconfigurable robotics apply to a nanoscale model and what do not. Klavins et al [40, 41] model active self-assembly using conformational switching [65] and graph grammars [27]. In such work, an assembly is a graph, which can be modified by graph rewriting rules that add or delete vertices or edges. Thus the model focuses attention on the topology of assemblies. Besides permitting the assembly of static graph structures, other more dynamic structures—such as a walker subgraph that moves around on a larger graph— can be expressed. Our model also has the ability to change structure and connectivity in a way that takes inspiration from such systems, but additionally includes geometric constraints by virtue of the fact that it lives on a two-dimensional grid. Lindenmayer systems [43] are another model where a graph-like structure is modified via insertion and addition of nodes, and where it is possible to generate beautiful movies of the growth of ferns and other plants [58]. Although it is indeed a model of (potentially fast) growth via insertion of nodes, it is quite different in a number of ways from our own model. 2 Nubot model description Figure 2: (a) A monomer in the triangular grid coordinate system. (b) Examples of monomer interaction rules, written formally as follows: r1 = (1, 1, null, (cid:126)x) → (2, 3, null, (cid:126)x), r2 = (1, 1, null, (cid:126)x) → (1, 1, flexible, (cid:126)x), r3 = (1, 1, rigid, (cid:126)x) → (1, 1, null, (cid:126)x), r4 = (1, 1, rigid, (cid:126)x) → (2, 3, flexible, (cid:126)x), r5 = (b, empty, null, (cid:126)x) → (1, 1, flexible, (cid:126)x), r6 = (1, a, rigid, (cid:126)x) → (1, empty, null, (cid:126)x), and r7 = (1, 1, rigid, (cid:126)x) → (1, 2, rigid, (cid:126)y). For rule r7, the two potential symmetric movements are shown corresponding to two choices for arm and base, one of which is nondeterministically chosen. This section contains the model definition. We also give a number of simple example constructions in Section 3, which may aid the reader here. The model uses a two-dimensional triangular grid with a coordinate system using axes x and y as shown in Figure 2(a). For notational convenience we define a third axis w, that 7 11(0,0)xyw(1,0)(2,0)(0,1)(0,2)(1,1)pp + yp + wp + xp - xp - wp - yabChange states1123Make a flexible bond111111Break a rigid bond2311Change a rigid bond to a flexible bond and change states1211Movement in the w directionwBaseArm11Appearanceb1aDisappearance1ABAB1211Movement in the -w direction-wBaseArmABAB r1 r2 r3 r4 r5 r6 r7 r7 runs through the origin and parallel to the vector (cid:126)w in Figure 2(a), but only axes x and y are used to define coordinates. In the vector space induced by this coordinate system, the axial directions D = { (cid:126)w, − (cid:126)w, (cid:126)x, −(cid:126)x, (cid:126)y , −(cid:126)y} are the unit vectors along the grid axes. A pair (cid:126)p ∈ Z2 is called a grid point and has the set of six neighbors {(cid:126)p + (cid:126)u (cid:126)u ∈ D}. The basic assembly unit is called a nubot monomer. A monomer is a pair X = (sX , (cid:126)p(X )) where sX ∈ Σ is one of a finite set of states and (cid:126)p(X ) ∈ Z2 is a grid point. Each grid point contains zero or one monomers. Monomers are depicted as state-labelled disks of unit diameter centered on a grid point. In general, a nubot is a collection of nubot monomers. Two neighboring monomers (i.e. residing on neighboring grid points) are either connected by a flexible bond or a rigid bond, or else have no bond between them (called a nul l bond). A flexible bond is depicted as a small empty circle and a rigid bond is depicted as a solid disk. Flexible and rigid bonds are described in more detail in Definition 2.2. A connected component is a maximal set of adjacent monomers where every pair of monomers in the set is connected by a path consisting of monomers bound by either flexible or rigid bonds. A configuration C is defined to be a finite set of monomers at distinct locations and the bonds between them, and is assumed to define the state of an entire grid at some time instance. A configuration C can be changed either by the application of an interaction rule or by a random agitation, as we now describe. 2.1 Rules Two neighboring monomers can interact by an interaction rule, r = (s1, s2, b, (cid:126)u) → (s1(cid:48) , s2(cid:48) , b(cid:48) , (cid:126)u(cid:48) ). To the left of the arrow, s1, s2 ∈ Σ ∪ {empty} are monomer states, at most one of s1, s2 is empty (denotes lack of a monomer), b ∈ {flexible, rigid, null} is the bond type between them, and (cid:126)u ∈ D is the relative position of the s2 monomer to the s1 monomer. If either of s1, s2 is empty then b is null, also if either or both of s1(cid:48) , s2(cid:48) is empty then b(cid:48) is null. The right is defined similarly, although there are some restrictions on the rules (involving (cid:126)u(cid:48) ) which are described below. The left and right hand sides of the arrow respectively represent the contents of the two monomer positions before and after the application of rule r . In summary, via suitable rules, adjacent monomers can change states and bond type, one or both monomers can disappear, one can appear in an empty space, or one monomer can move relative to another by unit distance. A rule is only applicable in the orientation specified by (cid:126)u, and so rules are not rotationally invariant. The rule semantics are defined next, and a number of examples are shown in Figure 2b. A rule may involve a movement (translation), or not. First, let us consider the case where there is no movement, that is, where (cid:126)u = (cid:126)u(cid:48) . Thus we have a rule of the form r = (s1, s2, b, (cid:126)u) → (s1(cid:48) , s2(cid:48) , b(cid:48) , (cid:126)u). From above, we have the restriction that at most one of s1, s2 is the special empty state (hence we disallow spontaneous generation of monomers from completely empty space). State change and bond change occurs in a straightforward way and a few examples are shown in Figure 2b. If si ∈ {s1, s2} is empty and s(cid:48) i is not, 8 then the rule induces the appearance of a new monomer. If one or both monomers go from being non-empty to being empty, the rule induces the disappearance of monomer(s). A movement rule is an interaction rule where (cid:126)u (cid:54)= (cid:126)u(cid:48) . More precisely, in a movement rule d((cid:126)u, (cid:126)u(cid:48) ) = 1, where d(u, v) is Manhattan distance on the triangular grid, and none If we fix (cid:126)u ∈ D, then there are exactly two (cid:126)u(cid:48) ∈ D that of s1, s2, s1(cid:48) , s2(cid:48) is empty. satisfy d((cid:126)u, (cid:126)u(cid:48) ) = 1. A movement rule is applied as follows. One of the two monomers is nondeterministically chosen to be the base (which remains stationary), the other is the arm (which moves). If the s2 monomer, denoted X , is chosen as the arm then X moves from its current position (cid:126)p(X ) to a new position (cid:126)p(X ) − (cid:126)u + (cid:126)u(cid:48) . After this movement (and potential state change), (cid:126)u(cid:48) is the relative position of the s2(cid:48) monomer to the s1(cid:48) monomer, as illustrated in Figure 2b. If the s1 monomer, Y , is chosen as the arm then Y moves from (cid:126)p(Y ) to (cid:126)p(Y ) + (cid:126)u − (cid:126)u(cid:48) . Again, (cid:126)u(cid:48) is the relative position of the s2(cid:48) monomer to the s1(cid:48) monomer. Bonds and states can change during the movement, as dictated by the rule. However, we are not done yet, as during a movement, the translation of the arm monomer A by a unit vector may cause the translation of a collection of monomers, or may in fact be impossible; to describe this phenomenon we introduce two definitions. The (cid:126)v -boundary of a set of monomers S is defined to be the set of grid locations located unit distance in the (cid:126)v direction from the monomers in S . Definition 2.1 (Agitation set) Let C be a configuration containing monomer A, and let (cid:126)v ∈ D be a unit vector. The agitation set A(C, A, (cid:126)v) is defined to be the minimal monomer set in C containing A that can be translated by (cid:126)v such that: (a) monomer pairs in C that are joined by rigid bonds do not change their relative position to each other, (b) monomer pairs in C that are joined by flexible bonds stay within each other’s neighborhood, and (c) the (cid:126)v-boundary of A(C, A, (cid:126)v) contains no monomers. It can be seen that for any non-empty configuration the agitation set is always non-empty. Using this definition we define the movable set M(C, A, B , (cid:126)v) for a pair of monomers A, B , unit vector (cid:126)v and configuration C . Essentially, the movable set is the minimal set that can be moved without disrupting existing bonds or causing collisions with other monomers. Definition 2.2 (Movable set) Let C be a configuration containing adjacent monomers A, B , let (cid:126)v ∈ D be a unit vector, and let C (cid:48) be the same configuration as C except that C (cid:48) omits any bond between A and B . The movable set M(C, A, B , (cid:126)v) is defined to be the agitation set A(C (cid:48) , A, (cid:126)v) if B (cid:54)∈ A(C (cid:48) , A, (cid:126)v), and the empty set otherwise. Figure 3 illustrates this definition with two examples. Now we are ready to define what happens upon application of a movement rule. If M(C, A, B , (cid:126)v) (cid:54)= {}, then the movement where A is the arm (which should be translated by (cid:126)v) and B is the base (which should not be translated) is applied as follows: (1) the movable set M(C, A, B , (cid:126)v) moves unit distance along (cid:126)v ; (2) the states of, and the bond between, A and B are updated according to the rule; (3) the states of all the monomers besides A and B remain unchanged and pairwise bonds remain intact (although monomer positions and bond orientations may change). 9 Figure 3: Two movable set examples. (a) The movement rule is (a, a, rigid, − (cid:126)w) → (c, c, rigid, (cid:126)x), where the rightmost of the two monomers is nondeterministically chosen as the arm. (b) Example with a non-empty movable set. (b1) Current configuration of the system. (b2) Computation of the movable set. The movable set is highlighted in green, and numbers in parentheses indicate the sequence of incorporation of monomers into the movable set via Algorithm 4.1. Monomers move as shown in (b3). Finally, (b4) shows the configuration of the system after the application of the movement rule. (c) Example with an empty movable set. (c1) A configuration that is identical to the configuration in b1, except for a single rigid bond highlighted in black. (c2) Algorithm 4.1 completes at the pink monomer, which is blocked by the base monomer B , and hence returns an empty movable set. Thus the movement rule can not be applied. If M(C, A, B , (cid:126)v) = {}, the movement rule is inapplicable (the pair of monomers A, B are “blocked” and thus A is prevented from translating). Section 4 describes a greedy algorithm for computing the movable set M(C, A, B , (cid:126)v) in time linear in assembly size. We note that flexible bonds are not required for any of the constructions in this paper (they are used in the construction in Figure 11 but they can be removed if we add extra monomers and rules), however we retain this aspect of the model because we anticipate that flexible bonds will be useful for future studies. 2.2 Agitation Agitation is intended to model movement that is not a direct consequence of a rule application, but rather results from diffusion, Brownian motion, turbulent flow or other undirected inputs of energy. An agitation step, applies a unit vector movement to a monomer. This monomer 10 aArmBaseuPosition change rule:aaccMovable set emptyA(1)(2)(3)(4)(5)(6)(7)B(4)b2A(1)(2)(3)(4)(5)(6)(7)B(4)c2b3A(1)(2)(3)(4)(5)(6)(7)B(4)b4ccbbbbbbbbbbbbbbbbbbbbbbaaCurrent configurationbbbbbbbbbbbbbbbbbbbbbbb1c1aaCurrent configurationbbbbbbbbbbbbbbbbbbbbbb=> rule is not applied then moves, possibly along with many other monomers in a way that does not break rigid nor flexible bonds. More precisely, applying a (cid:126)v ∈ D agitation step to monomer A causes the agitation set A(C, A, (cid:126)v) (Definition 2.1) to move by vector (cid:126)v . During agitation, the only change in the system configuration is in the positions of the constituent monomers in the diffusing component, and all the monomer states and bond types remain unchanged. None of the constructions in this paper exploit agitation, and all work correctly regardless of its presence or absence (due to the fact that our constructions are stable, see below). However, we feel it is important enough to be considered as part of the model definition. We leave open the possibility of designing interesting systems that exploit agitation (e.g. by having components interact by drifting into each other as is typical in a molecular-scale environment). 2.3 Stability The following definition is useful for proving correctness of many of our constructions. Definition 2.3 (Stable) A configuration C is stable if for al l monomers A in C and for al l 6 unit vectors (cid:126)v ∈ D, the agitation set A(C, A, (cid:126)v) is the entire set of monomers in C . In other words, translating any monomer by any of the 6 unit vectors in D results in the translation of the entire set. This happens when monomers have a bond structure such that under agitation all monomers move together unit distance, and their relative positions remain unchanged. Hence, stable configurations have a bond structure that allows the entire structure to be “pushed” or “pulled” around by the movement of any individual monomer, without changing the relative location of any monomer to any other monomer in the configuration. Essentially, this can be used as a tool to show that a structure does not unintentionally become disconnected or end up in an unintended configuration. This is a very useful property when proving the correctness and carrying out time analysis of our constructions, and is extensively used in this paper. 2.4 System evolution An assembly system T = (C0 , R) is a pair where C0 is the initial configuration, and R is the set of interaction rules. Consider two configurations Ci and Cj . If Cj can be derived from Ci by a single step agitation, we write Ci (cid:96)A Cj . Let the relation (cid:96)∗ A be the reflexive transitive closure of (cid:96)A . If Ci (cid:96)∗ A Cj , then Ci and Cj are called isomorphic configurations, ∼= Cj . (Notice that the relative position of monomers may differ for which is denoted as Ci two isomorphic configurations, although their connectivity is identical.) If Cj can be derived from Ci by a single application of a rule r ∈ R, we write Ci (cid:96)r Cj . If Ci transitions to Cj by either a single agitation step or a single application of some rule r ∈ R, we write Ci (cid:96)T Cj . Let the relation (cid:96)∗ T be the reflexive transitive closure of (cid:96)T . The set of configurations that can be produced by an assembly system T = (C0 , R) is Prod(T ) = {C C0 (cid:96)∗ T C }. The set D}. of terminal configurations are Term(T ) = {C C ∈ Prod(T ) and (cid:64) D (cid:29) C s.t. C (cid:96)∗ T 11 An assembly system T uniquely produces C if ∀ D ∈ Term(T ), C ∼= D. A trajectory is a finite sequence of configurations C1 , C2 , . . . , Ck where Ci (cid:96)T Ci+1 and 1 ≤ i ≤ k − 1. An assembly system evolves as a continuous time Markov process. For simplicity, when counting the number of applicable rules for a configuration, a movement rule is counted twice, to account for the two symmetric choices of arm and base. If there are k applicable transitions for a configuration Ci (i.e. k is the sum of the number of rule and agitation steps that can be applied to all monomers), then the probability of any given transition being applied is 1/k , and the time until the next transition is an exponential random variable with rate k (i.e. the expected time is 1/k). The rate for each rule application and agitation step is 1 in this paper (although more sophisticated rate choices can be accommodated by of the expected times of each transition in the tra jectory. Thus, (cid:80) the model). The probability of a tra jectory is then the product of the probabilities of each of the transitions along the tra jectory, and the expected time of a tra jectory is the sum t∈T Pr[t]time(t) is the expected time for the system to evolve from configuration Ci to configuration Cj , where T is the set of all tra jectories from Ci to any configuration isomorphic to Cj , that do not pass through any other configuration isomorphic to Cj , and time(t) is the expected time for tra jectory t. The following lemma is useful for the time analysis of the constructions in this paper. Lemma 2.4 Given an assembly system T in which al l configurations in Prod(T ) have at most one stable connected component, the expected time from configuration Ci to configura- tion Cj is the same with or without agitation steps. Proof: Assembly system T has a corresponding Markov process M . We consider another Markov process M (cid:48) . Each state SC in M (cid:48) corresponds to all configurations in Prod(T ) that are isomorphic to a particular configuration C , which by hypothesis are all stable. For each transition in M from configuration Cx to Cy , there is also a transition from SCx to SCy with the same transition rate. The expected time from configuration Ci to configuration Cj in the assembly system T is the same as the expected time from state SCi to first reach SCj in Markov process M (cid:48) since every tra jectory in M corresponds to a tra jectory in M (cid:48) . Furthermore, all agitation steps in T corresponds to self-loops in M (cid:48) . Therefore, removing the agitation steps in T is equivalent to removing some self-loops in M (cid:48) and does not change 2 the expected time to transition from one state to another. Since all of our constructions satisfy the assumption that all producible configurations have only a single connected stable component, we ignore agitation steps in the time analysis of the constructions in this paper. 3 Examples Figures 4 to 8 show a number of examples. Figure 4 depicts a simple assembly system that grows a line of monomers. Figure 4b shows the initial configuration C0 , which consists 12 Figure 4: Growth of a linear chain. (a) Rule set: Rk = {ri ri = (i, empty, null, (cid:126)x) → (0, i − 1, rigid, (cid:126)x), where 0 < i ≤ k}. (b) Initial configuration of the system. (c) Evolution of a system tra jectory over time. of a single monomer with state k ∈ N. This system evolves as shown in Figure 4c, and uniquely produces a linear chain with k + 1 monomers, with each monomer having a final state of 0. Since the system involves k sequential events each with unit expected time, it takes expected time k to complete. Figure 5: Autonomous unidirectional motion of a walker along a linear track. (a) Rule set: r1 = (1, 1, null, − (cid:126)w) → (2, 1, rigid, − (cid:126)w), r2 = (1, 2, rigid, (cid:126)y) → (1, 1, null, (cid:126)y), and r3 = (1, 1, rigid, (cid:126)w) → (1, 1, rigid, (cid:126)y). (b) Evolution of an example initial configuration. (c) A subroutine abstraction. Figure 5 depicts the autonomous unidirectional motion of a single-monomer “walker” along a linear track of monomers. It takes O(n) expected time for a monomer to move n steps. The rules depicted in Figure 5a implement the subroutine depicted in Figure 5c. Figure 6 describes insertion of a single monomer between two other monomers, which occurs in constant expected time. Figure 7 describes the rotation of a long arm. As the motion of each monomer is independent of the motion of the other monomers, it takes O(log n) expected time to complete the rotation of an arm of n monomers. Interestingly, this example captures a kind of movement and speed that is impossible to achieve with cellular automata, but has an analog in reconfigurable robotics [5]. Figure 8 shows a simple Turing machine example. The Turing machine program is stored in the rule set and directs the tape head monomer to walk left or right, and to update the relevant tape monomer. The Turing machine state is stored in the tape monomer, currently the Turing machine is in state q . If the Turing machine requires a longer tape, new tape cell monomers are created to the left or right of the end of tape marker B . This example shows that the model is capable of algorithmically directed behavior. 13 Initial configurationRules:ki0i-1r_iabwhere i > 0System evolutionkc0k-1r_kr_k-100k-2r_k-2r10000Unique terminal configurationA linear chain of k+1 monomers1111121111111111Rules:Execution:a111111Subroutine:cu1211r22111r11111ur3r2r1r3bInitial configurationUnique terminal configuration1111r1r3 Figure 6: Insertion of a single monomer between two others. (a) Rule set: r1 = (1, empty, null, (cid:126)y) → (1.1, 0, rigid, (cid:126)y), r2 = (0, x, null, − (cid:126)w) → (0, x.1, rigid, − (cid:126)w), r3 = (1.1, x.1, rigid, (cid:126)x) → (1.1, x.1, null, (cid:126)x), r4 = (0, x.1, rigid, − (cid:126)w) → (0.1, x.1, rigid, (cid:126)x), r5 = (1.1, 0.1, rigid, (cid:126)y) → (2, 2, rigid, (cid:126)x), and r6 = (2, x.1, rigid, (cid:126)x) → (2, x, rigid, (cid:126)x). (b) Evolution of an example initial configuration. (c) A subroutine abstraction. Figure 7: Rotation of a long arm. (a) Rule set: r1 = (1, 1, rigid, (cid:126)w) → (1, 1, rigid, (cid:126)y). (b) Evolution of an example initial configuration to a terminal configuration. (c) A subroutine abstraction. 4 System simulation In this section we show that there is an algorithm that simulates one of the tra jectories of an assembly system in time O(tn2 ) where t is the number of configuration transitions in the tra jectory and n is the maximum number of monomers of any configuration in the tra jectory. This shows that simulation of individual tra jectories is tractable in terms of the number of rule applications, and in terms of the number of monomers.1 In fact, it is not difficult to imagine other variations on the model where simulation of a single, non-local, rule is an intractable problem. The existence of our algorithm gives evidence that our rules, in particular the movement rule, are in some sense reasonable. 1This forms the basis of our software simulator for the model. 14 Subroutine:Rules:1x1.1x01.1x.101.1x.101.1x.10.122x.122x1x22xr1r2r3r4r5r6x0x.10r22x.12xr611.10r11.1x.11.1x.1r3-w1.10.122r5x.10x.10.1r4yExecutionacbInitial configurationUnique terminal configurationRules:Subroutinec11111111111111111111xr1aExecution:br11111111111111111r1r1r11111111111111111Initial configurationUnique terminal configuration Figure 8: Turing machine example. The Turing machine program is stored in the rule set. New tape monomers can be created as needed. 4.1 Simulation of a single step The continuous-time Markov process that describes a tra jectory is simulated using a discrete time-algorithm. Essentially, the algorithm examines the grid contents and using a local neighborhood of radius 2, a list of potentially applicable rules are generated. The list also contains 6n potentially applicable agitation steps (6 directions for each of the n monomers). All of this can be done in O(n) time. The algorithm then, uniformly at random, picks an event from the list to apply, if the rule or agitation step can indeed be applied the grid contents are updated accordingly. Besides the movement rules and agitation steps, the other rule types can be easily simulated in time O(n), since at most two grid sites are affected. As described below, movement is simulated in time O(n2 ). Hence a single step is simulated in time O(n2 ). Due to its non-local nature, the movement rule is the most complicated rule type to simulate. Algorithm 4.1 below calculates the moveable set for a given movement rule in time O(n). We may have to try this algorithm < n times before we can find a non-empty movable set and can apply a movement rule, or decide that there is no applicable movement rule. Applying a rule simply involves translating < n monomers by unit distance, which can be done in O(n) time. Hence movement can be simulated in O(n2 ) time. Agitation is simulated similarly. 4.2 Computing the movable set We describe a greedy algorithm for computing the movable set M(C, A, B , (cid:126)v) of monomers for a movement rule where C is a configuration, A is an arm monomer, B is a base monomer and (cid:126)v ∈ D the unit vector describing the translation of A. The algorithm takes time linear in the number of monomers. Figure 3 shows two examples of computing the movable set. Algorithm 4.1 Compute movable set M(C, A, B , (cid:126)v). • Step 1. Let M ← {A}, F ← {A}, B ← {}. • Step 2. Compute the blocking set B for the frontier set F along (cid:126)v , as fol lows. For each monomer X ∈ F , do: 15 qBB1110000tape headtapeend of tape symboltape cell 1. If (cid:126)p(X ) + (cid:126)v is occupied by Y /∈ M, then B = B ∪ {Y }; 2. If X is bonded to Y /∈ M, and if translating X by (cid:126)v without translating Y would disrupt the bond between X and Y , then B = B ∪ {Y }; (Ignore the special case where X = A, Y = B ). • Step 3. Inspect the blocking set: 1. If B ∈ B, return {}; 2. If B = {}, return M; 3. Otherwise, let M ← M ∪ B, F ← B, B ← {}, and go to Step 2. Lemma 4.2 Algorithm 4.1 identifies the movable set M(C, A, B , (cid:126)v) in time O(n), where n is the number of monomers in C . Proof: To argue that the algorithm identifies the movable set we consider two cases: the algorithm completes with (1) a non-empty set, and (2) an empty set. In Case (1) when the algorithm completes with a non-empty set M, we only need to prove the following claims: (1.1) M contains A but not B , (1.2) M can move unit distance along (cid:126)v without causing monomer collision nor bond disruption, and (1.3) M is the minimal set that satisfies (1.1) and (1.2). Claim (1.1) follows directly from step 1 and step 3.1. To prove Claim (1.2), assume, for contradiction, that there exists a monomer Y /∈ M that blocks a monomer X ∈ M. Therefore, when X gets first incorporated into M, Y must be incorporated into M in the next round of execution of step 2. This contradicts Y /∈ M. Therefore, Claim (1.2) must be true. To prove Claim (1.3), assume, for contradiction, that there exists a set C ⊂ M, A ∈ C such that C can move by (cid:126)v . The first monomer in M \ C that gets incorporated in M must block some monomer in C , which contradicts that C can move a unit distance along (cid:126)v . Therefore, Claim (1.3) holds. In Case (2), we know from Claim (1.3) that any movable set that contains A must contain every monomer in M and thus contain B . Therefore, the movable set must be 2 empty. We note that the nondeterministic choice of which monomer is the arm and which is the base can make a difference in the resulting configuration: for example switching the arm and base monomers in Figure 3a will induce a different movable set. In this paper we do not exploit such asymmetric nondeterministic choices. 5 Efficient growth of simple shapes: lines and squares In this section, we show how to efficiently construct lines and squares in time and number of monomer types logarithmic in shape size. We give a fast (logarithmic time) method to 16 Figure 9: Building a line of length n ∈ N by decomposing into O(log n) lines whose lengths are distinct powers of 2. synchronize a line of monomers: the procedure detects in logarithmic time in line length whether all monomers in the line are in the same state. We also give a Chernoff bound lemma that aids in the time-analysis of these and other systems. 5.1 Line Theorem 5.1 A line of monomers of length n ∈ N can be uniquely produced in expected time O(log n) and with O(log n) states. Proof: We first describe the construction, then prove correctness and conclude with a time analysis. {k1 , k2 , . . . , kp}, where (cid:80) Description: To build a line of length n, from the start monomer s.n, we first (se- quentially) generate a short line of p = O(log n) monomers with respective states K = k∈K 2k = n. Figure 9 illustrates this first step. Then, each monomer with state k ∈ K efficiently builds a line of length 2k as described below. Figure 10 gives an overview of the main construction, as well as many of the rules. The idea is to quickly build a line of length 2k , by having the start monomer, s.k , create 2 monomers (one of which is in state k − 1), which in turn create 4 monomers (2 of which are in state k − 2), and so on until there are 2k monomers with state 0. An overview of a possible tra jectory of the system is given in Figure 10a3. However, as the model is asynchronous, most tra jectories are not of this simple form. The construction can be described using the two subroutines shown in Figure 10a2. Subroutine (1) consists of a single rule that is applied only once, to the seed monomer. Subroutine (2) consists of k − 1 sets of rules, one for each x where k > x > 0. A schematic of one of these k − 1 rule sets is given in Figure 10b, with an example execution of Subroutines (1) and (2) in Figure 10c. Subroutine (2) begins with a single pair of monomers with states x, 0 and ends with four monomers in states x − 1, 0, x − 1, 0. Monomers are shown as left (purple), right (blue) pairs to aid readability. The rules for Subroutine (2) are given in Figure 10b and an example can be seen in Figure 10c. The subroutine works as follows. Each monomer on the line has a left/right component to its state: left is colored purple, right is colored blue. The initial xleft , 0right monomers send themselves to state x − 1left , 0right while inserting two new monomers to give the pattern x − 1left , 0right , x − 1left , 0right , as indicated in Subroutine (2). To achieve this, the initial pair of monomers create a “bridge” of 2 monomers on top, and 17 cRuless.ns.k1s.kis.kis.ki+1where ∑i ki = n, and all ki are distinct powers of 2bs.naSubroutines.k1s.k2s.kps.3s.1n = 11 = 23+21+20 s.0Examples.11 Figure 10: Construction that builds a length 2k line in expected time O(k). (a) Overview: 1 monomer in state x ∈ N creates 2 in state x − 1, and this happens independently in parallel along the entire line as it is growing. The blue/purple colors are for readability purposes only. (b) Rules for subroutines (1) & (2), for all x where k > x > 0. (c) Example execution of 13 steps, starting with a left-right pair of monomers. The “stick and dot” illustrations emphasize bond structure, representing bonds and monomers respectively. (d) Example configuration, in stick and dot notation, that emphasizes parallel asynchronous rule applications. Each gray box shows the application of a subroutine. 18 aConstruction overview0s.4a2s.k a3Overview of one possible trajectory where k = 4Subroutinesa1Initial configurationbRules for Subroutines (1) & (2)k > x > 0 d 302020101010100000000000000000k-1s.k0x0x-10x-1 k > x > 0 r5x-1’x-10’xr2b.1xxExample execution of Subroutine (2)r3b.1b.2b.3r40’0b.3b.4r6x-1’x-1’b.4b.5r70x-1’’x-1’r8b.5b.6x-1’’x-1’’00b.6b.7r9r11r10b.7b.8x-1’’x-1’’x-1’’0.’x-1r14b.2b.8cr10k-1s.kr2b.1x0r3b.2b.3x0r4b.2b.4x0’r5b.2b.4x-1x-1’r120.’x-10.’’x-1r130.’’0r6x-1’b.2b.5x-1r70x-1’’b.2b.5x-1r80x-1’’b.2b.6x-1r90x-1’’b.2b.7x-1r100x-1’’b.2b.8x-1r110x-1b.2b.8x-10.’0x-1b.2b.8x-10.’’r120x-1b.2x-100x-1x-10r13r14Example configuration(2)(1)0x by using movement and appearance rules two new monomers are inserted. The bridge monomers are then deleted and we are left with four monomers. Throughout execution, all monomers are connected by rigid bonds so the entire structure is stable. Subroutine (2) completes in constant expected time 13. Subroutine (2) has the following properties: (i) during the application of its rules to an initial pair of monomers xleft , 0right it does not interact with any monomers outside of this pair, and (ii) a left-right pair creates two adjacent left-right pairs. Intuitively, these properties imply that along a partially formed line, multiple subroutines can execute asynchronously and in parallel, on disjoint left-right pairs, without interfering with each other. Correctness: We argue by induction that the line completes with 2k monomers in state 0. The initial rule (Subroutine (1) in Figure 10a2) creates a left-right pair of monomers k − 1left , 0right ; the base case. For the inductive case, consider an arbitrary, even length, line of monomers (cid:96)j where all monomers are arranged in left-right pairs of the form xleft , 0right , where either x ∈ N. For any left-right pairs of the form 0left , 0right , no rules are applicable (they have reached their final state). For all other left-right pairs xleft , 0right Subroutine (2) is applicable. Choose any such left-right pair, and consider the new line (cid:96)j+1 created after applying Subroutine (2). The new line (cid:96)j+1 is identical to (cid:96)j except that our chosen pair xleft , 0right has been replaced by x − 1left , 0right , x − 1left , 0right . Line (cid:96)j+1 shares the following property with line (cid:96)j : all monomers are in left-right pairs. Hence, except for (already completed) 0left , 0right pairs, Subroutine (2) is applicable to every left-right pair of (cid:96)j+1 , and so by induction we maintain the property that rules can be correctly applied. Furthermore, application of Subroutine (2) leaves one 0 state untouched, creates a new 0 state, and creates two new x − 1 states. Hence, eventually we get a line where all states are 0 and no rules are applicable. The fact that the line grown from the monomer with state s.k has length 2k follows from a straightforward counting argument. Time analysis: Consider any pair of adjacent monomers 0left , 0right in a final line of length 2k . The number of rule applications from the start monomer s.k to this pair is k (i.e. using Figure 10a2, apply Subroutine (2) k times to get this pair). Given that these k rule applications are applied independently (without interference from other rules that are acting on other monomers on the line) and in sequence the expected time to generate our chosen pair is O(k). There are 2k−1 of these 0left , 0right pairs in a final line of length 2k , giving an O(k log 2k−1 ) = O(k2 ) bound on the expected time for the line to finish. In a line of length n ∈ N we have O(log n) lines, each of length a power of 2, being generated in parallel (using the technique in Figure 9), giving an expected time of O(log2 n log log n) for the length n line to complete. This analysis can be improved using Chernoff bounds. Specifically, in Lemma 5.2 we choose m = n/2 and a1 , a2 , . . . , am to be the n/2 rule applications that generate the n/2 pairs of 0left , 0right monomers in the final configuration. Each ai requires k ≤ 2 log2 n insertions to happen before it. Therefore, the expected time for the line to finish is O(k) = O(log n). 19 Number of states: Subroutine (1) has 1 rule. Subroutine (2) has O(1) states for each x ∈ 1, . . . , k − 1, hence the total number of states is O(k). 2 Lemma 5.2 In an assembly system, if there are m rule applications a1 , a2 , . . . , am that must happen, and 1. the desired configuration is reached as soon as al l m rule applications happen, 2. for any specific rule application ai among those m rule applications, there exist at most k rule applications r1 , r2 , . . . , rk such that ai = rk and for al l j , rj can be applied directly after r1 , r2 , . . . , rj−1 have been applied, regard less of whether other rule applications have happened or not, 3. m ≤ ck for some constant c, then the expected time to reach the desired configuration is O(k). Proof: From the assumptions, the time Ti at which the rule application ai happens is upper bounded by the sum of k mutually independent exponential variables, each with Prob[Ti > k(1 + δ)] ≤ (cid:0) 1 + δ (cid:1)k . mean 1 for every k . Using Chernoff bounds for exponential variables [50], it follows that eδ Prob[T > k(1 + δ)] ≤ m(cid:0) 1 + δ (cid:1)k ≤ ck e− kδ (cid:1)k ≤ (cid:0) c(1 + δ) Let T be the time to first reach the desired configuration. From the union bound, we know that 2 , for all δ ≥ 3. eδ eδ Therefore, the expected time is E [T ] = O(k). 2 For some constructions it is useful to have a procedure to efficiently (in time and states logarithmic in n) detect when a large number (n) of monomers are in a certain state. Here we give such a procedure. Specifically, we show that after growing a line, we can use a fast signaling mechanism to synchronize the states of all the monomers in the completed line. Theorem 5.3 (Synchronized line) In time O(log n), with O(log n) states, a line of length n ∈ N can be uniquely produced in such a way that each monomer switches to a prescribed final state, but only after al l insertions on the line have finished. Proof: The basic idea is to build a synchronization row of monomers below the line. This row is grown only in regions of the line that have finished growth (are in state 0), and takes time O(log n) time to grow. The bond structure of the synchronization row is such that upon the completion of the entire line, a relative shift of the synchronization row to the line occurs (in O(1) time), informing the line monomers to switch to a prescribed final state. Finally, the synchronization row is deleted, in O(log n) time. 20 Figure 11: Synchronization mechanism for Theorem 5.3 that quickly, in O(log n) expected time, sends a signal to n monomers in a line. Stick and dot notation is used to emphasize the bond structure throughout. A single movement, or shift, between configurations (7) and (8) sends the signal to all monomers. The structure maintains stability throughout execution. Figure 11 describes the synchronization mechanism. Starting from a seed monomer we grow a line (1), as each monomer on the line reaches state 0 (and so has finished inserting) it grows a synchronization monomer (in black) below it (2), joined to the line with a rigid bond. In the following we want to always ensure that the entire structure is stable. Neighboring synchronization monomers form horizontal rigid bonds (3). Any synchronization monomer that is joined with its two horizontal neighbors changes its bond to the line from rigid to flexible (the rightmost monomer is a special case, it changes to flexible immediately upon bonding with a horizontal neighbor). According to this rule we eventually get to configuration (7) where the entire synchronization row is bonded to the backbone row by flexible bonds, except for the leftmost pair. At this time, the leftmost pair is, for the first time, able to execute a movement rule (8) which shifts the synchronization row to the right, relative to the backbone row. Backbone monomers can detect this shift. 21 Rigid bondFlexible bondShift monomerInsertion completeSynchronized(1)(2)(3)(4)(5)InsertionShift does not applyShift can now applyBackbone rowSynchronization row(1)(2)(3)(4)(5)(8)(9)(10)(15)(16)Unsynchronized(7)(5)(6)(11)(12)(13)(14)Synchronized From here on the aim is to delete the synchronization row, while maintaining the property of stability. This is achieved in a manner inversely analogous to before: synchronization monomers create rigid bonds with the backbone, then delete their bonds to their horizontal neighbors only when the neighbors have formed vertical rigid bonds. From Theorem 5.1 the expected time to grow the unsynchronized line, and to then grow the additional synchronization row is O(log n) (the addition of the synchronization row requires O(1) for each monomer in the unsynchronized line). The movement rule that underlies the synchronization then takes expected time O(1), and a further O(log n) expected time is required to delete the length n synchronization row. the number of states is dominated by the O(log n) states to build a line (Theorem 5.1), as the synchronization 2 mechanism itself can be executed using O(1) states (Figure 11). 5.2 Square Square building is a common benchmark problem in self-assembly. Figure 12: Building a square in O(log n) time, using O(log n) states. Theorem 5.4 An n × n square can be constructed in time O(log n) using O(log n) states. Proof: Figure 12 contains an overview. Using the construction in Theorem 5.3, we first assemble a horizontal backbone line of length n. When a given monomer pair on the line finishes insertion (i.e. reach states 0, 0), the line then expands by a factor of 3 at that location. Every third monomer in the expanded backbone grows a vertical line of length n, the previous expansion ensures that each vertical line has sufficient space to grow. Each vertical line synchronizes upon completion. This synchronization signals to the backbone line to contract by factor of 3, essentially bringing all n vertical lines into contact. Adjacent vertical lines form rigid bonds, so that the final shape is fully connected. To analyze the expected time to completion we first consider the expected time for the n vertical rows to be a situation where all synchronization rows have grown and they are about to apply the synchronization steps. Each synchronization monomer can grow independently of all others, and depends only on ≤ 4(cid:100)log2 n(cid:101) prior insertion events to happen. By setting m = n2 − n in Lemma 5.2 and k = O(log n) the expected time is O(log n). The synchronizations then apply in expected time O(log n), as do the final folding and bonding steps. The number of states to build and synchronize each line is O(log n), a 2 constant number of other states are used in the construction. 22 Seed(1) Backbone assembly (2) Expansion(3) Growth(4) Contraction(5) Bonding 6 Computable shapes Let n = (cid:100)log2 n(cid:101) be the length of binary string encoding n ∈ N. Theorem 6.1 An arbitrary connected computable 2D shape of size ≤ √ n × √ n can be constructed in expected time O(log2 n + t(n)) using O(s + log n) states. Here, t(n) is the time required for a program-size s Turing machine to compute, given the index of a pixel n, whether the pixel is present in the shape. The remainder of this section contains the proof. 6.1 Construction overview Figure 13 gives an overview of the construction. We first assemble a binary counter that writes out the n binary numbers {0, 1 . . . , n − 1}, and where each row of the counter √ n × √ represents a pixel location in the n square that contains the final shape. The counter completes in expected time O(log2 n). The counter has an additional backbone column of monomers of length n. After the counter is complete, each row of the counter acts as a finite Turing machine tape: the binary string on the tape represents an input i ∈ {0, . . . n − 1} to the Turing machine. For each such i, there is a monomer that encodes the Turing program and acts as a tape head. If the head needs to increase the length of the tape, new monomers are created beyond the end of the counter row as needed. Eventually the simulated Turing machine finishes its computation on input i, and the head transmits the yes/no answer to a single backbone monomer. All Turing machines complete their computation in expected time O(t(n)), where t(n) is the worst case time for a single Turing machine to finish on an input of length n = O(log n). The Turing machine head monomers then cause the deletion of the counter rows. A synchronization on the backbone occurs after all backbone monomers encode either yes or no. The entire backbone then “folds” into a square, using a number of parallel “arm rotation” movements. Folding runs in expected time O(log2 n). After folding, the “no” pixels (monomers) are deleted from the shape in a process called “carving”, which happens in O(1) expected time. After carving is complete we are left with the desired connected shape, all in expected time O(log2 n + t(n)) and using O(s + log n) states. 6.2 Binary counter Figure 14 gives an overview of a binary counter that efficiently writes out the binary strings that represent 0 to n − 1 ∈ N in O(log2 n) time, and O(log n) states. The counter construction builds upon the line construction in Theorem 5.1 (and Figure 10). The essential idea is to build a line in one direction while simultaneously building counter rows in an orthogonal direction. The counter begins with a single seed monomer as shown in Figure 14(0) and ends with a configuration of the form shown in Figure 14(8), growing in an unsynchronized manner. 23 Figure 13: Construction of an arbitrary connected computable shape. 24 000000000001001000001001110110110111111110111111tttttttt100000000000100100000100111011011011111110111111tttttttttttttttt(2) Binary counter assembly(4) Shape computationSeedS000000000001001000001001110110110111111110111111(6) Prepare for folding(10) Change bond structure}}}}}}......}}}}(1) (11) Carve out shape by deleting monomers(9) Folded structure (8) Folding & synchronization (7) Folding (5) Yes/no pixels (3) Create Turing machine tape heads Figure 14(1)–(6) illustrates the construction by making the (unlikely, but valid) as- sumption that at configuration (1) we have created a counter that has already counted the set {0, 1, 2, 3}, and then gives a number configurations along a tra jectory to compute the set {0, 1, . . . , 8}. (Note that the system is asynchronous so very few tra jectories are of this nice form). A line is efficiently grown using the technique in Theorem 5.1, but where the 0 monomers from the line are denoted with a monomer with no state name in the counter (to simplify the presentation). Starting from configuration (1), insertion events independently take place across the entire line. Each counter row in (1) is separated by unit distance, which enables multiple insertion routines to act independently (each uses a pair of monomers to form “bridge” monomers b.∗, similar to Figure 10). Insertion of a pair of monomers triggers copying of a counter row, as seen in configuration (4). While a row is being copied, a 0 monomer is appended to one copy and a 1 monomer is appended to another copy. Insertion of two monomers and the growth of the new counter row takes O(log n) expected time: this comes from the fact that insertion works in constant time, and that copying of the O(log n) monomers takes O(log n) expected time. After copying and generation of the new 0 or 1 monomers is complete, a signal is sent to the line. The line can then continue the insertion process. Growing a line takes expected time O(log n), but we’ve replaced each O(1) time insertion event with an expected time O(log n) copying process, hence the overall expected time is O(log2 n). From Theorem 5.1, the number of states to build the backbone line is O(log n), a further O(1) states can be used to carry out counter row growth and copying. Correctness for the counter essentially follows from that of the line: We can consider that each insertion on the line is paused while counter row copying completes. After the copying the line monomers can continue their insertions, and eventually will complete. The copying and bit-flipping mechanism guarantees that the rows of the counter encode the correct bit sequences. 6.2.1 Counter synchronization After the counter is complete, the backbone synchronizes. More precisely, after the backbone has grown to its full length n, and all counter rows have finished their final copying (i.e. configuration (8) in Figure 14 is reached), the synchronization routine from Theorem 5.1 is executed to inform all backbone monomers that the counter is complete, in expected time O(log n). 6.3 Turing machine computations The next part of the construction involves simulating n2 Turing machines (in parallel) in order to determine which of the n2 pixels in the n × n canvas are in the desired shape, and which are not. We begin with the synchronized counter described in the previous section. After 25 Figure 14: A binary counter that efficiently writes out the binary strings that represent all integers from 0 to n − 1, in O(log2 n) time and O(log n) states. The counter grows in an unsynchronized fashion, some example configurations are shown in (0)–(8), although many other tra jectories are possible. A backbone line is efficiently grown using the technique in Theorem 5.1. The configuration shown in (1) represents a count of 0 to 3. In this example the backbone then expands (6) by a factor of 2, with each expansion a row of the counter is copied, with a 0 appended to one copy and a 1 appended to another copy (4). To save space the grid is rotated anti-clockwise. synchronization the counter changes its bond structure so that it is of that shown in Figure 13(2). Each row can do this independently, by a straightforward application of Lemma 5.2, this takes O(log n) time. The counter then expands by a factor of 2 (in the (cid:126)y direction), and each row grows a single “head” monomer on top as shown in Figure 13(3). The “head” monomer acts as a Turing machine tape head, as in Figure 8, and treats the counter row as a finite Turing machine tape. The input to the Turing machine is the binary number i ∈ {0, 1, . . . , n2 − 1} stored on the tape. The Turing machine program executed by the head is of size s and is stored explicitly in the rules that are applicable to the head monomer, this gives the O(s) term of monomer states in the statement of Theorem 6.1. If the Turing machine requires more than log2 n tape space (the length of the counter row), then new monomers are grown to the left as required (we assume that the turing machine runs on a single, one-way infinite tape). When the Turing machine enters an accept or reject state, the head moves to the right, deleting each tape monomer along the way, and communicates this bit to the backbone row, as shown in Figure 13(5). Each tape head then deletes itself, and n2 backbone monomers undergo a synchronization when all tape head monomers are deleted. We are left with n2 monomers as shown in Figure 13(6), each of which stores a bit representing whether or not it represents a pixel in the final desired shape. We have n2 Turing machines to simulate in parallel. In the folding step below we modify the Turing machine program so each machine first computes a simple inequality, which causes each simulated Turing machine to run for time t(n) = Ω(log2 n). Then, by setting 26 110101k-2k-2k-2k-2000000101110k-2k-2k-2k-200b.1b.3b.2b.4b.2101110k-2k-200b.4b.200’0k-3b.2b.5k-3’k-3b.2b.5k-3’1110k-2k-3k-300b.2b.2b.500copy, flip last bitk-301b.2b.601b.1b.500k-3’’110k-3’k-3’’00copy, flip last bitk-2b.4b.200010010101100k-311b.2b.611010k-3’’k-3b.2b.2k-3k-30k-300.’’00b.8copy, flip last bits.k(0)(1)(2)(3)(4)(5) (6) (7) (8)1111111111000000000000011101111000010101100111111000000011111111100000000000001000010110001000010110001111111111110000000000001100111110101100111110000111copy, flip last bitcopy, flip last bit0’k-300101110111k-31k-3k-3k-300001010110k-30k-3k-300000000 m = n2 , and k = t(n) in Lemma 5.2, all Turing machines finish their computations in expected time O(t(n)). 6.4 Folding In this part of the construction the line of n2 monomers folds itself into an n × n square. The folding process is outlined in Figure 13(7)–(9), and is accomplished as follows. In the previous section, we used a Turing machine computation on the ith row of a counter was to decide whether or not pixel i ∈ {0, 1, . . . n2} is in the final shape. We use these same Turing machines to carry out an additional computation. We can see in Figure 13(6)–(9) that the line of monomers is divided into alternating segments, each of length n, that fold in one of two ways. In particular, the monomers highlighted in green each carry out a sequence of 3 clockwise rotations with respect to their left neighbor. This can be done using rules similar to the single rule in the arm rotation example shown in Figure 7. For each monomer to know whether it should rotate (green) or not (blue), we have the Turing machine check if i satisfies the inequality (2j − 1)n ≤ i < 2jn, and if so this bit is communicated to the ith backbone monomer (along with the yes/no pixel information). Then after the synchronization described in the previous section, monomers with indices i that satisfy the inequality rotate as shown in Figure 13(6)–(9). A synchronization takes place for each rotating arm, after the second rotation of each monomer, as shown in Figure 13(8). The expected time for the Turing machine monomer head to compute the inequality is Ω(log n), as it requires reading the entire input (given our orientation of binary strings), and this is already accounted for in Section 6.3 above. The expected time to rotate an arm (twice) so that it is in the position shown in Figure 13(8) is O(log n), for each individual arm. By letting m = n2/2 and k = log n in Lemma 5.2, the expected time for all n arms to rotate to the configuration shown in Figure 13(8) is O(log n). Then we apply n synchronization steps, each of which runs in expected time O(log n), giving an expected time of O(log2 n). As with the first rotations, the final rotations occur in expected time O(log n), to give a total expected time of O(log2 n) for the folding step. The number of states used for folding is O(1). 6.5 Bonding and carving The goal here is to delete those pixels that should not be in the final stage, and to do this in a way such that the shape does not become unintentionally disconnected (otherwise if we delete too early, e.g. before all “arms” have folded or all bonds have formed, part of the shape could become disconnected). In Figure 13 “yes” pixels belonging to the final shape are highlighted in gray, and “no” pixels that should be deleted are in white. After folding, i.e. when green and blue outlined monomers begin to come into horizontal ((cid:126)x) contact, as shown in Figure 13(9), these monomers bond to all of their neighbors. Then the following distributed carving algorithm is executed, a “no” pixel is deleted if and only if either (a) it 27 Figure 15: Construction of an n × n pattern in expected time polylogarithmic in n, without growing outside the pattern borders. No long range communication (synchronization) is used and so the computation happens in a completely asynchronous and distributed fashion. Final configuration adapted from M. C. Escher, Sky & Water I, woodcut, 1938. is bonded to its 6 neighbors and they have the maximum number of bonds to each other (b) all neighbors that have not been deleted already are bonded to it and to each other. This procedure prevents the shape from becoming disconnected by the following argu- ment. Any two adjacent regions, one containing as yet unbonded monomers, and the other containing deleted monomers are bordered by a connected path of rigid bonds. The only way for monomers on this rigid path to be deleted are if neighboring unbonded monomers become bonded, thereby maintaining the connectedness of the boundary and making more monomers available for safe deletion. Assuming folding has completed, bonding is a local operation that for each individual monomer runs in time O(1). The same is true for carving. The expected time for all monomers to bonding and carving is O(log n). This completes the construction for Theorem 6.1. 7 Efficient computation of patterns Let n = (cid:100)log2 n(cid:101). Theorem 7.1 An arbitrary finite computable 2D pattern of size ≤ n × n, where n = 2p , p ∈ N, with pixels whose color is computable on a polynomial time O(log(cid:96) n) (inputs are of length O(log n)), linear space O(n), program-size s Turing machine, can be constructed in expected time O(log(cid:96)+1 n), with O(s + log n) monomer states and without growing outside the pattern borders. Moreover, this can be done without explicitly using synchronization. The construction is described in the remainder of this section. Figure 15 gives an overview. For simplicity, the figure is drawn on a square grid. It should be noted that the construction occurs in a completely asynchronous distributed fashion. For ease of exposition, 28 S0 0 ... 00 0 ... 10 0 ... 01 1 ... 1......i0 0...0......0 0...11 1...11i2}log nnlog n...i, j...0 0...00 0...11 1...11i2}log n 1 2 . . . . . . nnlog n11 . . . . . . nn. . . . . . (5)(4)......i, j0 0...00 0...11 1...11i2}log n nnlog n...i , j 1 1i , j 2 2i , j nlog nnlog n(2)(1)(3) we first describe a construction where n is a double power of 2, i.e. n = 22p for p ∈ N, and then in Section 7.3 we describe how to modify it for n = 2p . Figure 16: Sketch of a procedure to efficiently reconfigure a counter into a straight line. 7.1 Vertical and horizontal binary counters The construction begins by growing a counter, shown in Figure 15(1), that contains all binary numbers from 1 to n/ log2 n. The counter is described in Section 6.2, and illustrated in Figure 14. The only difference here is that we omit the final synchronization steps from Section 6.2. Notice that such a counter contains exactly n monomers; i.e. n/ log2 n rows each of length log2 (n/ log2 n). The counter rows then expand so that they are of length log2 n (we omit the details, but this is easy to achieve with the number of states permitted in the theorem statement). As counter rows finish, we want to rotate them so that they stand in a column as shown in Figure 15(2), although due to the asynchronous nature of the computation they will most likely not do this as shown. As can be seen in Figure 14, the counter is stable throughout its entire construction. Figure 16 shows how this is accomplished. After a counter row completes, the backbone monomer that is attached to that counter row expands vertically by log2 n monomers. Then the counter row rotates from a horizontal, to a vertical position as shown in Figure 16. Finally the binary string stored in the counter row is copied to the expanded backbone monomers, and the counter row deletes itself. All of this is carried out while maintaining stability (Definition 2.3). By the time all rows rotate we have a backbone of height n. After row i rotates to the vertical orientation, it immediately initiates growth of a second, horizontal, counter which counts while copying the binary number i. Note that i can not be stored in single monomer (as this would require Ω(n) states for the entire construction), instead the entire strip of log2 n monomers encoding i is copied as the second counter grows. 29 010101100101011000001111iii010101100101011000001111iiii010101100101011000001111iiiiiiiiiiiiiiiiiiiiiiii010101100101011000001111iiiiiiiiiiiiii011001010110101010000111(4)(2)(1)(3)(5) Figure 17: A strip of monomers of length log2 n. (1) The entire strip acts as an input tape and work tape for a Turing machine that uses log2 n, whose head is denote in green. (2) After the first Turing machine has completed its computation the second machine is initialized, and so on until machine log2 n completes its computation. (4) The output, yes or no, from each machine is denoted as solid green or white. A sketch is shown in row i of Figure 15(3). This second counter works as follows. Its backbone line grows horizontally, starting from the top monomer of the i strip. During each insertion event, the log2 n monomers that encode i are copied. At the same time these log2 n monomers are used to encode the values being generated by second counter (essentially, while copying i we execute the copying and bit flip idea seen in Figure 14 to get a new value j ). By the time row i finishes it contains n vertical strips of log2 n monomers, and each strip encodes a distinct pair (i, j ) where j ∈ {0, 1, . . . n − 1}. To find the expected time to complete all strips notice that each strip (i, j ) can grow independently from all others, and each strip depends on only O(log2 n) events to happen in order for that strip to be complete. Hence we can apply Lemma 5.2 by setting m = n2/ log n (the number of strips), and k = O(log2 n), to get an expected time of O(log2 n) for all strips to complete. 7.2 Turing machine computations We will treat each strip (i, j ) as a Turing machine tape. After a strip completes, a signal is sent from the top to the bottom of the strip, successively writing out one of the integers p ∈ {1, 2, . . . , log2 n} in each of the log2 n monomers. This signal also tells the topmost monomer that it now encodes a Turing machine tape head, as shown in green in Figure 17(1). The encoded tape head moves up and down the strip as required. By the theorem hypothesis, the Turing machine requires at most log2 n space, which is exactly the strip length. These Turing machine are assumed to takes as input three integers (i, j, p) which provide a unique coordinate for each monomer in the entire n × n pattern. In time polynomial in its input 30 ...i, j 1,0,1, * 1,1,5, * 1,0,4, * 0,1,3, * 1,1,2, * 0,1,6, * 1,0,log n, * 0,0,8, * 1,1,7, * ...i, j 1,0,1, YES 1,1,5, * 1,0,4, * 0,1,3, * 1,1,2, * 0,1,6, * 1,0,log n, * 0,0,8, * 1,1,7, * ...i, j 1,0,1, YES 1,1,5, YES 1,0,4, YES 0,1,3, NO 1,1,2, NO 0,1,6, YES 1,0,log n, YES 0,0,8, NO 1,1,7, YES ...i, j .........(4)(2)(1)(3) length n = log2 n, the first Turing machine decides whether pixel (i, j, 1) is black or white, communicates this bit to the topmost monomer, and moves on to the second from top monomer, which has coordinate (i, j, 2). This process continues until all log2 n monomers in the strip are colored either black or white. Each Turing machine runs in time O(log(cid:96) n), which takes expected time O(log(cid:96) n) to simulate. We can apply the Chernoff bound in Lemma 5.2 by setting m = n2/ log n (the number of strips) and k = O(log(cid:96)+1 n) (the expected time for all log2 n Turing machines to finish on a single strip) to get an expected running time of O(log(cid:96)+1 n) for all Turing machine computations to complete. The overall time bound for the entire construction is O(log2 n + log(cid:96)+1 n) = O(log(cid:96)+1 n) since we know (cid:96) ≥ 1 (because our Turing machines are required to read their entire input). 7.3 Patterns with diameter a power of 2 The previous construction works for when n is a double power of 2. The following text shows how to modify the construction so it works for n being a single power of 2, i.e. n = 2p ∈ N. In this case, the counter that builds Figure 15(1) is modified so that it does not produce the final (bottom) row with index (cid:100)n/ log n(cid:101). Let k = n − (cid:98)n/ log n(cid:99) log n, and observe that k < log n. Now, the bottoms row has index b = (cid:98)n/ log n(cid:99). Row b triggers growth of a counter as before, however when each column (of length log2 n) of the counter finishes, it grows an additional k monomers, each with a unique id i ∈ {1, . . . , k}. This results in a counter of size n × (k + log n). When all counters complete in the entire construction, the canvas is of size n × (k + (cid:98)n/ log n(cid:99) log n) = n × n. The Turing machine computations proceed as follows. As each column of the counter in row b completes, the log n Turing machine computations in that column proceed as before. When they are finished, an additional k Turing machine computations are triggered, which run one after the other, and use k + log n workspace in the column (which is more than enough), and the unique IDs of the k extra monomers in order to decide whether or not each of those k pixels belong in the pattern. These additional aspects of the construction merely add a constant factor to the time analysis. 8 Discussion and future work We have introduced a model of computation called the nubot model, and explored its ability to construct shapes and patterns. We have shown that the model is capable of efficiently generating a wide variety of shapes and patterns exponentially quickly. The intention for our model is to explore the abilities of molecules to compute in ways that are seen in nature and that we are starting to see in the laboratory. This perspective leaves a lot of room for future work. One interesting direction is to explore the algorithmic limits of dynamic structures. In this paper we have used our active self-assembly model to grow shapes and patterns that 31 are ultimately static. One can also consider shapes and patterns that are forever dynamic. Cellular automata are a well-studied model from this point of view, although they are incapable of expressing our notion of movement and active self-assembly. What kinds of dynamic structural systems can, and can not, be modeled by nubots? One possible ob jection to our model, on physical grounds, is the lack of any realistic notion of persistence length (which is also absent from many models of self-assembly). On the one hand, it is clear that there are natural and artificial structures of high aspect ratio coupled with high tensile strength or persistence length (hair, actin filaments, microtubules). On the other hand, ‘high’ does not mean ‘infinite’ ! One could introduce complexity measures of tensile strength or persistence length and analyze the capabilities of the nubots model with respect to these resources. The important point here would be to appropriately define these measures so that they capture what is observed at the molecular scale in the laboratory. For the topic of tensile strength, one could take inspiration from cellular migration and adhesion in developmental biology: nubot monomers could have variable strength bonds which break if there is enough movement in one direction. For example, bonds could have strength s ∈ [0, 1] ⊆ R where 0 is not bonded, 1 is fully bonded, and other values are of intermediate strength. Ob jects are pulled apart if enough movement rules are applicable and so that their bond strength, or tensile strength, can not overcome the strength of movement. What are the classes of systems that can and can not be built under such constraints? If we have to pay for bond strength, in general, is it possible to place bounds on this cost in terms of the shapes, patterns or dynamics we wish to model? As noted in the introduction, the field of reconfigurable robotics considers a wide range of models that share a number of features with our nubot self-assembly model. In particular, reconfigurable modular robots with a similar long-range movement primitive to ours can achieve arbitrary reconfiguration in time logarithmic in shape size [5], and are capable of linear parallel time reconfiguration with more realistic physical constraints [4]. It remains as future work to compare such models to ours. What would be particularly interesting would be to explore the differences in model capabilities that are solely due to the inherent differences in macro-scale and molecular-scale self-assembly (in molecular systems we are typically unconcerned with gravity and friction; energy in the form of fuel molecules may be freely available in the environment; temperature, brownian motion and other forms of agitation play a ma jor role). There are also some more technical questions arising from our work. We use a Chernoff bound in Lemma 5.2 to simplify the time analysis of our constructions. However, many assembly systems that are expressible in our model do not satisfy the conditions of this lemma. It would be nice to find other tools, perhaps more general, to aid in the time analysis of nubots systems. For example, starting from a single monomer, if the longest sequence of rule applications that can lead to some ‘terminal’ monomer type is k , then is O(k) the expected time for all rules to complete? The pattern construction in Section 7 terminates with an assembly that is not completely 32 connected (however, it is stable and connected). In that construction we intentionally did not use synchronization over long distances, but by using synchronization it is indeed possible (and relatively easy) to modify the final pattern so that it is completely connected. However, given that synchronization has such power, it is interesting to ask what can be done in its absence. Without using synchronization, or any similar form of rapid communication over long (> log n) distances, is it possible to deterministically assemble an n × n completely-connected square in time polylogarithmic in n? Without the movement rule, the nubot model is a kind of asynchronous and nonde- terministic cellular automaton. Thus in the absence of movement in our model, cellular automata are a good starting point to assess its computational complexity (how efficiently can problems be solved?). However, with movement, it is clear that our model can carry out certain tasks that cellular automata, or indeed Turing machines, can not (even under reasonable encodings). What are the upper bounds and lower bounds on the computa- tional complexity of our model? For example, Section 4 gives a polynomial (in nubots time plus number of monomers) time algorithm for simulating a nubots tra jectory. If nubots time is merely polylogarithmic in the maximum number of monomer types, then is it possible to simulate nubots in polylogarithmic time on a parallel computer (e.g. on polylogarithmic-depth Boolean circuits)? One could consider variations on the rules. Already it is the case that movement rules facilitate non-local interactions. One could take this even further, as we now discuss. Consider a variant on the movement rule where the application of a movement rule r remotely triggers the application of another movement rule r (cid:48) . More precisely, let A be an arm monomer bonded to base monomer B , and let M(C, A, B , (cid:126)v) (cid:54)= {} be the movable set for the application of rule r to monomers A, B . Also, in the same configuration C , there is another pair of bonded monomers D , E , with an applicable movement rule r (cid:48) , and where D ∈ M(C, A, B , (cid:126)v) and E /∈ M(C, A, B , (cid:126)v), and where r (cid:48) translates D by (cid:126)v . When r is applied it triggers the application of r (cid:48) : i.e. when monomer D moves because of the remote application of r, both D and E change state as if rule r (cid:48) was applied; hence r and r (cid:48) are applied at the same time. We do not consider this kind of remote rule triggering in this paper, but we mention it here as a way for potential future work to model non-local interactions that can occur due to movement. This is one possible way to model systems where interactions occur in a decentralized manner. The model uses both rigid and flexible bonds. Besides simple examples given early in the paper, the only construction that uses flexible bonds is synchronization, and it turns out that one can design a synchronization routine that does not use flexible bonds that works in the presence of agitation (by building a rigid row immediately below, and parallel to, the synchronization row—see Figure 11—that stops monomers floating away). What classes of (perhaps scale-invariant) shapes can be assembled by exploiting flexible bonds that can not be assembled otherwise? Finally, since the model is directly inspired by a wide election of natural and artificial molecular systems, this begs the question: can nubots be implemented at the molecular 33 scale in the laboratory? Acknowledgments Many thanks to Niles Pierce and Patrick Mullen for valuable discussions and input. We also thank Moya Chen, Doris Xin, Joseph Schaefer, and Andrew Winslow for stimulating and fruitful discussions. References 1. Z. Abel, N. Benbernou, M. Damian, E. Demaine, M. Demaine, R. Flatland, S. Komin- ers, and R. Schweller. Shape replication through self-assembly and RNase enzymes. In SODA 2010: Proceedings of the Twenty-first Annual ACM-SIAM Symposium on Discrete Algorithms, Austin, Texas, 2010. 2. L. M. Adleman, Q. Cheng, A. Goel, and M.-D. Huang. Running time and program size for self-assembled squares. In STOC 2001: Proceedings of the thirty-third annual ACM Symposium on Theory of Computing, pages 740–748, Hersonissos, Greece, 2001. ACM. 3. G. Aggarwal, Q. Cheng, M. H. Goldwasser, M.-Y. Kao, P. M. de Espanes, and R. T. Schweller. Complexities for generalized models of self-assembly. SIAM Journal on Computing, 34:1493–1515, 2005. 4. G. Aloupis, S. Collette, M. Damian, E. Demaine, R. Flatland, S. Langerman, J. O’rourke, V. Pinciu, S. Ramaswami, V. Sacrist´an, and S. Wuhrer. Efficient constant-velocity reconfiguration of crystalline robots. Robotica, 29(1):59–71, 2011. 5. G. Aloupis, S. Collette, E. D. Demaine, S. Langerman, V. Sacrist´an, and S. Wuhrer. Reconfiguration of cube-style modular robots using O(log n) parallel moves. In Pro- ceedings of the 19th Annual International Symposium on Algorithms and Computation (ISAAC 2008), pages 342–353, Gold Coast, Australia, December 15–17 2008. 6. E. Andersen, M. Dong, M. Nielsen, K. Jahn, R. Subramani, W. Mamdouh, M. Golas, B. Sander, H. Stark, C. Oliveira, et al. Self-assembly of a nanoscale DNA box with a controllable lid. Nature, 459(7243):73–76, 2009. 7. D. Angluin, J. Aspnes, and D. Eisenstat. Fast computation by population protocols with a leader. Distributed Computing, pages 61–75, 2006. 8. R. D. Barish, P. W. K. Rothemund, and E. Winfree. Two computational primitives for algorithmic self-assembly: Copying and counting. Nano Lett., 5:2586–2592, 2005. 9. R. D. Barish, R. Schulman, P. W. K. Rothemund, and E. Winfree. An information- bearing seed for nucleating algorithmic self-assembly. Proceedings of the National Academy of Sciences, 106(15):6054, 2009. 10. J. Bath, S. Green, and A. Turberfield. A free-running DNA motor powered by a nicking enzyme. Angewandte Chemie International Edition, 44:4358–4361, 2005. 34 11. J. Bath and A. Turberfield. DNA nanomachines. Nature Nanotechnology, 2:275–284, 2007. 12. F. Becker, E. Remila, and I. Rapaport. Self-assemblying classes of shapes, fast and with minimal number of tiles. In Proceedings of the 26th Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2006), volume 4337 of LNCS, pages 45–56. Springer, Dec. 2006. 13. Z. Butler, R. Fitch, and D. Rus. Distributed control for unit-compressible robots: goal- recognition, locomotion, and splitting. IEEE/ASME Transactions on Mechatronics, 7:418–430, 2002. 14. S. Cannon, E. Demaine, M. Demaine, S. Eisenstat, M. Patitz, R. Schweller, S. Summers, and A. Winslow. Two hands are better than one (up to constant factors). In STACS 2013: Proceedings of the 30th International Symposium on Theoretical Aspects of Computer Science, To appear. 15. B. Chakraborty, R. Sha, and N. Seeman. A DNA-based nanomechanical device with three robust states. Proceedings of the National Academy of Sciences, 105(45):17245, 2008. 16. H. Chandran, N. Gopalkrishnan, and J. Reif. Tile complexity of approximate squares. Algorithmica, pages 1–17, 2012. 17. H. Chen and M. Kao. Optimizing tile concentrations to minimize errors and time for dna tile self-assembly systems. DNA Computing and Molecular Programming, pages 13–24, 2011. 18. E. Demaine, M. Demaine, S. Fekete, M. Ishaque, E. Rafalin, R. Schweller, and D. Souvaine. Staged self-assembly: nanomanufacture of arbitrary shapes with O(1) glues. Natural Computing, 7(3):347–370, 2008. 19. E. Demaine, M. Demaine, S. Fekete, M. Patitz, R. Schweller, A. Winslow, and D. Woods. One tile to rule them all: Simulating any Turing machine, tile assembly system, or tiling system with a single puzzle piece. Arxiv preprint arXiv:1212.4756, Dec. 2012. 20. E. D. Demaine, S. Eisenstat, M. Ishaque, and A. Winslow. One-dimensional staged self-assembly. In Proceedings of the 17th International Conference on DNA Computing and Molecular Programming (DNA 2011), volume 6937 of Lecture Notes in Computer Science, pages 100–114, Pasadena, California, Sept. 2011. 21. E. D. Demaine, M. J. Patitz, R. T. Schweller, and S. M. Summers. Self-assembly of arbitrary shapes using RNAse enzymes: Meeting the Kolmogorov bound with small scale factor. In Proceedings of the 28th International Symposium on Theoretical Aspects of Computer Science (STACS 2011), pages 201–212, March 2011. 22. B. Ding and N. Seeman. Operation of a DNA robot arm inserted into a 2D DNA crystalline substrate. Science, 314(5805):1583, 2006. 23. D. Doty. Randomized self-assembly for exact shapes. SIAM Journal on Computing, 39:3521, 2010. 24. D. Doty. Theory of algorithmic self-assembly. Communications of the ACM, 55:78–88, 35 2012. 25. D. Doty, L. Kari, and B. Masson. Negative interactions in irreversible self-assembly. In DNA Computing and Molecular Programming, Lecture Notes in Computer Science, pages 37–48. Springer, 2011. 26. D. Doty, J. Lutz, M. Patitz, R. Schweller, S. Summers, and D. Woods. The tile assembly model is intrinsically universal. In FOCS 2012: Proceedings of the 53th Annual IEEE Symposium on Foundations of Computer Science, pages 302–310, New Brunswick, New Jersey, Oct. 2012. 27. H. Ehrig. Introduction to the algebraic theory of graph grammars (a survey). Lecture Notes in Computer Science, 73:1–69, 1979. 28. L. Feng, S. H. Park, J. H. Reif, and H. Yan. A two-state DNA lattice switched by DNA nanoactuator. Angew. Chem. Int. Ed., 42:4342–4346, 2003. 29. F. Foster, M. Zhang, A. Duckett, V. Cucevic, and C. Pavlin. In vivo imaging of embryonic development in the mouse eye by ultrasound biomicroscopy. Investigative ophthalmology & visual science, 44(6):2361, 2003. 30. B. Fu, M. Patitz, R. Schweller, and B. Sheline. Self-assembly with geometric tiles. In The 39th International Col loquium on Automata, Languages and Programming (ICALP 2012), volume 7391 of Lecture Notes in Computer Science, pages 714–725. Springer, 2012. 31. K. Fujibayashi, R. Hariadi, S. Park, E. Winfree, and S. Murata. Toward reliable algorithmic self-assembly of DNA tiles: A fixed-width cellular automaton pattern. Nano Letters, 8(7):1791–1797, 2007. 32. D. Gillespie. A rigorous derivation of the chemical master equation. Physica A: Statistical Mechanics and its Applications, 188(1):404–425, 1992. 33. R. Goodman, M. Heilemann, S. Doose, C. Erben, A. Kapanidis, and A. Turber- field. Reconfigurable, braced, three-dimensional DNA nanostructures. Nature nanotechnology, 3(2):93–96, 2008. 34. S. J. Green, J. Bath, and A. J. Turberfield. Coordinated chemomechanical cy- cles: A mechanism for autonomous molecular motion. Physical Review Letters, 101(23):238101, 2008. 35. H. Gu, J. Chao, S. Xiao, and N. Seeman. A proximity-based programmable DNA nanoscale assembly line. Nature, 465(7295):202–205, 2010. 36. D. Han, S. Pal, Y. Liu, and H. Yan. Folding and cutting DNA into reconfigurable topological nanostructures. Nature nanotechnology, 5(10):712–717, 2010. 37. N. Jonoska and D. Karpenko. Active tile self-assembly, self-similar structures and recursion. arXiv preprint arXiv:1211.3085, 2012. 38. M. Kao and R. Schweller. Reducing tile complexity for self-assembly through temperature programming. In Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 571–580. ACM, 2006. 39. M. Kao and R. Schweller. Randomized self-assembly for approximate shapes. Au- tomata, Languages and Programming, pages 370–384, 2008. 36 40. E. Klavins. Directed self-assembly using graph grammars. In Foundations of Nanoscience: Self Assembled Architectures and Devices, Snowbird, UT, 2004. 41. E. Klavins, R. Ghrist, and D. Lipsky. Graph grammars for self-assembling robotic systems. In Proceedings of the International Conference on Robotics and Automation, pages 5293–5300, 2004. 42. T. Liedl and F. Simmel. Switching the conformation of a DNA molecule with a chemical oscillator. Nano letters, 5(10):1894–1898, 2005. 43. A. Lindenmayer. Mathematical models for cellular interactions in development I. Filaments with one-sided inputs. Journal of theoretical biology, 18(3):280–299, 1968. 44. D. Lubrich, J. Lin, and J. Yan. A contractile DNA machine. Angewandte Chemie International Edition, 47(37):7026–7028, 2008. 45. R. Luecke, W. Wosilait, and J. Young. Mathematical modeling of human embryonic and fetal growth rates. Growth Development and Aging, 63:49–59, 1999. 46. K. Lund, A. Manzo, N. Dabby, N. Michelotti, A. Johnson-Buck, J. Nangreave, S. Taylor, R. Pei, M. Sto janovic, N. Walter, E. Winfree, and H. Yan. Molecular robots guided by prescriptive landscapes. Nature, 465(7295):206–210, 2010. 47. C. Mao, W. Sun, Z. Shen, and N. Seeman. A nanomechanical device based on the B-Z transition of DNA. Nature, 397(6715):144–146, 1999. 48. M. Marini, L. Piantanida, R. Musetti, A. Bek, M. Dong, F. Besenbacher, M. Lazzarino, and G. Firrao. A revertible, autonomous, self-assembled DNA-origami nanoactuator. Nano Letters, 2011. 49. D. Morris, M. Grealy, H. Leese, and G. R. Centre. Cattle embryo growth, development and viability. Teagasc, Ireland, 2001. Pro ject No. 4388, Beef Production Series No. 36. 50. R. Motwani and P. Raghavan. Randomized Algorithms. Cambridge University Press, 1995. 51. S. Murata and H. Kurokawa. Self-reconfigurable robots. Robotics & Automation Magazine, IEEE, 14(1):71–78, 2007. 52. T. Omabegho, R. Sha, and N. Seeman. A bipedal DNA Brownian motor with coordinated legs. Science, 324(5923):67, 2009. 53. J. Padilla, W. Liu, and N. Seeman. Hierarchical self assembly of patterns from the Robinson tilings: DNA tile design in an enhanced tile assembly model. Natural Computing, pages 1–16, 2011. 54. J. Padilla, M. Patitz, R. Pena, R. Schweller, N. Seeman, R. Sheline, S. Summers, and X. Zhong. Asynchronous signal passing for tile self-assembly: Fuel efficient computation and efficient assembly of shapes. Arxiv preprint arXiv:1202.5012, 2012. 55. M. Patitz. An introduction to tile-based self-assembly. In Unconventional Com- putation and Natural Computation, volume 7445 of LNCS, pages 34–62. Springer, 2012. 56. M. Patitz, R. Schweller, and S. Summers. Exact shapes and turing universality In DNA Computing and Molecular at temperature 1 with a single negative glue. 37 Programming, Lecture Notes in Computer Science, pages 175–189. Springer, 2011. 57. M. Patitz and S. Summers. Identifying shapes using self-assembly. In Proceedings of the Twenty First International Symposium on Algorithms and Computation (ISAAC 2010), volume 6507, pages 458–469. Springer, 2010. 58. P. Prusinkiewicz and A. Lindenmayer. The algorithmic beauty of plants. Springer- Verlag, 1990. 59. J. Reif, S. Sahu, and P. Yin. Complexity of graph self-assembly in accretive systems and self-destructible systems. In Eleventh International Meeting on DNA Based Computers, volume 3892 of Lecture Notes in Computer Science, pages 257–274. Springer, 2006. 60. J. Reif and S. Slee. Optimal kinodynamic motion planning for 2d reconfiguration of self-reconfigurable robots. Robot. Sci. Syst, 2007. 61. P. Rothemund, N. Papadakis, and E. Winfree. Algorithmic self-assembly of DNA Sierpinski triangles. PLoS Biology, 2:2041–2053, 2004. 62. P. W. Rothemund. Folding DNA to create nanoscale shapes and patterns. Nature, 440(7082):297–302, 2006. 63. P. W. K. Rothemund and E. Winfree. The program-size complexity of self-assembled squares (extended abstract). In Proceedings of the thirty-second annual ACM sympo- sium on Theory of computing, pages 459–468. ACM Press, 2000. 64. D. Rus and M. Vona. Crystalline robots: Self-reconfiguration with compressible unit modules. Autonomous Robots, 10(1):107–124, 2001. 65. K. Saitou. Conformational switching in self-assembling mechanical systems. IEEE Transactions on Robotics and Automation, 15(3):510–520, 1999. 66. W. Sherman and N. Seeman. A precisely controlled DNA biped walking device. Nano Letters, 4(7):1203–1207, 2004. 67. J. S. Shin and N. A. Pierce. A synthetic DNA walker for molecular transport. Journal of the American Chemical Society, 126:10834–10835, 2004. 68. D. Soloveichik, M. Cook, E. Winfree, and J. Bruck. Computation with finite stochastic chemical reaction networks. Natural Computing, 7(4):615–633, 2008. 69. D. Soloveichik and E. Winfree. Complexity of self-assembled shapes. SIAM Journal on Computing, 36(6):1544–1569, 2007. 70. S. Summers. Reducing tile complexity for the self-assembly of scaled shapes through temperature programming. Algorithmica, pages 1–20, 2012. 71. Y. Tian, Y. He, Y. Chen, P. Yin, and C. Mao. A DNAzyme that walks processively and autonomously along a one-dimensional track. Angewandte Chemie International Edition, 44(28):4355–4358, 2005. 72. A. J. Turberfield, J. C. Mitchell, B. Yurke, A. P. Mills, Jr., M. I. Blakey, and F. C. Simmel. DNA fuel for free-running nanomachines. Physical Review Letters, 90(11):118102–1–4, 2003. 73. S. Venkataraman, R. Dirks, P. Rothemund, E. Winfree, and N. Pierce. An autonomous polymerization motor powered by DNA hybridization. Nature Nanotechnology, 2:490– 38 494, 2007. 74. H. Wang. Proving theorems by pattern recognition II. Bel l Systems Technical Journal, 40:1–41, 1961. 75. E. Winfree. On the computational power of DNA annealing and ligation. In R. Lipton and E. Baum, editors, DNA Based Computers, pages 199–221. American Mathematical Society, Providence, RI, 1996. 76. E. Winfree. Algorithmic Self-Assembly of DNA. Ph.D. thesis, California Institute of Technology, 1998. 77. E. Winfree. Simulations of computing by self-assembly. Technical Report CS- TR:1998.22, Caltech, 1998. 78. E. Winfree and R. Bekbolatov. Proofreading tile sets: Error correction for algorithmic self-assembly. In DNA Computing: 9th International Workshop on DNA Based Computers, DNA9, volume 2943 of Lecture Notes in Computer Science, pages 126–144. Springer, 2004. 79. E. Winfree, F. Liu, L. Wenzler, and N. C. Seeman. Design and self-assembly of two-dimensional DNA crystals. Nature, 394:539–544, 1998. 80. M. Yim, W. Shen, B. Salemi, D. Rus, M. Moll, H. Lipson, E. Klavins, and G. Chirikjian. Modular self-reconfigurable robot systems. Robotics & Automation Magazine, IEEE, 14(1):43–52, 2007. 81. P. Yin, H. M. T. Choi, C. R. Calvert, and N. A. Pierce. Programming biomolecular self-assembly pathways. Nature, 451:318–322, 2008. 82. P. Yin, H. Yan, X. Daniell, A. J. Turberfield, and J. Reif. A unidirectional DNA walker that moves autonomously along a track. Angew. Chem. Int. Ed., 43:4906–4911, 2004. 83. B. Yurke, A. J. Turberfield, A. P. Mills, Jr., F. C. Simmel, and J. L. Nuemann. A DNA-fuelled molecular machine made of DNA. Nature, 406:605–608, 2000. 84. Z. Zhang, E. Olsen, M. Kryger, N. Voigt, T. Tørring, E. Gultekin, M. Nielsen, R. Mo- hammadZadegan, E. Andersen, M. Nielsen, J. Kjems, V. Birkedal, and K. Gothelf. A DNA tile actuator with eleven discrete states. Angewandte Chemie International Edition, 50(17):3983–3987, 2011. 39
1811.02457
2
1811
2019-05-29T12:39:32
Tunneling on Wheeler Graphs
[ "cs.DS" ]
The Burrows-Wheeler Transform (BWT) is an important technique both in data compression and in the design of compact indexing data structures. It has been generalized from single strings to collections of strings and some classes of labeled directed graphs, such as tries and de Bruijn graphs. The BWTs of repetitive datasets are often compressible using run-length compression, but recently Baier (CPM 2018) described how they could be even further compressed using an idea he called tunneling. In this paper we show that tunneled BWTs can still be used for indexing and extend tunneling to the BWTs of Wheeler graphs, a framework that includes all the generalizations mentioned above.
cs.DS
cs
Tunneling on Wheeler Graphs Jarno Alanko1, Travis Gagie2,3, Gonzalo Navarro2,4, Louisa Seelbach Benkner5 1Dept. of Computer Science, University of Helsinki, Finland, [email protected] 2CeBiB -- Center for Biotechnology and Bioengineering, Chile 3EIT, Diego Portales University, Chile, [email protected] 4Dept. of Computer Science, University of Chile, Chile, [email protected] 5Dept. of Electrical Engineering and Computer Science, University of Siegen, Germany, [email protected] Abstract The Burrows-Wheeler Transform (BWT) is an important technique both in data compression and in the design of compact indexing data structures. It has been generalized from single strings to collections of strings and some classes of labeled directed graphs, such as tries and de Bruijn graphs. The BWTs of repetitive datasets are often compressible using run-length compression, but recently Baier (CPM 2018) described how they could be even further compressed using an idea he called tunnel- ing. In this paper we show that tunneled BWTs can still be used for indexing and extend tunneling to the BWTs of Wheeler graphs, a framework that includes all the generalizations mentioned above. Introduction The Burrows-Wheeler transform (BWT) is a cornerstone of data compression and succinct text indexing. It is a reversible permutation on a string that tends to com- press well with run-length coding, while simultaneously facilitating pattern matching against the original string. Recently, practical data structures have been designed on top of the run-length compressed BWT to support optimal-time text indexing within space bounded by the number of runs of the BWT [1]. However, run-length coding does not necessarily exploit all the available redun- dancy in the BWT of a repetitive string. To this end, Baier recently introduced the concept of tunneling to compress the BWT by exploiting additional redundancy not yet captured by run-length compression [2]. While his representation can achieve better compression than run-length coding, no support for text indexing is given. Meanwhile, the concept of Wheeler graphs was introduced by Gagie et al. as an alternative way to view Burrows-Wheeler type indices [3]. The framework can be used to derive a number of existing index structures in the Burrows-Wheeler family, like the classical FM-index [4] including its variants for multiple strings [5] and alignments [6], the XBWT for trees [7], the GCSA for directed acyclic graphs [8], and the BOSS data structure for de Bruijn graphs [9]. In this work, we show how Baier's concept of tunneling can be neatly explained in terms of Wheeler graphs. Using the new point of view, we show how to support FM-index style pattern searching on the tunneled BWT. We also describe a sam- pling strategy to support pattern counting and locating and character extraction, making our set of data structures a fully-functional FM-index. Supporting FM-index operations was posed as an open problem by Baier [2]. We also use the generality of the Wheeler graph framework to generalize the concept of tunneling to any Wheeler graph. This result can be used to compress any Wheeler graph while still supporting basic pattern searching to decide if a pattern exists as a path label in the graph. This has applications for all index structures that can be explained in terms of Wheeler graphs. Preliminaries Let G = (V, E, λ) denote a directed edge-labeled multi-graph, in which V denotes the set of nodes, E denotes the multiset of edges and λ : E → A denotes a function labeling each edge of G with a character from a totally-ordered alphabet A. Let ≺ denote the ordering among A's elements. We follow the definition of Gagie et al. [3]. Definition 1 (Wheeler graph). The graph G = (V, E, λ) is called a Wheeler graph if there is an ordering on the set of nodes such that nodes with in-degree 0 precede those with positive in-degree and for any two edges (u1, v1), (u2, v2) labeled with λ((u1, v1)) = a1 and λ((u2, v2)) = a2, we have (i) a1 ≺ a2 ⇒ v1 < v2, (ii) (a1 = a2) ∧ (u1 < u2) ⇒ v1 ≤ v2. We note that the definition implies that all edges arriving at a node have the same label. We call such an ordering a Wheeler ordering of nodes, and the rank of a node within this ordering the Wheeler rank of the node. Given a pattern P ∈ A∗, we call a node v ∈ V an occurrence of P if there is a path in G ending at v such that the concatenation of edge labels on the path is equal to P . The Wheeler ranks of all occurrences of P form a contiguous range of integers, which we call the Wheeler range of P . Finding such a range is called path searching for P . Given a Wheeler ordering of nodes, we define the corresponding Wheeler ordering of edges such that for a pair of edges e1 = (u1, v1) and e2 = (u2, v2), we have e1 < e2 iff λ(e1) ≺ λ(e2) or (λ(e1) = λ(e2) and u1 < u2). When referring to edges, the term Wheeler rank refers to the rank of the edge in the Wheeler ordering of edges, and Wheeler range refers to a set of edges whose Wheeler ranks form a contiguous interval. We use a slightly modified version of the representation of Wheeler graphs pro- posed by Gagie et al. [3]. Suppose we have a Wheeler graph with n nodes and m edges. Then we represent the graph with the following data structures: • A string L[1..m] = L1 · · · Ln where Li is the concatenation of the labels of the Li edges going out from the node with Wheeler rank i such that the labels from a node are concatenated in their relative Wheeler order. • An array C[1..A] such that C[i] is the number of edges in E with a label smaller than the ith smallest symbol in A. • A binary string I[1..n + m + 1] = X1, · · · , Xn · 1 where Xi = 1 · 0ki and ki is the indegree of the node with Wheeler rank i. • A binary string O[1..n + m + 1] = X1, · · · , Xn · 1 where Xi = 1 · 0li and li is the outdegree of the node with Wheeler rank i. Given these data structures, we can traverse the Wheeler graph with the following two operations: First, given the Wheeler rank i of a node, find the Wheeler rank of the k-th out-edge labeled c from the node using Eq. (1) below; second, given the Wheeler rank j of an edge, find the Wheeler-rank r of its target node with Eq. (2): C[c] + rankc(L, select1(O, i) − i) + k, rank1(I, select0(I, j)), (1) (2) where, given a string S, rankc(S, i) denotes the number of occurrences of character c in S[1..i] and selectc(S, i) denotes the position of the i-th occurrence of c in S. For the binary strings I and O, these operations can be carried out in constant time using o(I + O) extra bits [10]. For string L, operation rank can be carried out in time O(log logw A) on a w-bit RAM machine using o(L log A) extra bits [11, Thm. 8]. Given a Wheeler range [i, i′] of nodes, we can find the Wheeler rank of the first and last edge labeled c leaving from a node in [i, i′] with a variant of Eq. (1): C[c] + rankc(L, select1(O, i) − i) + 1 and C[c] + rankc(L, select1(O, i′ + 1) − (i′ + 1)), respectively; then we apply Eq. (2) on both edge ranks to obtain the corresponding node range (the result is a range by the path coherence property of Wheeler graphs [3]). This operation enables path searches on Wheeler graphs. Tunneling We adapt Baier's concept of blocks on the BWT [2] to Wheeler graphs. Definition 2 (Block). A block B of a Wheeler graph G = (V, E, λ) of size s and width w is a sequence of w-tuples (v1,1, . . . , vw,1), . . . , (v1,s, . . . , vw,s) of pairwise dis- tinct nodes of G such that (i) For 1 ≤ i ≤ w − 1 and 1 ≤ j ≤ s, the node vi+1,j is the immediate successor of vi,j with respect to the Wheeler ordering on V . (ii) For 1 ≤ i ≤ w, let Vi = {vi,j 1 ≤ j ≤ s}, Ei = E ∩(Vi ×Vi), and λi = λ(cid:12)(cid:12)Ei . The subgraphs ti = (Vi, Ei, λi) are isomorphic subtrees of G, preserving topology and labels. For 1 ≤ i ≤ w − 1, let fi : ti → ti+1 denote the corresponding isomorphisms, thus vi+1,j = fi(vi,j) for all 1 ≤ j ≤ s. (iii) For 1 ≤ i ≤ w, let vi,1 denote the root node of ti. In particular, vi,1 is the only node of indegree 0 in ti. All edges leading to a node in {vi,1 1 ≤ i ≤ w} are labeled with the same character. The indegrees of these nodes may differ. (iv) For 1 ≤ i ≤ w and 2 ≤ j ≤ s, the nodes vi,j are of indegree 1 in G (and by (i) and (ii), of indegree 1 in the corresponding subtree ti, that is, the only edge in G leading to such a node vi,j belongs to the subtree ti). b a 24 b c b 63 c 74 41 aa c a 31 9 4 a a c b b b a c 25 64 c b a b b 32 a a b 75 42 10 a b b b a a a b c b c a b b a a b b c c a b b a b 5 a c c c c a a c c Figure 1: Tunneling a block of size 7 and width 2 in a Wheeler graph. (v) For every integer 1 ≤ j ≤ s and character c ∈ A, exactly one of the following conditions holds: (a) For every 1 ≤ i ≤ w, there is exactly one out-edge of vi,j labeled with c, which is contained in Ei. There are no out-edges of vi,j labeled with c leading to non-block nodes. (b) For every 1 ≤ i ≤ w, there is no out-edge of vi,j labeled with c contained in Ei. There may be out-edges of vi,j labeled with c leading to non-block nodes. The number of such out-edges for each node may differ. A block B = ((v1,1, . . . , vw,1), . . . , (v1,s, . . . , vw,s)), abbreviated B = (vi,j)1≤i≤w,1≤j≤s, is called maximal in size if, for any choice of nodes v1, . . . , vw ∈ V , the sequences of size s + 1 of w-tuples ((vi)1≤i≤w, (vi,1)1≤i≤w, . . . , (vi,s)1≤i≤w) and ((vi,1)1≤i≤w, . . . , (vi,s)1≤i≤w, (vi)1≤i≤w) do not form a block. The block is called maximal in width if, for any choice of nodes v1, . . . , vs ∈ V , the sequences of (w+1)-tuples ((vj, v1,j, . . . , vw,j))1≤j≤s and ((v1,j, . . . , vw,j, vj))1≤j≤s do not form a block. A block is called maximal if it is maximal in both width and size. Let G = (V, E, λ) denote a Wheeler graph containing a maximal block. We then obtain a directed edge-labeled (multi-)graph Gt from G as follows: (i) We merge the corresponding nodes and edges of the isomorphic subtrees ti, with 1 ≤ i ≤ w, in order to obtain a subtree t of G. In particular, for 1 ≤ j ≤ s, we collapse the nodes of the w-tuple (v1,j, . . . , vw,j) to obtain a node xj of the graph t. The labels of the merged edges coincide and stay the same. (ii) All edges leading from a non-block node u to the root node vi,1 of the subtree ti are redirected to lead to the node x1 of t, preserving their labels. (iii) All edges leading from a node vi,j of subgraph ti to a non-block node u are redirected to leave from the node xj of t, preserving their labels. Formally, the graph Gt = (Vt, Et, λt) is defined as follows: The set of nodes of Gt is defined as Vt = (V \ {vi,j 1 ≤ i ≤ w, 1 ≤ j ≤ s}) ∪ {xj 1 ≤ j ≤ s}. We define a function ϕ : V → Vt mapping a node in G to its corresponding node in Gt by ϕ(v) =(v xj if v /∈ {vi,j 1 ≤ i ≤ w, 1 ≤ j ≤ s} if v = vi,j for some integers 1 ≤ i ≤ w, 1 ≤ j ≤ s. The multiset of edges Et is defined as the difference of multisets {(ϕ(u), ϕ(v)) (u, v) ∈ E} \ {(ϕ(u), ϕ(v)) (u, v) ∈ Ei, 2 ≤ i ≤ w}. For every edge (x, y) ∈ Et, there is a corresponding edge (u, v) ∈ E such that (x, y) = (ϕ(u), ϕ(v)). Thus, we define λt((x, y)) = λ((u, v)). This is well-defined because only edges with the same label are merged. We call tunneling the process of obtaining the graph Gt from G. See Fig. 1. Lemma 3. Let G = (V, E, λ) denote a Wheeler graph containing a maximal block B = (vi,j)1≤i≤w,1≤j≤s of width w and size s and let Gt = (Vt, Et, λt) denote the graph obtained from G by tunneling. Then Gt is a Wheeler graph. Proof. To show that Gt is a Wheeler graph, we must define a Wheeler ordering on Vt. As only consecutive nodes of V are merged in order to obtain Gt, this induces a canon- ical ordering on the nodes of Vt: Pick two nodes x 6= y of Vt. Let ϕ−1(x), ϕ−1(y) ⊆ V denote the corresponding preimages under ϕ. By property (i) of Def. 2, the nodes of ϕ−1(x) (respectively, ϕ−1(y)) are consecutive in Wheeler order. Thus, we either have u < v for every u ∈ ϕ−1(x), v ∈ ϕ−1(y), or vice versa. We set x < y in the first case and x > y in the second. This yields an ordering on the nodes of Vt such that for any two nodes u 6= v of V , we have ϕ(u) < ϕ(v) ⇒ u < v and u < v ⇒ ϕ(u) ≤ ϕ(v). First, take two nodes x 6= y of Gt, such that x has in-degree 0 and y is of positive in-degree. As in the process of tunneling the in-degree of a node is not decreased, every node u ∈ ϕ−1(x) is of in-degree 0 as well. Moreover, as y is of positive in-degree, there is a node v ∈ ϕ−1(y), such that v is of positive in-degree. As G is a Wheeler graph, we have u < v and thus x = ϕ(u) ≤ ϕ(v) = y. As by assumption, x 6= y, this yields x < y. Therefore, nodes with in-degree 0 precede those with positive in-degree. Now, take two edges (x, y) and (x′, y′) of G labeled with a and a′, respectively. Without loss of generality, assume a (cid:22) a′. Choose u ∈ ϕ−1(x), v ∈ ϕ−1(y), u′ ∈ ϕ−1(x′) and v′ ∈ ϕ−1(y′), such that (u, v) and (u′, v′) are edges of G. By definition of Gt, the label on the edge (u, v) (resp., (u′, v′)) is a (resp., a′). We then have (x, y) = (ϕ(u), ϕ(v)) and (x′, y′) = (ϕ(u′), ϕ(v′)). Consider the two cases of Def. 1: (i) Let a ≺ a′. As G is a Wheeler graph, we have v < v′ and thus ϕ(v) ≤ ϕ(v′). If ϕ(v) < ϕ(v′) we are done, so assume ϕ(v) = ϕ(v′). We then have v = vi,j and v′ = vk,j for some nodes vi,j 6= vk,j of the block. By properties (ii) - (iv) of Def. 2, the labels of the incoming edges of vi,j and vk,j are the same, contradicting a ≺ a′. (ii) Let a = a′ and without loss of generality assume u < u′. This yields ϕ(u) ≤ ϕ(u′). As G is a Wheeler graph, we obtain v ≤ v′, and thus ϕ(v) ≤ ϕ(v′). Two blocks B1 = (vi,j)1≤i≤w1,1≤j≤s1 and B2 = (ui,j)1≤i≤w2,1≤j≤s2 of a Wheeler graph G = (V, E, λ) are called disjoint if their corresponding node sets {vi,j 1 ≤ i ≤ w1, 1 ≤ j ≤ s1} ⊂ V and {ui,j 1 ≤ i ≤ w2, 1 ≤ j ≤ s2} ⊂ V are disjoint. Since, by Lemma 3, a graph obtained from a Wheeler graph by tunneling is still a Wheeler graph, we can tunnel iteratively with disjoint blocks. Definition 4 (Tunneled Graph). Let G be a Wheeler graph containing k pairwise disjoint maximal blocks B1, . . . , Bk. The tunneled graph Gt of G corresponding to those blocks is defined as the Wheeler graph obtained from G by iteratively tunneling all the blocks Bi, for 1 ≤ i ≤ k. Each maximal block Bi is also called a tunnel. Note that tunnels more general than the tree form given in Def. 2 would break the Wheeler graph rules of Def. 1 before or after tunneling, except that the nodes of t1 and tw could be connected with outside nodes, all of Wheeler ranks smaller and larger, respectively, than their corresponding tunnel edges. We could also handle forests, but those can be seen as a set of disjoint tunnels. Path searching on a tunneled Wheeler graph Wheeler graphs can be searched for the existence of paths whose concatenated labels yield a given string P [3], generalizing the classical backward search on strings [4]. We now show that those searches can also be performed on tunneled Wheeler graphs. Given Gt, we can simulate the traversal of G as follows. A node v ∈ V is represented by a pair hϕ(v), off(v)i, where ϕ(v) is the corresponding node in Gt as defined in the previous section and off(v) is the tunnel offset of v. If the node ϕ(v) does not belong to a tunnel, then it must be that off(v) = 1 and the pair represents just the node v. Otherwise, ϕ(v) corresponds to multiple nodes (vi,j)1≤i≤w of some tunnel B = (vi,j)1≤i≤w,1≤j≤s in G and the tunnel offset represents which of the original nodes we are currently at, in Wheeler rank order. That is, if v = vi,j, then off(v) = i. The idea is that, when our traversal enters a tunnel B, we remember which orig- inal subgraph ti we actually entered, and use that information to exit the tunnel accordingly. We mark the nodes of Gt that are tunnel entrances in a bitvector, and the other tunnel nodes in another bitvector. We then distinguish three cases. If we are at a pair hi, 1i not in a tunnel, compute j and Keeping out of tunnels. r with Eqs. (1) and (2), respectively, and it turns out that r is not marked as a tunnel entrance, then we stay out of any tunnel and our new pair is hr, 1i. Entering a tunnel. Assume we are at a pair hi, 1i, where i = ϕ(v) for some non- tunnel node v, compute j and r with Eqs. (1) and (2), respectively, and then it turns out that r = ϕ(u) is marked as a tunnel entrance. Then we have entered a tunnel and the new pair must be hr, oi, for some offset o we have to find out. The w nodes (up)1≤p≤w ∈ V that were collapsed to form ϕ(u) are of indegree 0 within the subgraphs tp, but may receive a number of edges from non-tunnel nodes (indeed, we are traversing one). Since all those edges are labeled by the same symbol c, the Wheeler rank of all the sources of edges that lead to up must precede the Wheeler ranks of all the sources of edges that lead to up′ for any 1 ≤ p < p′ ≤ w. The problem is, knowing that we are entering by the edge with Wheeler rank j, and that the edges that enter into r start at Wheeler rank select1(I, r) − r + 1, how to determine the index o of the subgraph to we have entered. For this purpose, we store a bitvector I ′[1..m], where m = Et, so that I ′[j] = 1 iff the jth edge of Et, in Wheeler order, corresponds to the first edge leading to its target in G. Said another way, I ′ marks, in the area of I corresponding to the edges that reach ϕ(u), which were the first edges arriving at each copy up that was collapsed to form ϕ(u). We can then compute o = rank1(I ′, j) − rank1(I ′, select1(I, r) − r). Moving in a tunnel. Assume we are at a pair hi, oi inside a tunnel, for i = ϕ(u), and want to traverse the kth edge labeled c leaving the pair. We then use the formulas given after Eqs. (1) and (2) to compute the first and last edge labeled c leaving node i. These form a Wheeler range [j1, j2]. We then apply Eq. (2) from j = j1 to find the first target node r. If r is marked as an in-tunnel node, then we know that letter c keeps us inside the tunnel, j1 = j2 (that is, there is exactly one out-edge by letter c from each of the nodes (up)1≤p≤w that were collapsed to form ϕ(u), by part (a) of item (v) of Definition 2), and thus our new node is simply hr, oi. If, instead, r is not an in-tunnel node, then letter c takes us out of the tunnel, and we must compute the appropriate target node. Each of the nodes us may have zero or more outgoing edges labeled c. The Wheeler ranks of the edges leaving up precede those of the edges leaving up′, for any 1 ≤ p < p′ ≤ w. Thus, we use a bitvector O′[1..m] analogous to I ′, where O′[j] = 1 iff the jth edge of Et in Wheeler order corresponds to the first edge leaving a node in G by some letter c. In the range O′[j1, j2], then, each 1 marks the first edge leaving from each up. The kth edge labeled c leaving from uo is thus j = select1(O′, rank1(O′, j1) + o − 1) + k − 1. If, for pattern searching, we want the last edge labeled c leaving from uo, this is j = select1(O′, rank1(O′, j1) + o) − 1. We then compute the correct target node rank r using Eq. (2). Finally, there are two possibilities. If the new node r is marked as a tunnel entrance, then we have left our original tunnel to enter a new one. We then apply the method described to enter a tunnel from the values j and r we have just computed. Otherwise, r is not a tunnel node and we just return the pair hr′, 1i. Therefore, we can simulate path searching in G by using just our representation of Gt. Given a character c and the Wheeler range [i, i′] of a string S, we can find the Wheeler range of the string Sc by following the first and last edge labeled with c leaving from [i, i′], as described after Eqs. (1) and (2), and operate as described from the corresponding ranks j and r. Thus, after P steps, we have the Wheeler range of the nodes that can be reached by following the characters in P . Theorem 5. We can represent a Wheeler graph G with labeled edges from the alphabet [1..σ] in nt log σ + o(nt log σ) + O(nt) bits of space, where nt is the number of edges in a tunneled version of G, such that we can decide if there exists a path labeled with P in time O(P log logw σ) in a w-bit RAM machine. Wheeler graphs of strings We now focus on a particular type of Wheeler graphs, which corresponds to the traditional notion of Burrows-Wheeler Transform (BWT) [12] and FM-index [4] (only that our arrows go forward in the text, not backwards), and show that the full self- index functionality on strings can still be supported after tunneling. This is close to the original tunneling concept developed by Baier [2], to which we now add search and traversal capabilities. Definition 6 (Wheeler graph of a string). Let T be a string over an alphabet A. The Wheeler graph of the string T is defined as G = (V, E, λ) with V := {v1, . . . , vT +1}, E = {(vi, vi+1) 1 ≤ i ≤ T + 1} and λ : E → A with λ((vi, vi+1)) = T [i], where T [i] denotes the ith character in the string T . In other words, the Wheeler graph of a string T is a path of length T + 1, where the ith edge is labeled with the ith character of T . There is exactly one valid Wheeler- ordering, which is given by the colexicographic order of prefixes of T , i.e., node vi comes before node vj iff the reverse of T [1..i − 1] is lexicographically smaller than the reverse of T [1..j − 1]. There is a close connection to the BWT: the Wheeler order is given by the suffix array of the reverse of T and therefore the L-array corresponds to the BWT of the reverse of T . For this special case of Wheeler graphs, Def. 2 simplifies as follows: A block B in G of width w and length s is a sequence of length s + 1 of w-tuples (v1,1, . . . , vw,1), . . . , (v1,s+1, . . . , vw,s+1) of pairwise distinct nodes of G satisfying (i) For 1 ≤ i ≤ w − 1 and 1 ≤ j ≤ s + 1, the immediate successor of the node vi,j with respect to the Wheeler ordering on V is vi+1,j. (ii) For 1 ≤ i ≤ w and 1 ≤ j ≤ s, (vi,j, vi,j+1) is an edge of E. (iii) For 1 ≤ j ≤ s, all the edges leading to the nodes in {vi,j 1 ≤ i ≤ w} have the same label. The process of tunneling in a Wheeler graph G of a string then consists of collapsing the nodes of each w-tuple (v1,j, . . . , vw,j) into a single node xj and collapsing the edges in {(vi,j, vi,j+1) 1 ≤ i ≤ w} into a single edge (xj, xj+1). Furthermore, all edges leading to a node vi,1 for some integer 1 ≤ i ≤ w are redirected to lead to the node x1 and all edges leaving from a node vi,s for some integer 1 ≤ i ≤ w are redirected to leave from the node xs. The labels of the edges stay the same. Note that we ensure that every path of the tunnel is followed by a non-tunnel node. Suppose we have the Wheeler graph G = (V, E, λ) of a string T . Denote T = n. Let Gt = (Vt, Et, λt) be a tunneled version of G with Vt = nt. We represent Gt with the data structures L, C, I and O described in the preliminaries. We can do path searches without the bitvectors I ′ and O′ used in the previous section, as in these particular graphs they are all 1s. We now describe how to implement the operations count, locate and extract, analogous to the operations in a regular FM-index, by using sampling schemes that extend those of the standard FM-index solution. First, for each tunnel of length at least log nt in Gt, we store a pointer and the distance to the end of the tunnel for every (log nt)th consecutive node in the tunnel. This information takes O(nt) bits of space and lets us skip to the end of the tunnel in O(log nt) steps by walking forward until the end of the tunnel is found, or until we hit a node with a pointer to the end. The stored distance value tells us how many nodes we have skipped over. Locating. We define a graph Gc, called the contracted graph, that is identical to Gt except that tunnels have been contracted into single nodes. Let ψ : Gt → Gc be the mapping such that nodes in a tunnel in Gt map to the corresponding contracted node in Gc. Take the path Q = (q1, . . . , qn) of all nodes in G in the order of the path from the source to the sink. Let Qc = ((ψ ◦ ϕ)(q1), . . . , (ψ ◦ ϕ)(qn)) be the corresponding path in Gc. Let Q′ c be the same sequence as Qc except that every run of the same node is contracted to length 1. Note that this path traverses all edges of Gc exactly once, i.e., it is an Eulerian path. We store a sample for every (log n)th node in the path on Q′ c, except that if a node represents a contracted tunnel, we sample the next node (our definition of blocks guarantees that the next node is not in a tunnel). The value associated with the sample is the text position corresponding to the node. This takes space O(nc), where nc is the number of nodes in Gc. We can then locate the text position of a node by walking to the next sample in text order, using at most log n graph traversal operations in Gt. In this walk we may have to skip tunnels, which is done in O(log nt) time using their stored pointers when necessary. In the end, we subtract the travelled distance from the text position of the sampled node to get the text position of the original node. We can view such a search as a walk in Gc, where traversing a contracted-tunnel node takes O(log nt) graph traversal steps and traversing a non-tunneled node takes just one. The worst case time, dominated by the time to traverse tunnels, is O(log n log nt) steps. Counting. Efficiently counting the number of occurrences of a pattern given its Wheeler-range requires a sampling structure different from that used for locating. The Wheeler-range could span many tunnels, whose widths are not immediately available. Let us define w(v) as the width of the tunnel v belongs to, or 1 if v does not belong to a tunnel. We can then afford to sample the cumulative sum of the values w(v) for all the nodes v up Wheeler-rank k for every k multiple of log nt nodes, using O(nt) bits of space. Within this space we can also mark which nodes belong to tunnels. This allows us to compute the sum of values w(v) for any Wheeler range with endpoints that are multiples of log nt, which leaves us to compute the width of only O(log nt) nodes at the ends of the range. For these nodes, we add 1 if they are not in a tunnel; otherwise we go to the end of the tunnel using the stored pointers and compute the width of the tunnel by looking at the out-degree of the exit of the tunnel. The total counting time is then O(log2 nt) graph traversal steps. Extracting. To extract characters from T , we use a copy of the samples hWheeler rank of graph node v, text position of node vi we store for locating, but sorted by text position. Also, at the end of every tunnel of length at least log nt, we store backpointers to the nodes storing pointers to the end of the tunnel. Suppose we want to extract T [i..j]. If we know the node u of Gt representing position i, we can simply walk forward from that node to find the j − i + 1 desired characters by accessing L at each position. Therefore it is enough to show how to find the node u. We binary search our sample pairs to find the Wheeler rank of the closest sample before text position i. This sample is at most log n nodes away (in Gc) from u, so we can reach u in O(log n) steps in Gc, or equivalently, O(log n log nt) steps in Gt. Note, however, that our target node u might be in a tunnel. If the tunnel is of length less than log nt, we walk towards it normally. If u is inside a tunnel of length at least log nt, instead, we use its pointers to skip to the end of the tunnel, and from there take the backpointer to the nearest position before u; we then walk the (at most) log nt nodes until reaching u. The time needed to reach u is again dominated by the time to skip over and within tunnels, so the total time complexity is O(log n log nt) graph traversal steps. We note that, in all cases, our graph traversal steps are of a particular form, because all the edges leaving from the current node are labeled by the same symbol. That is, the c in Eq. (1) is always L[select1(O, i)]. This particular form of rank is called partial rank and it can be implemented in constant time using o(L log A) further bits [13, Lem. 2]. The following theorem summarizes the results in this section. Theorem 7. We can store a text T [1..n] over alphabet [1..σ] in nt log σ +o(nt log σ)+ O(nt) bits of space, such that in a w-bit RAM machine we can decide the existence of any pattern P in time O(P log logw σ), and then report the text position of any occur- rence in time O(log n log nt) or count the number of occurrences in time O(log2 nt). We can also extract any k consecutive characters of T in time O(k + log n log nt), where nt ≤ n is the number of nodes in a tunneled Wheeler graph of T . Future work Open problems are: How to find the optimal blocks that minimize space? Can we still support path searching if blocks are overlapping? Can the O(log2 n) times of counting, locating, and extracting be reduced to O(log n), as in the basic sampling scheme on non-tunneled BWTs? How to extend those operations to more complex graphs, like trees? And can we count paths instead of path endpoints? Acknowledgements. Funded in part by EU's Horizon 2020 research and innova- tion programme under Marie Sk lodowska-Curie grant agreement No 690941 (project BIRDS). T.G. and G.N. partially funded with Basal Funds FB0001, Conicyt, Chile. T.G. partly funded by Fondecyt grant 1171058. L.S.B. supported by the EU project 731143 - CID and the DFG project LO748/10-1 (QUANT-KOMP). Operation extract was designed in StringMasters 2018. We thank Uwe Baier for helpful discussions. References [1] T. Gagie, G. Navarro, and N. Prezza, "Optimal-time text indexing in BWT-runs bounded space," in Proc. 29th SODA, 2018, pp. 1459 -- 1477. [2] U. Baier, "On undetected redundancy in the Burrows-Wheeler transform," in Proc. 29th CPM, 2018, pp. 3.1 -- 3.15. [3] T. Gagie, G. Manzini, and J. Sir´en, "Wheeler graphs: A framework for BWT-based data structures," Theoretical Computer Science, vol. 698, pp. 67 -- 78, 2017. [4] P. Ferragina and G. Manzini, "Indexing compressed texts," Journal of the ACM, vol. 52, no. 4, pp. 552 -- 581, 2005. [5] S. Mantaci, A. Restivo, G. Rosone, and M. Sciortino, "An extension of the Burrows -- Wheeler transform," Theoretical Computer Science, vol. 387, no. 3, pp. 298 -- 312, 2007. [6] J. C. Na, H. Kim, H. Park, T. Lecroq, M. L´eonard, L. Mouchard, and K. Park, "FM- index of alignment: A compressed index for similar strings," Theoretical Computer Science, vol. 638, pp. 159 -- 170, 2016. [7] P. Ferragina, F. Luccio, G. Manzini, and S. Muthukrishnan, "Structuring labeled trees for optimal succinctness, and beyond," in Proc. 46th FOCS, 2005, pp. 184 -- 193. [8] J. Sir´en, N. Valimaki, and V. Makinen, "Indexing graphs for path queries with appli- cations in genome research," IEEE/ACM Transactions on Computational Biology and Bioinformatics, vol. 11, no. 2, pp. 375 -- 388, 2014. [9] A. Bowe, T. Onodera, K. Sadakane, and T. Shibuya, "Succinct de bruijn graphs," in Proc. WABI, 2012, pp. 225 -- 235. [10] D. R. Clark, Compact PAT Trees, Ph.D. thesis, University of Waterloo, Canada, 1996. [11] D. Belazzougui and G. Navarro, "Optimal lower and upper bounds for representing sequences," ACM Transactions on Algorithms, vol. 11, no. 4, pp. article 31, 2015. [12] M. Burrows and D. Wheeler, "A block sorting lossless data compression algorithm," Tech. Rep. 124, Digital Equipment Corporation, 1994. [13] D. Belazzougui and G. Navarro, "Alphabet-independent compressed text indexing," ACM Transactions on Algorithms, vol. 10, no. 4, pp. article 23, 2014.
1507.07789
1
1507
2015-07-28T14:46:48
Duality and Nonlinear Graph Laplacians
[ "cs.DS" ]
We present an iterative algorithm for solving a class of \\nonlinear Laplacian system of equations in $\tilde{O}(k^2m \log(kn/\epsilon))$ iterations, where $k$ is a measure of nonlinearity, $n$ is the number of variables, $m$ is the number of nonzero entries in the graph Laplacian $L$, $\epsilon$ is the solution accuracy and $\tilde{O}()$ neglects (non-leading) logarithmic terms. This algorithm is a natural nonlinear extension of the one by of Kelner et. al., which solves a linear Laplacian system of equations in nearly linear time. Unlike the linear case, in the nonlinear case each iteration takes $\tilde{O}(n)$ time so the total running time is $\tilde{O}(k^2mn \log(kn/\epsilon))$. For sparse graphs where $m = O(n)$ and fixed $k$ this nonlinear algorithm is $\tilde{O}(n^2 \log(n/\epsilon))$ which is slightly faster than standard methods for solving linear equations, which require approximately $O(n^{2.38})$ time. Our analysis relies on the construction of a nonlinear "energy function" and a nonlinear extension of the duality analysis of Kelner et. al to the nonlinear case without any explicit references to spectral analysis or electrical flows. These new insights and results provide tools for more general extensions to spectral theory and nonlinear applications.
cs.DS
cs
Duality and Nonlinear Graph Laplacians International Computer Science Institute W. M. Keck Science Department of Claremont Eric J. Friedman [email protected] Adam S. Landsberg McKenna, Pitzer, and Scripps Colleges [email protected] 5 1 0 2 l u J 8 2 ] S D . s c [ 1 v 9 8 7 7 0 . 7 0 5 1 : v i X r a ABSTRACT We present an iterative algorithm for solving a class of nonlinear Laplacian system of equations in O(k2m log(kn/ǫ)) iterations, where k is a measure of nonlinearity, n is the number of variables, m is the number of nonzero entries in the graph Laplacian L, ǫ is the solution accuracy and O() neglects (non-leading) logarithmic terms. This algorithm is a natural nonlinear extension of the one by of Kelner et. al., which solves a linear Laplacian system of equations in nearly linear time. Unlike the linear case, in the nonlinear case each iteration takes O(n) time so the total running time is O(k2mn log(kn/ǫ)). For sparse graphs where m = O(n) and fixed k this nonlinear algorithm is O(n2 log(n/ǫ)) which is slightly faster than standard methods for solving linear equations, which require approximately O(n2.38) time. Our analysis relies on the construction of a nonlinear "energy function" and a nonlinear extension of the duality analysis of Kelner et. al to the nonlinear case without any explicit references to spectral analysis or electrical flows. These new insights and results provide tools for more general extensions to spectral theory and nonlinear applications. General Terms Graph Laplacian, Spectral analysis, Nonlinear equations INTRODUCTION 1. The goal of solving linear systems of equations in nearly lin- ear time, spearheaded by Vaidya [10], has propelled a rev- olution in spectral graph theory and several related fields. In addition to many important results about graph sparsi- fication (see [6, 11] for overviews and references) this the- ory has led to two main types of methods of solving sets of symmetrical diagonally dominant linear equations in nearly linear time -- the first using graph sparsification (and ul- tra sparsifiers) (e.g., [8]) combined with classical iterative methods, and the second which relies on a underlying low stretch spanning tree to provide an algorithm that relies on cycle updates for "electrical flows" in the underlying graph [3]. In addition to having important applications in matrix computations, these results have led to a large number theo- retical results, reducing the complexity of several important graphical algorithms. The key insights underlying these approaches are the re- duction of a set of symmetrical diagonally dominant linear equations to a system of equations Lx = b arising from a graph Laplacian, L. Previous analyses (e.g., [8]) rely on the linearity of the underlying system of equations and the use of a carefully chosen spanning tree on the underlying graph. Thus, one might expect that linearity is required for the analyses; however, as we will show, linearity is not necessary and there appears to be a more general struc- ture underlying these approaches which allows a certain de- gree of nonlinearity. More precisely, we show that one can generalize the graph Laplacian in a nonlinear manner and apply a nonlinear extension of the Algorithm in Kelner et [3] to solve them in O(k2m log(kn/ǫ)) iterations and al. O(k2mn log(kn/ǫ)) time. Our analysis relies on the con- struction of an "nonlinear energy function" and extension of their duality analysis to nonlinear Laplacian systems of equations. While providing new insights into the linear problem, this analysis shows that one can generalize graph Laplacians without losing much of the underlying structure and suggests further nonlinear generalizations. 2. RELATED WORK The idea of using a spanning tree to precondition a set of linear equations comes from an unpublished presentation by Vaidya [10]. That paper led to a large body of work over many years that led to Spielman and Teng's seminal paper [8] which showed the theoretical existence of nearly linear time algorithms for systems of equations, using very sophis- ticated machinery [4, 5, 7, 9]. Our algorithm is based on Kelner et. al's algorithm [3], which dramatically reduces the amount of machinery re- quired. Its origins are clearly implicitly based on the more sophisticated machinery in the earlier papers, such as low- stretch spanning trees (e.g., [1] ) and ultra-sparsifiers (e.g., [8]), but does not require them directly. 3. GENERALIZED MODEL AND RELAX- ATION We begin with an undirected weighted graph G =< V, E, w > with node set V , edges E and weights wij > 0 where wij = wji. The graph Laplacian of G is given by L where Lij = a Laplacian system of equations is simply Lx = b. Such a −wij for i 6= j and Lii = −Pj6=i wij . Given a vector b ∈ ℜn system always has a solution if Pi bi = 0, which we denote x∗ and is unique up to an additive constant. Throughout this paper whenever we talk about solutions, we will ignore the multiplicity of solutions due to the nullspace of L. Note that for notational clarity we will always assume that G is connected. In the case that G is not connected one can simply solve on each connected component separately. Let N (i) be the neighbors of node i in the graph G. It is well known that one can express the action of the Laplacian as (Lx)i = Xj∈N(i) wij(xi − xj), which only depends on xi −xj for (i, j) ∈ E. In the following we will consider a generalization of this to non-linear graph Laplacians where (Lx)i = Xj∈N(i) wij hij (xi − xj) (∗) where the nonlinear function hij (·) is anti-symmetric, satis- fies hij (−v) = −hij (v), is continuous, the derivative h′ ij (v) is left-continuous, vh′ ij (v) is strictly increasing and 1/k ≤ h′ ij (v) < k for a chosen k ≥ 1. Note that the running time of our algorithm will depend on k and the computational complexity of hij (·). In order to simplify the analysis with respect to hij (·), we assume that we have constant time oracles for computing hij (·), h−1 ij (·), and h′ ij (·). The more natural version where these oracles require O(log(1/ǫ)) computations, would only increase our running times by O(log(1/ǫ)) factors, where ǫ is the accuracy of the solution. A simple example of this model arises when h′ ij (v) = 1/k for v ≤ 1 and h′ ij (v) = 1 otherwise. This example arises when the cost is small for small flows, in contrast to the linear case where the "cost" of a flow between edges is linear in the flow. More generally, we can choose h′ ij (v) to be constant except at a discrete set of points where it increases, corresponding to a piecewise linear hij (v) with discrete increases in slope, bounded by slopes 1/k and k. Surprisingly, one can also use an hij (v) that is not convex in the positive quadrant. For ex- ample the function given by hij (v) = v + arctan(v) satisfies the requirements and is not convex in the positive quad- rant, leading to"economies of scale" where the incremental cost can decrease as a flow increases. Following Kelner et. al [3] we can introduce new variables, gij , which for generalized Laplacians allow us to rewrite Lx = b as: Formally, we will only have a single variable for each edge, written ge for e ∈ E but for notational convenience we will write gij = −gji where one of these two variables as canon- ical and the other is simply a notational convenience. For example if P(i,j)∈E gij corresponds to a sum where each edge appears once, while in Pi∈V Pj∈N(i) gij each ge ap- pears twice. Note that our variables differ from those in Kelner et. al [3] and most of the literature in the linear case where in the electrical model our gij variables correspond to the voltage drop between nodes i and j while their hij corresponds to the current flow between those nodes. Algebraically, gij = hij /wij . 4. CYCLE UPDATES A key idea in the algorithm by Kelner et al [3] is to update the gij's using cycles to maintain b-feasibility. Let C be an oriented set of edges in G that forms a cycle. Let α(C, t) be defined such that for all (i, j) ∈ C, wij hij (gij + αij (C, t)) = wijhij (gij ) + t, and αij (C, t) = 0 for (i, j) 6∈ C and note that α(C, 0) = 0 by construction. It can be easily checked that this procedure maintains b-feasibility for any value of t, since the increase from an incoming edge of the cycle through any node is canceled by the decrease in the sum from the outgoing edge that follows it. When hij (·) is the identity, αij (C, t) = t/wij as in the linear analysis. The key idea in the linear analysis is to iteratively update cy- cles by updating cycles using α(C, t) in order to approach p- feasibility while always maintaining b-feasibility. The anal- ysis [3] relies on duality related to "electrical systems" with an energy function. In the nonlinear case we can also define an analogous energy function Φ(g) = Xij φij(gij ) where g is the vector of gij's and φij (gij) = wij Z gij 0 sh′ ij (s) ds. In the linear case where hij (v) is the identity, this reduces to the standard energy function of [3], after a change of variables. The key insight in our analysis is that for any cycle C the "cycle adjustment", α(C, t) that minimizes Φ(g) satisfies p- feasibility around the cycle. ∀i ∈ V : Xj∈N(i) wij hij (gij) = bi (BCi) Lemma 1. If for some cycle C t∗ = argmintΦ(g + α(C, t)) ∀(i, j) ∈ E : gij = xi − xj (P Ci) then which decomposes the problem in a natural way into b- constraints (BCi) and p-constraints (P Ci), where x is a 'potential function' for g. We say that g is b-feasible if g satisfies the b-constraints and p-feasible for p-constraints. (gij + αij (C, t∗)) = 0. X(i,j)∈C Proof. To see this note that Φ(g) is convex by the defi- nition of the h's and that the derivative is Summing over C and integrating over t yields dΦ(g + α(C, t)) dt = X(i,j)∈C dφij(gij + αij (C, t)) dt X(i,j)∈C αij (C, t) ≤ kt/WC = X(i,j)∈C φ′ ij(gij + αij (C, t)) dαij(C, t) dt . Since GC + P(i,j)∈C αij (C, t∗) = 0 this implies that t∗ ≥ −WCGC /k. Combining this with (***) yields Inserting the definition of φij into the right hand side of the equation yields Φ(g) − Φ(g + α(C, t∗)) ≥ Z 0 −WC GC /k (GC + kt/WC )dt = X(i,j)∈C wij (gij+αij (C, t))h′ ij(gij+αij (C, t)) dαij(C, t) dt . Implicitly differentiating the defining equation for α(C, t) with respect to t gives wij h′ ij (gij + αij (C, t)) dαij(C, t) dt = 1, (∗∗) which combined with the previous equation and the defini- tion of t∗ gives the desired result after setting the derivative to 0. ✷ This lemma implies our first theorem: Theorem 1. If g is a b-feasible flow that minimizes Φ(g) over all "cycle updates" in G, then g is also p-feasible. Proof. Clearly if there are no cycle updates that de- crease the energy then by the preceding Lemma the flows around those cycles must sum to 0. ✷ We next derive a quantitative measure of the gain in energy from a cycle update. This will depend on both the initial flow around the cycle GC = X(i,j)∈C gij and the harmonic sum of the w's around the cycle WC = ( X(i,j)∈C 1/wij )−1. Lemma 2. For a cycle C the decrease in energy from a cycle update satisfies: Φ(g) − Φ(g + α(C, t∗)) ≥ WCG2 C/(2k). Proof. We assume that GC ≤ 0. (If not then simply traverse the cycle in the opposite direction.) As seen in the proof in Lemma 1 dΦ(g + α(C, t)) dt = X(i,j)∈C (gij + αij (C, t)). Integrating from t = t∗ to t = 0 yields Φ(g)−Φ(g+α(C, t∗)) = Z 0 t∗ (GC + X(i,j)∈C αij (C, t))dt (∗∗∗). Note that the integrand is 0 at t = t∗, GC at t = 0 and is strictly decreasing over the range of integration. Using (**) we see that dαij(C, t) dt = (wij h′ ij (gij + αij (C, t)))−1 ≤ k/wij and integrating completes the proof. ✷ To compute the cycle update we can use Newton's method on the derivative Φ(g + α(C, t)), written in the form. GC + X(i,j)∈C αij (C, t). Note that the sum is bounded by (t/WC)/k and (t/WC )k so we can use a binary search on the interval [0, (t/WC)k]. Since the function is convex in t, for any t ∈ [t∗/4, 3t∗/4] the value of the function will be reduced by at least a factor of 2. This will require O(log(k2)) iterations so the total time required is O(n log(k)) since each evaluation of the sum requires O(n) time. Thus we have proven an approximate version of the previous lemma. Lemma 3. One can compute an approximate cycle update in O(n log(k)) such that for any cycle C the decrease in en- ergy satisfies: Φ(g) − Φ(g + α(C, t∗)) ≥ WCG2 C /(4k). 5. SPANNING TREES Given a spanning tree, T ⊆ E one can analyze a simple set of cycles that span the cycle space of all cycles [2]. Given an edge (i, j) ∈ E \ T define the tree path P(i,j) to be the minimal oriented set of edges from node j to node i and let the tree cycle to be C(i,j) = P(i,j) S(i, j). Thus, instead of minimizing Φ(g) over all cycles one only needs to minimize it over each of the tree cycles. As in [3], we will choose edges e ∈ E \ T at random with probability pe and then minimize Φ(g) over the tree cycle Ce. The main difference here is that in the linear case one can minimize the energy over a cycle analytically while in the nonlinear case one needs to rely on an iterative method, which we described earlier. For later use, we define the tree-values of x, denoted x(T, g) to be those which satisfy gij = xi − xj on the tree. These are easily computed, up to an additive constant, using using a breadth first search from any leaf of the spanning tree of G. 6. LAGRANGIAN DUALITY In order to analyze the progress made by each iteration of our algorithm we need an estimate of the distance to opti- mality. To do this we compute the Lagrangian dual for our minimization problem. First recall that our primal problem is to compute Proof. Since GAP ≤ T GAP we can focus on TGAP, min g Φ(g) s.t. Xj∈N(i) wij hij (gij) = bi. ∀i ∈ V ∂TGAPij (g) ∂gij = φ′ ij (gij) − wij(xi − xj)h′ ij (gij) The dual function is given by substituting for φ′ ij gives Θ(x) = min g {Φ(g) − Xi∈V xi[( Xj∈N(i) wij hij (gij)) − bi]} where x are the dual variables, and as we will see correspond to the x in our original problem. (As a reminder, we only consider one of gij, gji as a variable, say gij and implicitly replace all occurrences of gji with −gij.) The first order condition for this minimization when differentiating by gij is: 0 = φ′ ij(gij) − (xi − xj)wijh′ ij (gij) Using the definition of φij yields: 0 = wij h′ ij (gij)gij − (xi − xj)wij h′ ij (gij) which reduces to gij = xi − xj . Plugging this into Θ(x) yields Θ(x) = X(i,j)∈E φij(xi−xj)−Xi∈V xi[( Xj∈N(i) wijhij (xi−xj))−bi] To simplify this we define gij = xi − xj and use the b- feasibility of gij to write this as Θ(x) = X(i,j)∈E φij(gij) − X(i,j)∈E wij gij(hij (gij) − hij (gij)). Using this we can approximate the distance to optimality since Φ(g) ≥ Θ(x) for any b-feasible g and Φ(g∗) = Θ(x∗) where g∗, x∗ are the optimizers of their respective problems. Thus, following Kelner et. al if we define GAP (g) = Φ(g) − Φ(g∗) then for any b-feasible g we have GAP (g) ≤ Φ(g) − Θ(x) ∂TGAPij(g) ∂gij = wij (gij − (xi − xj))h′ ij (gij). Integrating yields TGAPij (g) ≤ Z gij (xi−xj ) wij(sij − (xi − xj))k dsij which after noting that GCij = (gij − (xi − xj)) yields TGAPij (g) ≤ wij G2 Cij k which implies the result after summing. ✷ 7. TREE CONDITION NUMBERS In order to guarantee convergence in the linear case, Kelner et. al. [3] require that the underlying spanning tree have nice properties. As we will show the same condition suffices for the nonlinear case as well. Define the tree condition number of spanning tree T to be τ (T ) = X(i,j)∈E\T wij /WCij where Cij is the tree cycle over edge (i, j). Now, as discussed in Kelner et. al, the tree condition number is closely related to the stretch of a tree, a well studied topic. The stretch of a tree T is defined to be st(T ) = P(i,j)∈E st(i, j) where st(i, j) = wij X(r,s)∈P(i,j) 1/wrs and it is easy to show that τ (T ) = st(T ) + m − 2n + 2. Thus, we can use the following result due to Abraham et. al [1] to construct a tree with a good condition number We can use the tree values for x to provide this estimate yielding Theorem 2 (Abraham et. al [1]). In O(m log n log log n) time we can compute a spanning tree T with total stretch st(T ) = O(m log n log log n). GAP (g) ≤ TGAP = X(i,j)∈E\T TGAPij(g) where we define TGAP by TGAPij (g) = φij (gij) − φij(xi − xj) + wij (xi − xj)(hij(xi − xj) − hij (gij)) where the sums in the gap formula need only be over non- tree edges since xi − xj = gij for all (i, j) ∈ T . 8. LINEARIZATION For static analyses we can linearize the Laplacian at some g by considering the adjusted weights, wg ij = wij hij (gij)/gij, creating a new Laplacian Lg. Then we can write ( Lgx)i = Xj∈N(i) wg ij (xi − xj). Next we define the linearized energy to be the energy of the linearized Laplacian: Lemma 4. Given a b-feasible g, ξ g(g) = X(i,j)∈E wg ij g2 ij/2 GAP (g) ≤ X(i,j)∈E\T wijG2 Cij k/2 and it is easy to see that ξ g(g) = Φ(g). Then, using the bounds on h′ ij (gij) we see that where Cij is the tree cycle passing through edge (i, j). wg ij ∈ [(1/k)wij , kwij ], Φ(g) ∈ [(1/k) ξ g(g), k ξ g(g)] Proof. Lemma 6.1 in [3] shows that ξ(g0) ≤ k2ξ(g∗)st(T ). and Φ(g)/Φ(g∗) ≥ (1/k2) ξ g(g)/ ξ g(g∗). This will allow us to use results from the linear case to an- alyze some static properties of our algorithm. 9. ACCURACY In the linear case, most spectral methods consider the ac- curacy in solution [3]. Thus we will say that a solution is ǫ-accurate if x − x∗Lq∗ x∗q∗ L ≤ ǫ, where Lq∗ is the linearization of L at q∗, as used in the pre- vious section. By combining our bounds on the linearization of the energy function (***) with Lemma 6.2 in [3] for the linearization we can easily prove the following: Lemma 5. If Φ(g)/Φ(g∗) ≤ 1 + ǫ2/(τ (T )k4) then x − x∗q∗ L x∗q∗ L ≤ ǫ where x is defined by its tree values on T . Proof. It is easy to see from Lemma 6.2 in [3] that if Φ(g)/Φ(g∗) ≤ (1 + ǫ2/k4) then x − x∗ Lg ≤ ǫ/(k2τ (T )). To complete the proof we need the following lemma relating v Lg and v Lg∗ . ✷ Lemma 6. v Lg ≤ k2v Lg∗ . Proof. This follows from the definition: wg(vi − vj )2 v L(g) = X(i,j)∈E and noting that wg ij ∈ [(1/k)wij , kwij]. ✷ INITIALIZATION 10. To initiate our algorithm we start with a b-feasible flow g0 with support only on the spanning tree. This can be com- puted recursively with O(n) operations by noting that for any leaf node i of the tree the value of gij for j = N (i) is given by wij hij (gij) = bi. However, it will be useful to note that this can be computed by first computing the solution for the linearization of L denoted g0, where we set all hij (·) to be identity functions, using the above recursive algorithm. Then convert g0 to g0 using the relationship g0 ij = h−1 ij (g0 ij ). The result follows from the fact that Φ(g) ∈ [(1/k) ξ g(g), k ξ g(g)]. ✷ 11. ALGORITHM AND MAIN RESULT We now present the algorithm which is a slight modification of that in Kelner et. al [3]. Algorithm: Simple Nonlinear Solver 1. INPUT: Input G = (V, E, w), ǫ ∈ ℜ+, k ≥ 1, hij (·) ∀(i, j) ∈ E. 2. OUTPUT: g ∈ ℜE, x ∈ ℜV . 3. Construct T : a low stretch spanning tree of G. 4. Construct g0: a b-feasible solution with support only on the spanning tree. 5. Set probabilities pij = wij/(WCij τ (T )) for all (i, j) ∈ E \ T . 6. Set S = ⌈2k2τ (T ) log(k6st(T )τ (T )/ǫ2)⌉. 7. For ℓ = 1 to S: (a) Pick a random (i, j) ∈ E \ T with probability pij. (b) Apply a cycle update to gℓ−1 using tree cycle Cij to get gℓ. Compute this to relative accuracy 1/(2k2) using binary search. 8. RETURN g and its tree induced x. In order to show the correctness of this algorithm, we ex- tend the analysis in [3]. Since the GAP (gℓ) conditional on GAP (gℓ−1) is a random variable we focus on expected val- ues. Lemma 8. For each iteration in the loop of "Algorithm: Simple Nonlinear Solver" E[GAP (gℓ)] − E[GAP (gℓ+1)GAP (gℓ)] E[GAP (gℓ)] ≥ 1 2k2τ (T ) . Proof. First note that the change in GAP is the same Cij /(2k) as the change in Φ(g) which is greater than WCij G2 for an update of Cij , thus the expected decrease is E[GAP (gℓ)]−E[GAP (gℓ+1)GAP (gℓ)] ≥ X(i,j)∈E\T pij WCij G2 Cij /(2k). Substituting in pij = wij /(τ (T )WCij ) yields E[GAP (gℓ)]−E[GAP (gℓ+1)GAP (gℓ)] ≥ X(i,j)∈E\T (wij /τ (T ))G2 Cij /(2k) using Lemma 4 for the RHS completes the proof. ✷ The following bound on the initial energy follows directly from Lemma 6.1 in [3]. Using this we can prove our main theorem. Lemma 7. Φ(g0) ≤ k2Φ(g∗)st(T ) Theorem 3. Given a nonlinear graph Laplacian L, "Al- gorithm: Simple Nonlinear Solver", computes an expected ǫ-accurate solution of Lx = b in O(mnk2 log(kn/ǫ)) time. 13. ACKNOWLEDGMENTS This material is based upon work supported by the National Science Foundation under Grants No. 1216073 and 1161813. 14. REFERENCES [1] I. Abraham and O. Neiman. Using petal-decompositions to build a low stretch spanning tree. In Proceedings of the forty-fourth annual ACM symposium on Theory of computing, pages 395 -- 406. ACM, 2012. [2] B. Bollob´as. Modern graph theory, volume 184. Springer Science & Business Media, 1998. [3] J. A. Kelner, L. Orecchia, A. Sidford, and Z. A. Zhu. A simple, combinatorial algorithm for solving sdd systems in nearly-linear time. In Proceedings of the forty-fifth annual ACM symposium on Theory of computing, pages 911 -- 920. ACM, 2013. [4] I. Koutis, G. L. Miller, and R. Peng. A fast solver for a class of linear systems. Communications of the ACM, 55(10):99 -- 107, 2012. [5] J. H. Reif. Efficient approximate solution of sparse linear systems. Computers & Mathematics with Applications, 36(9):37 -- 58, 1998. [6] D. A. Spielman. Algorithms, graph theory, and linear equations in laplacian matrices. In Proceedings of the International Congress of Mathematicians, volume 4, pages 2698 -- 2722, 2010. [7] D. A. Spielman and N. Srivastava. Graph sparsification by effective resistances. SIAM Journal on Computing, 40(6):1913 -- 1926, 2011. [8] D. A. Spielman and S.-H. Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In Proceedings of the thirty-sixth annual ACM symposium on Theory of computing, pages 81 -- 90. ACM, 2004. [9] D. A. Spielman and J. Woo. A note on preconditioning by low-stretch spanning trees. arXiv preprint arXiv:0903.2816, 2009. [10] P. M. Vaidya. Solving linear equations with symmetric diagonally dominant matrices by constructing good preconditioners. A talk based on this manuscript, 1991. [11] N. K. Vishnoi. Laplacian solvers and their algorithmic applications. Theoretical Computer Science, 8(1-2):1 -- 141, 2012. Proof. Rewriting the expression in Lemma 5 shows that in order to attain ǫ-accuracy we need Φ(gS) − Φ(g∗) ≤ ǫ2/(τ (T )k4)Φ(g∗). Iterating Lemma 8, implies that Φ(gS) − Φ(g∗) ≤ (1 − 1 2k2τ (T ) )S(Φ(g0) − Φ(g∗)). Combining this with Lemma 7 on the initial energy yields Φ(gS) − Φ(g∗) ≤ (1 − 1 2k2τ (T ) )S(k2st(T ) − 1)Φ(g∗). Plugging in S = ⌈2k2τ (T ) log(k6st(T )τ (T )/ǫ2)⌉ satisfies the requirement, proving the accuracy of the Algorithm. By Theorem 2 st(T ) = O(m log n log log n) = O(m) the required number of iterations is given by r = O(k2m log(kn/ǫ)). Since each iteration takes O(n) time by Lemma 3 we get the stated result. ✷ Note that instead of an expected ǫ-accurate solution, one can compute an actual ǫ-accurate solution with high proba- bility with the same time bound using standard probabilistic techniques. 12. CONCLUDING REMARKS This paper has shown that one can extend some of the tech- niques from the linear theory of systems of equations arising from linear graph Laplacians to ones with nonlinear graph Laplacians. We view our analysis as suggestive that even more general extensions, perhaps even asymmetric ones re- lated to directed graphs, may be possible, extending the range of spectral analysis. Perhaps as in Kelner et. al [3] our algorithm has a representation as an alternating projec- tions algorithm, showing that nonlinear extensions are also possible in that setting. There are many open directions for improving our algorithm. First, note that we have not optimized the k dependence. Next, note that one could use the ideas of tree scaling and a randomized stopping time as in [3] to reduce the running time. In addition, one might be able to use algorithms for the linear problem to speed up the nonlinear algorithm, ei- ther by providing a warm start or by speeding up conver- gence near optimality when the linear problem might pro- vide a good approximation for the nonlinear one. While this paper raises many open problems relating to non- linear spectral theory, the main problem with the current algorithm is the dependence on n due to the complexity of computing a nonlinear cycle update which unlike the linear version does not have a simple analytic solution which can be computed in logarithmic time using a special data structure for keeping track of the flows on the tree. Nonetheless, it might be possible to reduce this complexity either through a specially designed data structure for the spanning tree, or perhaps through the use of a spanning tree with small diameter. Also, the direct application of our algorithm to nonlinear graph problems might be fruitful.
1601.04233
1
1601
2016-01-17T00:02:37
Sublinear-Time Algorithms for Counting Star Subgraphs with Applications to Join Selectivity Estimation
[ "cs.DS" ]
We study the problem of estimating the value of sums of the form $S_p \triangleq \sum \binom{x_i}{p}$ when one has the ability to sample $x_i \geq 0$ with probability proportional to its magnitude. When $p=2$, this problem is equivalent to estimating the selectivity of a self-join query in database systems when one can sample rows randomly. We also study the special case when $\{x_i\}$ is the degree sequence of a graph, which corresponds to counting the number of $p$-stars in a graph when one has the ability to sample edges randomly. Our algorithm for a $(1 \pm \varepsilon)$-multiplicative approximation of $S_p$ has query and time complexities $\O(\frac{m \log \log n}{\epsilon^2 S_p^{1/p}})$. Here, $m=\sum x_i/2$ is the number of edges in the graph, or equivalently, half the number of records in the database table. Similarly, $n$ is the number of vertices in the graph and the number of unique values in the database table. We also provide tight lower bounds (up to polylogarithmic factors) in almost all cases, even when $\{x_i\}$ is a degree sequence and one is allowed to use the structure of the graph to try to get a better estimate. We are not aware of any prior lower bounds on the problem of join selectivity estimation. For the graph problem, prior work which assumed the ability to sample only \emph{vertices} uniformly gave algorithms with matching lower bounds [Gonen, Ron, and Shavitt. \textit{SIAM J. Comput.}, 25 (2011), pp. 1365-1411]. With the ability to sample edges randomly, we show that one can achieve faster algorithms for approximating the number of star subgraphs, bypassing the lower bounds in this prior work. For example, in the regime where $S_p\leq n$, and $p=2$, our upper bound is $\tilde{O}(n/S_p^{1/2})$, in contrast to their $\Omega(n/S_p^{1/3})$ lower bound when no random edge queries are available.
cs.DS
cs
Sublinear-Time Algorithms for Counting Star Subgraphs with Applications to Join Selectivity Estimation Maryam Aliakbarpour ∗ John Peebles § Amartya Shankha Biswas † Themistoklis Gouleakis ‡ Ronitt Rubinfeld ¶ Anak Yodpinyanee (cid:107) We study the problem of estimating the value of sums of the form Sp (cid:44) (cid:80)(cid:0)xi Abstract (cid:1) when one has the ability to sample xi ≥ 0 with probability proportional to its magnitude. When p = 2, this problem is equivalent to estimating the selectivity of a self-join query in database systems when one can sample rows randomly. We also study the special case when {xi} is the degree sequence of a graph, which corresponds to counting the number of p-stars in a graph when one has the ability to sample edges randomly. Our algorithm for a (1 ± ε)-multiplicative approximation of Sp has query and time complexities ). Here, m =(cid:80) xi/2 is the number of edges in the graph, or equivalently, half the number O( m log log n p 2S 1/p p of records in the database table. Similarly, n is the number of vertices in the graph and the number of unique values in the database table. We also provide tight lower bounds (up to polylogarithmic factors) in almost all cases, even when {xi} is a degree sequence and one is allowed to use the structure of the graph to try to get a better estimate. We are not aware of any prior lower bounds on the problem of join selectivity estimation. For the graph problem, prior work which assumed the ability to sample only vertices uniformly gave algorithms with matching lower bounds [Gonen, Ron, and Shavitt. SIAM J. Comput., 25 (2011), pp. 1365-1411]. With the ability to sample edges randomly, we show that one can achieve faster algorithms for approximating the number of star subgraphs, bypassing the lower bounds in this prior work. For example, in the regime where Sp ≤ n, and p = 2, our upper bound is O(n/S1/2 ), in contrast to their Ω(n/S1/3 ) lower bound when no random edge queries are available. p p In addition, we consider the problem of counting the number of directed paths of length two when the graph is directed. This problem is equivalent to estimating the selectivity of a join query between two distinct tables. We prove that the general version of this problem cannot be solved in sublinear time. However, when the ratio between in-degree and out-degree is bounded—or equivalently, when the ratio between the number of occurrences of values in the two columns being joined is bounded—we give a sublinear time algorithm via a reduction to the undirected case. 1065125, and CCF-1420692 1065125, and CCF-1420692. ∗CSAIL, MIT, Cambridge MA 02139. E-mail: [email protected]. Research supported by NSF grants CCF-1217423, CCF- †MIT, Cambridge MA 02139. E-mail: [email protected]. ‡CSAIL, MIT, Cambridge MA 02139. E-mail: [email protected]. Research supported by NSF grants CCF-1217423, CCF- §CSAIL, MIT, Cambridge MA 02139. E-mail: [email protected]. Research supported by NSF grants CCF-1217423, ¶CSAIL, MIT, Cambridge MA 02139 and the Blavatnik School of Computer Science, Tel Aviv University. E-mail: [email protected]. Research supported by NSF grants CCF-1217423, CCF-1065125, CCF-1420692, and ISF grant 1536/14. (cid:107)CSAIL, MIT, Cambridge MA 02139. E-mail: [email protected]. Research supported by NSF grants CCF-1217423, CCF-1065125, CCF-1420692, and CCF-1122374. CCF-1065125, and CCF-1420692, and the DPST scholarship, Royal Thai Government. 1 Introduction We study the problem of approximately estimating Sp (cid:44)(cid:80)n i=1 (cid:0)xi p (cid:1) when one has the ability to sample xi ≥ 0 with probability proportional to its magnitude. To solve this problem we design sublinear-time algorithms, which compute such an approximation while only looking at an extremely tiny fraction of the input, rather than having to scan the entire data set in order to determine this value. We consider two primary motivations for this problem. The first is that in undirected graphs, if xi is the degree of vertex i then Sp counts the number of p-stars in the graph. Thus, estimating Sp when one has the ability to sample xi with probability proportional to its magnitude corresponds to estimating the number of p-stars when one has the ability to sample vertices with probability proportional to their degrees (which is equivalent to having the ability to sample edges uniformly). This problem is an instance of the more general subgraph counting problem in which one wishes to estimate the number of occurrences of a subgraph H in a graph G. The subgraph counting problem has applications in many different fields, including the study of biological, internet and database systems. For example, detecting and counting subgraphs in protein interaction networks is used to study molecular pathways and cellular processes across species [SIKS06]. The second application of interest is that the problem of estimating S2 corresponds to estimating the selectivity of join and self-join operations in databases when one has the ability to sample rows of the tables uniformly. For example, note that if we set xi as the number of occurrences of value i in the column being joined, then S2 is precisely the number of records in the join of the table with itself on that column. When performing a query in a database, a program called a query optimizer is used to determine the most efficient way of performing the database query. In order to make this determination, it is useful for the query optimizer to know basic statistics about the database and about the query being performed. For example, queries that return a very larger number of records are usually serviced most efficiently by doing simple linear scans over the data whereas queries that return a smaller number of records may be better serviced by using an index [HILM09]. As such, being able to estimate selectivity (number of records returned compared to the maximum possible number) of a query can be useful information for a query optimizer to have. In the more general case of estimating the selectivity of a join between two different tables (which can be modeled with a directed graph), the query optimizer can use this information to decide on the most efficient order to execute a sequence of joins which is a common task. In the “typical” regime in which we wish to estimate S2 given that n ≤ S2 ≤ n2, our algorithm has a running time of O( n) which is very small compared to than the total amount of data. Furthermore, in the case of selectivity estimation, this number can be much less than the number of distinct values in the column being joined on, which results in an even smaller number of queries than would be necessary if one were using an index to compute the selectivity. √ We believe that our query-based framework can be realized in many systems. One possible way to implement random edge queries is as follows: because edges normally take most of the space for storing graphs, an access to a random memory location where the adjacency list is stored, would readily give a random edge. Random edge queries allow us to implement a source of weighted vertex samples, where a vertex is output with probability proportional to its weight (magnitude). Weighted sampling is used in [MPX07, BBS09] to find sublinear algorithms for approximating the sum of n numbers (allowing only uniform sampling, results in a linear lower bound). We later use this as a subroutine in our algorithm. Throughout the rest of the paper, we will mostly use graph terminology when discussing this problem. However, we emphasize that all our results are fully general and apply to the problem of estimating Sp even when one does not assume that the input is a graph. 1.1 Our Contribution Prior theoretical work on this problem only considered the version of this problem on graphs and assumed the ability to sample vertices uniformly rather than edges. Specifically, prior studies of sublinear-time algorithms for graph problems usually consider the model where the algorithm is allowed to query the adjacency list 1 representation of the graph: it may make neighbor queries (by asking “what is the ith neighbor of a vertex v”) and degree queries (by asking “what is the degree of vertex v”). We propose a stronger model of sublinear-time algorithms for graph problems which allows random edge queries. Next, for undirected graphs, we construct an algorithm which uses only degree queries and random edge queries. This algorithm and its analysis is discussed in Section 3. For the problem of computing an approximation Sp satisfying (1 − )Sp ≤ Sp ≤ (1 + )Sp, our algorithm has query and time complexities O(m log log n/2S1/p ). Although our algorithm is described in terms of graphs, it also applies to the more (cid:1) without any assumptions about graph structure. general case when one wants to estimate Sp = (cid:80) (cid:0)xi p i p Thus, it also applies to the problem of self-join selectivity estimation. We then establish some relationships between m and other parameters so that we may compare the performance of this algorithm to a related work by Gonen et al. more directly ([GRS11]). We also provide lower bounds for our proposed model in Section 4, which are mostly tight up to polylogarithmic factors. This comparison is given in Table 1. We emphasize that even though these lower bounds are stated for graphs, they also apply to the problem of self-join selectivity estimation. To understand this table, first note that these algorithms require more samples when Sp is small (i.e., stars are rare). As Sp increases, the complexity of each algorithm decreases until—at some point—the number of required samples drops to O(n1−1/p). Our algorithm is able to obtain this better complexity of O(n1−1/p) for a larger range of values of Sp than that of the algorithm given in [GRS11]. Specifically, our algorithm is more efficient for Sp ≤ n1+1/p, and has the same asymptotic bound for Sp up to np. Once Sp > np, it is unknown whether the degree and random edge queries alone can provide the same query complexity. Nonetheless, if we have access to all three types of queries, we may combine the two algorithms to obtain the best of both cases as illustrated in the last column. permitted types of queries range of Sp Sp ≤ n n < Sp ≤ n1+1/p n1+1/p < Sp ≤ np np < Sp neighbor, degree n S1/(p+1) ([GRS11]) (cid:19) (cid:18) (cid:101)Θ (cid:101)Θ(cid:0)n1−1/p(cid:1) (cid:18) (cid:19) (cid:101)Θ np−1/p S1−1/p p p degree, random edge n (this paper) (cid:18) (cid:19) (cid:101)Θ (cid:101)Θ(cid:0)n1−1/p(cid:1) (cid:19) S1/p p (cid:18) Ω np−1/p S1−1/p p ,(cid:101)O(cid:0)n1−1/p(cid:1) all types of queries p n S1/p (this paper) (cid:18) (cid:19) (cid:101)Θ (cid:101)Θ(cid:0)n1−1/p(cid:1) (cid:18) (cid:19) (cid:101)Θ np−1/p S1−1/p p Table 1: Summary of the query and time complexities for counting p-stars on undirected graphs, given a different set of allowed queries.  is assumed to be constant. Adjacent cells in the same column with the same contents have been merged. We also consider a variant of the counting stars problem on directed graphs in Appendix D. If one only needs to count “stars” where all edges are either pointing into or away from the center, this is essentially still the undirected case. We then consider counting directed paths of length two, and discover that allowing random edge queries does not provide an efficient algorithm in this case. In particular, we show that any constant factor multiplicative approximation of Sp requires Ω(n) queries even when all three types of queries are allowed. However, when the ratio between the in-degree and the out-degree on every vertex is bounded, we solve this special case in sublinear time via a reduction to the undirected case where degree queries and random edge queries are allowed. directed graph, we aim at estimating the quantity (cid:80) database context, we wish to compute the quantity (cid:80)n This variant of the counting stars problem can also be used for approximating join selectivity. For a (v) · deg+(v). On the other hand in the v∈V (G) deg i=1 xi · yi, where xi and yi denote the number of occurrences of a label i in the column we join on, from the first and the second table, respectively. Thus, − 2 applying simple changes in variables, the algorithms from Appendix D can be applied to the problem of estimating join selectivity as well. 1.2 Our Approaches In order to approximate the number of stars in the undirected case, we convert the random edge queries into weighted vertex sampling, where the probability of sampling a particular vertex is proportional to its degree. We then construct an unbiased estimator that approximates the number of stars using the degree of the sampled vertex as a parameter. The analysis of this part is roughly based on the variance bounding method used in [AMS96], which aims to approximate the frequency moment in a streaming model. The number of samples required by this algorithm depends on Sp, which is not known in advance. Thus we create a guessed value of Sp and iteratively update this parameter until it becomes accurate. To demonstrate lower bounds in the undirected case, we construct new instances to prove tight bounds for the case in which our model is more powerful than the traditional model. In other cases, we provide a new proof to show that the ability to sample uniformly random edges does not necessarily allow better performance in counting stars. Our proof is based on applying Yao’s principle and providing an explicit construction of the hard instances, which unifies multiple cases together and greatly simplifies the approach of [GRS11].1 For the directed case, we prove the lower bound using a standard construction and Yao’s principle. As for the upper bound when the in-degree and out-degree ratios are bounded, we use rejection sampling to adjust the sampling probabilities so that we may apply the unbiased estimator method from the undirected case. 1.3 Related Work Motivated by applications in a variety of areas, the subgraph detection and counting problem and its vari- ations have been studied in many different works, often under different terminology such as network motif counting or pathway querying (e.g., [MSOI+02, PCJ04, Wer06, SIKS06, SSRS06, GK07, HBPS07, HA08, ADH+08]). As this problem is NP-hard in general, many approaches have been developed to efficiently count subgraphs more efficiently for certain families of subgraphs or input graphs (e.g., [DLR95, AYZ97, FG04, KIMA04, ADH+08, AG09, VW09, Wil09, GS09, KMPT10, AGM12, AFS12, FLR+12]). As for applications to database systems, the problem of approximating the size of the resulting table of a join query or a self-join query in various contexts has been studied in [SS94, HNSS96, AGMS99]. Selectivity and query optimization have been considered, e.g., in [PI97, LKC99, GTK01, MHK+07, HILM09]. Other works that study sublinear-time algorithms for counting stars are [GRS11] that aims to approximate the number of stars, and [Fei06, GR08] that aim to approximate the number of edges (or equivalently, the average degree). Note that [GRS11] also shows impossibility results for approximating triangles and paths of length three in sublinear time when given uniform edge sampling, limiting us from studying more sophisticated subgraphs. Recent work by Eden, Levi and Ron ([ELR15]) and Seshadhri ([Ses15]) provide sublinear time algorithms to approximate the number of triangles in a graph. However, their model uses adjacency matrix queries and neighbor queries. The problem of counting subgraphs has also been studied in the streaming model (e.g., [BYKS02, BFL+06, BBCG08, MMPS11, KMSS12]). There is also a body of 1One useful technique for giving lower bounds on sublinear time algorithms, pioneered by [BBM12], is to make use of a connection between lower bounds in communication complexity and lower bounds on sublinear time algorithms. More specifically, by giving a reduction from a communication complexity problem to the problem we want to solve, a lower bound on the communication complexity problem yields a lower bound on our problem. In the past, this approach has led to simpler and cleaner sublinear time lower bounds for many problems. Attempts at such an approach for reducing the set-disjointness problem in communication complexity to our estimation problem on graphs run into the following difficulties: First, as explained in [Gol13], the straightforward reduction adds a logarithmic overhead, thereby weakening the lower bound by the same factor. Second, the reduction seems to work only in the case of sparse graphs. Although it is not clear if these difficulties are insurmountable, it seems that it will not give a simpler argument than the approach that we present in this work. 3 work on sublinear-time algorithms for approximating various graph parameters (e.g., [PR07, NO08, YYI09, HKNO09, ORRR12]). Abstracting away the graphical context of counting stars, we may view our problem as finding a parameter of a distribution: edge or vertex sampling can be treated as sampling according to some distribution. In vertex sampling, we have a uniform distribution and in edge sampling, the probabilities are proportional to the degree. The number of stars can be written as a function of the degrees. Aside from our work, there are a number of other studies that make use of combined query types for estimating a parameter of a distribution. Weighted and uniform sampling are considered in [MPX07, BBS09]. Their algorithms may be adapted to approximate the number of edges in the context of approximating graph parameters when given weighted vertex sampling, which we will later use in this paper. A closely related problem in the context of distributions, is the task of approximating frequency moments, mainly studied in the streaming model (e.g., [AMS96, CK04, IW05, BGKS06]). On the other hand, the combination of weighted sampling and probability distribution queries is also considered (e.g., [CR14]). 2 Preliminaries In this paper, we construct algorithms to approximate the number of stars in a graph under different types of query access to the input graph. As we focus on the case of simple undirected graphs, we explain this model here and defer the description for the directed case to Appendix D. 2.1 Graph Specification Let G = (V, E) be the input graph, assumed to be simple and undirected. Let n and m denote the number of vertices and edges, respectively. The value n is known to the algorithm. Each vertex v ∈ V is associated with a unique ID from [n] def= {1, . . . , n}. Let deg(v) denote the degree of v. Let p ≥ 2 be a constant integer. A p-star is a subgraph of size p + 1, where one vertex, called the center, is adjacent to the other p vertices. For example, a 2-star is an undirected path of length 2. Note that a vertex may be a center for many stars, and a set of p + 1 vertices may form multiple stars. Let Sp denote the number of occurrences of distinct stars in the graph. Our goal is to construct a randomized algorithm that outputs a value that is within a (1±)-multiplicative factor of the actual number of stars Sp. More specifically, given a parameter  > 0, the algorithm must give an approximated value (cid:98)Sp satisfying the inequality (1 − )Sp ≤ (cid:98)Sp ≤ (1 + )Sp with success probability at least 2/3. 2.2 Query Access The algorithm may access the input graph by querying the graph oracle, which answers for the following types of queries. First, the neighbor queries: given a vertex v ∈ V and an index 1 ≤ i < n, the ith neighbor of v is returned if i ≤ deg(v); otherwise, ⊥ is returned. Second, the degree queries: given a vertex v ∈ V , its degree deg(v) is returned. Lastly, the random edge queries: a uniformly random edge {u, v} ∈ E is returned. The query complexity of an algorithm is the total number of queries of any type that the algorithm makes throughout the process of computing its answer. Combining these queries, we may implement various useful sampling processes. We may perform a uniform edge sampling using a random edge query, and a uniform vertex sampling by simply picking a random index from [n]. We may also perform a weighted vertex sampling where each vertex is obtained with probability proportional to its degree as follows: uniformly sample a random edge, then randomly choose one of the endpoints with probability 1/2 each. Since any vertex v is incident with deg(v) edges, then the probability that v is chosen is exactly deg(v)/2m, as desired. 4 2.3 Queries in the Database Model Now we explain how the above queries in our graph model have direct interpretations in the database model. Consider the column we wish to join on. For each valid label i, let xi be the number of rows containing this label. We assume the ability to sample rows uniformly at random. This gives us a label i with probability proportional to xi, which is a weighted sample from the distribution of labels. We also assume that we can also quickly compute the number of other rows sharing the same label with a given row (analogous to making a degree query). For example, this could be done quickly using an index on the column. Note that if one has an index that is augmented with appropriate information, one can compute the selectivity of a self-join query exactly in time roughly O(k log n) where k is the number of distinct elements in the column. However, our methods can give runtimes that are asymptotically much smaller than this. 3 Upper Bounds for Counting Stars in Undirected Graphs In this section we establish an algorithm for approximating the number of stars, Sp, of an undirected input graph. We focus on the case where only degree queries and random edge queries are allowed. This illustrates that even without utilizing the underlying structure of the input graph, we are still able to construct a sublinear approximation algorithm that outperforms other algorithms under the traditional model in certain cases. 3.1 Unbiased Estimator Subroutine Our algorithm uses weighted vertex sampling to find stars. Intuitively, the number of samples required by the algorithms should be larger when stars are rare because it takes more queries to find them. While the query complexity of the algorithm depends on the actual value of Sp, our algorithm does not know this value in advance. In order to overcome this issue, we devise a subroutine which—given a guess (cid:101)Sp for the value of Sp—will give a (1 ± ) approximation of Sp if (cid:101)Sp is close enough to Sp or tell us that (cid:101)Sp is much larger than Sp. Then, we start with the maximum possible value of Sp and guess multiplicatively smaller and smaller values for it until we find one that is close enough to Sp, so that our subroutine is able to correctly output a (1 ± ) approximation. Our subroutine works by computing the average value of an unbiased estimator to Sp after drawing enough weighted vertex samples. To construct the unbiased estimator, notice first that the number of p-stars centered at a vertex v is(cid:0)deg(v) (cid:1).2 Thus, Sp =(cid:80) (cid:0)deg(v) (cid:1). (cid:1) so that Y is an unbiased estimator for Sp; that is, (cid:18)deg(v) (cid:19)(cid:19) (cid:18) 2m Next, we define the unbiased estimator and give the corresponding algorithm. First, let X be the random variable representing the degree of a random vertex obtained through weighted vertex sampling, as explained in Section 2.2. Recall that a vertex v is sampled with probability deg(v)/2m. We define the random variable Y = 2m X (cid:0)X p (cid:18)deg(v) (cid:19) (cid:88) (cid:88) v∈V p p E[Y ] = deg(v) v∈V 2m deg(v) p = v∈V p = Sp. Clearly, the output ¯Y of Algorithm 1 satisfies E[ ¯Y ] = Sp. We claim that the number of samples k in Algorithm 1 is sufficient to provide two desired properties: the algorithm returns an (1 ± )-approximation of Sp if (cid:101)Sp is in the correct range; or, if (cid:101)Sp is too large, the anomaly will be evident as the output ¯Y will be much smaller than (cid:101)Sp. In particular, we may distinguish between these two cases by comparing ¯Y against (1 − ) Sp, as specified through the following lemma. Lemma 3.1 For 0 <  ≤ 1/2, with probability at least 2/3: 2For our counting purpose, if x < y then we define(cid:0)x (cid:1) = 0. y 5 Algorithm 1 Subroutine for Computing Sp given (cid:101)Sp with success probability 2/3 1: procedure Unbiased-Estimate((cid:101)Sp, ) v ← weighted sampled vertex obtained from a random edge query d ← deg(v) obtained from a degree query Yi ← 2m p for i = 1 to k do k ← 36m / p2(cid:101)S1/p (cid:0)d (cid:1) (cid:80)k p d i=1 Yi ¯Y ← 1 return ¯Y k 2: 3: 4: 5: 6: 7: 8: 1. If 1 2 Sp ≤ (cid:101)Sp ≤ 6Sp, then Algorithm 1 outputs ¯Y such that (1 − )Sp ≤ ¯Y ≤ (1 + )Sp; moreover, if Sp < Sp then ¯Y ≥ (1 − )(cid:101)Sp. 2. If (cid:101)Sp > 6Sp, then Algorithm 1 outputs ¯Y such that ¯Y < 1 2(cid:101)Sp ≤ (1 − )(cid:101)Sp. The first item of Lemma 3.1 can be proved by bounding the variance of Y using various Chebyshev’s Inequality and identities of binomial coefficients, while the second item is a simple application of Markov’s Inequality. Detailed proofs for these statements can be found in Appendix B. 3.2 Full Algorithm Our full algorithm proceeds by first setting (cid:101)Sp to n(cid:0)n−1 (cid:1), the maximum possible value of Sp given by the complete graph. We then use Algorithm 1 to check if (cid:101)Sp > 6Sp; if this is the case, we reduce (cid:101)Sp then proceed to the next iteration. Otherwise, Algorithm 1 should already give an (1 ± )-approximation to Sp (with constant probability). We note that if  > 1/2, we may replace it with 1/2 without increasing the asymptotic complexity. p Since the process above may take up to O(log n) iterations, we must amplify the success probability of Algorithm 1 so that the overall success probability is still at least 2/3. To do so, we simply make (cid:96) = O(log log n) multiple calls to Algorithm 1 then take the median of the returned values. Our full algorithm can be described as Algorithm 2 below. p loop for i = 1 to (cid:96) do (cid:101)Sp ← n(cid:0)n−1 Algorithm 2 Algorithm for Approximating Sp 1: procedure Count-Stars() 2: 3: 4: (cid:1), (cid:96) ← 40(log p + log log n) Zi ← Unbiased-Estimate((cid:101)Sp, ) if Z ≥ (1 − )(cid:101)Sp then (cid:101)Sp ← (cid:101)Sp/2 Z ← median{Z1,··· , Z(cid:96)} Sp ← Z return Sp 5: 6: 7: 8: 9: 10: Theorem 3.2 Algorithm 2 outputs Sp such that (1 − )Sp ≤ Sp ≤ (1 + )Sp with probability at least 2/3. The query complexity of Algorithm 2 is O m log n log log n . (cid:18) (cid:19) 2S1/p p 6 (cid:16) n(cid:0)n−1 (cid:1)(cid:17)(cid:101) ≤ Proof: If we assume that the events from Lemma 3.1 hold, then the algorithm will take at most (cid:100)log (p + 1) log n iterations. By choosing (cid:96) = 40(log p + log log n), Chernoff bound (Theorem A.3) implies that excepted for probability 1/3(p + 1) log n, more than half of the return values of Algorithm 1 satisfy the desired property, and so does the median Z. By the union bound, the total failure probability is at most 1/3. Now it is safe to assume that the events from the two lemmas hold. In case (cid:101)Sp > 6Sp, our algorithm will detect this event because Z ≤ (1−)(cid:101)Sp, implying that we never stop and return an inaccurate approximation. On the other hand, if (cid:101)Sp < Sp, our algorithm computes Z ≥ (1 − )(cid:101)Sp and must terminate. Since we only halve (cid:101)Sp on each iteration, when (cid:101)Sp < Sp first occurs, we have (cid:101)Sp ≥ 1 terminate with the desired approximation before the value (cid:101)Sp is halved again. Thus, Algorithm 2 returns Recall that the number of samples required by Algorithm 1 may only increase when (cid:101)Sp decreases. Thus we may use the number of samples in the last round of Algorithm 2, where (cid:101)Sp = Θ(Sp), as the upper bound Sp satisfying (1 − )Sp ≤ Sp ≤ (1 + )Sp with probability at least 2/3, as desired. 2 Sp. As a result, our algorithm must p for each previous iteration. Therefore, each of the O(log n) iterations takes O(m log log n / 2S1/p achieving the claimed query complexity. p ) samples, 3.3 Removing the Dependence on m As described above, Algorithm 1 picks the value k and defines the unbiased estimator based on m, the number of edges. Nonetheless, it is possible to remove this assumption of having prior knowledge of m by instead computing its approximation. Furthermore, we will bound m in terms of n and Sp, so that we can also relate the performance of our algorithm to previous studies on this problem such as [GRS11], as done in Table 1. 3.3.1 Approximating m probability xi/(cid:80)n We briefly discuss how to apply our algorithm when m is unknown by first computing an approximation of √ m. Using weighted vertex sampling, we may simulate the algorithm from [MPX07] or [BBS09] that computes an (1 ± )-approximation to the sum of degrees using O( n) weighted samples. More specifically, we cite the following theorem: Theorem 3.3 ([MPX07]) Let x1, . . . , xn be n variables, and define a distribution D that returns (i, xi) with i=1 xi i=1 xj. There exists an algorithm that computes a (1 ± )-approximation of S = (cid:80)n √ using O( Thus, we simulate the sampling process from D by drawing a weighted vertex sample v, querying its degree, and feeding (v, deg(v)) to this algorithm. We will need to decrease  used in this algorithm and our algorithm √ by a constant factor to account for the additional error. Below we show that our complexities are at least O(n1−1/p) which is already O( n) for p = 2, and thus this extra step does not affect our algorithm’s performance asymptotically. n) samples from D. 3.3.2 Comparing m to n and Sp For comparison of performances, we will now show some bounds relating m to n and Sp. Notice that the function(cid:0)deg(v) 3We may use the binomial coefficients (cid:0)x (cid:1) is convex with respect to deg(v).3 Then by applying Jensen’s inequality (Theorem A.4) to (cid:1) for non-integral value x in the inequalities. These can be interpreted through p y alternative formulations of binomial coefficients using falling factorials or analytic functions. 7 this function, we obtain (cid:18)deg(v) (cid:19) p (cid:88) v∈V (cid:18)(cid:80) ≥ n Sp = (cid:19) (cid:18)2m/n (cid:19) p . = n v∈V deg(v)/n p First, let us consider the case where the stars are very rare, namely when Sp ≤ n. The inequality above implies that m ≤ np/2. Substituting this formula back into the bound from Theorem 3.2 yields the query complexity O(n / 2S1/p ). p Now we consider the remaining case where Sp > n. If m < np/2 = O(n), then the query complexity from Theorem 3.2 becomes O(n1−1/p / 2). Otherwise we have 2m/n ≥ p, which allows us to apply the following bound on our binomial coefficient: (cid:18)2m/n (cid:19) p ≥ n (cid:18) 2m (cid:19)p . np Sp ≥ n This inequality implies that m ≤ pn1−1/pS1/p p /2, also yielding the query complexity O(n1−1/p / 2). Compared to [GRS11], our algorithm achieves a better query complexity when Sp ≤ n1+1/p, where the rare stars are more likely to be found via edge sampling rather than uniform vertex sampling or traversing the graph. Our algorithm also performs no worse than their algorithm does for any Sp as large as np. Moreover, due to the simplicity of our algorithm, the dependence on  of our query complexity is only 1/2 for any value of Sp, while that of their algorithm is as large as 1/10 in certain cases. This dependence on  may be of interest to some applications, especially when stars are rare whilst an accurate approximation of Sp is crucial. 3.4 Allowing Neighbor Queries We now briefly discuss how we may improve our algorithm when neighbor queries are allowed (in addition to degree queries and random edge queries). For the case when Sp > np, it is unknown whether our algorithm alone achieves better performance than [GRS11] (see table 1). However, their algorithm has the same basic framework as ours, namely that it also starts by setting (cid:101)Sp to the maximum possible number of stars, then iteratively halves this value until it is in the correct range, allowing the subroutine to correctly compute a (1 ± )-approximation of Sp. As a result, we may achieve the same performance as them in this regime by simply letting Algorithm 2 call the subroutine from [GRS11] when Sp ≥ np. We will later show tight lower bounds (up to polylogarithmic factors) to the case where all three types of queries are allowed, which is a stronger model than the one previously studied in their work. 4 Lower Bounds for Counting Stars in Undirected Graphs In this section, we establish the lower bounds summarized in the last two columns of Table 1. We give lower bounds that apply even when the algorithm is permitted to sample random edges. Our first lower bound is proved in Section 4.1; While this is the simplest case, it provides useful intuition for the proofs of subsequent bounds. In order to overcome the new obstacle of powerful queries in our model, for larger values of Sp we create an explicit scheme for constructing families of graphs that are hard to distinguish by any algorithm even when these queries are present. Using this construction scheme, our approach obtains the bounds for all remaining ranges for Sp as special cases of a more general bound, and the general bound is proved via the straightforward application of Yao’s principle and a coupling argument. Our lower bounds are tight (up to polylogarithmic factors) for all cases except for the bottom middle cell in Table 1. 4.1 Lower Bound for Sp ≤ n Theorem 4.1 For any constant p ≥ 2, any (randomized) algorithm for approximating Sp to a multiplicative factor via neighbor queries, degree queries and random edge queries with probability of success at least 2/3 8 ) total number of queries for any Sp ≤ np. p requires Ω(n/S1/p Proof: We now construct two families of graphs, namely F1 and F2, such that any G1 and G2 drawn from each respective family satisfy Sp(G1) = 0 and Sp(G2) = Θ(s) for some parameter s > (p + 1)p = O(1). We construct G1 as follows: for a subset S ⊆ V of size (cid:100)s1/p(cid:101) + 1, we create a union of a (p − 1)-regular graph on S and a (p− 1)-regular graph on V \ S, and add the resulting graph G1 to F1. To construct all graphs in F1, we repeat this process for every subset S of size (cid:100)s1/p(cid:101) + 1. F2 is constructed a little differently: rather than using a (p − 1)-regular graph on S, we use a star of size (cid:100)s1/p(cid:101) on this set instead. We add a union between a star on S and a (p − 1)-regular graph on V \ S of any possible combination to F2. By construction, every G1 ∈ F1 contains no p-stars, whereas every G2 ∈ F2 has(cid:0)O(s1/p) (cid:1) = Θ(s) p-stars. For any algorithm to distinguish between F1 and F2, when given a graph G2 ∈ F2, it must be able to detect some vertex in S with probability at least 2/3. Otherwise, if we randomly generate a small induced subgraph according to the uniform distribution in F2 conditional on not having any vertex or edge in S, the distribution would be identical to the uniform in F1. Furthermore, notice that S cannot be reached via traversal using neighbor queries as it is disconnected from V \ S. The probability of sampling such vertex or edge from each query is O(s1/p/n). Thus, Ω(n/s1/p) samples are required to achieve a constant factor approximation with probability 2/3. p 4.2 Overview of the Lower Bound Proof for Sp > n √ Since graphs with large Sp contain many edges, we must modify our approach above to allow graphs from the first family to contain stars. We construct two families of graphs F1 and F2 such that the number of stars of graphs from these families differ by some multiplicative factor c > 1; any algorithm aiming to approximate Sp within a multiplicative factor of c must distinguish between these two families with probability at least 2/3. We create representations of graphs that explicitly specify their adjacency list structure. Each G1 ∈ F1 contains n1 vertices of degree d1, while the remaining n2 = n − n1 vertices are isolated. For each G2 ∈ F2, we modify our representation from F1 by connecting each of the remaining n2 vertices to d2 (cid:29) d1 neighbors, so that these vertices contribute sufficient stars to establish the desired difference in Sp. We hide these additional edges in carefully chosen random locations while ensuring minimal disturbance to the original graph representation; our representations are still so similar that any algorithm may not detect them without making sufficiently many queries. Moreover, we define a coupling for answering random edge queries so that the same edges are likely to be returned regardless of the underlying graph. While the proof of [GRS11] also uses similar families of graphs, our proof analysis greatly deviates from their proof as follows. Firstly, we apply Yao’s principle which allows us to prove the lower bounds on ran- domized algorithms by instead showing the lower bound on deterministic algorithms on our carefully chosen distribution of input instances.4 Secondly, rather than constructing two families of graphs via random pro- cesses, we construct our graphs with adjacency list representations explicitly, satisfying the above conditions for each lower bound we aim to prove. This allows us to avoid the difficulties in [GRS11] regarding the gen- eration of potential multiple edges and self-loops in the input instances. Thirdly, we define the distribution of our instances based on the permutation of the representations of these two graphs, and the location we place the edges in G2 that are absent in G1. We also apply the coupling argument, so that the distribution of these permutations we apply on these graphs, as well as the answers to random edge queries, are as similar as possible. As long as the small difference between these graphs is not discovered, the interaction between the algorithm and our oracle must be exactly the same. We show that with probability 1 − o(1), the algorithm and our oracle behave in exactly the same way whether the input instance corresponds to G1 or G2. Simplifying the arguments from [GRS11], we completely bypass the algorithm’s ability to make use of graph structures. Our proof only requires some conditions on the parameters n1, d1, n2, d2; this allows us to show the lower bounds for multiple ranges of Sp simply by choosing appropriate parameters. We provide the full details in Section C. The main results of our constructions are given as the following 4See e.g., [MR10] for more information on Yao’s principle. 9 theorems. We note that lower bounds apply when only subsets of these three types of queries are provided. This concludes all of our lower bounds in Table 1. Theorem 4.2 For any constant p ≥ 2, any (randomized) algorithm for approximating Sp to a multiplicative factor via neighbor queries, degree queries and random edge queries with probability of success at least 2/3 requires Ω(n1−1/p) total number of queries for any Sp = O(np). Theorem 4.3 For any constant p ≥ 2, any (randomized) algorithm for approximating Sp to a multiplicative factor via neighbor queries, degree queries and random edge queries with probability of success at least 2/3 (cid:19) (cid:18) np−1/p S1−1/p p requires Ω total number of queries for any Sp = Ω(np). 5 Acknowledgements This material is based upon work supported by the National Science Foundation Graduate Research Fellow- ship under Grant No. CCF-1217423, CCF-1065125, CCF-1420692, and CCF-1122374. Any opinion, findings, and conclusions or recommendations expressed in this material are those of the authors(s) and do not nec- essarily reflect the views of the National Science Foundation. We thank Peter Haas and Samuel Madden for helpful discussions. References [ADH+08] Noga Alon, Phuong Dao, Iman Hajirasouliha, Fereydoun Hormozdiari, and S Cenk Sahinalp. Biomolecular network motif counting and discovery by color coding. Bioinformatics, 24(13):i241– i249, 2008. [AFS12] [AG09] Omid Amini, Fedor V Fomin, and Saket Saurabh. Counting subgraphs via homomorphisms. SIAM Journal on Discrete Mathematics, 26(2):695–717, 2012. Noga Alon and Shai Gutner. Balanced hashing, color coding and approximate counting. Parameterized and Exact Computation, pages 1–16. Springer, 2009. In [AGM12] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: sparsification, spanners, and subgraphs. In Proceedings of the 31st symposium on Principles of Database Systems, pages 5–14. ACM, 2012. [AGMS99] Noga Alon, Phillip B Gibbons, Yossi Matias, and Mario Szegedy. Tracking join and self-join In Proceedings of the eighteenth ACM SIGMOD-SIGACT-SIGART sizes in limited storage. symposium on Principles of database systems, pages 10–20. ACM, 1999. [AMS96] Noga Alon, Yossi Matias, and Mario Szegedy. The space complexity of approximating the frequency moments. In Proceedings of the twenty-eighth annual ACM symposium on Theory of computing, pages 20–29. ACM, 1996. [AYZ97] Noga Alon, Raphael Yuster, and Uri Zwick. Finding and counting given length cycles. Algorith- mica, 17(3):209–223, 1997. [BBCG08] Luca Becchetti, Paolo Boldi, Carlos Castillo, and Aristides Gionis. Efficient semi-streaming al- gorithms for local triangle counting in massive graphs. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 16–24. ACM, 2008. [BBM12] Eric Blais, Joshua Brody, and Kevin Matulef. Property testing lower bounds via communication complexity. Computational Complexity, 21(2):311–358, 2012. 10 [BBS09] Tugkan Batu, Petra Berenbrink, and Christian Sohler. A sublinear-time approximation scheme for bin packing. Theoretical Computer Science, 410(47):5082–5092, 2009. [BFL+06] Luciana S Buriol, Gereon Frahling, Stefano Leonardi, Alberto Marchetti-Spaccamela, and Chris- tian Sohler. Counting triangles in data streams. In Proceedings of the twenty-fifth ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, pages 253–262. ACM, 2006. [BGKS06] Lakshminath Bhuvanagiri, Sumit Ganguly, Deepanjan Kesh, and Chandan Saha. Simpler al- gorithm for estimating frequency moments of data streams. In Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 708–713. ACM, 2006. [BYKS02] Ziv Bar-Yossef, Ravi Kumar, and D Sivakumar. Reductions in streaming algorithms, with an application to counting triangles in graphs. In Proceedings of the thirteenth annual ACM- SIAM symposium on Discrete algorithms, pages 623–632. Society for Industrial and Applied Mathematics, 2002. [CK04] Don Coppersmith and Ravi Kumar. An improved data stream algorithm for frequency moments. In Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithms, pages 151– 156. Society for Industrial and Applied Mathematics, 2004. [CR14] Cl´ement Canonne and Ronitt Rubinfeld. Testing probability distributions underlying aggregated data. arXiv preprint arXiv:1402.3835, 2014. [DLR95] Richard A Duke, Hanno Lefmann, and Vojtech Rodl. A fast approximation algorithm for com- puting the frequencies of subgraphs in a given graph. SIAM Journal on Computing, 24(3):598– 620, 1995. [ELR15] Talya Eden, Amit Levi, and Dana Ron. Approximately counting triangles in sublinear time. arXiv preprint arXiv:1504.00954, 2015. [Fei06] [FG04] Uriel Feige. On sums of independent random variables with unbounded variance and estimating the average degree in a graph. SIAM Journal on Computing, 35(4):964–984, 2006. Jorg Flum and Martin Grohe. The parameterized complexity of counting problems. SIAM Journal on Computing, 33(4):892–922, 2004. [FLR+12] Fedor V Fomin, Daniel Lokshtanov, Venkatesh Raman, Saket Saurabh, and BV Rao. Faster algorithms for finding and counting subgraphs. Journal of Computer and System Sciences, 78(3):698–706, 2012. [GK07] [Gol13] Joshua A Grochow and Manolis Kellis. Network motif discovery using subgraph enumeration and symmetry-breaking. In Research in Computational Molecular Biology, pages 92–106. Springer, 2007. Oded Goldreich. On the communication complexity methodology for proving lower bounds on the query complexity of property testing. Electronic Colloquium on Computational Complexity (ECCC), 20:73, 2013. [GR08] Oded Goldreich and Dana Ron. Approximating average parameters of graphs. Random Struc- tures & Algorithms, 32(4):473–493, 2008. [GRS11] Mira Gonen, Dana Ron, and Yuval Shavitt. Counting stars and other small subgraphs in sublinear-time. SIAM Journal on Discrete Mathematics, 25(3):1365–1411, 2011. [GS09] Mira Gonen and Yuval Shavitt. Approximating the number of network motifs. Internet Mathe- matics, 6(3):349–372, 2009. 11 [GTK01] Lise Getoor, Benjamin Taskar, and Daphne Koller. Selectivity estimation using probabilistic models. In ACM SIGMOD Record, volume 30, pages 461–472. ACM, 2001. [HA08] David Hales and Stefano Arteconi. Motifs in evolving cooperative networks look like protein structure networks. Networks and Heterogeneous Media, 3(2):239, 2008. [HBPS07] Fereydoun Hormozdiari, Petra Berenbrink, Natasa Przulj, and S Cenk Sahinalp. Not all scale-free networks are born equal: the role of the seed graph in ppi network evolution. PLoS computational biology, 3(7):e118, 2007. [HILM09] Peter J Haas, Ihab F Ilyas, Guy M Lohman, and Volker Markl. Discovering and exploiting statistical properties for query optimization in relational databases: A survey. Statistical Analysis and Data Mining: The ASA Data Science Journal, 1(4):223–250, 2009. [HKNO09] Avinatan Hassidim, Jonathan A Kelner, Huy N Nguyen, and Krzysztof Onak. Local graph partitions for approximation and testing. In Foundations of Computer Science, 2009. FOCS’09. 50th Annual IEEE Symposium on, pages 22–31. IEEE, 2009. [HNSS96] Peter J Haas, Jeffrey F Naughton, S Seshadri, and Arun N Swami. Selectivity and cost estimation for joins based on random sampling. Journal of Computer and System Sciences, 52(3):550–569, 1996. [IW05] Piotr Indyk and David Woodruff. Optimal approximations of the frequency moments of data streams. In Proceedings of the thirty-seventh annual ACM symposium on Theory of computing, pages 202–208. ACM, 2005. [KIMA04] Nadav Kashtan, Shalev Itzkovitz, Ron Milo, and Uri Alon. Efficient sampling algorithm for estimating subgraph concentrations and detecting network motifs. Bioinformatics, 20(11):1746– 1758, 2004. [KMPT10] Mihail N Kolountzakis, Gary L Miller, Richard Peng, and Charalampos E Tsourakakis. Efficient triangle counting in large graphs via degree-based vertex partitioning. In Algorithms and Models for the Web-Graph, pages 15–24. Springer, 2010. [KMSS12] Daniel M Kane, Kurt Mehlhorn, Thomas Sauerwald, and He Sun. Counting arbitrary subgraphs in data streams. In Automata, Languages, and Programming, pages 598–609. Springer, 2012. [LKC99] Ju-Hong Lee, Deok-Hwan Kim, and Chin-Wan Chung. Multi-dimensional selectivity estimation using compressed histogram information. In ACM SIGMOD Record, volume 28, pages 205–214. ACM, 1999. [MHK+07] Volker Markl, Peter J Haas, Marcel Kutsch, Nimrod Megiddo, Utkarsh Srivastava, and Tam Minh Tran. Consistent selectivity estimation via maximum entropy. The VLDB jour- nal, 16(1):55–76, 2007. [MMPS11] Madhusudan Manjunath, Kurt Mehlhorn, Konstantinos Panagiotou, and He Sun. Approximate counting of cycles in streams. In Algorithms–ESA 2011, pages 677–688. Springer, 2011. [MPX07] Rajeev Motwani, Rina Panigrahy, and Ying Xu. Estimating sum by weighted sampling. In Automata, Languages and Programming, pages 53–64. Springer, 2007. [MR10] Rajeev Motwani and Prabhakar Raghavan. Randomized algorithms. Chapman & Hall/CRC, 2010. [MSOI+02] Ron Milo, Shai Shen-Orr, Shalev Itzkovitz, Nadav Kashtan, Dmitri Chklovskii, and Uri Alon. Network motifs: simple building blocks of complex networks. Science, 298(5594):824–827, 2002. 12 [NO08] Huy N Nguyen and Krzysztof Onak. Constant-time approximation algorithms via local im- provements. In Foundations of Computer Science, 2008. FOCS’08. IEEE 49th Annual IEEE Symposium on, pages 327–336. IEEE, 2008. [ORRR12] Krzysztof Onak, Dana Ron, Michal Rosen, and Ronitt Rubinfeld. A near-optimal sublinear-time algorithm for approximating the minimum vertex cover size. In Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1123–1131. SIAM, 2012. [PCJ04] N Przulj, Derek G Corneil, and Igor Jurisica. Modeling interactome: scale-free or geometric? Bioinformatics, 20(18):3508–3515, 2004. [PI97] [PR07] [Ses15] [SIKS06] Viswanath Poosala and Yannis E Ioannidis. Selectivity estimation without the attribute value independence assumption. In VLDB, volume 97, pages 486–495, 1997. Michal Parnas and Dana Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theoretical Computer Science, 381(1):183–196, 2007. C Seshadhri. A simpler sublinear algorithm for approximating the triangle count. arXiv preprint arXiv:1505.01927, 2015. Jacob Scott, Trey Ideker, Richard M Karp, and Roded Sharan. Efficient algorithms for de- tecting signaling pathways in protein interaction networks. Journal of Computational Biology, 13(2):133–144, 2006. [SS94] Arun Swami and K Bernhard Schiefer. On the estimation of join result sizes. Springer, 1994. [SSRS06] Tomer Shlomi, Daniel Segal, Eytan Ruppin, and Roded Sharan. Qpath: a method for querying pathways in a protein-protein interaction network. BMC bioinformatics, 7(1):199, 2006. [VW09] [Wer06] [Wil09] [YYI09] Virginia Vassilevska and Ryan Williams. Finding, minimizing, and counting weighted subgraphs. In Proceedings of the forty-first annual ACM symposium on Theory of computing, pages 455–464. ACM, 2009. Sebastian Wernicke. Efficient detection of network motifs. IEEE/ACM Transactions on Com- putational Biology and Bioinformatics (TCBB), 3(4):347–359, 2006. Ryan Williams. Finding paths of length k in o ∗ (2k) time. Information Processing Letters, 109(6):315–318, 2009. Yuichi Yoshida, Masaki Yamamoto, and Hiro Ito. An improved constant-time approximation algorithm for maximum. In Proceedings of the 41st annual ACM symposium on Theory of computing, pages 225–234. ACM, 2009. A Useful Inequalities This section provides standard equalities that we use throughout our paper. These inequalities exist in many variations, but here we only present the formulations which are most convenient for our purposes. Theorem A.1 (Chebyshev’s Inequality) For any random variable X and a > 0, Theorem A.2 (Markov’s Inequality) For any non-negative random variable X and a > 0, P[X − E[X] ≥ a] ≤ Var[X] a2 P[X ≥ a] ≤ E[X] a . 13 Theorem A.3 (Chernoff Bound) Let X1,··· , Xn be independent Poisson random variables such that P[Xi = 1] = p for all i ∈ [n], and let X = 1 Theorem A.4 (Jensen’s Inequality) For any real convex function f with x1,··· , xn in its domain, (cid:80)n i=1 Xi. Then for any 0 < δ ≤ 1, P[X > (1 + δ)p] < e−δ2pn/3. n n(cid:88) f (xi) ≥ nf i=1 i=1 (cid:32) n(cid:88) (cid:33) xi 1. If 1 B Proof of Lemma 3.1 Lemma 3.1 For 0 <  ≤ 1/2, with probability at least 2/3: 2 Sp ≤ (cid:101)Sp ≤ 6Sp, then Algorithm 1 outputs ¯Y such that (1 − )Sp ≤ ¯Y ≤ (1 + )Sp; moreover, if Sp < Sp then ¯Y ≥ (1 − )(cid:101)Sp. 2. If (cid:101)Sp > 6Sp, then Algorithm 1 outputs ¯Y such that ¯Y < 1 Proof: Let us first consider the first item. Since Var[Y ] ≤ E[Y 2], we will focus on establishing an upper bound of E[Y 2]. We compute 2(cid:101)Sp ≤ (1 − )(cid:101)Sp. (cid:18) 2m (cid:18)deg(v) (cid:19)(cid:19)2 (cid:88) (cid:32)(cid:88) (cid:19)2−1/p ≤ 2m (cid:18)deg(v) (cid:18)deg(v) where the first inequality holds because (deg(v))p ≥(cid:0)deg(v) (cid:1). Rearranging the terms, we have the following (cid:18)deg(v) (cid:19)2 (cid:19)(cid:33)2−1/p = 2mS2−1/p (cid:88) (cid:88) ≤ 2m E[Y 2] = deg(v) deg(v) deg(v) = 2m v∈V v∈V v∈V v∈V 2m p p p p p , 1 relationship: Now let us consider our average ¯Y . Since Yi are identically distributed, we have Var[ ¯Y ] = Var Yi = 1 k2 Var Yi = 1 k Var[Y ] ≤ 1 k E[Y 2]. p E[Y 2] S2 p ≤ 2m pS1/p p . (cid:35) (cid:34) k(cid:88) i=1 1 k (cid:35) (cid:34) k(cid:88) i=1 By Chebyshev’s inequality (Theorem A.1), we have In order to achieve the desired value ¯Y such that (1 − )Sp ≤ ¯Y ≤ (1 + )Sp with error probability 1/3, it is sufficient to take 6m / p2S1/p the number of required samples to achieve such bound with probability 1/3 is 2 Sp ≤ (cid:101)Sp ≤ 6Sp. Thus, Pr[ ¯Y − E[ ¯Y ] ≥ Sp] ≤ Var[ ¯Y ] 2S2 p samples. Recall the assumption that (cid:101)Sp satisfying 1 p2S1/p ≤ 1 k 2m · p p . For the second item, we apply Markov’s Inequality (Theorem A.2) to the given condition to obtain (cid:20) P Y ≥ 1 2 (cid:21) (cid:101)Sp k = 36m p2(cid:101)S1/p p . ≤ E[Y ] 2(cid:101)Sp 1 2(cid:101)Sp Sp 1 < = 14 6(cid:101)Sp 2(cid:101)Sp 1 1 = 1 3 , implying the desired success probability. Lastly, we substitute  < 1/2 to obtain the relationship between ¯Y and (1 − ) Sp, which establishes the condition for deciding whether the given Sp is much larger than Sp, as desired. C Proof of Lower Bounds for Undirected Graphs with Sp > n In this section we provide the proof of lower bounds claimed in Section 4.2. Firstly, to properly describe the adjacency list representation of the input graphs, we introduce the notion of graph representation. Next, we state a main lemma (Lemma C.1) that establishes the constraints of parameters n1, d1, n2, d2 that allows us to create hard instances. We then move on to describe our constructions, including both the distribution for applying Yao’s principle, and the implementation of the oracle for answering random edge queries. We prove our main lemma for our construction, and lastly, we give the appropriate parameters that complete the proof of our lower bounds. C.1 Graph Representations Consider the following representation L of an adjacency list for an undirected graph G. Let us say that each vertex vi has deg(vi) ports numbered 1, . . . , deg(v) attached, where the jth port of vertex vi is identify as a pair (i, j), which is used as an index for L. L imposes a perfect matching between these ports; namely, L(i1, j1) = (i2, j2) indicates that ports (i1, j1) and (i2, j2) are matched to each other, and this implies L(i2, j2) = (i1, j1) as well. We use L to define the adjacency list of our graph; that is, if L(i1, j1) = (i2, j2) then the jth 1 neighbor of vi1 is vi2 (and vice versa). Note that there can be many such representations of G, and some perfect matchings between ports may yield graphs parallel edges or self-loops. Furthermore, each edge e is associated with a unique pair of matched cells. C.2 Main Lemma Our proof proceeds in two steps. First, we show the following lemma that applies to certain parameters of graphs. Lemma C.1 Let n1, d1, n2, d2 be positive parameters satisfying the following properties: d1 and n2 are even, n2 ≤ d1 ≤ 2d2 and d1 + 2d2 < n1. Let n = n1 + n2, and define the following two families of graphs on n vertices: • F1: all graphs containing n1 vertices of degree d1 and n2 isolated vertices; • F2: all graphs containing n1 vertices of degree d1 and n2 vertices of degree d2. d1n1 and q = o(1/r). Then, there exists a distribution D of representations of graphs from Let r = (d1+d2)n2 F1 ∪ F2 such that for any deterministic algorithm A that makes at most q total neighbor queries, degree queries and random edge queries, on the graph representation randomly drawn from D, A cannot correctly identify whether the given representation is of a graph from F1 or F2 with probability at least 2/3. (cid:0)d1 p By applying Yao’s principle, the following corollary is implied. (cid:1) and s2 = n1 Corollary C.2 Let n1, d1, n2, d2 be parameters satisfying the properties specified in Lemma C.1. Let s1 = n1 (randomized) algorithm for approximating Sp to a multiplicative factor via neighbor queries, degree queries and random edge queries with probability of success at least 2/3 requires Ω(q) queries for Sp = Θ(f (n, p)). (cid:1). If s1 = Θ(f (n, p)) and s2 ≥ c · s1 for some constant c > 1, then any (cid:1) + n2 (cid:0)d2 p (cid:0)d1 p As a second step, we propose a few sets of parameters for different ranges of Sp. Applying Corollary C.2, this yields lower bounds for the remaining ranges of Sp. 15 Figure 1: first few columns of L1 C.3 Our Constructions C.3.1 Construction of D We prove this lemma by explicitly constructing the distribution. Construction of graph representations for F1. We now define the representation L1 for the graph G1 ∈ F1 as follows. We let v1, . . . , vn1 be the vertices with degree d1. Let us refer to the jth pair of consecutive columns (with indices 2j − 1 and 2j) as the jth slab. Then, in the jth slab, we match each cell on the left column with the cell at distance j below on the right column. Figure 1 illustrates the matching of cells in the first few columns of L1. More formally, for each integer i ∈ [n1] and j ∈ [d1/2], we match the cells (i, 2j − 1) and (i + j mod n1, 2j) in L1. Since d1 is even, this construction fills the entire table of L1. We wish to claim that we do not create any parallel edges with this construction. Clearly, this is true within a slab. For different slabs, recall that we map cells in the jth slab with those at vertical distance j away. Thus, it suffices to note that no pair of slabs uses the same distance mod n1. Equivalently, we can note that as the maximum distance is d1/2 and d1/2 < n1/2 by our assumption, the set of distances {j, n1 − j} for j ∈ [d1/2] are all disjoint. That is, our construction creates no parallel edges or self-loops. Construction of graph representations for F2. Next, for each integer x ∈ [n1] and y ∈ [d/2], we define a graph Gx,y by modifying L1 as follows. First, recall that we need to add neighbors to the previously isolated vertices vn1+1, . . . , vn. These neighbors are represented as a table of size n2 × d2 in Lx,y (a) which is not present in L1. We match the cells in this new table to a subtable of size d2 × n2, which is shown as the (a). The top-left cell of this subtable corresponds to the index (x, 2y − 1) in yellow rectangle in Figure Lx,y 2 , and note that if x + d2 > n1 or 2y + n2 > d1, this subtable may wrap around as shown in Figure Lx,y Lx,y (b). Since n2 ≤ d1 and d2 < n1, the dimensions of this yellow rectangle does not exceed the original table in L1. 2 ; in Figure 2, it is represented as the green rectangle in Figure Lx,y 2 2 with corresponding representation Lx,y 2 2 2 Now we explain how we match the cells. Between the yellow and green subtables, we map them in a transposed fashion. That is, the cell with index (i, j) (relative to the green table) is mapped to the yellow cell with index (j, i) (relative to the yellow subtable), as shown in Figure 3 (a). This method guarantees that no two rows contain two pair of matched cells between them. As a result, we do not create any parallel edges or self-loops. As we place the yellow subtable, some edges originally in L1 may now have only one endpoint in the yellow subtable. We refer to the cells in the table that correspond to such edges as unmatched. Since n2 is even and we set our offset to (x, 2y − 1), then every slab either does not overlap with the yellow subtable, or 16 123456……𝑖𝑖−1𝑖−2𝑖+1𝑖+2⋮⋮⋮⋮ Figure 2: Comparison between tables L1 and L2. Lx,y depending on the values of x and y. 2 (a) and (b) show two different possibilities for Lx,y 2 Figure 3: matchings in Lx,y 2 17 𝑛1𝑑2𝐿1𝐿2𝑥,𝑦(a)𝑥,2𝑦−1𝑛2𝑑1𝑛2𝑑2𝑛1𝑑1𝑛2𝐿2𝑥,𝑦(b)𝑥,2𝑦−1(a)≤𝑑1/2≤ 𝑑12+𝑑2𝑑2(b) overlaps in the exact same rows for both columns of the slab. Thus, the only edges that have one endpoint in the yellow subtable are those that go from a cell above it to one in it. Roughly speaking, we still map the cells in the same way but ignore the distance it takes to skip over the yellow subtable. More formally, in the jth slab, we pair each unmatched cell from the left and right respectively that are at vertical distance j + d2 away (instead of j), as shown with the red edges in Figure 3 (b). Now the set of distances between the cells corresponding to an edge in the jth slab are {j, j + d2, n1 − j, n1 − (j + d2)}, since distances can be measured both by going down and by going up and looping around. From our assumption, d1/2 ≤ d2 and d1/2 + d2 < n1/2, and thus no distance is shared by multiple slabs, and thus there are no parallel edges or self-loops. Permutation of graph representations. Let π be a permutation over [n].5 Given a graph representation L, we define π(L) as a new presentation of the same underlying graph, such that the indices of the vertices are permuted according to π. We may consider this operation as an interface to the original oracle. Namely, any query made on a vertex index i is translated into a query for index π(j) to the original oracle. If a vertex index j is an answer from the oracle, then we return π−1(j) instead. The distribution D. Let Sn denote the set of all n! permutations over [n]. We define D formally as follows: for any permutation π ∈ Sn, the representation π(L1) corresponding to G1 is drawn from D with probability 1/(2n!), and each representation π(Lx,y is drawn with probability 1/(n1d1n!) for every (x, y) ∈ [n1] × [d1/2]. In other words, to draw a random instance from D, we flip an unbiased coin to choose between families F1 and F2. We obtain a representation L1 if we choose F1; otherwise we pick a random representation Lx,y for F2. Lastly, we apply a random permutation π to such representation. 2 ) corresponding to Gx,y 2 2 C.3.2 Answering Random Edge Queries Notice that Yao’s principle allows us to remove randomness used by the algorithm, but the randomness of the oracle remains for the random edge queries. For any representation we draw from D, the oracle must return an edge uniformly at random for each random edge query. Nonetheless, we may choose our own implementation of the oracle as long as this condition is ensured. We apply a coupling argument that imposes dependencies between the behaviors of our oracle between when the underlying graph is from F1 or F2. Let m1 = d1n1/2 and m2 = (d1n1 + d2n2)/2 denote the number of edges of graphs from F1 and F2, respectively. Our oracle works differently depending on which family the graph comes from. The following describes the behavior of our oracle for a single query, and note that all queries should be evaluated independently. Query to L1. We simply return an edge chosen uniformly at random. That is, we pick a random matched pair of cells in L1, and return the vertices corresponding to the rows of those cells. Query to Lx,y mx,y random from the set of edges in Lx,y 2 . With probability s /m2, we return the same edge we choose for L1. Otherwise, we return an edge chosen uniformly at denote the number of edges shared by both L1 and Lx,y 2 . Let mx,y s 2 but not in L1. Our oracle clearly returns an edge chosen uniformly at random from the corresponding representation. The benefit of using this coupling oracle is that we increase the probability that the same edge is returned to mx,y are fully contained within the subtable of size (d1 + d2)n2 obtained by extending the yellow subtable to include d1/2 more rows above and s ≥ (d1n1 − (d1 + d2)n2)/2. Thus, our oracle may only return a different edge with probability below. mx,y s /m2. By our construction, the cells in L1 that are modified to obtain Lx,y 2 = d1n2 d1n1 + d2n2 ≤ r. 1 − mx,y s m2 = 1 − d1n1 − (d1 + d2)n2 d1n1 + d2n2 C.4 Proof of Lemma C.1 Recall that we consider a deterministic algorithm A that makes at most q = o(1/r) queries. We may describe the behavior between A and the oracle with its query-answer history. Notice that since A is 5A permutation π over [n] is a bijection π : [n] → [n]. 18 deterministic, if every answer that A receives from the oracle is the same, then A must return the same answer, regardless of the underlying graph. Our general approach is to show that for most permutations π, running A with instance π(L1) will result in the same query-answer history as running with π(Lx,y 2 ) for most random parameters π and (x, y). If these histories are equivalent, then A may answer correctly for only roughly half of the distribution. Throughout this section, we refer to our indices before applying π to the representation. We bound the probability that the query-answer histories are different using an inductive argument as follows. Suppose that at some point during the execution of A, the history only contains vertices of indices from [n1], and all cells in the history are matched in the same way in both L1 and Lx,y 2 . This inductive hypothesis restricts the possible parameters π and (x, y) to those that yield same history up to this point. We now consider the probability that the next query-answer pair differs, and aim to bound this probability by O(r). Firstly, we consider a degree query. By our hypothesis, for a vertex of index outside [n1] to be queried, A must specify a vertex it has not chosen before. Notice that A may learn about up to 2 vertices from each query-answer pair, so at least n − 2q vertices have never appeared in the history. Since we pick a random permutation π for our construction, the probability that the queried vertex has index outside [n1] is n2/(n − 2q). As r ≥ n2/n1 ≥ 1/n1, we have q = o(n1) and our probability simplifies to at most n2 n − 2q = n2 (n1 + n2) − 2 · o(n1) ≤ n2 n1(1 − o(1)) = O(r). Next, we consider a neighbor query. From the argument above, with probability 1 − O(r), the queried vertex given by A has an index from [n1]. Similarly, A may learn about up to 2 cells from each query-answer pair. Notice that there are (d1 +d2)n2 different possible (x, y) for which each of these cells could be located in the yellow subtable or the two (d1/2)× n2 strips above and below it. As a result, out of d1n1− ((d1 + d2)n2)q remaining possible locations for the yellow subtable, the queried cell and the corresponding answer may be in at most 2(d1 + d2)n2 of them. As (x, y) is randomly chosen, the probability that this next query-answer pair is different is at most 2(d1 + d2)n2 d1n1 − ((d1 + d2)n2)q = 2r 1 − rq = 2r 1 − o(1) = O(r). Lastly, we consider a random edge query. From the construction in Section C.3.2 above, the probability that the returned random edge differs is O(r), regardless of the parameters. From this inductive argument, the probability that the history differs at each step is at most O(r). As A only make q queries, the probability that the history differs is at most q · O(r) = o(1). Thus with probability 1 − o(1), it is impossible for A to distinguish whether the underlying graph is from F1 or F2. Since each family is included in D with probability density 1/2, as A is deterministic, the answer given by A for these cases is correct for only half of them. Thus, the probability of A correctly distinguish between the two graph families is only 1 − 1 2 (1 − o(1)) = 1 2 + o(1), as required. C.5 Establishing Lower Bounds Now we propose the feasible asymptotic parameters according to Lemma C.1 and Lemma C.2 in order to establish our lower bounds through the following claim. Claim C.3 There exists parameters n1, d1, n2, d2 satisfying the properties specified in Lemma C.1, yielding values s1, s2 satisfying the properties in Lemma C.2, for each of the following cases: 1. n1 = Θ(n), d1 = Θ((s/n)1/p), n2 = Θ(1), d2 = Θ(s1/p) for f (n, p) = O(np) 2. n1 = Θ(n), d1 = Θ((s/n)1/p), n2 = Θ(s/np), d2 = Θ(n) for f (n, p) = Ω(np) We omit the proof of this claim; our proof only requires straightforward calculation, and a very similar analysis can be found in [GRS11]. By computing the value r for each case and applying Lemma C.2, we obtain Theorem 4.2 and Theorem 4.3, respectively. 19 D Extension to Directed Graphs In this section, we extend our model to the directed case. Firstly, we formally give the specification of this new model. Since most of the specification from the undirected graph model given in Section 2 still applies to the directed case, we only explain the differences between these models. We assume separate adjacency lists for in-neighbors and out-neighbors, allowing for a neighbor about either type of neighbor. Similarly, a degree query may ask for either of the in-degree or the out-degree. Random edge queries now return directed edges (u, v); the algorithm knows both the endpoints and the direction. We focus on the simplest case of stars with mixed directions: approximately counting the number of paths of length two. Notice the number of stars where all edges point inward or outward can be computed easily by modifying the weighted vertex sampling to sample using in-degree or out-degree respectively and then applying the algorithm from Section 3. This works because the numbers of such stars only depend on the in-degrees and the out-degrees, respectively. Thus, we turn to the problem of counting directed paths of length two as the next simplest case. D.1 Lower Bound By constructing hard instances similar to those of Lemma 4.1, we obtain a lower bound of Ω(n). More formally, letting L(G) denote the number of paths of length two in the directed graph G, we prove the following theorem. Theorem D.1 Any (randomized) algorithm for approximating L(G) to a multiplicative factor via neighbor queries, degree queries and random edge queries requires Ω(n) total number of queries. In particular, this number of queries is necessary to distinguish the case where L(G) = 0 and the case where L(G) = n with probability 2/3. Proof: Without loss of generality, we assume n is even. Now, we partition the vertex set V into S and T such that S = T = n/2. Let G1 be the family of graphs that contains only G1, the complete bipartite graph where every vertex in S has an edge pointing to every vertex in T . Let G2 be the family of graphs G(t,s) constructed by taking the graph from G1 and adding one extra back edge (t, s) ∈ T × S. Notice that there can be many adjacency list representations of each graph, and this affect the answers to neighbor queries. We associate each possible adjacency list representation to each graph, and include all possible such representations in the family. Clearly, L(G1) = 0, whereas L(G(t,s)) = n for every G(t,s) ∈ G2. For any algorithm to distinguish between G1 and G2, when given a graph G(t,s) from G2, it must be able to detect the vertex s or t, the endpoints of the extra edge, with probability at least 2/3. Otherwise, if neither s nor t is discovered, the subgraph induced by vertices that the algorithm sees from both families would be exactly the same. The probability of sampling vertices s or t from a vertex sampling, as well as their incident edges from an edge sampling, is O(1/n). Similarly, in order to reach s or t from one of their neighbors, the algorithm must provide the index of s or t in order to make such neighbor query, which may only succeed with probability O(1/n). Thus, Ω(n) samples are required in order to find s or t with probability 2/3, which establishes our lower bound. as L =(cid:80) D.2 Upper Bound (v) · deg+(v), which represents the number of length two paths whose For each v ∈ V , define l(v) = deg middle vertex is v. Thus the number of paths of length two, which we aim to approximate, can be written v∈V l(v). Notice that 2n degree queries suffice for exactly computing the number of such paths, already matching the lower bound. We explore this problem further by making an assumption in attempt to obtain an algorithm that requires o(n) queries. To this end, we restrict to direct graphs such that there exists a bound on the ratio of in-degree to out-degree. More specifically, we assume that there exists a value − 20 r ≥ 1 such that 1 in G. r ≤ deg−(v) deg+(v) ≤ r, limiting the ratio between the in-degree and the out-degree of any vertex of each vertex closer to the number of paths centered at that vertex by the rejection sampling method. Then Under this additional assumption, we obtain a sublinear time algorithm by reduction to what is essentially the undirected case. Our approach is to modify the weighted vertex sampling process via rejection sampling so that the probability of sampling a vertex v becomes proportional to(cid:112)l(v), bringing the sampling probability v∈V ((cid:112)l(v))2, which requires some modification to the algorithm, we use Algorithm 2 to approximate (cid:80) a random vertex such that each vertex v is returned with probability (cid:112)l(v)/(cid:80) (cid:112)l(v(cid:48)) by making O(r) Claim D.2 In the directed graph model, given weighted vertex sampling and degree queries, we may generate explained later. First, we explain the details of our rejection sampling method. v(cid:48)∈V queries in expectation given the aforementioned assumption. keep u with probability 1√ r Thus, O(r) queries are required to generate one such sample. deg+(u) . Otherwise, discard u and repeat the process. Each vertex u is chosen from a random edge sampling is proportional to its in-degree, deg (cid:113) deg−(u) deg+(u) = (cid:112)l(u), as desired. Since 1 Proof: We draw a random edge sample (u, v), and query for u’s in-degree and out-degree. We return u with probability 1√ r (u). We only (cid:113) deg−(v) deg+(u) , so the probability that any vertex u is actually returned is proportional deg+(v) ≤ 1. (cid:113) deg−(u) to deg+(u) ·(cid:113) deg−(u) (cid:112)l(v). We now have a method to sample a vertex v with probability (cid:112)l(v)/L(cid:48) by Define L(cid:48) =(cid:80) the new distribution given above. Second, we redefine X = (cid:112)l(v) and Y = X · L(cid:48) = (cid:112)l(v) · L(cid:48), so that increasing the time or query complexities only asymptotically by a factor of r. Now we make the following changes to Algorithm 1 so that it approximates L. First, the algorithm should draw random vertices from E[Y ] = L. Note that the value L(cid:48) can be approximated via essentially the same method as in Section 3.3.1. √ nL2). The proof of the variance bound (Lemma 3.1) can be subsequently modified to obtain Var[Y ] = O( √ (This is essentially the problem of approximating the second frequency moment: see [AMS96] for more details.) That is, O( n) queries, suffice to obtain a (1 ± )-approximation of L. This concludes the proof of the following theorem. r ≤ deg−(v) deg+(v) ≤ r, we have that 1 n) samples from this new distribution, or equivalently O(r v∈V √ − r ≤ 1√ r Theorem D.3 Assuming there exists some value r such that 1 graph G, then there exists an algorithm that, using degree queries and random edge queries, computes a (1 ± )-approximation of the number of paths of length two in G with success probability 2/3 using O(r n) queries. deg+(v) ≤ r for every v ∈ V in the directed √ r ≤ deg−(v) Corollary D.4 Assuming that the ratio between the in-degree and the out-degree of every vertex in the directed graph G is bounded above and below by a constant, then there exists an algorithm that, using degree queries and random edge queries, computes a (1 ± )-approximation of the number of paths of length two in √ G with success probability 2/3 using O( n) queries. 21
1712.06690
2
1712
2018-04-23T15:32:39
An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline
[ "cs.DS" ]
Previous work has suggested that the structural restrictions of graphs from classes of bounded expansion--locally dense pockets in a globally sparse graph--naturally coincide with common properties of real-world networks such as clustering and heavy-tailed degree distributions. As such, fixed-parameter tractable algorithms for bounded expansion classes may offer a promising framework for network analysis where other approaches have struggled to scale. However, there has been little work done in implementing and evaluating the performance of these structure-based algorithms. To this end we introduce CONCUSS, a proof-of-concept implementation of a generic algorithmic pipeline for classes of bounded expansion. In particular, we focus on using CONCUSS for subgraph isomorphism counting (also called motif or graphlet counting), which has been used extensively as a tool for analyzing biological and social networks. Through a broad set of experiments we first evaluate the interactions between implementation/engineering choices at multiple stages of the pipeline and their effects on overall run time. From there, we establish viability of the bounded expansion framework by demonstrating that in some scenarios CONCUSS achieves run times competitive with a popular algorithm for subgraph isomorphism counting that does not exploit graph structure. Finally, we empirically identify two particular ways in which future theoretical advances could alleviate bottlenecks in the algorithmic pipeline.
cs.DS
cs
An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline Michael P. O'Brien and Blair D. Sullivan North Carolina State University, (mpobrie3blair_sullivan)@ncsu.edu Abstract Previous work has suggested that the structural restrictions of graphs from classes of bounded expansion-locally dense pockets in a globally sparse graph-naturally coincide with common properties of real-world networks such as clustering and heavy-tailed degree distributions. As such, fixed-parameter tractable algorithms for bounded expansion classes may offer a promising framework for network analysis where other approaches have struggled to scale. However, there has been little work done in implementing and evaluating the performance of these structure- based algorithms. To this end we introduce CONCUSS, a proof-of-concept implementation of a generic algorithmic pipeline for classes of bounded expansion. In particular, we focus on using CONCUSS for subgraph isomorphism counting (also called motif or graphlet counting), which has been used extensively as a tool for analyzing biological and social networks. Through a broad set of experiments we first evaluate the interactions between implementation/engineering choices at multiple stages of the pipeline and their effects on overall run time. From there, we establish viability of the bounded expansion framework by demonstrating that in some scenarios CONCUSS achieves run times competitive with a popular algorithm for subgraph isomorphism counting that does not exploit graph structure. Finally, we empirically identify two particular ways in which future theoretical advances could alleviate bottlenecks in the algorithmic pipeline. Digital Object Identifier 10.4230/LIPIcs... Introduction 1 The analysis of complex networks has proven useful for understanding relationships between entities in large data sets. For example, networks modeling social interactions, protein func- tionality, and accessible transportation routes have been studied extensively in the network science community. However, since many network properties that might yield interesting insights are NP-hard to compute, the prevailing strategies for detecting such properties gen- erally depend on sampling, estimation, and/or heuristics whose reasons for success or failure are not theoretically well understood. At the same time, the structural graph theory and parameterized algorithms communities have a large body of literature on exactly solving NP-hard problems in polynomial time on sparse graphs by exploiting the underlying graph structure. Unfortunately, many of these results either rely on structure like low treewidth, which is unlikely to occur in many complex networks, or hide enormous constants in big-O notation that in practice negate the theoretical gains from the polynomial run times. Recent work has identified a structural class of graphs known as bounded expansion that gives significant algorithmic advantages [21, 22, 11] while accommodating the structural characteristics of complex networks [10]. Though there are some algorithms for bounded expansion that appear to be suitable for practical use, they have yet to be implemented and tested in order to understand their behavior. In this work, we seek to establish the use of bounded expansion structure as a viable pathway to creating scalable software tools for network analysis. As a starting point, we focus specifically on the problem of subgraph isomorphism counting in which the number of occurrences of a small subgraph H (sometimes called a motif or graphlet) in a larger host licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline graph G is counted. Because previous research suggests that subgraph isomorphism counting can be used as a building block for understanding network dynamics [29] and aligning similar graphs [20], an improved counting algorithm would have many practical applications. Our main contribution is a set of computational experiments using CONCUSS [24], an open source software tool written in pure Python that implements the best known algorithm for subgraph isomorphism counting in bounded expansion graphs [10]. On a high level, CONCUSS finds a coloring of the vertices to identify the relevant structure, uses the coloring to decompose the graph into small pieces, counts the isomorphisms on each small piece, and combines the subsolutions to get a final count. Notably, the theoretical description of this pipeline leaves room for multiple choices for implementing certain subroutines; we implement several variants of these routines and discuss the associated algorithm engineering decisions. Our experimental design is oriented towards understanding not only the strengths of the algorithmic pipeline of CONCUSS but also the ways in which further theoretical research could alleviate bottlenecks. Theoretical advances to this pipeline would not only enable faster subgraph isomorphism counting, but also provide an improved framework for solving other combinatorial problems in graphs of bounded expansion (see Section 3). As such, we answer the following four questions: Q1. What choices of subroutines give the best performance in CONCUSS? Q2. How does CONCUSS compare to other algorithms for subgraph isomorphism counting? Q3. How does the distribution of color class sizes influence downstream performance? Q4. Would alternative colorings with weaker structural guarantees incur significant penalties? After giving the necessary background and notation in Section 2, we briefly describe the algorithmic pipeline CONCUSS implements in Section 3. Section 4 details the general experimental setup. In Section 5 we show the performance of various configurations of CONCUSS compared to each other (Q1) and to the NetworkX [13] implementation of the popular VF2 algorithm [9] (Q2). We then investigate in Section 6 ways in which theoretical improvements to the coloring algorithms might improve CONCUSS (Q3 and Q4). Background 2 All graphs in this paper are assumed to be simple and undirected unless otherwise specified. For a graph G, let V (G) and E(G) denote the vertices and edges of G, respectively, and let uv denote an edge with endpoints u and v. For convenience, we define G = V (G). We will write Pn and Sn for the path and star on n vertices, respectively. A (vertex) coloring φ is a mapping of V (G) to a set of k colors; we say that k is the size of φ. A color class C of φ is a maximal set of vertices that for all u, v ∈ C, φ(u) = φ(v). The remainder of this section gives background on subgraph isomorphism counting, bounded expansion, and a related structural class called bounded treedepth. 2.1 Subgraph Isomorphism Counting (cid:73) Definition 1. Given graphs G, H, a subgraph isomorphism from H to G is a mapping ψ : V (H) → V (G) such that uv ∈ E(H) ⇐⇒ ψ(u)ψ(v) ∈ E(G). The subgraph isomorphism counting problem is to count the number of distinct isomor- phisms from V (H) to V (G); solving this problem is #W[1]-hard1 [16]. The most successful 1 There is likely no O(f(H) · nc) time algorithm for any computable function f and constant c. Michael P. O'Brien and Blair D. Sullivan XX:3 algorithms to date used for subgraph isomorphism counting have relied on backtracking [31, 4] or expanding partial mappings [8, 9, 6]. Other subclasses of algorithms have focused on indexing graph databases [28, 14] or creating data structures for parallel computation [30]. Subgraph isomorphism counting is important as a building block for two other network analysis techniques, described below. Motif Counting: Originally used in the study of cellular biology [29], motif counting computes the number subgraph isomorphisms expected to occur "by chance" and compares it to the observed subgraph isomorphism count. If H represents some functional unit in the domain of the data-i.e., cliques in social networks corresponding to people with common interests-an unexpected abundance of H in G gives insight into the domain dynamics that caused these motifs to occur. Graphlet Degree Distribution: Subgraph isomorphism counting is also a building block in the graphlet degree distribution [25], which measures the number of times a vertex occurs in distinct "positions" of multiple small subgraphs. Graphlet degree distributions give a more robust "fingerprint" of a graph's structure which has in turn been used to uncover underlying domain knowledge [20]. They also have been used in network alignment [19], using the knowledge that two vertices are more likely to be mapped to one another if they occupy the same positions at similar frequencies. 2.2 Bounded Expansion The algorithms implemented in CONCUSS are designed to exploit bounded expansion net- work structure. While classes of bounded expansion can be characterized by their r-shallow minors [21] or their neighborhood complexities [27], we focus on the algorithmically relevant characterization using p-centered colorings [21]. (cid:73) Definition 2. A p-centered coloring of graph G is a vertex coloring such that every con- nected subgraph H has a unique color or uses at least p colors. The minimum size of a p-centered coloring of G is denoted χp(G). (cid:73) Proposition 1. function f, every graph G ∈ C satisfies χp(G) ≤ f(p) for all p ≥ 1. Intuitively, p-centered colorings identify overlapping, locally well-structured regions of the graph; being in a class of bounded expansion implies the graph can be covered by a small number of such regions. More specifically we note that by Definition 2, for any p-centered coloring φ of graph G, if there is a subgraph H for which φH uses fewer than p colors, then every subgraph of H has a vertex of unique color. This relates classes of bounded expansion to a much more restricted class of graphs described below. [21] A class of graphs C has bounded expansion if and only if for some 2.3 Centered Colorings and Treedepth (cid:73) Definition 3. A centered coloring of graph G is a vertex coloring such that every connected subgraph H has a vertex of unique color, called a center. The minimum number of colors needed for a centered coloring of G is its centered coloring number, denoted χcen(G). Note that a centered coloring is also proper, or else there would be a connected subgraph of size two with no center. Centered colorings are closely related to treedepth decompositions. (cid:73) Definition 4. A treedepth decomposition of a graph G is an injective mapping ψ : V (G) → V (F), where F is a rooted forest and uv ∈ E(G) =⇒ ψ(u) is an ancestor or descendant XX:4 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline of ψ(v). The depth of a treedepth decomposition is the height of F. The treedepth of G, denoted td(G) is the minimum depth of a treedepth decomposition of G. In other words, a treedepth decomposition arranges the vertices of G in such a way that no edge joins vertices from different branches of the tree. Given a centered coloring with k colors, we can generate a treedepth decomposition of depth at most k by choosing center v to be the root and recursing on the components of G\{v}, as detailed in Algorithm 1 (Appendix A). In this way, Definition 2 is equivalent to the fact that every small set of colors in a p-centered coloring induces components with small treedepth. CONCUSS 3 Broadly speaking, the algorithmic pipeline in CONCUSS executes four modules to count the number of isomorphisms of graph H in G. 1. Color: 2. Decompose: Find a (H + 1)-centered coloring of G. Compute a treedepth decomposition of the subgraph induced by each set of H colors. Using dynamic programming, count the isomorphisms in the treedepth decompositions. 3. Compute: 4. Combine: Combine the counts from previous step to get the total number of isomorphisms in G. In Appendix B, we briefly describe these modules and the algorithm engineering aspects considered as part of the implementation. Many of the subroutines in the modules can achieve the same high-level functionality with different implementation details, e.g., heuris- tics, data structures, etc. We draw particular attention to the following areas of algorithm engineering: (1) post-processing the p-centered coloring to merge color classes and reduce the coloring size (Color), (2) saving partial treedepth decompositions when enumerating sets of colors (Decompose), and (3) representing partial isomorphisms as bitvectors to enable fast checking of consistency (Compute). CONCUSS allows users to specify their choices for subroutines in a configuration file; for more details, see the CONCUSS source and documentation [24]. These alternatives are designated with teletype. We note that the four-stage algorithmic workflow (Color, Decompose, Compute, Combine) can be useful for solving problems other than subgraph isomorphism counting. In particular, this approach is amenable to problems in which local subsolutions can be effi- ciently computed on graphs of low treedepth and then combined to create a global solution. For such a problem, it is possible to reuse the Color and Decompose modules and simply replace the Compute and Combine modules with the appropriate alternatives. Dvořák et al. [12] proved that any problem expressible in first-order logic can be solved in this way, such as finding small dominating sets or small independent sets. Experimental Design 4 We conducted four experiments, one to answer each question posed in Section 1. The first two (Section 5) identify an "optimal" configuration for CONCUSS and test its scalability against an existing subgraph isomorphism counting algorithm. The other two experiments (Section 6) investigate ways in which properties of the coloring affect downstream compu- tation to guide future theoretical research. Michael P. O'Brien and Blair D. Sullivan XX:5 To compare the effects of varying multiple options, we normalize two measures a, b using a+b. This ratio will be close to 1 when a (cid:29) b and close to the difference to sum ratio, i.e., a−b −1 when b (cid:29) a. When comparing times, a positive ratio indicates b is faster than a. 4.1 Data Since the theoretical advantages of the algorithms implemented in CONCUSS rely on exploit- ing structure, it was necessary to ensure our input graphs belonged to classes of bounded expansion. Consequently, we chose three random graph models which asymptotically al- most surely produce classes of bounded expansion [10]: the stochastic block model (SB) [15] and the Chung-Lu model, with households (CLH) [3] and without (CL) [7]. The first two models both exhibit clustering commonly found in real-world networks; the CL model was included as a baseline. For each model, we selected configuration parameters known to pro- duce bounded expansion classes. In the CL and CLH models, we used a degree distribution with exponential decay and household size four; for SB we used .40 .30 .20 .10 − .50 .13 .05 − − .35 .11 − − − .45  as the probability matrix. For each model, three random instances with 1024 vertices and average degree 6 were generated. 4.2 Hardware The experiments were run on identical machines with four-core, 3.0 GHz Intel Xeon E5 v3 processors with a 10 MB cache and 64 GB of memory (4 × 16 GB). Each run of CONCUSS received dedicated resources to avoid interference from other processes. Engineering Evaluation 5 We first engineered the implementation of CONCUSS by testing different configurations against each other before evaluating its practicality via comparison with an existing algo- rithm. 5.1 Configuration Testing To measure the run times of various configurations, we created one configuration file for each combination of options described in Sections B.1 and B.4. For all possible pairings of random instances and configuration options we ran CONCUSS three times. In each run we counted the number of isomorphisms of P4; the particular motif did not vary because the dynamic programming algorithm has theoretically comparable run time for all motifs of the same size. The metrics of interest in each run were the number of colors used, the total elapsed time, and the time specifically spent in the Color module. To compare the performance between two implementations of a subroutine, we did a pairwise comparison between configurations in which all other subroutines were held constant. That is to say, to differentiate between A1 and A2, we would compare (A1, B1, C1) against (A2, B1, C1), (A1, B2, C1) against (A2, B2, C1), etc. Though there were minor variations across graph models, the effects of the different con- figuration options (Figure 1) were relatively consistent. Orienting the edges using Sandpiling XX:6 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline Figure 1 Average difference/sum ratio in coloring size (top), Color time (middle), and De- compose, Compute, and Combine time (bottom) between paired configuration options. Note the differing y-axes. (a) Chung-Lu + households (b) Stochastic block Figure 2 Distribution of time spent in the different submodules of the Color module. Results for the Chung-Lu model without households were comparable to those for the model with households. and Degeneracy led to comparable time and coloring sizes. Surprisingly, using DTFA, which is more prudent in augmenting edges, did not outperform TFA in either time or coloring size. We attribute this result to the fact that the average number of augmentation steps needed to reach a p-centered coloring was smaller while using TFA (2.9 vs. 4.8), indicating that it may be worth making "suboptimal" choices for the augmentations as long as it leads to a p-centered coloring sooner. The Low-degree coloring prioritization generally yielded fewer colors and a shorter run time than High-degree, while the more complicated DSATUR prioritization was somewhere in-between. Taken as a whole, the best coloring routine used Degeneracy orientation, TFA, and Low-degree prioritization. The general distribution of time spent within the Color module also did not vary much -0.100.1Coloring sizeCLHSBCL-1.001.0Color TimeHigh-DSATLow-DSATLow-HighSand-DgenTFA-DTFA-0.300.3Count TimeHigh-DSATLow-DSATLow-HighSand-DgenTFA-DTFAHigh-DSATLow-DSATLow-HighSand-DgenTFA-DTFA0.00.20.40.60.81.0Dgen,DTFA,DSATDgen,DTFA,HighDgen,DTFA,LowDgen,TFA,DSATDgen,TFA,HighDgen,TFA,LowSand,DTFA,DSATSand,DTFA,HighSand,DTFA,LowSand,TFA,DSATSand,TFA,HighSand,TFA,LowAugmentColorCheck tdOptimizeMerge0.00.20.40.60.81.0Dgen,DTFA,DSATDgen,DTFA,HighDgen,DTFA,LowDgen,TFA,DSATDgen,TFA,HighDgen,TFA,LowSand,DTFA,DSATSand,DTFA,HighSand,DTFA,LowSand,TFA,DSATSand,TFA,HighSand,TFA,LowAugmentColorCheck tdOptimizeMerge Michael P. O'Brien and Blair D. Sullivan XX:7 Figure 3 Relationship between number of Inclusion-exclusion. colors and total execution time using with the coloring configuration (Figure 2). Computing the augmentations and coloring the vertices took a very small fraction of the total run time; upwards of 80% of the time was spent ensuring merging color classes kept the coloring p-centered, with the pre-merge opti- mization consuming most of the rest of the time. Nearly all of the computation in these two post-processing routines is in deciding whether a smaller coloring is indeed p-centered. As such, small improvements to the efficiency of checking the treedepth of all color sets would pay large dividends in the overall time. Although the post-processing reduced the coloring size by at least 50% in 90% of the colorings and the total execution time correlated positively with coloring size (Figure 3), we cannot assess whether those optimizations were a net benefit without extrapolating beyond our observed data. Because the time spent merging is dependent on the coloring size, we believe there is a coloring size threshold below which the post-processing is worthwhile; it would be useful to empirically identify this threshold in future work. The effects of the configurations on the computation downstream from the coloring (Fig- ure 1) were weaker and more varied. In particular, we note that Low-degree prioritization often led to slower downstream computation, but this was offset by faster coloring times. The only configuration option varied outside of the Color module was the method of correcting double counting in the Combine module. We were once again surprised to see that Hybrid, the "intelligent" method of circumventing enumerating many additional color classes, was not successful at improving the run time over the naïve Inclusion-exclusion. To the contrary, Hybrid increased the total time of the Decompose, Compute, and Com- bine modules by at least a factor of two, getting up to a factor of ten when the number of colors was very large. We ultimately concluded the preferred configuration is Degeneracy, TFA, Low-degree, and Inclusion-exclusion. 5.2 Comparison with NXVF2 After determining the behavior of various configurations of CONCUSS, we wanted to assess its performance compared to algorithmic approaches that do not exploit bounded expansion structure. Recognizing that CONCUSS is a proof-of-concept of an algorithmic pipeline for classes of bounded expansion, we were primarily interested in establishing it has comparable run times to other algorithms and good scaling behavior; in future work, we hope to incor- porate additional theoretical advances into CONCUSS, i.e., those identified in Section 6, to 8090100110120130Colors25005000750010000125001500017500Time (s)SBCLHCL XX:8 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline increase its performance. To make a comparison in the same programming language, we selected the NetworkX [13] implementation of the popular VF2 algorithm [9], which we will refer to as NXVF2. Although there exists an updated version of this algorithm known as VF3 [6], the authors' publicly available implementation [1] only accepts graphs with 216 or fewer vertices, which is insufficient for the data sets described below. 5.2.1 Additional Data Because of the large p-centered coloring sizes of the Chung-Lu and stochastic block model graphs generated for the previous experiment, CONCUSS requires around 45 minutes to count in graphs where NXVF2 terminates in 1 second. We hypothesized, however, that in large graphs with small coloring sizes and many isomorphisms of H into G, CONCUSS would outperform NXVF2. We included the restriction on number of isomorphisms because the run time of CONCUSS does not depend on the count, while NXVF2 requires more time for each additional isomorphism. To test this hypothesis we generated graphs that met the criteria with the following procedure. First, we generated a complete binary tree of depth d. Then, we selected a tree vertex uniformly at random and attached to it the endpoint of a P'. We continued randomly selecting tree vertices with replacement and adding a P' for a total of s · 2d times. That is, we made sure that each tree vertex had an average of s P's as neighbors. We denote this graph Td,s,'.In this way, we could effectively vary the size of the graph and the number of isomorphisms of small stars and paths. ' s Figure 4 Td,s,'. d 5.2.2 Results We observed (Figure 5) that our hypothesis holds when counting stars in Td,s,' for sufficiently large s. In particular, CONCUSS has more than a fourteen-fold speed advantage over NXVF2 in counting S5s in T12,16,1. We believe the difference in time would diverge even more for counting S5s in T14,16,1, but NXVF2 already takes nearly 80 hours in T12,16,1. It is also important to note that when ' = 1, the number of paths does not increase in the same way that the number of stars increases. This is because every path of length at least four must contain multiple tree vertices, of which each tree vertex is adjacent to at most three. Moreover, Pn has exactly two automorphisms ("forwards" and "backwards") for every n, while Sn has (n−1)! automorphisms (any ordering of the leaves). We observed that there were insufficiently many P4s and P5s in Td,s,1 to see the same performance benefits, and NXVF2 was consistently faster than CONCUSS. As predicted, CONCUSS can outperform NXVF2 when counting in Td,s,4, which has many more P4s and P5s (Figure 9). Similar to the results shown in Figure 5 (Appendix C), CONCUSS counts P3s faster in all graph sizes, while the advantage in counting P5s is only realized in the largest graphs. Michael P. O'Brien and Blair D. Sullivan XX:9 Figure 5 Average difference/sum ratio between CONCUSS and NXVF2 on Td,s,1 as a function of s, the average number of P1s per tree vertex. Each small plot shows a fixed motif and value of d. Negative ratios indicate CONCUSS is faster. 6 Bottleneck Identification Having identified configurations and graph instances in which CONCUSS outperforms NXVF2, we proceeded to identify bottlenecks in CONCUSS that ought to receive further theoretical consideration. We focused on how changing properties of the output of the Color module would influence performance in the other three modules. 6.1 Color Class Distribution Because a graph may admit many distinct p-centered colorings of small size, it is important to know whether two colorings of the same size lead to observable differences in the down- stream computation. Though the effects the coloring has on the rest of the pipeline almost certainly depend on complex and subtle interactions, we hypothesized that the distribution of sizes of color classes is an important factor. The intuition behind this hypothesis is that different distributions in sizes will lead to different "shapes" of treedepth decompositions, i.e., one large, wide decomposition vs. many small, thin decompositions. To test it, we created colorings of equal size that have unequal distributions of color class sizes. The stochastic block and Chung-Lu with households graphs described previously were used again as inputs for this experiment; we excluded the Chung-Lu graphs without house- holds due to their long run times. For each graph instance, we found the largest coloring from the configuration experiment, then iteratively split in half the existing color classes (Figure 6) in colorings generated by the other configurations until all colorings had the same 1.00.50.00.51.0d=10d=12d=141.00.50.00.51.014s=161.00.50.00.51.01/414s=161/161/41s=4s2d210212214216 XX:10 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline min max med Figure 6 Creating a new color class (black) using the three splitting heuristics (min, med, max). size. To vary the distributions of color class sizes, we used three splitting heuristics: max, med, and min, which target the maximum-, median-, and minimum-sized color classes2. When splitting color classes, we chose a random subset of vertices to move into the new color class; to account for this randomness, we repeated each splitting heuristic three times for each coloring. We ran the Decompose, Compute, and Combine modules of CONCUSS three times for each graph instance and associated new coloring, using Inclusion-Exclusion in the Combine module. We observed (Table 1) that max led to the fastest performance, while med and min had very similar run times. The dynamic programming algorithm counts isomorphisms from the leaves of the treedepth decomposition upwards using two operations: forgetting, which moves from children to their parent, and joining which combines results from "siblings" (vertices with the same parent). Since siblings often belong to the same color class, ensuring that no color class has too many vertices limits the number of children, which in turn limits the number of joins. In Table 1, we report that when using max the average number of joins was 33% lower than when splitting the median or minimum-sized classes. Thus future coloring algorithms should attempt to make the sizes of the color classes more uniform. Model Method Avg time (s) 856 +19% +20% 1327 +21% +21% SB SB SB CLH CLH CLH max med min max med min Joins 5.12 × 105 +48% +49% 7.63 × 105 +48% +50% Forgets 2.00 × 108 +13% +13% 3.01 × 108 +4% +5% Table 1 Average run time and dynamic programming operations used for each color splitting heuristic. The statistics for med and min are reported as percent increases over max. 6.2 Color Set Treedepth The dynamic programming (DP) in the Compute module counts isomorphisms of a sub- graph of size h in an arbitrary treedepth decomposition of depth t. While this algorithm runs in linear time with respect to the size of the graph, it takes O(th) time with respect to t. One potential direction for further theoretical improvements to the bounded expansion pipeline is to find alternatives to p-centered colorings in which subgraphs with at most i < p colors have treedepth that is small but greater than i. Ideally, relaxing treedepth require- ment would result in a significant reduction in the size of the coloring without dramatically increasing the time spent in DP in the Compute module. Though we cannot measure the 2 Color classes with exactly one vertex were ignored for calculating the minimum and median sizes. Michael P. O'Brien and Blair D. Sullivan XX:11 size of a hypothetical coloring, we can evaluate how the time per DP operation increases as we count the same subgraph in larger treedepth decompositions. To do this, we computed a 6-centered coloring, enumerated sets of 3, 4, and 5 colors, and counted the number of isomorphisms of P3 in each set. The run time of the DP algorithm is only dependent on the treedepth of the decomposi- tions insofar as it increases the number of labelings3 of the ancestors of each vertex. There are t3 + 3t2 + t such labelings for a P3, each of which requires a constant number of DP operations, so the amount of time spent counting in one color set should grow proportionally to this function. Figure 7 Observed vs. predicted average execution time per operation in the stochastic block graphs. Results for the graphs from the CL models are similar and are omitted for space. We only include those operations incurred in counting in color sets of exactly t colors. Model t CL CL CL CLH CLH CLH SB SB SB 3 4 5 3 4 5 3 4 5 leaf Time per 7.5 × 10−7 7.7 × 10−7 7.9 × 10−7 8.0 × 10−7 8.0 × 10−7 8.1 × 10−7 8.1 × 10−7 7.9 × 10−7 8.0 × 10−7 join Time per 7.3 × 10−7 8.1 × 10−7 9.0 × 10−7 7.4 × 10−7 8.1 × 10−7 9.3 × 10−7 7.3 × 10−7 7.9 × 10−7 8.5 × 10−7 forget Time per 1.4 × 10−6 1.7 × 10−6 2.0 × 10−6 1.4 × 10−6 1.7 × 10−6 2.1 × 10−6 1.4 × 10−6 1.5 × 10−6 1.8 × 10−6 Avg. depth 2.0 2.4 2.8 2.0 2.4 2.8 1.9 2.3 2.7 Table 2 Average execution time per operation and average depth of vertices in the treedepth decomposition. Rows for treedepth t only include those operations incurred in counting in color sets of exactly t colors. To compare our observations to the predicted growth of t3 +3t2 + t, we assumed that the average time per operation for t = 3 aligned correctly with this theoretical time and extrap- olated outwards for t ∈ {4, 5}. As reported in Figure 7, the observed times grow significantly slower than predicted for all operations. The time spent on each operation is dependent on the depth of the vertex in the treedepth decomposition, but the average depth of vertices does not grow at a one-to-one ratio with the treedepth (Table 2). This means that the ad- ditional color classes add vertices at many depths of the decomposition, rather that simply 3 These are the k-patterns mentioned in Appendix B.3; see [10]. 345Treedepth12345Time (s)1e6Leaf (observed)Leaf (predicted)Join (observed)Join (predicted)Forget (observed)Forget (predicted) XX:12 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline increasing the depth of every branch uniformly, and thus we seldom "pay" for the cost of the larger depths. Consequently, we conclude that colorings producing deeper decompositions with fewer colors ought to be a viable strategy for improving the overall speed of CONCUSS. Conclusion 7 We demonstrated that exploiting bounded expansion structure is a promising methodology for scaling subgraph isomorphism counting to larger classes of sparse graphs. We identified through testing various configurations of CONCUSS that orienting with a degeneracy order- ing, augmenting with TFA, coloring low-degree vertices first, and combining counts using the inclusion-exclusion principle led to fast run times and small colorings. On sufficiently sparse graphs with high isomorphism counts, CONCUSS was able to significantly outperform NXVF2. In order to get the bounded expansion pipeline to outperform other methods in a broader set of graphs, it is important to understand in future work whether the large color- ing sizes of the random graph models were an artifact of the heuristics used in generating the p-centered colorings, or whether their asymptotically bounded values are actually large. Moreover, reimplementing CONCUSS in a lower-level language like C++ would allow us to make meaningful comparisons to other C++ implementations, e.g., the RI algorithm in [17]. Our experiments also identified three areas for future theoretical research. The first is to reduce the time needed to verify a coloring is p-centered, which would yield large dividends in the Color module. The second is to design p-centered coloring algorithms that balance the sizes of the color classes, consequently reducing the number of join operations. Finally, our results suggest using colorings that trade fewer colors for larger treedepth per color set could be faster than using p-centered colorings. Acknowledgments This work was supported in part by the DARPA GRAPHS Program and the Gordon & Betty Moore Foundation's Data-Driven Discovery Initiative through Grants SPAWAR-N66001-14-1-4063 and GBMF4560 to Blair D. Sullivan. References 1 VF3. http://mivia.unisa.it/datasets-request/. 2 P. Bak et al. Self-organized criticality: An explanation of the 1/f noise. PRL, 59(4):381, 1987. F. Ball et al. Threshold behaviour and final outcome of an epidemic on a random network with household structure. Advances in Applied Probability, 41(3):765–796, 2009. 3 4 V. Bonnici, R. Giugno, A. Pulvirenti, D. Shasha, and A. Ferro. A subgraph isomorphism algorithm and its application to biochemical data. BMC bioinformatics, 14(7):S13, 2013. 5 D. Brélaz. New methods to color the vertices of a graph. CACM, 22(4):251–256, 1979. 6 V. Carletti, P. Foggia, A. Saggese, and M. Vento. Introducing vf3: A new algorithm for In International Workshop on Graph-Based Representations in subgraph isomorphism. Pattern Recognition, pages 128–139. Springer, 2017. F. Chung and L. Lu. The average distances in random graphs with given expected degrees. PNAS, 99(25):15879–15882, 2002. L. P. Cordella et al. Performance evaluation of the vf graph matching algorithm. In Image Analysis and Processing, pages 1172–1177. IEEE, 1999. L. P. Cordella et al. A (sub) graph isomorphism algorithm for matching large graphs. Pattern Analysis and Machine Intelligence, 26(10):1367–1372, 2004. 7 8 9 Michael P. O'Brien and Blair D. Sullivan XX:13 10 11 12 E. D. Demaine et al. Structural sparsity of complex networks: Random graph models and linear algorithms. CoRR, abs/1406.2587, 2015. Z. Dvořák et al. Algorithms for classes of graphs with bounded expansion. Theoretic Concepts in Computer Science, pages 17–32. Springer, 2009. Z. Dvořák et al. Testing first-order properties for subclasses of sparse graphs. JACM, 60(5):36:1–36:24, October 2013. In Graph- 13 A. A. Hagberg et al. Exploring network structure, dynamics, and function using NetworkX. In SciPy2008, pages 11–15, Pasadena, CA USA, August 2008. 14 H. He and A. K. Singh. Graphs-at-a-time: query language and access methods for graph databases. In SIGMOD, pages 405–418. ACM, 2008. P. W. Holland et al. Stochastic blockmodels: First steps. Social networks, 5(2):109–137, 1983. 16 M. Jerrum and K. Meeks. The parameterised complexity of counting connected subgraphs. CoRR, abs/1308.1575, 2013. Jure Leskovec and Rok Sosič. Snap: A general-purpose network analysis and graph-mining library. ACM Transactions on Intelligent Systems and Technology (TIST), 8(1):1, 2016. 15 17 18 D. W. Matula and L. L. Beck. Smallest-last ordering and clustering and graph coloring algorithms. JACM, 30(3):417–427, 1983. 19 T. Milenkovic et al. Optimal network alignment with graphlet degree vectors. Cancer informatics, 9:121, 2010. 20 T. Milenkovic and N. Pržulj. Uncovering biological network function via graphlet degree signatures. Cancer informatics, 6:257, 2008. J. Nešetřil and P. Ossona de Mendez. Grad and classes with bounded expansion i. decom- positions. European Journal of Combinatorics, 29(3):760 – 776, 2008. J. Nešetřil and P. Ossona de Mendez. Grad and classes with bounded expansion ii. algo- rithmic aspects. European Journal of Combinatorics, 29(3):777 – 791, 2008. J. Nešetřil and P. Ossona de Mendez. Grad and classes with bounded expansion iii. re- stricted graph homomorphism dualities. European Journal of Combinatorics, 29(4):1012 – 1024, 2008. Homomorphisms: Structure and Highlights. 21 22 23 26 27 29 30 31 24 M. P. O'Brien et al. CONCUSS, v2.0. http://dx.doi.org/10.5281/zenodo.30281, June 2016. 25 N. Pržulj. Biological network comparison using graphlet degree distribution. Bioinformat- ics, 23(2):e177–e183, 2007. F. Reidl. Structural sparseness and complex networks. Dr., Aachen, Techn. Hochsch., Aachen, 2015. Aachen, Techn. Hochsch., Diss., 2015. F. Reidl et al. Characterising bounded expansion by neighbourhood complexity. CoRR, abs/1603.09532, 2016. 28 H. Shang et al. Taming verification hardness: an efficient algorithm for testing subgraph isomorphism. PVLDB, 1(1):364–375, 2008. S. S. Shen-Orr et al. Network motifs in the transcriptional regulation network of escherichia coli. Nature genetics, 31(1):64–68, 2002. Z. Sun et al. Efficient subgraph matching on billion node graphs. PVLDB, 5(9):788–799, 2012. J. R. Ullmann. An algorithm for subgraph isomorphism. JACM, 23(1):31–42, 1976. XX:14 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline A Computing Treedepth Decompositions Algorithm 1 Treedepth decomposition implied by centered coloring φ ← centered coloring of G T ← treedepth decomposition of G if G = 0 then return end if v ← center(φG) root(T) ← v for all components C ∈ G\{v} do T 0 ← treedepth decomposition of C implied by φC parent(root(T 0)) ← v end for Algorithmic Description of CONCUSS B B.1 Color Algorithm 2 Sketch of p-centered coloring G0 ← G repeat Orient the edges of G0 to make it a directed acyclic graph of low indegree Augment G0 with additional edges based on their orientation Color the vertices greedily Check whether each set of vertices with p − 1 colors has low treedepth in G until the coloring is p-centered The workflow in the Color module is outlined in Algorithm 2. The objective is to produce a p-centered coloring by greedily coloring the vertices of the graph. Because a simple greedy coloring may not immediately be p-centered, additional edges are added to the graph to impose further constraints. After a bounded number of iterations of the loop in Algorithm 2, a greedy coloring is guaranteed to be p-centered [21, 23, 26]. Since each substep runs in linear time with respect to G, the entire Color module also runs in linear time. Orient: The later stages of the Color module operate on directed acyclic graphs. In essence, directed edges capture the ancestor relationships in treedepth decompositions of small sets of colors by having edges point from an ancestor to its descendants. In this repre- sentation, vertices with large indegree have many ancestors, indicating subgraphs with large treedepth. A low-indegree orientation can be found either with a Degeneracy ordering [18] or by Sandpiling [2]. Augment: After the edges are oriented, additional directed edges are augmented to the graph to impose more constraints. The placement of the augmenting edges is dependent on the direction of edges in the orientation. Two vertices a, b are said to be transitive if there is some vertex c such that ac and cb are both directed edges in the graph, while a, b are said to be fraternal if there is a vertex c such that ac and bc are both directed edges. Michael P. O'Brien and Blair D. Sullivan XX:15 The transitive-fraternal augmentation (TFA) algorithm [22] adds the edge ab for every pair of transitive vertices a, b and either the edge xy or yx for every pair of fraternal vertices x, y. The orientation of edges between fraternal vertices is chosen to preserve acyclicity and minimize indegree. Distance-truncated transitive fraternal augmentation (DTFA) [26] works similarly, but only requires that some transitive and fraternal edges are added. If ac was added in the ith iteration4 of the loop in Algorithm 2 and cb was added in the jth, the edge ab need not be added until the (i + j)th iteration. Color: The acyclic orientation of the edges defines an ordering over which to greedily color the vertices. To minimize the number of colors, CONCUSS uses of one of three different heuristics: prioritizing high-degree vertices (High-degree), prioritizing low-degree vertices (Low-degree), or prioritizing vertices with many colors already represented among their neighbors (DSATUR) [5]. Check: Finally, we check whether the coloring is p-centered by testing whether each connected subgraph that uses p − 1 or fewer colors has a unique color. This can be done by keeping track of components and their respective color multiplicities using union-find structures; when two components merge, we ensure that that there is still a unique color. We perform this check at every iteration in order to prevent the algorithm from adding any more colors than necessary. Other Optimizations: We include additional pre- and post-processing steps to obtain smaller colorings. Vertices of high degree can cause many additional edges to be augmented at each iteration of the loop, which in turn causes more colors to be used. For this reason, removing all high-degree vertices, e.g., degree at least 4√ n, finding a coloring of the smaller graph, and then giving each removed vertex a new unique color can reduce the total number of colors. Likewise, in any component of size larger than two, vertices of degree one can be removed and all given the same color in post-processing. After obtaining a p-centered coloring, we can also potentially reduce the number of colors by randomly adding transitive and fraternal edges, computing a new greedy coloring, and seeing if this greedy coloring is p-centered. The final post-processing step is to check whether pairs of color classes can be merged without violating the p-centered property. B.2 Decompose After the coloring is computed, CONCUSS finds the components induced by each set of H colors. To save computation, CONCUSS processes overlapping color sets sequentially in a depth-first search manner. For example, if H = 4 and the coloring has 9 colors, the sets would be processed as: . . . , {1, 2, 3}, {1, 2, 3, 4}, {1, 2, 3, 5}, . . . , {1, 2, 3, 9}, {1, 2, 4}, {1, 2, 4, 5}, etc. When processing color set {1, 2, 3, 4}, the components from {1, 2, 3} are saved to be reused for {1, 2, 3, 5}. Given a component induced by a particular color set, a treedepth decomposition is cre- ated using Algorithm 1. In order to save memory, these treedepth decompositions are fed into the subsequent Count and Compute stages before a new color set is processed. B.3 Compute The Compute module uses the dynamic programming algorithm of Demaine et al. [10] to count the isomorphisms of H in a treedepth decomposition. It has exponential time de- pendence on the small treedepth, but runs in linear time with respect to G. Briefly, this 4 Edges present originally in G are considered to have been added in the 1st iteration. XX:16 An Experimental Evaluation of a Bounded Expansion Algorithmic Pipeline algorithm exploits the fact that no edges in the treedepth decomposition join vertices in different branches. Therefore, partial pieces of H in one subtree have limited ways of inter- acting with those in other subtrees. By tracking which pieces occur in each subtree, these counts of partial pieces can be combined to count all isomorphisms in the decomposition. Integral to the dynamic programming are k-patterns, also called boundaried graphs. These (sub)graphs have a subset of vertices labeled uniquely with integers on the interval [1, k], which in turn determine how partial pieces of H can "glue" together. We store the k- pattern labelings as bitvectors to enable fast checking of whether two patterns are compatible to be "glued", i.e., their labelings are consistent with one another. B.4 Combine The goal in the Combine module is to sum the counts from each treedepth decomposition to get the count for the whole graph. However, because the color sets contain overlapping subgraphs, a simple summation of counts may count some isomorphisms more than once. For example, if H = P4, the subgraph in Figure 8 will be counted in the color sets {blue, orange, purple, yellow}, {blue, orange, purple, green}, etc. There are multiple ways to rectify Figure 8 The highlighted P4 only uses three colors and thus will be counted in multiple color sets of size four. this issue. Inclusion-exclusion simply enumerates all color sets with fewer than H colors, counts the isomorphisms in those subgraphs, and then applies the inclusion-exclusion principle to correct the counts appropriately. We can also incorporate the combinations into the dynamic programming itself by ignoring counts of color sets that have already been seen (Hybrid). Michael P. O'Brien and Blair D. Sullivan XX:17 C Additional Figures Figure 9 Average difference/sum ratio between CONCUSS and NXVF2 on Td,s,4 as a function of s, the average number of P4s per tree vertex. Each small plot shows a fixed motif and value of d. Negative ratios indicate CONCUSS is faster. 1.00.50.00.51.0d=10d=12d=141.00.50.00.51.014s=161.00.50.00.51.01/414s=161/161/41s=4s2d210212214216
1606.04763
3
1606
2018-09-25T11:52:39
A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching
[ "cs.DS" ]
The pattern matching problem with swaps is to find all occurrences of a pattern in a text while allowing the pattern to swap adjacent symbols. The goal is to design fast matching algorithm that takes advantage of the bit parallelism of bitwise machine instructions and has only streaming access to the input. We introduce a new approach to solve this problem based on the graph theoretic model and compare its performance to previously known algorithms. We also show that an approach using deterministic finite automata cannot achieve similarly efficient algorithms. Furthermore, we describe a fatal flaw in some of the previously published algorithms based on the same model. Finally, we provide experimental evaluation of our algorithm on real-world data.
cs.DS
cs
A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching⋆ V´aclav Blazej⋆⋆, Ondrej Such´y⋆ ⋆ ⋆, and Tom´as Valla† Faculty of Information Technology, Czech Technical University in Prague, Prague, Czech Republic Abstract. The pattern matching problem with swaps is to find all occur- rences of a pattern in a text while allowing the pattern to swap adjacent symbols. The goal is to design fast matching algorithm that takes advan- tage of the bit parallelism of bitwise machine instructions and has only streaming access to the input. We introduce a new approach to solve this problem based on the graph theoretic model and compare its perfor- mance to previously known algorithms. We also show that an approach using deterministic finite automata cannot achieve similarly efficient al- gorithms. Furthermore, we describe a fatal flaw in some of the previously published algorithms based on the same model. Finally, we provide ex- perimental evaluation of our algorithm on real-world data. 1 Introduction In the Pattern Matching problem with Swaps (Swap Matching, for short), the goal is to find all occurrences of any swapped version of a pattern P in a text T , where P and T are strings of length p and t over an alphabet Σ, respectively. By the swapped version of a pattern P we mean a string of symbols created from P by swapping adjacent symbols while ensuring that each symbol is swapped at most once (see Section 2 for formal definitions). The solution of Swap Match- ing is a set of indices which represent where occurrences swapped version of P in T begin. Swap Matching is intensively studied due to its use in practical ap- plications such as text and music retrieval, data mining, network security and biological computing [7]. The swap of two consecutive symbols is one of the most typical typing errors. It also represent a simpler version of swaps that appear in nature. In particular, ⋆ An extended abstract of this work appeared in the Proceedings of the 7th Interna- tional Conference on Mathematical Aspects of Computer and Information Sciences, MACIS 2017 [8]. ⋆⋆ Supported OP VVV by the project CZ.02.1.01/0.0/0.0/16 019/0000765 "Research Center for Informatics" and by the SGS CTU project SGS17/209/OHK3/3T/18. funded MEYS ⋆ ⋆ ⋆ Supported by grant 17-20065S of the Czech Science Foundation. † Supported by the Centre of Excellence -- Inst. for Theor. Comp. Sci. 79 (project P202/12/G061 of the Czech Science Foundation.) 2 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla the phenomenon of swaps occurs in gene mutations and duplications such as in the region of human chromosome 5 that is implicated in the disease called spinal muscular Atrophy, a common recessive form of muscular dystrophy [18]. While the biological swaps occur at a gene level and have several additional constraints and characteristics, which make the problem much more difficult, they do serve as a convincing pointer to the theoretical study of swaps as a natural edit operation for the approximation metric [2]. Indeed Lowrance and Wagner [21] suggested to add the swap operation when considering the edit distance of two strings. 1 Swap Matching was introduced in 1995 as an open problem in non-standard string matching [20]. The first result was reported by Amir et al. [2] in 1997, 3 log p)-time solution for alphabets of size 2, while also who provided an O(tp showing that alphabets of size exceeding 2 can be reduced to size 2 with a little overhead. Amir et al. [5] came up with solution with O(t log2 p) time complexity for some very restrictive cases. Several years later Amir et al. [3] showed that Swap Matching can be solved by an algorithm for the overlap matching achieving the running time of O(t log p log Σ). This algorithm as well as all the previous ones is based on fast Fourier transformation (FFT). In 2008 Iliopoulos and Rahman [17] introduced a new graph theoretic ap- proach to model the Swap Matching problem and came up with the first efficient solution to Swap Matching without using FFT (we show it to be incorrect). Their algorithm based on bit parallelism runs in O((t + p) log p) time if the pattern length is similar to the word-size of the target machine. One year later Cantone and Faro [10] presented a dynamic programming algorithm named Cross Sam- pling solving Swap Matching in O(t) time and O(Σ) space, assuming that the pattern length is similar to the word-size in the target machine. In the same year Campanelli et al. [9] enhanced the Cross Sampling algorithm using notions from Backward directed acyclic word graph matching algorithm and named the new algorithm Backward Cross Sampling. This algorithm also assumes short pattern length. Although Backward Cross Sampling has O(Σ) space and O(tp) time complexity, which is worse than that of Cross Sampling, it improves the real-world performance. In 2013 Faro [14] presented a new model to solve Swap Matching using re- active automata and also presented a new algorithm with O(t) time complexity assuming short patterns. The same year Chedid [12] reformulated the dynamic programming solution by Cantone and Faro [10] which results in more intuitive algorithms. In 2014 a minor improvement by Fredriksson and Giaquinta [15] ap- peared, yielding slightly (at most factor Σ) better asymptotic time complexity (and also slightly worse space complexity) for special cases of patterns. The same year Ahmed et al. [1] took ideas of the algorithm by Iliopoulos and Rahman [17] and devised two algorithms named Smalgo-I and Smalgo-II which both run in O(t) for short patterns, but bear the same error as the original algorithm. Another remarkable effort related to Swap Matching is to actually count the number of swaps needed to match the pattern at the location [6]. This is more often studied with an extra operation of character change allowed [4,13,19]. A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 3 Our Contribution. We design a simple algorithm which solves the Swap Matching problem. The goal is to design a streaming algorithm, which is given one symbol per each execution step until the end-of-input arrives, and thus does not need access to the whole input. This algorithm has O(⌈ p w ⌉(Σ + t) + p) time and O(⌈ p w ⌉Σ) space complexity where w is the word-size of the machine. We would like to stress that our solution, as based on the graph theoretic ap- proach, does not use FFT. Therefore, it yields a much simpler non-recursive algorithm allowing bit parallelism and is not suffering from the disadvantages of the convolution-based methods. While our algorithm matches the best asymp- totic complexity bounds of the previous results [10,15] (up to a Σ factor), we believe that its strength lies in the applications where the alphabet is small and the pattern length is at most the word-size, as it can be implemented using only 7 + Σ CPU registers and few machine instructions. This makes it practical for tasks like DNA sequences scanning. Also, as far as we know, our algorithm is currently the only known streaming algorithm for the swap matching problem. We continue by proving that any deterministic finite automaton that solves Swap Matching has number of states exponential in the length of the pattern. We also describe the Smalgo (swap matching algorithm) by Iliopoulos and Rahman [17] in detail. Unfortunately, we have discovered that Smalgo and derived algorithms contain a flaw which cause false positives to appear. We have prepared implementations of Smalgo-I, Cross Sampling, Backward Cross Sampling and our own algorithm, measured the running times and the rate of false positives for the Smalgo-I algorithm. All of the sources are available for download.1 This paper is organized as follows. First we introduce all the basic definitions, and also recall the graph theoretic model introduced in [17] and its use for matching in Section 2. In Section 3 we show our algorithm for Swap Matching problem and follow it in Section 4 with the proof that Swap Matching cannot be solved efficiently by deterministic finite automata. Then we describe the Smalgo algorithms in detail in Section 5 and finish with the experimental evaluation of the algorithms in Section 6. 2 Basic Definitions and the Graph Theoretic Model In this section we state the basic definitions, present the graph theoretic model and show a basic algorithm that solves Swap Matching using the model. 2.1 Notations and Basic Definitions We use the word-RAM as our computational model. That means we have access to memory cells of fixed capacity w (e.g., 64 bits). A standard set of arithmetic and bitwise instructions include And (&), Or (), Left bitwise-shift (LShift or ≪ 1) and Right bitwise-shift (RShift or ≫ 1). Each of the standard operations on 1 http://users.fit.cvut.cz/blazeva1/gsm.html 4 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla 1 −1 ✚ 0 1 a b 2 a b c 3 b c b 4 c b b 5 b b a 6 b a c 7 a c ✚ Fig. 1. P -graph PP for the pattern P = abcbbac words takes single unit of time. In order to compare to other existing algorithms, which are not streaming, we define the access to the input in a less restrictive way -- the input is read from a read-only part of memory and the output is written to a write-only part of memory. However, it will be easy to observe that our algorithm accesses the input sequentially. We do not include the input and the output into the space complexity analysis. A string S over an alphabet Σ is a finite sequence of symbols from Σ and S is its length. By Si we mean the i-th symbol of S and we define a substring S[i,j] = SiSi+1 . . . Sj for 1 ≤ i ≤ j ≤ S, and prefix S[1,i] for 1 ≤ i ≤ S. String P prefix matches string T k symbols on position i if P[1,k] = T[i,i+k−1]. Next we formally introduce a swapped version of a string. Definition 1 (Campanelli et al. [9]). A swap permutation for S is a permu- tation π : {1, . . . , n} → {1, . . . , n}, where n = S, such that: (i) if π(i) = j then π(j) = i (symbols at positions i and j are swapped), (ii) for all i, π(i) ∈ {i − 1, i, i + 1} (only adjacent symbols are swapped), (iii) if π(i) 6= i then Sπ(i) 6= Si (identical symbols are not swapped). For a string S a swapped version π(S) is a string π(S) = Sπ(1)Sπ(2) . . . Sπ(n) where π is a swap permutation for S. Now we formalize the version of matching we are interested in. Definition 2. Given a text T = T1T2 . . . Tt and a pattern P = P1P2 . . . Pp, the pattern P is said to swap match T at location i if there exists a swapped version π(P ) of P that matches T at location i, i.e., π(P ) = T[i,i+p−1]. 2.2 A Graph Theoretic Model The algorithms in this paper are based on a model introduced by Iliopoulos and Rahman [17]. In this section we briefly describe this model. For a pattern P of length p we construct a labeled graph PP = (V, E, σ) with vertices V , edges E, and a vertex labeling function σ : V → Σ (see Fig. 1 for an example). Let V = V ′ \ {m−1,1, m1,p} where V ′ = {mr,c r ∈ {−1, 0, 1}, c ∈ A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 5 Algorithm 1 The basic matching algorithm (BMA) Input: Labeled directed acyclic graph G = (V, E, σ), set Q0 ⊆ V of starting vertices, set F ⊆ V of accepting vertices, text T , and position k. 1 := Q0. 1: Let D′ 2: for i = 1, 2, 3, . . . , p do 3: 4: 5: 6: i, σ(x) = Tk+i−1}. Let Di := {x x ∈ D′ if Di = ∅ then finish. if Di ∩ F 6= ∅ then we have found a match and finish. Define the next iteration set D′ D′ i+1 := {d ∈ V (PP ) (v, d) ∈ E(PP ) for some v ∈ Di}. i+1 as vertices which are successors of Di, i.e., {1, 2, . . . , p}}. For mr,c ∈ V we set σ(mr,c) = Pr+c. Each vertex mr,c is identified with an element of a 3 × p grid. We set E′ := E′ p−1, where E′ j := {(mk,j, mi,j+1) k ∈ {−1, 0}, i ∈ {0, 1}} ∪ {(m1,j, m−1,j+1)}, and let E = E′ ∩ V × V . We call PP the P -graph. Note that PP is directed acyclic graph, V (PP ) = 3p − 2, and E(PP ) = 5(p − 1) − 4. 2 ∪ · · · ∪ E′ 1 ∪ E′ The idea behind the construction of PP is as follows. We create vertices V ′ and edges E′ which represent every swap pattern without unnecessary restric- tions (equal symbols can be swapped). We remove vertices m−1,1 and m1,p which represent symbols from invalid indices 0 and p + 1. The P -graph now represents all possible swap permutations of the pattern P in the following sense. Vertices m0,j represent ends of prefixes of swapped version of the pattern which end by a non-swapped symbol. Possible swap of symbols Pj and Pj+1 is represented by vertices m1,j and m−1,j+1. Edges represent symbols which can be consecutive. Each path from column 1 to column p represents a swap pattern and each swap pattern is represented this way. Definition 3. For a given Σ-labeled directed acyclic graph G = (V, E, σ) ver- tices s, e ∈ V and a directed path f = v1, v2, . . . , vk from v1 = s to vk = e, we call S = σ(f ) = σ(v1)σ(v2) . . . σ(vk) ∈ Σ∗ a path string of f . 2.3 Using Graph Theoretic Model for Matching In this section we describe an algorithm called Basic Matching Algorithm (BMA) which can determine whether there is a match of pattern P in text T on a position k using any graph model which satisfies the following conditions. -- It is a directed acyclic graph, -- V = V1 ⊎ V2 ⊎ · · · ⊎ Vp (we can divide vertices to columns), -- E ⊆ {(u, w) u ∈ Vi, w ∈ Vi+1, 1 ≤ i < p} (edges lead to next column). Let Q0 = V1 be the starting vertices and F = Vp be the accepting vertices. BMA is designed to run on any graph which satisfies these conditions. Since P -graph satisfies these assumptions we can use BMA for PP . The algorithm runs as follows (see also Algorithm 1). We initialize the algo- 1 now holds information about vertices 1 := Q0 (Step 1). D′ rithm by setting D′ 6 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Algorithm 2 BMA in terms of prefix match signals 1: Let I 0(v) := 1 for each v ∈ Q0 and I 0(v) := 0 for each v /∈ Q0. 2: for i = 0, 1, 2, 3, . . . , p − 1 do 3: 4: 5: 6: Filter signals by a symbol Tk+i. if I i(v) = 0 for every v ∈ PP then finish. if I i(v) = 1 for any v ∈ F then we have found a match and finish. Propagate signals along the edges. which are the end of some path f starting in Q0 for which σ(f ) possibly prefix matches 1 symbol of T[k,k+p−1]. To make sure that the path f represents a pre- fix match we need to check whether the label of the last vertex of the path f matches the symbol Tk (Step 3). If no prefix match is left we did not find a match (Step 4). If some prefix match is left we need to check whether we already have a complete match (Step 5). If the algorithm did not stop it means that we have some prefix match but it is not a complete match yet. Therefore we can try to extend this prefix match by one symbol (Step 6) and check whether it is a valid prefix match (Step 3). Since we extend the matched prefix in each step, we repeat these steps until the prefix match is as long as the pattern (Step 2). Having vertices in sets is not handy for computing so we present another way to describe this algorithm. We use their characteristic vectors instead. Definition 4. A Boolean labeling function I : V → {0, 1} of vertices of PP is called a prefix match signal. The algorithm can be easily divided into iterations according to the value of i in Step 2. We denote the value of the prefix match signal in j-th iteration as I j and we define the following operations: -- propagate signal along the edges, is an operation which sets I j(v) := 1 if and only if there exists an edge (u, v) ∈ E with I j−1(u) = 1, -- filter signal by a symbol x ∈ Σ, is an operation which sets I (v) := 0 for each v where σ(v) 6= x, -- match check, is an operation which checks whether there exists v ∈ F such that I(v) = 1 and if so reports a match. With these definitions in hand we can describe BMA in terms of prefix match signals as Algorithm 2. See Fig. 2 for an example of use of BMA to figure out whether P = acbab swap matches T = babcabc at a position 2. 2.4 Shift-And Algorithm The following description is based on [11, Chapter 5] describing the Shift-Or algorithm. For a pattern P and a text T of length p and t, respectively, let R be a bit array of size p and Rj its value after text symbol Tj has been processed. It contains information about all matches of prefixes of P that end at the position j A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 7 a b5 a c b2 c3 b a b a4 b a1 c Fig. 2. BMA of T[2,6] = abcab on a P -graph of the pattern P = acbab. The prefix match signal propagates along the dashed edges. Index j above a vertex v represent that I j(v) = 1, otherwise I j(v) = 0. in the text. For 1 ≤ i ≤ p, Rj i = 1 if P[1,i] = T[j−i+1,j] and 0 otherwise. The vector Rj+1 can be computed from Rj as follows. For each positive i we have Rj+1 i+1 = 0 otherwise. Furthermore, Rj+1 p = 1 then a complete match can be reported. i+1 = 1 if Rj 1 = 1 if P1 = Tj+1 and 0 otherwise. If Rj+1 i = 1 and Pi+1 = Tj+1, and Rj+1 The transition from Rj to Rj+1 can be computed very fast as follows. For each x ∈ Σ let Dx be a bit array of size p such that for 1 ≤ i ≤ p, Dx i = 1 if and only if Pi = x. The array Dx denotes the positions of the symbol x in the pattern P . Each Dx can be preprocessed before the search. The computation of Rj+1 is then reduced to three bitwise operations, namely Rj+1 = (LShift(Rj) 1) & DTj+1 . When Rj p = 1, the algorithm reports a match on a position j − p + 1. 3 Our Algorithm In this section we will show an algorithm which solves Swap Matching. We call the algorithm GSM (Graph Swap Matching). GSM uses the graph theoretic model presented in Section 2.2 and is based on the Shift-And algorithm from Section 2.4. The basic idea of the GSM algorithm is to represent prefix match signals (see Definition 4) from the basic matching algorithm (Section 2.3) over PP in bit vectors. The GSM algorithm represents all signals I in the bitmaps RX formed by three vectors, one for each row. Each time GSM processes a symbol of T , it first propagates the signal along the edges, then filters the signal and finally checks for matches. All these operations can be done very quickly thanks to bitwise parallelism. First, we make the concept of GSM more familiar by presenting a way to interpret the Shift-And algorithm by means of the basic matching algorithm (BMA) from Section 2.3 to solve the (ordinary) Pattern Matching problem. Then we expand this idea to Swap Matching by using the graph theoretic model. 3.1 Graph Theoretic View of the Shift-And Algorithm Let T and P be a text and a pattern of lengths t and p, respectively. We create the T -graph TP = (V, E, σ) of the pattern P . 8 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Definition 5. Let S be a string. The T -graph of S is a graph TS = (V, E, σ) where V = {vi 1 ≤ i ≤ S}, E = {(vi, vi+1) 1 ≤ i ≤ S − 1} and σ : V → Σ such that σ(vi) = Si. Note that the T -graph is directed acyclic graph which can be divided into columns Vi, 1 ≤ i ≤ p (each of them containing one vertex vi) such that the edges lead from Vj to Vj+1. This means that the T -graph satisfies all assump- tions of BMA. We apply BMA to TP to figure out whether P matches T at a position j. We get a correct result because for each i ∈ {1, . . . , p} we check whether Tj+i−1 = σ(vi) = Pi. To find every occurrence of P in T we would have to run BMA for each position separately. This is basically the naive approach to solve the pattern matching. We can improve the algorithm significantly when we parallelize the computations of p runs of BMA in the following way. The algorithm processes one symbol at a time starting from T1. We say that the algorithm is in the j-th step when a symbol Tj has been processed. BMA represents a prefix match as a prefix match signal I : V → {0, 1}. Its value in the j-th step is denoted I j. Since one run of the BMA uses only one column of the T -graph at any time we can use other vertices to represent different runs of the BMA. We represent all prefix match indicators in one vector so that we can manipulate them easily. To do that we prepare a bit vector R. Its value in j-th step is denoted Rj and defined as Rj i = I j(vi). First operation which is used in BMA (propagate signal along the edges) can be done easily by setting the signal of vi to value of the signal of its predeces- sor vi−1 in the previous step. I.e., for i ∈ {1, . . . , p} we set I j(vi) = 1 if i = 1 and I j(vi) = I j−1(vi−1) otherwise. In terms of Rj this means just Rj = LSO(Rj−1), where LSO is defined as LSO(x) = LShift(x) 1. We also need a way to set I (vi) := 0 for each vi for which σ(vi) 6= Tj+i which is another basic BMA operation (filter signal by a symbol). We can do this using the bit vector Dx from Section 2.4 and taking R & Dx. I.e., the algorithm computes Rj as Rj = LSO(Rj−1) & DTj+1 . The last BMA operation we have to define is the match detection. We do p = 1 and if this is the case then a match starting at this by checking whether Rj position j − p + 1 occurred. 3.2 Our Algorithm for Swap Matching Using the Graph Theoretic Model Now we are ready to describe the GSM algorithm. We again let PP = (V, E, σ) be the P -graph of the pattern P , apply BMA to PP to figure out whether P matches T at a position j, and parallelize p runs of BMA on PP . Again, the algorithm processes one symbol at a time and it is in the j-th step when symbol Tj is being processed. We again denote the value of the prefix match signal I : V → {0, 1} of BMA in the j-th step by I j. I.e., the semantic A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 9 Algorithm 3 The graph swap matching (GSM) Input: Pattern P of length p and text T of length t over alphabet Σ. Output: Positions of all swap matches. DPi i := 1 1: Let RU 0 := RM 0 := RD0 := 0p. 2: Let Dx := 0p, for all x ∈ Σ. 3: for i = 1, 2, 3, . . . , p do 4: 5: for j = 1, 2, 3, . . . , t do 6: 7: 8: 9: 10: 11: 12: 13: RU ′j := LSO(RDj−1). RM ′j := LSO(RM j−1 RU j−1). RD′j := LSO(RM j−1 RU j−1). RU j := RU ′j & LShift(DTj ). RM j := RM ′j & DTj . RDj := RD′ j & RShift(DTj ). if RU j p = 1 then p = 1 or RM j report a match on position j − p + 1. meaning of I j(mr,c) is that I j(mr,c) = 1 if there exists a swap permutation π such that π(c) = c + r and π(P )[1,c] = T[j−c+1,j]. Otherwise I j(mr,c) is 0. We want to represent all prefix match indicators in vectors so that we can manipulate them easily. We can do this by mapping the values of I for rows r ∈ {−1, 0, 1} of the P -graph to vectors RU , RM , and RD, respectively. We denote value of the vector RX ∈ {RU , RM , RD} in j-th step as RX j. We define values of the vectors as RU j i = I j(m−1,i), RM j i = I j(m1,i), where the value of I j(v) = 0 for every v /∈ V . i = I j(m0,i), and RDj We define BMA propagate signal along the edges operation as setting the sig- nal of mr,c to 1 if at least one of its predecessors have signal set to 1. I.e., we set I j+1(m−1,i) := I j(m1,i−1), I j+1(m0,i) := I j(m−1,i−1) I j(m0,i−1), I j+1(m0,1) := 1, I j+1(m1,i) := I j(m−1,i−1) I j(m0,i−1), and I j+1(m1,1) := 1. We can perform the above operation using the LSO(R) operation. We obtain the propagate sig- nal along the edges operation in the form RU ′j+1 := LSO(RDj), RM ′j+1 := LSO(RM j RU j), and RD′j+1 := LSO(RM j RU j). The operation filter signal by a symbol can be done by first constructing a bit vector Dx for each x ∈ Σ as Dx i = 0 otherwise. Then we use these vectors to filter signal by a symbol x by taking RU j := RU ′j &LShift(DTj ), RM j := RM ′j & DTj , and RDj := RD′j & RShift(DTj ). i = 1 if x = Pi and Dx The last operation we define is the match detection. We do this by checking p = 1 and if this is the case, then a match starting at whether RU j a position j − p + 1 occurred. p = 1 or RM j The final GSM algorithm (Algorithm 3) first prepares the D-masks Dx for every x ∈ Σ and initializes RU 0 := RM 0 := RD0 := 0 (Steps 1 -- 4). Then the algorithm computes the value of vectors RU j, RM j, and RDj for j ∈ {1, . . . , t} by first using the above formula for signal propagation (Steps 6 -- 8) and then the formula for signal filtering (Steps 9 -- 11) and checks whether RU j p = 1 and if this is the case the algorithm reports a match (Steps 12 and 13). p = 1 or RM j 10 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Observe that Algorithm 3 accesses the input sequentially and thus it is a streaming algorithm. We now prove correctness of our algorithm. To ease the notation let us define Rj(mr,c) to be RU j c if r = 0, and RDj c if r = 1. We define R′j(mr,c) analogously. Similarly, we define Dx(mr,c) as (LShift(Dx))c = Dx c+1 if r = 1. By the way the masks Dx are computed on lines 2 -- 4 of Algorithm 3, we get the following observation. c if r = 0, and (RShift(Dx))c = Dx c if r = −1, RM j c−1 if r = −1, Dx Observation 1 For every mr,i ∈ V and every j ∈ {i, . . . t} we have DTj (mr,i) = 1 if and only if Tj = Pr+i. The following lemma constitutes the crucial part of the correctness proof. Lemma 1. For every mr,i ∈ V and every j ∈ {i, . . . t} we have Rj(mr,i) = 1 if and only if there exists a swap permutation π such that π(P )[1,i] = T[j−i+1,j] and π(i) = i + r. Proof. Let us start with the "if" part. We prove the claim by induction on i. If i = 1 and there is a swap permutation π such that π(1) = 1 + r and P1+r = Tj, then the algorithm sets R′j(mr,1) to 1 on line 6, 7, or 8 (recall the definition of LSO). As P1+r = Tj, we have DTj (mr,1) = 1 by Observation 1 and, therefore, by lines 9 -- 11, also Rj(mr,1). Now assume that i > 1 and that the claim is true for every smaller i. Assume that there exists a swap permutation π such that π(P )[1,i] = T[j−i+1,j] and π(i) = i + r. By induction hypothesis we have that Rj−1(mr′,i−1) = 1, where r′ = i−1−π(i−1). Since r equals −1 if and only if r′ equals +1 by Definition 1, we have (r, r′) ∈ {(−1, 1), (0, −1), (0, 0), (1, −1), (1, 0)}. Therefore the algorithm sets R′j(mr,i) to 1 on line 6, 7, or 8. Moreover, since Pi+r = Tj, we have DTj (mr,i) = 1 by Observation 1 and the algorithm sets Rj(mr,i) to 1 on one of the lines 9 -- 11. Now we prove the "only if" part again by induction on i. If i = 1 and Rj(mr,i) = 1, then we must have DTj (mr,1) = 1 and, by Observation 1, also P1+r = Tj. We obtain π by setting π(1) = 1 + r, π(2) = 2 − r and π(i′) = i′ for every i′ ∈ {2, . . . , p}. It is easy to verify that this is a swap permutation for P and has the desired properties. Now assume that i > 1 and that the claim is true for every smaller i. Assume that Rj(mr,i) = 1. Then, due to lines 9 -- 11 we must have DTj (mr,i) = 1 and, hence, by Observation 1, also Pi+r = Tj. Moreover, we must have R′j(mr,i) = 1 and, hence, by lines 6 -- 8 of the algorithm also Rj−1(mr′,i−1) = 1 for some r′ with (r, r′) ∈ {(−1, 1), (0, −1), (0, 0), (1, −1), (1, 0)}. By induction hypothesis there exists a swap permutation π′ for P such that π′(P )[1,i−1] = T[j−i+1,j−1] and π′(i − 1) = i − 1 + r′. If π′(i) = i + r, then setting π = π′ finishes the proof. Otherwise we have either r = 0 or r = 1 and i < p. In the former case we let π(i′) = i′ for every i′ ∈ {i, . . . , p} and in the later case we let π(i) = i + 1, π(i + 1) = i and π(i′) = i′ for every i′ ∈ {i + 2, . . . , p}. In both cases we let π(i′) = π′(i′) for every i′ ∈ {1, . . . , i − 1}. It is again easy to verify that π is a swap permutation for P with the desired properties. ⊓⊔ A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 11 Theorem 2. The GSM algorithm is correct. Proof. Our GSM algorithm reports a match on position j − p + 1 if and only if Rj(mp,−1) = 1 or Rj(mp,0) = 1. However, by Lemma 1, this happens if and only if there is a swap match of P on position j − p + 1 in T . Hence, the algorithm is correct. Theorem 3. The GSM algorithm runs in O(⌈ p w ⌉(Σ + t) + p) time and uses O(⌈ p w ⌉Σ) memory cells (not counting the input and output cells), where t is the length of the input text, p length of the input pattern, w is the word-size of the machine, and Σ size of the alphabet.2 Proof. The initialization of RX and Dx masks (lines 1 and 2) takes O(⌈ p w ⌉Σ) time. The bits in Dx masks are set according to the pattern in O(p) time (lines 3 and 4). The main cycle of the algorithm (lines 5 -- 13) makes t iterations. Each iteration consists of computing values of RX in 13 bitwise operations, i.e., in O(⌈ p w ⌉) machine operations, and checking for the result in O(1) time. This gives O(⌈ p w ⌉(Σ + t) + p) time in total. The algorithm saves 3 RX masks (using the same space for all j and also for RX ′ masks), Σ Dx masks, and constant number of variables for other uses (iteration counters, temporary variable, etc.). Thus, in total the GSM algorithm needs O(⌈ p ⊓⊔ w ⌉Σ) memory cells. Corollary 1. If p = cw for some constant c, then the GSM algorithm runs in O(Σ + p + t) time and has O(Σ) space complexity. Moreover, if p ≤ w, then the GSM algorithm can be implemented using only 7 + Σ memory cells. Proof. The first part follows directly from Theorem 3. Let us show the second part. We need Σ cells for all D-masks, 3 cells for R vectors (reusing the space also for R′ vectors), one pointer to the text, one iteration counter, one constant for the match check and one temporary variable for the computation of the more complex parts of the algorithm. Alltogether, we need only 7 + Σ memory cells to run the GSM algorithm. ⊓⊔ From the space complexity analysis we see that for some sufficiently small alphabets (e.g. DNA sequences) the GSM algorithm can be implemented in practice using solely CPU registers with the exception of text which has to be loaded from the RAM. 4 Limitations of the Finite Deterministic Automata Approach Many of the string matching problems can be solved by finite automata. The construction of a non-deterministic finite automaton that solves Swap Matching can be done by a simple modification of the P -graph. An alternative approach 2 To simplify the analysis, we assume that log t < w, i.e., the iteration counter fits into one memory cell. 12 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Table 1. An example of the construction from proof of Theorem 4 for k = 3. P = T0 acabcabcabc T1 acabcabcbac T2 acabcbacabc T3 acabcbacbac T4 acbacabcabc T5 acbacabcbac T6 acbacbacabc T7 acbacbacbac to solve the Swap Matching would thus be to determinize and execute this automaton. The drawback is that the determinization process may lead to an exponential number of states. We show that in some cases it actually does, con- tradicting the conjecture of Holub [16], stating that the number of states of this determinized automaton is O(p). Theorem 4. There is an infinite family F of patterns such that any deter- ministic finite automaton AP accepting the language LS(P ) = {uπ(P ) u ∈ Σ∗, π is a swap permutation for P } for P ∈ F has 2Ω(P ) states. k−1, bi k−2 . . . bi j = abc if bi j = 0 and let Bi j = bac if bi k−1Bi k−2 . . . Bi Proof. For any integer k we define the pattern Pk := ac(abc)k. Note that the length of Pk is Θ(k). Suppose that the automaton AP recognizing language L(P ) has s states such that s < 2k. We consider a set of strings T0, . . . , T2k−1 where Ti is defined as follows. Let bi 0 be the binary representation of the number i. Let Bi j = 1. Then, let Ti := acBi 0. See Table 1 for an example. Note that each Ti, i ∈ {0, . . . , 2k − 1} is a swapped version of P = T0. Since s < 2k, there exist 0 ≤ i < j ≤ 2k − 1 such that both Ti and Tj are accepted by the same accepting state q of the automaton A. Let m be the minimum number such m = 1. Now we define T ′ that bi i = Ti(abc)(m+1) and T ′ i )[3(m+1)+1,3(m+1+k)+2] and Y = (T ′ j both of length 3k + 2. Note that X begins with bc . . . and Y begins with ac . . . and that block abc or bac repeats for k times in both. Therefore pattern P swap matches Y and does not swap match X. Since for the last symbol of both Ti and Tj the automaton is in the same state q, the computation for T ′ j must end in the same state q′. However as X should not be accepted and Y should be accepted we obtain contradiction with the correctness of the automaton A. Hence, we may define the family F as F = {P1, P2, . . . }, concluding the proof. ⊓⊔ m = 0 and bj j = Tj(abc)(m+1). Let X = (T ′ k−1−m. Note that bi j)[3(m+1)+1,3(m+1+k)+2] be the suffices of the strings T ′ i and T ′ k−1−m 6= bj i and T ′ This proof shows the necessity for specially designed algorithms which solve the Swap Matching. We presented one in the previous section and now we reiterate on the existing algorithms. A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 13 5 Smalgo Algorithm In this section we discuss how Smalgo by Iliopoulos and Rahman [17] and Smalgo-I and Smalgo-II by Ahmed et al. [1] work. Since Smalgo-I is bitwise inverse of Smalgo, we will introduce them both in terms of operations used in Smalgo-I. After that we will describe and analyze Smalgo-II. Before we show how these algorithms work, we need one more definition. Definition 6. A degenerate symbol w over an alphabet Σ is a nonempty set of symbols from alphabet Σ. A degenerate string S is a string built over an alphabet of degenerate symbols. We say that a degenerate string eP matches a text T at a position j if Tj+i−1 ∈ ePi for every 1 ≤ i ≤ p. 5.1 Smalgo-I The Smalgo-I [1] algorithm is a modification of the Shift-And algorithm from Section 2.4 for Swap Matching. The algorithm uses the graph theoretic model introduced in Section 2.2. First let eP = {P1, P2} . . . {Px−1, Px, Px+1} . . . {Pp−1, Pp} be a a degenerate version of pattern P . The symbol on position i in eP represents the set of symbols of P which can swap to that position. To accommodate the Shift-And algorithm to match degenerate patterns we need to change the way the Dx masks are defined. For each x ∈ Σ let eDx i be the bit array of size p such that for 1 ≤ i ≤ p, eDx = 1 if and only if x ∈ ePi. While a match of the degenerate pattern eP is a necessary condition for a swap match of P , it is clearly not sufficient. The way the Smalgo algorithms try to fix this is by introducing P-mask P (x1, x2, x3) which is defined as P (x1, x2, x3)i = 1 if i = 1 or if there exist vertices u1, u2, and u3 and edges (u1, u2), (u2, u3) in PP for which u2 = mr,i for some r ∈ {−1, 0, 1} and σ(un) = xn for 1 ≤ n ≤ 3, and P (x1, x2, x3)i = 0 otherwise. One P -mask called P (x, x, x) is used to represent the P -masks for triples (x1, x2, x3) which only contain 1 in the first column. Now, whenever checking whether P prefix swap matches T k + 1 symbols at position j we check for a match of eP in T and we also check whether P (Tj+k−1, Tj+k, Tj+k+1)k+1 = 1. This ensures that the symbols are able to swap to respective positions and that those three symbols of the text T are present in some π(P ). With the P-masks completed we initialize R1 = 1& eDT1 . Then for every j = 1 to t we repeat the following. We compute Rj+1 as Rj+1 = LSO(Rj) & eDTj+1 & RShift( eDTj+2 ) & P (Tj, Tj+1, Tj+2). To check whether or not a swap match oc- curred we check whether Rj p−1 = 1. This is claimed to be sufficient because during the processing we are in fact considering not only the next symbol Tj+1 but also the symbol Tj+2. 5.2 The Flaw in the Smalgo, Smalgo-I and Smalgo-II We shall see that for a pattern P = abab and a text T = aaba all Smalgo versions give false positives. 14 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla a b a b a b a b a b Fig. 3. Smalgo flaw represented in the P -graph for P = abab The concept of Smalgo is based on the assumption that we can find a path in PP by searching for consecutive paths of length 3 (triplets), where each two consecutive share two columns and can partially overlap. However, this only works if the consecutive triplets actually share the two vertices in the common columns. If the assumption is not true then the found substring of the text might not match any swapped version of P . The above input gives such a configuration (see Fig. 3) and therefore the assumption is false. The Smalgo-I algorithm actually reports match of pattern P = abab on a position 1 of text T = aaba. This is obviously a false positive, as the pattern has two b symbols while the text has only one. The reason behind the false positive match is as follows. The algorithm checks whether the first triplet of symbols (a, a, b) matches. It can match the swap pattern aabb. Next it checks the second triplet of symbols (a, b, a), which can match baba. We know that baba is not possible since it did not appear in the previous check, but the algorithm cannot distinguish them since it only checks for triplets existence. Since each step gave us a positive match the algorithm reports a swap match of the pattern in the text. In the Fig. 3 we see the two triplets which Smalgo assumes have two vertices in common. The Smalgo-II algorithm saves space by maintaining less informa- tion, however it simulates how Smalgo-I works and so it contains the same flaw. 5.3 The Run of Smalgo-I Resulting in the False Positive In Tables 2 and 3 we can see the step by step execution of Smalgo-I algorithm on pattern P = abab and text T = aaba. In Table 3 we see that R3 has 1 in the 3-rd row which means that the algorithm reports a pattern match on a position 1. This is a false positive, because it is not possible to swap match the pattern with two b symbols in the text with only one b symbol. 5.4 Description of Smalgo-II To explain the Smalgo-II algorithm in more detail, we first introduce a notion of change. An upward change corresponds to (the BMA) going to vertex m−1,i for some i, a downward change corresponds to going to vertex m+1,i, and a middle-ward change corresponds to going to vertex m0,i. A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 15 Table 2. eD-masks and P-masks for P = abab. A column xyz contains values P (x, y, z)i. ePi i 1 [ab] 2 [ba] 3 [ab] 4 [ba] eDa i 1 1 1 1 eDb i aaa aab aba baa abb bab bba bbb 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 Table 3. Smalgo-I algorithm execution for P = abab and T = aaba. The column RDx denotes the values of RShift( eDx). i R1 LSO(R1) eDa RDb P (a, a, b) R2 LSO(R2) eDb RDa P (a, b, a) R3 1 1 1 2 3 1 0 4 1 1 0 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 0 If a downward change has occurred, then we have to check whether an upward change occurs at the next position. If an upward change has occurred, then we have to check whether a downward or middle-ward change occurs at the next position. The main problem here is how to tell whether the changes actually occur. To this end, the authors of the algorithm introduce three new types of masks, namely up-masks up(x,y), down-masks down(x,y), and middle-masks middle(x,y), which express whether an upward, a downward, and a middle-ward change can occur at the particular position, respectively, with the endpoints of the edge having labels x and y. The authors of the algorithm now claim that to perform the above checks, it is enough to save the previous down-mask and match its value with current up- mask and Rj, or to save the previous up-mask and match its value with current down-mask, middle-mask, and Rj, respectively. However, this way in both cases we only check whether the change can occur, not whether it actually occurred. This would lead not only to false positives (as shown in Section 5), but also to false negatives. Unfortunately, no more details are available about the algorithm in the orig- inal paper. The pseudocode of Smalgo-II (which contains numerous errors) performs something different and we include its analysis in the next section for completeness. Nevertheless, the example presented in the Section 5 and in the previous section still makes the pseudocode (with the small errors corrected) report a false positive. 5.5 Analysis of the Pseudocode of Smalgo-II In this section we analyze the pseudocode of the Smalgo-II algorithm as given by Ahmed et al. in [1], we will perform equivalent transformation on the pseu- 16 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla docode in order to understand the meaning of the checks the pseudocode actually performs. The original pseudocode is as follows. Algorithm 4 Smalgo-II Require: Text T, up-mask up, down-mask down, middle-mask middle, P-mask pmask, D-mask D for given pattern p 1: R0 ← 2patternLength−1 2: checkUp ← checkDown ← 0 3: R0 ← R0 & DT0 4: R1 ← R0 ≫ 1 5: for j = 0 to (n − 2) do 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: Rj+1 ← Rj ≫ 1 checkUp ← checkUp ≫ 1 checkDown ← checkDown ≫ 1 Rj ← Rj & pmask(Tj ,Tj+1 ) & DTj+1 temp ← prevCheckUp ≫ 1 checkUp ← checkUp up(Tj ,Tj+1) checkUp ← checkUp & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1 ) prevCheckUp ← checkUp Rj ← ∼ (temp & checkUp) & Rj temp ← prevCheckDown ≫ 1 checkDown ← checkDown down(Tj ,Tj+1) checkDown ← checkDown & ∼ up(Tj ,Tj+1) prevCheckDown ← checkDown Rj ← ∼ (temp & checkDown) & Rj if (Rj & 1) = 1 then Match found ending at position (j − 1) The pseudocode has several problems. First, in the first iteration of the cy- cle, the algorithm uses the value of the variable prevCheckUp which was never initialized. Second, the algorithm never adds new ones to the variable R and, hence, can never report a match after position patternLength of the text. Third, if the text is of the same length as the pattern, the algorithm only applies the shift patternLength − 2 times to the original value of 2patternLength−1 (note that in the first iteration it uses R0 and overwrites the value of R1) before the last match check. Therefore, at the last check, the value could only drop to 2patternLength−1−patternLength+2 = 21 = 2 and the match check cannot be success- ful. Also the reported position of the match does not make much sense. Let us first correct all these easy problems. A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 17 Algorithm 5 Smalgo-II 1: R0 ← 2patternLength−1 2: prevCheckUp ← prevCheckDown ← checkUp ← checkDown ← 0 3: R0 ← R0 & DT0 4: R1 ← R0 ≫ 1 5: for j = 0 to (n − 2) do 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: Rj+1 ← Rj+1 & pmask(Tj ,Tj+1) & DTj+1 temp ← prevCheckUp ≫ 1 checkUp ← checkUp up(Tj ,Tj+1) checkUp ← checkUp & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1 ) prevCheckUp ← checkUp Rj+1 ← ∼ (temp & checkUp) & Rj+1 temp ← prevCheckDown ≫ 1 checkDown ← checkDown down(Tj ,Tj+1) checkDown ← checkDown & ∼ up(Tj ,Tj+1) prevCheckDown ← checkDown Rj+1 ← ∼ (temp & checkDown) & Rj+1 if (Rj+1 & 1) = 1 then Rj+2 ← (Rj+1 ≫ 1) 2patternLength−1 checkUp ← checkUp ≫ 1 checkDown ← checkDown ≫ 1 Match found ending at position (j + 1) If we now move the line setting prevCheckUp to checkUp after the line where the check with the temp variable is performed and similarly with prevCheckDown, we do not need the temp variable anymore. We also move the shifts of checkUp and checkDown closer to where this variables are used. We only show the impor- tant part of the algorithm. Algorithm 6 Smalgo-II . . . Rj+1 ← Rj+1 & pmask(Tj ,Tj+1) & DTj+1 checkUp ← checkUp up(Tj ,Tj+1) checkUp ← checkUp & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1 ) Rj+1 ← ∼ (prevCheckUp ≫ 1 & checkUp) & Rj+1 prevCheckUp ← checkUp checkUp ← checkUp ≫ 1 checkDown ← checkDown down(Tj ,Tj+1) checkDown ← checkDown & ∼ up(Tj ,Tj+1) Rj+1 ← ∼ (prevCheckDown ≫ 1 & checkDown) & Rj+1 prevCheckDown ← checkDown checkDown ← checkDown ≫ 1 if (Rj+1 & 1) = 1 then 5: for j = 0 to (n − 2) do 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: Rj+2 ← (Rj+1 ≫ 1) 2patternLength−1 Match found ending at position (j + 1) 18 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Now we swap the order of setting prevCheckUp to checkUp and the shift of checkUp. As this makes prevCheckUp shifted by one, we remove the additional shift in the check. Similarly for checkDown. Algorithm 7 Smalgo-II . . . 7: checkUp ← checkUp up(Tj ,Tj+1) 8: checkUp ← checkUp & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1 ) 9: Rj+1 ← ∼ (prevCheckUp & checkUp) & Rj+1 10: checkUp ← checkUp ≫ 1 11: prevCheckUp ← checkUp 12: checkDown ← checkDown down(Tj ,Tj+1) 13: checkDown ← checkDown & ∼ up(Tj ,Tj+1 ) 14: Rj+1 ← ∼ (prevCheckDown & checkDown) & Rj+1 15: checkDown ← checkDown ≫ 1 16: prevCheckDown ← checkDown . . . Now we institute checkUp into the check and move its computation after the check. Algorithm 8 Smalgo-II . . . 6: Rj+1 ← Rj+1 & pmask(Tj ,Tj+1 ) & DTj+1 7: Rj+1 ← ∼ (prevCheckUp & (checkUp up(Tj ,Tj+1)) & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1)) & Rj+1 8: checkUp ← (checkUp up(Tj ,Tj+1)) & ∼ down(Tj ,Tj+1 ) & ∼ middle(Tj ,Tj+1) 9: checkUp ← checkUp ≫ 1 10: prevCheckUp ← checkUp 11: Rj+1 ← ∼ (prevCheckDown & (checkDown down(Tj ,Tj+1 )) & ∼ up(Tj ,Tj+1)) & Rj+1 12: checkDown ← (checkDown down(Tj ,Tj+1)) & ∼ up(Tj ,Tj+1) 13: checkDown ← checkDown ≫ 1 14: prevCheckDown ← checkDown . . . Now note that during the check, the content of prevCheckUp is exactly the same as the content of checkUp, so we can remove prevCheckUp completely. A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 19 Algorithm 9 Smalgo-II 1: R0 ← 2patternLength−1 2: checkUp ← checkDown ← 0 3: R0 ← R0 & DT0 4: R1 ← R0 ≫ 1 5: for j = 0 to (n − 2) do 6: 7: Rj+1 ← Rj+1 & pmask(Tj ,Tj+1) & DTj+1 Rj+1 ← ∼ (checkUp & (checkUp up(Tj ,Tj+1 )) & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1)) & Rj+1 checkUp ← (checkUp up(Tj ,Tj+1)) & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1 ) checkUp ← checkUp ≫ 1 Rj+1 ← ∼ (checkDown & (checkDown down(Tj ,Tj+1)) & ∼ up(Tj ,Tj+1 )) & Rj+1 checkDown ← (checkDown down(Tj ,Tj+1 )) & ∼ up(Tj ,Tj+1) checkDown ← checkDown ≫ 1 if (Rj+1 & 1) = 1 then Match found ending at position (j + 1) Rj+2 ← (Rj+1 ≫ 1) 2patternLength−1 8: 9: 10: 11: 12: 13: 14: 15: Now we modify the expressions by laws of logic to arrive at the following formulation. Algorithm 10 Smalgo-II . . . 7: Rj+1 ← Rj+1 & ( ∼ checkUp down(Tj ,Tj+1) middle(Tj ,Tj+1)) 8: checkUp ← (checkUp & ∼ down(Tj ,Tj+1) & ∼ middle(Tj ,Tj+1)) (up(Tj ,Tj+1 ) & ∼ down(Tj ,Tj+1 ) & ∼ middle(Tj ,Tj+1)) 9: checkUp ← checkUp ≫ 1 10: Rj+1 ← Rj+1 & ( ∼ checkDown up(Tj ,Tj+1)) 11: checkDown ← (checkDown & ∼ up(Tj ,Tj+1)) (down(Tj ,Tj+1) & ∼ up(Tj ,Tj+1)) 12: checkDown ← checkDown ≫ 1 . . . Now, if the first subexpression in the logical OR setting the new value of checkUp is true, then the appropriate bit of Rj+1 was just set to 0 on the previous line and filtrating this bit again in future is useless. Hence, we can omit this part of the expression. We arrive at the following resulting pseudocode. 20 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Algorithm 11 Smalgo-II 1: R0 ← 2patternLength−1 2: checkUp ← checkDown ← 0 3: R0 ← R0 & DT0 4: R1 ← R0 ≫ 1 5: for j = 0 to (n − 2) do 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: Rj+1 ← Rj+1 & pmask(Tj ,Tj+1) & DTj+1 Rj+1 ← Rj+1 & ( ∼ checkUp down(Tj ,Tj+1 ) middle(Tj ,Tj+1)) checkUp ← up(Tj ,Tj+1) & ∼ down(Tj ,Tj+1 ) & ∼ middle(Tj ,Tj+1) checkUp ← checkUp ≫ 1 Rj+1 ← Rj+1 & ( ∼ checkDown up(Tj ,Tj+1 )) checkDown ← down(Tj ,Tj+1) & ∼ up(Tj ,Tj+1) checkDown ← checkDown ≫ 1 if (Rj+1 & 1) = 1 then Match found ending at position (j + 1) Rj+2 ← (Rj+1 ≫ 1) 2patternLength−1 Now it is easy to see, that checkUp stores the information on whether an upward-change must have occurred in the previous step (provided that there was a prefix match) and this is compared with the information whether downward- change or middle-change can occur. Similarly for the downward-change. This is not sufficient to avoid false positives since sometimes both upward-change and downward-change can occur (e.g, as in our counterexample), in which case no filtration is performed at all. 5.6 Why the Flaw is Not Easily Repairable Consider the following attempt to fix the Smalgo-I or Smalgo-II. After each reported match we check for the validity of the result using a single linear-time algorithm. This approach would rule out false positives but it ruins the time complexity of the algorithms, since there are texts of arbitrary length t with Θ(t) of reported occurrences. Namely consider the text T = aa(baa)n for some positive n, pattern P = abab, and let t = T . Note that n = (t − 2)/3 = Θ(t). Text T contains string aaba on positions 1, 4, 7, . . . , 3(n − 1) + 1 (n occurrences in total) and string baab on positions 3, 6, . . . , 3(n − 1) (n − 1 occurrences in total). Thus there are 2n − 1 occurrences which need to be checked since the n occurrences of aaba are reported by the algorithms although they are not valid matches. Even if the checking for correctness was done in linear time O(p), the algorithms will report up to Θ(t) occurrences which means we have to run the checking algorithm Θ(t) times. Therefore the time complexity of a version of the Smalgo algorithm corrected this way is O(tp) even for a pattern length similar to the word-size of the target machine. Also, the flaw cannot be resolved by checking for subpaths of length 4 or any larger constant, due to the following. Consider a pattern P = (ab)n and a text A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 21 T = aa(ba)n−1 for any positive n. Obviously P does not swap match T , as they are of the same length 2n, but T contains more a's than P . However, there is a swap permutation π for P such that (π(P ))[1...(2n−1)] = T[1...(2n−1)] and also a swap permutation π′ for P such that (π′(P ))[2...(2n)] = T[2...(2n)]. For example if we have P = abab and a text T = aabaabaabaa both Smalgo algorithms report swap matches on positions {1, 3, 4, 6, 7} while the correct output would be {3, 6}. 6 Experiments We implemented our Algorithm 3 (GSM), described in Section 3.2, the Bitwise Parallel Cross Sampling (BPCS) algorithm by Cantone and Faro [10], the Bitwise Parallel Backward Cross Sampling (BPBCS) algorithm by Campanelli et al. [9], and the faulty SMALGO algorithm by Iliopoulos and Rahman [17]. All these implementations are available online.3 We tested the implementations on three real-world datasets. The first dataset (CH) is the 7th chromosome of the human genome4 which consists of 159 M char- acters from the standard ACTG nucleobases and N as for non-determined. Second dataset (HS) is a partial genome of Homo sapiens from the Protein Corpus5 with 3.3 M characters representing proteins encoded in 19 different symbols. The last dataset (BIB) is the Bible text of the Cantenbury Corpus6 with 4.0 M characters containing 62 different symbols. For each length from 3, 4, 5, 6, 8, 9, 10, 12, 16, and 32 we randomly selected 10,000 patterns from each text and processed each of them with each implemented algorithm. All measured algorithms were implemented in C++ and compiled with -O3 in gcc 6.3.0. Measurements were carried on an Intel Core i7-4700HQ processor with 2.4 GHz base frequency and 3.4 GHz turbo with 8 GiB of DDR3 memory at 1.6 GHz. Time was measured using std::chrono::high resolution clock::now() from the C++ chrono library. The resulting running times, shown in Table 4, were averaged over the 10,000 patterns of the given length. The results show, that the GSM algorithm runs approximately 23% faster than Smalgo (ignoring the fact that Smalgo is faulty by design). Also, the performance of GSM and BPCS is almost indistinguishable and according to our experiments, it varies in the span of units of percents depending on the exact CPU, cache, RAM and compiler setting. The seemingly superior average performance of BPBCS is caused by the heuristics BPBCS uses; however, while the worst-case performance of GSM is guaranteed, the performance of BPBCS for certain patterns is worse than that of GSM. Also note that GSM is a streaming algorithm while the others are not. Table 5 visualizes the accurateness of Smalgo-I with respect to its flaw by comparing the number of occurrences found by the respective algorithms. The 3 http://users.fit.cvut.cz/blazeva1/gsm.html 4 ftp://ftp.ensembl.org/pub/release-90/fasta/homo_sapiens/dna/ 5 http://www.data-compression.info/Corpora/ProteinCorpus/ 6 http://corpus.canterbury.ac.nz/descriptions/large/bible.html 22 V´aclav Blazej, Ondrej Such´y, and Tom´as Valla Table 4. Comparison of the running times in milliseconds. Each value is the average over 10,000 patterns randomly selected from the text. Data (Σ) CH (5) HS (19) BIB (62) Algor. 3 SMALGO 426 398 824 394 BPCS BPBCS GSM Pattern Length 4 376 353 675 354 5 355 335 555 338 6 350 332 472 333 8 347 329 366 332 9 347 329 328 331 10 344 326 297 329 12 347 328 257 333 16 345 329 199 331 32 345 327 112 333 SMALGO 4.80 4.43 7.16 4.42 BPCS BPBCS GSM 4.72 4.74 4.73 4.36 4.36 4.36 5.80 4.38 4.70 4.34 4.79 4.05 3.03 2.70 2.44 2.06 1.62 0.95 4.41 4.48 4.71 4.34 4.72 4.35 4.71 4.34 4.70 4.34 4.71 4.33 4.44 4.53 4.45 4.46 4.45 4.45 8.29 SMALGO 8.60 7.53 12.43 10.03 7.37 7.52 BPCS BPBCS GSM 8.34 8.38 7.36 7.28 7.29 8.32 7.26 8.33 7.25 8.26 7.03 5.44 4.93 4.52 3.93 3.19 1.88 7.31 7.40 8.35 7.28 8.35 7.29 8.30 7.26 8.33 7.27 7.42 7.44 7.35 7.38 7.40 7.38 Table 5. Found occurrences across datasets: The value is simply the sum of occurrences over all the patterns. Algorithm CH Dataset HS BIB SMALGO 86243500784 51136419 315612770 84411799892 51034766 315606151 rest ratio of false positives to true positives for the Smalgo-I was: CH 2.17%, HS 0.20% and BIB 0.002%. References 1. Ahmed, P., Iliopoulos, C.S., Islam, A.S., Rahman, M.S.: The swap matching prob- lem revisited. Theoretical Computer Science 557, 34 -- 49 (2014) 2. Amir, A., Aumann, Y., Landau, G.M., Lewenstein, M., Lewenstein, N.: Pattern matching with swaps. Journal of Algorithms 37(2), 247 -- 266 (2000) 3. Amir, A., Cole, R., Hariharan, R., Lewenstein, M., Porat, E.: Overlap matching. Information and Computation 181(1), 57 -- 74 (2003) 4. Amir, A., Eisenberg, E., Porat, E.: Swap and mismatch edit distance. Algorithmica 45(1), 109 -- 120 (2006) 5. Amir, A., Landau, G.M., Lewenstein, M., Lewenstein, N.: Efficient special cases of pattern matching with swaps. Information Processing Letters 68(3), 125 -- 132 (1998) 6. Amir, A., Lewenstein, M., Porat, E.: Approximate swapped matching. Information Processing Letters 83(1), 33 -- 39 (2002) A Simple Streaming Bit-parallel Algorithm for Swap Pattern Matching 23 7. Antoniou, P., Iliopoulos, C.S., Jayasekera, I., Rahman, M.S.: Implementation of a swap matching algorithm using a graph theoretic model. In: Bioinformatics Re- search and Development, BIRD 2008, CCIS, vol. 13, pp. 446 -- 455. Springer (2008) 8. Blazej, V., Such´y, O., Valla, T.: A simple streaming bit-parallel algorithm for swap pattern matching. In: Mathematical Aspects of Computer and Information Sciences, MACIS 2017. LNCS, vol. 10693, pp. 333 -- 348. Springer (2017) 9. Campanelli, M., Cantone, D., Faro, S.: A new algorithm for efficient pattern matching with swaps. In: International Workshop on Combinatorial Algorithms, IWOCA 2009, LNCS, vol. 5874, pp. 230 -- 241. Springer (2009) 10. Cantone, D., Faro, S.: Pattern matching with swaps for short patterns in linear time. In: International Conference on Current Trends in Theory and Practice of Computer Science, SOFSEM 2009, LNCS, vol. 5404, pp. 255 -- 266. Springer (2009) 11. Charras, C., Lecroq, T.: Handbook of Exact String Matching Algorithms. King's College Publications (2004) 12. Chedid, F.: On pattern matching with swaps. In: IEEE/ACS International Con- ference on Computer Systems and Applications, AICCSA 2013. pp. 1 -- 5. IEEE (2013) 13. Dombb, Y., Lipsky, O., Porat, B., Porat, E., Tsur, A.: The approximate swap and mismatch edit distance. Theoretical Computer Science 411(43), 3814 -- 3822 (2010) 14. Faro, S.: Swap matching in strings by simulating reactive automata. In: Proceedings of the Prague Stringology Conference 2013, pp. 7 -- 20. CTU in Prague (2013) 15. Fredriksson, K., Giaquinta, E.: On a compact encoding of the swap automaton. Information Processing Letters 114(7), 392 -- 396 (2014) 16. Holub, J.: Personal communication (2015) 17. Iliopoulos, C.S., Rahman, M.S.: A new model to solve the swap matching problem and efficient algorithms for short patterns. In: International Conference on Current Trends in Theory and Practice of Computer Science, SOFSEM 2008, LNCS, vol. 4910, pp. 316 -- 327. Springer (2008) 18. Lewin, B.: Genes for SMA: Multum in parvo. Cell 80(1), 1 -- 5 (1995) 19. Lipsky, O., Porat, B., Porat, E., Shalom, B.R., Tzur, A.: String matching with up to k swaps and mismatches. Information and Computation 208(9), 1020 -- 1030 (2010) 20. Muthukrishnan, S.: New results and open problems related to non-standard stringology. In: Annual Symposium on Combinatorial Pattern Matching, CPM 95, LNCS, vol. 937, pp. 298 -- 317. Springer (1995) 21. Wagner, R.A., Lowrance, R.: An extension of the string-to-string correction prob- lem. Journal of the ACM 22(2), 177 -- 183 (1975)
1512.06283
2
1512
2016-09-12T12:23:35
Chinese Postman Problem on Edge-Colored Multigraphs
[ "cs.DS", "math.CO" ]
It is well-known that the Chinese postman problem on undirected and directed graphs is polynomial-time solvable. We extend this result to edge-colored multigraphs. Our result is in sharp contrast to the Chinese postman problem on mixed graphs, i.e., graphs with directed and undirected edges, for which the problem is NP-hard.
cs.DS
cs
Chinese Postman Problem on Edge-Colored Multigraphs Gregory Gutin1, Mark Jones1, Bin Sheng1, Magnus Wahlstrom1, and Anders Yeo2,3 1Department of Computer Science, Royal Holloway, University of London, TW20 0EX, Egham, Surrey, UK 2Engineering Systems and Design, Singapore University of Technology and Design, 8 Somapah Road 487372, Singapore 3Department of Mathematics, University of Johannesburg, Auckland Park, 2006 South Africa September 13, 2016 Abstract It is well-known that the Chinese Postman Problem on undirected and directed graphs is polynomial-time solvable. We extend this result to edge-colored multigraphs. Our result is in sharp contrast to the Chi- nese Postman Problem on mixed graphs, i.e., graphs with directed and undirected edges, for which the problem is NP-hard. 1 Introduction In this paper, we consider edge-colored multigraphs. In such multigraphs, each edge is assigned a color; a multigraph G is called k-edge-colored if only colors from [k] := {1, 2, . . . , k} are used in G. A walk1 W in an edge-colored multigraph is called properly colored (PC) if no two consecutive edges of W have the same color. PC walks are of interest in graph theory applications, e.g., in genetic and molecular biology [18, 20, 21], in design of printed circuit and wiring boards [22], and in channel assignment in wireless networks [3, 19]. They are also of interest in graph theory itself as generalizations of walks in undirected and directed graphs. Indeed, if we assign different colors to all edges of an undirected multigraph, every walk not traversing the same edge 1 Terminology on walks used in this paper is given in the next section. 1 twice becomes PC. Also, consider the standard transformation from a directed graph D into a 2-edge-colored graph G by replacing every arc uv of D by a path with a blue edge uwuv and a red edge wuvv, where wuv is a new vertex [4]. Clearly, every directed walk in D corresponds to a PC walk in G (with end-vertices in V (G)) and vice versa. There is an extensive literature on PC walks: for a detailed survey of pre-2009 publications, see Chapter 16 of [4], more recent papers include [2, 8, 13, 14, 15]. A walk is closed if it starts and ends in the same vertex. (A closed walk W has no last edge, every edge in W has a following edge; if W is PC, each edge of W is of different color to the following edge.) An Euler trail in a multigraph G is a closed walk which traverses each edge of G exactly once. PC Euler trails were one of the first types of PC walks studied in the literature and the first papers that studied PC Euler trails were motivated by theoretical questions [7, 12] as well as questions in molecular biology [18]. To formulate a characterization of edge-colored graphs with PC Euler trails by Kotzig [12], we introduce additional terminology. A vertex in an edge-colored multigraph is balanced if no color appears on more than half of the edges incident with the vertex, and even if it is of even degree. We say that an edge-colored graph is PC Euler if it contains a PC Euler trail. Theorem 1. [12] An edge-colored multigraph G is PC Euler if and only if G is connected and every vertex of G is balanced and even. Benkouar et al. [6] described a polynomial-time algorithm to find a PC Euler trail in an edge-colored multigraph, if it contains one. Studying DNA physical mapping, Pevzner [17] came up with a simpler polynomial-time algo- rithm solving the same problem. In this paper, we consider the Chinese Postman Problem on edge-colored graphs (CPP-ECG): given a connected edge-colored multigraph G with non- negative weights on its edges, find a PC closed walk in G which traverses all edges of G and has the minimum weight2 among such walks. Observe that to solve CPP-ECG, it is enough to find a PC Euler edge- colored multigraph G∗ of minimum weight such that V (G∗) = V (G) and for every pair of distinct vertices u, v and color i, G∗ has p∗ > 0 parallel edges between vertices u and v of color i if and only if G has at least one and at most p∗ edges of color i between u and v. (To find the actual walk, we can use the algorithm from [6] or [18].) CPP-ECG is a generalization of the PC Euler trail problem as an instance G has a PC Euler trail if and only if G∗ = G. CPP-ECG is also a generaliza- tion of the Chinese Postman Problem (CPP) on both undirected and directed multigraphs (the arguments are the same as for PC walks above). However, 2The weight of a walk is the sum of the weights of its edges. 2 while CPP on both undirected and directed multigraphs has a solution on every connected multigraph G, it is not the case for CPP-ECG. Indeed, there is no solution on any connected edge-colored multigraph containing a vertex incident to edges of only one color. It is not hard to solve CPP on undirected and directed multigraphs [11]. For a directed multigraph G, we construct a flow network N by assigning lower bound 1, upper bound ∞ and cost ω(uv) to each arc uv, where ω(uv) is the weight of uv in G. A minimum-cost circulation in N viewed as an Euler directed multigraph corresponds to a CPP solution and vice versa. For an undirected multigraph G, we construct an edge-weighted complete graph H whose vertices are odd degree vertices of G and the weight of an edge xy in H equals the minimum weight path between x and y in G. Now find a minimum- weight perfect matching M in H and add to G a minimum-weight path of G between x and y for each edge xy of M . The resulting Euler multigraph corresponds to a CPP solution and vice versa. We will prove that CPP-ECG is polynomial-time solvable as well. Note that our proof is significantly more complicated than that for CPP on undi- rected and directed graphs. As in the undirected case, we construct an aux- iliary edge-weighted complete graph H and seek a minimum-weight perfect matching M in it. However, the construction of H and the arguments justi- fying the appropriate use of M are significantly more complicated. This can partially be explained by the fact that CPP-ECG has no solution on many edge-colored multigraphs. Note that there is another generalization of CPP on both undirected and directed multigraphs, namely, CPP on mixed multigraphs, i.e., multigraphs that may have both edges and arcs. However, CPP on mixed multigraphs is NP-hard [16]. It is fixed-parameter tractable when parameterized by both number of edges and arcs [5, 9] and W[1]-hard when parameterized by path- width [10]. For more information on the classical and parameterized complex- ity of CPP and its generalizations, see an excellent survey by van Bevern et al. [5]. 2 Preliminaries Walks. A walk in a multigraph is a sequence W = v1e1v2 . . . vp−1ep−1vp of alternating vertices and edges such that vertices vi and vi+1 are end-vertices of edge ei for every i ∈ [p − 1]. A walk W is closed (open, respectively) if v1 = vp ( v1 6= vp, respectively). A trail is a walk in which all edges are distinct. For technical reasons we will consider walks with fixed end vertices and call them fixed end-vertex (FEV) walks. Note that an open walk is necessarily an FEV walk since the end-vertices are predetermined, whereas any vertex 3 in a closed walk can be viewed as its two end-vertices and thus fixing such a vertex is somewhat similar to assigning a root vertex in a tree. An FEV walk W = v1e1v2 . . . vp−1ep−1vp is PC in an edge-colored graph if the colors of ei and ei+1 are different for every i ∈ [p − 2]. Note that we do not require that colors of ep−1 and e1 are different even if v1 = vp. Thus, a PC FEV walk might not be a PC walk if v1 = vp. Let e = xy be an edge in an edge-colored multigraph G. The operation of double subdivision of e replaces e with an (x, y)-path Pe with three edges such that the weight of Pe equals that of edge e. It is easy to see that in our study of PC walks, we may restrict ourselves to graphs rather than multigraphs. Indeed, it suffices to double subdivide every parallel edge e and assign the original color of e to the first and third edges of Pe and a new color to the middle edge. Finding PC FEV walks. Let R+ denote the set of non-negative real num- bers. To show a polynomial-time algorithm for CPP-ECG, we will use the following: Lemma 1. Let G = (V, E) be a k-edge-colored graph and ω : E → R+ a weight function. Let vertices u, v ∈ V and edge colors c1, c2 be given, where we may have u = v. In polynomial time we can find a minimum-weight PC FEV walk from u to v in G whose first edge has color c1 and whose last edge has color c2, or conclude that there is no such PC FEV walk in G. Proof. Define an auxiliary digraph H as follows. Let the vertex set of H be {(u, 0)} ∪ {(x, i) : x ∈ V, i ∈ [k]}. For every edge xy ∈ E, of color i, we add to H all arcs (x, j)(y, i) and (y, j)(x, i) where j ∈ [k], j 6= i. We also add an arc from (u, 0) to (z, c1) for every edge uz ∈ E of color c1. Every arc in H retains the weight of the corresponding edge in G. We claim that the minimum-weight PC FEV walk we seek in G corresponds to a minimum-weight directed path from (u, 0) to (v, c2) in H, which can be found in polynomial time, e.g., using Dijkstra's algorithm. On the one hand, let (x1, d1)(x2, d2) . . . (xℓ, dℓ) be a directed path in H such that (x1, d1) = (u, 0) and (xℓ, dℓ) = (v, c2). Then by construction, x1e2x2 . . . eℓxℓ, where ei is an edge between xi−1 and xi of color di, is a PC FEV walk in G with required properties. On the other hand, consider a minimum-weight PC FEV walk W in G with the properties requested. Ori- ent the edges of the walk away from u. We may assume that no vertex has two in-coming directed edges in the walk of the same color, as the walk could otherwise be shortened. As above it is not hard to verify that the walk corre- sponds to a directed path P in H from (u, 0) to (v, c2). By construction, the weight of P equals that of W . It remains to observe that P is a minimum- weight directed path from (u, 0) to (v, c2), as otherwise there is a PC FEV 4 u1 u4 u2 u3 color 3 color 2 color 1 Figure 1: 3-edge-colored graph G walk between u and v with required edge colors of weight smaller than W , a contradiction. Finally, we observe that the construction works without modification if u = v. 3 Main Result We are now ready to prove the main result. Theorem 2. We can solve CPP-ECG in polynomial time. Proof. Let G be an input of CPP-ECG. That is, G is a connected k-edge- colored graph with at least one edge. We may assume that no vertex of G is incident with edges of a single color only (G cannot have PC closed walks through such vertices). We may also assume that k ≥ 2 is odd (if not, we double subdivide an edge e of G and assign a new color to the middle edge of Pe and the original color of e to the other two edges). For a vertex u ∈ V (G) and color i ∈ [k], let di(u) be the number of edges incident with u of color i. Let d(u) (= Pk i=1 di(u)) be the degree of u in G. We say that color i is dominant for u in G if 2di(u) > d(u); note that a vertex has at most one dominant color, and is balanced if and only if it has no dominant color. We now show how to construct, in polynomial time, an undirected graph H such that H has a perfect matching if and only if G has a PC closed walk traversing all edges of G, and the minimum weight of a perfect matching in H is equal to the minimum weight of such a walk in G minus the weight of G. As computing a minimum-weight perfect matching can be done in polynomial time, the claim follows. An example is shown in Figures 1 and 2. We will build the undirected graph H as follows. Define θi(u) as follows: θi(u) = max{0, d(u) − 2di(u)}. Let Xi(u) be a set of independent vertices of size θi(u) and let X(u) = i=1 Xi(u). We now consider the cases when u is balanced and when u is not Sk balanced, separately. 5 X3(u1) X(u2) artificial edge non-artificial edge Y (u1) X2(u1) X2(u3) X(u4) X3(u3) Y (u3) Figure 2: Constructed graph H from the graph of Figure 1. Some edges, including artificial edges within X(u2) and X(u4), are omitted for clarity. Case 1: u is not balanced. Let Y (u) be a set of (k − 2)d(u) independent vertices and add all possible edges between Y (u) and X(u) and all possible edges within Y (u). Let the weight of all these edges be zero and let us call them artificial edges. Let Z(u) = X(u) ∪ Y (u). Case 2: u is balanced. Add all possible edges within X(u). Let the weight of all these edges be zero and let call them artificial edges. Let Z(u) = X(u). For every pair a ∈ Xi(u) and b ∈ Xj(v) of distinct vertices such that ab is not an artificial edge, i, j ∈ [k] and u, v ∈ V (G) (we may have i = j and/or u = v), add an edge between a and b with the weight equal to that of a minimum-weight PC FEV walk from u to v in G, starting in color i and ending in color j if one exists, otherwise add no edge ab; this can be computed in polynomial time by Lemma 1. This completes the description of H. Assume that H has a perfect matching and M is a minimum-weight perfect matching in H. We will show that the weight of M plus the weight of all edges in G is the weight of an optimal solution to the CPP-ECG instance. We begin with an observation about the structure of M . Claim 1. We say that a vertex a ∈ X(u) for some u ∈ V (G) is affected by M if a is incident with a non-artificial edge in M . Then M has the following properties. 6 1. If u is unbalanced with dominant color i ∈ [k], then at least 2di(u) − d(u) vertices of X(u) are affected by M . Furthermore Xi(u) = ∅. 2. If d(u) is odd, then an odd number of vertices of X(u) are affected by M . 3. If d(u) is even, then an even number of vertices of X(u) are affected by M . Furthermore, for any matching M0 in H with no artificial edges that has the above properties, M0 can be completed to a perfect matching by adding artificial edges. Proof. 1. Assume that u is unbalanced with dominant color i, i.e., 2di(u) > d(u), i ∈ [k]. Then necessarily, 2dj (u) < d(u) for every other color j ∈ [k], hence θj(u) = d(u) − 2dj (u) if i 6= j, whereas θi(u) = 0. Thus X(u) = X j6=i (d(u) − 2dj (u)) = (k − 2)d(u) + (2di(u) − d(u)), where the last equality uses Pj6=i d(u) = (k − 1)d(u) and Pj6=i dj(u) = d(u) − di(u). Artificial edges on X(u) can only match vertices of X(u) against Y (u). Since Y (u) = (k − 2)d(u) < X(u), this leaves at least X(u) − Y (u) = 2di(u)−d(u) vertices in X(u) which must be affected by M . Finally, Xi(u) = ∅ since θi(u) = 0. 2 and 3. Assume first that u is unbalanced, so there is a set of vertices Y (u). Since k is odd, the parity of Y (u) matches the parity of d(u), hence an odd (resp. even) number of vertices of X(u) are matched against Y (u) if and only if d(u) is odd (resp. even). Now, as calculated in the previous paragraph, X(u) = (k − 3)d(u) + 2di(u), which is always even. Furthermore, the affected vertices of X(u) are exactly those not matched against Y (u). The claim follows. Finally, if u is balanced, then X(u) = Pj(d(u) − 2dj(u)) = (k − 2)d(u), which again has the same parity as d(u). Since every artificial edge matches two vertices of X(u), and the remaining vertices are exactly the affected ver- tices in X(u), the claim follows. Completing a non-perfect matching. Let M0 be a matching in H such that for every vertex u, (1) if u has a dominant color i, then at least 2di(u) − d(u) vertices of X(u) are affected by M0, and (2) an odd number of vertices of X(u) are affected by M0 if and only if d(u) is odd. By the above, the second point here implies that the number of unmatched vertices of Z(u) is even for every vertex u. If u is balanced, then Z(u) = X(u) is a clique and we can add artificial edges from the clique. If u is unbalanced, then Y (u) is entirely unmatched, and by the first point here, the number of unmatched vertices in X(u) is at most Y (u). Hence the completion is possible. 7 Let u and v be vertices of G and let i and j be colors. Let e = ab be an arbitrary non-artificial edge in H, with a ∈ Xi(u) and b ∈ Xj(v), where we may have u = v and/or i = j. An e-walk is a PC FEV walk in G, starting at u with an edge of color i, and ending at v with an edge of color j. We will show the theorem in two parts. First, we will show that for any perfect matching M ′ of H, if we add an e-walk to G for every non-artificial edge e ∈ M ′, then the resulting multigraph G′ is PC Euler. Here, to add an e-walk to G means to duplicate every edge along the walk, duplicating an edge multiple times if it occurs in the walk multiple times. Second, we show that for any PC Euler graph G′ = (V, E ∪ W ), obtained by duplicating edges in E, there exists a perfect matching M ′ of H such that W can be decomposed into a set F of e-walks, where there is an e-walk in F if and only if e is a non-artificial edge in M ′. This will settle the result. We need an observation about the effect of adding an e-walk to a graph. Claim 2. Let e ∈ H be a non-artificial edge. Adding an e-walk F to G has the following effects. 1. For any vertex u, the parity of d(u) changes if and only if F is open and u is either its first or last vertex. 2. If u ∈ V (G) is neither the first nor the last vertex of the walk, then for every i ∈ [k], the value of d(u) − 2di(u) is non-decreasing in the process. 3. If F is closed, let u be its end-vertex, and let i (j, respectively) be the colors of its first (last, respectively) edges. Then for any c ∈ [k], the value of d(u) − 2dc(u) increases by at least 2 if c /∈ {i, j}; is non-increasing if c ∈ {i, j} and i 6= j; and decreases by at most 2 if i = j = c. 4. If F is open, let u be an end-vertex of F , without loss of generality, the first one. Let i be the color of the first edge. Then for any j ∈ [k], the value of d(u) − 2dj(u) decreases by at most one if j = i, and increases by at least one, otherwise. Proof. The first item is easy. For the second item, we just observe that a single transition through u increases d(u) by 2 and di(u) by at most 1. Since the graph has no loops, the local effect on u of duplicating F decomposes into transitions, hence the second item holds. By the same argument, if u is an endpoint of F , then all visits to u except the first and/or last one decompose into transitions. This leaves only the first and last edges of F , and their effects on the end-vertices of F , to consider. The claims in items 3 and 4 follow by considering all possibilities for these two edges. We are now ready to show the first part of the theorem, as announced above. Let M ′ be an arbitrary perfect matching in H, and let G′ be the result 8 of adding an arbitrary e-walk, which has the same weight as edge e, to G for every non-artificial edge e ∈ M ′. We will show that G′ is PC Euler. By Theorem 1, we need to show three conditions: G′ is connected, every vertex in G′ is even, and every vertex in G′ is balanced. The first condition follows since G is connected; the second condition follows from Claim 1(2–3) and Claim 2(1). It remains to show that every vertex is balanced in G′, i.e., for every u ∈ V (G) and every i ∈ [k], it holds in G′ that d(u) ≥ 2di(u). We break this down into two cases. Case 1: i is the dominant color for u in G. In this case, d(u) − 2di(u) < 0 in G, and we need to show that this value is nonnegative in G′. By Claim 1(1), at least 2di(u)− d(u) vertices of X(u) are affected by M ′, and since Xi(u) = ∅, Claim 2 gives that the value of d(u) − 2di(u) increases by at least 1 for every such vertex, and never decreases. Thus d(u) ≥ 2di(u) in G′. Case 2: i is not a dominant color for u in G. In this case, Xi(u) = d(u) − 2di(u) ≥ 0, and we need to show that this value is nonnegative in G′. By Claim 2, the value of d(u) − 2di(u) decreases by at most as much as the number of vertices in Xi(u) affected by M ′, in the sense of the term used in Claim 1. Since there are only d(u) − 2di(u) such vertices, we see that d(u) ≥ 2di(u) also in G′. Hence we conclude that d(u) ≥ 2di(u) in G′ for every u ∈ V (G) and every i ∈ [k], hence every vertex is balanced. This concludes the proof that G′ has a PC Euler trail. Clearly, the weight of this trail is equal to the total weight of E(G) plus the sum of the weight of the added e-walks, where the latter part is exactly the weight of M ′. Now assume that CPP-ECG on G has a solution, a PC closed walk Q in G, and let G′ be the graph obtained from G by replacing every edge e = xy by qe parallel edges with vertices x and y, where qe is the number of times Q traverses e. Let W = E(G′) \ E(G), i.e., W are the edges that are added to G in order to get the PC Euler multigraph G′. We will find a perfect matching in H with total weight at most the sum of the weights of edges in W . This will complete the proof. We initially define a set W ′ of walks as the set of one-edge walks xey, where e = xy ∈ W . We will merge walks in W ′ until we can map the remaining walks W ′ to a matching M0 in H meeting the requirements of Claim 1, at which point we will be done. Here to merge two walks is to replace the walks u1e1u2 . . . eℓ−1uℓ and v1f1v2 . . . fh−1vh, where uℓ = v1 = u, with the walk u1e1u2 . . . eℓ−1uf1v2 . . . fh−1vh. For u ∈ V (G) and i ∈ [k], let wi(u) denote the number of times that u is an end-vertex of a walk in W ′ and that walk ends in u with color i. Here we do not assume a fixed "first" and "last" vertex, and thus the walks u1e1u2 . . . el−1ul and ulel−1ul−1 . . . e1u1 are the same. Note that we will allow walks in W ′ to start and end in the same vertex, in which 9 case one walk may contribute to wi(u) twice. By Claim 1, we need to ensure that 1. wi(u) ≤ θi(u) = Xi(u) for every u ∈ V (G) and i ∈ [k] (so that W ′ corresponds to a matching); 2. Pj∈[k]\{i} wj(u) ≥ 2di(u)−d(u) for every vertex u with a dominant color i in G; and 3. the parity condition is met for every vertex u. Because G′ has a PC closed walk traversing all edges, and by Theorem 1, we have that initially W ′ satisfies the following: 4. Pj∈[k] wj(u) + d(u) ≥ 2wi(u) + 2di(u) for every vertex u ∈ V (G) and integer i (since G′ is balanced); 5. Pj∈[k] wj(u) is even if and only if d(u) is even i.e. the parity condition is met (since G′ is even, and hence d(u) + Pj∈[k] wj(u) is even). We note that Condition 4 implies Condition 2 and Condition 5 implies Con- dition 3. As long as Condition 1 is not satisfied, we will modify W ′ by merging walks in such a way that Condition 4 and Condition 5 are still satisfied. As each merging reduces the number of walks in W ′, we must eventually stop with a set of walks W ′ satisfying Condition 1, Condition 2 and Condition 3. So now assume that Condition 1 is not satisfied and let u ∈ V (G) be a vertex such that wi(u) > θi(u) for some i ∈ [k]. If wi(u) > d(u) − 2di(u), then we must have that wc(u) > 0 for some c 6= i, as otherwise 2wi(u) + 2di(u) > wi(u)+d(u) = Pj∈[k] wj(u)+d(u), a contradiction to Condition 4. Thus there are at least two colors c with wc(u) > 0. We will choose two colors h, j, with wh(u) > 0, wj (u) > 0, h 6= j (i is not necessarily in {j, h}), and merge a walk ending at u with color h with a walk ending at u with color j. (If this makes us merge both endvertices of the same walk, we may simply remove the walk). It is clear that the new walk is still PC, and this operation reduces the number of walks in W ′. As we have reduced wh(u) and wj(u) by 1, and the other values are unaffected, it is clear that Condition 5 is still satisfied. We now show how to choose h, j in such a way that Condition 4 is still satisfied. Let us call a color c at risk if Pj∈[k] wj(u) + d(u) ≤ 2wc(u) + 2dc(u) + 1 (informally, a color is "at risk" if removing two edges of other colors would lead that color to dominate u). As Pj∈[k] wj(u) + d(u) is necessarily even and Pj∈[k] wj(u) + d(u) ≥ 2wc(u) + 2dc(u) , we have that in fact Pj∈[k] wj(u) + d(u) = 2wc(u) + 2dc(u) for any at risk color c. Furthermore, we note that 10 at most two colors in [k] can be at risk. Indeed, suppose that distinct colors c1, c2, c3 ∈ [k] are at risk. Then 2wc1(u)+2dc1 (u)+2wc2 (u)+2dc2 (u)+2wc3 (u)+ 2dc3(u) = 3(Pj∈[k] wj(u) + d(u)) > 2(Pj∈[k] wj(u) + d(u)) ≥ 2(wc1 (u) + wc2(u) + wc3(u) + dc1(u) + dc2(u) + dc3(u)), a contradiction. Next, suppose for a contradiction that wc(u) = 0 for an at risk color c. Then 2dc(u) = d(u) + Pj∈[k] wj(u) and so 2di(u) ≤ 2d(u) − 2dc(u) = d(u) − Pj∈[k] wj(u). Then wi(u) > θi(u) ≥ d(u) − 2di(u) ≥ d(u) − d(u) + Pk∈[k] wj(u) ≥ wi(u), a contradiction. Thus, wc(u) > 0 for any at risk color c. We now know that there at least two colors c with wc(u) > 0, there are at most 2 at risk colors, and if color c is at risk then wc(u) > 0. We can therefore select two distinct colors h, j with wh(u) > 0, wj(u) > 0, such that any at risk color is contained in {h, j}. We now merge a walk ending with color h at u and a walk ending with color j at u, as described above. This has the effect of reducing each of wh(u) and wj(u) by 1, and leaving wc(u) unchanged for c ∈ [k] \ {h, j}. We now show that we still have Pj∈[k] wj(u) + d(u) ≥ 2wc(u)+2dc(u) for any c ∈ [k]. If c ∈ {h, j}, then both Pj∈[k] wj(u)+d(u) and 2wc(u)+2dc(u) are reduced by 2, so the condition still holds. If c /∈ {h, j}, then as c was not at risk we originally had Pj∈[k] wj(u)+d(u) ≥ 2wc(u)+2dc(u)+2. As Pj∈[k] wj(u)+ d(u) is reduced by 2, we will still have Pj∈[k] wj(u)+ d(u) ≥ 2wc(u) + 2dc(u), as required. We continue the above process until there is no u ∈ V (G), i ∈ [k] for which Condition 1 fails. We therefore have that Conditions 1, 4 and 3 hold, which in turn implies Conditions 2 and 3 hold. Convert W ′ to a matching M0 in H by adding for every walk F an edge e to M0 such that F is an e-walk. This is possible since wi(u) ≤ θi(u) = Xi(u) for every i ∈ [k], u ∈ V (G). The weight of M0 is at most the weight of W , since every edge e added to M0 this way has a weight corresponding to a minimum-weight e-walk where F is just one possible e-walk. By Claim 1 we can complete M0 to a perfect matching M ′ by adding artificial edges, which does not increase the weight. Hence H admits a perfect matching whose weight is at most the weight of W . So in all cases we can find a perfect matching in H with weight exactly the weight of all the (non-closed) walks in W ′. As we have already shown that a perfect matching in H gives rise to a solution to CPP-ECG on G where duplicated edges add the same weight as the weight of the matching, we are done. 4 Conclusion We considered the Chinese Postman Problem on edge-colored graphs (CPP- ECG). This problem generalizes the Chinese Postman Problem on undirected 11 and directed graphs and the properly colored Euler trail problem on edge- colored graphs, all of which can be solved in polynomial time. We proved that CPP-ECG is still polynomial time solvable. It is well-known that the number of Euler trails on digraphs can be cal- culated in polynomial time using the so-called BEST theorem [23, 1], named after de Bruijn, van Aardenne-Ehrenfest, Smith and Tutte. However, the problem is much harder on undirected graphs as it is #P-complete [24]. Our simple transformation from directed walks to PC walks described in Section 1, shows that the problem of counting PC Euler trails on 2-edge-colored graphs generalizes that of counting the number of Euler trails on digraphs. Assigning each edge of an undirected graph a distinct color, shows that the problem of counting PC Euler trails on k-edge-colored graphs is #P-complete when k is unbounded. So it would be interesting to determine the complexity of the problem of counting PC Euler trails on a k-edge-colored graphs when k is bounded, in particular when k = 2. Acknowledgments. We are thankful to the referees for careful reading of the paper and several useful suggestions. Research of GG was partially supported by Royal Society Wolfson Research Merit Award. Research of BS was partially supported by China Scholarship Council. References [1] T. van Aardenne-Ehrenfest and N. G. de Bruijn, Circuits and trees in oriented linear graphs, Simon Stevin 28 (1951) 203–217. [2] A. Abouelaoualim, K. Ch. Das, W. Fernandez de la Vega, M. Karpinski, Y. Manoussakis, C. A. Martinhon, and R. Saad, Cycles and paths in edge- colored graphs with given degrees, J. Graph Theory 64 (1) (2010) 63–86. [3] S.K. Ahuja, Algorithms for Routing and Channel Assignment in Wireless Infrastructure Networks, PhD thesis, Univ. Arizona, 2010. [4] J. Bang-Jensen and G. Gutin, Digraphs: Theory, Algorithms and Applica- tions, 2nd Ed., Springer-Verlag, London, 2009. [5] R. van Bevern, R. Niedermeier, M. Sorge and M. Weller. Complexity of Arc Routing Problems. In Arc Routing: Problems, Methods and Applications (A. Corber´an and G. Laporte, eds.), SIAM, 2014. [6] A. Benkouar, Y. Manoussakis, V. Paschos and R. Saad, On the complexity of finding alternating hamiltonian and Eulerian cycles in edge-coloured graphs. Lect. Notes Comp. Sci. 557 (1991) 190–198. 12 [7] H. Fleischner, G. Sabidussi, and E. Wenger, Transforming Eulerian trails. Discrete Math. 109(1) (1992)103–116. [8] S. Fujita and C. Magnant, Properly colored paths and cycles. Discrete Appl. Math. 159 (14) (2011) 1391–1397. [9] G. Gutin, M. Jones and B. Sheng, Parameterized Complexity of the k-Arc Chinese Postman Problem. Lect. Notes Comput. Sci. 8737 (2014) 530–541. [10] G. Gutin, M. Jones and M. Wahlstrom, Structural Parameterizations of the Mixed Chinese Postman Problem. Lect. Notes Comput. Sci. 9294 (2015) 668–679. [11] B. Korte and J. Vygen, Combinatorial Optimization: Theory and Algo- rithms. 3rd Ed., Springer, 2005. [12] A. Kotzig, Moves without forbidden transitions in a graph, Math. Fyz. Cazopis 18 (1968) 76–80. [13] A. Lo, Properly coloured Hamiltonian cycles in edge-coloured complete graphs. Combinatorica, doi: 10.1007/s00493-015-3067-1 (online). [14] A. Lo, A Dirac type condition for properly coloured paths and cycles, J. Graph Theory 76 (1) (2014) 60–87. [15] A. Lo, An edge-coloured version of Dirac's theorem, SIAM J. Discrete Math. 28 (1) (2014) 18–36. [16] C. H. Papadimitriou. On the complexity of edge traversing. J. ACM 23 (1976) 544–554. [17] P.A. Pevzner, DNA physical mapping and alternating Eulerian cycles in colored graphs. Algorithmica 13 (1995) 77–105. [18] P.A. Pevzner, Computational Molecular Biology: an algorithmic ap- proach. MIT Press (2000). [19] S Sankararaman, A Efrat, S Ramasubramanian, On channel- discontinuity-constraint routing in wireless networks, Ad Hoc Networks 134 (2014) 153–169. [20] M. Szachniuk, M. Popenda, R.W. Adamiak and J. Blazewicz, An assign- ment walk through 3D NMR spectrum. in: Proc. 2009 IEEE Symposium on Computational Intelligence in Bioinformatics and Computational Biol- ogy (2009) 215–219. 13 [21] M. Szachniuk, M.C. De Cola and G. Felici, The orderly colored longest path problem – a survey of applications and new algorithms. RAIRO-Oper. Res. 48 (2014) 25–51. [22] I.L. Tseng, H.W. Chen and C.I. Lee, Obstacle-aware longest path routing with parallel MILP solvers. in: Proc WCECS-ICCS vol. 2 (2010) 827–831. [23] W. T. Tutte and C. A. B. Smith, On unicursal paths in a network of degree 4, American Mathematical Monthly 48 (1994) 233–237. [24] G. R. Brightwell and P. Winkler, Note on Counting Eulerian Circuits. CDAM Research Report LSE-CDAM-2004-12, 2004. 14
1508.05143
2
1508
2016-04-05T21:00:07
A Discrete and Bounded Envy-free Cake Cutting Protocol for Four Agents
[ "cs.DS", "cs.GT" ]
We consider the well-studied cake cutting problem in which the goal is to identify a fair allocation based on a minimal number of queries from the agents. The problem has attracted considerable attention within various branches of computer science, mathematics, and economics. Although, the elegant Selfridge-Conway envy-free protocol for three agents has been known since 1960, it has been a major open problem for the last fifty years to obtain a bounded envy-free protocol for more than three agents. We propose a discrete and bounded envy-free protocol for four agents.
cs.DS
cs
A Discrete and Bounded Envy-Free Cake Cutting Protocol for Four Agents Haris Aziz Simon Mackenzie Data61 and UNSW Sydney, Australia {haris.aziz, simon.mackenzie}@data61.csiro.au 6 1 0 2 r p A 5 ] S D . s c [ 2 v 3 4 1 5 0 . 8 0 5 1 : v i X r a ABSTRACT We consider the well-studied cake cutting problem in which the goal is to identify an envy-free allocation based on a min- imal number of queries from the agents. The problem has attracted considerable attention within various branches of computer science, mathematics, and economics. Although, the elegant Selfridge-Conway envy-free protocol for three agents has been known since 1960, it has been a major open problem to obtain a bounded envy-free protocol for more than three agents. The problem has been termed the cen- tral open problem in cake cutting. We solve this problem by proposing a discrete and bounded envy-free protocol for four agents. Categories and Subject Descriptors F.2 [Theory of Computation]: Analysis of Algorithms and Problem Complexity; I.2.11 [Distributed Artificial Intelligence]: Multiagent Systems; J.4 [Computer Ap- plications]: Social and Behavioral Sciences - Economics General Terms Algorithms, Theory, Economics Keywords Fair Division, Elicitation Protocols, Multiagent Resource Al- location, Cake cutting 1. INTRODUCTION Cake cutting is a metaphor for the allocation of a het- erogeneous divisible good among multiple agents with pos- sibly different preferences over different parts of the cake. Its main application is fair scheduling, resource allocation, and conflict resolution [13] and hence it has been exten- sively studied within computer science [27] and the social sciences [36]. Since various important divisible resources such as time and land can be captured by cake cutting, the problem of fairly dividing the cake is a fundamental one within the area of fair division and multiagent resource al- location [6, 17, 26, 29, 33, 35, 36]. Formally speaking, a cake is represented by an interval [0, 1] and each of the n agents has a value function over pieces of the cake that specifies how much that agent val- ues a particular subinterval. The main aim is to divide the cake fairly. In particular, an allocation should be envy-free so that no agent prefers to take another agent's allocation instead of his own allocation. Although an envy-free alloca- tion is guaranteed to exist even with n − 1 cuts [35]1, finding an envy-free allocation is a challenging problem which has been termed "one of the most important open problems in 20th century mathematics" by Garfunkel [16]. Motivation and Contribution. Unlike allocation of indivisible items [12], the number of possible allocations in cake cutting is infinite. Since the valu- ations of agents over the subsets of the cake can be complex, it is not practiceable to elicit each agent's complete valua- tions function over the cake. A natural approach in cake cutting protocols to query agents about their valuations of different portions of the cake and based on these queries, propose an allocation. A cake cutting protocol is envy-free if each agent is guaranteed an envy-free piece if he reports his real valuations. For the case of two agents, the problem has a well-known solution in the form of the Divide and Choose protocol: one agent is asked to cut the cake into equally preferred pieces and the other agent is asked to choose the preferred piece. The protocol even features in the Book of Genesis (Chap- ter 13) where Abraham divides the land of Canaan and Lot chooses first. In modern times, the protocol has been en- shrined in the Convention of the Law of the Sea (Page 10, [6]). For the case of three agents, an elegant and bounded protocol was independently discovered by John L. Selfridge and John H. Conway around 1960 (Page 116, [6]). Since then, an efficient envy-free protocol for four or more agents has eluded mathematicians, economists, and computer sci- entists. In 1995, Brams and Taylor [5] made a breakthrough by presenting an envy-free protocol for any number of agents [18]. Although the protocol is guaranteed to ter- minate in finite time, there is one critical drawback of the protocol: the running time or number of queries and even the number of cuts required is unbounded even for four 1The existence of an envy-free cake allocation can be shown via an interesting connection with Sperner's Lemma [35]. agents. In other words, the number of queries required to identify an envy-free allocation can be arbitrarily large for certain valuations functions. If a protocol is not bounded, then its practicality is compromised [21]. Procaccia [27] terms unboundedness as a "serious flaw". Brams and Taylor were cognizant of their protocol's drawback and explicitly mentioned the problem of proposing a bounded envy-free protocol even for n = 4. Lindner and Rothe [21] write that "even for n = 4, the development of finite bounded envy-free cake-cutting protocols still appears to be out of reach, and a big challenge for future research." The prob- lem has remained open and has been highlighted in several works [2, 5, 6, 10, 14, 31, 19, 26, 27, 22, 29, 30]. Saberi and Wang [30] term the problem as "one of the most important open problems in the field" and Lindner and Rothe [22] men- tion the case for n = 4 as "the central open problem in the field of cake-cutting". In this paper, we present a discrete envy-free protocol for four agents that requires a bounded number of queries as well as cuts of the cake. The maximum number of cuts required is 203.2 Some of the techniques we use may be useful for cake cutting protocols with other prop- erties or for more agents. In particular, we propose a new technique (called permutation) in which by suitably reallo- cating portions of a partial allocation that is envy-free, we ensure that some agent will not be envious of another agent even if the unallocated cake is given to the latter agent. Related Work. Cake cutting problems originated in the 1940's when fa- mous mathematicians such as Banach, Knaster, and Stein- haus initiated serious mathematical work on the topic of fair division.3 Since then, the theory of cake cutting algorithms has become a full-fledged field with at least three books writ- ten on the topic [3, 6, 29]. The central problem within cake cutting is finding an envy-free allocation [15, 33]. Since the earliest works, mathematicians have been inter- ested in the complexity of cake cutting. Steinhaus [32] wrote that "Interesting mathematical problems arise if we are to determine the minimal number of cuts necessary for fair di- vision." When formulating efficient cake cutting protocols, a typical goal is to minimize the number of cuts while ig- noring the number of valuations queried from the agents. In principle, the actual complexity of a problem or a protocol depends on the number of queries. When considering how efficient a protocol is, it is useful to have a formal query model for cake-cutting protocols. Robertson and Webb [29] formalized a simple query model in which there are two kinds of queries: Evaluate and Cut. In an Evaluate query, an agent is asked how much he values a subinterval. In a Cut query, an agent is asked to identify an interval, with a fixed left endpoint, of a particular value. Although, the query model of Robertson and Webb is very simple, it is general enough to capture all known protocols in the liter- ature. Note that if the number of queries is bounded, it implies that the number of cuts is bounded in the Robert- son and Webb model. The protocol that we present in this 2Most of the 203 cuts are technically trims but in the Robertson and Webb model, any marking/trim on the cake is also treated as a proper cut. 3Hugo Steinhaus presented the cake cutting problems to the mathematical and social science communities on Sep. 17, 1947, at a meeting of the Econometric Society in Washing- ton, D.C. [29, 32]. paper uses a bounded number of queries in the Robertson and Webb model. Cake cutting protocols also provide an in- teresting connection between the literature on fair division and the field of communication complexity [20]. There is not too much known about the existence of a bounded envy-free protocol for n ≥ 4 except that any envy- free cake-cutting algorithm requires Ω(n2) queries in the Robertson-Webb model [25, 27]. Also, for n ≥ 3, there ex- ists no finite envy-free cake-cutting algorithm that outputs contiguous allocations [34]. Brams et al. [7] and Barbanel and Brams [4] presented envy-free protocols for four agents that require 13 and 5 cuts respectively. However, the proto- cols are not only unbounded but not even finite since they are continuous protocols that require the notion of a mov- ing knife. An alternative approach is to consider known bounded protocols and see how well they perform in terms of envy-freeness [21]. Apart from the unbounded Brams and Taylor envy-free protocol for n agents, there are other gen- eral envy-free protocols by Robertson and Webb [28] and Pikhurko [24] that are also unbounded. There are positive algorithmic results concerning envy- free cake cutting when agents have restricted valuations functions [13, 8] or when some part of the cake is left unallo- cated [30]. There has also been work on strategyproof cake cutting protocols for restricted valuation functions [1, 11, 23] as well as strategic aspects of protocols [9]. Structure of the Paper. In Section 2, the formal model is presented. In Section 3, we present an envy-free protocol for three agents that serves as a warm-up for the case of four agents. In Section 4, we presents the main protocol. The section is divided into subsections in which three different protocols (Post Dou- ble Domination Protocol, Core Protocol, and Permutation Protocol ) are described. These three protocols are used as building blocks to formulate the overall protocol. 2. PRELIMINARIES Model. We consider a cake which is represented by the interval [0, 1]. A piece of cake is a finite union of disjoint subsets of [0, 1]. We will make the standard assumptions in cake cutting. Each agent in the set of agents N = {1, . . . , n} has his own valuation function over subsets of interval [0, 1]. The valuations are (i) defined on all finite unions of the intervals; (ii) non-negative: Vi(X) ≥ 0 for all X ⊆ [0, 1]; (iii) additive: for all disjoint X, X ′ ⊆ [0, 1], Vi(X ∪ X ′) = Vi(X) + Vi(X ′); (iv) divisible i.e., for every X ⊆ [0, 1] and 0 ≤ λ ≤ 1, there exists X ′ ⊆ X with Vi(X ′) = λVi(X). We will call an allocation partial if there is some cake that is unallocated. A partial envy-free allocation is a partial allo- cation that is envy-free. In order to ascertain the complexity of a protocol, Robertson and Webb presented a computa- tional framework in which agents are allowed to make two kinds of queries: (1) for given x ∈ [0, 1] and r ∈ R+, Cut query asks an agent to return a point y ∈ [0, 1] such that Vi([x, y]) = r (2) for given x, y ∈ [0, 1], Evaluate query ask agent to return a value r ∈ R+ such that Vi([x, y]) = r. A cake-cutting protocol specifies how agents interact with queries and cuts. A protocol is envy-free if no agent is en- vious if he follows the protocol truthfully. All well-known 1 2 3 1 2 γ β 2 1 3 Initially allocated cake Figure 1: Example of a trim. Agents 1 and 2 trim their most preferred piece (the left most piece) to the value equal to that of their second most pre- ferred piece. In this instance, agent 2 trims more than agent 1, hence his trim is to the right of agent 1's trim. Let us assume agent 1 and 3 each get a complete piece with 1 getting his second most pre- ferred piece. Agent 2 is not envious of other agents if he gets the right side of the trimmed piece up till his trim. If agent 2 gets the part to the right of agent 1's trim instead of his own trim, then he is even happier. We will refer to this extra bit γ as the 'bonus' for agent 2. Agent 1 is still not envious of agent 2 if 2 gets the bonus. cake cutting protocols can be analyzed in terms of number of queries required to return a fair allocation. A cake cut- ting protocol is bounded if the number of queries required to return a solution is bounded by a function of n irrespective of the valuations of the agents. Terms and Conventions. We now define some terms and conventions that we will use in the paper. Given a partial envy-free allocation of the cake and an unallocated residue β, we say that agent j dominates agent i if j does not become envious of i even if all of β were to be allocated to i. This concept has been referred to as i's irrevocable advantage in the cake cutting literature [6]. In the cake cutting protocols, we will describe, an agent may be asked to trim a piece of cake so that its value equals the value of a less valuable piece. Agents will be asked to trim various pieces of the cake so their remaining value is equal to the value of the third (or in some cases their second) most preferred complete piece. In Figure 1, we outline the idea of trimming a piece to equal the value of some other piece. When an agent trims a piece of cake, he will trim it from the left side: the main piece (albeit trimmed) will be on the the right side. The piece minus the trim will be called the partial main piece. The remainder will be referred to as the residue. If an agent trims a piece, we say he is competing for the piece. When we say an agent is guaranteed to get his second/third/etc most favoured piece, this guarantee is based on the ordinal preferences of the agents over the pieces. By ordinal, we mean that agents simply give a weak ordering over the pieces but do not tell the exact cardinal utility difference between two pieces. If an agent is indifferent between the top three pieces, then we will still say that the agent is guaranteed to get his third most valued piece. We introduce notation to represent which agents have trimmed which pieces. So for example 123123 represents the scenario where one piece has three trims (by agents 1,2,3) in any possible order and the other three pieces have one trim each by one of the agents 1, 2, 3. We may enrich this no- tation further as follows: 112131123 which represents that all agents think that the piece with the three trim marks is their most preferred or equivalently highest valued piece. 3. PROTOCOL FOR THREE AGENTS We warm-up by presenting a protocol (Algorithm 1) for Algorithm 1 Envy-free Protocol for 3 Agents. 1: Agent 3 divides the cake into 3 equally preferred pieces. 2: if 1 and 2 can each be given a different complete most preferred piece then 3: give that complete piece to the agent who prefers it the most and give remaining piece to 3 and return. 4: else 5: 1 and 2 trim their highest valued piece from the left side to make the right side of the trim equal to the value of second most preferred piece (they simultaneously put trim marks). 6: end if 7: if 1 and 2 trim the same piece then 8: consider β1, the remainder from the left extreme of the piece to the leftmost trim. The partial piece P 1 1 which is the most preferred piece except β1 is given to the agent i ∈ {1, 2} who trimmed the piece more (let the other agent be −i). Let γ1 be the part between the two trims of agent 1 and 2. Agent −i gets his second highest valued complete piece P 1 2 . Agent 3 gets the remaining complete piece. The unallocated cake is β1. ′ 9: end if 10: 3 cuts β1 into 3 equally preferred pieces. 11: 1 and 2 trim their highest valued piece from the left side to make it equal to the value of second best. 12: if 1 and 2 can be each be given a different complete most preferred piece then 13: give that complete piece to the agent who prefers it the most and give remaining piece to 3 and return. 14: else if 1 and 2 trim the same piece but −i trims at least as much as i then, 15: give −i the most preferred piece up till the leftmost trim, give i a complete second most preferred piece, and give 3 the remaining complete piece. 16: else if 1 and 2 trim the same piece but i trims more again then, 17: 18: ′ let β2 be the remainder from the left hand side to the first trim in β1. The partial piece P 2 which is the most preferred piece except β2 is given to the agent i. Let γ2 be the part between the two trims. Agent −i gets his second highest valued complete piece P 2 2 . Agent 3 gets the remaining complete piece. The only unallocated cake left if any is β2. 1 Since i again got a partial piece, i is asked to identify to the lesser preferred γj ∈ {γ1, γ2}. Then i gives P j agent −i and gets P j 2 in return. 1 ′ 19: end if 20: If some cake is still unallocated, Agent 1 and 2 perform Divide and Choose to allocate it. β1 β2 2 1 3 3 2 1 3 Figure 2: Protocol for 3 agent: In case agent 2 gets a trimmed piece two times, then we need to perform a permutation so that 1 gets a trimmed piece. n = 3 which we will extend to n = 4. Although the protocol requires more cuts than the Selfridge-Conway protocol, it bears similarities with it. It also depends on some ideas that we will exploit for our main protocol for four agents. The main idea of the protocol is that in each step, the cutter (agent 3) cuts the unallocated cake into 3 equally preferred pieces and gets one of the com- plete pieces. In each step, a partial envy-free allocation is maintained and then the remainder is again allocated which results in the remainder being fully allocated or a smaller re- mainder left. Note that when i 6= 3 is given the partial cake piece, agent 3 dominates i. When the remainder β1 in the first step is divided among the agents, if now 3 dominates −i, then 3 does not care how β1 is divided among i and −i since he dominates both. So 3 is in this sense 'eliminated' from the protocol and we can perform Divide and Choose for 1 and 2 on the unallocated cake. If 3 again dominates i based on how β1 is allocated, then we enforce a permu- tation or reallocation of some pieces of i and −i, so that 3 dominates −i (see Figure 2). Both the ideas of domination and permutation will feature prominently in our protocol for four agents. 4. PROTOCOL FOR FOUR AGENTS We now extend the ideas for the case of n = 3 to n = 4. The general flavour of the protocol is similar to that of the protocol for 3 agents. A designated cutter is asked to cut into equally preferred pieces. Based on some finer steps, we are able to achieve an envy-free allocation with possibly some cake still unallocated. We repeat the process on the remaining unallocated piece with the goal that the cutter dominates other agents just as we managed in the protocol for 3 agents. A few additional complications are introduced when dealing with 4 agents. Eliminating an agent would require being able to ensure that we can make an agent dominate all 3 others. Thankfully this is not necessary: we can show that we only need a protocol that ensures a given agent dominates 2 others. This is proved in the Double Domination Lemma. 4.1 Post Double Domination Protocol We now present the Post Double Domination Protocol (Algorithm 2) that takes as input a partial envy-free alloca- tion in which each agent dominates two agents and it returns a complete envy-free allocation. Algorithm 2 Post Double Domination Protocol Agents Input: A partial envy-free allocation and unallocated for 4 cake such that each agent dominates 2 other agents Output: Envy-free complete allocation. 1: There exists some agent 1 who dominates two other agents say 3 and 4. 2: if 2 also dominates 3 and 4 then 3: 3 and 4 can divide the remainder by Divide and Choose. 4: else if 2 does not dominate 3 and 4 then 5: it dominates 1 and one of 3 and 4 say 4. 6: if 3 dominates 4 then 7: give all the remainder to 4 (since everyone domi- nates 4). 8: 9: else if 3 does not dominate 4 and hence dominates 1 and 2 then then let 4 cut the residue into four equally preferred pieces, and agents 1, 2, 3 pick their most preferred re- maining piece in that order. end if 10: 11: end if 12: return Envy-free complete allocation. 3 1 4 2 Figure 3: The domination graph of the final case in the proof of the Double Domination Lemma. Lemma 1 (Double Domination Lemma). Suppose we have a bounded protocol which given a specified agent i and an unallocated piece of cake returns a partial envy-free allocation such that i dominates 2 other agents, then we can extend this into a 4 agent envy-free bounded protocol. Proof. If we have a bounded protocol in which one agent can be made to dominate two other agents, then we simply run it at most 4 times on any unallocated cake to ensure that each agent dominates two other agents. If while doing this, the cake is completely allocated, we are already done. Otherwise, we can run the Post Double Domination Protocol (Algorithm 2). We now argue for the correctness of the protocol. Assume 1 dominates 3 and 4. Now if 2 also dominates 3 and 4, then there exists a partial envy-free allocation in which even if all the residue is given to 3 or 4, then agent 1 and 2 will not be envious. All the residue can be divided among 3 and 4 using divide and choose. Agents 1 and 2 don't care because they dominate 3 and 4. The other case is when 2 does not dominate 3 and 4. Without loss of generality assume that 2 dominates 1 and 4. Now if 3 dominates 4, we are already done because the whole residue can be given to 4 since everyone dominates 4. If 3 does not dominate 4 but dominates 1 and 2, then the domination graph looks like in Figure 3, an envy-free allocation can be found via the following method: agent 4 cuts the residue into equally preferred four pieces, and agents 1, 2, 3 pick their most preferred remaining piece in that order. Agent 2 dominates 1 so does not care if 1 chooses first; agent 3 dominates 2 and 1 so that he does not care if 1 and 2 choose before him. Since we have shown that making an agent dominate two other agents is helpful, we will now explain how to achieve it. The overall protocol will first achieve double domination for each agent and if some cake is still unallocated, it will use the Post Double Domination Protocol. In order to get an agent to dominate other agents, we will repeat a core proto- col multiple times which gives a partial envy-free allocation. The core protocol is explained in the next section. 4.2 Core Protocol In the core protocol, a specified agent is asked to cut the cake into equally preferred pieces. The cutter gets a com- plete piece whereas the other agents may get partial pieces. The core protocol is recursively applied to the unallocated cake. After a bounded number of calls of the core proto- col, we are in a position to do some reallocation so as to ensure that the specified cutter dominates two agents. We can then repeat this for another specified agent until each agent dominates two other agents. We now give a high level description of the core protocol. Let us say that agent 4 divides the unallocated cake into 4 pieces. Agents 1, 2, and 3 are asked to trim the left hand side of their most preferred two pieces to make the right side of their trim equally valuable as their third most preferred cake piece. Each agent in set {1, 2, 3} trims at most two pieces. In case an agent is indifferent between two or more pieces, we will still assume that the agent trims one piece to make it equal to the other piece. The trim in this extreme case is a trivial trim that coincides with the left edge of the cake. Hence the four pieces have a total of six trims. If an agent who trims a piece most is given that piece (an agent who trims most two pieces can choose which piece to get), up to his trim point, then the agent is envy-free. In fact the agent is not envious even if each other agent who gets a piece is given the piece up till the second rightmost trim. This approach is useful to get a partial envy-free allocation with some cake unallocated. In the core protocol, we do some extra work so that apart from the cutter, at least one more agent is given a complete piece. In order to do this, in a couple of cases, we may ask one or two carefully identified agents to additionally trim their most preferred piece to the value of their second most preferred piece in which case the previous trims of these agents are ignored. This is helpful is ensuring that at least two agents get complete pieces. It may be the case that some cake is left unallocated in which case the core protocol may be implemented on the unallocated cake again. The main thing we will prove is that we do not need to implement the core protocol on the unallocated cake unbounded number of times. For this, we first show in the Core Protocol Lemma that the core protocol returns a par- tial envy-free allocation with the additional useful property that the cutter and one other agent get complete pieces. Lemma 2 (Core Protocol Lemma). For n = 4, there exists a discrete and bounded protocol which returns partial envy-free allocation in which one agent cuts the cake into four equally preferred pieces and the cutter as well as at least one other agent gets one of these four pieces. Algorithm 3 Core Protocol for 4 agents that returns a partial envy-free allocation Input: Output: Partial envy-free allocation. 1: Agent 4 is asked to cut the cake into 4 equal value pieces. 2: Agents 1, 2, 3 are asked to give their values for the 4 Specified cutter agent (say agent 4) pieces. 3: if each agent in {1, 2, 3} can be given a most preferred piece then 4: Allocate each agent in {1, 2, 3} a most preferred (com- plete) piece and the remaining complete piece to the cutter (agent 4). return the envy-free allocation. 5: 6: end if 7: Agents 1, 2, 3 are asked to trim the left hand side of their most and second most preferred pieces to make them (the right side of the trim) equally valuable as their third most preferred cake piece. 8: if no piece has exactly one trim then 9: if we are in a case ijjkik where {i, j, k} = {1, 2, 3}. then 10: 11: 12: Since we have already covered the case in which each agent can be given a complete most preferred piece, we end up in situation i1j1j2ki2k. Without loss of generality, the case is i1j1j2k1i2k2. In this case i and k are asked to trim their most preferred piece to their second most preferred piece whereas agent j is asked to trim his two most preferred pieces to equal his third most preferred piece. Agent i and k's trims up to their third most preferred piece are ignored. The effective trims look as follows now: ijjk. if j does not have the rightmost trim in both pieces then the right side of each piece with two trims is given to the agent who trimmed it the most. The piece is given up till the second rightmost trim. The remaining agent picks his most preferred complete unallocated piece and then 4 get the remaining unallocated piece. else if j trimmed both the pieces the most then j can choose which piece (up till the second rightmost trim) to get. The other piece with the trims is given to the agent with the second rightmost trim up till the second rightmost trim. The third non-cutter i or k gets his second most preferred piece completely. The last unallocated complete piece is given to agent 4. end if 13: 14: 15: else if we are in a case ijkijk where {i, j, k} = end if {1, 2, 3}. then 16: Ask each agent in {1, 2, 3} to trim this first and second most preferred piece from the left side to make the right hand side to the value of his third most preferred piece. Each agent is given the piece he trims the most up till the second rightmost trim. If the same agent has the rightmost trims for both pieces, he chooses which piece to get. The agent with second rightmost trim gets the other piece up till the second rightmost trim. The third non-cutter gets his third most piece completely. The last unallocated complete piece is given to agent 4. 17: end if {Continued on next page...} Proof. We argue that when agent 4 cuts the cake into equally preferred piece and then these pieces are partially allocated to the agents, then (1) the partial allocation is envy-free, and (2) the cutter and one other agent get com- plete pieces. If each agent in {1, 2, 3} can be given a most preferred piece, then both conditions are trivially met. Oth- erwise, the algorithm distinguishes between the following cases: (1) no piece has exactly one trim; (2) exactly one piece has exactly one trim; (3) exactly two pieces have ex- actly one trim; (4) exactly three pieces have exactly one trim. In each of the cases, one non-cutter gets a complete piece and the cutter is also given an unallocated complete piece. It remains to be shown that the partial allocation is envy- free. When an agent i gets a (possibly partial) piece a, he was the one who trimmed that piece the most. For each other piece b that is allocated, some other agent j trimmed b at least as much as agent i, i.e., j's trim in b was not left of i's trim. Hence i is not envious of j if j gets b up till j's trim from the right hand side. The reason is that i thinks that j's piece has more value than i's allocation only if j gets the right side of b beyond the trim of agent i. Thus, if i has the second rightmost trim in b, then i is not envious of j even if j gets the right side of b up till i's trim (e.g., see Figure 4). We note that in each of the four cases, when an agent i get a piece, he is not envious of another agent j because of the reason above. Moreover, if in piece a, the second rightmost trim is strictly to the left of i's trim in a or if there is no other trim in a, then i not only gets the right hand side of a up to i's trim but an additional bonus up till the second rightmost trim or the edge of the cake (whichever comes first). Hence, no agent i is envious of another agent j. Remark 1. As soon as the agents' ordinal ranking of the four pieces cut by the cutter are known, it can be ascertained whether in the core protocol, an agent is guaranteed to get a piece of value equal to his third or second most preferred piece. Each agent gets a piece that is of same value as his third most preferred piece. An agent is guaranteed to get a second most preferred piece during the core protocol, if he is asked in the worst case to trim his most preferred piece to his second most preferred piece. a b i i j Figure 4: Example of a scenario where i has the rightmost trim for piece a and second rightmost trim of piece b whereas agent j has the rightmost trim for piece b. If i gets the right hand side of a up till his trim, and j gets the right hand side of b till i's trim in b, then i is not envious of j's allocation. We make another observation about the outcome of the core protocol. 18: if exactly one piece has exactly one trim then {The trims look like iijkjk} 19: if the agent who trimmed it views it as his most pre- ferred then 20: 21: 22: 23: 24: Give the complete piece to him. else if the agent who trimmed it find it his second most preferred then ask him to trim his first most preferred to equal his second most preferred piece. end if The pieces are allocated up to the second rightmost trim to the agents who trimmed them most. If 2 pieces were trimmed most by the same agent, he decides which to get and the other is given to the agent who trimmed that piece second most. 25: Give the last unallocated piece completely to the cut- ter (agent 4). 26: end if 27: if exactly 2 pieces have exactly one trim then {The trims look like jkikij} 28: Give those pieces with exactly one trim completely to the agents in {1, 2, 3} who trimmed them if it is their most preferred. 29: 30: 31: Agents who trimmed a piece with a single trim but do not value that piece most are asked to re-trim their most preferred piece up to their second most preferred piece. Their trims to make them equal to their third most preferred ignored from now on. The right hand side of the two pieces with the two trims are given to the agents with the rightmost trims. The pieces are allocated up till the second rightmost trim. If the 2 pieces were trimmed most by the same agent (agent k), he choses which to get and the other piece is given to whoever trimmed it second most. If one non-cutter has not been allocated a piece, he gets the most preferred piece among the two unallocated complete pieces. 32: Give the last unallocated piece completely to the cut- ter (agent 4) 33: end if. 34: if exactly 3 pieces have exactly one trim then 35: 36: The trims look like 123123. If an agent most prefers the piece where he made a single trim, give him that complete piece. 37: 38: The ones who most prefer the piece with the three trims (call it a) compete for it by trimming up to their second most preferred piece. Their trims to make them equal to their most preferred ignored from now on. Cut a at the second rightmost trim, and then allocate a to whichever agent trimmed it most. The other agents get their second most preferred complete piece. 39: Give the cutter (agent 4) the remaining complete piece. 40: end if 41: return envy-free allocation and any cake that is still not allocated. Lemma 3. During the core protocol, when an agent i makes trims to equal his second or third most preferred piece respectively, i either gets such a piece completely or some other agent gets such a piece completely that i values as much as second or third most preferred piece respectively. Proof. Assume agent i is not the cutter in the core pro- tocol and he was asked to trim his first and second most preferred pieces to equal his third most preferred piece. If agent i gets the complete piece that is his third most pre- ferred piece, we are already done. Let us say that he got a partial piece. Then, at most one other agent got a partial piece. This means that some other agent j got a complete piece that is either agent i first, second or third most pre- ferred piece. Assume agent i is not the cutter in the core protocol and he was asked to trim his most preferred pieces to equal his second most preferred piece. This means that i got either his most preferred piece up to the value of the second most preferred piece or he got the second most preferred piece completely. If he got the second most preferred piece com- pletely, we are done. If i got the most preferred piece up to the value of the second most preferred piece, then some other agent got a possibly partial piece from i's most pre- ferred piece. But note that since i was asked to trim up to his second most piece in the protocol, only i was competing for his second most preferred piece. Hence, some other agent j got i's second most preferred piece completely. The core protocol for partial envy-free allocation can be extended to obtain protocol for partial envy-free allocation with a single domination. If the core protocol is run again on the unallocated cake, we show in Lemma 4 that the cutter dominates at least one agent. When the core protocol is implemented, then the piece from which the highest valued (from the perspective of the cutter) residue is trimmed is called a significant piece. We will show that the cutter can be made to dominate an agent who got the significant piece. If residues from both pieces that are partially allocated are of the same value to the cutter, then we say that both non- cutters who got partial pieces were given significant pieces. In this case, a second run of the core protocol is enough for the cutter to dominate two agents. Lemma 4 (Single-Domination Protocol Lemma). For n = 4, there exists a discrete and bounded protocol which returns an envy-free partial allocation in which one agent dominates another agent. Proof. We run the core protocol a first time. This guar- antees that the cutter (say agent 4) gets a complete piece (of value 1/4 of the whole cake) and that the residue is com- posed from the trims of at most 2 pieces. Since from the cutter's perspective all pieces were equal, the residue can- not sum up to more than 1/2 of the cake for him. Recall that the piece which agent 4 thinks was trimmed is the significant piece. The total residue is composed of the residue from the significant piece (call the residue β1) and the residue from the other trimmed piece (let us call this residue β2). The cutter thinks that he got V4(β1) more value than the agent who got the significant piece. Since V4(β1) ≥ V4(β2), the value of the total residue from the cutter's perspective is at most 2V4(β1). If we run the core protocol again, at most two pieces are partial and hence the residue's value for the cutter is at most 2 × 2V4(β1)/4 = V4(β1). This implies that even if the agent who got the significant piece gets all the residue which is of value V4(β1) to the cutter, the cutter would still not envy him. This implies the cutter dominates the agent who got the significant piece. 4.3 Permutation Protocol If we run the core protocol repeatedly on the remaining unallocated cake, it may be that the cutter keeps dominat- ing the same agent. We show that we only need to run the core protocol 5 times in total to achieve double domination. It may be that each time, the core protocol is run, the same agent gets the significant piece and hence the cutter domi- nates the same agent. If a different agent gets a significant part of the residue in any of the iterations, then the double domination is already achieved with one more iteration since from the cutter's perspective we have 2 agents who may be given all that is left of the cake without him being envious of them. If not, then we have one agent who ends up with the piece from which a significant trim was obtained for all iterations. The permutation lemma tells us that it is possi- ble to give one of the 4 significant pieces to another agent while still preserving envy-freeness. This ensures that agent 1 ends up dominating two agents. Algorithm 4 Permutation Protocol for 4 Agents Input: An outcome of a core protocol in which one agent (say agent 4) is the cutter and another specified agent (say agent 1) gets the significant piece. Output: An allocation in which each agent gets a piece equal to the value he trimmed to in the core protocol and in which agent 2 or 3 gets the significant piece. 1: if agent 2 was competing with someone for the piece and therefore had a trimmed piece then 1. If the agent who made the second rightmost trim on agent 2's piece is agent 1, then we can simply permute agents 1 and 2 i.e., exchange their pieces. 2. If the agent who made the second rightmost trim on agent 2's piece is agent 3, then we can move 3 to agent 2's piece. Agent 2 can be given 1's (trimmed) piece. Agent 1 can be given one of the complete pieces (which was given to 3 or 4). Agent 4 can be given the remaining complete piece. 2: else if agent 2 was in possession of a complete piece for which he was not competing with another agent then 1. If 2's piece is the piece such that agent 1 trimmed up to that value in the core protocol, then simply permute 1 and 2. 2. If 4 is holding the piece such that agent 1 trimmed up to that value in the core protocol then we simply move 4 to 2's piece since it is a complete piece and agent 1 gets 4's piece. Agent 2 is given 1's piece. 3. If 3 has a complete piece such that agent 1 trimmed up to that value in the core protocol and 3 is indif- ferent between two pieces among his top 3 pieces, then 3 can be given another complete piece (such that he trimmed up to the value of that piece) of ei- ther 2 and 4. Agent 1 can be given 3's piece. Agent 2 gets 1's piece and 4 gets the remaining complete piece. 3: end if Although the core protocol can be easily used to enable the cutter to dominate one agent, dominating two agents is more challenging. In the next section, we show how to overcome this challenge. We will use this idea in the argument of the Permuta- tion Lemma. Before presenting the Permutation Lemma, we present another lemma that is useful for the proof of the Permutation Lemma. Lemma 5. Consider m rows each with m − 1 entries of positive reals. Then there exists at least one row such that for each entry in the row, the sum of other entries in the column corresponding to that entry is greater than or equal to the entry in the row. Proof. It is sufficient to find a row in which each entry is not the unique maximum entry for that column. We go row by row and eliminate a row if it has at least one entry that is a maximal value among all entries in the corresponding column. Even if m − 1 rows are eliminated, we are left with one row in which each entry is not the unique maximum entry for that column. We will rely on Lemma 5 while reasoning about when reallocating pieces does not cause any envy. In particular let us say that an agent gets slightly more than the value he wanted to guarantee. He may not want to let go of this extra value lest it leads to him being envious. However, let us say he gets similar extra values again, then we may ask the agent to choose which one of the extra values he rates least and give this extra value to some other agent. The other extra values, make up for this loss. Intuitively, Lemma 5 will help identify that if we have enough subcases (rows) then there will be one row on which an agent will be happy to compromise. We are now in a position to present the Permutation Lemma. Lemma 6 (Permutation Lemma). There exists a dis- crete and bounded protocol for 4 agents that returns a partial envy-free allocation in which one agent dominates two other agents. Proof. Assume that agents 1, 2, 3, 4 get pieces p1, p2, p3, and p4 respectively with 4 getting complete pieces. When 4 cut the pieces, p1 is a piece P1 without the part left of the second rightmost trim. Now, assume that in four iterations of the 1 gets the significant piece and we want to reallocate so that some other agent among 2 and 3 gets the signif- icant piece. We need to show that when the reallocation is done then barring the bonus part that agents get in the core protocol, the agents get at least as preferred a piece. If another agent aside from agent 1 gets the significant piece then we are done. If agent 1 is repeatedly getting it, then we zoom in to a case to permute it i.e., reallocate some of the pieces so as to make sure that an agent other than 1 is dominated. If agent 1 is repeatedly getting the significant piece and there is no reallocation in which instead of agent 1 some other agent gets the significant piece, this means that either (a) agent 1 likes the bonus from his significant piece so much that he is not willing to take some other piece or (b) for some other agent j, the bonus corresponding to the significant piece is not enough for j to be attracted towards the significant piece. Claim 1. For a partial allocation as a result of the core protocol in which agents make trims, a reallocation can be done in which some agent other than 1 gets the significant piece and each agent gets a piece of value corresponding to his original trims but in which he may lose out on the addi- tional bonus due to the second rightmost trims. Proof. The algorithm to perform the reallocation is stated as the Permutation Protocol (Algorithm 4). Imag- ine that agent 1 is holding the significant piece. For the piece to be significant, another agent must have been com- peting with agent 1 for it. If no other agent was competing for the piece, then agent 1 would have got the whole piece and hence the piece would not be significant. Let us say that the agent who competes for the same piece is agent 2. Since the piece was cut up to the second rightmost trim, agent 2 is not envious of any other agent if agent 2 gets the piece (while not getting his trim). We now distinguish between 2 possibilities. We show how both cases can be handled. 1. Agent 2 was competing with someone for the piece and therefore had a trimmed piece. We distinguish between two subcases. (a) If the agent who made the second rightmost trim on agent 2's piece is agent 1, then we can simply permute agents 1 and 2 i.e., exchange their pieces. (b) If the agent who made the second rightmost trim on agent 2's piece is agent 3, then we can move 3 to agent 2's piece. Notice that 3 must have been allocated a complete piece since only 2 pieces may be trimmed. This means that 1 did not compete with 3 for 3's piece which implies that if 1 can get 4 or 3's piece he will get the piece he was guaran- teed before the order of the trim was determined (either second most preferred or third most pre- ferred). Agent 2 can be given 1's (trimmed) piece. Agent 1 can be given one of the complete pieces (which was given to 3 or 4). Agent 4 can be given the remaining complete piece. 2. Agent 2 was in possession of a complete piece for which he was not competing with another agent. Let us focus on the piece agent 1 desires and was guaranteed to get a piece of that value (either his second most preferred or third most preferred). We will use the fact that by Lemma 3, some other agent got a complete piece that was of at least as much value to agent 1. We distinguish between three subcases. (a) If 2's piece is the piece agent 1 desires, then simply permute 1 and 2. (b) If 4 is holding the piece to be freed then we simply move 4 to 2's piece since it is a complete piece and agent 1 gets 4's piece. Agent 2 is given 1's piece. (c) Let us assume that 3 is holding the piece to be freed and agent 1 is guaranteed to get a piece of a value as much as this complete piece (which we refer to as a). If 3 is indifferent among any two of his most preferred three pieces, then either he is indifferent among the top 2 or among the second and third. For the former, if he got a top 2 piece, he will be willing to get another top 2 piece and if he got a third piece, he would certainly be happy to get one of the complete top 2 pieces. For the latter, if he got one of the second or third preferred pieces, he would be happy to get the other equally preferred one. If he had got the top piece, then this means that only 3 had a proper trim on a. But this means that 3 is willing to move to another complete piece with as much value barring the extra bonus he got in piece a. Hence in all the cases above, 3 can be given another complete piece, agent 1 can be given 3's complete piece, and 2 can get 1's partial piece. We now assume that 3 is not indifferent among any of his 3 most preferred pieces. We show that in this scenario, we would already be in one of the previous cases in which 1 is okay with taking 2 or 4's piece. We first argue that agent 3's most preferred piece is the significant piece. Piece a cannot be agent 3's most preferred piece since otherwise 1 would not be guaranteed to get it: if 1 got it, 3 would be envious. Neither can the piece held by 4 or 2 be 3's most preferred piece since envy-freeness of the partial allocation will be violated. Since the pieces allocated to 2, 3 and 4 are not 3's most valued pieces, it implies that agent 3's most pre- ferred piece is the significant piece. Next, we argue that 3 was allocated his second most preferred piece in which had put a proper trim. First we assume that 3 trimmed up to his third most preferred piece. If a is 3's third most preferred piece, then 3 would have been envious of either 2 or 4 whoever got 3's most preferred piece. 3 would have competed for such as piece and such a piece would not have been allocated completely. This means that 3 got his second most preferred piece. Second, we assume that 3 trimmed unto his second most preferred piece, then this means 3 was allocated his second most preferred piece since he was guaranteed it. In both cases 3 put a proper trim on a. We now argue that a (3's piece) is also agent 1's second most preferred piece. If the piece allo- cated to 2 or 4 was agent 1's second most pre- ferred piece, we would be in a different case. Therefore a is agent 1's and 3's second most pre- ferred piece. Since 1 is guaranteed to get a piece of value of a and since a is agent 1's second most preferred piece, it means that only 1 has a proper trim on a. But we have already shown that 3 also put a proper trim on a. But if two agents put a proper trim on a piece, the piece cannot be completely allocated to an agent hence a contra- diction. This complete the proof of the claim. We have shown that reallocation can be done in which each agent gets a piece of value corresponding the trims the agents made. Note that in each iteration of protocol, each agent gets some (possibly non-zero) bonus. Since agent 1 gets a signif- icant piece, he gets a non-zero bonus each time. Although 1 may object to any reallocation for a particular iteration of core protocol, we show that he will not envious if one par- ticular iteration of the core protocol is identified in which corresponds to the row of entries in Table 1 in which for each entry in the row, the sum of other entries in the col- umn corresponding to that entry is greater than or equal to the entry in the row. By Lemma 5, such a row exists. This means that even if each agent loses his bonus because of the permutation, he gets enough bonus in the other iterations to make for this loss so that there is no envy. We have shown so far that in four iterations of the core protocol, the partial envy-free allocation is such that two different agents got a significant piece in one of the calls of the core protocol. If the same agents get a significant piece in all the first four iterations of the core protocol, then we have shown above that the permutation protocol can implemented to give the significant piece to another agent and still not maintain envy-free across the four iterations of the core protocol. The fifth iteration of the core protocol ensures that the cutter dominates two agents and the partial allocation is envy-free. 1 2 3 Bonus in 1st iteration Bonus in 2nd iteration Bonus in 3rd iteration Bonus in 4th iteration 1 1 b1 b2 b3 b4 1 1 2 2 b1 b2 b3 b4 2 2 3 3 b1 b2 b3 b4 3 3 4 0 0 0 0 Table 1: Bonus of each agent in the first 4 calls of the core protocol with agent 4 as the cutter. 4.4 Overall Protocol In the previous sections, we built the building blocks for our overall protocol: Post Double Domination Protocol, Core Protocol, and Permutation Protocol. We are now in a position to formalize the protocol to compute a complete envy-free allocation and presents the main result. The pro- tocol is formalized as Algorithm 5. Algorithm 5 Discrete and Bounded Envy-free Protocol for 4 Agents. 1: while some agent i does not dominate two other agents and there is still some unallocated cake do 2: 3: 4: 5: 6: 7: Run the Core Protocol (Algorithm 3) 4 times on the unallocated cake with i as the cutter. Return at any point if there is no cake left unallocated. {After two iterations, i already dominates one agent} if the same agent (say agent j) gets the significant piece in each of the 4 calls of the core protocol then Identify in which call of the protocol, the non-cutter agents get less bonus than the sum of bonuses in the other calls of the core protocol. {see Table 1} Implement reallocation via the Permutation Proto- col (Algorithm 4) for pieces allocated by this particular call of the core protocol where i is the cutter and j gets the significant piece. end if Run core protocol in the unallocated cake if some cake is still unallocated. 8: end while 9: if there is some unallocated cake then 10: Run Post Double Domination Protocol (Algorithm 2) on the remaining cake. 11: end if 12: return envy-free complete allocation. Theorem 2. For four agents, there exists a discrete and bounded envy-free protocol that requires constant number of queries in the Robertson and Webb model. Proof. The protocol is formalized as Algorithm 5. The theorem follows from Lemmas 1 and 6. The protocol first en- sures that there exists a partial envy-free allocation in which each agent dominates two other agents. The protocol then used the Double Domination Protocol to obtain a complete envy-free allocation. We now argue in more detail that the protocol is bounded not only in terms of number of cuts but also in terms of Robertson-Webb queries. In each run of the core protocol, the cutter makes three cuts and then each non-cutter makes at most two trims. Two agents may be asked to replace their cuts and make a cut to make their most preferred piece equal to their second most preferred piece or in another case agents perform Divide and Choose which requires 1 cut. Hence, in the core protocol, there are at most 3+6+1=11 cuts. Since we run 5 iterations of the core protocol to get one double domination, we need 50 cuts to get one double domination. Since we need each agent to double dominate, we need 50 × 4 = 200 cuts. After we achieve double dominations for all agents, we need at most three more cuts. So we need at most 203 cuts. We now count the maximum number of Robertson-Webb query operations required during the protocol. The cutter is asked the value of the whole cake (1 query), and then made to cut to equal 1/4 of the value (3 queries). The non-cutter agents are asked to give values of the pieces (3 × 4 = 12 queries.) They are then asked to trim to equal the value of the third most preferred piece (3 × 2 queries). Two agents may be asked to make one additional cut to make their most preferred piece equal to their second most preferred piece (2 × 1 queries) or in another case, agents perform Divide and Choose which requires 4 queries. Hence the core proto- col requires in total 1 + 3 + 12 + 6 + 4 = 26 queries. The core protocol is run 5 times so that takes 26 × 5 queries. In addition to running the core protocol 5 times, we also need to run permutation protocol four times to check which permutation to implement. In each call of the permuta- tion protocol, agents are queried about the amount of bonus which they get in the core protocol which takes additional 3 queries so in total of 12 queries for the permutation pro- tocol. In order to get all double dominations, we require ((26 × 5) + 12) × 4 = 568 queries. After we achieve double dominations, we require maximum 16 more queries. So the total number of queries is 584. 5. DISCUSSION In this paper, we proposed the first bounded and envy- free protocol for four agents. Some of our insights such as the one of exploiting the bonus cake given to the agents as well as analyzing the domination graph may be useful in at- tacking the problem for any number of agents. Our protocol is based on three main ingredients: core protocol, permuta- tional protocol, and post double domination protocol. The higher level ideas of our overall protocol could be applied to general problem for more number of agents. Some of the proof ideas may be generalizable to more than four agents. For example, a suitable generalization of the core protocol is feasible. On the other hand, the Permutation Protocol appears to be challenging to extend to arbitrary number of agents and will require more interesting insights and tech- niques. There are also some other interesting directions for future research such as existence and properties of equilibria under our new protocol. 6. ACKNOWLEDGMENTS Data61 is funded by the Australian Government through the Department of Communications and the Australian Re- search Council through the ICT Centre of Excellence Pro- gram. Part of the research was carried out when the authors were visiting LAMSADE, University Paris Dauphine in May 2015. The authors thank Rediet Abebe, Steven Brams, Simina Branzei, Ioannis Caragiannis, Katar´ına Cechl´arov´a, Serge Gaspers, David Kurokawa, and Ariel Procaccia for useful comments. They also thank the reviewers of STOC 2016 for suggestions to improve the presentation. Haris Aziz thanks Ulle Endriss for introducing the subject to him at the COST-ADT Doctoral School on Computational Social Choice, Estoril, 2010. 7. REFERENCES [1] H. Aziz and C. Ye. Cake cutting algorithms for piece- wise constant and piecewise uniform valuations. In Pro- ceedings of the 10th International Workshop on Internet and Network Economics (WINE), pages 1–14, 2014. [2] B. Barbanel and A. D. Taylor. Preference relations and measures in the context of fair division. Ameri- can Mathematical Monthly, 123(7):2061–2070, 1995. [3] J. B. Barbanel. The Geometry of Efficient Fair Divi- sion. Cambridge University Press, 2005. [4] J. B. Barbanel and S. J. Brams. Cake division with minimal cuts: envy-free procedures for three persons, four persons, and beyond. Mathematical Social Sci- ences, 48(3):251–269, 2004. [5] S. J. Brams and A. D. Taylor. An envy-free cake di- vision protocol. The American Mathematical Monthly, 102(1):9–18, 1995. [6] S. J. Brams and A. D. Taylor. Fair Division: From Cake-Cutting to Dispute Resolution. Cambridge Uni- versity Press, 1996. [7] S. J. Brams, A. D. Taylor, and W. S. Zwicker. A moving-knife solution to the four-person envy-free cake division. Proceedings of the American Mathematical So- ciety, 125(2):547–554, 1997. [8] S. Branzei. A note on envy-free cake cutting with polynomial valuations. Information Processing Letters, 115(2):93–95, 2015. [9] S. Branzei and P. B. Miltersen. A dictatorship theo- rem for cake cutting. In Proceedings of the 23rd In- ternational Joint Conference on Artificial Intelligence (IJCAI), pages 482–488. AAAI Press, 2015. [10] C. Busch, M. S. Krishnamoorthy, and M. Magdon- Ismail. Hardness results for cake cutting. Bulletin of the EATCS, 86:85–106, 2005. [11] Y. Chen, J. K. Lai, D. C. Parkes, and A. D. Procaccia. Truth, justice, and cake cutting. Games and Economic Behavior, 77(1):284–297, 2013. [12] R. Cole and V. Gkatzelis. Approximating the nash so- cial welfare with indivisible items. In Proceedings of the 47th Annual ACM Symposium on Theory of Computing (STOC), pages 371–380. ACM Press, 2015. [13] X. Deng, Q. Qi, and A. Saberi. Algorithmic solutions for envy-free cake cutting. Mathematics of Operations Research, 60(6):1461–1476, 2012. [14] J. Edmonds and K. Pruhs. Cake cutting really is not a piece of cake. In Proceedings of the 17th An- nual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 271–278, 2006. [25] A. D. Procaccia. Thou shalt covet thy neighbor's cake. In Proceedings of the 21st International Joint Confer- ence on Artificial Intelligence (IJCAI), pages 239–244. AAAI Press, 2009. [15] G. Gamow and M. Stern. Puzzle-math. Macmillan, [26] A. D. Procaccia. Cake cutting: Not just child's play. 1958. [16] S. Garfunkel. For all practical purposes social choice. COMAP, 1988. [17] R. Guo. Cross-Border Management: Theory, Method and Application. Springer, 2015. [18] W. Hively. Dividing the spoils. Discover Magazine, March, 1995. [19] D. Kurokawa, J. Lai, and A. D. Procaccia. How to cut a cake before the party ends. In Proceedings of the 27th AAAI Conference on Artificial Intelligence (AAAI), pages 555–561. AAAI Press, 2013. [20] E. Kushilevitz and N. Nisan. Communication Complex- ity. Cambridge University Press, 2006. [21] C. Lindner and J. Rothe. Degrees of guaranteed envy- In freeness in finite bounded cake-cutting protocols. Proceedings of the 5th International Workshop on In- ternet and Network Economics (WINE), volume 5929 of Lecture Notes in Computer Science (LNCS), pages 149–159. Springer-Verlag, 2009. [22] C. Lindner and J. Rothe. Cake-cutting: Fair division of divisible goods. In J. Rothe, editor, Economics and Computation: An Introduction to Algorithmic Game Theory, Computational Social Choice, and Fair Divi- sion, chapter 7. Springer-Verlag, 2015. [23] A. Maya and N. Nisan. Incentive compatible two player cake cutting. In Proceedings of the 8th Interna- tional Workshop on Internet and Network Economics (WINE), volume 7695 of Lecture Notes in Computer Science (LNCS), pages 170–183. Springer-Verlag, 2012. [24] O. Pikhurko. On envy-free cake division. The American Mathematical Monthly, 107(8):736–738, 2000. Communications of the ACM, 56(7):78–87, 2013. [27] A. D. Procaccia. Cake cutting algorithms. In F. Brandt, V. Conitzer, U. Endriss, J. Lang, and A. D. Procac- cia, editors, Handbook of Computational Social Choice, chapter 13. Cambridge University Press, 2016. [28] J. M. Robertson and W. Webb. Near exact and envy- free cake division. Ars Combinatorica, 45:97–108, 1997. [29] J. M. Robertson and W. A. Webb. Cake Cutting Algo- rithms: Be Fair If You Can. A. K. Peters, 1998. [30] A. Saberi and Y. Wang. Cutting a cake for five people. In Proceedings of the 5th International Conference on Algorithmic Aspects in Information and Management (AAIM), Lecture Notes in Computer Science (LNCS), pages 292–300. Springer-Verlag, 2009. [31] E. Segal-Halevi, A. Hassidim, and Y. Aumann. Waste makes haste: Bounded time protocols for envy-free cake cutting with free disposal. In Proceedings of the 14th International Conference on Autonomous Agents and Multi-Agent Systems (AAMAS), pages 901–908. IFAA- MAS, 2015. [32] H. Steinhaus. The problem of fair division. Economet- rica, 16:101–104, 1948. [33] I. Stewart. Division without envy. Scientific American, 1999. [34] W. Stromquist. Envy-free cake divisions cannot be found by finite protocols. The Electronic Journal of Combinatorics, 15(R11), 2008. [35] F. E. Su. Rental harmony: Sperner's lemma in fair division. American Mathematical Monthly, 10:930–942., 1999. [36] W. Thomson. Children crying at birthday parties. Why? Economic Theory, 31:501–521, 2007.
1301.3402
2
1301
2013-03-13T08:14:34
Constraint Expressions and Workflow Satisfiability
[ "cs.DS", "cs.CR" ]
A workflow specification defines a set of steps and the order in which those steps must be executed. Security requirements and business rules may impose constraints on which users are permitted to perform those steps. A workflow specification is said to be satisfiable if there exists an assignment of authorized users to workflow steps that satisfies all the constraints. An algorithm for determining whether such an assignment exists is important, both as a static analysis tool for workflow specifications, and for the construction of run-time reference monitors for workflow management systems. We develop new methods for determining workflow satisfiability based on the concept of constraint expressions, which were introduced recently by Khan and Fong. These methods are surprising versatile, enabling us to develop algorithms for, and determine the complexity of, a number of different problems related to workflow satisfiability.
cs.DS
cs
Constraint Expressions and Workflow Satisfiability Jason Crampton Gregory Gutin June 28, 2021 Abstract A workflow specification defines a set of steps and the order in which those steps must be executed. Security requirements and business rules may impose constraints on which users are permitted to perform those steps. A workflow specification is said to be satisfiable if there exists an assignment of authorized users to workflow steps that satisfies all the constraints. An algorithm for determining whether such an assignment exists is important, both as a static analysis tool for workflow specifications, and for the construction of run-time reference monitors for workflow management systems. We develop new methods for determining workflow satisfiability based on the concept of constraint expressions, which were introduced recently by Khan and Fong. These methods are surprising versatile, enabling us to develop algorithms for, and determine the complexity of, a number of different problems related to workflow satisfiability. 1 Introduction It is increasingly common for organizations to computerize their business and management pro- cesses. The co-ordination of the tasks or steps that comprise a computerized business process is managed by a workflow management system (or business process management system). Typi- cally, the execution of these steps will be triggered by a human user, or a software agent acting under the control of a human user, and the execution of each step will be restricted to some set of authorized users. A workflow is defined by the steps that comprise a business process and the order in which those steps should be performed. Moreover, it is often the case that some form of access control, often role-based, should be applied to limit the execution of steps to authorized users. In addition, many workflows require controls on the users that perform groups of steps. The concept of a Chinese wall, for example, limits the set of steps that any one user can perform [9], as does separation-of-duty, which is a central part of the role-based access control model [1]. Hence, it is important that workflow management systems implement security controls that enforce authorization rules and business rules, in order to comply with statutory requirements or best practice [6]. It is these "security-aware" workflows that will be the focus of the remainder of this paper. A simple, illustrative example for purchase order processing [10] is shown in Figure 1. In the first step of the workflow, the purchase order is created and approved (and then dispatched to the supplier). The supplier will submit an invoice for the goods ordered, which is processed by the create payment step. When the supplier delivers the goods, a goods received note (GRN) must be signed and countersigned. Only then may the payment be approved and sent to the supplier. Note that a workflow specification need not be linear: the processing of the GRN and of the invoice can occur in parallel, for example. 1 In addition to defining the order in which steps must be performed, the workflow specification includes rules to prevent fraudulent use of the purchase order processing system. In our example, these rules restrict the users that can perform pairs of steps in the workflow: the same user may not sign and countersign the GRN, for example. s3 s5 s2 6= s1 s2 s4 s6 s5 6= s3 s1 = s4 6= 6= s6 (a) Ordering on steps (b) Constraints s1 s2 s3 s4 s5 s6 6= = create purchase order approve purchase order sign GRN create payment countersign GRN approve payment different users must perform steps same user must perform steps (c) Legend Figure 1: A simple constrained workflow for purchase order processing It is apparent that it may be impossible to find an assignment of authorized users to workflow steps such that all constraints are satisfied. In this case, we say that the workflow specification is unsatisfiable. The Workflow Satisfiability Problem (WSP) is known to be NP-hard, even when the set of constraints only includes constraints that have a relatively simple structure (and that would arise regularly in practice).1 The rules described above can be encoded using constraints [10], the rules being enforced if and only if the constraints are satisfied. More complex constraints, in which restrictions are placed on the users who execute sets of steps can also be defined [3, 12, 21], can encode more complex business requirements. (We describe these constraints in more detail in Section 2.1.) A considerable body of work now exists on the satisfiability of workflow specifications that include such constraints [6, 12, 21]. In this paper, we use constraint expressions to solve WSP. Constraint expressions were introduced by Khan and Fong in their work on workflow feasibility [16]. However, the potential of constraint expressions was not fully realized. In this paper, we show how constraint expressions can be used to solve WSP and a number of related problems. We also introduce a set of operators for combining workflows. This allows us to model workflows in which the execution of steps is determined at execution time, which we will call conditional workflows. Our model enables us to formulate the satisfiability problem for condi- tional workflows, which we solve using constraint expressions. To our knowledge, these are the first results on conditional workflows. The main contributions of this paper are: 1In particular, the Graph k-Colorability problem can be reduced to a special case of WSP in which the workflow specification only includes separation-of-duty constraints [21]. 2 • to generalize the results of Wang and Li on the fixed parameter tractability of WSP (Section 3); • to introduce a language for workflow composition (Section 4); • to establish new results on the satisfiability of conditional workflows (Section 4); • to demonstrate how a problem studied by Armando et al. [3] and a problem introduced by Crampton [10] can be solved using constraint expressions (Section 5). In the next section we provide relevant background material. In Section 3 -- 5, we describe our results. The proofs of our results can be found in the appendix, with the exception of the proof of Theorem 5. We conclude with a summary of our contributions, a discussion of related work, and our plans for future work. 2 Background In this section, we introduce our notation and definitions, derived from earlier work [10, 21], and then define the workflow satisfiability problem. In order to make the paper self-contained, we also provide a short overview of parameterized complexity and summarize a number of useful results from the literature. 2.1 The Workflow Satisfiability Problem A directed acyclic graph G = (V, E) is defined by a set of nodes V and a set of edges E ⊆ V × V . The reflexive, transitive closure of a directed acyclic graph defines a partial order, where v 6 w if and only if there is a path from v to w in G. If (V, 6) is a partially ordered set, then we write v k w if v and w are incomparable; that is, v 66 w and w 66 v. We may write v > w whenever w 6 v. We may also write v < w whenever v 6 w and v 6= w. Finally, we will write [n] to denote {1, . . . , n}. Definition 1. A workflow specification is defined by a directed, acyclic graph G = (S, E), where S is a set of steps and E ⊆ S × S. Given a workflow specification (S, E) and a set of users U , an authorization policy for a workflow specification is a relation A ⊆ S × U . A workflow authorization schema is a tuple (G, U, A), where G = (S, E) is a workflow specification and A is an authorization policy. We will use the representations of a workflow specification as a partial order and a DAG interchangeably. The workflow specification describes a sequence of steps and the order in which they must be performed when the workflow is executed, each such execution being called a workflow instance. If s < s′ then s must be performed before s′ in every instance of the workflow; if s k s′ then s and s′ may be performed in either order. User u is authorized to perform step s only if (s, u) ∈ A.2 We assume that for every step s ∈ S there exists some user u ∈ U such that (s, u) ∈ A. 2In practice, the set of authorized step-user pairs, A, will not be defined explicitly. Instead, A will be inferred In particular, R2BAC -- the role-and-relation-based access control from other access control data structures. model of Wang and Li [21] -- introduces a set of roles R, a user-role relation UR ⊆ U × R and a role-step relation SA ⊆ R × S from which it is possible to derive the steps for which users are authorized. For all common access control policies (including R2BAC), it is straightforward to derive A. We prefer to use A in order to simplify the exposition. 3 Definition 2. Let ((S, E), U, A) be a workflow authorization schema. A plan is a function π : S → U . A plan π is authorized for ((S, E), U, A) if (s, π(s)) ∈ A for all s ∈ S. Definition 3. A workflow constraint has the form (ρ, S1, S2), where S1, S2 ⊆ S and ρ ⊆ U × U . A constrained workflow authorization schema is a tuple ((S, E), U, A, C), where C is a set of workflow constraints. Definition 4. A plan π : S → U satisfies a workflow constraint (ρ, S1, S2) if there exist s1 ∈ S1 and s2 ∈ S2 such that (π(s1), π(s2)) ∈ ρ. Given a constrained workflow authorization schema ((S, E), U, A, C), a plan π is valid if it is authorized and it satisfies all constraints in C. We write ∆ ⊆ U × U to denote the diagonal relation {(u, u) : u ∈ U } and ∆c to denote its complement {(u, u) : (u, u) 6∈ ∆}. Thus, the constraint on steps s1 and s2 in Figure 1 would be written as (∆c, {s1} , {s2}). We may now define the workflow satisfiability problem, as defined by Wang and Li [21]. Workflow Satisfiability Problem (WSP) Input: A constrained workflow authorization schema ((S, E), U, A, C) Output: A valid plan π : S → U or an answer that there exists no valid plan We now discuss constraints in more detail, including the type of business rules we can encode using our constraints and compare them to constraints in the literature. Our definition of work- flow constraint is more general than similar definitions used when studying WSP. Crampton defined constraints in which S1 and S2 are singleton sets: we will refer to constraints of this form as Type 1 constraints; for brevity we will write (ρ, s1, s2) for the Type 1 constraint (ρ, {s1} , {s2}). Wang and Li defined constraints in which at least one of S1 and S2 is a singleton set: we will refer to constraints of this form as Type 2 constraints and we will write (ρ, s1, S2) in preference to (ρ, {s1} , S2). Constraints in which S1 and S2 are arbitrary sets will be called Type 3 constraints. We say that two constraints γ and γ ′ are equivalent if a plan π satisfies γ if and only if it satisfies γ ′. The Type 2 constraint (ρ, s1, S2) is equivalent to (ρ, S2, s1) if ρ is symmetric, in which case we will write (ρ, s1, S2) in preference to (ρ, S2, s1). It is worth pointing out that Type 1 constraints can express requirements of the form described in Section 1, where we wish to restrict the combinations of users that perform pairs of steps. The plan π satisfies constraint (∆, s, s′), for example, if the same user is assigned to both steps by π, and satisfies constraint (∆c, s, s′) if different users are assigned to s and s′. In other words, these represent, respectively, binding-of-duty and separation-of-duty constraints. Abusing notation in the interests of readability, we will replace ∆ and ∆c by = and 6=, respectively. Type 2 constraints provide greater flexibility, although Wang and Li, who introduced these constraints, do not provide a use case for which such a constraint would be needed. However, there are forms of separation-of-duty requirements that are most naturally encoded using Type 3 constraints. Consider, for example, the requirement that a set of steps S ′ ⊆ S must not all be performed by the same user [2]. We may encode this as the constraint (6=, S ′, S ′), which is satisfied by a plan π only if there exists two steps in S ′ that are allocated to different users by π. Henceforth, we will write WSP(ρ1, . . . , ρt) to denote a special case of WSP in which all constraints have the form (ρi, S ′, S ′′) for some ρi ∈ {ρ1, . . . , ρt} and for some S ′, S ′′ ⊆ S. We will write WSPi(ρ1, . . . , ρt) to denote a special case of WSP(ρ1, . . . , ρt), in which there are no constraints of Type j for j > i. Thus, WSP1(=, 6=), for example, indicates an instance of WSP in which all constraints have the form (=, s1, s2) or (6=, s1, s2) for some s1, s2 ∈ S. We will write c, n and k to denote the number of constraints, users and steps, respectively, in an instance of WSP. We will analyze the complexity of the workflow satisfiability problem in terms of these parameters. 4 Note that definition of WSP given above does not make any reference to the ordering on the set of steps. The original definition, as formulated by Crampton [10], included constraints that were sensitive to the order in which steps were executed. If s k s′, we may define two different constraints (ρ, s, s′) and (ρ′, s′, s), the first of which must be satisfied if s is performed before s′, while the second must be satisfied if s′ is performed before s. To facilitate direct comparison with the work of Wang and Li on WSP, we defer the analysis of Crampton's version of the problem until Section 5. 2.2 Applications of WSP In some systems, a There are a number of different execution models for workflow systems. tasklist is created when a workflow is instantiated. The tasklist is simply a valid plan for the worfklow instance, allocating users to specific steps in the workflow instance. In other systems, the workflow system maintains a pool of ready steps for each worfklow instance. We say a step is ready in a workflow instance if all its immediate predecessor steps have been executed. The workflow system may allocate ready steps to users; alternatively users may select steps to perform from the pool. In both cases, the system must ensure both that the user is authorized and that allowing the user to perform the step does not prevent the remaining steps in the workflow instance from completing. For systems that create tasklists, it is sufficient to know that the workflow specification is satisfiable. Thus, an algorithm for deciding WSP is an important static analysis tool for such systems. However, such an algorithm will only need to be executed when the workflow specification is created or when it changes. The fact that the problem is NP-hard means that it is important to find as efficient an algorithm as possible. For other systems, however, the algorithm will need to be run repeatedly: every time a user is allocated to a step. Note that the decision whether to allow a user to execute a step in a partially completed workflow instance can be determined by solving an instance of WSP. Specifically, suppose W = ((S, E), U, A, C) is a workflow specification, some subset S ′ of steps have been performed in some instance of W , and the system needs to decide whether to allow u′ to perform s′. Thus we have a partial plan π : S ′ → U . We then construct a new workflow instance W ′ = ((S, E), U, A′, C), where (s, u) ∈ A′ if and only if one of the following conditions holds: (i) s ∈ S ′ and u = π(s) (ii) s = s′ and u = u′ (iii) s 6∈ S ′ ∪ {s′} and (u, s) ∈ A. Clearly, the workflow instance is satisfiable (when u′ performs s′) if and only if W ′ is satisfiable. Assuming that these checks should incur as little delay as possible, particularly in the case when users select steps in real time [17], it becomes even more important to find an algorithm that can decide WSP as efficiently as possible. The definition of workflow satisfiability given above assumes that the set of users and the authorization relation are given. This notion of satisfiability is appropriate when the workflow schema is designed "in-house". A number of large information technology companies develop business process systems which are then configured by the end users of those systems. Part of that configuration includes the assignment of users to steps in workflow schemas. The developer of such a schema may wish to be assured that the schema is satisfiable for some set of users and some authorization relation, since the schema is of no practical use if no such user set and authorization relation exist. The desired assurance can be provided by solving an instance of WSP in which there are k users, each of which is authorized for all steps. The developer may also determine the minimum number of users required for a workflow schema to be satisfiable. The minimum number must be between 1 and k and, using a binary search, can be determined by examining ⌈log2 k⌉ instances of WSP. 5 2.3 Parameterized Complexity A naıve approach to solving WSP would consider every possible assignment of users to steps in the workflow. There are nk such assignments if there are n users and k steps, so an algorithm of this form would have complexity O(cnk), where c is the number of constraints. Moreover, Wang and Li showed that WSP is NP-hard, by reducing Graph k-Colorability to WSP(6=) [21, Lemma 3]. In short, WSP is hard to solve in general. The importance of finding an efficient algorithm for solving WSP led Wang and Li to look at the problem from the perspective of parameterized complexity [21]. Suppose we have an algorithm that solves an NP-hard problem in time O(f (k)nd), where n denotes the size of the input to the problem, k is some (small) parameter of the problem, f is some function in k only, and d is some constant (independent of k and n). Then we say the algorithm is a fixed-parameter tractable (FPT) algorithm. If a problem can be solved using an FPT algorithm then we say that it is an FPT problem and that it belongs to the class FPT [13, 18]. Wang and Li showed, using an elementary argument, that WSP2(6=) is FPT and can be solved in time O(kk+1N ), where N is the size of the entire input to the problem [21, Lemma 8]. They also showed that WSP2(6=, =) is FPT [21, Theorem 9], using a rather more complex approach: specifically, they constructed an algorithm that runs in time O(kk+1(k − 1)k2k−1 N ); it follows that WSP2(=, 6=) is FPT. One of the contributions of this paper is to describe a new method for solving WSP3(=, 6=) (that can also be used to solve WSP2(=, 6=)), thus generalizing Wang and Li's result. 3 Solving WSP Using Constraint Expressions In this section, we show how to extend the elementary methods used by Wang and Li to obtain results for WSP2(=, 6=) and WSP3(=, 6=). Informally, our results make use of two observations: • A construction used by Crampton et al. [11] can be used to transform an instance of WSP1(=, 6=) into an equivalent instance of WSP1(6=) in time polynomial in the numbers of constraints, steps and users. • We can transform an instance of WSPi(=, 6=) into multiple instances of WSP1(=, 6=), the number of instances being dependent only on the number of steps. We use constraint expressions [16] to represent workflow constraints and to reason about multiple constraints and the relationships between different types of constraints. 3.1 Reducing WSP1(=, 6=) to WSP1(6=) The basic idea is to merge all steps that are related by constraints of the form (=, s1, s2) for s1, s2 ∈ S. More formally, consider an instance I of WSP1(=, 6=), given by a workflow ((S, E), U, A, C). (1) Construct a graph H with vertices S, in which s′, s′′ ∈ S are adjacent if C includes a constraint (=, s′, s′′). (2) If there is a connected component of H that contains both s′ and s′′ and C contains a constraint (6=, s′, s′′) then I is unsatisfiable, so we may assume there is no such connected component. (3) For each connected component T of H, 6 (a) replace all steps of T in S by a "superstep" t; (b) for each superstep t, authorize user u for t if and only if u was authorized (by A) for all steps in t (c) for each such superstep t, merge all constraints for steps in t. Clearly, we now have an instance of WSP1(6=), perhaps with fewer steps and a modified autho- rization relation, that is satisfiable if and only if I is satisfiable. For ease of reference, we will refer to the procedure described above as the WSP1 constraint reduction method. The reduction can be performed in time O(kc + kn), where c is the number of constraints: step (1) takes time O(k + c); step (3) performs at most k merges; each merge takes O(k + c + n) time (since we need to merge vertices, and update constraints and the authorization relation for the new vertex set);3 finally, if k 6 c we have O(k(k + c + n) = O(k(c + n)), and if c 6 k then we perform no more than c merges in time O(c(k + c + n)) = O(ck + cn) = O(ck + kn). 3.2 Constraint Expressions the our behind intuition approach, understand To workflow W = ((S, E), U, A, {(ρ, S ′, S ′′)}), which defines an instance of WSP3(ρ). By definition, a plan π satisfies the constraint (ρ, S ′, S ′′) if there exist s′ ∈ S ′ and s′′ ∈ S ′′ such that (π(s′), π(s′′)) ∈ ρ. In other words, we could decide the satisfiability of W by considering the satisfiability of multiple instances of WSP1: specifically, for each pair (s′, s′′) ∈ S ′ × S ′′, we consider the satisfiability of the workflow ((S, E), U, A, {(ρ, s′, s′′)}); if any one of these instances is satisfiable, then so is W . On the other hand, a plan satisfies a workflow W = ((S, E), U, A, {γ1, γ2}), for constraints γ1 and γ2, if and only π satisfies workflows ((S, E), U, A, {γ1}) and ((S, E), U, A, {γ2}). consider a More formally, given a set of steps S, we define a constraint expression recursively: • (ρ, s1, s2) is a (primitive) constraint expression; • if γ and γ ′ are constraint expressions, then γ ∧ γ ′ and γ ∨ γ ′ are constraint expressions. A plan π satisfies constraint expression: • γ ∧ γ ′ if and only if π satisfies γ and γ ′; and • γ ∨ γ ′ if and only if π satisfies γ or γ ′. 3.3 Reducing WSP(ρ1, . . . ρt) to WSP1(ρ1, . . . , ρt) We now express workflow specifications using constraint expressions, rather than sets of con- straints. A constraint (ρ, S ′, S ′′), ρ ∈ {ρ1, . . . , ρt}, is equivalent to a constraint expression Ws′ ∈S ′,s′′ ∈S ′′ (ρ, s′, s′′), so every constraint can be written as the disjunction of primitive con- straints. Moreover, the set of constraints {Γ1, . . . , Γc}, where each Γi is a disjunction of primitive constraint expressions, is equivalent to the constraint expression Γ1 ∧ · · · ∧ Γc. In other words, we can reduce the problem of determining the satisfiability of ((S, E), U, A, C) to the problem of determining the satisfiability of a workflow of the form ((S, E), U, A, Γ1 ∧ · · · ∧ Γc), where c = C; each clause Γi = (ρ, S ′ and each literal γi,j has the form (ρ, s′, s′′) for some s′ ∈ S ′ i, S ′′ i ) has the form γi,1 ∨ · · · ∨ γi,m(i), with m(i) = S ′ i ; In other words, i · S ′′ i and s′′ ∈ S ′′ i . 3We can check step (2) when we merge constraints in step 3(c). 7 we can represent any instance of WSP3(=, 6=) as a workflow containing a constraint expression in "conjunctive normal form" in which each of the "literals" is a primitive constraint (which corresponds to a single Type 1 constraint). Moreover, each literal is positive. 3.4 Solving WSP(=, 6=) Given a constraint expression Γ1 ∧ · · · ∧ Γc, it is easy to see that if we can find a plan π for some constraint expression of the form γ1 ∧ · · · ∧ γc, with γi ∈ Γi, then π is a plan for C. This is because such a plan satisfies at least one literal in each clause Γi, thereby causing each Γi to be satisfied; and C is satisfied if each clause is satisfied. Conversely, if π is a plan for C then it is a plan for Γ1 ∧ · · · ∧ Γc and there exists a workflow expression of the form γ1 ∧ · · · ∧ γc for which π is a plan. In other words, π is a plan for C if and only if it is a plan for γ1 ∧ · · · ∧ γc for some γi ∈ Γi, where γi is a Type 1 constraint and γ1 ∧ · · · ∧ γc represents the constraint set {γ1, . . . , γc}. We call γ1 ∧ · · · ∧ γc a simple constraint expression. That is, we have reduced the satisfiability of an instance of WSP3(=, 6=) to determining the satisfiability of one or more i=1 Γi, where Γi denotes the number of literals (primitive constraint expressions) in Γi. Our strategy for solving an instance of WSP3(=, 6=), therefore, is to try to determine the satisfiability of these related instances of WSP1(=, 6=). instances of WSP1(=, 6=). The number of instances is equal to Qc Theorem 5. WSP2(=, 6=) and WSP3(=, 6=) can be decided in time O((k − 1)c(c(k − 1)k + kn)) and O(cid:16)k2c(c(k − 1)k + kn)(cid:17), respectively, where c is the number of constraints in the workflow instance. Proof. We first consider an instance of WSP1(=, 6=), to which we apply the WSP1 constraint reduction to obtain an instance of WSP1(6=). As any step with at least k authorized users can be assigned a user that has not been assigned to any other step, we may focus on the allocation of users to steps having fewer than k authorized users. We consider each possible plan in turn and for each plan we check whether every constraint is satisfied. There are no more than (k − 1)k plans to check -- since each of the steps has at most k − 1 authorized users and there are no more than k steps -- and each constraint contains two steps, so the time taken to solve WSP1(6=) is O(c(k − 1)k) and the time taken to solve WSP1(6=, =) is O(c(k − 1)k + kn). Now suppose we are given an instance of WSP(=, 6=). Then we can determine its satisfiability by considering the satisfiability of multiple instances of WSP1(=, 6=), each instance containing c constraints. We now determine the number of instances of WSP1(=, 6=) that need to be considered in the worst case. For a Type 2 constraint (ρ, s, S ′), we may assume that s 6∈ S ′: for (=, s, S ′), if s ∈ S ′, then the constraint is satisfied by every plan and the constraint is redundant; for (6=, s, S ′), if s ∈ S ′, then the constraint is equivalent to (6=, s, S ′ \ {s}). Hence, each Type 2 constraint (ρ, s, S ′) gives rise to S ′ literals in a clause with S ′ < k. So we have c clauses, each of which contains no more than k − 1 literals. Type 1 constraints are equivalent to clauses with a single literal. Hence, for an instance of WSP2(=, 6=) there are no more than (k − 1)c simple constraint expressions and so there are no more than (k −1)c instances of WSP1(=, 6=) to check, which can be done in time O((k −1)c(c(k − 1)k + kn + kc)) = O((k − 1)c(c(k − 1)k + kn)). Each Type 3 constraint (ρ, S ′, S ′′) yields a clause containing fewer than S ′ · S ′′ 6 k2 literals (which is greater than the number of clauses that can be obtained from a Type 1 or 8 Type 2 constraint). Hence, there are no more than O(k2c) simple constraint expressions and WSP3(6=, =) can be decided in time O(k2c(c(k − 1)k + kn + kc)) = (k2c(c(k − 1)k + kn)). Corollary 6. WSP2(=, 6=) and WSP3(=, 6=) are FPT. 3.5 Kernelization of WSP Formally, a parameterized problem P can be represented as a relation P ⊆ Σ∗ × N over a finite alphabet Σ. The second component is call the parameter of the problem. In particular, WSP is a parameterized problem with parameter k, the number of steps. We denote the size of a problem instance (I, k) by I + k. Definition 7. Given a parameterized problem P , a kernelization of P is an algorithm that maps an instance (I, k) to an instance (I ′, k′) in time polynomial in I + k such that (i) (I, k) ∈ P if and only if (I ′, k′) ∈ P , and (ii) k′ + I ′ 6 g(k) for some function g; (I ′, k′) is the kernel and g is the size of the kernel. If g(k) = kO(1), then we say (I ′, k′) is a polynomial-size kernel. A kernelization provides a form of preprocessing aimed at compressing the given instance of the problem. Polynomial-size kernels are particularly useful in practice as they often allow us to reduce the size of the input of the problem under consideration to an equivalent problem with an input of significantly smaller size. Crampton et al. recently established that WSP1(=, 6=) has a polynomial-size kernel [11, §6]. In the case of WSP1(=, 6=), we can reduce the problem to one containing at most k users [11, Theorem 6.5]. Crampton el al. also showed that WSP2(=, 6=) (and hence WSP3(=, 6=)) does not have a polynomial-size kernel, so there is no efficient preprocessing step for such instances of WSP. However, our results in this paper show we can reduce an instance of WSP(=, 6=) to at most k2c instances of WSP1(6=) and then solve each instance by first computing a (polynomial- size) kernel. The proof of Corollary 6 asserts that c 6 4k, although we would expect c to be linear or quadratic in the number of steps in practice. This approach is similar to those that use so-called Turing kernels (see [19], for example). 3.6 Negative Constraint Expressions We could extend the syntax for constraint expressions to include negation. In other words, if γ is a constraint expression, then ¬γ is a constraint expression. A plan π satisfies ¬γ if and only if π violates γ. A plan π satisfies the constraint ¬(=, S1, S2), for example, if and only for all si ∈ Si, (π(s1), π(s2)) 6∈ ∆; that is, if and only if for all si ∈ Si, π(s1) 6= π(s2).4 Thus, we can encode any instance of WSP(=, 6=) using only constraints of the form (=, s1, s2) if we allow the use of negation. Note, however, this means that the method for solving WSP(=, 6=) described in Section 3.4 no longer works, because we may have negative literals in our conjunctive normal form expressions. However, we can determine the satisfiability of the constraint expression using any SAT solver. A satisfying assignment returned by the SAT solver provides a "template" for a valid plan: if the variable (=, s1, s2) is set to true, then our plan must assign the same user to s1 and s2. This induces a partition of the set of steps into blocks, each of which must be executed by a different user. Hence, each satisfying assignment of the constraint expression gives rise to an instance of WSP1(6=) in which each "step" is a block of steps in the original problem instance. We can 4This constraint is similar to the separation of duty constraints described by Basin et al. [7] and the universal constraints described by Wang and Li [21]. Of course, we can represent this constraint as the set of Type 1 constraints {(6=, s1, s2) : s1 ∈ S1, s2 ∈ S2}. 9 solve this instance in time O((cid:0)k 2(cid:1)(b − 1)b), where b 6 k is the number of blocks, since there are at most (cid:0)k 2(cid:1) constraints of the form (=, s1, s2). If b is small relative to k, then this may prove to be a very efficient way of solving the original instance of WSP(=, 6=). However, we may need to consider 2(k 2) satisfying assignments. In future work we hope to explore whether the additional expressive power of negative constraint expressions allows us to encode business rules of practical relevance. Further experimental work, investigating which strategies for solving WSP work best in practice, is required. 4 Conditional Workflows In some situations, we may wish to have conditional branching in a workflow specification, some- times known as OR-forks [20] or exclusive gateways [22]. In our workflow system for purchase order processing, for example, we may require that only orders with a value exceeding some threshold amount need to be signed for twice. Informally, we can represent this extended specifi- cation by the diagram shown in Figure 2, where s′ 3 represents a step for signing a goods received note on low-valued items. The nodes containing k and ⊕ are "orchestration" steps (or "gate- ways") at which no processing is performed: ⊕ indicates that exactly one of the two branches is executed, while k denotes that both branches must be executed. ⊕ s3 s′ 3 s4 s5 s6 s1 s2 k Figure 2: A workflow specification with conditional step execution 4.1 Workflow Composition We now introduce a simple language for defining workflows. This language enables us to extend the definition of WSP to workflows containing OR-forks, but not to arbitrary workflow patterns. We assume every workflow specification includes a start step and a finish step, which we will denote by α and ω, respectively, with subscripts where appropriate. These steps are orchestration steps: no processing is performed by these steps and no constraints are applied to their execution; they are used by the workflow management system solely to manage the initiation and completion of workflow instances. Given two workflow specifications W1 = (S1, E1) and W2 = (S2, E2), we may construct new workflow specifications using serial, parallel and xor composition, denoted by W1 ; W2, W1 k W2 and W1 ⊕ W2, respectively. We assume throughout that S1 ∩ S2 = ∅. (If this were not the case with s ∈ S1 ∩ S2, we could simply introduce subscripts or new labels to distinguish the two copies of s.) For serial composition, all the steps in W1 must be completed before the steps in W2. Hence, the graph of W1 ; W2 is formed by taking the union of S1 and S2, the union of E1 and E2, and the addition of a single edge between ω1 and α2. 10 For parallel composition, the execution of the steps in W1 and W2 may be interleaved. Hence, the graph of W1 k W2 is formed by taking the union of S1 and S2, the union of E1 and E2, the addition of new start and finish steps αpar and ωpar, and the addition of edges from αpar to α1 and α2 and from ω1 and ω2 to ωpar. This form of composition is sometimes known as an AND-fork [20] or a parallel gateway [22].5 In both serial and parallel composition, all steps in W1 and W2 are executed. In xor com- position, either the steps in W1 are executed or the steps in W2, but not both. In other words, xor composition represents non-deterministic choice in a workflow specification. The graph of W1 ⊕ W2 is formed by taking the union of S1 and S2, the union of E1 and E2, the addition of new start and finish steps αxor and ωxor, and the addition of edges from αxor to α1 and α2 and from ω1 and ω2 to ωxor. Henceforth, we will assume that ω1 followed by α2 will be merged to form a single (orchestra- tion) node ǫ. Similarly, we will assume that (i) αpar followed by α1 and α2 in serial composition will be merged to form a single node αpar; (ii) ωpar followed by ω1 and ω2 will be merged to form a single node ωpar; (iii) αxor followed by α1 and α2 will be merged to form a single node αxor; (iv) ωxor followed by ω1 and ω2 will be merged to form a single node ωxor. Serial and parallel composition are illustrated in Figure 3. The structure of xor composition is identical to that for parallel composition so it is not shown. α1 W1 ǫ W2 ω2 (a) Serial Figure 3: Workflow composition W1 αpar ωpar W2 (b) Parallel 4.2 Execution Sets When we have conditional branching in a workflow, there exists more than one set of steps that could comprise a complete workflow instance. Formally, an execution set is defined recursively: • for a workflow specification comprising a single step s, there is a single execution set {s}; • if W1 and W2 are workflow specifications and S1 and S2 are execution sets for W1 and W2, respectively, then -- S1 ∪ S2 is an execution set for W1 ; W2, -- S1 ∪ S2 is an execution set for W1 k W2, -- S1 and S2 are execution sets for W1 ⊕ W2. 5The workflows that arise from serial and parallel composition have a lot in common with series-parallel graphs; see [5], for example, for further details. 11 In our running example, both {s1, s2, s3, s4, s5, s6} and {s1, s2, s′ 3, s4, s6} represent possible ex- ecution sets, with the second set representing a workflow instance in which the value of goods ordered is lower than the threshold requiring the GRN to be countersigned.6 4.3 Workflow Formulas and Trees Clearly, each workflow step represents a workflow specification, in fact the simplest possible specification. Hence, we may represent the example workflow specification in Figure 2 as the workflow formula (s1 ; s2) ; (((s3 ; s5) ⊕ s′ 3) k s4) ; s6. Thus, we may also represent the workflow specification as a workflow tree, as illustrated in Figure 4. ; k s6 ⊕ s4 s′ 3 ; ; ; s1 s2 s3 s5 Figure 4: A workflow tree The number of different possible execution sets is determined by the structure of the workflow formula. Specifically, let ♯(W ) denote the number of possible execution sets for workflow W . For a workflow W comprising a single step, we have ♯(W ) = 1. In general, we have ♯(W1 ; W2) = ♯(W1 k W2) = ♯(W1) · ♯(W2) ♯(W1 ⊕ W2) = ♯(W1) + ♯(W2), where · denotes multiplication. Using a post-order traversal of the workflow tree, we can compute the number of possible execution sets: we assign the value 1 to each leaf node; we compute the number of possible execution sets for each non-leaf node using the values assigned to its children and the appropriate formula for the operation associated with the node. The root node in the tree depicted in Figure 4 is assigned the value 2, for example. We write ♭(W ) to denote the maximum number of steps in any possible execution set for a workflow specification W . Then ♭(W1 ; W2) = ♭(W1 k W2) = ♭(W1) + ♭(W2) ♭(W1 ⊕ W2) = max {♭(W1), ♭(W2)} . 6The concept of an execution set is related to, but simpler than, the concept of an execution history [7]: for any execution set {s1, . . . , sm}, an execution history is a set {(s1, u1), . . . , (sm, um)} for some users u1, . . . , um. An execution history also has some similarity to our concept of a plan. 12 Clearly, we can compute ♭(W ) from the workflow tree associated with W using a similar algorithm to the one described above for calculating ♯(W ). 4.4 Constraints in Conditional Workflows Let W1 and W2 be two workflow specifications with constraints C1 and C2, respectively. When we form W1 ; W2 or W1 k W2, we include all constraints in C1 and C2. In addition, we may create new constraints, governing the execution of some steps in S1 and some steps in S2. However, we prohibit the addition of constraints in which all the steps are contained in either S1 or S2 (the assumption being that they would have been created earlier, if required). In other words, any constraint that is added when we form W1 ; W2 (or W1 k W2) has the form (ρ, S ′, S ′′), where S ′ ∪ S ′′ 6⊆ S1 and S ′ ∪ S ′′ 6⊆ S2. In contrast, since xor composition requires that we either perform the steps in S1 or those in S2, any constraint that includes steps from both S1 and S2 serves no purpose. Hence, we assume that we add no constraints when we form W1 ⊕ W2. 4.5 Derived Deterministic Workflows We say a workflow specification is deterministic if it has a single execution set (and non- deterministic otherwise). Each possible execution set in a non-deterministic workflow speci- fication gives rise to a different, deterministic workflow specification. In particular, given a workflow specification W = (S, E) with execution sets {S1, . . . , Sm}, we define Wi = (Si, Ei), where Ei def= (Si × Si) ∩ E. Then Wi is a (derived) deterministic workflow specification. For a constrained workflow specification W = ((S, E), A, C) with possible execution sets {S1, . . . , Sm}, we define Wi = (Si, Ei, Ai, Ci), where Ai def= (Si × U ) ∩ A, and, for each γ = (ρ, S1, S2) ∈ C such that S1 ∩ Si 6= ∅ and S2 ∩ Si 6= ∅, γi def = (ρ, S1 ∩ Si, S2 ∩ Si) ∈ Ci. Each Wi is a deterministic, constrained workflow specification. Notice that when we form γi, S1 ∩ Si 6= ∅ and S2∩Si 6= ∅: this follows by a simple induction on the structure of the workflow formula and the assumptions we make about the addition of constraints when we compose workflows (as described in Section 4.4). Hence, we may model any non-deterministic workflow specification as a collection of deter- ministic workflow specifications. We may define the notion of weakly satisfiable and strongly satisfiable for a non-deterministic specification: the former holds if there exists a derived, de- terministic workflow specification that is satisfiable; the latter holds if all derived, deterministic workflow specifications are satisfiable. In practice, it is likely that a workflow specification should be strongly satisfiable (otherwise there exist execution paths that can never complete). Proposition 8. Let W be an instance of WSP1(=, 6=). Then we can determine whether W is weakly or strongly satisfiable in time O(♯(W )(♭(W ) − 1)♭(W )). Note that we can extend this result to WSP3(=, 6=) as described in the proof of Theorem 5 (that is, using the reduction to multiple instances of WSP1(=, 6=), where the number of instances 13 is O(♭(W )2)). The above result asserts that the complexity of checking whether a workflow is strongly satisfiable is determined by ♭(W ) and ♯(W ). Crude upper bounds for these parameters are k and 2k, both functions of k only. Thus, determining whether a conditional workflow is strongly satisfiable is FPT. Of course, these bounds can be improved: the upper bound for ♭(W ) is only attained if no xor composition is used, in which case ♯(W ) = 1; conversely, introducing xor composition may reduce the maximum length, and using only xor composition reduces the number of derived specifications to k. The question is: What deployment of k − 1 composition operators for k steps yields the worst-case complexity? We have the following result. Theorem 9. Given k workflow steps, a workflow has no more than: • 3k′ execution sets if k = 3k′; • 4 · 3k′ −1 execution sets if k = 3k′ + 1; and • 2 · 3k′ execution sets if k = 3k′ + 2. Remark 10. The proof of the above result (see appendix) is constructive, in the sense that it tells us how to maximize the number of execution sets for a fixed set of k steps. Given k steps, we obtain a workflow with the greatest possible number of execution sets by taking the serial (or parallel) composition of sub-workflows ⊕2 and ⊕3, where ⊕i denotes the xor composition of i steps. More specifically, if k = 3a, we take the serial composition of a copies of ⊕3; if k = 3a + 1, we take the serial composition of a − 1 copies of ⊕3 and two copies of ⊕2; and if k = 3a + 2, we take the serial composition of a copies of ⊕3 and one copy of ⊕2. We may conclude that ♭(W ) for such a workflow is no greater than ⌈k/3⌉. Remark 11. Note that using xor composition reduces ♭(W ). And note that the exponential term in the complexity of solving WSP1(=, 6=) is determined by the number of steps in the workflow, for which an upper bound is ♭(W ) in the case of non-deterministic workflow specifications. For a fixed k, it follows from Theorem 9 that the worst-case complexity for WSP1(=, 6=) occurs for a workflow specification with a single execution set (of k steps). 5 Further Applications In this section, we study two problems from the literature and establish that they are fixed- parameter tractable. In both cases, we represent the problem as a workflow satisfiability problem using constraint expressions. 5.1 Ordered WSP We note that the version of WSP considered so far in this paper makes no use of the order relation on the set of steps. This is a simplification introduced by Wang and Li [21]. In fact, the definition of workflow constraints by Crampton [10] prohibited constraints of the form (ρ, s, s′) for s > s′. Moreover, a plan was required to specify an execution order for the steps in the workflow (in addition to the assignment of steps to users). This, in turn, means that Crampton's definition of constraint satisfaction (and hence of the workflow satisfiability problem) is more complex. More formally, we have the following definitions. Definition 12. Let W = ((S, E), U, A, C) be a workflow comprising k steps. A tuple (s1, . . . , sk) is an execution schedule for W if {s1, . . . , sk} = S and, for all 1 6 i < j 6 k, si 6> sj.7 We say si precedes sj in an execution schedule if i < j. 7In other words, an execution schedule is a linear extension or topological sort of (S, 6). 14 For the workflow depicted in Figure 1, (s2, s1, . . . ) is not an execution schedule, for example, but (s1, s2, s3, s5, s4, s6) and (s1, s2, s3, s4, s5, s6) are. Definition 13. The (Type 1) constraint (ρ, s, s′) is satisfied by execution schedule σ and plan π if one of the following holds: (i) s precedes s′ in σ and (π(s), π(s′)) ∈ ρ; (ii) s′ precedes s in σ. The intuition here is that a constraint (ρ, s, s′) is well-formed only if s could precede s′ in the execution of some instance of the workflow (that is, either s < s′ or s k s′). Moreover, if s does occur before s′, then the execution of s′ is constrained by ρ and the identity of the user that performed s. A modified version of WSP, based on the above definitions, is defined in the following way. Ordered WSP (OWSP) Input: A constrained workflow authorization schema ((S, E), U, A, C). Output: True if there exists an execution schedule σ and a plan π that satisfy all constraints in C, and False otherwise. Note that it may not be possible to find a valid plan π for a particular execution schedule σ. Conversely, there may be a plan π for which there exist schedules σ and σ′ such that (σ, π) satisfies all constraints but (σ′, π) does not. Consider, for example, a plan π that is valid for our purchase order workflow such that π(s3) = π(s4). If we add the constraint (6=, s3, s4), then π is valid for any execution schedule in which s4 precedes s3 and invalid otherwise. The above example also shows there exist workflows for which a plan π is not a solution to WSP, but for which (σ, π) is a solution to OWSP for certain choices of σ. Crampton introduced the notion of a well-formed workflow, which has the following property: for all si k sj, (ρ, si, sj) ∈ C if and only if (ρ, sj, si) ∈ C, where ρ is defined to be {(u, u′) ∈ U × U : (u′, u) ∈ ρ}. To ensure that the workflow in the above example is well-formed, we would add the constraint (6=, s4, s3) to C. It is easy to see that OWSP for well-formed workflows and WSP are essentially equivalent, since a valid plan for one execution schedule will be a valid plan for any execution schedule [10, Lemma 9]. Nevertheless, there will be business processes that cannot be represented using a well-formed workflow schema. In the purchase order example illustrated in Figure 1, for example, it would be quite reasonable to impose constraints on s3 and s4 that would mean the resulting workflow schema was not well-formed. Suppose, for example, that ∼ is an equivalence relation on U , where u ∼ u′ if and only if u and u′ belong to the same department. Then the constraints (≁, s3, s4) and (6=, s4, s3) require that if s3 (the sign GRN step) is performed before s4 (the create payment step), then the user that performs s4 must be in a different department from the user that performs s3; whereas if the steps are performed in the reverse order, we only require the users to be different (since the more commercially sensitive step has been performed first in this case). Note that OWSP is only defined for Type 1 constraints (see Definition 13). Wang and Li showed that WSP is W[1]-hard [13] for arbitrary constraint relations (even if only Type 1 constraints) are used [21]. Moreover, any instance of WSP defines an instance of OWSP. Thus, OWSP is W[1]-hard. However, there is a strong connection between WSP and OWSP. Proposition 14. OWSP1(ρ1, . . . , ρt) is FPT if WSP1(ρ1, . . . , ρt) is. A stronger notion of satisfiability for OWSP would require that there exists a plan for every execution schedule (as for conditional workflows). In this case, we simply require that every one of the O(k!) derived instances of WSP is satisfiable. The worst-case complexity of determining "weak" and "strong" satisfiability for OWSP is, therefore, the same. Note that an instance of WSP is satisfiable if the corresponding instance of OWSP is strongly satisfiable. 15 5.2 Identifying Constraint Violation Consider the following problem: Given a constrained workflow specification ((S, E), U, A, C), does there exist a plan α such that (s, α(s)) ∈ A for all s ∈ S and at least one constraint C that is not satisfied? This question is of interest because if we know that no such plan exists, then we do not need a reference monitor: any allocation of (authorized) users to steps will satisfy all the constraints. This question has been studied by Armando and colleagues [2, 4] and solutions have been computed using model checkers. We answer this question by examining the satisfiability of the "negation" of the problem, rewritten using the language of constraint expressions. Theorem 15. Determining whether there exists a plan that violates a workflow specification ((S, E), U, A, C), where all constraints have the form (=, S1, S2) or (6=, S1, S2), is FPT. The approach described above can also be used to "prune" a workflow specification. Given a workflow specification ((S, E), U, A, C), we can identify, with the same (worst-case) time com- plexity, all constraints in C that can be violated. This enables us to remove any constraints that cannot be violated, leaving a workflow specification ((S, E, U, A, C ′), with C ′ ⊆ C. In Section 2.2, we identified situations in which we may be required to solve WSP for a workflow specification multiple times. Thus, reducing the set of constraints will reduce the complexity of subsequent attempts to determine the satisfiability of the workflow specification. 6 Concluding Remarks In this paper, we have explored the use of constraint expressions as a means of translating different versions of the workflow satisfiability problem into one or more instances of WSP1(6=). Constraint expressions provide a uniform way of representing the workflow satisfiability problem and related problems, such as WSP for conditional workflows (Section 4), ordered WSP and the identification of constraints that can be violated (Section 5). This, in turn, enables us to establish the complexity of solving these problems. We also believe our characterization of workflow composition, the representation of workflows as trees, and execution sets may be useful modeling tools for future research on authorization in workflow systems. 6.1 Related Work Work on computing plans for workflows that must simultaneously satisfy authorization policies and constraints goes back to the seminal paper of Bertino et al. [8]. This work considered linear workflows and noted the existence of an exponential algorithm for computing valid plans. Crampton extended the model for workflows to partially ordered sets (equivalently, directed acyclic graphs) and to directed acyclic graphs with loops [10]. Wang and Li further extended this model to include Type 2 constraints [21]. Wang and Li first investigated the computational complexity and, significantly, the existence of fixed-parameter tractable algorithms for the workflow satisfiability problem [21]. One or their main results [21, Theorem 9] is very similar to the result we prove for WSP2(=, 6=) (Theorem 5), although our approach is more direct and generalizes to WSP3(=, 6=). Crampton et al. introduced a new method for solving the problem [12], which yields significantly better complexity bounds for WSP3(=, 6=). However, their methods only apply for certain kinds of constraints; indeed, it is not clear whether their approach extends to relations other than ∆, ∆c and constraints using equivalence relations defined on the user set. The use of constraint expressions to represent and reason about the complexity of the work- flow satisfiability problem appears, therefore, to have some significant advantages, one specific 16 advantage being its versatility, over existing approaches. Khan and Fong introduced the notion of a constraint expression to reason about the problem of workflow feasibility [16], which asks: Given a set of constraints and restrictions on admissible authorization policies, does there exist an authorization policy from which we can construct a valid plan? Their work was undertaken in the context of the relationship-based access control model [14], in which the "shape" of au- thorization policies is restricted, and does not explore fully the possibility of using constraints expressions to solve the "classical" workflow satisfiability problem. It is widely accepted that it is useful to have conditional branching in workflow specifica- tions [20, 22]. However, there is very little prior work on the workflow satisfiability problem, or its complexity, for conditional workflows. Khan's master's thesis includes work on existential satisfiability (what we have called weak satisfiability) and universal (strong) satisfiability [15, Chapter 8] but does not consider fixed parameter tractability. 6.2 Future Work There are a number of opportunities for future work. Crampton et al. studied the workflow satisfiability problem in the presence of constraints specified using an equivalence relation ∼ defined on U [12]. The relation ∆ may be viewed as an equivalence relation, in which each equivalence class is a single user. We would like to investigate whether our methods can be extended to solve WSP(=, 6=, ∼, ≁), where ∼ is not equal to ∆. This is a non-trivial problem as we cannot use our trick of considering only those steps for which there are fewer than k authorized users. A second problem we would like to consider is the optimal workflow-aware authorization administration problem, which determines whether it is possible to modify the authorization relation, subject to some bound on the "cost" of the changes, when the workflow is unsatisfiable [7]. Finally, we would like (a) to remove the restriction that (S, E) is an ayclic graph, so that we can model sub-workflows that can be repeated, and (b) to include inclusive gateways [22], allowing for one or more sub-workflows to be executed. Both of these extensions can be readily modeled using execution sets (or multisets). If, for example, S1 and S2 are execution sets for W1 and W2, respectively, then S1, S2 and S1 ∪ S2 are execution sets for W1 + W2, where + indicates inclusive-or composition. References [1] American National Standards Institute. ANSI INCITS 359-2004 for Role Based Access Control, 2004. [2] A. Armando, E. Giunchiglia, and S. E. Ponta. Formal specification and automatic analysis of business processes under authorization constraints: An action-based approach. In S. Fischer- Hubner, C. Lambrinoudakis, and G. Pernul, editors, TrustBus, volume 5695 of Lecture Notes in Computer Science, pages 63 -- 72. Springer, 2009. [3] A. Armando and S. Ponta. Model checking of security-sensitive business processes. In P. Degano and J. D. Guttman, editors, Formal Aspects in Security and Trust, volume 5983 of Lecture Notes in Computer Science, pages 66 -- 80. Springer, 2009. [4] A. Armando and S. Ranise. Automated analysis of infinite state workflows with access control policies. In C. Meadows and M. C. F. Gago, editors, STM, volume 7170 of Lecture Notes in Computer Science, pages 157 -- 174. Springer, 2011. [5] J. Bang-Jensen and G. Gutin. Digraphs: Theory, Algorithms and Applications. Springer, 2nd edition, 2009. 17 [6] D. A. Basin, S. J. Burri, and G. Karjoth. Obstruction-free authorization enforcement: Aligning security with business objectives. In CSF, pages 99 -- 113. IEEE Computer Society, 2011. [7] D. A. Basin, S. J. Burri, and G. Karjoth. Optimal workflow-aware authorizations. In V. Atluri, J. Vaidya, A. Kern, and M. Kantarcioglu, editors, SACMAT, pages 93 -- 102. ACM, 2012. [8] E. Bertino, E. Ferrari, and V. Atluri. The specification and enforcement of authorization constraints in workflow management systems. ACM Trans. Inf. Syst. Secur., 2(1):65 -- 104, 1999. [9] D. F. C. Brewer and M. J. Nash. The Chinese Wall security policy. In IEEE Symposium on Security and Privacy, pages 206 -- 214. IEEE Computer Society, 1989. [10] J. Crampton. A reference monitor for workflow systems with constrained task execution. In E. Ferrari and G.-J. Ahn, editors, SACMAT, pages 38 -- 47. ACM, 2005. [11] J. Crampton, G. Gutin, and A. Yeo. On the parameterized complexity and CoRR, abs/1205.0852, 2012. kernelization of http://arxiv.org/abs/1205.0852. the workflow satisfiability problem. [12] J. Crampton, G. Gutin, and A. Yeo. On the parameterized complexity of the workflow satisfiability problem. In T. Yu, G. Danezis, and V. D. Gligor, editors, ACM Conference on Computer and Communications Security, pages 857 -- 868. ACM, 2012. [13] R. G. Downey and M. R. Fellows. Parameterized Complexity. Springer Verlag, 1999. [14] P. W. L. Fong. Relationship-based access control: protection model and policy language. In R. S. Sandhu and E. Bertino, editors, CODASPY, pages 191 -- 202. ACM, 2011. [15] A. A. Khan. Satisfiability and feasibility in a relationship-based workflow authorization model. Master's thesis, University of Calgary, 2012. [16] A. A. Khan and P. W. L. Fong. Satisfiability and feasibility in a relationship-based workflow authorization model. In S. Foresti, M. Yung, and F. Martinelli, editors, ESORICS, volume 7459 of Lecture Notes in Computer Science, pages 109 -- 126. Springer, 2012. [17] M. Kohler and A. Schaad. Proactive access control for business process-driven environments. In ACSAC, pages 153 -- 162. IEEE Computer Society, 2008. [18] R. Niedermeier. Invitation to Fixed-Parameter Algorithms. Oxford University Press, 2006. [19] A. Schafer, C. Komusiewicz, H. Moser, and R. Niedermeier. Parameterized computational complexity of finding small-diameter subgraphs. Optimization Letters, 6(5):883 -- 891, 2012. [20] W. M. P. van der Aalst, A. H. M. ter Hofstede, B. Kiepuszewski, and A. P. Barros. Workflow patterns. Distributed and Parallel Databases, 14(1):5 -- 51, 2003. [21] Q. Wang and N. Li. Satisfiability and resiliency in workflow authorization systems. ACM Trans. Inf. Syst. Secur., 13(4):40, 2010. [22] S. A. White and D. Miers. BPMN Modeling and Reference Guide. Future Strategies, Incorporated, 2008. 18 A Proofs Proof of Corollary 6. For WSP2(=, 6=), in the worst case, each constraint has the form (ρ, s, S ′), with s 6∈ S ′. Hence, the number of Type 2 constraints can be no greater than k2k−1. It now follows from Theorem 5 that WSP2(=, 6=) is FPT. For WSP3(=, 6=), in the worst case, each constraint has the form (ρ, S ′, S ′′). Thus, noting that (ρ, S ′, S ′′) is equivalent for WSP3(=, 6=), the number of Type 3 constraints can be no greater than 2k · 2k = 22k, from which it follows that WSP3(=, 6=) is FPT. Proof of Proposition 8. The result follows by noting that determining strong satisfiability re- quires us to check whether all ♯(W ) derived instances of W are satisfiable, while determining weak satisfiability requires us to check whether at least one derived instance is satisfiable. The complexity, in the worst case, is the same. The complexity of checking a single instance is (k′ − 1)k′ , where k′ is the number of steps in the derived instance. The result now follows. Proof of Theorem 9. First observe that may disregard the k operator in computing an upper bound on ♯(W ). To see this, note that the parallel operator requires, like the serial operator, that all steps in the sub-workflows are performed. In particular, an execution set for workflow W1 k W2 has the form S1 ∪ S2, where Si is an execution set for workflow Wi. Recall ⊕i represents the xor composition of i steps and ♯(⊕i ; ⊕j) = ♯(⊕j ; ⊕i) = ij. We proceed by induction on k. For k = 2, we may construct ⊕1 ; ⊕1 and ⊕2, thus the result holds for k = 2. For k = 3, we may construct three different workflows: thus the result holds for k = 3. Finally, for k = 4, we may construct ⊕1 ; ⊕1 ; ⊕1, ⊕1 ; ⊕2, and ⊕3, ⊕1 ; ⊕1 ; ⊕1 ; ⊕1, ⊕1 ; ⊕1 ; ⊕2, ⊕1 ; ⊕3, ⊕2 ; ⊕2 and ⊕4, thus the result holds for k = 4. Now consider k > 4 steps and suppose the result holds for all workflows constructed from k − 1 or fewer steps. Then for any split of k into workflows W1 and W2 comprising k1 and k2 steps, respectively, such that k1 + k2 = k, we may form W1 ; W2 or W1 ⊕ W2. Clearly, for k > 4, ♯(W1 ; W2) > ♯(W1 ⊕ W2). Moreover, ♯(W1 ; W2) = ♯(W1) · ♯(W2). First consider the case k = 3a and let ki = 3ai + bi, i = 1, 2, with bi ∈ {0, 1, 2}. We assume If b1 = b2, then k1 and k2 are divisible by 3 and (without loss of generality) that b1 6 b2. ♯(Wi) 6 3ai by the inductive hypothesis, whence ♯(W ) = ♯(W1) · ♯(W2) 6 3a1 · 3a2 = 3a. If b1 = 1 and b2 = 2, then we have a1 + a2 = a − 1 and ♯(W ) = ♯(W1) · ♯(W2) 6 4 · 3a1−1 · 2 · 3a2 = 8 · 3a−2 < 3a and the result holds. Now consider the case k = 3a + 1. If b1 = 0, then b2 = 1 and a1 + a2 = a. Hence, by the inductive hypothesis, we have ♯(W ) 6 3a1 · 4 · 3a2−1 = 4 · 3a−1, 19 as required. If b1 = b2, then we have bi = 2 and a1 + a2 = a − 1. Hence, by the inductive hypothesis, we have ♯(W ) 6 2 · 3a1 · 2 · 3a2 = 4 · 3a−1, as required. Finally, consider the case k = 3a + 2. If b1 = 0, then b2 = 2 and a1 + a2 = a. Hence, by the inductive hypothesis, we have ♯(W ) 6 3a1 · 2 · 3a2 = 2 · 3a, as required. If b1 = b2, then bi = 1 and a1 + a2 = a. Hence, we have ♯(W ) 6 16 · 3a1+a2−2 = 16 9 · 3a < 2 · 3a. as required. Proof of Proposition 14. An instance of OWSP1 contains a set of constraints C and we may as- sume that C contains at least two constraints of the form (ρi, s, s′) and (ρj, s′, s) with ρi 6= eρj. (If no such constraints exist then OWSP1(ρ1, . . . , ρt) is identical to an instance of WSP1(ρ1, . . . , ρt).) Observe that the number of linear extensions of (S, 6) (and hence possible execution schedules) is determined only by k. Specifically, the number of linear extensions is no greater than k!. Note also that in any execution of the workflow, either s precedes s′ or vice versa. Hence each linear extension allows us to discard either (ρi, s, s′) or (ρj , s′, s) (since exactly one of them will be irrelevant to the schedule defined by the linear extension), thus defining an instance of WSP that contains fewer constraints than the original problem. In other words, we may consider our instance of OWSP1 to be the disjunction of k! instances of WSP1. If each instance of WSP1 is FPT, we can solve each of these instances, thus solving the original instance of OWSP1. Proof of Theorem 15. A Type 1 constraint (ρ, s, s′) is satisfied by a plan α if (α(s), α(s′)) ∈ ρ and is not satisfied ("violated") otherwise. In other words, (ρ, s, s′) is violated by α if (α(s), α(s′)) 6∈ ρ. Equivalently, a constraint (ρ, s, s′) is violated iff (ρ, s, s′) is satisfied, where ρ def= {(u, u′) ∈ U × U : (u, u′) 6∈ ρ} . A Type 2 constraint (ρ, s, S ′), S ′ ⊆ S is violated if (ρ, s, s′) is violated for all s′ ∈ S ′. In other words, (ρ, s, S ′) is violated iff the constraint expression ^ s′∈S ′ (ρ, s, s′) is satisfied. Similarly, a Type 3 constraint (ρ, S ′, S ′′) is violated iff the constraint expression ^ s′ ∈S ′,s′′ ∈S ′′ (ρ, s′, s′′) is satisfied. Finally a set of constraints {c1, . . . , ct} is violated if at least one ci is violated. In other words, we can determine whether there exists a plan that violates a set of constraints by de- termining if there exists a plan α that satisfies a constraint expression in disjunctive normal form, where each clause is a conjunction of Type 1 constraints. We make the following observations. • There are no more than c disjuncts, where c is the number of constraints in the original workflow specification. 20 • A Type 2 constraint, when rewritten in the above way, gives rise to a conjunction of no more than k − 1 Type 1 constraints, while a Type 3 constraint gives rise to no more than k2 Type 1 constraints. • There can be no more than k2k Type 2 constraints in a workflow specification and no more than 4k Type 3 constraints. • ∆ is ∆c and ∆c is ∆. • By Theorem 5, the time taken to solve WSP1(∆, ∆c) (that is, WSP1(=, 6=)) is O(c(k − 1)k + kn), where c is the number of constraints. Therefore, there exists an FPT algorithm to determine whether there exists a plan π in which each user is authorized and a constraint that π does not satisfy, since we need only find a single disjunct that is true, and each disjunct represents a workflow specification containing only Type 1 constraints. The time taken to solve this new problem is O(k2k−1((k − 1)k+1 + kn)) for Type 2 constraints and O(4k(k(k − 1)k+1 + kn)) for Type 3 constraints. 21
1806.01119
1
1806
2018-06-04T13:51:29
Covering with Clubs: Complexity and Approximability
[ "cs.DS" ]
Finding cohesive subgraphs in a network is a well-known problem in graph theory. Several alternative formulations of cohesive subgraph have been proposed, a notable example being $s$-club, which is a subgraph where each vertex is at distance at most $s$ to the others. Here we consider the problem of covering a given graph with the minimum number of $s$-clubs. We study the computational and approximation complexity of this problem, when $s$ is equal to 2 or 3. First, we show that deciding if there exists a cover of a graph with three $2$-clubs is NP-complete, and that deciding if there exists a cover of a graph with two $3$-clubs is NP-complete. Then, we consider the approximation complexity of covering a graph with the minimum number of $2$-clubs and $3$-clubs. We show that, given a graph $G=(V,E)$ to be covered, covering $G$ with the minimum number of $2$-clubs is not approximable within factor $O(|V|^{1/2 -\varepsilon})$, for any $\varepsilon>0$, and covering $G$ with the minimum number of $3$-clubs is not approximable within factor $O(|V|^{1 -\varepsilon})$, for any $\varepsilon>0$. On the positive side, we give an approximation algorithm of factor $2|V|^{1/2}\log^{3/2} |V|$ for covering a graph with the minimum number of $2$-clubs.
cs.DS
cs
Covering with Clubs: Complexity and Approximability Riccardo Dondi1, Giancarlo Mauri2, Florian Sikora3, and Italo Zoppis2 1 Universit`a degli Studi di Bergamo, Bergamo, Italy [email protected] 2 Universit`a degli Studi di Milano-Bicocca, Milano - Italy {mauri,zoppis}@disco.unimib.it 3 Universit´e Paris-Dauphine, PSL Research University, CNRS UMR 7243, LAMSADE, 75016 Paris, France [email protected] Abstract. Finding cohesive subgraphs in a network is a well-known problem in graph theory. Several alternative formulations of cohesive subgraph have been proposed, a notable example being s-club, which is a subgraph where each vertex is at distance at most s to the others. Here we consider the problem of covering a given graph with the minimum number of s-clubs. We study the computational and approximation complexity of this problem, when s is equal to 2 or 3. First, we show that deciding if there exists a cover of a graph with three 2-clubs is NP-complete, and that deciding if there exists a cover of a graph with two 3-clubs is NP-complete. Then, we consider the approximation complexity of covering a graph with the minimum number of 2-clubs and 3-clubs. We show that, given a graph G = (V, E) to be covered, covering G with the minimum number of 2-clubs is not approximable within factor O(V 1/2−ε), for any ε > 0, and covering G with the minimum number of 3-clubs is not approximable within factor O(V 1−ε), for any ε > 0. On the positive side, we give an approximation algorithm of factor 2V 1/2 log3/2 V for covering a graph with the minimum number of 2-clubs. 1 Introduction The quest for modules inside a network is a well-known and deeply studied problem in network analysis, with several application in different fields, like computational biology or social network analysis. A highly investigated problem is that of finding cohesive subgroups inside a network which in graph theory translates in highly connected subgraphs. A common approach is to look for cliques (i.e. complete graphs), and several combinatorial problems have been considered, notable examples being the Maximum Clique problem ([11, GT19]), the Minimum Clique Cover problem ([11, GT17]), and the Minimum Clique Partition problem ([11, GT15]). This last is a classical problem in theoretical computer science, whose goal is to partition the vertices of a graph into the minimum number of cliques. The Minimum Clique Partition problem has been deeply studied since the seminal paper of Karp [15], studying its complexity in several graph classes [5,6,21,9]. In some cases, asking for a complete subgraph is too restrictive, as interesting highly connected graphs may have some missing edges due to noise in the data considered or because some pair may not be directly connected by an edge in the subgraph of interest. To overcome this limitation of the clique approach, alternative definitions of highly connected graphs have been proposed, leading to the concept of relaxed clique [16]. A relaxed clique is a graph G = (V, E) whose vertices satisfy a property which is a relaxation of the clique property. Indeed, a clique is a subgraph whose vertices are all at distance one from each other and have the same degree (the size of the clique minus one). Different definitions of relaxed clique are obtained by modifying one of the properties of clique, thus leading to distance-based relaxed cliques, degree-based relaxed cliques, and so on (see for example [16]). In this paper, we focus on a distance-based relaxation. In a clique all the vertices are required to be at distance at most one from each other. Here this constraint is relaxed, so that the ver- tices have to be at distance at most s, for an integer s (cid:62) 1. A subgraph whose vertices are all distance at most s is called an s-club (notice that, when s = 1, an s-club is exactly a clique). The identification of s-clubs inside a network has been applied to social networks [19,1,18,20,23], and biological networks [3]. Interesting recent studies have shown the relevance of finding s-clubs 2 in a network [18,20], in particular focusing on finding 2-clubs in real networks like DBLP or a European corporate network. Contributions to the study of s-clubs mainly focus on the Maximum s-Club problem, that is the problem of finding an s-club of maximum size. Maximum s-Club is known to be NP-hard, for each s (cid:62) 1 [4]. Even deciding whether there exists an s-club larger than a given size in a graph of diameter s + 1 is NP-complete, for each s (cid:62) 1 [3]. The Maximum s-Club problem has been studied also in the approximability and parameterized complexity framework. A polynomial-time approximation algorithm with factor V 1/2 for every s (cid:62) 2 on an input graph G = (V, E) has been designed [2]. This is optimal, since the problem is not approximable within factor V 1/2−ε, on an input graph G = (V, E), for each ε > 0 and s (cid:62) 2 [2]. As for the parameterized complexity framework, the problem is known to be fixed-parameter tractable, when parameterized by the size of an s-club [22,17,7]. The Maximum s-Club problem has been investigated also for structural parameters and specific graph classes [13,12]. In this paper, we consider a different combinatorial problem, where we aim at covering the vertices of a network with a set of subgraphs. Similar to Minimum Clique Partition, we consider the problem of covering a graph with the minimum number of s-clubs such that each vertex belongs to an s-club. We denote this problem by Min s-Club Cover, and we focus in particular on the cases s = 2 and s = 3. We show some analogies and differences between Min s-Club Cover and Minimum Clique Partition. We start in Section 3 by considering the computational complexity of the problem of covering a graph with two or three s-clubs. This is motivated by the fact that Clique Partition is known to be in P when we ask whether there exists a partition of the graph consisting of two cliques, while it is NP-hard to decide whether there exists a partition of the graph consisting of three cliques [10]. As for Clique Partition, we show that it is NP-complete to decide whether there exist three 2-clubs that cover a graph. On the other hand, we show that, unlike Clique Partition, it is NP-complete to decide whether there exist two 3-clubs that cover a graph. These two results imply also that Min 2-Club Cover and Min 3-Club Cover do not belong to the class XP for the parameter "number of clubs" in a cover. Then, we consider the approximation complexity of Min 2-Club Cover and Min 3-Club Cover. We recall that, given an input graph G = (V, E), Minimum Clique Partition is not approximable within factor O(V 1−ε), for any ε > 0, unless P = N P [24]. Here we show that Min 2-Club Cover has a slightly different behavior, while Min 3-Club Cover is similar to Clique Partition. Indeed, in Section 4 we prove that Min 2-Club Cover is not approximable within factor O(V 1/2−ε), for any ε > 0, unless P = N P , while Min 3-Club Cover is not approximable within factor O(V 1−ε), for any ε > 0, unless P = N P . In Section 5, we present a greedy approximation algorithm that has factor 2V 1/2 log3/2 V for Min 2-Club Cover, which almost match the inapproximability result for the problem. We start the paper by giving in Section 2 some definitions and by formally defining the problem we are interested in. 2 Preliminaries Given a graph G = (V, E) and a subset V (cid:48) ⊆ V , we denote by G[V (cid:48)] the subgraph of G induced by V (cid:48). Given two vertices u, v ∈ V , the distance between u and v in G, denoted by dG(u, v), is the length of a shortest path from u to v. The diameter of a graph G = (V, E) is the maximum distance between two vertices of V . Given a graph G = (V, E) and a vertex v ∈ V , we denote by NG(v) the set of neighbors of v, that is NG(v) = {u : {v, u} ∈ E}. We denote by NG[v] the close neighborhood of V , that is NG[v] = NG(v) ∪ {v}. Define N l G(v) = {u : u has distance at most l from v}, with 1 (cid:54) l (cid:54) 2. Given a set of vertices X ⊆ V and l, with 1 (cid:54) l (cid:54) 2, define N l G(u). We may omit the subscript G when it is clear from the context. Now, we give the definition of s-club, which is fundamental for the paper. Definition 1. Given a graph G = (V, E), and a subset V (cid:48) ⊆ V , G[V (cid:48)] is an s-club if it has diameter at most s. G(X) =(cid:83) u∈X N l Notice that an s-club must be a connected graph. We present now the formal definition of the Minimum s-Club Cover problem we are interested in. 3 Minimum s-Club Cover (Min s-Club Cover) Input: a graph G = (V, E) and an integer s (cid:62) 2. Output: a minimum cardinality collection S = {V1, . . . , Vh} such that, for each i with 1 (cid:54) i (cid:54) h, Vi ⊆ V , G[Vi] is an s-club, and, for each vertex v ∈ V , there exists a set Vj, with 1 (cid:54) j (cid:54) h, such that v ∈ Vj. We denote by s-Club Cover(h), with 1 (cid:54) h (cid:54) V , the decision version of Min s-Club Cover that asks whether there exists a cover of G consisting of at most h s-clubs. Notice that while in Minimum Clique Partition we can assume that the cliques that cover a graph G = (V, E) partition V , hence the cliques are vertex disjoint, we cannot make this assumption for Min s-Club Cover. Indeed, in a solution of Min s-Club Cover, a vertex may be covered by more than one s-club, in order to have a cover consisting of the minimum number of s-clubs. Consider the example of Fig. 1. The two 2-clubs induced by {v1, v2, v3, v4, v5} and {v1, v6, v7, v8, v9} cover G, and both these 2-clubs contain vertex v1. However, if we ask for a partition of G, we need at least three 2-clubs. This difference between Minimum Clique Partition and Min s-Club Cover is due to the fact that, while being a clique is a hereditary property, this is not the case for being an s-club. If a graph G is an s-club, then a subgraph of G may not be an s-club (for example a star is a 2-club, but the subgraph obtained by removing its center is not anymore a 2-club). G v3 v2 v6 v7 v1 v4 v5 v9 v8 Fig. 1. A graph G and a cover consisting of two 2-clubs (induced by the vertices in the ovals). Notice that the 2-clubs of this cover must both contain vertex v1. 3 Computational Complexity In this section we investigate the computational complexity of 2-Club Cover and 3-Club Cover and we show that 2-Club Cover(3), that is deciding whether there exists a cover of a graph G with three 2-clubs, and 3-Club Cover(2), that is deciding whether there exists a cover of a graph G with two 3-clubs, are NP-complete. 3.1 2-Club Cover(3) is NP-complete In this section we show that 2-Club Cover(3) is NP-complete by giving a reduction from the 3-Clique Partition problem, that is the problem of computing whether there exists a partition of a graph Gp = (V p, Ep) in three cliques. Consider an instance Gp = (V p, Ep) of 3-Clique Partition, we construct an instance G = (V, E) of 2-Club Cover(3) (see Fig. 2). The vertex set V is defined as follows: V = {wi : vi ∈ V p} ∪ {wi,j : {vi, vj} ∈ Ep ∧ i < j}} The set E of edges is defined as follows: E = {{wi, wi,j},{wi, wh,i} : vi ∈ V p, wi, wi,j, wh,i ∈ V }∪ {{wi,j, wi,l},{wi,j, wh,i},{wh,i, wz,i} : wi,j, wi,l, wh,i, wz,i ∈ V } Before giving the main results of this section, we prove a property of G. 4 Lemma 2. Let Gp = (V p, Ep) be an instance of 3-Clique Partition and let G = (V, E) be the cor- responding instance of 2-Club Cover(3). Then, given two vertices vi, vj ∈ V p and the corresponding vertices wi, wj ∈ V : – if {vi, vj} ∈ Ep, then dG(wi, wj) = 2 – if {vi, vj} /∈ Ep, then dG(wi, wj) (cid:62) 3 Proof. Notice that NG(wi) = {wi,z : {vi, vz} ∈ Ep ∧ i < z} ∪ {wh,i : {vi, vh} ∈ Ep ∧ h < i}. It follows that wj ∈ N 2 G(wi) if and only if there exists a vertex wi,j (or wj,i), which is adjacent to both wi and wj. But then, by construction, wj ∈ N 2 (cid:117)(cid:116) G(wi) if and only if {vi, vj} ∈ Ep. We are now able to prove the main properties of the reduction. Lemma 3. Let Gp = (V p, Ep) be a graph input of 3-Clique Partition and let G = (V, E) be the corresponding instance of 2-Club Cover(3). Then, given a solution of 3-Clique Partition on Gp = (V p, Ep), we can compute in polynomial time a solution of 2-Club Cover(3) on G = (V, E). 3 ⊆ V p be Proof. Consider a solution of 3-Clique Partition on Gp = (V p, Ep), and let V p the sets of vertices of Gp that partition V p. We define a solution of 2-Club Cover(3) on G = (V, E) as follows. For each d, with 1 (cid:54) d (cid:54) 3, define 1 , V p 2 , V p Vd = {wj ∈ V : vj ∈ V p d } ∪ {wi,j : vi ∈ V p d } We show that each G[Vd], with 1 (cid:54) d (cid:54) 3, is a 2-club. Consider two vertices wi, wj ∈ Vd, with 1 (cid:54) i < j (cid:54) V . Since they correspond to two vertices vi, vj ∈ V p that belong to a clique of Gp, it follows that {vi, vj} ∈ Ep and wi,j ∈ Vd. Thus dG[Vd](wi, wj) = 2. Now, consider the vertices wi ∈ Vd, with 1 (cid:54) i (cid:54) V , and wh,z ∈ Vd, with 1 (cid:54) h < z (cid:54) V . If i = h or i = z, assume w.l.o.g. i = h, then by construction dG[Vd](wi, wi,z) = 1. Assume that i (cid:54)= h and i (cid:54)= z (assume w.l.o.g. that i < h < z), since wh,z ∈ Vd, it follows that wh ∈ Vd. Since wi, wh ∈ Vd, it follows that wi,h ∈ Vd. By construction, there exist edges {wi,h, wh,z}, {wi, wi,h} in Ep, thus implying that dG[Vd](wi, wh,z) = 2. Finally, consider two vertices wi,j, wh,z ∈ Vd, with 1 (cid:54) i < j (cid:54) V and 1 (cid:54) h < z (cid:54) V . Then, by construction, wi ∈ Vd and wh ∈ Vd. But then, wi,h belongs to Vd, and, by construction, {wi,j, wi,h} ∈ E and {wh,z, wi,h} ∈ E. It follows that dG[Vd](wi,j, wh,z) = 2. that V = V1 ∪ V2 ∪ V3, thus G[V1], G[V2], G[V3] covers G. We conclude the proof observing that, by construction, since V p 3 partition V p, it holds (cid:117)(cid:116) 1 , V p 2 , V p Gp v4 v5 v1 v2 G w4 w1,4 w1 w4,5 w5 w1,2 w2,5 w2 v3 w1,3 w2,3 w3 Fig. 2. An example of a graph Gp input of 3-Clique Partition and the corresponding graph G input of 2-Club Cover(3). Based on Lemma 2, we can prove the following result. Lemma 4. Let Gp = (V p, Ep) be a graph input of 3-Clique Partition and let G = (V, E) be the corresponding instance of 2-Club Cover(3). Then, given a solution of 2-Club Cover(3) on G = (V, E), we can compute in polynomial time a solution of 3-Clique Partition on Gp = (V p, Ep). 5 Proof. Consider a solution of 2-Club Cover(3) on G = (V, E) consisting of three 2-clubs G[V1], G[v2], G[V3]. Consider a 2-club G[Vd], with 1 (cid:54) d (cid:54) 3. By Lemma 2, it follows that, for each wi, wj ∈ Vd, {vi, vj} ∈ E. As a consequence, we can define three cliques Gp[V p 2 ], Gp[V p 3 ] in Gp as follows. For each d, with 1 (cid:54) d (cid:54) 3, V p 1 ], Gp[V p d is defined as: d = {vi : wi ∈ Vd} V p Next, we show that G[V p it holds {vi, vj} ∈ E, thus by construction {vi, vj} ∈ Ep and G[V p since V1 ∪ V2 ∪ V3 = V , then V p 3 = V p. Notice that V p but, starting from V p cliques. d ], with 1 (cid:54) d (cid:54) 3, is indeed a clique. By Lemma 2 if wi, wj ∈ Vd then d ] is a clique in Gp. Moreover, 1 , V p 3 may not be disjoint, 3 , it is easy to compute in polynomial time a partition of Gp in three (cid:117)(cid:116) 1 ∪ V p 2 ∪ V p 1 , V p 2 , V p 2 , V p Now, we can prove the main result of this section. Theorem 5. 2-Club Cover(3) is NP-complete. Proof. By Lemma 3 and Lemma 4 and from the NP-hardness of 3-Clique Partition [15], it follows that 2-Club Cover(3) is NP-hard. The membership to NP follows easily from the fact that, given three 2-clubs of G, it can be checked in polynomial time whether they are 2-clubs and cover all (cid:117)(cid:116) vertices of G. 3.2 3-Club Cover(2) is NP-complete In this section we show that 3-Club Cover(2) is NP-complete by giving a reduction from a variant of Sat called 5-Double-Sat. Recall that a literal is positive if it is a non-negated variable, while it is negative if it is a negated variable. Given a collection of clauses C = {C1, . . . , Cp} over the set of variables X = {x1, . . . , xq}, where each Ci ∈ C, with 1 (cid:54) i (cid:54) p, contains exactly five literals and does not contain both a variable and its negation, 5-Double-Sat asks for a truth assignment to the variables in X such that each clause Ci, with 1 (cid:54) i (cid:54) p, is double-satisfied. A clause Ci is double-satisfied by a truth assignment f to the variables X if there exist a positive literal and a negative literal in Ci that are both satisfied by f . Notice that we assume that there exist at least one positive literal and at least one negative literal in each clause Ci, with 1 (cid:54) i (cid:54) p, otherwise Ci cannot be doubled-satisfied. Moreover, we assume that each variable in an instance of 5-Double-Sat appears both as a positive literal and a negative literal in the instance. Notice that if this is not the case, for example a variable appears only as a positive literal, we can assign a true value to the variable, as defining an assignment to false does not contribute to double-satisfy any clause. First, we show that 5-Double-Sat is NP-complete, which may be of independent interest. Theorem 6. 5-Double-Sat is NP-complete. Proof. We reduce from 3-Sat, where given a set X3 of variables and a set C3 of clauses, which are a disjunction of 3 literals (a variable or the negation of a variable), we want to find an assignment to the variables such that all clauses are satisfied. Moreover, we assume that each clause in C3 does not contain a positive variable x and its negation x, since such a clause is obviously satisfied by any assignment. The same property holds also for the instance of 5-Double-Sat we construct. Consider an instance (X3,C3) of 3-Sat, we construct an instance (X,C) of 5-Double-Sat as follows. Define X = X3 ∪ XN , where X3 ∩ XN = ∅ and XN is defined as follows: The set C of clauses is defined as follows: XN = {xC,i,1, xC,i,2 : Ci ∈ C3} C = {Ci,1, Ci,2 : Ci ∈ C3} where Ci,1, Ci,2 are defined as follows. Consider Ci ∈ C3 = (li,1 ∨ li,2 ∨ li,3), where li,p, with 1 (cid:54) p (cid:54) 3 is a literal, that is a variable (a positive literal) or a negated variable (a negative literal), the two clauses Ci,1 and Ci,2 are defined as follows: 6 – Ci,1 = li,1 ∨ li,2 ∨ li,3 ∨ xC,i,1 ∨ xC,i,2 – Ci,2 = li,1 ∨ li,2 ∨ li,3 ∨ xC,i,1 ∨ xC,i,2 We claim that (X3,C3) is satisfiable if and only if (X,C) is double-satisfiable. Assume that (X3,C3) is satisfiable and let f be an assignment to the variables on X that satisfies C3. Consider a clause Ci in C3, with 1 (cid:54) i (cid:54) C3. Since it is satisfied by f , it follows that there exists a literal li,p of Ci, with 1 (cid:54) p (cid:54) 3, that is satisfied by f . Define an assignment f(cid:48) on X that is identical to f on X3 and, if li,p is positive, then assigns value false to both xC,i,1 and xC,i,2, if li,p is negative, then assigns value true to both xC,i,1 and xC,i,2. It follows that both Ci,1 and Ci,2 are double-satisfied by f(cid:48). Assume that (X,C) is double-satisfied by an assignment f(cid:48). Consider two clauses Ci,1 and Ci,2, with 1 (cid:54) i (cid:54) C, that are double-satisfied by f(cid:48), we claim that there exists at least one literal of Ci,1 and Ci,2 not in XN which is satisfied. Assume this is not the case, then, if Ci,1 is double-satisfied, it follows that xC,i,1 is true and xC,i,2 is false, thus implying that Ci,2 is not double-satisfied. Then, an assignment f that is identical to f(cid:48) restricted to X3 satisfies each clause in C. Now, since 3-Sat is NP-complete [15], it follows that 5-Double-Sat is NP-hard. The membership to NP follows from the observation that, given an assignment to the variables on X, we can check in polynomial-time whether each clause in C is double-satisfied or not. (cid:117)(cid:116) Let us now give the construction of the reduction from 5-Double-Sat to 3-Club Cover(2). Con- sider an instance of 5-Double-Sat consisting of a set C of clauses C1, . . . , Cp over set X = {x1, . . . , xq} of variables. We assume that it is not possible to double-satisfy all the clauses by setting at most two variables to true or to false (this can be easily checked in polynomial-time). Before giving the details, we present an overview of the reduction. Given an instance (X,C) of 5-Double-Sat, for each positive literal xi, with 1 (cid:54) i (cid:54) q, we define vertices xT i,2 and for i . Moreover, for each clause Cj ∈ C, each negative literal xi, with 1 (cid:54) i (cid:54) q, we define a vertex xF with 1 (cid:54) j (cid:54) p, we define a vertex vC,j. We define other vertices to ensure that some vertices have distance not greater than three and to force the membership to one of the two 3-clubs of the solution (see Lemma 7). The construction implies that for each i with 1 (cid:54) i (cid:54) q, xT i,1 and xF i belong to different 3-clubs (see Lemma 8); this corresponds to a truth assignment to the variables in X. Then, we are able to show that each vertex vC,j belongs to the same 3-club of a vertex i,1, with 1 (cid:54) i (cid:54) q, and of a vertex xF h , with 1 (cid:54) h (cid:54) q, adjacent to vC,j (see Lemma 10); these xT vertices correspond to a positive literal xi and a negative literal xh, respectively, that are satisfied by a truth assignment, hence Cj is double-satisfied. Now, we give the details of the reduction. Let (X,C) be an instance of 5-Double-Sat, we con- struct an instance G = (V, E) of 3-Club Cover(2) as follows (see Fig. 3). The vertex set V is defined as follows: i,1, xT V = {r, r(cid:48), rT , r(cid:48) T , r∗ T , rF , r(cid:48) F} ∪ {xT i,1, xT i,2, xF i : xi ∈ X} ∪ {vC,j : Cj ∈ C} ∪ {y1, y2, y} The edge set E is defined as follows: E = {{r, r(cid:48)},{{r(cid:48), rT},{r(cid:48), r∗ ∪{{rF , xF i } : xi ∈ X} ∪ {{r(cid:48) T , xT {{xT i,1, xT i,2} : xi ∈ X} ∪ {{r∗ i,1} : xi ∈ X} ∪ {{r(cid:48) T}{r(cid:48), rF}} ∪ {{rT , xT F , xF i,2},{y1, xT T , xT i,1} : xi ∈ X} i } : xi ∈ X}∪ i,2} : xi ∈ X}∪ i , vC,j} : xi ∈ Cj}∪ F}} T},{y1, r(cid:48) {{xT i,2, xF j } : xi, xj ∈ X, i (cid:54)= j} ∪ {{xT i,1, vC,j} : xi ∈ Cj} ∪ {{xF {{vC,j, y} : Cj ∈ C} ∪ {{y, y2},{y1, y2},{y1, r(cid:48) We start by proving some properties of the graph G. Lemma 7. Consider an instance (C, X) of 5-Double-Sat and let G = (V, E) be the corresponding instance of 3-Club Cover(2). Then, (1) dG(r(cid:48), y) > 3, (2) dG(r, y) > 3, (3) dG(r, vC,j) > 3, for each j with 1 (cid:54) j (cid:54) p, and (4) dG(r, r(cid:48) F ) > 3, dG(r, r(cid:48) T ) > 3. 7 i,1, xT T or rF is adjacent to vertices xT Proof. We start by proving (1). Notice that any path from r(cid:48) to y must pass through rT , r∗ T or rF . i , with 1 (cid:54) i (cid:54) q (in addition to r(cid:48)), Each of rT , r∗ and none of these vertices is adjacent to y, thus concluding that dG(r(cid:48), y) > 3. Moreover, observe that for each vertex vC,j, with 1 (cid:54) j (cid:54) p, there exists a vertex xT h , with 1 (cid:54) h (cid:54) q, that is adjacent to vC,j, with 1 (cid:54) j (cid:54) p, thus dG(r(cid:48), vCj ) = 3, for each j with 1 (cid:54) j (cid:54) p. As a consequence of (1), it follows that (2) holds, that is dG(r, y) > 3. Since dG(r(cid:48), vCj ) = 3, for each j with 1 (cid:54) j (cid:54) p, it holds (3) dG(r, vC,j) > 3. T , rT , rF} and that none of the vertices in Finally, we prove (4). Notice that N 2 (cid:117)(cid:116) G(r) is adjacent to r(cid:48) N 2 i,1, with 1 (cid:54) i (cid:54) q, or xF T , thus dG(r, r(cid:48) G(r) = {r(cid:48), r∗ F and r(cid:48) i,2 and xF F ) > 3. rT xT i,1 r(cid:48) T r r(cid:48) r∗ T xT i,2 y1 vC,j y y2 rF xF i r(cid:48) F Fig. 3. Schematic construction for the reduction from 5-Double-Sat to 3-Club Cover(2). Consider two sets V1 ⊆ V and V2 ⊆ V , such that G[V1] and G[V2] are two 3-clubs of G that cover G. As a consequence of Lemma 7, it follows that r and r(cid:48) are in exactly one of G[V1], G[V2], F , y and vC,j, for each j with 1 (cid:54) j (cid:54) p, belong to G[V2] and not to w.l.o.g. G[V1], while r(cid:48) G[V1]. T , r(cid:48) Next, we show a crucial property of the graph G built by the reduction. Lemma 8. Given an instance (C, X) of 5-Double-Sat, let G = (V, E) be the corresponding instance of 3-Club Cover(2). Then, for each i with 1 (cid:54) i (cid:54) q, dG(xT Proof. Consider a path π of minimum length that connects xT notice that, by construction, the path π after xT i,2 or vC,j, with 1 (cid:54) j (cid:54) p. xT We consider the first case, that is the path π after xT in π is either r(cid:48) or xT that in this case the path π has length greater than three. We consider the second case, that is the path π after xT i , with 1 (cid:54) i (cid:54) q. First, i,1 must pass through one of these vertices: rT , r(cid:48) T , i,1 passes through rT . Now, the next vertex i , it follows h,1, with 1 (cid:54) h (cid:54) q. Since both r(cid:48) and xT h,1 are not adjacent to xF i,1 passes through r(cid:48) T . Now, after r(cid:48) i,1 and xF i ) > 3. i,1, xF passes through either y1 or xT it follows that in this case the path π has length greater than three. h,1, with 1 (cid:54) h (cid:54) q. Since both y1 and xT T , π h,1 are not adjacent to xF i , 8 T or y1 or xF i,1 passes through xT We consider the third case, that is the path after xT We consider the last case, that is the path after xT h , with 1 (cid:54) h (cid:54) q and h (cid:54)= i. Since r∗ of π is either r∗ xF i , it follows that in this case the path π has length greater than three. i,2. Now, the next vertex h are not adjacent to i,1 passes through vC,j, with 1 (cid:54) j (cid:54) p. We have assumed that xi and xi do not belong to the same clause, thus by construction xF is not i incident in vC,j. It follows that after vC,j, the path π must pass through either y or xT h,1, with 1 (cid:54) h (cid:54) q, or xF z are not adjacent to xF i , it follows that also in this case the path π has length greater than three, thus concluding the (cid:117)(cid:116) proof. z , 1 (cid:54) z (cid:54) q and z (cid:54)= i. Once again, since y, xT T , y1 and xF h,1 and xF Now, we are able to prove the main results of this section. Lemma 9. Given an instance (C, X) of 5-Double-Sat, let G = (V, E) be the corresponding instance of 3-Club Cover(2). Then, given a truth assignment that double-satisfies C, we can compute in polynomial-time two 3-clubs that cover G. Proof. Consider a truth assignment f on the set X of variables that double-satisfies C. In the following we construct two 3-clubs G[V1] and G[V2] that cover G. The two sets V1, V2 are defined as follows: V1 = {r, r(cid:48), rT , r∗ T , rF} ∪ {xT i,1, xT i,2 : f (xi) = f alse} ∪ {xF i , : f (xi) = true} V2 = {r(cid:48) T , r(cid:48) F , y, y1, y2} ∪ {xT i,2 : f (xi) = true} ∪ {xF i,1, xT {vC,j : 1 (cid:54) j (cid:54) p} i : f (xi) = f alse∪} i,1, xT h,2 and xF i,1, from each vertex xT i,2, and from each vertex xF i,1) = 2 and dG[V1](r(cid:48), xT i,1, with 1 (cid:54) i (cid:54) q, xT i,1, rT , xT Let us first consider G[V1]. By construction, dG[V1](r, xT h,2, with 1 (cid:54) h (cid:54) q and xF h,1 and xT h,2, vertices xT i,1) = 3 and dG[V1](r, xT i,2) = 2, for each i with 1 (cid:54) i (cid:54) q, and dG[V1](r(cid:48), xF Next, we show that G[V1] and G[V2] are indeed two 3-clubs that cover G. First, notice that V1 ∪ V2 = V , hence G[V1] and G[V2] cover G. Next, we show that both G[V1] and G[V2] are indeed 3-clubs. i,2) = 3, for i ) = 3, for each i with 1 (cid:54) i (cid:54) i (cid:54) q. Moreover, each i with 1 (cid:54) i (cid:54) i (cid:54) q, and dG[V1](r, xF dG[V1](r(cid:48), xT i ) = 2, for each i with 1 (cid:54) i (cid:54) i (cid:54) q. As a consequence, it holds that rT , r(cid:48) T and rF have distance at most three in G[V1] from each vertex xT i . Since r, rT , T and rF are in N (r(cid:48)), it follows that r, r(cid:48), rT , r∗ r∗ T and rF are at distance at most 2 in G[V1]. j , with 1 (cid:54) j (cid:54) q. Since Hence, we focus on vertices xT i,1, xT there exists a path that passes trough xT h,1 are at distance at most two in G[V1], while xT h,2 are at distance at most three in G[V1] (if i = h they are at j are at distance one in G[V1], since h (cid:54)= j and {xT j } ∈ E distance one). Vertices xT by construction. Finally, xT j are at distance two in G[V1], since there exists a path that passes trough xT i,2 ∈ V2, then We now consider G[V2]. We recall that, for each i with 1 (cid:54) i (cid:54) q, if xT i ∈ V1. Furthermore, we recall that we assume that each xi appears as a positive and a negative xF i,1, with 1 (cid:54) i (cid:54) q, and each vertex xF literal in the instance of 5-Double-Sat, thus each vertex xT h , with 1 (cid:54) h (cid:54) q, are connected to some VC,j, with 1 (cid:54) j (cid:54) p. First, notice that vertex y is at distance at most three in G[V2] from each vertex of V2, since it has distance one in G[V2] from each vertex vC,j, with 1 (cid:54) j (cid:54) p, thus distance two from xT i,1, with 1 (cid:54) i (cid:54) q, and xF F . Since y is adjacent to y2, it has distance one from y2 and two from y1. Now, consider a vertex vC,j, with 1 (cid:54) j (cid:54) p. Since f double-satisfies C, it follows that there z , with 1 (cid:54) z (cid:54) q, which are connected to T and from r(cid:48) F , and at most 3 from each z ∈ V2, with 1 (cid:54) z (cid:54) q. Furthermore, notice that, h,2 ∈ V2, with 1 (cid:54) h (cid:54) q and h (cid:54)= z, then exist two vertices in V2, xT vC,j. It follows that vC,j has distance 2 in G[V2] from r(cid:48) h,1 ∈ V2, with 1 (cid:54) h (cid:54) q, and from each xF xT since vC,j is adjacent to xF in G[V1], as i (cid:54)= j. It follows that G[V1] is a 3-club. i,1, xT h , with 1 (cid:54) h (cid:54) q, and three from xT i,1, with 1 (cid:54) i (cid:54) q, and xF i,2, with 1 (cid:54) i (cid:54) q, r(cid:48) z and xF z is adjacent to each xT i,1, xT i,2 and xF j T and r(cid:48) i,1 and xF h,2, xF 9 Consider a vertex xT h,2 of G[V2]. Moreover, it has distance two from y1 and three from y2 and r(cid:48) vC,j has distance at most two in G[V2] from each xT has distance two and three respectively, from y2 and y1, in G[V2]. most three in G[V2] from any vC,j, with 1 (cid:54) j (cid:54) p, and two from y. Since xT has distance at most two from each other vertex xT vertex xT is adjacent to every vertex xF most two from every vertex xF h,2 ∈ V2. Finally, since vC,j is adjacent to y, it i,1 ∈ V2, with 1 (cid:54) i (cid:54) q. We have already shown that it has distance at T , it h,1, with 1 (cid:54) h (cid:54) q, and three from each other F . Since xT i,2 h,1 has distance at i,2 ∈ V2, with 1 (cid:54) i (cid:54) q. We have already shown that it has distance at i,1, it has distance three from y and z ∈ V2, with 1 (cid:54) z (cid:54) q, i,2 has distance two from each vertex i,2 is most two from each vC,j in G[V2]. Since it is connected to xT two from r(cid:48) i,2 has distance at most two from r(cid:48) xT h,2 in G[V2], with 1 (cid:54) i (cid:54) q, since by construction they are both adjacent to y1. Since xT xT adjacent to y1, thus it has distance at most two from y2 in G[V2]. z ∈ V2, with 1 (cid:54) z (cid:54) q, as z (cid:54)= i, it follows that xT z ∈ V2. i,2 is adjacent to every vertex xF T in G[V2]. By construction xT i,1 is adjacent to r(cid:48) F in G[V2]. Moreover, xT Consider a vertex xT Consider a vertex xF h , with 1 (cid:54) h (cid:54) q. It has distance one from r(cid:48) two from y1 and three from y2 in G[V2]. Moreover, xF thus it has distance two from each xT there exists at least one vC,j, with 1 (cid:54) j (cid:54) p, adjacent to xF and three from each vC,z in G[V2]. Finally, we consider vertices r(cid:48) i,1 and distance three from r(cid:48) T , r(cid:48) h is adjacent to each xT F in G[V2], and thus distance i,2 ∈ V2, with 1 (cid:54) i (cid:54) q, T in G[V2]. Since by construction h has distance two from y h , thus xF T , r(cid:48) T , r(cid:48) F , y1 and y2. Notice that it suffices to show that these vertices have pairwise distance at most three in G[V2], since we have previously shown that any other vertex F , y2 ∈ N (y1), they are of V2 has distance at most three from these vertices in G[V2]. Since r(cid:48) (cid:117)(cid:116) all at distance at most two. It follows that G[V2] is a 3-club, thus concluding the proof. Lemma 10. Given an instance (C, X) of 5-Double-Sat, let G = (V, E) be the corresponding in- stance of 3-Club Cover(2). Then, given two 3-clubs that cover G, we can compute in polynomial time a truth assignment that double-satisfies C. Proof. Consider two 3-clubs G[V1], G[V2], with V1, V2 ⊆ V , that cover G. First, notice that by F ∈ V2 \ V1 and vC,j ∈ V2 \ V1, for each j Lemma 7 we assume that r, r(cid:48) ∈ V1 \ V2, while y, r(cid:48) with 1 (cid:54) j (cid:54) p. Moreover, by Lemma 8 it follows that for each i with 1 (cid:54) i (cid:54) q, xT i do not belong to the same 3-club, that is exactly one belongs to V1 and exactly one belongs to V2. By construction, each path of length at most three from a vertex vC,j, with 1 (cid:54) j (cid:54) p, to r(cid:48) h , with 1 (cid:54) h (cid:54) q. Similarly, each path of length at most three from a must pass through some xF vertex vC,j, with 1 (cid:54) j (cid:54) p, to r(cid:48) i,1. Assume that vC,j, with 1 (cid:54) j (cid:54) p, h ∈ V2, with 1 (cid:54) h (cid:54) p respectively). It i,1 ∈ V2, with 1 (cid:54) i (cid:54) q (xF is not adjacent to a vertex xT u,1, with 1 (cid:54) u (cid:54) q, w, with 1 (cid:54) w (cid:54) q (xT follows that vC,j is only adjacent to y and to vertices xF respectively) in G[V2]. In the first case, notice that y is adjacent only to vC,z, with 1 (cid:54) z (cid:54) p, and F , respectively), thus implying that this path from vC,j to r(cid:48) y2, none of which is adjacent to r(cid:48) T (to r(cid:48) w (xT F , respectively) has length at least 4. In the second case, xF u,1, respectively) is adjacent T (r(cid:48) to r(cid:48) T , rT , vC,j, xT F , rF , vC,j and xT F , respectively), implying that also in this case the path from vC,j to r(cid:48) T (to r(cid:48) F , respectively) has F , vC,j ∈ V2, it follows that, for each vC,j, the set V2 contains a vertex length at least 4. Since r(cid:48) h , with 1 (cid:54) h (cid:54) q, connected to vC,j. i,1, with 1 (cid:54) i (cid:54) q, and a vertex xF xT i,1, xF By Lemma 8 exactly one of xT i belongs to V2, thus we can construct a truth assignment f i ∈ V2. The assignment f double-satisfies i,1, for some i with 1 (cid:54) i (cid:54) q, and a (cid:117)(cid:116) as follows: f (xi) := true, if xT each clause of C, since each vC,j is connected to a vertex xT vertex xF u,2, respectively), none of which is adjacent to r(cid:48) h , for some h with 1 (cid:54) h (cid:54) q. i,1 ∈ V2, f (xi) := false, if xF T must pass through some xT i,2 (r(cid:48) T , r(cid:48) i,1 and xF T (r(cid:48) F Based on Lemma 9 and Lemma 10, and on the NP-completeness of 5-Double-Sat (see Theorem 6), we can conclude that 3-Club Cover(2) is NP-complete. 10 Theorem 11. 3-Club Cover(2) is NP-complete. Proof. By Lemma 9 and Lemma 10, and from the NP-hardness of 5-Double-Sat (see Theorem 6), it follows that 3-Club Cover(2) is NP-hard. The membership in NP follows easily from the fact that, given two 3-clubs, it can be checked in polynomial time whether are 3-clubs and cover all (cid:117)(cid:116) vertices of G. 4 Hardness of Approximation consider section we the approximation complexity of Min 2-Club Cover In this and Min 3-Club Cover and we prove that Min 2-Club Cover is not approximable within factor O(V 1/2−ε), for each ε > 0, and that Min 3-Club Cover is not approximable within factor O(V 1−ε), for each ε > 0. The proof for Min 2-Club Cover is obtained with a reduction very similar to that of Section 3.1, except from the fact that we reduce Minimum Clique Partition to Min 2-Club Cover. Corollary 12. Unless P = N P , Min 2-Club Cover is not approximable within factor O(V 1/2−ε), for each ε > 0. present a Proof. We to Min 2-Club Cover. Let Gp = (V p, Ep) be a graph input of Minimum Clique Partition, we compute in polynomial time a corresponding instance G = (V, E) of Min 2-Club Cover as in Section 3.1. In what follows we prove the following results that are useful for the reduction. from Minimum Clique Partition preserving-factor reduction Lemma 13. Let Gp = (V p, Ep) be a graph input of Minimum Clique Partition and let G = (V, E) be the corresponding instance of Min 2-Club Cover. Then, given a solution of Minimum Clique Partition on Gp = (V p, Ep) consisting of k cliques, we can compute in polyno- mial time a solution of Min 2-Club Cover on G = (V, E) consisting of k 2-clubs. Proof. Consider a solution of Minimum Clique Partition on Gp = (V p, Ep) where {V p k } 2 , . . . , V p is the set of k cliques that partition V P . We define a solution of Min 2-Club Cover on G = (V, E) consisting of k 2-clubs as follows. For each d, 1 (cid:54) d (cid:54) k, let 1 , V p Vd = {wj ∈ V : vj ∈ V p d } ∪ {wi,j : vi ∈ V p d ∧ i < j} 2 . . . V p k . it follows that for each d, G[Vd] As for the proof of Lemma 9, is a 2-club. Furthermore, G[V1], . . . , G[Vk] cover each vertex of V , as each vi ∈ V p is covered by one of the cliques (cid:117)(cid:116) V p 1 , V p Lemma 14. Let Gp = (V p, Ep) be a graph input of Minimum Clique Partition and let G = (V, E) be the corresponding instance of Min 2-Club Cover. Then, given a solution of Min 2-Club Cover on G = (V, E) consisting of k 2-clubs, we can compute in polynomial time a solution of Minimum Clique Partition on Gp = (V p, Ep) with k cliques. Proof. Consider the 2-clubs G[V1], . . . , G[Vk] that cover G. As for the proof of Lemma 10, the result follows from the fact that by Lemma 2, given wi, wj ∈ Vd, for each d with 1 (cid:54) d (cid:54) k, it holds that {vi, vj} ∈ E. As a consequence, we can define a solution of Minimum Clique Partition on Gp = (V p, Ep) consisting of k cliques as follows, for each d, 1 (cid:54) d (cid:54) k: d = {vi : wi ∈ Vd} V p (cid:117)(cid:116) The inapproximability of Min 2-Club Cover follows from Lemma 13 and Lemma 14, and from the inapproximability of Minimum Clique Partition, which is known to be inapproximable within factor O(V p1−ε(cid:48) ) [24] (where Gp = (V p, Ep) is an instance of Hence Min 2-Club Cover is not approximable within factor O(V p1−ε(cid:48) ), for each ε(cid:48) > 0, unless P = N P , hence Min 2-Club Cover is not approximable within factor O(V p(1−ε(cid:48))). By the definition of G = (V, E), it holds V = V p + Ep (cid:54) V p2 hence, for each ε > 0, Min 2-Club Cover is not approximable within factor (cid:117)(cid:116) O(V 1/2−ε), unless P = N P . 11 Next, we show that Min 3-Club Cover is not approximable within factor O(V 1−ε), for each ε > 0, unless P = N P , by giving a preserving-factor reduction from Minimum Clique Partition. Consider an instance Gp = (V p, Ep) of Minimum Clique Partition, we construct an instance G = (V, E) of Min 3-Club Cover by adding a pendant vertex connected to each vertex of V p. Formally, V = {ui, wi : vi ∈ V p}, E = {{ui, wi} : 1 (cid:54) i (cid:54) V p} ∪ {{ui, uj} : {vi, vj} ∈ Ep}}. We prove now the main properties of the reduction. Lemma 15. Let Gp = (V p, Ep) be an instance of Minimum Clique Partition and let G = (V, E) be the corresponding instance of Min 3-Club Cover. Then, given a solution of Minimum Clique Partition on Gp = (V p, Ep) consisting of k cliques, we can compute in polynomial time a solution of Min 3-Club Cover on G = (V, E) consisting of k 3-clubs. Proof. Consider a solution of Minimum Clique Partition on Gp = (V p, Ep), consisting of the cliques {Gp[Vc,1], Gp[Vc,2], . . . , Gp[Vc,k]}. Then, for each i, with 1 (cid:54) h (cid:54) k, define the following subset Vh ⊆ V : Vh = {uj, wj ∈ V : vj ∈ V p h } 1 , V p 2 . . . V p Since V p k partition V p, it follows that V1, V2 . . . Vk partition (hence cover) G. Now, we show that each G[Vh], with 1 (cid:54) h (cid:54) k, is a 3-club. First, notice that since G[V p h ], is a clique, then the set {uj : uj ∈ Vh} induces a clique in G. Then, it follows that, for each ui, wj, wz ∈ Vh, (cid:117)(cid:116) dG[Vh](ui, wj) (cid:54) 2 and dG[Vh](wj, wz) (cid:54) 3, thus concluding the proof. Lemma 16. Let Gp = (V p, Ep) be a graph input of Minimum Clique Partition and let G = (V, E) be the corresponding instance of Min 3-Club Cover. Then, given a solution of Min 3-Club Cover on G = (V, E) consisting of k 3-clubs, we can compute in polynomial time a solution of Minimum Clique Partition on Gp = (V p, Ep) consisting of k cliques. Proof. Consider the k 3-clubs G[V1], . . . , G[Vk] that cover G. First, we show that for each Vh, 1 (cid:54) h, (cid:54) k, ∀wi, wj ∈ Vh, with 1 (cid:54) i, j (cid:54) V p, it holds that ui, uj ∈ Vh. Indeed, notice that N (wi) = {ui} and N (wj) = {uj}, and by the definition of a 3-club we must have dG[vh](wi, wj) (cid:54) 3, it follows that ui, uj ∈ Vh. Hence, we can define a set of cliques of Gp. For each Vh, with 1 (cid:54) h (cid:54) k, define a set V p h : h = {vi : wi ∈ Vh} V p Notice that each V p wi, wj ∈ Vh, and this implies {vi, vj} ∈ Ep. Notice that the cliques V p but starting from V p consisting of at most k cliques. h , 1 (cid:54) h (cid:54) k, induces a clique in Gp, as by construction if vi, vj ∈ V p 1 , . . . , V p h , then k may overlap, k , we can easily compute in polynomial time a clique partition of Gp (cid:117)(cid:116) 1 , . . . , V p Lemma 15 and Lemma 16 imply the following result. Theorem 17. Min 3-Club Cover is not approximable within factor O(V 1−ε), for each ε > 0, unless P = N P . Proof. The result follows from Lemma 15 and Lemma 16, as these results imply that we have defined a factor-preserving reduction, and from the inapproximability of Minimum Clique Partition, which is known to be inapproximable within factor O(V p1−ε), for each ε > 0, unless P = N P [24] (where Gp = (V p, Ep) is an instance of Minimum Clique Partition). Thus, Min 3-Club Cover is not approximable within factor O(V p1−ε), for each ε > 0, unless P = N P , and since it holds V = 2V p, Min 3-Club Cover is not approximable within factor O(V 1−ε), unless P = N P . (cid:117)(cid:116) 5 An Approximation Algorithm for Min 2-Club Cover In this section, we present an approximation algorithm for Min 2-Club Cover that achieves an approximation factor of 2V 1/2 log3/2 V . Notice that, due to the result in Section 4, the approxi- 12 mation factor is almost tight. We start by describing the approximation algorithm, then we present the analysis of the approximation factor. Algorithm 1: Club-Cover-Approx Data: a graph G Result: a cover S of G 1 V (cid:48) := V ; /* V (cid:48) is the set of uncovered vertices of G, initialized to V */ 2 S := ∅; 3 while V (cid:48) (cid:54)= ∅ do Let v be a vertex of V such that N [v] ∩ V (cid:48) is maximum; Add N [v] to S; V (cid:48) := V (cid:48) \ N [v]; Club-Cover-Approx similar the is 6 4 5 to algorithm for Minimum Dominating Set and Minimum Set Cover. While there exists an uncovered vertex of G, the Club-Cover-Approx algorithm greedily defines a 2-club induced by the set N [v] of vertices, with v ∈ V , such that N [v] covers the maximum number of uncovered vertices (notice that some of the vertices of N [v] may already be covered). While for Minimum Dominating Set the choice of each iteration is optimal, here the choice is suboptimal. Notice that indeed computing a maximum 2-club is NP-hard. approximation greedy Clearly the algorithm returns a feasible solution for Min 2-Club Cover, as each set N [v] picked by the algorithm is a 2-club and, by construction, each vertex of V is covered. Next, we show the approximation factor yielded by the Club-Cover-Approx algorithm for Min 2-Club Cover. First, consider the set VD of vertices v ∈ V picked by the Club-Cover-Approx algorithm, so that N [v] is added to S. Notice that VD = S and that VD is a dominating set of G, since, at each step, the vertex v picked by the algorithm dominates each vertex in N [v], and each vertex in V is covered by the algorithm, so it belongs to some N [v], with v ∈ VD. Let D be a minimum dominating set of the input graph G. By the property of the greedy approximation algorithm for Minimum Dominating Set, the set VD has the following property [14]: VD (cid:54) D log V (1) The size of a minimum dominating set in graphs of diameter bounded by 2 (hence 2-clubs) has been considered in [8], where the following result is proven. Lemma 18 ([8]). Let H = (VH , EH ) be a 2-club, then H has a dominating set of size at most 1 +(cid:112)VH + ln(VH). The approximation factor 2V 1/2 log3/2 V for Club-Cover-Approx is obtained by combining Lemma 18 and Equation 1. Theorem 19. Let OP T be an optimal solution of Min 2-Club Cover, then Club-Cover-Approx returns a solution having at most 2V 1/2 log3/2 V OP T 2-clubs. Proof. Let D be a minimum dominating set of G and let OP T be an optimal solution of Min 2-Club Cover. We start by proving that D (cid:54) 2OP TV 1/2 log1/2 V . For each 2-club G[C], with C ⊆ V , that belongs to OP T , by Lemma 18 there exists a dominating set DC of size at most 1 +(cid:112)C + ln(C) (cid:54) 2(cid:112)C + ln(C). Since C (cid:54) V , it follows that each 2-club G[C] that belongs to OP T has a dominating set of size at most 2(cid:112)V + ln(V ). Consider D(cid:48) = (cid:83) ers G. Since D(cid:48) contains OP T sets DC and DC (cid:54) 2(cid:112)V + ln(V ), for each G[C] ∈ OP T , it follows that D(cid:48) (cid:54) 2OP T(cid:112)V + ln(V ). Since D is a minimum dominating set, it follows that D (cid:54) D(cid:48) (cid:54) 2OP T((cid:112)V + ln(V )). By Equation 1, it holds VD (cid:54) 2D log V thus C∈OP T DC. It follows that D(cid:48) is a dominating set of G, since the 2-clubs in OP T cov- VD (cid:54) 2V 1/2 ln1/2 V log V OP T (cid:54) 2V 1/2 log3/2 V OP T. (cid:117)(cid:116) 6 Conclusion There are some interesting direction for the problem of covering a graph with s-clubs. From the computational complexity point of view, the main open problem is whether 2-Club Cover(2) is NP- complete or is in P. Moreover, it would be interesting to study the computational/parameterized complexity of the problem in specific graph classes, as done for Minimum Clique Partition [5,6,21,9]. 13 References 1. Alba, R.D.: A graph-theoretic definition of a sociometric clique. The Journal of Mathematical Sociol- ogy 3, 113–126 (1973) 2. Asahiro, Y., Doi, Y., Miyano, E., Samizo, K., Shimizu, H.: Optimal Approximation Algorithms for Maximum Distance-Bounded Subgraph Problems. Algorithmica (Jul 2017) 3. Balasundaram, B., Butenko, S., Trukhanov, S.: Novel Approaches for Analyzing Biological Networks. J. Comb. Optim. 10(1), 23–39 (2005) 4. Bourjolly, J., Laporte, G., Pesant, G.: An exact algorithm for the maximum k-club problem in an undirected graph. European Journal of Operational Research 138(1), 21–28 (2002) 5. Cerioli, M.R., Faria, L., Ferreira, T.O., Martinhon, C.A.J., Protti, F., Reed, B.A.: Partition into cliques for cubic graphs: Planar case, complexity and approximation. Discrete Applied Mathematics 156(12), 2270–2278 (2008) 6. Cerioli, M.R., Faria, L., Ferreira, T.O., Protti, F.: A note on maximum independent sets and minimum clique partitions in unit disk graphs and penny graphs: complexity and approximation. RAIRO - Theor. Inf. and Applic. 45(3), 331–346 (2011) 7. Chang, M., Hung, L., Lin, C., Su, P.: Finding large k-clubs in undirected graphs. Computing 95(9), 739–758 (2013) 8. Desormeaux, W.J., Haynes, T.W., Henning, M.A., Yeo, A.: Total domination in graphs with diameter 2. Journal of Graph Theory 75(1), 91–103 (2014) 9. Dumitrescu, A., Pach, J.: Minimum Clique Partition in Unit Disk Graphs. Graphs and Combinatorics 27(3), 399–411 (2011) 10. Garey, M.R., Johnson, D.S., Stockmeyer, L.J.: Some Simplified NP-Complete Graph Problems. Theor. Comput. Sci. 1(3), 237–267 (1976) 11. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness (1979) 12. Golovach, P.A., Heggernes, P., Kratsch, D., Rafiey, A.: Finding clubs in graph classes. Discrete Applied Mathematics 174, 57–65 (2014) 13. Hartung, S., Komusiewicz, C., Nichterlein, A.: Parameterized Algorithmics and Computational Ex- periments for Finding 2-Clubs. J. Graph Algorithms Appl. 19(1), 155–190 (2015) 14. Johnson, D.S.: Approximation Algorithms for Combinatorial Problems. J. Comput. Syst. Sci. 9(3), 256–278 (1974) 15. Karp, R.M.: Reducibility among combinatorial problems. In: Miller, R.E., Thatcher, J.W. (eds.) Pro- ceedings 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. pp. 85–103. The IBM Research Symposia Series, Plenum Press, New York (1972) 16. Komusiewicz, C.: Multivariate Algorithmics for Finding Cohesive Subnetworks. Algorithms 9(1), 21 (2016) 17. Komusiewicz, C., Sorge, M.: An algorithmic framework for fixed-cardinality optimization in sparse graphs applied to dense subgraph problems. Discrete Applied Mathematics 193, 145–161 (2015) 18. Laan, S., Marx, M., Mokken, R.J.: Close communities in social networks: boroughs and 2-clubs. Social Netw. Analys. Mining 6(1), 20:1–20:16 (2016) 19. Mokken, R.: Cliques, clubs and clans. Quality & Quantity: International Journal of Methodology 13(2), 161–173 (1979) 20. Mokken, R.J., Heemskerk, E.M., Laan, S.: Close communication and 2-clubs in corporate networks: Europe 2010. Social Netw. Analys. Mining 6(1), 40:1–40:19 (2016) 21. Pirwani, I.A., Salavatipour, M.R.: A weakly robust PTAS for minimum clique partition in unit disk graphs. Algorithmica 62(3-4), 1050–1072 (2012) 22. Schafer, A., Komusiewicz, C., Moser, H., Niedermeier, R.: Parameterized computational complexity of finding small-diameter subgraphs. Optimization Letters 6(5), 883–891 (2012) 14 23. Zoppis, I., Dondi, R., Santoro, E., Castelnuovo, G., Sicurello, F., Mauri, G.: Optimizing social inter- action - A computational approach to support patient engagement. In: Zwiggelaar, R., Gamboa, H., Fred, A.L.N., i Badia, S.B. (eds.) Proceedings of the 11th International Joint Conference on Biomed- ical Engineering Systems and Technologies (BIOSTEC 2018) - Volume 5: HEALTHINF, Funchal, Madeira, Portugal, January 19-21, 2018. pp. 651–657. SciTePress (2018) 24. Zuckerman, D.: Linear Degree Extractors and the Inapproximability of Max Clique and Chromatic Number. Theory of Computing 3(1), 103–128 (2007)
1506.07568
1
1506
2015-06-24T21:25:49
Towards Resistance Sparsifiers
[ "cs.DS" ]
We study resistance sparsification of graphs, in which the goal is to find a sparse subgraph (with reweighted edges) that approximately preserves the effective resistances between every pair of nodes. We show that every dense regular expander admits a $(1+\epsilon)$-resistance sparsifier of size $\tilde O(n/\epsilon)$, and conjecture this bound holds for all graphs on $n$ nodes. In comparison, spectral sparsification is a strictly stronger notion and requires $\Omega(n/\epsilon^2)$ edges even on the complete graph. Our approach leads to the following structural question on graphs: Does every dense regular expander contain a sparse regular expander as a subgraph? Our main technical contribution, which may of independent interest, is a positive answer to this question in a certain setting of parameters. Combining this with a recent result of von Luxburg, Radl, and Hein~(JMLR, 2014) leads to the aforementioned resistance sparsifiers.
cs.DS
cs
Towards Resistance Sparsifiers Michael Dinitz∗ Robert Krauthgamer† Tal Wagner‡ May 29, 2021 Abstract We study resistance sparsification of graphs, in which the goal is to find a sparse subgraph (with reweighted edges) that approximately preserves the effective resistances between every pair of nodes. We show that every dense regular expander admits a (1 + ε)-resistance sparsifier of size O(n/ε), and conjecture this bound holds for all graphs on n nodes. In comparison, spectral sparsification is a strictly stronger notion and requires Ω(n/ε2) edges even on the complete graph. Our approach leads to the following structural question on graphs: Does every dense regular expander contain a sparse regular expander as a subgraph? Our main technical contribution, which may of independent interest, is a positive answer to this question in a certain setting of parameters. Combining this with a recent result of von Luxburg, Radl, and Hein (JMLR, 2014) leads to the aforementioned resistance sparsifiers. 1 Introduction Compact representations of discrete structures are of fundamental importance, both from an appli- cations point of view and from a purely mathematical perspective. Graph sparsification is perhaps one of the simplest examples: given a graph G(V, E), is there a subgraph that represents G truth- fully, say up to a small approximation? This notion has had different names in different contexts, depending on the property that is being preserved: preserving distances is known as a graph span- ner [PS89], preserving the size of cuts is known as a cut sparsifier [BK96], while preserving spectral properties is known as a spectral sparsifier [ST04]. These concepts are known to be related, for example, every spectral sparsifier is clearly also a cut sparsifier, and spectral sparsifiers can be constructed by an appropriate sample of spanners [KP12]. Our work is concerned with sparsification that preserves effective resistances. We define this in Section 1.1, but informally the effective resistance between two nodes u and v is the voltage differential between them when we regard the graph as an electrical network of resistors with one unit of current injected at u and extracted at v. Effective resistances are very useful in many applications that seek to cluster nodes in a network (see [vLRH14] and references therein for a comprehensive list), and are also of fundamental mathematical interest. For example, they have deep connections to random walks on graphs (see [Lov96] for an excellent overview of this connection). Most famously, the commute time between two nodes u and v (the expected time for ∗Johns Hopkins University, Baltimore, MD. Work supported in part by NSF award #1464239. Email: [email protected] †Weizmann Institute of Science, Rehovot, Israel. Work supported in part by a US-Israel BSF grant #2010418 and ‡Massachussetts Institute of Technology, Cambridge, MA. Email: [email protected] an Israel Science Foundation grant #897/13. Email: [email protected] 1 a random walk starting at u to hit v plus the expected time for a random walk starting at v to hit u) is exactly 2m times the effective resistance between u and v, where throughout n := V and m := E. Hence, we are concerned with sparsification which preserves commute times. We ask whether graphs admit a good resistance sparsifier : a reweighted subgraph G(cid:48)(V, E(cid:48), w(cid:48)) in which the effective resistances are equal, up to a (1 + ε)-factor, to those in the original graph. The short answer is yes, because every (1+ε)-spectral sparsifier is also a (1+ε)-resistance sparsifier. Using the spectral-sparsifiers of [BSS12], we immediately conclude that every graph admits a (1+ε)- resistance sparsifier with O(n/ε2) edges. Interestingly, the same 1/ε2 factor loss appears even when we interpret "sparsification" far more broadly. For example, a natural approach to compressing the effective resistances is to use a metric embedding (instead of looking for a subgraph): map the nodes into some metric, and use the metric's distances as our resistance estimates. This approach is particularly attractive since it is well-known that effective resistances form a metric space which embeds isometrically into (cid:96)2-squared (i.e., the metric is of negative type, see e.g. [DL97]). Hence, using the Johnson- Lindenstrauss dimension reduction lemma, we can represent effective resistances up to a distortion of (1 + ε) using vectors of dimension O(ε−2 log n), i.e., using total space O(n/ε2). In fact, this very approach was used by [SS11] to quickly compute effective resistance estimates, which were then used to construct a spectral sparsifier. Since a 1/ε2 term appears in both of these natural ways to compactly represent effective resis- tances, an obvious question is whether this is necessary. For the stronger requirement of spectral sparsification, we know the answer is yes -- every spectral sparsifier of the complete graph requires Ω(n/ε2) edges [BSS12, Section 4] (see also [AKW14]). However, it is currently unknown whether such a bound holds also for resistance sparsifiers, and the starting point of our work is the ob- servation (based on [vLRH14]) that for the complete graph, every O(1/ε)-regular expander is a (1 + ε)-resistance sparsifier, despite not being a (1 + ε)-spectral sparsifier! We thus put forward the following conjecture. Conjecture 1.1. Every graph admits a (1 + ε)-resistance sparsifier with O(n/ε) edges. We make the first step in this direction by proving the special case of dense regular expanders (which directly generalize the complete graph). Even this very special case turns out to be non- trivial, and in fact leads us to another beautiful problem which is interesting in its own right. Question 1.2. Does every dense regular expander contain a sparse regular expander as a subgraph? Our positive answer to this question (for a certain definition of expanders) forms the bulk of our technical work (Sections 2 and 3), and is then used to find good resistance sparsifiers for dense regular expanders (Section 4). 1.1 Results and Techniques Throughout, we consider undirected graphs, and they are unweighted unless stated otherwise. In a weighted graph, i.e., when edges have nonnegative weights, the weighted degree of a vertex is the sum of weights on incident edges, and the graph is considered regular if all of its weighted degrees are equal. Typically, a sparsifying subgraph must be weighted even when the host graph is unweighted, in order to exhibit comparable parameters with far fewer edges. Before we can state our results we first need to recall some basic definitions from spectral graph theory. Given a weighted graph G, let D be the diagonal n × n matrix of weighted degrees, and let A be the weighted adjacency matrix. The Laplacian of G is defined as L := D − A, and the normalized Laplacian is the matrix L := D−1/2LD−1/2. 2 Definition 1.3 (Effective Resistance). Let G(V, E, w) be a weighted graph, and let P the Moore- Penrose pseudo-inverse of its Laplacian matrix. The effective resistance (also called resistance distance) between two nodes u, v ∈ V is RG(u, v) := (eu − ev)T P (eu − ev), where eu and ev denote the standard basis vectors in RV that correspond to u and v respectively. When the graph G is clear from context we will omit it and write R(u, v). We can now define the main objects that we study. Definition 1.4 (Resistance Sparsifier). Let G(V, E, w) be a weighted graph, and let ε ∈ (0, 1). A (1 + ε)-resistance sparsifier for G is a subgraph H(V, E(cid:48), w(cid:48)) with reweighted edges such that (1 − ε)RH (u, v) ≤ RG(u, v) ≤ (1 + ε)RH (u, v), for all u, v ∈ V . It will turn out that in order to understand resistance sparsifiers, we need to use expansion properties. Definition 1.5 (Graph Expansion). The edge-expansion (also known as the Cheeger constant) of a weighted graph G(V, E, w) is (cid:27) (cid:26) w(S, ¯S) S φ(G) := min : S ⊂ V, 0 < S ≤ V /2 , where w(S, ¯S) denotes the total weight of edges with exactly one endpoint in S ⊂ V . The spec- tral expansion of G, denoted λ2(G), is the second-smallest eigenvalue of the graph's normalized Laplacian. Our main result is the following. Throughout this paper, "efficiently" means in randomized polynomial time. Theorem 1.6. Fix β, γ > 0, let n be sufficiently large, and 1/n0.99 < ε < 1. Every D-regular graph G on n nodes with D ≥ βn and φ(G) ≥ γD contains (as a subgraph) a (1 + ε)-resistance sparsifier with at most ε−1n(log n)O(1/βγ2) edges, and it can be found efficiently. While dense regular expanders may seem like a simple case, even this special case requires significant technical work. The most obvious idea, of sparsifying through random sampling, does not work -- selecting each edge of G uniformly at random with probability O(1/(Dε)) (the right probability for achieving a subgraph with O(n/ε) edges) need not yield a (1 + ε)-resistance spar- sifier. Intuitively, this is because the variance of independent random sampling is too large (see Theorem 4.1 for the precise effect), and the easiest setting to see this is the case of sparsifying the complete graph. If we sparsify through independent random sampling, then to get a (1 + ε)- resistance sparsifier requires picking each edge independently with probability at least 1/(ε2n), and we end up with n/ε2 edges. To beat this, we need to use correlated sampling. More specifically, it turns out that a random O(1/ε)-regular graph is a (1 + ε)-resistance sparsifier of the complete graph, despite not being a (1 + ε)-spectral sparsifier. So instead of sampling edges independently (the natural approach, and in fact the approach used to construct spectral sparsifiers by Spielman and Srivastava [SS11]), we need to sample a random regular graph. In order to prove Theorem 1.6, we actually need to generalize this approach beyond the complete graph. But what is the natural generalization of a random regular graph when the graph we start with is not the complete graph? It turns out that what we need is an expander, which is sparse but maintains regularity of its degrees. This motivates our main structural result, that every dense regular expander contains a sparse regular expander (as a subgraph). This can be seen as a type of sparsification result that retains regularity. 3 Theorem 1.7. Fix β, γ > 0 and let n be sufficiently large. Every D-regular graph G on n nodes with D ≥ βn and φ(G) ≥ γD contains a weighted d-regular subgraph H with d = (log n)O(1/βγ2) and φ(H) ≥ 1 3 . All edge weights in H are in {1, 2}, and H can be found efficiently. To prove this theorem, we analyze a modified version of the cut-matching game of Khandekar, Rao, and Vazirani [KRV09]. This game has been used in the past to construct expander graphs, but in order to use it for Theorem 1.7 we need to generalize beyond matchings, and also show how to turn the graphs it creates (which are not necessarily subgraphs of G) into subgraphs of G. The expansion requirement for G in Theorem 1.7 is equivalent to λ2(G) = Ω(1), when β and γ are viewed as absolute constants. We note that H is a much weaker expander, satisfying only λ2(H) = Ω(1/polylog(n)), but this is nonetheless sufficient for Theorem 1.6. Also, H is regular in weighted degrees. For completeness we give a variant of Theorem 1.7 that achieves an unweighted H by requiring stronger expansion from G, but this is not necessary for our application to resistance sparsifiers, which anyway involves reweighting the edges. Theorem 1.8. For every β > 0 there is 0 < γ < 1 such the following holds for sufficiently large n. Every D-regular graph G on n nodes with D ≥ βn and φ(G) ≥ γD contains an (unweighted) d-regular subgraph H with d = (log n)O(1/βγ) and φ(H) ≥ 1 3 , and it can be found efficiently. The algorithm underlying Theorems 1.6, 1.7 and 1.8 turns out to be quite straightforward: decompose the host graph into disjoint perfect matchings or Hamiltonian cycles (which are "atomic" regular components), and subsample a random subset of them of size d to form the target subgraph. However, since the decomposition leads to large dependencies between inclusion of different edges in the subgraph, it is unclear how to approach this algorithm with direct probabilistic analysis. Instead, our analysis uses the adaptive framework of [KRV09] to quantify the effect of gradually adding random matching/cycles from the decomposition to the subgraph. 1.2 Related Work The line of work most directly related to resistance sparsifiers is the construction of spectral spar- sifiers. This was initiated by Spielman and Teng [ST04], and was later pushed to its limits by Spielman and Teng [ST11], Spielman and Srivastava [SS11], and Batson, Spielman, and Srivas- tava [BSS12], who finally proved that every graph has a (1 + ε)-spectral sparsifier with O(n/ε2) edges and that this bound is tight (see also [AKW14]). The approach by Spielman and Srivastava [SS11] is particularly closely related to our work. They construct almost-optimal spectral sparsifiers (a logarithmic factor worse than [BSS12]) by sampling each edge independently with probability proportional to the effective resistance between the endpoints. This method naturally leads us to try the same thing for resistance sparsification, but as discussed, independent random sampling (even based on the effective resistances) cannot give improved resistance sparsifiers. Interestingly, in order to make their algorithm extremely efficient they needed a way to estimate effective resistances very quickly, so along the way they showed how to create a sketch of size O(n log n/ε2) from which every resistance distance can be read off in O(log n) time (essentially through an (cid:96)2-squared embedding and a Johnson-Lindenstrauss dimension reduction). 2 Sparse Regular Expanding Subgraphs In this section we prove Theorem 1.7, building towards it in stages. Our starting point is the Cut-Matching game of Khandekar, Rao and Vazirani (KRV) [KRV09], which is a framework to 4 constructing sparse expanders by iteratively adding perfect matchings across adaptively chosen bisections of the vertex set. The resulting graph H is regular, as it is the union of perfect matchings, and if the matchings are contained in the input graph G then H is furthermore a subgraph of G, as desired. In Section 2.1, we employ this approach to prove Theorem 1.7 in the case D/n = 3 4 + Ω(1). To handle smaller D, we observe that the perfect matchings in the KRV game can be replaced with a more general structure that we call a weave, defined as a set of edges where for every vertex at least one incident edge crosses the given bisection. To ensure that H is regular (all vertices have the same degree), we would like the weaves to be regular. We thus decompose the input graph to disjoint regular elements -- either perfect matchings or Hamiltonian cycles -- and use them as building blocks to construct regular weaves. Leveraging the fact that for some bisections, G contains no perfect matching but does contain a weave, we use this extension in Section 2.2 to handle the case D/n = 1 2 + Ω(1). Finally, for the general case D/n = Ω(1), we need to handle a graph G that contains no weave on some bisections. The main portion of our proof constructs a weave that is not contained in G, but rather embeds in G with small (polylogarithmic) congestion. Repeating this step sufficiently many times as required by the KRV game, yields a subgraph H as desired. Notation and terminology. For a regular graph G, we denote deg(G) the degree of each vertex. We say that a graph H is an edge-expander if φ(H) > 1 3 . A bisection of a vertex set of size n is a partition (S, ¯S) with equal sizes 1 2 n if n is even, or with sizes (cid:98) 1 2 n(cid:99) and (cid:100) 1 2 n(cid:101) if n is odd. 2.1 The Cut-Matching Game Khandekar, Rao and Vazirani [KRV09] described the following game between two players. Start with an empty graph (no edges) H on a vertex set of even size n. In each round, the cut player chooses a bisection, and the matching player answers with a perfect matching across the bisection. The game ends when H is an edge-expander. Informally, the goal of the cut player is to reach this as soon as possible, and that of the matching player is to delay the game's ending. Theorem 2.1 ([KRV09, KKOV07]). The cut player has an efficiently computable strategy that wins (i.e., is guaranteed to end the game) within O(log2 n) rounds, and a non-efficient strategy that wins within O(log n) rounds. The following result illustrates the use of the KRV framework in our setting. Theorem 2.2. Let δ > 0 and let n be even and sufficiently large (n ≥ n0(δ)). Then every n- vertex graph G(V, E) with minimum degree D ≥ ( 3 4 + δ)n contains an edge-expander H that is d-regular for d = O(log n), and also an efficiently computable edge-expander H(cid:48) that is a d(cid:48)-regular for d(cid:48) = O(log2 n). Proof. Apply the Cut-Matching game on V with the following player strategies. For the cut player, execute the efficient strategy from Theorem 2.1 that wins within O(log2 n) rounds. For the matching player, given a bisection (S, ¯S), consider the bipartite subgraph G[S, ¯S] of G induced by (S, ¯S). Each 2 n − 1 of them are in S, and the rest vertex in S has in G at least D ≥ 3 must be in ¯S, which implies that G[S, ¯S] has minimum degree ≥ 1 4 n. Hence, as a simple consequence of Hall's theorem (see Proposition A.2), it contains a perfect matching that can be efficiently found. The matching player returns this matching as his answer. We then remove this matching from G before proceeding to the next round, to ensure that different iterations find disjoint matchings. The slackness parameter δ (and n being sufficiently large) ensure that the minimum degree of G does not fall below 3 4 n during the O(log2 n) iterations, so the above argument holds in all rounds. 4 n neighbors, but at most 1 5 The game ends with an edge-expander H(cid:48) which is a disjoint union of d(cid:48) = O(log2 n) perfect matchings contained in G, and hence is a d(cid:48)-regular subgraph of G, as required. To obtain the graph H, apply the same reasoning but using the non-efficient strategy from Theorem 2.1 that wins within O(log n) rounds. 2.2 The Cut-Weave Game For values of D below 3 4 n, we can no longer guarantee that every bisection in G admits a perfect matching. However, we observe that one can allow the matching player a wider range of strategies while retaining the ability of the cut player to win within a small number of rounds. Definition 2.3 (weave). Given a bisection (S, ¯S) of a vertex set V , a weave on (S, ¯S) is a subgraph in which every node has an incident edge crossing (S, ¯S). Definition 2.4 (Cut-Weave Game). The Cut-Weave game with parameter r is the following game of two players. Start with a graph H on a vertex set of size n and no edges. In each round, the cut player chooses a bisection of the vertex set, and the weave player answers with an r-regular weave on the bisection. The edges of the weave are added to H. Note that the r = 1 case is the original Cut-Matching game (when n is even). The following theorem is an extension of Theorem 2.1. For clarity of presentation, its proof is deferred to Section 3. Theorem 2.5. In the Cut-Weave game with parameter r, the cut player has an efficient strategy that wins within O(r log2 n) rounds, and furthermore ensures φ(H) ≥ 1 2 r. In order to construct regular weaves, we employ a decomposition of G into disjoint Hamiltonian cycles. The following theorem was proven by Perkovic and Reed [PR97], and recently extended by Csaba, Kuhn, Lo, Osthus and Treglown [CKL+14]. Theorem 2.6. Let δ > 0. Every D-regular graph G on n nodes with D ≥ ( 1 decomposition of its edges into (cid:98) 1 is odd). Furthermore, the decomposition can be found efficiently. 2 + δ)n, admits a 2 D(cid:99) Hamiltonian cycles and possibly one perfect matching (if D Now we can use the Cut-Weave framework to make another step towards Theorem 1.7. Theorem 2.7. Let δ > 0 and let n be sufficiently large. Then every n-vertex graph G(V, E) with minimum degree D ≥ ( 1 2 + δ)n contains a d-regular edge-expander H with d = O(log3 n), which furthermore can be efficiently found. Proof. We simulate the Cut-Weave game with r = 16δ−1 log n. The proof is the same as Theo- rem 2.2, only instead of a perfect matching we need to construct an r-regular weave across a given bisection (S, ¯S). We apply Theorem 2.6 to obtain a Hamiltonian decomposition of G. For simplic- ity, if D is odd we discard the one perfect matching from Theorem 2.6. Let C be the collection of Hamiltonian cycles in the decomposition. 2 n neighbors in S, and hence at least δn incident edges crossing to ¯S. We set up a Set-Cover instance of the cycles C against the nodes in S, where a node v is considered covered by a cycle C is v has an incident edge crossing to ¯S, that belongs to C. This is a dense instance: since each cycle visits v only twice, v can be covered 2 δn cycles. Therefore, 4δ−1 log n randomly chosen cycles form a cover with high probability (see by 1 Proposition A.3 for details). We then repeat the same procedure to cover the nodes on side ¯S. The result is a collection of 8δ−1 log n = 1 2 r disjoint Hamiltonian cycles, whose union forms an r-regular weave on (S, ¯S), which we return as the answer of the weave player. Applying Theorem 2.5 with r = O(log n) concludes the proof of Theorem 2.7. 2 n(cid:101). Every v ∈ S has at most S − 1 ≤ 1 Suppose w.l.o.g. S = (cid:100) 1 6 Observe that in the proof of Theorem 2.7, the weave player is in fact oblivious to the queries of the cut player: all she does is sample random cycles from C, and the output subgraph H is the union of those cycles. Therefore, in order to construct H, it is sufficient to decompose G into disjoint Hamiltonian cycles, and choose a random subset of size O(log3 n) of them. There is no need to actually simulate the cut player, and in particular, the proof does not require her strategy (from Theorem 2.5) to be efficient. 2.3 Reduction to Double Cover We now begin to address the full range of parameters stated in Theorem 1.7. In this range there is no Hamiltonian decomposition theorem (or a result of similar flavor) that we are aware of, so we replace it with a basic argument which incurs edge weights w : V × V → {0, 1, 2} in the target subgraph H, as well as a loss in its degree. Given the input graph G(V, E), we construct its double cover, which is the bipartite graph G(cid:48)(cid:48)(V (cid:48)(cid:48), E(cid:48)(cid:48)) defined by V (cid:48)(cid:48) = V × {0, 1} and E(cid:48)(cid:48) = {((v, 0)(u, 1)) : vu ∈ E}. It is easily seen that if G is D-regular then so is G(cid:48)(cid:48), and since V (cid:48)(cid:48) = 2V we have D ≥ 1 2 βV (cid:48)(cid:48). It also well known that λ2(G) = λ2(G(cid:48)(cid:48)), and therefore by the discrete Cheeger inequalities, φ(G(cid:48)(cid:48)) ≥ 1 2 λ2(G(cid:48)(cid:48))D = 1 2 λ2(G)D ≥ 1 2 γ2(G)D. 2 β and γ(cid:48)(cid:48) = 1 G(cid:48)(cid:48) satisfies the requirements of Theorem 1.7 with β(cid:48)(cid:48) = 1 2 γ2. Suppose we find in G(cid:48)(cid:48) a d-regular edge-expander H(cid:48)(cid:48) with d = (log n)O(1/β(cid:48)(cid:48)γ(cid:48)(cid:48)) = (log n)O(1/βγ2). We carry it over to a sub- graph H of G, by including each edge uv ∈ E in H with weight {(v, 0)(u, 1), (u, 0)(v, 1)} ∩ E(H(cid:48)(cid:48)), where E(H(cid:48)(cid:48)) denotes the edge set of H(cid:48)(cid:48). Each edge then appears in H with weight either 1 or 2 (or 0, which means it is not present in H). It can be easily checked that H is d-regular in weighted degrees, and φ(H) ≥ 1 2 φ(H(cid:48)(cid:48)). Therefore H is a suitable target subgraph for Theorem 1.7. The above reduction allows us to restrict our attention to regular bipartite graphs G, but on the other hand we are forced to look for a subgraph H which is unweighted and d-regular with d = (log n)O(1/βγ) (which is tighter than stated in Theorem 1.7). We take this approach in the remainder of the proof. The gain is that such G admits a decomposition into disjoint perfect matchings, which can be efficiently found, as a direct consequence of Hall's theorem. We will use this fact where we have previously used Theorem 2.6. 2.4 Constructing an Embedded Weave We now get to the main technical part of the proof. Given a bisection (S, ¯S) queried by the cut player, we need to construct an r-regular weave on the bisection, where this time we choose r = (log n)O(1/βγ). Unlike the proof of Theorem 2.7, we cannot hope to find a weave which is a subgraph of G, since if D < 1 2 n, any bisection in which one side contains some vertex and all its neighbors would not admit a weave in G. Instead, we aim for a weave which embeds into G with polylogarithmic congestion. We will use two types of graph operations: The union of two graphs on the same vertex set V is obtained by simply taking the set union of their edge sets, whereas the sum of the two graphs is given by keeping parallel edges if they appear in both graphs. We now construct the weave in 4 steps. Step 1. Fix µ = βγ2 following process: 4 . We partition the entire vertex set V into subsets S0, S1, . . . , St by the 7 1. Set S0 ← ¯S and T ← S. 2. While T (cid:54)= ∅, take Si ⊆ T to be the subset of nodes with at least µD neighbors in Si−1, and set T → T \ Si. βγ iterations. βγ that ends with T (cid:54)= ∅. Denote ¯T = V \ T = ∪i Lemma 2.8. The process terminates after t ≤ 2 Proof. Consider an iteration i ≤ 2 j=0Sj. By the hypothesis φ(G) ≥ γD we have at least γDT edges crossing from T to ¯T , so by averaging over the nodes in T , there is v ∈ T with γD neighbors in ¯T . For every j < i, v must have less than µD neighbors in Sj, or it would already belong to Sj+1 ⊆ ¯T . Summing over j = 0, . . . , i − 1, we see that v has less than iµD ≤ 1 2 γD neighbors in Si. This implies Si ≥ 1 βγ iterations either terminates the process or removes 1 2 γD. We have shown that each of the first 2 2 γD ≥ 1 2 γD neighbors in ¯T \ Si, so at least 1 2 γβn nodes from T , so after 2 βγ iterations we must have T = ∅. Step 2. By Section 2.3 we have a decomposition of all the edges in G into a collection M of D disjoint perfect matchings. For every i = 1, . . . , t, we now cover the nodes in Si with perfect matchings, similar to the proof of Theorem 2.7. A node v ∈ Si is considered covered by a matching if v has an incident edge with the other endpoint in Si−1, and that edge lies on the matching. Since v has µD incident edges crossing to Si−1, and each matching touches v with at most one edge, we have µD matchings that can cover v. Therefore k = 1 µ log n randomly chosen matchings from M form a cover of Si (see Proposition A.3), which we denote as Ki. Thus, for each i we have a subgraph Ki which is k-regular, such that each node in Si has an incident edge in Ki with the other endpoint in Si−1. Denote henceforth K = ∪t i=1Ki. Note that K is a regular subgraph of G, since it is a union of disjoint perfect matchings from M, and deg(K) ≤ kt. In this step we construct a graph K∗ from the subgraph K. As discussed, K∗ will not Step 3. be a subgraph of G but will embed into it with reasonable congestion. Let us formally define the notion of graph embedding that we will be using. Definition 2.9 (Graph embedding with congestion). Let G(V, E) and G(cid:48)(V, E(cid:48)) be graphs on the same vertex set. Denote by PG the set of simple paths in G. An embedding of G(cid:48) into G is a map f : E(cid:48) → PG such that every edge in G(cid:48) is mapped to a path in G with the same endpoints. The congestion of f on an edge e ∈ E is cngf (e) := e(cid:48) ∈ E(cid:48) : e ∈ f (e(cid:48)). The congestion of f is cng(f ) := maxe∈E cngf (e). We say that G(cid:48) embeds into G with congestion c if there is an embedding f with cng(f ) = c. The following claim is a simple observation and we omit its proof. Claim 2.10. If G(cid:48) embeds into G with congestion c, then φ(G) ≥ 1 c φ(G(cid:48)). We generate K∗ with the following inductive construction. Lemma 2.11. Let ρ0 = c0 = 0. We can efficiently construct subgraphs K∗ have parallel edges and self-loops), such that for every i = 1, . . . , t, 1 , . . . , K∗ t (which may 1. K∗ 2. K∗ i is ρi-regular, where ρi = k(1 + ρi−1). i embeds into K with congestion ci, where ci = 1 + kci−1. 8 3. Every v ∈ Si has an incident edge in K∗ i with the other endpoint in S0. Proof. We go by induction on i. For the base case i = 1 we simply set K∗ as we recall that 1 = K1. The claim holds 1. K1 is k-regular. 2. K1 is a subgraph of K, hence it embeds into K with congestion 1 = 1 + kc0. 3. By Step 2, every v ∈ S1 has an incident edge in K1 crossing to S0. We turn to the inductive step i > 1. Start with a graph K(cid:48) which is a fresh copy of K∗ i−1, with each edge duplicated into k parallel edges. By induction, K(cid:48) is (kρi−1)-regular. Now sum Ki into K(cid:48); recall this means keeping parallel edges instead of unifying them. Since Ki is k-regular, K(cid:48) is ρi-regular. Let v ∈ Si. By Step 2, there is an edge vw ∈ Ki such that w ∈ Si−1. By induction, there is an edge wu ∈ K∗ i−1 such that u ∈ S0. Note that both edges vw and wu are present in K(cid:48). Perform the following crossing operation on K(cid:48): Remove the edges vw and wu, and add an edge vu and a self-loop on w. Perform this on every v ∈ Si. The resulting graph is K∗ i . We need to show that it is well defined in the following sense: we might be using the same edge wu for several v's, and we need to make sure each wu appears sufficiently many times, to be removed in all the crossing operations in which it is needed. Indeed, we recall that Ki is the union of k disjoint perfect matchings, and therefore each w ∈ Si−1 has at most k edges in Ki incoming from Si. Since K(cid:48) contains k copies of each edge wu, we have enough copies to be removed in all necessary crossing operations. Lastly we show that K∗ 1. Since K(cid:48) was ρi-regular, and the switching operations do not effect vertex degrees, we see i satisfies all the required properties. that K∗ is ρi-regular. 2. Each edge vu in K∗ i i which is not original from K(cid:48), corresponds to a path (of length 2) in K(cid:48) that was removed upon adding that edge; hence K∗ i embeds into K(cid:48) with congestion 1. K(cid:48) is the sum of Ki, which is a subgraph of K, and k copies of K∗ i−1, which by induction embeds into K with congestion ci−1. Hence K(cid:48) embeds into K with congestion 1 + kci−1 = ci. Therefore, K∗ i embeds into K with congestion ci. 3. For every v ∈ Si, we added to K∗ i an edge vu such that u ∈ S0. Step 4. i=1 K∗ the latter point holds, recall that we put ¯S = S0.) i . By Lemma 2.11, K∗ is ((cid:80)t i=1 ρi)-regular, embeds into K with i=1 ci, and every v ∈ S has an incident edge vu ∈ K∗ such that u ∈ ¯S. (To see why We now take K∗ =(cid:80)t congestion(cid:80)t This results in a subgraph ¯K of G which is kt-regular, and a graph ¯K∗ which is ((cid:80)t embeds into ¯K with congestion(cid:80)t embeds into K∪ ¯K (and hence into G, which contains K∪ ¯K) with congestion c, where r = 2(cid:80)t and c = 2(cid:80)t In this final step we repeat Steps 1 -- 3, only with the roles of S and ¯S interchanged. i=1 ρi)-regular, i=1 ci, and every v ∈ ¯S has an incident edge vu ∈ ¯K∗ such that Our final weave is K∗ + ¯K∗. By the above it is clearly a weave, and moreover it is r-regular and i=1 ρi i=1 ci. By inspecting the recurrence formulas from Lemma 2.11, in which ρi and ci were defined, we can bound ρi, ci ≤ (2k)i ≤ (2k)t for every i, and hence r, c ≤ 2t(2k)t. Recalling that t ≤ 2 µ log n = O(log n), we find r, c ≤ (log n)O(1/βγ). βγ + 1 and k = 1 u ∈ S. 9 2.5 Completing the Proof of Theorem 1.7 (cid:96)=1W(cid:96) and H∗ =(cid:80)L We play the Cut-Weave game for L rounds, where L = O(r log2 n) is the number of rounds required by the efficient strategy in Theorem 2.5. For each round (cid:96) = 1, . . . , L, we constructed above an (cid:96) = K∗ + ¯K∗, that embeds into a subgraph W(cid:96) = K ∪ ¯K of G with congestion c. r-regular weave W ∗ (cid:96) . Then H is a union of disjoint perfect matchings from M, Let H = ∪L and hence regular. Moreover deg(H) ≤ 2ktL, since H is the union of L subgraphs {W(cid:96)}L (cid:96)=1, where each W(cid:96) is a union W(cid:96) of two kt-regular graphs K, ¯K. (cid:96) embeds into W(cid:96) with congestion c, we see that H∗ embeds into H with congestion (at most) cL. By Theorem 2.5 we have φ(H∗) ≥ 1 2 r, and this now implies φ(H) ≥ r 2cL . Now consider H∗. Since each W ∗ 1=(cid:96) W ∗ Recalling the parameters: t = O(1) ; k = O(log n) ; r, c = O(logO(1/βγ) n) ; L = O(r log2 n), we see that H is a d-regular subgraph of d = (log n)O(1/βγ) and φ(H) ≥ 1/(log n)O(1/βγ). We can now repeat this Cut-Weave game (log n)O(1/βγ) disjoint times, because if each time we remove the graph H we have found, we decrease the degree D = βn of each node by only polylog (n). By repeating the game this many times and taking the union of the disjoint resulting subgraphs, we find a regular subgraph H of G with deg(H) = (log n)O(1/βγ) and φ(H) ≥ 1. Lastly recall that unfolding the reduction from Section 2.3 puts on H edge weight in {1, 2}, and weakens the degree bound to deg(H) = (log n)O(1/βγ2). This completes the proof of Theorem 1.7. Regarding the algorithm to construct H, the observation made after Theorem 2.7 applies here as well. The weave player's strategy is oblivious to the queries of the cut player, since she just samples random matchings from M to form H. The cut player strategy does not actually need to be simulated, nor the graphs K∗ need to actually be constructed. The algorithm to construct H then amounts to the following: Construct the double cover graph G" of G; decompose G" into disjoint perfect matchings; choose a random subset of (log n)O(1/βγ2) of them to form a subgraph H" of G"; and unfold the double cover construction to obtain the final subgraph H from H". 2.6 Proof of Theorem 1.8 The theorem follows from replacing the reduction to the double cover in Section 2.3 by a Hamil- tonian decomposition result that holds for this stronger expansion requirement, due to Kuhn and Osthus [KO14, Theorem 1.11]. The trade-off between β and γ is inherited from their theorem (in which it is unspecified). Circumventing Section 2.3 also improves the dependence of d on γ. The proof of Theorem 1.8 is otherwise identical to the proof of Theorem 1.7. 3 Proof of the Cut-Weave Theorem Recall the setting of the Cut-Weave game with parameter r: The game starts with a graph G0 on n vertices and without edges. In each round t = 1, 2, . . ., the weave player queries a bisection of the vertex set, and the weave player answers with an r-regular weave Ht on that bisection. The weave is then unified into the graph, putting Gt = Gt−1 ∪ Ht. We now prove Theorem 2.5 by an adaptation of the analysis from [KRV09]. The main change is in Lemma 3.6. For each step t, let Mt be the matrix describing one step of the natural lazy random walk on 2r move to a neighbor. The cut player 2 stay in the current vertex, and with probability 1 Ht: W.p. 1 strategy is as follows: 10 • Choose a random unit vector z ⊥ 1 in Rn. • Compute u = MtMt−1 . . . M1z. • Output the bisection (S, . . . S) where S is the (cid:98)n/2(cid:99) vertices with smallest values in u. Let us analyze the game with this strategy. In the graph Gt (which equals ∪t t(cid:48)=1Ht(cid:48)), we consider the following t-steps random walk: Take one (lazy) step on H1, then on H2, and so on until Ht. In other words, the walk is given by applying sequentially M1, then M2, and so on. Let Pij(t) denote the probability to go from node j to node i within t steps. Let Pi denote the vector (Pi1, Pi2, . . . , Pji). We use the following potential function: n(cid:88) Lemma 3.1. For every t and every i ∈ V , we have(cid:80) (Pij − 1/n)2 = (cid:88) Ψ(t) = i,j∈V i=1 (cid:107)Pi − 1/n(cid:107)2 2. j∈V Pij(t) = 1. Proof. By induction on t: It holds initially, and in each step t, vertex i trades exactly half of its total present probability with its neighbors in Ht. (Note that this relies on the fact that Ht is regular.) 2 r. Lemma 3.2. If Ψ(t) < 1/4n2 then G = Gt has edge-expansion at least 1 2n for all i, j ∈ V . Hence the graph Kt on V , in which each Proof. If Ψ(t) < 1/4n2 then Pji(t) ≥ 1 edge ij has weight Pji(t) + Pij(t), has edge-expansion 1 2 . We finish by showing that Kt embeds into Gt with congestion 1/r. Proof by induction: Consider the transition from Gt−1 to Gt, which is unifying Ht into Gt−1. Let i, j ∈ V be connected with an edge in Ht, and let k be any vertex. In the transition from Kt−1 to Kt, we need to ship 1 2r Pik) to j, and similarly, ship 1 2r Pjk probability from j to i. (The "type-k" probabiility is probability mass that was originally located in k.) In total, we need to ship 1 2r from i to j and a 2r similar amount from j to i. In total the edge ij in Ht needs to support 1 r flow (of probability) in the transition, so the claim follows. 2r of the type-k probability in i (namely 1 k∈V Pik = 1 (cid:80) We turn to analyzing the change in potential in a single fixed round t. To simplify notation we let Moreover recall we have a vector u generated by the cut player in the current round: Pji = Pji(t) ; Qji = Pji(t + 1). u = MtMt−1 . . . M1z. Denote its entries by u1, . . . , un. We are now adding the graph Ht+1 to Gt to produce Gt+1. Lemma 3.3. For every i, ui is the projection of Pi on r, i.e. ui = P T i z. Proof. Fix i. Abbreviate M = MtMt−1 . . . M1( 1 P T i φ is the probability that the random walk lands in vertex i after t steps, meaning n 1). If φ is any distribution on the vertices then (M φ)i = P T i φ. (1) n(cid:107)z(cid:107)∞ z. Applying Equation (1) with φ = z(cid:48) + 1 Let z(cid:48) = 1 Applying Equation (1) again with φ = 1 i z(cid:48), which implies ui = (M z)i = P T P T i z. n 1 gives (M 1 n 1 gives (M (z(cid:48) + 1 n 1). n 1) and together we get (M z(cid:48))i = n 1))i = P T i (z(cid:48) + 1 n 1)i = P T i ( 1 11 Lemma 3.4. With probability 1 − 1/nΩ(1) over the choice of z, for all pairs i, j ∈ V , (cid:107)Pi − Pj(cid:107)2 2 ≥ n − 1 C log n ui − uj2. Proof. Similar to [KRV09, Lemma 3.4]. Lemma 3.5. Let E(S, ¯S) denote the set of edges in Ht+1 that cross the bisection (S, ¯S) produced by the cut player (from the vector u). Then,  (cid:88) ij∈E(S, ¯S) (n − 1)E ui − uj2  ≥ Ψ(t). Proof. Denote by deg(S, ¯S)(i) the number of edges in E(S, ¯S) incident to vertex i. Note that deg(S, ¯S)(i) ≥ 1 for every i ∈ V , since Ht+1 is a weave on (S, ¯S). Recall that S contains the vertices with smallest entries in u. Hence there is a number η ∈ R such that i ≤ η ≤ j for each edge ij ∈ E(S, ¯S). Hence,(cid:88) ((ui − η)2 + (η − uj)2) ij∈E(S, ¯S) ij∈E(S, ¯S) = ui − uj2 ≥ (cid:88) (cid:88) ≥(cid:88) (cid:88) ≥(cid:88) i∈V i∈V i∈V = u2 i , deg(S, ¯S)(i)(ui − η)2 (ui − η)2 i − 2η u2 (cid:88) ui + nη2 i∈V where the last equality is by noting that z ⊥ 1, hence u ⊥ 1, hence(cid:80) i∈V Next, since ui = P T Pi − 1/n on z. By properties of random projections we have E[u2 in [KRV09]), hence i z and z ⊥ 1 we have ui = (Pi − 1/n)T z. Hence ui is the projection of 2 (see details i ] = 1 i ui = 0. n−1(cid:107)Pi − 1/n(cid:107)2 (cid:35) (cid:34)(cid:88) i∈V E (cid:88) i∈V u2 i = 1 n − 1 (cid:107)Pi − 1/n(cid:107)2 2 = 1 n − 1 Ψ(t), and the lemma follows from combining this with the above. Lemma 3.6. Let Et+1 denote the edge set of Ht+1. The potential reduction is Ψ(t) − Ψ(t + 1) = 1 r (cid:107)Pi − Pj(cid:107)2 2. (cid:88) ij∈Et+1 Proof. We construct from G a graph G(cid:48) by splitting each vertex i into r copies i1, . . . , ir, assigning arbitrarily one edge from the r edges incident to i in Et+1 to the copies, and distributing the type-j probability in i, for each j, evenly among the copies. We denote by Pjik the amount of type-j probability on ik before adding Et+1 to G(cid:48), and by Qjik the type-j probability in i after adding r Pji for all i, j ∈ V and k ∈ [r], but for the Qjik 's all we Et+1. Note that we have defined Pjik = 1 12 k=1 Qjik = Qji, so Qji may be distributed arbitrarily among the Qjik 's. As usual Pik denotes the vector with entries Pjik , and Qik is defined similarly. Define the potential of G(cid:48) as: (cid:88) r(cid:88) i∈V k=1 Ψ(cid:48)(t) = r(cid:88) (cid:88) i∈V k=1 (cid:107)Pik − 1/nr(cid:107)2 2. r(cid:88) r 1. Since we have(cid:80)r (cid:107)Pik − 1/nr(cid:107)2 (cid:88) 2 = r i∈V (cid:107)Pi − 1/n(cid:107)2 2 = r Pi − 1/nr(cid:107)2 (cid:107) 1 r 2 = rΨ(cid:48)(t). to min(cid:107)x − c1(cid:107) s.t. x ∈ Rr,(cid:80) To relate Ψ(t + 1) to Ψ(cid:48)(t + 1), we use the general fact that for any constants c and X, the solution k=1 Qjik = Qji for i xi = X is attained on x = X k=1 know is that(cid:80)r We thus have Ψ(t) = (cid:88) i∈V all i, j, we infer Ψ(t + 1) = (cid:107)Qi − 1/n(cid:107)2 2 = i∈V i,j∈V (cid:88) (cid:88) (cid:88) ≤ (cid:88) (cid:88) i,j∈V i,j∈V = = r = rΨ(cid:48)(t + 1). i∈V k=1 (Qji − 1/n)2 r ( k=1 1 r Qji − 1/nr)2 r(cid:88) r(cid:88) (Qjik − 1/nr)2 r(cid:88) (cid:107)Qik − 1/nr(cid:107)2 k=1 2 r We have thus proven, Ψ(t) − Ψ(t + 1) ≥ r(Ψ(cid:48)(t) − Ψ(cid:48)(t + 1)). Now observe that Et+1 is, by construction, a perfect matching on G(cid:48). Therefore by [KRV09, Lemma 3.3] (which the current lemma generalizes), Ψ(cid:48)(t) − Ψ(cid:48)(t + 1) ≥ (cid:88) (cid:88) (cid:88) = ik,jk(cid:48)∈Et+1 ik,jk(cid:48)∈Et+1 1 r2 i,j∈Et+1 = (cid:107)Pik − Pjk(cid:48)(cid:107)2 2 Pj(cid:107)2 2 (cid:107) 1 Pi − 1 r r (cid:107)Pi − Pj(cid:107)2 2, and the lemma follows. Proof of Theorem 2.5. The initial potential is Ψ(0) = n − 1, and by Lemma 3.2 we need to get it below 1/4n2. Putting Lemmas 3.4 to 3.6 together, we see that in each step we have in expectation Ψ(t + 1) ≤ (1− 1 Cr log n )Ψ(t). Hence, in expectation, it is enough to play for O(r log2 n) rounds. 13 4 Resistance Sparsification We prove Theorem 1.6 by combining Theorem 1.7 with the following known result. Theorem 4.1 (von Luxburg, Radl and Hein [vLRH14]). Let G be a non-bipartite weighted graph with maximum edge weight wmax and minimum weighted degree dmin. Let u, v be nodes in G with weighted degrees du, dv respectively. Then (cid:12)(cid:12)(cid:12)(cid:12)RG(u, v) − (cid:18) 1 + 1 dv du (cid:18) 1 (cid:19)(cid:12)(cid:12)(cid:12)(cid:12) ≤ 2 + 2 λ2(G) (cid:19) wmax . d2 min Qualitatively, the theorem asserts that in a sufficiently regular expander, the resistance distance is essentially determined by vertex degrees. Therefore an expanding subgraph H of G with the same weighted degrees can serve as a resistance sparsifier. In particular, in order to resistance-sparsify a regular expander, all we need is a regular expanding subgraph, as we have by Theorem 1.7. Since Theorem 4.1 does not apply to bipartite graphs, we will use the following variant that holds also for bipartite graphs as long as they are regular. Its proof appears in Appendix A.1. Theorem 4.2. Let G be a weighted graph which is d-regular in weighted degrees, with maximum edge weight wmax. Let u, v be nodes in G. Then (cid:12)(cid:12)(cid:12)(cid:12)RG(u, v) − 2 d (cid:12)(cid:12)(cid:12)(cid:12) ≤ 12 (cid:18) 1 + 2 λ2(G) (cid:19) wmax . d2 Proof of Theorem 1.6. Using Theorem 1.7 we obtain a d-regular subgraph H of G with φ(H) > 1 3 . By removing the obtained subgraph H from G and iterating, we can apply the theorem 3d/ε times and obtain disjoint subgraphs H. Since d = (log n)O(1) and D = Ω(n), the degree of G does not significantly change in the process, and the requirements of Theorem 1.7 continue to hold throughout the iterations (with a loss only in constants). Taking the union of the disjoint subgraphs produced in this process, we obtain a subgraph H of G which is (3d2/ε)-regular with φ(H) ≥ d/ε. By the discrete Cheeger inequality, (cid:18) φ(H) deg(H) (cid:19)2 ≥ 1 18d2 . λ2(H) ≥ 1 2 Recall that H has edge weights in {1, 2}. We now multiply each weight by εD/(3d2), rendering it D-regular in weighted degrees. This does not affect λ2(H) since it is an eigenvalue of the normalized Laplacian. Let u, v ∈ V . Apply Theorem 4.2 on both G and H. As G is D-regular with wmax = 1 and d2 ) (cid:1). And as H is D-regular with wmax = O( εD (cid:1). Putting these together, we get D ± O(cid:0) ε (cid:1) = 1 ± O (ε) , where the last equality holds for sufficiently large n since D ± O(cid:0) 1 D λ2(G) = Ω(1), we know that RG(u, v) = 2 and λ2(H) = Ω(1/d2), we know that RH (u, v) = 2 RH (u,v) RG(u,v) = 1 ± O(cid:0)ε + 1 D2 D D = Ω(n). Scaling ε down by the constant hidden in the last O(ε) notation yields the theorem. Acknowledgements We thank Uriel Feige for useful comments on this work. 14 References [AKW14] A. Andoni, R. Krauthgamer, and D. P. Woodruff. The sketching complexity of graph cuts. CoRR, abs/1403.7058, 2014. arXiv:1403.7058. [BK96] A. A. Bencz´ur and D. R. Karger. Approximating s-t minimum cuts in O(n2) time. In 28th Annual ACM Symposium on Theory of Computing, pages 47 -- 55. ACM, 1996. doi:10.1145/237814.237827. [BSS12] J. D. Batson, D. A. Spielman, and N. Srivastava. Twice-ramanujan sparsifiers. SIAM J. Comput., 41(6):1704 -- 1721, 2012. doi:10.1137/090772873. [CKL+14] B. Csaba, D. Kuhn, A. Lo, D. Osthus, and A. Treglown. Proof of the 1-factorization and Hamilton decomposition conjectures. ArXiv e-prints, abs/1401.4159, 2014. arXiv: 1401.4159. [DL97] M. M. Deza and M. Laurent. Geometry of cuts and metrics. Springer-Verlag, Berlin, 1997. [KKOV07] R. Khandekar, S. A. Khot, L. Orecchia, and N. K. Vishnoi. On a cut-matching game for the sparsest cut problem. Technical Report UCB/EECS-2007-177, EECS Department, University of California, Berkeley, 2007. Available from: http://www.eecs.berkeley. edu/Pubs/TechRpts/2007/EECS-2007-177.html. [KO14] [KP12] D. Kuhn and D. Osthus. Decompositions of complete uniform hypergraphs into hamil- ton berge cycles. J. Comb. Theory, Ser. A, 126:128 -- 135, 2014. doi:10.1016/j.jcta. 2014.04.010. M. Kapralov and R. Panigrahy. Spectral sparsification via random spanners. In 3rd Innovations in Theoretical Computer Science Conference, pages 393 -- 398. ACM, 2012. doi:10.1145/2090236.2090267. [KRV09] R. Khandekar, S. Rao, and U. V. Vazirani. Graph partitioning using single commodity flows. J. ACM, 56(4), 2009. doi:10.1145/1538902.1538903. [Lov96] [PR97] [PS89] [SS11] [ST04] L. Lov´asz. Random walks on graphs: a survey. In Combinatorics, Paul Erdos is eighty, Vol. 2 (Keszthely, 1993), volume 2 of Bolyai Soc. Math. Stud., pages 353 -- 397. J´anos Bolyai Math. Soc., Budapest, 1996. L. Perkovic and B. Reed. Edge coloring regular graphs of high degree. Math.,165/166, pages 567 -- 578, 1997. In Discrete D. Peleg and A. A. Schaffer. Graph spanners. J. Graph Theory, 13(1):99 -- 116, 1989. doi:10.1002/jgt.3190130114. D. A. Spielman and N. Srivastava. Graph sparsification by effective resistances. SIAM J. Comput., 40(6):1913 -- 1926, December 2011. doi:10.1137/080734029. D. A. Spielman and S.-H. Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In 36th Annual ACM Symposium on Theory of Computing, pages 81 -- 90. ACM, 2004. doi:10.1145/1007352.1007372. 15 [ST11] D. A. Spielman and S.-H. Teng. Spectral sparsification of graphs. SIAM J. Comput., 40(4):981 -- 1025, July 2011. doi:10.1137/08074489X. [vLRH14] U. von Luxburg, A. Radl, and M. Hein. Hitting and commute times in large random neighborhood graphs. Journal of Machine Learning Research, 15(1):1751 -- 1798, 2014. Available from: http://jmlr.org/papers/v15/vonluxburg14a.html. A Appendix: Omitted Proofs A.1 Proof of Theorem 4.2 In the non-bipartite case, Theorem 4.2 follows from Theorem 4.1. We henceforth assume that G = (V, E, w) is bipartite with bipartition V = V1 ∪ V2. Note that since it is regular, we must have V1 = V2 = 1 2V . Furthermore, as a weighted regular bipartite graph, G is a convex combination of perfect matchings and hence is regular also in unweighed degrees. Let d(cid:48) denote the unweighted degree of each vertex in G. If d(cid:48) ≤ 2 then it is easy to verify that the theorem holds (due to poor expansion), so we henceforth assume d(cid:48) ≥ 3. For brevity we denote the error term in Theorem 4.1 as (cid:18) 1 (cid:19) wmax . d2 err := 2 + 2 λ2(G) We will use the notion of hitting time: For a pair of vertices u, v, the hitting time HG(u, v) is defined as the expected time it takes a random walk in G that starts at u, to hit v. Define the normalized hitting time hG(u, v) = 1 2W HG(u, v), where W is the sum of all edge weights in G. We then have, RG(u, v) = hG(u, v) + hG(v, u). (2) We will use the following bound on the normalized hitting time, which is given in the same theorem by von Luxburg, Radl and Hein [vLRH14]. Theorem A.1. In the same setting of Theorem 4.1, ∀u (cid:54)= v ∈ V, hG(u, v) = ± err. 1 dv (Like Theorem 4.1, this theorem does not apply to bipartite graphs, and this is the obstacle we are now trying to circumvent.) We begin by handling pairs of vertices contained within the same partition side, say V1. We construct from G a weighted graph G1 on the vertex set V1, with weights w1, by putting ∀i (cid:54)= j ∈ V1, w1(i, j) = 1 d w(i, k)w(j, k). (cid:88) k∈V2 We argue that HG1(u, v) = 1 2 HG(u, v). This follows by observing that we set the weights w1 such that for any i, j ∈ V1, the probability to walk in one step from i to j in G1 equals the probability to walk in two steps from i to j in G via an intermediate node in V2. Furthermore, we have normalized 2V , we have the weights w1 such that G1 is d-regular in weighted degrees. Recalling that V1 = 1 hG1(u, v) = 1 dV1 HG1(u, v) = 2 dV · 1 2 HG(u, v) = hG(u, v). 16 Recalling that the unweighted degree in G is d(cid:48) ≥ 3, we see that by construction, G1 contains a triangle and hence is non-bipartite. Hence we can apply to it Theorem A.1 and obtain hG1(u, v) = d ± err1, where err1 is the error term of G1. Note that for every i (cid:54)= j ∈ V1 we have w1(i, j) ≤ 1 w(i, k) = wmax, so the maximum edge weight in G1 is bounded by wmax, and λ2(G1) ≥ λ2(G) (easy to verify by construction), so err1 ≤ err, and we have hG1(u, v) = 1 d ± err. Hence, (cid:80) k∈V2 wmax d Recalling that RG(u, v) = hG(u, v) + hG(v, u), we have established that hG(u, v) = ± err. 1 d RG(u, v) = ± 2err 2 d for every pair u, v ∈ V1. The same arguments hold for every pair u, v ∈ V2 as well. We are left to handle the case u ∈ V1, v ∈ V2. Recalling the definition of hitting time, we have HG(u, v) = 1 + w(u, v) d · 0 + w(u, x) d HG(x, v) (factoring out the first step) = 1 + w(u, v) · 0 + w(u, x) · 2W · hG(x, v) (cid:88) (cid:88) x∈V2\{v} x∈V2\{v} w(u, x) (cid:18) 1 (cid:19)(cid:18) 1 d d ± err (cid:19) (cid:19) . ± err d (cid:18) d (cid:88) = 1 + 2W = 1 + 2W (cid:18) d x∈V2\{v} 1 − w(u, v) d hG(u, v) = 1 2W + 1 − w(u, v) d hG ≤ 1 2W ± err 1 d (cid:19) (cid:16) + (cid:17)(cid:18) 1 (cid:88) d j∈V d = deg(i) = w(i, j) ≤ nwmax, Therefore which implies and (since v, x ∈ V2) (cid:19)(cid:18) 1 d (cid:19) ± err , hG(u, v) ≥ 1 2W 1 − wmax d ± 2err. 2W ± 2err. Now, since for an arbitrary vertex i we have ± err 1 2W d + 1 1 d + + = Together, hG(u, v) = 1 we see that 1 2W = 1 nd ≤ wmax d2 ≤ err and hence hG(u, v) = ± 3err. 1 d Plugging this into RG(u, v) = hG(u, v) + hG(v, u), we find ± 6err, RG(u, v) = 2 d which completes the proof of Theorem 4.2. 17 4 n. Then G contains a perfect matching. 4 n neighbors in U , we have N (S) ≥ N ({v}) ≥ 1 A.2 Further Omitted Proofs Proposition A.2. Let G(V, U ; E) be a bipartite graph on n nodes with V = U = 1 minimum degree ≥ 1 Proof. Let S ⊂ V be non-empty, and denote N (S) ⊂ U the set of nodes with a neighbor in S. If S ≤ 1 4 n then since any v ∈ S has 1 4 n ≥ S. If S > 1 4 n then by the minimum degree condition on side U , every u ∈ U must have a neighbor in S, and hence N (S) = U = V ≥ S. The same arguments apply for S ⊂ U , so the condition of Hall's Marriage Theorem is verified, and it implies that G contains a perfect matching. Proposition A.3. Consider an instance of Set Cover with a set S of n elements, and a family M of subsets of S. Suppose each x ∈ S belongs to at least a µ-fraction of the subsets in M. Then for sufficiently large n, we can efficiently find a cover M ⊂ M with M ≤ 1.1 Proof. Pick q uniformly random sets (with replacement) from M to form M . The probability that a given element in S is not covered by M is upper-bounded by (1− µ)q. Taking a union bound over the element, we need to ensure that n(1− µ)q < 1 in order to ensure that with constant probability, M is a solution to the given Set Cover instance. This can be achieved by q ≤ 1.1 2 n, and µ log n. µ log n. 18
1209.5821
3
1209
2013-11-16T15:08:23
Faster spectral sparsification and numerical algorithms for SDD matrices
[ "cs.DS" ]
We study algorithms for spectral graph sparsification. The input is a graph $G$ with $n$ vertices and $m$ edges, and the output is a sparse graph $\tilde{G}$ that approximates $G$ in an algebraic sense. Concretely, for all vectors $x$ and any $\epsilon>0$, $\tilde{G}$ satisfies $$ (1-\epsilon) x^T L_G x \leq x^T L_{\tilde{G}} x \leq (1+\epsilon) x^T L_G x, $$ where $L_G$ and $L_{\tilde{G}}$ are the Laplacians of $G$ and $\tilde{G}$ respectively. We show that the fastest known algorithm for computing a sparsifier with $O(n\log n/\epsilon^2)$ edges can actually run in $\tilde{O}(m\log^2 n)$ time, an $O(\log n)$ factor faster than before. We also present faster sparsification algorithms for slightly dense graphs. Specifically, we give an algorithm that runs in $\tilde{O}(m\log n)$ time and generates a sparsifier with $\tilde{O}(n\log^3{n}/\epsilon^2)$ edges. This implies that a sparsifier with $O(n\log n/\epsilon^2)$ edges can be computed in $\tilde{O}(m\log n)$ time for graphs with more than $O(n\log^4 n)$ edges. We also give an $\tilde{O}(m)$ time algorithm for graphs with more than $n\log^5 n (\log \log n)^3$ edges of polynomially bounded weights, and an $O(m)$ algorithm for unweighted graphs with more than $n\log^8 n (\log \log n)^3 $ edges and $n\log^{10} n (\log \log n)^5$ edges in the weighted case. The improved sparsification algorithms are employed to accelerate linear system solvers and algorithms for computing fundamental eigenvectors of slightly dense SDD matrices.
cs.DS
cs
Faster spectral sparsification and numerical algorithms for SDD matrices Ioannis Koutis CSD-UPRRP [email protected] Alex Levin MATH-MIT [email protected] Richard Peng CSD-CMU [email protected] May 2, 2014 Abstract We study algorithms for spectral graph sparsification. The input is a graph G with n vertices and m edges, and the output is a sparse graph G that approximates G in an algebraic sense. Concretely, for all vectors x and any ǫ > 0, the graph G satisfies (1 − ǫ)xT LGx ≤ xT L Gx ≤ (1 + ǫ)xT LGx, where LG and L G are the Laplacians of G and G respectively. We show that the fastest known algorithm for computing a sparsifier with O(n log n/ǫ2) edges can actually run in O(sf m log2 n) time1, an O(log n) factor faster than before. We also present faster sparsifi- cation algorithms for slightly dense graphs. Specifically, we give an algorithm that runs in O(tf m log n) time and generates a sparsifier with O(sf n log3 n/ǫ2) edges. We also give an O(m log log n) time al- f n log5 n log log n edges and an O(m) algorithm for graphs with gorithm for graphs with more than s2 f n log8 n edges. The improved more than t2 sparsification algorithms are employed to accelerate linear system solvers and algorithms for computing fundamental eigenvectors of slightly dense SDD matrices. f n log10 n edges and unweighted graphs with more than s3 f s3 1 Introduction The efficient transformation of dense instances of graph problems to nearly equivalent sparse instances is a very powerful tool in algorithm design. The idea, widely known as graph sparsification, was originally introduced by Bencz´ur and Karger [3] in the context of cut problems. Spielman and Teng [15] generalized the cut-preserving sparsifiers of Bencz´ur and Karger to the more powerful spectral sparsifiers, which preserve in an algebraic sense the Laplacian matrix of the dense graph. The main motivation of spectral sparsifiers was the design of nearly-linear time algorithms for the solution of symmetric diagonally dominant (SDD) linear systems. A matrix A is SDD if it is symmetric and for all i, Aii ≥ Pj6=i Aij. Bencz´ur and Karger proved that, for arbitrary ǫ, cuts can be preserved within a factor of 1 ± ǫ by a graph with O(n log n/ǫ2) edges. This graph can be computed by a randomized algorithm that runs in O(m log3 n) time2, where m is the number of edges in the dense graph. Spielman and Teng gave the first construction of spectral sparsifiers, but the edge count of these objects was several log factors bigger than 1We denote by sf and tf the O(log log n) factors that appear in the stretch and time guarantees of the best currently known algorithm for computing low-stretch trees [1]. It is conjectured that sf = O(1) and tf = O(1) is possible. 2All sparsification algorithms in this paper are randomized with a probability failure inversely proportional to n. They consist of a preprocessing phase followed by the generation of the sparsifier which in general can be performed in time proportional to the number of edges in it (e.g. O(n log n/ǫ2)). For the sake of conciseness our running time statements will include only the time for preprocessing and will omit the failure probability. 1 that of Bencz´ur and Karger’s cut-preserving sparsifiers. However, recent progress that we review below allows for the construction of spectral sparsifiers with O(n log n/ǫ2) edges in O(sf m log3 n) time. Sparsification can be employed to immediately accelerate algorithms for numerous problems. In several cases and depending on the density of the instance, the sparsification routine dominates the running time of the sparsifier-enhanced algorithm. This is a strong incentive for speeding up the construction of sparsifiers even further. This problem was undertaken in the context of cut-preserving sparsifiers by Fung et al. [5]. Improving upon the work of Bencz´ur and Karger, they proved that there is an O(m log2 n) time algorithm that computes a sparsifier with O(n log n/ǫ2) edges. This stands as the fastest known algorithm with this sparsity guarantee for general graphs. However, Fung et al. also showed that we can do even better on slightly more dense graphs. More concretely, they proved that there is an O(m) time algorithm that computes a sparsifier with O(n log2 n/ǫ2) edges. Note that by transitivity, a combination of the two algorithms can produce a graph with O(n log n/ǫ2) edges in O(m + n log4 n) time. In other words, there is a linear time sparsification algorithm for graphs with more than n log4 n edges. This leads us to the main question we address in this paper: Is something analogous possible for spectral sparsification? We answer the question in the affirmative. We first show that a slight modification of the Spielman-Srivastava algorithm [14] can improve the run time to O(sf m log2 n). This nearly matches the general case algorithm of [5]. We present three additional sparsification algorithms. The first is a variation of the Spielman-Srivastava algorithm that generates a sparsifier with O(sf n log3 n/ǫ2) edges in O(tf m log n) time. The second produces a sparsifier with O(n log n/ǫ2) edges in O(m log log n) time, assuming the f n log5 n log log n edges. The third produces a sparsifier with O(n log n/ǫ2) edges in input has more than s2 f n log8 n edges, or if it has more than O(m) time assuming the input is unweighted and has more than s3 t2 f s3 Applications in numerical algorithms The (1 ± ǫ)-sparsifiers we obtain can be employed in a standard way as preconditioners for SDD lin- ear systems, giving us faster solvers for slightly dense graphs: (i) an O(m log log n) time solver for sys- f n log5 n log log n non-zero entries and (ii) an O(m) time solver for Laplacians of tems with more than s2 f n log10 n non-zero entries. The best previously known algorithm [13] runs in f s3 graphs with more than t2 O(sf m log n log(1/δ)) time. f n log10 n in the weighted case. In addition, our sparsification algorithms accelerate the computation of an approximate Fiedler eigen- vector of a graph Laplacian LG. An (1+ǫ)-approximate eigenvector is a unit norm vector x such that xT LGx is within a factor 1 + ǫ from the eigenvalue λ2 of LG. The algorithm consists of two steps: (i) computing a spectral sparsifier G that (1 ± ǫ/2)-approximates the input graph G and (ii) computing a (1 + ǫ/3)- approximate eigenvector of G; this will automatically be an (1 ± ǫ)-approximate eigenvector of the (more) dense input graph because the spectral sparsification step preserves the eigenvalues of G within 1 ± ǫ/2. Hence combining our sparsification algorithms with the inverse power method [16] (which consists of solving f n log5 n log(1/ǫ)/ǫ2) time. O(log n log(1/ǫ)) systems in L G) gives an approximate eigenvector in O(m + s2 The fastest previously known algorithm runs in time O(sf m log2 n log(1/ǫ)). The same result applies to the computation of the Fiedler eigenvector of a normalized Laplacian D−1/2LGD−1/2; applying the inverse power method on D−1/2L GD−1/2 gives the required eigenvector. We note here that one practical application of eigenvectors is in partitioning algorithms; the analysis of Cheeger’s inequality [4] tells us how to turn an approximate Fiedler vector into a partition. Hence, we give an improvement to the running time of a fundamental graph partitioning algorithm. Finally we note that the computation of additional eigenvectors can be performed in the same amount of time (per vector) by restricting the action of the matrix to the complement of the subspace spanned by the previously computed eigenvectors. 2 2 Overview of our techniques 2.1 Brief background on spectral sparsification The first algorithm for edge-efficient spectral sparsifiers was given by Spielman and Srivastava [14]. Their algorithm produces a sparsifier with O(n log n/ǫ2) edges in a very elegant way: it samples edges with replacement. The probability of sampling an edge is proportional to its weight multiplied by its effective resistance in the resistive electrical network associated with the given graph. Computing the effective resistance of a given edge requires—almost by definition—the solution of a linear system on the graph Laplacian.3 However, Spielman and Srivastava also provided a way of estimating all m effective resistances, via solving O(log n) SDD linear systems. This holds under the assumption that the SDD solver is direct, i.e. it outputs an exact solution. The use of a nearly-linear time iterative solver that computes approximate solutions introduces an additional source of imprecision; Spielman and Srivastava showed that solving the systems up to an inverse polynomial precision is sufficient for sparsification. This brings the running time of their algorithm to O(sf m logc+2 n), where c is the constant appearing in the running time of the SDD solver. 2.2 The O(sf m log2 n) time algorithm While the work of Spielman and Srivastava did not improve the running time of the SDD solver, it proved to be a decisive step towards the fast SDD solver of Koutis, Miller, and Peng [12, 13], which runs in time O(sf m log n log(1/δ)), where δ is the desired precision. Using this solver in the Spielman and Srivastava sparsification sampling scheme immediately yields an O(sf m log3 n/ǫ2) time algorithm. This brings us to the first contribution of this paper, a tighter analysis of the Spielman and Srivastava algorithm. In Section 5 we show that solving the systems up to fixed precision is actually sufficient for sparsification. This decreases the running time to O(sf m log2 n/ǫ2). 2.3 Faster algorithms: The main idea To get our two faster algorithms, we will trade accuracy in the computation of effective resistances for speed. The idea is to transform the input graph G into another graph H where effective resistances can be computed faster while still providing good bounds for the true effective resistances in G. These approximate effective resistances can still be used for sparsification at the expense of additional sampling [12] that yields slightly more dense sparsifiers. These sparsifiers can be re-sparsified to O(n log n/ǫ2) edges by applying the fast general-case algorithm. 2.4 The O(tf m log n) time algorithm The O(tf m log n) time algorithm is based on the observation that the Spielman-Srivastava scheme can be implemented to run in O(tf m log n) time on a spine-heavy approximation H of G. The spine-heavy graph H is derived in O(tf m log n) time from G by computing a low-stretch tree of G and scaling it up by a O(sf log2 n) factor. In [13] it was shown that linear systems involving the Laplacian of H can be solved in O(m) time, enabling the faster implementation of the Spielman-Srivastava scheme on H. At the same time the effective resistances in H are at most a O(sf log2 n) factor smaller than those in G. Sampling with respect to these estimates, allows us to get a sparsifier G′ with O(sf n log3 n/ǫ2) edges. Re-sparsifying G′ gives a sparsifier G with O(n log n/ǫ2) edges in O(s2 f n log5 n/ǫ2) time. The details are given in Section 5. 2.5 The O(m log log n) and O(m) time algorithms There are two major bottlenecks in the O(tf m log n) time algorithm. In order to work around them, we introduce several ideas of independent interest. 3Laplacian matrices are SDD. 3 (a) The first bottleneck is in the computation of the low-stretch tree; all known algorithms for comput- ing a low-stretch tree run in time at least O(m log n). The solution to this problem involves two steps. We first observe that if we can settle for a weaker stretch guarantee, it is enough to find a low-stretch tree of a subgraph H of the input graph G which preserves all cuts of G within a polylogarithmic factor. This allows the existing low-stretch tree computation to run faster, assuming the subgraph is sparser by an O(tf log n) factor. The subgraph H can be viewed as an approximate cut sparsifier of G, a notion very similar to the incremental spectral sparsifiers from [12]; these are computed by first finding a low-stretch tree and sampling off-tree edges with probability proportional to their stretch over the tree. Inspired by this idea, we give an even simpler algorithm for computing the graph H: we find a maximum weight spanning tree and then we sample uniformly the off-tree edges. The proof that a variant of this simple procedure returns the desired incremental cut sparsifier relies on Karger’s earlier work on cut sparsification [8]. (b) Having removed the low-stretch tree computation obstacle we can now attempt to mimic the steps of the O(tf m log n) time algorithm. In fact it is possible to take care of the system-solving part of the Spielman-Srivastava scheme in O(m) time by merely scaling-up the low-stretch tree by a larger factor. However this is not enough; there is still a bottleneck that lies in the computations after the solution of the linear systems in the heavier-spine graphs. These are m simple manipulations of vectors of dimension O(log n). In an earlier version of this work, we attempted to work around this problem by reducing the dimension of these vectors, but at a significant loss of sparsity [11]. Here we take a different route. We first use the low-stretch tree to construct an approximate sparsifier i.e. a sparse approximation for the input graph, but of moderate quality. The significant departure from the Spielman-Srivastava scheme comes in the next step which computes estimates of the effective resistances using a combinatorial rather than algebraic approach. Concretely, we observe that with some additional work we can ‘leverage’ the approximate sparsifier to compute a sparsifier for G as well. Indeed, let H be a κ-approximation of G (see Definition 3.1) and H be a sparsifier of H with O(n log n) edges; H is the approximate sparsifier. Then we generate a low-stretch spanning tree T of H in O(sf n log2 n) time and approximate the effective resistances of G over T in O(m) time. We will be able to claim that these approximate values are enough to generate a sparsifier G′ for G with O(sf nκ log3 n) edges. Finally from G′ we can compute a sparsifier G with O(n log n/ǫ2) edges in O(s2 f κn log5 n) time using our first algorithm. We will derive our O(m) algorithm via a single application of the above ‘leveraging’ idea for κ = f log5 n). To improve over the O(sf m log n) algorithm for even sparser graphs we will progressively O(s3 sparsify a sequence of t = O(log log n) graphs H = H0, H1, . . . , Ht = G, such that Hi is a 2-approximation of Hi+1: given the sparsifier for Hi we can construct the sparsifier for Hi+1 via the leveraging idea. The details are given in Section 6. 3 Background on spectral graph theory and sparsification 3.1 The graph Laplacian and its pseudoinverse Let G = (V, E, w) be an undirected weighted graph on n vertices, which we identify with the integers {1, 2, . . . , n}, and m edges, where the weight of edge e is given by we. Without loss of generality we will assume that minimum weight is 1. We will also assume that matrices discussed below are represented as adjacency lists. The Laplacian of G is denoted by LG. It is a symmetric n × n matrix with zero row and column sums, where the (i, j) off-diagonal entry is given by −w(i,j) if (i, j) is an edge of G and 0 otherwise. The ith diagonal entry is given by the weighted degree of vertex i. If G is a connected graph, then LG is a matrix of rank n − 1, with its kernel spanned by 1 (the vector G denote the Moore-Penrose pseudoinverse of LG; this is a matrix that acts as the G = In−1, where In−1 is the projection onto the of all 1’s). We let L+ inverse of LG on (ker LG)⊥, and satisfies L+ GLG = LGL+ 4 (n − 1)-dimensional image of LG. notation to graphs, with the obvious meaning. Given the one-to-one correspondence of graphs and their Laplacians we will often apply algebraic 3.2 Spectral approximation and sparsification In this paper we concentrate on symmetric diagonally dominant matrices. For two matrices A and B of the same dimension, we write A (cid:22) B if xT Ax ≤ xT Bx for all vectors x. For two graphs G and H, we write G (cid:22) H if the Laplacians satisfy LG (cid:22) LH. Definition 3.1 We say that a graph H is a κ-approximation of a graph G if G (cid:22) H (cid:22) κG. It is not hard to show that if H is a graph that κ-approximates a graph G then we have 1 κ G (cid:22) L+ L+ H (cid:22) L+ G (3.1) Definition 3.2 Given a graph G, we say that a (sparser) graph H is a 1 ± ǫ spectral sparsifier of G if (3.2) (1 − ǫ)G (cid:22) H (cid:22) (1 + ǫ)G. It is easy to see that if H is a 1± ǫ spectral sparsifier of G then 1 1−ǫ -approximates G. By the definition, it is also easy to verify transitivity. If G1 is a 1 ± ǫ1 sparsifier of G and G2 is a 1 ± ǫ2 of G1 then G2 is a (1 ± ǫ1)(1 ± ǫ2) sparsifier of G. 3.3 Graphs as resistive electrical networks 1−ǫ H is a graph that 1+ǫ We can consider our graph G as an electrical network of nodes (vertices) and wires (edges), where edge e has resistivity of w−1 e Ohms. In this context it is very useful to give another definition of the Laplacian LG, in terms of its incidence matrix BG. To define BG, fix an arbitrary orientation for each edge in G. For a vertex i let χi be its (n × 1) characteristic vector, with a 1 at the ith entry and 0’s everywhere else. Let e = (i, j) be an edge and define be = χi − χj. Then BG is the m × n matrix whose eth row is the vector be. Let WG be the m × m diagonal matrix whose eth diagonal entry is we. With these definitions, it is easy to verify that LG = BT GWGBG = X e∈G webebT e . For notational convenience, we will drop the subscripts on LG, BG, and WG when the graph we are dealing with is clear from context. Going back to the electrical analogy, the effective resistance between vertices i and j, denoted by RG(i, j) or RG(e) when (i, j) is an edge e, is the voltage difference that has to be applied between i and j in order to drive one unit of external current between the two vertices. Algebraically it is given by RG(i, j) = (χi − χj)T L+ The above equation allows us to apply (3.1) and see that G(χi − χj) G (cid:22) H (cid:22) κG ⇒ (1/κ)RG(e) ≤ RH(e) ≤ RG(e). (3.3) (3.4) The definition of the effective resistance for (i, j) in (3.3) shows directly that it can be computed by solving the system LGx = (χi − χj). In light of this, (3.4) will be of central importance in our proofs. Informally, it states that if H is a κ-approximation of G, then the effective resistance of any edge in G 5 can be approximated by the effective resistance of the same edge in H, which can be done by solving the system LHx = (χi − χj). This will allow us to construct special approximations H for which solving with LH is easier than with LG. 3.4 Low-stretch subgraphs, spine-heavy graphs, and SDD solvers Let S be a graph on the same vertex set as a graph G. Let e = (i, j) be an edge of G. If p is a path e1, e2, . . . , eν between i and j in S we say that the stretch of e over p is stretchp(e) := we Pν ei , i.e. the weight of e multiplied by the sum of inverse weights of tree edges on the path from i to j. If P(e) is the set of all paths between i and j in S we define i=1 w−1 stretchS(e) = min p∈P(e) stretchp(e). We will use the term stretch of e over S for stretchS(e). The definition is simpler when S is a tree. In this case there is a unique path between the endpoints of e. We denote by stretchS(G) the sum of stretches in S of all edges of G, i.e. stretchS(G) = X e∈G stretchS(e). It is known that every graph G has a spanning tree T with stretchT (G) = O(m log n log log n), known as a low-stretch tree. The tree can computed in O(m log n log log n) time [1]. Because these guarantees are still open to improvement we will state our results with respect to two parameters: We will denote by tf the factor in excess of O(m log n) in the time required for computing a low-stretch tree on a graph with m edges, via the algorithm in [1]. Similarly, we will denote by sf the factor in excess of O(m log n) in stretchT (G) provided by the same algorithm. That is, as noted above, the best current guarantees are sf = O(log log n) and tf = O(log log n). We call a graph spine-heavy if it has a spanning tree with stretchT (G) = O(m/ log n). Given a graph G we can compute a spine-heavy graph H that O(sf log2 n)-approximates it by computing a low-stretch tree and then scaling up the weights of tree edges in G by the O(sf log2 n) factor. This is summarized in the following lemma. Lemma 3.3 For every graph G with n vertices there is a spine-heavy graph H that O(sf log2 n)-approximates G. The graph H can be constructed in time dominated by the computation of a low-stretch tree for G. Finally we state a lemma that summarizes the recent work on fast SDD solvers [13]. Lemma 3.4 Let A be an SDD matrix. There is a symmetric operator Aδ such that and that for any vector b, the vector A+ Moreover, if A is the Laplacian of a spine-heavy graph and its low-stretch tree is given, then A+ evaluated in O(m log(1/δ)) time. (1 − δ)A (cid:22) Aδ (cid:22) (1 + δ)A δ b can be evaluated in O(tf m log n + sf m log n log(1/δ)) time. δ b can be 3.5 Sampling for sparsification In a remarkable work, Spielman and Srivastava [14] analyzed a spectral sparsification algorithm based on a simple sampling procedure. The procedure will be central in our algorithms and we review it here. It takes as input a weighted graph G and frequencies p′ e for each edge e. These frequencies are normalized to probabilities pe summing to 1. It then picks in q rounds exactly q samples, which are weighted copies of the edges. The probability that given edge e is picked in a given round is pe. The weight of the corresponding 6 Sample e Input: Graph G = (V, E, w), p′ : E → R+. Output: Graph G′ = (V,L, w′). 1: t := Pe p′ 2: q := Cst log t/ǫ2 3: pe := p′ 4: G′ := (V,L, w′) with L = ∅ 5: for q times do 6: e/t (* CS is an explicitly known constant *) Sample one e ∈ E with probability of picking e being pe Add l, a sample of e, to L with weight w′ l = we/pe 7: 8: end for 9: For all l ∈ L, let w′ 10: return G′ l := w′ l/q sample is set so that the expected weight of the edge e after sampling is equal to its actual weight in the input graph. The details are given in the following pseudocode. Spielman and Srivastava analyzed the case when p′ e = weRG(e), where RG(e) is the effective resistance of e in G. The following generalization characterizes the quality of G′ as a spectral sparsifier for G. It is shown in [9] and it was originally proved with a weaker success guarantee in [12]. Theorem 3.5 (Oversampling) Let G = (V, E, w) be a graph. Assuming that p′ edge e ∈ E the graph G′ = Sample(G, p′) is a (1 ± ǫ) sparsifier of G with probability at least 1 − 1/n2. 3.6 Incremental spectral sparsifiers e ≥ weRG(e) for each In [12], Koutis, Miller, and Peng asked whether they could get anything useful out of the Spielman- Srivastava construction, without having to use effective resistances whose computation requires the solution of linear system solvers. The oversampling Theorem 3.5 offers a possibility as long as we are able to compute, more efficiently, upper bounds to the quantities weRG(e). The idea in [12] was to use spanning trees and use as an upper bound the stretch of an edge over the tree. The idea generalizes readily to spanning subgraphs. The reason is that for any subgraph S, we have stretchS(e) ≥ weRG(e) by Rayleigh’s theorem. In the case S is a tree, we can compute the stretches of all the edges in O(m) time (using an offline lowest common ancestor algorithm [18, 6]). For one of our results we will also take S to be a so-called O(log n)-spanner of the graph. In this case, by definition of spanner, we have stretchS(e) = O(log n) for all e; we will use directly these estimates without further computations. In order to get a useful approximation via oversampling, we need the number of edges in the resulting object to be significantly smaller than m. The intuition is that the lower we get stretchS(G) the fewer sam- ples we need to take, since the sum of the overestimates of the probabilities defines the number of samples. In [12] this intuition is coupled with a scaling-up technique, where instead of G we apply oversampling on a graph H that is the same as G except that the weights of the edges of S are scaled up by a suitably chosen factor κ. By doing that, we lose a factor of κ in the approximation guarantee but at the same time we in fact lower the total stretch by a κ factor, and, for suitable κ, we will have have a small enough edge count in the graph I we output. We call this graph the incremental spectral sparsifier. We summarize the result in Theorem 3.6 below, which is an adaptation of a corresponding Theorem in [13], coupled with the stronger probabilistic guarantee of success of Theorem 3.5, and slightly generalized to handle general subgraphs rather than only spanning trees. 7 Theorem 3.6 Let G be a graph and S be a spanning subgraph of G. Assume that stretchS(e) is known for each edge e of G. Then, there is an algorithm for constructing a graph I such that, given κ: • H (cid:22) I (cid:22) 2H, where H = G + κS. • I has n − 1 + O(stretchS(G) log n/κ) edges assuming stretchS(G) is polynomially bounded. The algorithm succeeds with high probability and runs in in O(m + stretchS(G) log n/κ) time. 4 The general case: An O(sf m log2 n) time algorithm 4.1 Estimating effective resistances e = weRG(e). For As we discussed above, Spielman and Srivastava [14] use the Sample algorithm with p′ the efficient implementation of their algorithm they first obtain a different expression for the effective resistance, via a simple algebraic manipulation: RG(i, j) = (χi − χj)T L+(χi − χj) = (χi − χj)T L+LL+(χi − χj) = (χi − χj)T L+BT W 1/2W 1/2BL+(χi − χj) = kW 1/2BL+(χi − χj)k2 The advantage of this definition is that it expresses the effective resistance as the squared Euclidean distance between two points, given by the ith and jth column of the matrix W 1/2BL+. This new expression still involves the solution of a linear system with L. The natural idea is to replace L with an approximation Lδ satisfying the properties described in Lemma 3.4. So instead of RG(i, j) we compute the quantities RG(i, j) = kW 1/2B L+ Of course, there are still m systems to be solved. To work around this hurdle, Spielman and Srivastava observe that projecting the vectors to an O(log n)-dimensional space preserves the Euclidean distances within a factor of 1±ǫ/8, by the Johnson- Lindenstrauss theorem. Algebraically this amounts to computing the quantities kQW 1/2B L+ δ (χi − χj)k2, where Q is a properly defined random matrix of dimension k × m for k = O(log n). The authors invoke the result of Achlioptas [2], which states that one can use a matrix Q each of whose entries is randomly chosen in {±1/√k}. δ (χi − χj)k2. The construction of the sparsifiers can can thus be broken up into three steps. 1. Compute QW 1/2B. This takes time O(km), since B has only two non-zero entries per row. 2. Apply the linear operator L+ δ to the k columns of the matrix (QW 1/2B)T , using Lemma 3.4. This gives the matrix Z = QW 1/2B L+ δ . 3. Compute all the (approximate) effective resistances (time O(km)) via the square norm of the differ- ences between columns of the matrix Z. Then sample the edges. 4.2 The O(sf m log2 n) time algorithm Spielman and Srivastava prove that the approximations RG(i, j) can be used to obtain the sparsifier if they satisfy (1 − ǫ/4)RG(i, j) ≤ RG(i, j) ≤ (1 + ǫ/4)RG(i, j). Then they show that this can be satisfied if δ, the accuracy guarantee of the linear system solver, is taken to be an inverse polynomial in n. Thus their algorithm is dominated by the second step (the applications of L+ δ ) and takes time O(tf m log n + sf m log3 n log(1/ǫ)). 8 The following lemma shows that in fact it is enough to take δ to be a constant. Furthermore, our proof significantly simplifies the corresponding analysis of [14]. Lemma 4.1 For a given ǫ, if L satisfies (1 − δ)L (cid:22) L (cid:22) (1 + δ)L where δ = ǫ/8, then the approximate effective resistance values RG(u, v) = kW 1/2B L+(χu − χv)k2 satisfy: (1 − ǫ)RG(u, v) ≤ RG(u, v) ≤ (1 + ǫ)RG(u, v). Proof. We only show the first half of the inequality, as the other half follows similarly. Since L and L have the same null space, by (3.1) the given condition is equivalent to: Since 1 1+δ L+ (cid:22) L+, we have 1 1 + δ L+ (cid:22) L+ (cid:22) 1 1 − δ L. RG(u, v) = (χu − χv)T L+(χu − χv) ≤ (1 + δ)(χu − χv)T L+(χu − χv) = (1 + δ)(χu − χv)T L+ L L+(χu − χv). Applying the fact that L (cid:22) (1 + δ)L to the vector L+(χu − χv) in turn gives: RG(u, v) ≤ (1 + δ)2(χu − χv)T L+L L+(χu − χv) = (1 + δ)2kW 1/2B L+(χu − χv)k2 = (1 + δ)2 RG(u, v) The rest of the proof follows from 1 (1+δ)2 ≤ 1 − ǫ/4 by choice of δ. (cid:3) This proves our first theorem. Theorem 4.2 There is a 1 ± ǫ sparsification algorithm that runs in O(tf m log n + sf m log2 n log(1/ǫ)) time. 5 The O(tf m log n) time algorithm Informally, the oversampling Theorem 3.5 states that if we use estimates to the effective resistances, rather than the true values, the Spielman-Srivastava scheme still works; but in order to produce the sparsifier we have to compensate by taking more samples. We exploit this in our second Theorem. Theorem 5.1 There is a (1± ǫ)-sparsification algorithm that runs in O(tf m log n + m log n log(1/ǫ)) time and returns a sparsifier with O(sf n log3 n/ǫ2) edges. As a result, we can compute an (1± ǫ)-sparsifier with O(n log n/ǫ2) edges in O(tf m log n + m log n log(1/ǫ) + s2 f n log5 n/ǫ2) time. Proof. Given the input graph G we construct a spine-heavy graph H that O(sf log2 n)-approximates G. The construction can be done in O(tf m log n) time, by Lemma 3.3. We then run the Spielman-Srivastava scheme (Section 4) on H to approximate the effective resistances RH(i, j) within a factor of 1 ± ǫ. Step 2 of the Spielman-Srivastava scheme runs in O(m log n log(1/ǫ)) time on H, by Lemma 3.4. We adjust the approximate effective resistances in H down by a factor of 1 + ǫ to accommodate for the upper side of the error in Lemma 4.1. Then, by (3.2) the calculated approximate effective resistances satisfy 1 O(sf log2 n) RG(i, j) ≤ RH(i, j) ≤ RG(i, j). 9 So Theorem 3.5 applies if we take p′ e = O(sf log2 n)we RH(i, j). We have X e e = O(sf log2 n) X p′ e we RH(i, j) ≤ O(sf log2 n) X e weRG(i, j) = O(sf n log2 n). The last equality follows from the fact that Pe weRG(i, j) = n−1 for any graph G (e.g. see [14]). Hence the total number of samples we need to take in order to produce an (1 ± ǫ)-sparsifier is O(sf n log3 n/ǫ2). The second sparsifier is computed by re-sparsifying with the general case algorithm (and appropriate settings for ǫ). (cid:3) 6 The fastest algorithms 6.1 A near-linear stretch tree in O(m) time The first problem in trying to accelerate the algorithm of the previous Section lies in the computation of the low-stretch tree; known algorithms for the task take time at least O(m log n). To work around this problem we will trade-off stretch for time. In the remainder of this subsection we show that we can in O(m) time f m log3 n). produce a spanning tree with a slightly weaker stretch guarantee, namely stretchT (G) = O(s2 The construction goes through the computation of incremental cut sparsifiers, which may be of independent interest. A cut-based characterization of stretch. We start by giving a simple alternative characterization of the stretch of a graph over a tree; for this we will need some notation. Let G = (V, EG) be a graph and T = (V, ET ) be a spanning tree of G. Every edge e ∈ ET defines in the obvious way a partition of V into two sets Ve and V − Ve. Indeed, removing the edge disconnects the tree, and the partition is formed by the vertices in the two connected components; we arbitrarily let Ve be the vertices in one of them. Let capG(Ve, V − Ve) be the total weight of the edges in G with endpoints in Ve and V − Ve. We have stretchT (G) = X e∈ET w−1 e capG(Ve, V − Ve). (6.5) To see why, let us go back to the definition of stretchT (G) given in Section 3. We have stretchT (G) = X e′∈EG we′ X e∈pT (e) w−1 e , where pT (e) is the unique path in T between the two endpoints of e. It is then clear that stretchT (G) is a sum of terms of the form we′w−1 for e′ ∈ EG and e ∈ ET . Instead of grouping the terms with respect to e′ ∈ EG as is customary in the above definition, we group them with respect to e ∈ ET . It can be seen that for any fixed e ∈ ET , the term w−1 appears as a factor multiplying we′ for each edge e′ ∈ EG that has its two endpoints in Ve and V − Ve, precisely when pT (e′) has to use e. This directly gives us the alternative characterization in Equation 6.5. e e Incremental cut sparsifiers. Inspired by the incremental spectral sparsifiers of [12], we give an analogous construction of incremental cut sparsifiers, i.e. sparsifiers that approximately preserve cuts but are only mildly sparser relative to the input graph. We will say that a graph H is a τ -cut approximation of G if for all S ⊆ V we have τ · capH(S, V − S) > capG(S, V − S). We claim the following Lemma. Lemma 6.1 There is an O(t2 The graph H can be computed in O(m) time with high probability. f log3 n)-cut approximation H of a graph G with O(m/(tf log n) + n) edges. 10 The algorithm and its proof is based on Karger’s earlier work on cut sparsification [8]. Before we proceed with it, we review necessary definitions and a Lemma from [8]. In the following context graphs are allowed to have multiple edges. A graph is k-connected if the value of each cut in G is at least k. A k-strong component is a k-connected vertex induced subgraph of a graph. The strong connectivity of an edge e, denoted ke, is the maximum value of k such that a k-strong component contains e. Finally, a graph G is said to be c-smooth if for every edge e, ke ≥ cwe. Now let G(p) be the subgraph of G resulting by keeping each edge of G with probability p. Lemma 6.2 [8] Let G be a c-smooth graph. Let p = ρǫ/c where ρǫ = O(log n/ǫ2). Then with high probability every cut in G(p) has a value in the range (1 ± ǫ) times its expectation (which is p times its original value). We now proceed with the algorithm and its proof. Proof. (of Lemma 6.1) We can assume without loss of generality that the edge weights in G are integers. We first find a max-weight spanning tree T of G; since the weights are integer this can be done in O(m) time. We then form an intermediate graph G′ by multiplying the weight of every edge in T by ⌈tf log2 n⌉; let T ′ be T with the scaled up weights. Consider now an edge e in G′ which is not in T ′. Let pT ′(e) be the path connecting the endpoints of e in T ′. Because T is a maximum-weight spanning tree in G every edge along pT (e) has weight at least we in G. Therefore the subgraph of G′ induced by the vertices in pT ′(e) is (we⌈tf log2 n⌉)-strong. Therefore the connectivity ke satisfies ke ≥ (⌈tf log2 n⌉)we. In order to be able to apply Lemma 6.2 we will modify G′ to be a multigraph, by viewing each e ∈ T ′ as ⌈tf log2 n⌉ parallel edges of weight we. Under this definition, the connectivity of each such parallel edge e′ trivially satisfies ke′ ≥ (⌈tf log2 n⌉)we. The same holds for all other edges of G′ as shown above. It follows that the multi-graph G′ is O(tf log2 n)-soft. We can now apply Lemma 6.2, setting ǫ = 1/2 to form G(p) for p = O(1/(tf log n)). We get that (2/3)G(p) is an O(tf log n)-cut approximation for G′. By an easy transitivity argument, the graph H = f log3 n)-cut approximation of G. The claim about the number of edges 2G(p)/(3⌈tf log2 n⌉) is then an O(t2 of H follows by application of Chernoff’s inequality. (cid:3) Computing a low-stretch tree faster. We conclude this subsection with the main Lemma. Lemma 6.3 Given a graph G, a spanning tree T such that stretchT (G) = O(t2 in O(m) time. f m log3 n) can be computed Proof. We first produce in O(m) time the graph H of Lemma 6.1. We then apply the low-stretch algorithm of [1] on graph H to get a spanning tree T ′ of H; given the number of edges in H this step takes O(m) time as well, while T ′ satisfies stretchT ′(H) = O(m). Notice now that the edge weights in H are by definition smaller than those in G. Therefore, the corresponding tree T in G (i.e. the tree with the original weights) satisfies stretchT (H) = O(m). Given the number of edges in H the low-stretch algorithm runs in O(m) time. Then using the definition 11 of cut approximation, and equation 6.5 we get that stretchT (G) = X e∈ET w−1 e capG(Ve, V − Ve). ≤ O(t2 = O(t2 = O(t2 f log3 n) X e∈ET w−1 e capH (Ve, V − Ve) f log3 n) · stretchT (H) f m log3 n). (cid:3) 6.2 Leveraging an approximate sparsifier The purpose of this section is to show that if we are given an approximate sparsifier for a graph G we can efficiently produce a sparsifier for G. So far we have been using only low-stretch subgraphs of G to get approximations to the effective resistances in G. A key to our fastest algorithm is the realization that we can find low-stretch trees that are not necessarily subgraphs of the given graph G; the total stretch will actually be only a near-linear function of n. This is based on the following Lemma. Lemma 6.4 Let H ′ (cid:22) H. Then for any tree T stretchT (H ′) ≤ stretchT (H). Proof. Let A+ denote the Moore-Penrose pseudoinverse of a matrix A and λi(A) denote the ith largest eigenvalue of A. By Spielman and Woo [17] we know that for any graph G stretchT (G) = trace(LGL+ T ) = X i λi(LGL+ T ) Because LG and LT have the same null space (the constant vector), we can write λi(LGL+ T ) = λi(L+/2 T LGL+/2 T ). Notice now that we have H ′ (cid:22) H ⇒ (L+/2 T LH ′L+/2 T ) (cid:22) (L+/2 T LHL+/2 T ). This follows easily by definition. It is also easy to prove (see for example [10], Ch. 6.1) that A (cid:22) B ⇒ λi(A) ≤ λi(B). Hence (cid:3) λi(L+/2 trace(L+/2 ) ≤ λi(L+/2 T LH ′L+/2 ) ≤ trace(L+/2 T LH ′L+/2 stretchT (H ′) ≤ stretchT (H). T LHL+/2 ) ⇒ T LHL+/2 T T T T ) ⇒ We are now ready to prove the main Lemma in this subsection. To avoid confusion we will use mH to denote the number of edges of a graph H. 12 Lemma 6.5 (Leveraging) Let H ′ be a κ-approximation of H. Suppose we are given H ′, a 4-approximation of H ′ with O(n log n) edges. Then we can construct an (1 ± ǫ)-approximation of H with O(sf κn log3 n/ǫ2) edges in O(mH + tf n log2 n) time. We can also construct am (1 ± ǫ)-sparsifier of H with O(n log n/ǫ2) edges in O(mH + s2 f κn log5 n/ǫ2) time. Proof. We compute a low-stretch spanning tree T of H ′ in O(tf n log2 n) time. Because H ′ has O(n log n) edges we have stretchT ( H ′) = O(sf n log2 n). We then compute in O(mH) time the effective resistance RT (e) of each edge e of H over T . This can be done in O(mH ) time using off-line LCA algorithms by Gabow and Tarjan [18, 6]. Since H ′ (cid:22) 4H ′ and H ′ (cid:22) H we can apply (3.2) twice and get By Rayleigh’s monotonicity theorem (e.g. see [12]) we get that: RH(e) ≤ RH ′ (e) ≤ 4R H ′ (e). H ′ R (e) ≤ RT (e). e = 4weRT (e) in Theorem 3.5 allows us to sparsify H. To get a (1 ± ǫ)-approximation of Hence setting p′ H, the number of samples we need to take is O(q log q/ǫ2) where q = Pe 4weRT (e) = 4stretchT (H). Since H ′ (cid:22) H ′ and H (cid:22) κH ′, we apply Lemma 6.4 twice and we get that stretchT (H) ≤ κ · stretchT (H ′) ≤ κ · stretchT ( H ′) = O(sf κn log2 n). This proves the first claim. The second claim follows via picking the appropriate ǫ and re-sparsifying the first sparsifier with the general case sparsification algorithm. (cid:3) 6.3 The O(m) and O(m log log n) time algorithms We are now ready to prove our main claims. Theorem 6.6 Given a graph G we can compute an (1± ǫ)-spectral sparsifier of G with O(n log n/ǫ2) edges in O(m + t2 f n log10 n/ǫ2) time. f s3 Proof. Let T be the spanning tree of G provided by Lemma 6.3. Let H and I be the two graphs from f sf log5 n). We use our algorithm from the application of Theorem 3.6 on G with respect to T and κ = O(t2 Theorem 5.1 to sparsify I and by transitivity we get a 4-approximation H ′ of H with O(n log n) edges in f sf log5 n)-approximation of G we can ‘leverage’ its sparsifier O(m + s2 f n log10 n/ǫ2) H ′ to compute a (1± ǫ)-sparsifier of G via Lemma 6.5 (with κ = O(t2 time. f n log5 n) time. Because H is an O(t2 f sf log5 n)) in O(m + t2 f s3 (cid:3) Theorem 6.7 Given an unweighted graph G we can compute an (1 ± ǫ)-spectral sparsifier of G with O(n log n/ǫ2) edges in O(m + s3 f n log8 n/ǫ2) time. Proof. Let S be an O(log n)-spanner of G, as discussed in Section 3.6. Such an S with O(n) edges can be computed in O(m) time [7]. Let H and I be the two graphs from the application of Theorem 3.6 on G with respect to S and κ = O(sf log3 n). We then use our algorithm from Theorem 5.1 to sparsify I and by f n log5 n) time. Because transitivity we get a 4-approximation H ′ of H with O(n log n) edges in O(m + s3 H is an O(sf log3 n)-approximation of G we can ‘leverage’ its sparsifier H ′ to compute a (1 ± ǫ)-sparsifier of G via Lemma 6.5 (with κ = O(sf log3 n)) in O(m + s3 f n log8 n/ǫ2) time. (cid:3) 13 Theorem 6.8 Given a graph G we can compute an (1± ǫ)-spectral sparsifier of G with O(n log n/ǫ2) edges in O((m + s2 f n log5 n/ǫ2) log log n) time. Proof. Let T be the spanning tree of G provided by Lemma 6.3. Let H = G + O(t2 f sf log5 n)T . We construct a sequence of graphs, H = H0, H1, . . . , Ht = G f sf log5 n)T /2i, for i = 1 . . . , t − 1 with some appropriate t = O(log log n). Notice where Hi = G + O(t2 that all graphs Hi have m edges, so this takes O(m log log n) time. For i = 0, . . . , t − 1, let Hi denote It is clear that H0 can be computed in O(m) time. a 4-approximation of Hi with O(n log n) edges. Provided now that we have Hj we can apply Lemma 6.5 (with κ = 2, ǫ = 1/2 and a proper scaling of the (1 ± ǫ)-sparsifier) to get a 4-approximation Hj+1 in O(m + s2 f n log5 n) time. From Ht−1 we produce a (1 ± ǫ)-sparsifier of Ht = G again by Lemma 6.5, using the desired value for ǫ. Because we apply the algorithm of Lemma 6.5 O(log log n) times, we get the claimed running time. (cid:3) 7 Final Remarks The original algorithm of Spielman and Teng remains the only known combinatorial sparsification algorithm that does not rely on solving systems. Designing a spectral sparsification algorithm that does not depend on a linear system solver and that outputs a very sparse graph with O(n log n) or O(n log2 n) edges is a challenging open problem. Since achieving this may prove to be difficult, an alternate approach could be algorithms that compute very sparse κ-approximations for small values of κ. Such algorithms could play a significant role in the development of more practical SDD solvers. 8 Acknowledgments We would like to thank Jonathan Kelner and Gary Miller for useful discussions and the anonymous referees for carefully reading an earlier version of this paper. Ioannis Koutis is supported by NSF CAREER award CCF-1149048. Alex Levin is supported by a National Science Foundation graduate fellowship. Richard Peng was at Microsoft Research New England for part of this work and is supported by a Microsoft Research Fellowship. He is also partially supported by the National Science Foundation under grant number CCF-1018463. References [1] Ittai Abraham and Ofer Neiman. Using petal-decompositions to build a low stretch spanning tree. In Howard J. Karloff and Toniann Pitassi, editors, STOC, pages 395–406. ACM, 2012. [2] Dimitris Achlioptas. Database-friendly random projections. In PODS ’01: Proceedings of the Twenti- eth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, pages 274–281, 2001. [3] Andr´as A. Bencz´ur and David R. Karger. Approximating s-t minimum cuts in O(n2) time. In STOC ’96: Proceedings of the Twenty-Eighth Annual ACM symposium on Theory of Computing, pages 47–55, 1996. [4] Fan Chung. Random walks and local cuts in graphs. Linear Algebra and its applications, 423(1):22–32, 2007. [5] Wai Shing Fung, Ramesh Hariharan, Nicholas J. A. Harvey, and Debmalya Panigrahi. A general In STOC ’11: Proceedings of the 43rd ACM Symposium on framework for graph sparsification. Theory of Computing, pages 71–80, 2011. 14 [6] Harold N. Gabow and Robert Endre Tarjan. A linear-time algorithm for a special case of disjoint set union. In Proceedings of the fifteenth annual ACM symposium on Theory of computing, STOC ’83, pages 246–251, New York, NY, USA, 1983. ACM. [7] Eran Halperin and Uri Zwick. Linear time deterministic algorithm for computing spanners for un- weighted graphs. 1996. manuscript. [8] David R. Karger. Better random sampling algorithms for flows in undirected graphs. In Proceed- ings of the ninth annual ACM-SIAM symposium on Discrete algorithms, SODA ’98, pages 490–499, Philadelphia, PA, USA, 1998. Society for Industrial and Applied Mathematics. [9] JonathanA. Kelner and Alex Levin. Spectral sparsification in the semi-streaming setting. Theory of Computing Systems, 53(2):243–262, 2013. [10] Ioannis Koutis. Combinatorial and algebraic tools for optimal multilevel algorithms. PhD thesis, Carnegie Mellon University, Pittsburgh, May 2007. CMU CS Tech Report CMU-CS-07-131. [11] Ioannis Koutis, Alex Levin, and Richard Peng. Improved spectral sparsification and numerical algo- rithms for sdd matrices. In 29th International Symposium on Theoretical Aspects of Computer Science, STACS, pages 266–277, 2012. [12] Ioannis Koutis, Gary L. Miller, and Richard Peng. Approaching optimality for solving SDD systems. In FOCS ’10: Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science, 2010. [13] Ioannis Koutis, Gary L. Miller, and Richard Peng. A nearly-m log n solver for SDD linear systems. In FOCS ’11: Proceedings of the 52nd Annual IEEE Symposium on Foundations of Computer Science, 2011. [14] Daniel A. Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. In STOC ’08: Proceedings of the 40th Annual ACM symposium on Theory of Computing, pages 563–568, 2008. [15] Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In STOC ’04: Proceedings of the 36th Annual ACM Sym- posium on Theory of Computing, pages 81–90, 2004. [16] Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for preconditioning and solving symmetric, diagonally dominant linear systems. CoRR, abs/cs/0607105, 2006. [17] Daniel A. Spielman and Jaeoh Woo. A note on preconditioning by low-stretch spanning trees. CoRR, abs/0903.2816, 2009. [18] Robert Endre Tarjan. Applications of path compression on balanced trees. J. ACM, 26(4):690–715, 1979. 15
1801.06216
1
1801
2018-01-18T19:57:39
Degree-constrained 2-partitions of graphs
[ "cs.DS", "math.CO" ]
A $(\delta\geq k_1,\delta\geq k_2)$-partition of a graph $G$ is a vertex-partition $(V_1,V_2)$ of $G$ satisfying that $\delta(G[V_i])\geq k_i$ for $i=1,2$. We determine, for all positive integers $k_1,k_2$, the complexity of deciding whether a given graph has a $(\delta\geq k_1,\delta\geq k_2)$-partition. We also address the problem of finding a function $g(k_1,k_2)$ such that the $(\delta\geq k_1,\delta\geq k_2)$-partition problem is ${\cal NP}$-complete for the class of graphs of minimum degree less than $g(k_1,k_2)$ and polynomial for all graphs with minimum degree at least $g(k_1,k_2)$. We prove that $g(1,k)=k$ for $k\ge 3$, that $g(2,2)=3$ and that $g(2,3)$, if it exists, has value 4 or 5.
cs.DS
cs
Degree-constrained 2-partitions of graphs J. Bang-Jensen∗ St´ephane Bessy† July 27, 2021 Abstract A (δ ≥ k1, δ ≥ k2)-partition of a graph G is a vertex-partition (V1, V2) of G satisfying that δ(G[Vi]) ≥ ki for i = 1, 2. We determine, for all positive integers k1, k2, the complexity of deciding whether a given graph has a (δ ≥ k1, δ ≥ k2)-partition. We also address the problem of finding a function g(k1, k2) such that the (δ ≥ k1, δ ≥ k2)-partition problem is NP-complete for the class of graphs of minimum degree less than g(k1, k2) and poly- nomial for all graphs with minimum degree at least g(k1, k2). We prove that g(1, k) = k for k ≥ 3, that g(2, 2) = 3 and that g(2, 3), if it exists, has value 4 or 5. Keywords: NP-complete, polynomial, 2-partition, minimum degree. Introduction 1 A 2-partition of a graph G is a partition of V (G) into two disjoint sets. Let P1, P2 be two graph properties, then a (P1, P2)-partition of a graph G is a 2-partition (V1, V2) where V1 induces a graph with property P1 and V2 a graph with property P2. For example a (δ ≥ k1, δ ≥ k2)-partition of a graph G is a 2-partition (V1, V2) where δ(G[Vi]) ≥ ki, for i = 1, 2 There are many papers dealing with vertex-partition problems on (di)graphs. Examples (from a long list) are [1, 2, 4, 6, 7, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 28, 29, 30, 31, 33, 34]. Examples of 2-partition problems are recognizing bipartite graphs (those having has a 2-partition into two independent sets) and split graphs (those having a 2-partition into a clique and an independent set) [15]. It is well known and easy to show that there are linear algorithms for deciding whether a graph is bipartite, respectively, a split graph. It is an easy exercise to show that every graph G has a 2-partition (V1, V2) such that the degree of each vertex in G[Vi], i ∈ [2] is at most half of its original degree. Furthermore such a partition can be found efficiently by a greedy algorithm. In [16, 17] and several other papers the opposite condition for a 2-partition was studied. Here we require the that each vertex has at least half of its neighbours inside the set it belongs to in the partition. This problem, known as the satisfactory partition problem, is NP-complete for general graphs [5]. A partition problem that has received particular attention is that of finding sufficient conditions for a graph to possess a (δ ≥ k1, δ ≥ k2)-partition. Thomassen [31] proved the existence of a function f (k1, k2) so that every graph of minimum degree at least f (k1, k2) has a (δ ≥ k1, δ ≥ k2)-partition. He proved that f (k1, k2) ≤ 12 · max{k1, k2}. This was later improved by Hajnal [19] and Haggkvist (see [31]). Thomassen [31, 32] asked whether it would hold that f (k1, k2) = k1 + k2 + 1 which would be best possible because of the complete graph Kk1+k2+1. Stiebitz [29] proved that indeed we have f (k1, k2) = k1 + k2 + 1. Since this result was published, several groups of researchers have tried to find extra conditions on the graph that would allow for a smaller minimum degree requirement. Among others the following results were obtained. Theorem 1.1 [20] For all integers k1, k2 ≥ 1 every triangle-free graph G with δ(G) ≥ k1 + k2 has a (δ ≥ k1, δ ≥ k2)-partition. ∗Department of Mathematics and Computer Science, University of Southern Denmark, Odense DK-5230, Denmark (email:[email protected]). This work was done while the first author was visiting LIRMM, Universit´e de Montpellier, France. Hospitality is gratefully acknowledged. The research of Bang-Jensen was supported by the Danish research council under grant number 7014-00037B. †LIRMM, Universit´e de Montpellier, France (email: [email protected]). 1 Theorem 1.2 [26] For all integers k1, k2 ≥ 2 every graph G with no 4-cycle and with δ(G) ≥ k1+k2−1 has a (δ ≥ k1, δ ≥ k2)-partition. Theorem 1.3 [23] • For all integers k1, k2 ≥ 1, except for K3, every graph G with no K4 − e and with δ(G) ≥ k1 + k2 has a (δ ≥ k1, δ ≥ k2)-partition. • For all integers k1, k2 ≥ 2 every triangle-free graph G in which no two 4-cycles share an edge and with δ(G) ≥ k1 + k2 − 1 has a (δ ≥ k1, δ ≥ k2)-partition. The original proof that f (k1, k2) = k1 + k2 + 1 in [29] is not constructive and neither are those of Theorems 1.2 and 1.3. In [7] Bazgan et al. gave a polynomial algorithm for constructing a (δ ≥ k1, δ ≥ k2)-partition of a graph with minimum degree at least k1 + k2 + 1 or at least k1 + k2 when the input is triangle-free. The main result of this paper is a full characterization of the complexity of the (δ ≥ k1, δ ≥ k2)- partition problem. Theorem 1.4 Let k1, k2 ≥ 1 with k1 ≤ k2 be integers. When k1 + k2 ≤ 3 it is polynomial to decide whether a graph has a 2-partition (V1, V2) such that δ(G[Vi]) ≥ ki for i = 1, 2. For all other values of k1, k2 it is NP-complete to decide the existence of such a partition. A result in [13] implies that (δ ≥ 3, δ ≥ 3)-partition is NP-complete already for 4-regular graphs and there are other results about the complexity of finding partitions with lower and/or upper bounds on the degrees inside each partition, such as [5, 6, 16, 17, 34], but we did not find anything which implies Theorem 1.4. The result of Stiebitz [29] insures that if the minimum degree of the input graph is large enough, at least k1 + k2 + 1, then the (δ ≥ k1, δ ≥ k2)-partition always exists. We conjecture that if this minimum degree is large but less than k1 + k2 + 1 then the (δ ≥ k1, δ ≥ k2)-partition is not always trivial but can be solved in polynomial time. Conjecture 1.5 There exists a function g(k1, k2) so that for all 1 ≤ k1 ≤ k2 with k1 + k2 ≥ 3 the (δ ≥ k1, δ ≥ k2)-partition problem is NP-complete for the class of graphs of minimum degree less than g(k1, k2) and polynomial for all graphs with minimum degree at least g(k1, k2). In the next section we introduce notions and tools that will be used later. In Section 3 we give the proof of Theorem 1.4 and in Section 4 we provide some partial results concerning Conjecture 1.5. In particular we prove that g(1, k) = k for k ≥ 3, that g(2, 2) = 3 and that g(2, 3), if it exists, has value 4 or 5. Finally in Section 5 we address some other partition problems mainly dealing with (edge-)connectivity in each part of the partition. Notice that regarding the results that we establish in this paper the first open case of Conjecture 1.5 is the following problem. Problem 1.6 What is the complexity of the (δ ≥ 2, δ ≥ 3)-partition problem for graphs of minimum degree 4? 2 Notation, definitions and preliminary results Notation is standard and follows [3, 12]. In this paper graphs have no parallel edges and no loops. We use the shorthand notation [k] for the set {1, 2, . . . , k}. 2.1 Special Graphs We first define some graphs that will be used frequently in our proofs to ensure that certain vertices have a sufficiently high degree. For all k ≥ 3 we let Xk,2 be the graph we obtain from Kk+1 by subdividing one edge by a vertex x. Let X3,1 be obtained from X3,2 by adding a vertex x(cid:48) adjacent to the degree 2 vertex x of X3,2. 2 Let Y4,1 be the graph on 7 vertices which we obtain from a 5-wheel by adding a new edge e linking 2 non adjacent vertices of the outer cycle of the 5-wheel, a new vertex joined to the 3 vertices of this outer cycle not incident to e and to another new vertex y. For k = 3 let Zk be the graph X3,1 that we defined above and let z = x(cid:48). For k ≥ 4 let Zk be the graph that we obtain from Kk−2,k−1 by adding a cycle on the k − 1 vertices of degree k − 2 and then adding a new vertex z adjacent to all the k − 2 vertices of degree k − 1. And finally let Wk be the graph we obtain from Kk+1 by deleting one edge u(cid:48)v(cid:48) and the adding two new vertices u, v and the edges uu(cid:48), vv(cid:48). All these graphs are depicted in Figure 1. y z Y4,1 X3,2 x x k − 2 vertices x(cid:48) X3,1 u u(cid:48) v v(cid:48) Zk Kk+1 Xk,2 Kk+1 Wk k − 1 vertices Figure 1: The graphs Y4,1, X3,2, X3,1, Zk, Xk,2 and Wk. 2.2 Connected instances of 3-SAT For a given instance F of 3-SAT with clauses C1, C2, . . . , Cm and variables x1, . . . , xn, where each variable xi occurs at least once as the literal xi and at least once as ¯xi, we define the bipartite graph B(F) as the graph with vertex set {v1, ¯v1, v2, ¯v2, . . . , vn, ¯vn} ∪ {c1, c2, . . . , cm}, where the first set corresponds to the literals and the second one to the clauses, and edge set containing an edge between the vertex cj and each of the 3 vertices corresponding to the literals of Cj for every j ∈ [m]. We say that F is a connected instance if B(F) is connected. Lemma 2.1 3-SAT is NP-complete for instances F where B(F) is connected Proof: Suppose B(F) has connected components X1, X2, . . . , Xk, where k ≥ 2. Fix a literal vertex (cid:96)i ∈ Xi for each i ∈ [k], add a new variable y and k − 1 new clauses C(cid:48) k−1 where j = ((cid:96)j−1 ∨ y ∨ (cid:96)j), j ∈ [k − 1]. Let F(cid:48) be the new formula obtained by adding the variable y and the C(cid:48) (cid:5) clauses C(cid:48) By adding a few extra variables, if necessary, we can also obtain an equivalent connected instance k−1. It is easy to check that F(cid:48) is equivalent to F and that B(F(cid:48)) is connected. 1, . . . , C(cid:48) 1, . . . , C(cid:48) in which each literal occurs at least twice. We leave the easy details to the interested reader. 2.3 Ring graphs and 3-SAT We first introduce an important class of graphs that will play a central role in our proofs. The directed analogue of these graphs was used in [2, 4]. A ring graph is the graph that one obtains by taking two or more copies of the complete bipartite graph on 4 vertices {a1, a2, b1, b2} and edges {a1b1, a1b2, a2b1, a2b2} and joining these in a circular manner by adding a path Pi,1 from the vertex 3 bi,1 to ai+1,1 and a path Pi,2 from bi,2 to ai+1,2 where bi,1 is the ith copy of b1 etc and indices are 'modulo' n (bn+1,j = b1,j for j ∈ [2] etc). Our proofs are all reductions from NP-complete variants of the 3-SAT problems. We call the copies of {a1b1, a1b2, a2b1, a2b2} switch vertices. We start by showing how we can associate a ring graph to a given 3-SAT formula. Let F = C1 ∧ C2 ∧ . . . ∧ Cm be an instance of 3-SAT consisting on m clauses C1, . . . , Cm over the same set of n boolean variables x1, . . . , xn. Each clause Ci is of the form Ci = ((cid:96)i,1 ∨ (cid:96)i,2 ∨ (cid:96)i,3) where each (cid:96)i,j belongs to {x1, x2, . . . , xn, ¯x1, ¯x2, . . . , ¯xn} and ¯xi is the negation of variable xi. By adding extra clauses to obtain an equivalent formula, if necessary, we can ensure that every literal occurs at least twice in F. We shall use this fact in one of our proofs. For each variable xi the ordering of the clauses above induces an ordering of the occurrences of xi, resp ¯xi, in the clauses. Let qi (resp. pi) denote the number of times xi (resp. ¯xi) occurs in the clauses Let R(F) = (V, E) be the ring graph defined as follows. Its vertex set is V = {a1,1, . . . an,1, a1,2 . . . , an,2} ∪ {b1,1, . . . , bn,1, b1,2, . . . , bn,2} ∪ n(cid:91) • (cid:83)n i=1{ai,1bi,1, ai,1bi,2, ai,2bi,1, ai,2bi,2} Its edge set E consists of the following edges: i=1 {vi,1, . . . , vi,qi, v(cid:48) i,1, . . . , v(cid:48) i,pi } • the edges of the paths Pi,1, Pi,2, i ∈ [n] where Pi,1 = bi,1vi,1 . . . vi,qiai+1,1 and Pi,2 = bi,2v(cid:48) i,1 . . . v(cid:48) ai+1,2. i,pi For 1 ≤ j ≤ m, we associate the clause Cj = ((cid:96)j,1 ∨ (cid:96)j,2 ∨ (cid:96)j,3) with the set Oj consisting of three vertices of R(F) representing the occurrences of the literals of Cj in F: if (cid:96)j,1 = xi for some i ∈ [n] and this is the r'th occurrence of xi in the clauses, then Oj contains the vertex vi,r. If (cid:96)j,1 = ¯xi for some i ∈ [n] and this is the r'th occurrence of ¯xi in the clauses, then Oj contains the vertex v(cid:48) i,r. The other two vertices of Oj are defined similarly. In our proofs below we will often add a vertex ci adjacent to all the vertices of Oi for i ∈ [n]. An example is depicted in Figure 2. b1,1 a1,1 v1,1 v4,2 v1,2 v(cid:48) 1,1 b1,2 a1,2 v(cid:48) 4,1 v4,1 a2,1 b2,1 a2,2 b2,2 v2,1 v(cid:48) 2,1 c1 c2 c4 c3 a3,2 b3,2 a3,1 b3,1 v(cid:48) 3,1 v(cid:48) 3,2 v(cid:48) 3,3 v3,1 b4,2 a4,2 b4,1 a4,1 Figure 2: The ring graph R(F) corresponding to the formula F = (x1 ∨ x4 ∨ ¯x3) ∧ (x1 ∨ ¯x2 ∨ ¯x3) ∧ (x2 ∨ ¯x3 ∨ x4) ∧ (¯x1 ∨ x3 ∨ ¯x4). The grey boxes contain the switch vertices, the white vertices are the variable vertices and we added the clauses vertices c1, c2, c3 and c4 (these are not part of the ring graph R(F)). 4 The following observation which forms the base of many of our proofs is easy to prove (for a proof of result a very similar to this see [4]). Theorem 2.2 Let F be a 3-SAT formula and let R(F) be the corresponding ring graph. Then R = R(F) contains a cycle C which intersects all the sets O1, . . . , Om so that R − C is a cycle C(cid:48) if and only if F is a 'Yes'-instance of 3-SAT. 3 Proof of Theorem 1.4 3.1 The case k1 + k2 ≤ 3 We start with a trivial observation. Proposition 3.1 Every graph G with δ(G) ≥ 1 and at least 4 vertices has a (δ ≥ 1, δ ≥ 1)-partition except if G is a star. Proposition 3.2 There is a polynomial algorithm for testing whether a graph has a (δ ≥ 1, δ ≥ 2)- partition Proof: We try for every choice of adjacent vertices u, v whether there is a solution with u, v ∈ V1. Clearly G is a 'yes'-instance if and only if at least one of these O(n2) attempts will succeed. Hence by starting with V1 = {u, v} and then moving vertices with at most one neighbour in V − V1 to V1 we either end with a good partition or V1 = V in which case no partition exists for that choice {u, v}. (cid:5) 3.2 The case k1 = 1 and k2 ≥ 3 The following variant of satisfiability, which we call ≤ 3-SAT(3), is known to be NP-complete: Given a boolean CNF formula F consisting of clauses C1, C2, . . . , Cm over variables x1, x2, . . . , xn such that each clause has 2 or 3 literals, no variable occurs in more than 3 clauses and no literal appears more than twice; decide whether F can be satisfied. As we could not find a proper reference for a proof that ≤ 3-SAT(3) is NP-complete, we give one here as it is presented on pages 281-283 in a set of course notes1 by Prof. Yuh-Dauh Lyuu, National Taiwan University: Assume that F is an instance of 3-SAT in which the variable x occurs a total of r ≥ 4 times in the formula (as x or ¯x) in clauses Ci1, . . . , Cir . Introduce new variables x1, . . . , xr and replace the first occurrence of x (in Ci1) by x1 is x is not negated in Ci1 and otherwise replace it by ¯x1 in Ci1 . Similarly we replace the occurrence of x in Cij , j ≥ 2 by xj or ¯xj. Finally we add the new clauses (¯x1 ∨ x2) ∧ (¯x2 ∨ x3) ∧ . . . ∧ (¯xr ∨ x1). These clauses (which have size 2) will force all the variables x1, . . . , xr to take the same value under any satisfying truth assignment. Repeating this replacement for all variables of the original formula F we obtain an equivalent instance F(cid:48) of ≤ 3-SAT(3). Below we will need another variant which we call ≤ 3-SAT(5) where clauses still have size 2 or 3 and each variable is allowed to occur at most 5 times and at most 3 times as the same literal. By following the scheme above and for each original variable occurring at least 4 times adding r extra clauses (x1 ∨ ¯x2) ∧ (x2 ∨ ¯x3) ∧ . . . ∧ (xr ∨ ¯x1) we obtain an equivalent instance F(cid:48)(cid:48) and because the 2r new clauses will form a cycle in the bipartite graph B(F(cid:48)(cid:48)) of F(cid:48)(cid:48) it is easy to see that F(cid:48)(cid:48) is a connected instance of ≤ 3-SAT(5) if F is a connected instance of 3-SAT. Hence, by Lemma 2.1, connected ≤ 3-SAT(5) is NP-complete. Theorem 3.3 For all k ≥ 3 it is NP-complete to decide whether a graph has a (δ ≥ 1, δ ≥ k)- partition. Proof: We show how to reduce an instance of connected ≤ 3-SAT(5) to (δ ≥ 1, δ ≥ k)-partition where k ∈ {3, 4} in polynomial time and then show how to extend the construction to higher values of k. We start the construction for k = 3. Below we will use several disjoint copies of the graphs X3,1 and X3,2 to achieve our construction. Let F be a connected instance of ≤ 3-SAT(5) with clauses C1, . . . , Cm and variables x1, . . . xn. We 1https://www.csie.ntu.edu.tw/~lyuu/complexity/2008a/20080403.pdf 5 may assume that each of the 2n literals occur at least once in F (this follows from the fact that we may assume this for any instance of normal 3-SAT and the reduction above to ≤ 3-SAT(5) preserves this property). We will construct G = G(F) as follows: • For each variable xi, i ∈ [n] we introduce three new vertices yi, vi, ¯vi and two the edges yivi, yi¯vi. • For each i ∈ [n]: if the literal xi (¯xi) occurs precisely once in F, then we identify vi (¯vi) with the vertex x in a private copy of X3,2. If xi (¯xi) occurs precisely twice, then we identify vi (¯vi) with the vertex x(cid:48) in a private copy of X3,1. • Now we add new vertices c1, . . . , cm, where ci corresponds to the clause Ci, i ∈ [m], and join each cj by an edge to those (2 or 3) vertices from {v1, . . . , vn, ¯v1, . . . , ¯vn} which correspond to its literals. If cj gets only two edges this way, we identify it with the vertex x(cid:48) in a private copy of X3,1. • Add 2m new vertices z1, z2, . . . , z2m and the edges of the 2m-cycle z1z2, z2z3, . . . , z2m−1z2m, z2mz1. • Finally we add, for each j ∈ [m] the edges cjz2j−1, cjz2j. We claim that G(F) has a (δ ≥ 1, δ ≥ 3)-partition if and only if F can be satisfied. Suppose first that t is a satisfying truth assignment. Then it is easy to check that (V1, V2) is a good 2-partition if we take V1 to be the union of {y1, . . . , yn} and the n vertices from {v1, . . . , vn, ¯v1, . . . , ¯vn} which corresponds to the false literals. Note that if a vertex vi (¯vi) is in V2 then it will have degree 3 via its private copy of one of the graphs X1, X2 or because the corresponding literal occurred 3 times in F. Conversely assume that (V1, V2) is a (δ ≥ 1, δ ≥ 3)-partition. Then we claim that we must have all the vertices z1, z2, . . . , z2m in V2: If one of these is in V1, then they all are as they have degree exactly 3. Clearly we also have {y1, . . . , yn} ⊂ V1. However, by construction, the literal and clause vertices all have degree 3 and they induce a connected graph (here we use that the instance F has a connected bipartite graph B(F)). Thus all of these vertices must be in V2, but then each vertex yi is isolated, contradiction. Hence all the vertices z1, z2, . . . , z2m are in V2 and this implies that all of c1, . . . , cm are also in V2. The vertices y1, . . . , yn are in V1 and hence, for each i ∈ [n], at least one of the vertices vi, ¯vi is also in V1. Now define a truth assignment a follows. For each i ∈ [n]: If both vi and ¯vi are in V1, or vi is in V2 we put xi true; otherwise we put xi false. Since each cj must have a neighbour from {v1, . . . , vn, ¯v1, . . . , ¯vn} in V2 this is a satisfying truth assignment. To obtain the construction for k = 4 we replace each copy of X3,1 above by a copy of Y4,1, each copy of X3,2 by a copy of X4,2 and identify each of the literal and clause vertices with the vertex y in an extra private copy of Y4,1. Finally we identify each vertex zt, t ∈ [2m] with the vertex y in a private copy of Y4,1. Now it is easy to see that we can complete the proof as we did for the case k = 3. For all k ∈ {3 + 2a, 4 + 2aa ≥ 1} we can increase the degree of all literal, clause and zj vertices by 2a by identifying these with the x vertices of a private copies of Xk,2 and repeat the proof above. (cid:5) Corollary 3.4 The (δ ≥ 1, δ ≥ k)-partition problem is NP-complete for graphs of minimum degree k − 1. Proof: Recall that in our proof above the vertices corresponding to clauses must always belong to V2 in any good partition (V1, V2) hence if we connect each vertex yi, i ∈ [n] to c1, . . . , ck−3 by edges we obtain a graph of minimum degree k − 1 which has a good partition if and only if F is satisfiable (The vertices yi, i ∈ [n] must belong to V1 as they have degree k − 1). (cid:5) 3.3 (δ ≥ k1, δ ≥ k2)-partition when 2 ≤ k1 ≤ k2 Theorem 3.5 For every choice of natural numbers 2 ≤ k1 ≤ k2 it is NP-complete to decide whether a graph has a (δ ≥ k1, δ ≥ k2)-partition. Proof: We show how to reduce 3-SAT to (δ ≥ k1, δ ≥ k2)-partition. Given an instance F of 3-SAT with clauses C1, C2, . . . , Cm and variables x1, . . . , xn we proceed as follows. Start from a copy of the ring graph R = R(F) and then add the following: 6 • If k2 ≥ 3 we identify each vertex of R with the vertex z in a private copy of Zk2. • For each i ∈ [n] add a new vertex ui and join it by edges to the vertices ai,1, ai,2. If k1 ≥ 3 we identify ui with the vertex z in a private copy of Zk1. • For each i ∈ [n] add a new vertex u(cid:48) i and join it by edges to the vertices bi,1, bi,2. If k1 ≥ 3 we identify u(cid:48) i with the vertex z in a private copy of Zk1. • For each j ∈ [m] we add a new vertex cj, identify cj with the vertex z in a private copy of Zk1 if k1 ≥ 3 and add three edges from cj to the three vertices of R which correspond to the literals of Cm. • Finally add a new vertex r and join this to all of the vertices in {u1, . . . , un, u(cid:48) n, c1, . . . , cm} via private copies of Wk1 by identifying the vertex u with r and v with the chosen vertex from {u1, . . . , un, u(cid:48) nc1, . . . , cm}. 1, . . . , u(cid:48) 1, . . . , u(cid:48) We claim that the final graph G has a (δ ≥ k1, δ ≥ k2)-partition if and only if F is satisfiable. First we make some observations about G: • Every vertex v of R which is not a switch vertex has degree exactly k2 + 1 as it has degree 2 in R(F), is adjacent to exactly one cj, j ∈ [m] and if k2 ≥ 3 then v has been identified with one vertex z of a private copy of Zk2. 1, . . . , u(cid:48) • Switch vertices all have degree exactly k2 + 2. • The vertices u1, . . . , un, u(cid:48) n have degree exactly k1 + 1. • All vertices in copies of Za have degree exactly a when a ≥ 3. • All vertices in copies of Wk1 have degree exactly k1 • All vertices cj, j ∈ [m] have degree k1 + 2. • The vertex r has degree m + 2n which we may clearly assume is at least k1. For convenience in writing, below we define Z2 to be the empty graph so that we can talk about Za's without having to condition this on a being at least 3. Suppose first that F is satisfiable. By Theorem 2.2 this means that R(F) has a cycle C which intersects the neighbourhood of each cj, j ∈ [m] and so that R− C is another cycle C(cid:48). Now we let V1 consist of the vertices of C, their corresponding private copies of Zk2, all the vertices {u1, . . . , un, u(cid:48) n, c1, . . . , cm} along with their private copies of Zk1 and finally the vertex r and the vertices of all copies of Wk1 that we used. Let V2 = V (G) − V1, that is V2 contains the vertices of C(cid:48) and their private copies of Zk2 . It is easy to check that δ(G[V1]) ≥ k1 and that δ(G[V2]) ≥ k2 so (V1, V2) is a good partition. Now assume that G has a good 2-partition n, c1, . . . , cm} via copies of (V1, V2). The way we connected r to the vertices in {u1, . . . , un, u(cid:48) Wk1 implies that these must belong to the same set Vi as r. If k1 < k2 this must be V1 and otherwise we can rename the sets so that i = 1. Since each cj, j ∈ [m] has degree k1 + 2 at least one of the vertices corresponding to a literal of Cj must belong to V1. Suppose that some vertex corresponding a literal (cid:96) is in V1, then all the vertices of the path in R corresponding to that literal, including the two end vertices which are switch vertices, must belong to V1. This follows from the fact that all n, c1, . . . , cm} ⊂ V1. these vertices have degree k2 + 1 and have a neighbour in {u1, . . . , un, u(cid:48) Moreover if ai,j (resp. bi,j) belongs to V2 then, as ai,j (resp. bi,j) has degree k2 + 2 and ui (resp. u(cid:48) i) belongs to V1, at least one of the vertices of {bi,1, bi,2} (resp. {ai,1, ai,2}) belongs to V2. And as ui i) belongs to V1, one of {ai,1, ai,2} (resp. {bi,1, bi,2}) must lie in V1. So since V2 is not empty (resp. u(cid:48) this implies that the restriction of V2 to R is a cycle consisting of paths Q1, . . . , Qn where Qi is either the path Pi,1 or the path Pi,2. Hence R[V (R) ∩ V1] is a cycle intersecting each of the neighbourhoods (cid:5) of the vertices cj, j ∈ [m] and hence F is satisfiable by Theorem 2.2. 1, . . . , u(cid:48) 1, . . . , u(cid:48) 1, . . . , u(cid:48) Combining the results of this section concludes the proof of Theorem 1.4. 7 4 Higher degrees We study the borderline between polynomial and NP-complete instances of the partition problems. That is, we try to see how close we can get to the bound k1 + k2 + 1 on the minimum degree and still have an NP-complete instance. For k1 = 1 we can give the precise answer by combining Corollary 3.4 and the result below. Proposition 4.1 There is a polynomial algorithm for checking whether a graph G of minimum degree at least k has a (δ ≥ 1, δ ≥ k)-partition. Proof: It suffices to see that we can test for a given edge uv of G whether there is a (δ ≥ 1, δ ≥ k)- partition (V1, V2) with u, v ∈ V1. This is done by starting with V1 = {u, v} and then moving vertices from V − V1 to V1 when these vertices do not have at least k neighbours in V − V1. Note that this process preserves the invariant that δ(G[V1]) ≥ 1. Hence if the process terminates before V1 = V we have found the desired partition and otherwise we proceed to the next choice for an edge to start (cid:5) from. For the (δ ≥ 2, δ ≥ 2)-partition problem we can also give the precise borderline between polynomial and NP-complete instances. Proposition 4.2 There exists a polynomial algorithm for checking whether a given graph of minimum degree at least 3 has a (δ ≥ 2, δ ≥ 2)-partition. Proof: First test whether G has two disjoint cycles C1, C2. This can be done in polynomial time [9, 25]. If no such pair exists G is a 'no'-instance, so assume that we found a pair of disjoint cycles C1, C2. Now put the vertices of C1 in V1 and continue to move vertices of V − V1 − V (C2) to V1 if they have at least two neighbours in the current V1. When this process stops the remaining set V2 = V − V1 induces a graph of minimum degree at least 2, since the vertices we did not move have (cid:5) at most one neighbour in V1. We now proceed to partitions where 2 ≤ k1 ≤ k2 and try to raise the minimum degree above k1 to see whether we can still prove NP-completeness. Theorem 4.3 For every a ≥ 3 it is NP-complete to decide whether a graph of minimum degree a + 1 has a (δ ≥ a, δ ≥ a)-partition. Proof: We give the proof for a = 3 and then explain how to extend it to larger a. Let F be an instance of 3-SAT with n variable and m clauses C1, . . . , Cm. Let R(cid:48) = R(cid:48)(F) be obtained from R(F) by adding, for all i ∈ [n], an edge between all vertices at distance 2 in one of the paths Pi,1, Pi,2, i ∈ [n] (that is, we replace each of these paths by their square). Now we construct the graph H = H(F) starting from R(cid:48) as follows: • For each j ∈ [m]: add two vertices cj,1, cj,2 and join them to the vertices in R(cid:48) which correspond to the literals of Cj. • add the vertices of a 2m -cycle y1y2 . . . y2my1. • For each j ∈ [m] add the two edges y2j−1cj,1, y2j−1cj,2 and the two edges y2jcj,2, y2j, cj+1,1, where cm+1,1 = c1,1. The resulting graph H has minimum degree 4 and we claim that H has a (δ ≥ 3, δ ≥ 3)-partition if and only if F is satisfiable, which we know, by Theorem 2.2 and the previous proofs, where we used the same approach, is if and only if the vertex set of R (which is the same as that of R(cid:48)) can be partitioned into two cycles C, C(cid:48) so that C contains a neighbour of each of the vertices cj,1, cj,2, j ∈ [m]. Again the proof is easy when F is satisfiable: Let C, C(cid:48) be as above and let V2 = V (C(cid:48)) and V1 = V (H) − V2. It is easy to check that δ(H[Vi]) ≥ 3 for i = 1, 2, because C contains a neighbour of each cj,1, cj,2, j ∈ [m] (and we assume that each literal appears at least twice in F to insure that δ(H[V2]) ≥ 3). Suppose now that H has a (δ ≥ 3, δ ≥ 3)-partition (V1, V2). Since adjacent vertices in {y1, y2, . . . , y2m} have degree 4 and share a neighbour they must all belong to the same set Vi, i ∈ [2] 8 and this set must also contain all the vertices cj,1, cj,2, j ∈ [m]. Without loss of generality we have i = 1. Thus V2 is a subset of V (R(cid:48)). The vertices of R have degree at most 4 in R(cid:48) and the initial and terminal vertex of each path Pi,1 or Pi,2 has degree 3. Using this is not difficult to see that if some vertex of a path Pi,1 or Pi,2 is in V2 then all the vertices of that path and the two adjacent switch vertices are in V2. If there is some i ∈ [n] so that both of the vertices ai,1, ai,2 or both of the vertices bi,1, bi,2 are in in V2, then, using the observation we just made, all vertices of R(cid:48) would be in V2 which is impossible. Similarly we can show that V1 cannot contain both of the vertices ai,1, ai,2 or both of the vertices bi,1, bi,2 for some i ∈ [n]. Hence for each switch {ai,1, ai,2, bi,1, bi,2}, exactly one of the vertices ai,1, ai,2 and exactly one of the vertices bi,1, bi,2 is in V2. Now we see that the vertices in V1 and V2 both induces a cycle in R and as the vertices cj,1, cj,2 have degree 2 outside R, the cycle in R which is in V1 must contain a neighbour of each of cj,1, cj,2, j ∈ [m]. Hence, by Theorem 2.2, F is satisfiable. We obtain the result for higher values of a by induction where we just proved the base case a = 3 above. Assume we have already constructed Ha = Ha(F) with δ(Ha) ≥ a + 1 such that Ha has a (δ ≥ a, δ ≥ a)-partition if and only if F is satisfiable. Construct Ha+1 from two copies of Ha by joining copies of the same vertex by an edge. It is easy to check that Ha+1 has a (δ ≥ a+1, δ ≥ a+1)-partition if and only if Ha has a (δ ≥ a, δ ≥ a)-partition. (cid:5) Theorem 4.4 Deciding whether a graph of minimum degree 3 has a (δ ≥ 2, δ ≥ 3)-partition is NP- complete. Proof: Let X = X(F) be the graph we obtain by starting from the ring graph R(F) and then adding the following: • Add the vertices of a tree T whose internal vertices have all degree 3 and which has 2m + 4n leaves denoted by u1,1, u1,2 . . . , un,1, un,2, u(cid:48) ui,1, ui,2 and u(cid:48) i,1, u(cid:48) j ∈ [m]. Here the vertices cj,1, cj,2 correspond to the clause Cj n,2, c1,1, c1,2, c2,1, c2,2, . . . , cm,1, cm,2, where the pairs i,2 have the same parent in T for i ∈ [n] and so do each of the pairs cj,1, cj,2, 1,2, . . . , u(cid:48) n,1, u(cid:48) 1,1, u(cid:48) • Join each vertex cj,1, cj,2, j ∈ [m] to the 3 vertices in R which correspond to the literals which correspond to Cj and add the edge cj,1cj,2. • Add 4n new vertices wi,1, wi,2, w(cid:48) • For each i ∈ [n] add the edges wi,1ai,1, wi,2ai,2, w(cid:48) • For each i ∈ [n] join each of ui,1 and ui,2 by edges to the vertices wi,1, wi,2 and add the edge i,2, i ∈ [n]. Add the edges wi,1wi,2, w(cid:48) i,2, i ∈ [n]. i,1bi,1, w(cid:48) i,1, w(cid:48) i,1w(cid:48) i,2bi,2. ui,1ui,2. i,2 and add the edge • For each i ∈ [n] join each of u(cid:48) i,1 and u(cid:48) i,2 by edges to the vertices w(cid:48) i,1, w(cid:48) u(cid:48) i,1u(cid:48) i,2. We first prove that in any (δ ≥ 2, δ ≥ 3)-partition (V1, V2) of X all the vertices of T must be in the same set Vi. Note that we can not have cj,1 and cj,2 in different sets of the partition because then one of their 3 neighbours in V (R) must be in both sets. By a similar argument, for each i ∈ [n] the i,1 and u(cid:48) vertices ui,1 and ui,2 must belong to the same set in the partition and the vertices u(cid:48) i,2 must belong to the same set in the partition. It is easy to check that this implies our claim for T . If F is satisfiable, then by Theorem 2.2, we can find vertex disjoint cycles C, C(cid:48) in R such that C contains a vertex corresponding to a literal of Cj for each j and V (R) = V (C) ∪ V (C(cid:48)). Now we let V1 = V (C(cid:48)) and V2 = V (X) − V1. It is easy to check that this is a (δ ≥ 2, δ ≥ 3)-partition because C must contain exactly one of the vertices ai,1, ai,2 and exactly one of the vertices bi,1, bi,2 for each i ∈ [n]. Suppose now that (V1, V2) is a good partition of X. By the argument above we have V (T ) ⊂ Vi for i = 1 or i = 2. This must be i = 2 since in the graph X − V (T ) all vertices except the switch vertices have degree 2. Thus we have V (T ) ⊂ V2 and each of the vertices cj,1, cj,2, j ∈ [m] have a neighbour in 9 V (R) which is also in V2. As in earlier proofs it is easy to check that if some vertex of one of the paths Pi,1, Pi,2 is in V2 then all vertices of that path are in V2. As in the proof of the previous theorem, we now conclude that for each switch {ai,1, ai,2, bi,1, bi,2}, exactly one of the vertices ai,1, ai,2 and exactly one of the vertices bi,1, bi,2 is in V2. Now we see that the vertices in V1 and V2 both induce a cycle in R and as the vertices cj,1, cj,2 have degree 2 outside R, the cycle in R which is in V2 must contain a neighbour of each of cj,1, cj,2, j ∈ [m]. Hence, by Theorem 2.2, F is satisfiable. (cid:5) Corollary 4.5 For every k ≥ 2 it is NP-complete to decide if a given graph with minimum degree at least k + 1 has a (δ ≥ k, δ ≥ k + 1)-partition. Proof: This follows by induction on k with Theorem 4.4 as the base case in the same way as we (cid:5) proved the last part of Theorem 4.3. Proposition 4.6 There is a polynomial algorithm for deciding whether a given graph of minimum degree 5 has a (δ ≥ 2, δ ≥ 3)-partition. Proof: Let G have δ(G) ≥ 5. By Theorem 1.1 and the algorithmic version of this result from [7] we may assume that G has a 3-cycle C. Denote its vertex set by {a, b, c}. If δ(G[V − V (C)] ≥ 3) we are done as we can take V1 = V (C), so assume there is a vertex d which adjacent to all vertices of C. Then {a, b, c, d} induce a K4. If δ(G[V − {a, b, c, d}) ≥ 2 we can take V2 = {a, b, c, d}, so we can assume that there is a vertex e which is adjacent to all 4 vertices in {a, b, c, d} and now {a, b, c, d, e} induce a K5. Now if G[V − {a, b, c, d, e}] contains a cycle C(cid:48) we can conclude by starting with V2 = {a, b, c, d, e} and adding vertices of V − V (C(cid:48)) − {a, b, c, d, e} to V2 as long as there is one with at least 3 neighbours in V2. When the process stops (V − V2, V2) is a good partition. Hence we can assume that G[V − {a, b, c, d, e}] is acyclic. If one connected component of G[V − {a, b, c, d, e}] is non trivial with a spanning tree T , then two leaves u, v of T will share a neighbour in {a, b, c, d, e}. Without loss of generality this is e and now the K4 induced by a, b, c, d and the cycle formed by e, u, v and the path between u and v in T are disjoint and we can find a good partition as we did above. Hence if we have not found the partition yet we must have that G[V −{a, b, c, d, e}] is an independent set I, all of whose vertices are joined to all vertices in {a, b, c, d, e}. If I ≥ 2 it is easy to find a good partition consisting of a 3-cycle on a, b and one vertex from I as V1 and the remaining vertices as V2. (cid:5) Finally if I = 1 there is no solution. 5 Further 2-partition problems In [31] Thomassen proved that every graph G of connectivity at least k1 + k2 − 1 and minimum degree at least 4k1 + 4k2 + 1 has a 2-partition (V1, V2) so that G[Vi] is ki-connected for i = 1, 2. with prescribed lower bounds on the (edge-)connectivity of G[Vi], i ∈ [2]. It is natural to ask about the complexity of deciding whether a graph has a 2-partition (V1, V2) We start with a simple observation. Proposition 5.1 There exits a polynomial algorithm for deciding whether a given graph has a 2- partition (V1, V2) such that G[V1] is connected and G[V2] is 2-edge-connected. Proof: Suppose first that G is not 2-edge-connected. If G has more than two connected compo- nents it is a 'no'-instance. If it has two components, it is a 'yes'-instance if and only if one of these is 2-edge-connected. Hence we can assume that G is connected but not 2-edge-connected. Now it is easy to see that there is a good partition if and only if the block-cutvertex tree of G has a nontrivial block which is a leaf in the block-cutvertex tree. Thus assume below that G is 2-edge-connected. Now consider an ear-decomposition (sometimes called a handle-decomposition) of G where we start from an arbitrary cycle C. Let P be the last non-trivial ear that we add and let u, v be the end vertices of P . Then V1 = V (P ) − {u, v} and V2 = V − V1 is a good partition. (cid:5) Perhaps a bit surprisingly, if we require just a bit more for the connected part, the problem becomes Both NP-completeness proofs below use reductions from a given 3-SAT formula F so we only NP-complete. describe the necessary modifications of R(F). 10 Theorem 5.2 It is NP-complete to decide whether an undirected graph G = (V, E) has a vertex partition (V1, V2) so that G[V1] is 2-edge-connected and G[V2] is connected and non-acyclic. Proof: We add vertices and edges to R = R(F) as follows: • For each clause Cj, j ∈ [m] we add a vertex cj and join it by three edges to the three literal vertices of R corresponding to Cj (as we did in several proofs above). 1, c(cid:48) j, j ∈ [m]. i, i ∈ [n] i, i ∈ [n]. m and edges cjc(cid:48) 1, . . . , α(cid:48) 1, . . . , β(cid:48) n and the edges αiai,1, αiai,2, αiα(cid:48) n and the edges βibi,1, βibi,2, βiβ(cid:48) • Add new vertices c(cid:48) 2, . . . , c(cid:48) • Add new vertices α1, . . . , αn, α(cid:48) • Add new vertices β1, . . . , βn, β(cid:48) We claim that the resulting graph G has a vertex partition (V1, V2) such that G[V1] is 2-edge- connected and G[V2] is connected and non-acyclic if and only if F is satisfiable. Note that, by construction, for every good partition every vertex of G which is not in R must belong to V2. In particular if a path Pi,j contains a vertex of V2 then all the vertices of Pi,j are in V2. Since we want G[V2] to be connected, the edges between αi, βi, i ∈ [n] and R imply that for every i ∈ [n] at most one of the vertices ai,1, ai,2 and a most one of the vertices bi,1, bi,2 can belong to V1. This implies that exactly one of ai,1, ai,2 and exactly one of the vertices bi,1, bi,2 belong to V1 as otherwise V1 would be empty. Now it is easy to check that the desired partition exists if and only if R contains a cycle C(cid:48) which uses precisely one of the paths Pi,1, Pi,2 for i ∈ [n] and avoids at least one literal vertex for every clause of F. Thus, by Theorem 2.2, F is satisfiable if and only if G has a good partition. (cid:5) Since we can decide whether a graph has two vertex disjoint cycles in polynomial time [9, 25] the following result, whose easy proof we leave to the interested reader, implies that it is polynomial to decide whether a graph has a 2-partition into two connected and non-acyclic graphs. Proposition 5.3 A graph G has a 2-partition (V1, V2) such that G[Vi] is connected and has a cycle for i = 1, 2 if and only if G has a pair of disjoint cycles and either G is connected or it has exactly two connected components, each of which contain a cycle. Theorem 5.4 It is NP-complete to decide whether a graph G = (V, E) has a vertex partition (V1, V2) so that each of G[V1] and G[V2] are 2-edge-connected. Proof: Let F be a 3-SAT formula and let G = G(F) be the graph we constructed in the proof above. Let G1 be the graph obtained by adding the following vertices and edges to G: mqm 1 q1c(cid:48)(cid:48) 2 q2 . . . c(cid:48)(cid:48) j , j ∈ [m], qj, j ∈ {0} ∪ [m] and γ • add new vertices c(cid:48)(cid:48) • add the edges c(cid:48)(cid:48) j, j ∈ [m] j c(cid:48) • add the edges of the path q0c(cid:48)(cid:48) • complete this path into a cycle W by adding the edges γq0, γqm • add an edge from γ to all vertices in {α(cid:48) We claim that G(cid:48) has a vertex-partition into two 2-edge-connected graphs if and only if F is satisfiable. First observe that in any good partition (V1, V2) we must have all vertices of W inside V1 or V2. This follows from the fact that each qi has degree 2 so it needs both its neighbours in the same set. Without loss of generality, W is a cycle in V2. After deleting the vertices of W we have exactly the graph G in the proof of Theorem 5.2 above and it is easy to see that all vertices not in V (R) must belong to V2 in any good partition. This implies that G(cid:48) has the desired vertex-partition if and only 2 ) so that G[V1] is 2-edge-connected and G[V (cid:48) if the graph G has a partition (V1, V (cid:48) 2 ] is connected and non-acyclic. This problem is NP-complete by Theorem 5.2 so the proof is complete. (cid:5) 1, . . . , α(cid:48) 1, . . . , β(cid:48) n, β(cid:48) n}. By inspecting the proof above it is not difficult to see that the following holds. Theorem 5.5 It NP-complete to decide whether a graph has a 2-partition (V1, V2) such that each of the graphs G[Vi], i = 1, 2 are 2-connected. It may be worth while to try and extend the results of this section to higher (edge)-connectivities. 11 References [1] N. Alon. Splitting digraphs. Combin. Prob. Comput., 15:933 -- 937, 2006. [2] J. Bang-Jensen, N. Cohen, and F. Havet. Finding good 2-partitions of digraphs II. Enumerable properties. Theor. Comput. Sci., 640:1 -- 19, 2016. [3] J. Bang-Jensen and G. Gutin. Digraphs: Theory, Algorithms and Applications. Springer-Verlag, London, 2nd edition, 2009. [4] J. Bang-Jensen and F. Havet. Finding good 2-partitions of digraphs I. Hereditary properties. Theor. Comput. Sci., 636:85 -- 94, 2016. [5] C. Bazgan, Z. Tuza, and D.Vanderpooten. The satisfactory partition problem. Discrete Appl. Math., 154(8):1236 -- 1245, 2006. [6] C. Bazgan, Z. Tuza, and D. Vanderpooten. Degree-constrained decompositions of graphs: Bounded treewidth and planarity. Theor. Comput. Sci., 355(3):389 -- 395, 2006. [7] C. Bazgan, Z. Tuza, and D. Vanderpooten. Efficient algorithms for decomposing graphs under degree constraints. Discrete Applied Mathematics, 155(8):979 -- 988, 2007. [8] J. Bensmail. On the complexity of partitioning a graph into a few connected subgraphs. J. Combin. Optim., 30:174 -- 187, 2015. [9] B. Bollob´as. Extremal Graph Theory. Academic Press, London, 1978. [10] M. Bonamy, K.K. Dabrowski, C. Feghali, M. Johnson, and D. Paulusma. Recognizing graphs In 42nd International Symposium on Mathematical Foundations of close to bipartite graphs. Computer Science, MFCS 2017, August 21-25, 2017 - Aalborg, Denmark, pages 70:1 -- 70:14, 2017. [11] M. Bonamy, K.K. Dabrowski, C. Feghali, M. Johnson, and D. Paulusma. Independent feedback vertex sets for graphs of bounded diameter. Information Proc. Letters., 131:26 -- 32, 2018. [12] J.A. Bondy and U.S.R. Murty. Graph Theory, volume 244 of Graduate Texts in Mathematics. Springer-Verlag, Berlin, 2008. [13] V. Chv´atal. Recognizing decomposable graphs. J. Graph Theory, 8(1):51 -- 53, 1984. [14] M.E. Dyer and A.M. Frieze. On the complexity of partitioning graphs into connected subgraphs. Discrete. Appl. Math., 10:139 -- 153, 1985. [15] S. Foldes and P. Hammer. Split graphs. Congress. Numer., 19:311 -- 315, 1977. [16] M. Gerber and D. Kobler. Algorithmic approach to the satisfactory graph partitioning problem. European J. of Operation Research, 125:283 -- 291, 2000. [17] M.U. Gerber and D. Kobler. Classes of graphs that can be partitioned to satisfy all their vertices. Australasian J. of Combin., 29:201 -- 214, 2004. [18] A. Grigoriev and R. Sitters. Connected feedback vertex set in planar graphs. In WG 2009: Graph Theoretical concepts in Computer Science, volume 5911 of Lect. Notes Comp. Sci., pages 143 -- 153. Springer Verlag, Berlin, 2009. [19] P. Hajnal. Partition of graphs with condition on the connectivity and minimum degree. Combi- natorica, 3:95 -- 99, 1983. [20] A. Kaneko. On decomposition of triangle-free graphs under degree constraints. J. Graph Theory, 27(1):7 -- 9, 1998. [21] D. Kuhn and D. Osthus. Partitions of graphs with high minimum degree or connectivity. J. Combin. Theory Ser. B, 88:29 -- 43, 2003. 12 [22] H.-O. Le, V.B. Le, and H. Muller. Splitting a graph into disjoint induced paths or cycles. Discrete. Appl. Math., 131:199 -- 212, 2003. [23] M. Liu and B. Xu. On partitions of graphs under degree constraints. Disc. Appl. Math., 226:87 -- 93, 2017. [24] M.H. Liu and B.G. Xu. Bipartition of graph under degree constraints. Science China Mathemat- ics, 58:869 -- 874, 2015. [25] L. Lovas´z. On graphs not containing independent circuits (in Hungarian). MatLapok, 16:289299, 1965. [26] J. Ma and T. Yang. Decomposing C4-free graphs under degree constraints. arXiv:1706.07292, 2017. [27] N. Misra, G. Philip, V. Raman, S. Saurabh, and S. Sikdar. FPT algorithms for connected feedback vertex set. J. Combin. Optim., 24:131 -- 146, 2012. [28] M. Stiebitz. Decomposition of graphs and digraphs. In KAM Series in Discrete Mathematics- Combinatorics-Operations Research-Optimization 95-309. Charles University Prague, 1995. [29] M. Stiebitz. Decomposing graphs under degree constraints. J. Graph Theory, 23:321 -- 324, 1996. [30] H. Suzuki, N. Takahashi, and T. Nishizeki. A linear algorithm for bipartion of biconnected graphs. Inform. Process. Lett., 33:227 -- 231, 1990. [31] C. Thomassen. Graph decomposition with constraints on the connectivity and minimum degree. J. Graph Theory, 7:165 -- 167, 1983. [32] C. Thomassen. Paths, circuits and subdivisions. In Selected topics in graph theory Vol. 3, pages 97 -- 131. Academic Press, 1988. [33] P. van't Hof, D. Paulusma, and G.J. Woeginger. Partitioning graphs into connected parts. Theor. Comput. Sci., 410:4834 -- 4843, 2009. [34] M. Xiao and H. Nagamochi. Complexity and kernels for bipartition into degree-bounded induced graphs. Theor. Comput. Sci., 659:72 -- 82, 2017. 13
1906.10615
1
1906
2019-06-25T15:45:56
Krivine diffusions attain the Goemans--Williamson approximation ratio
[ "cs.DS" ]
Answering a question of Abbasi-Zadeh, Bansal, Guruganesh, Nikolov, Schwartz and Singh (2018), we prove the existence of a slowed-down sticky Brownian motion whose induced rounding for MAXCUT attains the Goemans--Williamson approximation ratio. This is an especially simple particular case of the general rounding framework of Krivine diffusions that we investigate elsewhere.
cs.DS
cs
KRIVINE DIFFUSIONS ATTAIN THE GOEMANS -- WILLIAMSON APPROXIMATION RATIO RONEN ELDAN AND ASSAF NAOR ABSTRACT. Answering a question of Abbasi-Zadeh, Bansal, Guruganesh, Nikolov, Schwartz and Singh (2018), we prove the existence of a slowed-down sticky Brownian motion whose induced rounding for MAXCUT attains the Goemans -- Williamson approximation ratio. This is an especially simple particular case of the general rounding framework of Krivine diffusions that we investigate elsewhere. Bibliographical comment. This text amounts to an extraction of a subsection from our preprint [EN14], with a modicum of background details added so as to make it self-contained. [EN14] is an outgrowth of a project that we have been pusuing over the past 5 years to understand a framework, which we call Krivine diffusions, to consistently "round" high-dimensional vectors to signs, i.e., to elements of {−1, 1}. We decided to post the present note separately, prior to the publication of the more extensive manu- script [EN14] (at which time [EN14] will subsume the present note), because recently a special case of the approach of [EN14] arose in [AZBG+18], and we realized that even this (much simpler) setting of [EN14] resolves one of the main open questions of [AZBG+18]. The present extract from [EN14] establishes this fact in a self-contained manner that can be read as a standalone article without waiting for the appear- ance of [EN14], though [EN14] situates the ensuing reasoning within proper context and derives more delicate statements in other settings of interest (notably for the Grothendieck constant, which entails treating cancellations that do not arise in the present setting). 1. INTRODUCTION Throughout what follows, we fix d ∈ N and let 〈·,·〉 : Rd → R be the standard scalar product on Rd , with the associated unit sphere denoted by Sd−1 = {x ∈ Rd : 〈x, x〉 = 1}. Suppose that n ∈ N and x1, . . . , xn ∈ Sd−1. It is a ubiquitous problem in several areas to meaningfully associate to these vectors signs σ1, . . . , σn ∈ {−1, 1}. The interpretation of the term "meaningfully" here is problem-specific, and it encompasses issues that may include the efficiency of determining these signs. This is of central importance to approximation algorithms, when x1, . . . , xn are an output of a continuous relaxation of a combinatorial optimization problem. Grothendieck famously broached [Gro53] this mat- ter for (formidable) analytic applications (see also the work of Lindenstrauss and Pełczynski [LP68] and the survey [Pis12]), and it occurs in quantum information theory; see e.g. the work of Tsirelson [Tsi85]. The above generic "rounding" problem has the following seemingly naïve solution: Simply output the "first bit" (namely, the sign of the first entry) of each of these vectors, perhaps after first apply- ing a suitable transformation, such as a uniformly random rotation as in the work of Goemans and Williamson [GW95] or a more sophisticated "preprocessing" as in the work of Krivine [Kri77]. Despite its simplistic appearance, this procedure is of major importance to algorithm design, as demonstrated decisively in the seminal work [GW95] and in numerous subsequent investigations. Superior performance of the above rounding task can sometimes be achieved by associating a sign to a vector in a manner that is more sophisticated than considering its first bit after preprocessing. This may be somewhat nonintuitive at times, e.g. Krivine [Kri77] stated that this is not so for the Grothendieck R. E. is supported by a European Reseach Council Starting Grant (ERC StG) and by the Israel Science Foundation. A. N. was supported by the Packard Foundation and the Simons Foundation. The research presented here was conducted under the auspices of the Simons Algorithms and Geometry (A&G) Think Tank. 1 problem (to be described below), but [BMMN13] established that Krivine's conjecture has a negative an- swer (note that despite the fact that for historical reasons this is formally described as a "negative answer" to a conjecture, it entails the design of a better rounding method, so it is in fact a positive result). Such higher-dimensional "Krivine rounding schemes" are shown to be optimal for the Grothendieck problem in [NR14], and this is the reason for the nomenclature that we choose below to describe a new rounding method. There is a remarkable generic procedure [Rag08, RS09a, RS09b, Aus10] to devise for certain con- straint satisfaction problems (CSPs) a higher-dimensional rounding method that has the best possible polynomial-time performance unless the Unique Games Conjecture [Kho02] has a negative answer. Despite the overall usefulness of the above "first bit rounding" (a.k.a. hyperplane rounding, after pre- processing), as well as its optimality in important settings such as MAXCUT [FS02, KKMO07], combined with the fact that sharp rounding methods have been proven to exist for a large family of CSPs, there is great need to devise further rounding methods (and ways to analyse them) because there are im- portant continuous relaxations of combinatorial optimization problems for which the aforementioned results do not shed light on the best-possible value of the associated integrality gap; understanding the Grothendieck constant is a prime example of a longstanding mystery of this nature. Of course, there is no reason to expect that such constants could be expressed in terms of elementary functions, but one might hope to find enlightening characterizations of them, better estimates, or to "merely" obtain a versatile rounding method that could be used heuristically in practice. More ways to reason about the rounding problem are needed also because the aforementioned generic rounding methods for CSPs are sharp (as- suming the Unique Games Conjecture) only when the integrality gap is O(1) as n → ∞, while there are important questions (e.g. Sparset Cut) where the integrality gap is unbounded as a function of n, so the pertinent issue becomes to devise methods that could be analysed so as to yield sharp asymptotics. Our preprint [EN14] considers the following general rounding method that we call Krivine diffusions, in reference to the power of Krivine rounding schemes that was established in [BMMN13, NR14]. Note, however, that while the works [BMMN13, NR14] build on a key idea that Krivine introduced in [Kri77], their success relies on the usefulness of degrees of freedom that Krivine expected [Kri77] not to be useful. Nonetheless, Krivine's approach is the fundamental inspiration for these ideas, thus justifying naming the method in homage to his contribution. The ensuing framework allows one to bring in tools from stochastic calculus to analyse the rounding question, and in [EN14] this is shown to relate integrality gaps to certain variational questions in partial differential equations. The present text, however, demonstrates how in the special setting of MAXCUT, an explicit sharp closed-form solution could be obtained. 1.1. Krivine diffusions. Consider the following method to associate to u ∈ Rd a random sign σu ∈ {−1, 1}. We call any such procedure a discrete-time Krivine diffusion. We will pass later to a natural continuous- time limit in order to use analytic tools to understand the behavior of the rounding procedure. • Datum. Each instance of the method is determined by an integer T ∈ N, a function f : R → R and for every t ∈ {1, . . . ,T } a function Ft : Rt → R. • Randomness. Let γ1, . . . γT be independent standard Gaussian random variables in Rd , i.e., their density at (x1, . . . , xd ) ∈ Rd is proportional to exp(−(x2 • Evolution. For every u ∈ Rd consider the random numbers Xu(0), . . . , Xu(T ) ∈ R that are defined by setting Xu(0) = 0, and proceeding recursively by setting 1 + . . .+ x2 d )/2). (1) def Xu(t + 1) = Xu(t )+ Ft¡Xu(1), . . . , Xu(t )¢f ¡〈γt ,u〉¢. • Output. For each u ∈ Rd , if there is t ∈ {1, . . . ,T } with Xu(t ) Ê 1, then let Tu be the first time that this occurs, i.e., Tu = min{t ∈ {1, . . . ,T } : Xu(t ) Ê 1}, and output σu = sign(Xu(Tu)). Otherwise, namely if Xu(t ) < 1 for all t ∈ {1, . . . ,T }, then let σu be uniformly distributed over {−1, 1}. In other words, the datum of a Krivine diffusion consists of the recursion coefficients in (1) and the number T of recursion steps. With this given, one chooses T independent Gaussians and evolves the random numbers {Xu(t )}T t=0 according to the update rule (1) in which the increment Xu(t + 1)− Xu(t ) is 2 proportional to a function of the random dot-product 〈γt ,u〉, where the proportion factor may depend on the values Xu(1), . . . , Xu(t ) that were determined thus far. The output σu ∈ {−1, 1} is the sign of this process at the first time that it exists the interval (−1, 1) if such a time exists, and otherwise it is a uni- formly random element of {−1, 1}. Note that the same Gaussians γ1, . . . , γT are used here for every u ∈ Rd , thus inducing an important and subtle correlation between the signs {σu}u∈Rd . There are degrees of freedom that the above construction did not exploit. One obvious variant is to allow the recursion coefficient f (〈γt ,u〉) in (1) to have a further dependence on t of the form ft (〈γt ,u〉) for some ft : R → R. We dropped this flexibility because thus far we did not find any use for it. A more substantial variant is to consider distributions over families of Krivine diffusions. This will not be needed in the present note, but it is worthwhile to mention in passing that distributions over pairs of Krivine diffusions are used in the following theorem from [EN14]. Theorem 1 (Krivine diffusions attain the Grothendieck constant). For any ε > 0, there exists T ∈ N and a distribution µ over pairs of Krivine diffusions {(Xu(t ),Yu(t ))}T t=0 such that for every m,n ∈ N, every u1, . . . ,um, v1, . . . , vn ∈ Sd−1 and every m by n matrix A = (ai j ) ∈ Mm×n(R), n Xi=1 n Xj=1 ai j〈ui , v j〉 É (KG + ε) n Xi=1 n Xj=1 ai j E£sign¡Xu(T )¢sign¡Yu(T )¢¤+ ε n Xi=1 n Xj=1ai j, (2) where KG is the Grothendieck constant and the expectation in (2) is with respect to both µ and the under- lying randomness of the Krivine diffusions, namely over the Gaussians γ1, . . . , γT . A much more well-understood rounding problem concerns the special case of (2) in which the coeffi- cients {ai j : (i , j ) ∈ {1, . . . ,n}2} are non-positive. An especially important instance of this is the MAXCUT problem; the lack of cancellations between the summands in the setting of MAXCUT allows for the suc- cess of understanding it fully assuming the Unique Games Conjecture [GW95, KKMO07]. Abbasi-Zadeh, Bansal, Guruganesh, Nikolov, Schwartz and Singh studied in [AZBG+18] a special case of Krivine diffusions (which they discovered independently of [EN14]), called sticky Brownian motion (and a "slowed down" version thereof ). It is shown in [AZBG+18] that the integrality gap for MAXCUT that can be attained by sticky Brownian motion is quite close to the Goemans -- Williamson approximation ratio [GW95], relying on analytic reasoning and computer-assisted numerical computations. One of the main open questions that were posed in [AZBG+18] is whether the Goemans -- Williamson approximation ratio can be achieved exactly using this approach. Here we prove that this is indeed the case. 1.2. The continuous setting. We begin by recalling the slowed-down sticky Brownian motion rounding scheme of [AZBG+18]. Its input is a sequence of unit vectors u1, . . . ,un ∈ Rd and its goal is to produce signs σ1, . . . , σn ∈ {−1, 1}. To do so, we will use below basic facts from stochastic calculus, all of which are standard and appear in introductory texts such as [Ok03, KS91]. Let {B (t )}tÊ0 be a Brownian motion in Rd adapted to the filtration {Ft }tÊ0. Sticky Brownian motion refers to the associated random signs ∀i ∈ {1, . . . ,n}, σi def = 〈ui ,B (Ti )〉, where Ti def = min{t Ê 0 : 〈ui ,B (t )〉= 1}. Thus, the sign σi is extracted when the stochastic process {〈ui ,B (t )〉}tÊ0 first reaches the set {−1, 1}; hence the terminology "sticky." Next, consider the following modification of this procedure. Fix a continuous function ϕ : [−1, 1] → [0,∞) that satisfies lim s→1− ϕ(s) = lim s→−1+ ϕ(s) = 0 and ∀ s ∈ (−1, 1), ϕ(s) > 0. Let {W ϕ u (t )}(u,t )∈Rd×[0,∞) be a stochastic process that satisfies the stochastic differential equation ∀(u, t ) ∈ Rd × [0,∞), W ϕ u (0) = 0, and 3 dW ϕ u (t ) = ϕ¡W ϕ u (t )¢〈u, dB (t )〉. (3) (4) The existence and uniqueness (in distribution) of {W ϕ u (t )}(u,t )∈Rd×[0,∞) follows from the rudimentary the- ory of stochastic differential equations; thorough treatments of this appear in e.g. [KS91, Ok03]. In par- ticular, {W ϕ u (t )}tÊ0 is a martingale (with respect to the Brownian filtration {Ft }tÊ0) for every u ∈ Rd , and by the martingale convergence theorem the following limit exists almost-surely. ϕ u σ def = lim t→∞ W ϕ u (t ). ϕ u ∈ {−1, 1} almost-surely. Since the speed ϕ satisfies ϕ(s) → 0 as The assumptions (3) on ϕ ensure that σ s → {±1}, this process is called "slowed-down" sticky Brownian motion. Remark 2. For each fixed u ∈ Rd the equation (4) that governs the evolution of the process {W ϕ u (t )}τÊ0 is a one-dimensional stochastic differential equation. One can solve (4) separately for each u ∈ Rd , but it is motion that is used to drive this family of stochastic differential equations is the same for all u ∈ Rd , thus inducing important correlations which are exploited crucially both below and in [EN14, AZBG+18]. important to stress that the resulting rounding procedure relies on the fact that the underlying Brownian A mechanical approximation argument verifies that the above processes can be obtained as continu- ous limits of Krivine diffusions; we will not include the straightforward details here (they are meaningful for understanding the context, and also a discretization is needed for efficient implementation of the rounding method, but such issues are not needed for the ensuing proof ). The work [AZBG+18] makes the choice ϕ(s) = (1− s2)α for α > 0. Here we pinpoint the following dif- ferent choice which recovers the Goemans -- Williamson approximation ratio and thus answers positively the question raised in [AZBG+18]. Define ξ : [−1, 1] → [0,∞) by setting 2 ¢2 Φ−1¡ 1−s ∀ s ∈ [−1, 1], p2 pπ e− 1 ξ(s) (5) = def , 2 where Φ : R → R is the standard Gaussian cumulative distribution function, i.e., ∀ x ∈ R, Φ(x) def = e− s2 2 ds, thus Φ′′(x) = −xΦ′(x). (6) 1 p2π x ∞ With the following theorem at hand, one concludes identically to [GW95] that the slowed-down sticky Brownian motion with speed ξ attains the Goemans -- Williamson approximation ratio for MAXCUT. Theorem 3. For u ∈ Rd and t Ê 0 write W ξ ∀u, v ∈ Sd−1, ξ u = σu ∈ {−1, 1}, where ξ is given in (5). Then, u (t ) = Wu(t ) and σ 2 arcsin(〈u, v〉). E£σu σv¤ = (7) π 2. PROOF OF THEOREM 3 Let {B (t )}tÊ0 be a Brownian motion in Rd adapted to the filtration {Ft }tÊ0. Consider the process ∀(x, t ) ∈ Rd × [0,∞), Zx (t ) def = t 0 e− s 2 〈x, dB (s)〉. 0 e−sd s implies that the following limit exists almost-surely. The convergence of the integral´ ∞ Zx (∞) Zw (t ) = ∞ Fix u, v ∈ Sd−1. Because u and v are unit vectors and´ ∞ and Zv (∞) are standard Gaussian random variables, and their covariance equals 2〈x, dB (s)〉. = lim t→∞ e− s def 0 0 e−s ds = 1, it follows from (9) that both Zu(∞) E£Zu(∞)Zv (∞)¤ (9) = ∞ 0 e−s d[〈u,B (s)〉〈v,B (s)〉]s = ∞ 0 e−s〈u, v〉 ds = 〈u, v〉. (8) (9) 4 Hence, by the original computation of Goemans and Wiliamson [GW95] (using elementary planar ge- ometry), we have the following equality (Grothendieck's identity [Gro53, LP68]) . E£sign¡Zu(∞)¢sign¡Zv (∞)¢¤ = 2 π arcsin(〈u, v〉). (10) Due to (10), Theorem 3 will be proven if we show that (σu , σv ) and (sign(Zu(∞)), sign(Zv (∞))) have the same distribution. More generally, by working with continuous modifications of {Wx (t )}(x,t )∈Sd−1×[0,∞) and {Zx (t )}(x,t )∈Sd−1×[0,∞) (as we may, see e.g. [Kun84]), the ensuing argument establishes that the sign- valued processes {σx }x∈Sd−1 and {sign(Zx (∞))}x∈Sd−1 are equal almost-surely. For every u ∈ Rd , consider the martingale that is defined by By the martingale convergence theorem, we almost-surely have ∀ t Ê 0, Mu(t ) def = E£sign¡Zu(∞)¢¯¯ Ft¤ . (11) Mu(t ) lim t→∞ = E£sign¡Zu(∞)¢¯¯ F∞¤ = sign¡Zu(∞)¢. We will show below that the stochastic processes {Mu(t )}u∈Sd−1×[0,∞) and {Wu(t )}u∈Sd−1×[0,∞) are equal. Since, by definition, σu = limt→∞ Wu(t ) almost-surely, together with (12) this would imply the desired equi-distribution of (σu, σv ) and (sign(Zu(∞)), sign(Zv (∞))). Note that´ ∞t e−s/2〈u, dB (s)〉 is independent of Zu(t ) and has the same distribution as e−t /2 γ, where γ is a standard Gaussian random variable that is independent of {Zu(t )}(u,t )∈Rd×[0,∞]. Hence, 2 Zu(t )¢. Ft¤− 1 = 2P£Zu(t )+ e− t 2 γ > 0¤− 1 = 1− 2Φ¡− e Mu(t ) (13) (11) t Itô's formula yields, (11) (12) (14) = 2P£Zu(∞) Ê 0¯¯ 2 Zu(t )¢e t dMu(t ) = 2Φ′¡− e (6)∧(13) t 2 dZu(t )− Φ′′¡− e t = 2Φ′µΦ−1³ 1− Mu(t ) 2 ´¶ e t 2 dZu(t ) t 2 Zu(t )¢ dt + e 2 Zu(t )Φ′¡− e (5)∧(8) = ξ¡Mu(t )¢〈u, dB (t )〉. t 2 Zu(t )¢ dt Recalling that {Wu (t )}u∈Sd−1×[0,∞) satisfies the stochastic differential equation (4) with ϕ = ξ, we see from (14) that the processes {Mu(t )}u∈Sd−1×[0,∞) and {Wu (t )}u∈Sd−1×[0,∞) satisfy the same stochastic dif- ferential equation, so by Itô's uniqueness theorem Wu(t ) = Mu(t ) for all t ∈ [0,∞) and all u ∈ Sd−1. (cid:3) REFERENCES [Aus10] [AZBG+18] S. Abbasi-Zadeh, N. Bansal, G. Guruganesh, A. Nikolov, R. Schwartz, and M. Singh. Sticky brownian rounding and P. Austrin. Towards sharp inapproximability for any 2-CSP. SIAM J. Comput., 39(6):2430 -- 2463, 2010. its applications to constraint satisfaction problems, 2018. ArXiv:1812.07769. [BMMN13] M. Braverman, K. Makarychev, Y. Makarychev, and A. Naor. The Grothendieck constant is strictly smaller than [EN14] [FS02] [Gro53] [GW95] [Kho02] Krivine's bound. Forum Math. Pi, 1:e4, 42, 2013. R. Eldan and A. Naor. Krivine diffusions, 2014. Preprint. U. Feige and G. Schechtman. On the optimality of the random hyperplane rounding technique for MAX CUT. Ran- dom Structures Algorithms, 20(3):403 -- 440, 2002. Probabilistic methods in combinatorial optimization. A. Grothendieck. Résumé de la théorie métrique des produits tensoriels topologiques. Bol. Soc. Mat. São Paulo, 8:1 -- 79, 1953. M. X. Goemans and D. P. Williamson. Improved approximation algorithms for maximum cut and satisfiability prob- lems using semidefinite programming. J. Assoc. Comput. Mach., 42(6):1115 -- 1145, 1995. S. Khot. On the power of unique 2-prover 1-round games. In Proceedings of the Thirty-Fourth Annual ACM Sympo- sium on Theory of Computing, pages 767 -- 775. ACM, New York, 2002. doi:10.1145/509907.510017. [KKMO07] S. Khot, G. Kindler, E. Mossel, and R. O'Donnell. Optimal inapproximability results for MAX-CUT and other 2- [Kri77] [KS91] variable CSPs? SIAM J. Comput., 37(1):319 -- 357, 2007. J.-L. Krivine. Sur la constante de Grothendieck. C. R. Acad. Sci. Paris Sér. A-B, 284(8):A445 -- A446, 1977. I. Karatzas and S. E. Shreve. Brownian motion and stochastic calculus, volume 113 of Graduate Texts in Mathematics. Springer-Verlag, New York, second edition, 1991. ISBN 0-387-97655-8. doi:10.1007/978-1-4612-0949-2. 5 [Kun84] [LP68] [NR14] [Ok03] [Pis12] [Rag08] [RS09a] [RS09b] [Tsi85] H. Kunita. Stochastic differential equations and stochastic flows of diffeomorphisms. In École d'été de probabilités de Saint-Flour, XII -- 1982, volume 1097 of Lecture Notes in Math., pages 143 -- 303. Springer, Berlin, 1984. doi:10. 1007/BFb0099433. J. Lindenstrauss and A. Pełczy ´nski. Absolutely summing operators in Lp -spaces and their applications. Studia Math., 29:275 -- 326, 1968. A. Naor and O. Regev. Krivine schemes are optimal. Proc. Amer. Math. Soc., 142(12):4315 -- 4320, 2014. B. Ø ksendal. Stochastic differential equations. Universitext. Springer-Verlag, Berlin, sixth edition, 2003. ISBN 3-540- 04758-1. doi:10.1007/978-3-642-14394-6. An introduction with applications. G. Pisier. Grothendieck's theorem, past and present. Bull. Amer. Math. Soc. (N.S.), 49(2):237 -- 323, 2012. P. Raghavendra. Optimal algorithms and inapproximability results for every CSP? [extended abstract]. In STOC'08, pages 245 -- 254. ACM, New York, 2008. doi:10.1145/1374376.1374414. P. Raghavendra and D. Steurer. How to round any csp. In In Proc. 50th IEEE Symp. on Foundations of Comp. Sci. 2009. P. Raghavendra and D. Steurer. Towards computing the Grothendieck constant. In Proceedings of the Twentieth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 525 -- 534. SIAM, Philadelphia, PA, 2009. B. S. Tsirelson. Quantum analogues of Bell's inequalities. The case of two spatially divided domains. Zap. Nauchn. Sem. Leningrad. Otdel. Mat. Inst. Steklov. (LOMI), 142:174 -- 194, 200, 1985. Problems of the theory of probability distributions, IX. 6
1109.6178
2
1109
2011-11-30T04:27:23
Space-efficient Local Computation Algorithms
[ "cs.DS" ]
Recently Rubinfeld et al. (ICS 2011, pp. 223--238) proposed a new model of sublinear algorithms called \emph{local computation algorithms}. In this model, a computation problem $F$ may have more than one legal solution and each of them consists of many bits. The local computation algorithm for $F$ should answer in an online fashion, for any index $i$, the $i^{\mathrm{th}}$ bit of some legal solution of $F$. Further, all the answers given by the algorithm should be consistent with at least one solution of $F$. In this work, we continue the study of local computation algorithms. In particular, we develop a technique which under certain conditions can be applied to construct local computation algorithms that run not only in polylogarithmic time but also in polylogarithmic \emph{space}. Moreover, these local computation algorithms are easily parallelizable and can answer all parallel queries consistently. Our main technical tools are pseudorandom numbers with bounded independence and the theory of branching processes.
cs.DS
cs
Space-efficient Local Computation Algorithms Noga Alon∗ Ronitt Rubinfeld† Shai Vardi ‡ Ning Xie § Abstract Recently Rubinfeld et al. (ICS 2011, pp. 223 -- 238) proposed a new model of sublinear algorithms called local computation algorithms. In this model, a computation problem F may have more than one legal solution and each of them consists of many bits. The local computation algorithm for F should answer in an online fashion, for any index i, the ith bit of some legal solution of F . Further, all the answers given by the algorithm should be consistent with at least one solution of F . In this work, we continue the study of local computation algorithms. In particular, we develop a technique which under certain conditions can be applied to construct local computation algorithms that run not only in polylogarithmic time but also in polylogarithmic space. Moreover, these local computation algorithms are easily parallelizable and can answer all parallel queries consistently. Our main technical tools are pseudorandom numbers with bounded independence and the theory of branching processes. 1 1 0 2 v o N 0 3 ] S D . s c [ 2 v 8 7 1 6 . 9 0 1 1 : v i X r a ∗Sackler School of Mathematics and Blavatnik School of Computer Science, Tel Aviv University, Tel Aviv 69978, Israel and Institute for Advanced Study, Princeton, New Jersey 08540, USA. E-mail: [email protected]. Research supported in part by an ERC Advanced grant, by a USA-Israeli BSF grant and by NSF grant No. DMS-0835373. †CSAIL, MIT, Cambridge, MA 02139, USA and School of Computer Science, Tel Aviv University, Tel Aviv 69978, Israel. E- mail: [email protected]. Supported by NSF grants CCF-0728645 and CCF-1065125, Marie Curie Reintegration grant PIRG03-GA-2008-231077 and the Israel Science Foundation grant nos. 1147/09 and 1675/09. ‡School of Computer Science, Tel Aviv University, Tel Aviv 69978, Israel. E-mail: [email protected]. Supported by Israel Science Foundation grant no. 1147/09. §CSAIL, MIT, Cambridge MA 02139, USA. E-mail: [email protected]. Research supported by NSF grants CCF- 0728645, CCF-0729011 and CCF-1065125. 0 1 Introduction The classical view of algorithmic analysis, in which the algorithm reads the entire input, performs a com- putation and then writes out the entire output, is less applicable in the context of computations on massive data sets. To address this difficulty, several alternative models of computation have been adopted, including distributed computation as well as various sub-linear time and space models. Local computation algorithms (LCAs) were proposed in [24] to model the scenario in which inputs to and outputs from the algorithms are large, such that writing out the entire output requires an amount of time that is unacceptable. On the other hand, only small portions of the output are required at any point in time by any specific user. LCAs support queries to the output by the user, such that after each query to a specified location i, the LCA outputs the value of the output at location i. LCAs were inspired by and intended as a generalization of several models that appear in the literature, including local algorithms, locally decodable codes and local reconstruction algorithms. LCAs whose time complexity is efficient in terms of the amount of solution requested by the user have been given for various combinatorial and coding theoretic problems. One difficulty is that for many computations, more than one output is considered to be valid, yet the values returned by the LCA over time must be consistent. Often, the straightforward solutions ask that the LCA store intermediate values of the computations in order to maintain consistency for later computations. Though standard techniques can be useful for recomputing the values of random coin tosses in a straightfor- ward manner, some algorithms (e.g., many greedy algorithms) choose very different solutions based on the order of input queries. Thus, though the time requirements of the LCA may be efficient for each query, it is not always clear how to bound the storage requirements of the LCA by a function that is sublinear in the size of the query history. It is this issue that we focus on in this paper. 1.1 Our main results Before stating our main results, we mention two additional desirable properties of LCAs. Both of these properties are achieved in our constructions of LCAs with small storage requirements. The first is that an LCA should be query oblivious, that is the outputs of A should not depend on the order of the queries but only on the input and the random bits generated on the random tape of A. The second is that the LCA should be parallelizable, i.e., that it is able to answer multiple queries simultaneously in a consistent manner. All the LCAs given in [25] suffer from one or more of the following drawbacks: the worst case space complexity is linear, the LCA is not query oblivious, and the LCA is not parallelizable. We give new techniques to construct LCAs for the problems studied in [25] which run in polylogarithmic time as well as polylogarithmic space. Moreover, all of the LCAs are query oblivious and easily parallelizable. Theorem 1.1 (Main Theorem 1 (informal)). There is an LCA for Hypergraph Coloring that runs in poly- logarithmic time and space. Moreover, the LCA is query oblivious and parallelizable. Theorem 1.2 (Main Theorem 2 (informal)). There is an LCA for Maximal Independent Set that runs in polylogarithmic time and space. Moreover, the LCA is query oblivious and parallelizable. We remark that following [25], analogous techniques can be applied to construct LCAs with all of the desirable properties for the radio network problem and k-CNF problems. 1.2 Techniques There are two main technical obstacle in making the LCAs constructed in [25] space efficient, query obliv- ious and parallelizable. The first is that LCAs need to remember all the random bits used in computing 1 previous queries. The second issue is more subtle -- [25] give LCAs based on algorithms which use very little additional time resources per query as they simulate greedy algorithms. These LCAs output results that depend directly on the orders in which queries are fed into the algorithms. We address the randomness issue first. The space inefficient LCAs constructed in [25] for the problems of concern to us are probabilistic by nature. Consistency among answers to the queries seems to demand that the algorithm keeps track of all random bits used so far, which would incur linear space complexity. A simple but very useful observation is that all the computations are local and thus involve a very small number of random bits. Therefore we may replace the truly random bits with random variables of limited independence. The construction of small sample space k-wise independent random variables of Alon et al. [3] allows us to reduce the space complexity from linear to polylogarithmic. This allows us to prove our main theorem on the LCA for the maximal independent set problem. It is also an important ingredient in constructing our LCA for Hypergraph Coloring. We believe such a technique will be a standard tool in future development of LCAs. For Hypergraph Coloring, we need to also address the second issue raised above. The original LCA for Hypergraph Coloring in [25] emulates Alon's algorithm [2]. Alon's algorithm runs in three phases. During the first phase, it colors all vertices in an arbitrary order. Such an algorithm looks "global" in nature and it is therefore non-trivial to turn it into an LCA. In [25], they use the order of vertices being queried as the order of coloring in Alon's algorithm, hence the algorithm needs to store all answers to previous queries and requires linear space in computation. We take a different approach to overcome this difficulty. Observe that there is some "local" dependency among the colors of vertices -- namely, the color of any vertex depends only on the colors of at most a constant number, say D, other vertices. The colors of these vertices in turn depend on the colors of their neighboring vertices, and so on. We can model the hypergraph coloring process by a query tree: Suppose the color of vertex x is now queried. Then the root node of the query tree is x, the nodes on the first level are the vertices whose colors the color of x depends on. In general, the colors of nodes on level i depends on1 the colors of nodes on level i + 1. Note that the query tree has degree bound D and moreover, the size of the query tree clearly depends on the order in which vertices are colored, since the color of a vertex depends only on vertices that are colored before it. In particular, if x is the kth vertex to be colored, then the query tree contains at most k vertices. An important fact to note is that Alon's algorithm works for any order, in particular, it works for a random order. Therefore we can apply the random order method of Nguyen and Onak [20]: generate a random number r ∈ [0, 1], called the rank, and use these ranks to prune the original query tree into a random query tree T . Specifically, T is defined recursively: the root of T is still x. A node z is in T if its parent node y in the original query tree is in T and r(z) < r(y). Intuitively, a random query tree is small and indeed it is surprisingly small [20]: the expected size of T is eD−1 D , a constant! Therefore, if we color the vertices in the hypergraph in a random order, the expected number of vertices we need to color is only a constant. However, such an "average case" result is insufficient for our LCA purpose: what we need is a "worst case" result which tells almost surely how large a random query tree will be. In other words, we need a concentration result on the sizes of the random query trees. The previous techniques in [20, 28] do not seem to work in this setting. Consider the worst case in which the rank of the root node x is 1. A key observation is, although there are D child nodes of x, only the nodes whose ranks are close to 1 are important, as the child nodes with smaller ranks will die out quickly. But in expectation there will be very few important nodes! This inspires 1In fact, they may depend on the colors of some nodes on levels lower than i. However, as we care only about query complexity, we will focus on the worst case that the query relations form a tree. 2 us to partition the random query tree into D + 1 levels based on the ranks of the nodes, and analyze the sizes of trees on each level using the theory of branching processes. In particular, we apply a quantitative bound on the total number of off-springs of a Galton-Watson process [22] to show that, for any m > 0, with probability at least 1 − 1/m2 the size of a random query tree has at most C(D) logD+1 m vertices, where C(D) is some constant depending only on D. We conjecture that the upper bound can be further reduced to C(D) log m. However, the random order approach raise another issue: how do we store the ranks of all vertices? Ob- serve that in constructing a random query tree, the actual values of the ranks are never used -- only the relative orders between vertices matter. This fact together with the fact that all computations are local enables us to replace the rank function with some pseudorandom ordering among the vertices, see Section 4 for formal definition and construction. The space complexity of the pseudorandom ordering is only polylogarithmic, thus making the total space complexity of the LCA also polylogarithmic. 1.3 Other related work Locally decodable codes [9] which given an encoding of a message, provide quick access to the requested bits of the original message, can be viewed as LCAs. Known constructions of LDCs are efficient and use small space [27]. LCAs generalize the reconstruction models described in [1, 6, 26, 7]. These models describe scenarios where an input string that has a certain property, such as monotonicity, is assumed to be corrupted at a relatively small number of locations. The reconstruction algorithm gives fast query access to an uncorrupted version of the string that is close to the original input. Most of the works mentioned are also efficient in terms of space. In [24], it is noted that the model of LCAs is related to local algorithms, studied in the context of distributed computing [19, 17, 12, 13, 14, 11, 10]. This is due to a reduction given by Parnas Ron [23] which allows one to construct (sequential) LCAs based on constant round distributed algorithms. Note that this relationship does not immediately yield space-efficient local algorithms, nor does it yield sub-linear time LCAs when used with parallel or distributed algorithms whose round complexity is O(log n). Recent exciting developments in sublinear time algorithms for sparse graph and combinatorial optimiza- tion problems have led to new constant time algorithms for approximating the size of a minimum vertex cover, maximal matching, maximum matching, minimum dominating set, minimum set cover, packing and covering problems (cf. [23, 16, 20, 28]). For example, for Maximal Independent Set, these algorithms con- struct a constant-time oracle which for most, but not all, vertices outputs whether or not the vertex is part of the independent set. For the above approximation algorithms, it is not necessary to get the correct answer for each vertex, but for LCAs, which must work for any sequence of online inputs, the requirements are more stringent, thus the techniques are not applicable without modification. 1.4 Organization The rest of the paper is organized as follows. Some preliminaries and notations that we use throughout the paper appear in Section 2. We then prove our main technical result, namely the bound on the sizes of random query trees in Section 3. In Section 4 we construct pseudorandom orderings with small space. Finally we apply the techniques developed in Section 3 and Section 4 to construct LCAs for the hypergraph coloring problem and the maximal independent set problem in Section 5 and Section 6, respectively. 3 2 Preliminaries Unless stated otherwise, all logarithms in this paper are to the base 2. Let n ≥ 1 be a natural number. We use [n] to denote the set {1, . . . , n}. All graphs in this paper are undirected graphs. Let G = (V, E) be a graph. The distance between two vertices u and v in V (G), denoted by dG(u, v), is the length of a shortest path between the two vertices. We write NG(v) = {u ∈ V (G) : (u, v) ∈ E(G)} to denote the neighboring vertices of v. Furthermore, let N + G (v) = N (v) ∪ {v}. Let dG(v) denote the degree of a vertex v. 2.1 Local computation algorithms We present our model of local computation algorithms: Let F be a computational problem and x be an input to F . Let F (x) = {y y is a valid solution for input x}. The search problem is to find any y ∈ F (x). Definition 2.1 ((t, s, δ)-local algorithms [25]). Let x and F (x) be defined as above. A (t(n), s(n), δ(n))- local computation algorithm A is a (randomized) algorithm which implements query access to an arbitrary y ∈ F (x) and satisfies the following: A gets a sequence of queries i1, . . . , iq for any q > 0 and after each query ij it must produce an output yij satisfying that the outputs yi1, . . . , yiq are substrings of some y ∈ F (x). The probability of success over all q queries must be at least 1 − δ(n). A has access to a random tape and local computation memory on which it can perform current computations as well as store and retrieve information from previous computations. We assume that the input x, the local computation tape and any random bits used are all presented in the RAM word model, i.e., A is given the ability to access a word of any of these in one step. The running time of A on any query is at most t(n), which is sublinear in n, and the size of the local computation memory of A is at most s(n). Unless stated otherwise, we always assume that the error parameter δ(n) is at most some constant, say, 1/3. We say that A is a strongly local computation algorithm if both t(n) and s(n) are upper bounded by logc n for some constant c. Two important properties of LCAs are as follows: Definition 2.2 (Query oblivious[25]). We say an LCA A is query order oblivious (query oblivious for short) if the outputs of A do not depend on the order of the queries but depend only on the input and the random bits generated on the random tape of A. Definition 2.3 (Parallelizable[25]). We say an LCA A is parallelizable if A supports parallel queries, that is the LCA is able to answer multiple queries simultaneously so that all the answers are consistent. 2.2 k-wise independent random variables Let 1 ≤ k ≤ n be an integer. A distribution D : {0, 1}n → R≥0 is k-wise independent if restricting D to any index subset S ⊂ [n] of size at most k gives rise to a uniform distribution. A random variable is said to be k-wise independent if its distribution function is k-wise independent. Recall that the support of a distribution D, denoted supp(D), is the set of points at which D(x) > 0. We say a discrete distribution D is symmetric if D(x) = 1/supp(D) for every x ∈ supp(D). If a distribution D : {0, 1}n → R≥0 is symmetric with supp(D) ≤ 2m for some m ≤ n, then we may index the elements in the support of D by {0, 1}m and call m the seed length of the random variable whose distribution is D. We will need the following construction of k-wise independent random variables over {0, 1}n with small symmetric sample space. 4 Theorem 2.4 ([3]). For every 1 ≤ k ≤ n, there exists a symmetric distribution D : {0, 1}n → R≥0 of support size at most n⌊ k 2 ⌋ and is k-wise independent. That is, there is a k-wise independent random variable x = (x1, . . . , xn) whose seed length is at most O(k log n). Moreover, for any 1 ≤ i ≤ n, xi can be computed in space O(k log n). 3 Bounding the size of a random query tree 3.1 The problem and our main result Consider the following scenario which was first studied by [20] in the context of constant-time approxi- mation algorithms for maximal matching and some other problems. We are given a graph G = (V, E) of bounded degree D. A real number r(v) ∈ [0, 1] is assigned independently and uniformly at random to every vertex v in the graph. We call this random number the rank of v. Each vertex in the graph G holds an input x(v) ∈ R, where the range R is some finite set. A randomized Boolean function F is defined inductively on the vertices in the graph such that F (v) is a function of the input x(v) at v as well as the values of F at the neighbors w of v for which r(w) < r(v). The main question is, in order to compute F (v0) for any vertex v0 in G, how many queries to the inputs of the vertices in the graph are needed? Here, for the purpose of upper bounding the query complexity, we may assume for simplicity that the graph G is D-regular and furthermore, G is an infinite D-regular tree rooted at v0. It is easy to see that making such modifications to G can never decrease the query complexity of computing F (v0). Consider the following question. We are given an infinite D-regular tree T rooted at v0. Each node w in T is assigned independently and uniformly at random a real number r(w) ∈ [0, 1]. For every node w other than v0 in T , let parent(w) denote the parent node of w. We grow a (possibly infinite) subtree T of T rooted at v as follows: a node w is in the subtree T if and only if parent(w) is in T and r(w) < r(parent(w)) (for simplicity we assume all the ranks are distinct real numbers). That is, we start from the root v, add all the children of v whose ranks are smaller than that of v to T . We keep growing T in this manner where a node w′ ∈ T is a leaf node in T if the ranks of its D children are all larger than r(w′). We call the random tree T constructed in this way a query tree and we denote by T the random variable that corresponds to the size of T . We would like to know what are the typical values of T . Following [20, 21], we have that, for any node w that is at distance t from the root v0, Pr[w ∈ T ]=1/(t+1)! as such an event happens if and only if the ranks of the t + 1 nodes along the shortest path from v0 to w is in monotone decreasing order. It follows from linearity of expectation that the expected value of T is given by the elegant formula [21] E[T ] = ∞ Xt=0 Dt (t + 1)! = eD − 1 D , which is a constant depending only on the degree bound D. Our main result in this section can be regarded as showing that in fact T is highly concentrated around its mean: Theorem 3.1. For any degree bound D ≥ 2, there is a constant C(D) which depends on D only such that for all large enough N , Pr[T > C(D) logD+1 N ] < 1/N 2. 5 3.2 Breaking the query tree into levels A key idea in the proof is to break the query tree into levels and then upper bound the sizes of the subtrees D+1 , 1 − i−1 on each level separately. First partition the interval [0, 1] into D + 1 sub-intervals: Ii := (1 − i D+1 ] 1 for i = 1, 2, . . . , D and ID+1 = [0, D+1 ]. We then decompose the query tree T into D + 1 levels such that a node v ∈ T is said to be on level i if r(v) ∈ Ii. For ease of exposition, in the following we consider the worst case that r(v0) ∈ I1. Then the vertices of T on level 1 form a tree which we call T1 = T (1) rooted at v0. The vertices of T on level 2 will in general form a set of trees {T (1) }, where the total number of such trees m2 is at most D times the number of nodes in T1 (we have only inequality here because some of the child nodes in T of the nodes in T1 may fall into levels 2, 3, etc). Finally the nodes on level D + 1 form a forest {T (1) i } are generated by the same stochastic process, as the ranks of all nodes in T are i.i.d. random variables. The next lemma shows that each of the subtrees on any level is of size O(log N ) with probability at least 1 − 1/N 3, }. Note that all these trees {T (j) , . . . , T (m2) D+1, . . . , T (mD+1) D+1 2 2 1 Lemma 3.2. For any 1 ≤ i ≤ D + 1 and any 1 ≤ j ≤ mi, with probability at least 1 − 1/N 3, T (j) O(log N ). i = One can see that Theorem 3.1 follows directly from Lemma 3.2: Once again we consider the worst case that r(v0) ∈ I1. By Lemma 3.2, the size of T1 is at most O(log N ) with probability at least 1 − 1/N 3. In what follows, we always condition our argument upon that this event happens. Notice that the root of any tree on level 2 must have some node in T1 as its parent node; it follows that m2, the number of trees on level 2, is at most D times the size of T1, hence m2 = O(log N ). Now applying Lemma 3.2 to each of the m2 trees on level 2 and assume that the high probability event claimed in Lemma 3.2 happens in each of the subtree cases, we get that the total number of nodes at level 2 is at most O(log2 N ). Once again, any tree on level 3 must have some node in either level 1 or level 2 as its parent node, so the total number of trees on level 3 is also at most D(O(log N ) + O(log2 N )) = O(log2 N ). Applying this argument inductively, we get that mi = O(logi−1 N ) for i = 2, 3, . . . , D + 1. Consequently, the total number of nodes at all D + 1 levels is at most O(log N ) + O(log2 N ) + · · · + O(logD+1 N ) = O(logD+1 N ), assuming the high probability event in Lemma 3.2 holds for all the subtrees in all the levels. By the union bound, this happens with probability at least 1 − O(logD+1 N )/N 3 > 1 − 1/N 2, thus proving Theorem 3.1. The proof of Lemma 3.2 requires results in branching processes, in particular the Galton-Watson pro- cesses. 3.3 Galton-Watson processes Consider a Galton-Watson process defined by the probability function p := {pk; k = 0, 1, 2, . . .}, with pk ≥ 0 and Pk pk = 1. Let f (s) = P∞ k=0 pksk be the generating function of p. For i = 0, 1, . . . , let Zi be the number of off-springs in the ith generation. Clearly Z0 = 1 and {Zi : i = 0, 1, . . .} form a Markov chain. Let m := E[Z1] = Pk kpk be the expected number of children of any individual. The classical result of the Galton-Watson processes is that the survival probability (namely limn→∞ Pr[Zn > 0]) is zero if and only if m ≤ 1. Let Z = Z0 + Z1 + · · · be the sum of all off-springs in all generations of the Galton-Watson process. The following result of Otter is useful in bounding the probability that Z is large. Theorem 3.3 ([22]). Suppose p0 > 0 and that there is a point a > 0 within the circle of convergence of f for which af ′(a) = f (a). Let α = a/f (a). Let t = gcd{r : pr > 0}, where gcd stands for greatest common divisor. Then 6 Pr[Z = n] =   a 2παf ′′(a)(cid:17)1/2 t(cid:16) 0, α−nn−3/2 + O(α−nn−5/2), if n ≡ 1 (mod t); if n 6≡ 1 (mod t). (1) In particular, if the process is non-arithmetic, i.e. gcd{r : pr > 0} = 1, and a αf ′′(a) is finite, then Pr[Z = n] = O(α−nn−3/2), and consequently Pr[Z ≥ n] = O(α−n). 3.4 Proof of Lemma 3.2 To simplify exposition, we prove Lemma 3.2 for the case of tree T1. Recall that T1 is constructed recursively as follows: for every child node v of v0 in T , we add v to T1 if r(v) < r(v0) and r(v) ∈ I1. Then for every child node v of v0 in T1, we add the child node w of v in T to T1 if r(w) < r(v) and r(w) ∈ I1. We repeat this process until there is no node that can be added to T1. Once again, we work with the worst case that r(v0) = 1. To upper bound the size of T1, we consider a 1. The process that 1 and w is a child node of v 1 as long as r(w) ∈ I1, but give up the requirement that r(w) < r(v). Clearly, we related random process which also grows a subtree of T rooted at v0, and denote it by T ′ grows T ′ in T , then we add w to T ′ always have T1 ⊆ T ′ 1 is the same as that of T1 except for the following difference: if v ∈ T ′ 1 and hence T ′ 1 ≥ T1. Note that the random process that generates T ′ 1 is in fact a Galton-Watson process, as the rank of each node in T is independently and uniformly distributed in [0, 1]. Since I1 = 1/(D + 1), the probability function is p = {(1 − q)D,(cid:18)D 1(cid:19)q(1 − q)D−1,(cid:18)D 2(cid:19)q2(1 − q)D−2, . . . , qD}, where q := 1/(D + 1) is the probability that a child node in T appears in T ′ Note that the expected number of children of a node in T ′ tree with probability one. 1 is Dq = D/(D + 1) < 1, so the tree T ′ 1 when its parent node is in T ′ 1. 1 is a finite The generating function of p is f (s) = (1 − q + qs)D, as the probability function {pk} obeys the binomial distribution pk = b(k, D, q). In addition, the conver- gence radius of f is ρ = ∞ since {pk} has only a finite number of non-zero terms. Solving the equation af ′(a) = f (a) yields a = 1−q q(D−1) = D D−1. It follows that (since D ≥ 2) D − 1(cid:19)D−2 1 − q > 0, f ′′(a) = q2D(D − 1)(cid:18)1 − q + hence the coefficient in (1) is non-singular. 7 Let α(D) := a/f (a) = 1/f ′(a), then 1/α(D) = f ′(a) = D D + 1 ( )D−1 D2 D2 − 1 1 )(D2−1)/(D+1) D D + 1 = (1 + D2 − 1 < e1/(D+1) D < (cid:18)(1 + 1 D D + 1 )D+1(cid:19)1/(D+1) D D + 1 where in the third and the fourth steps we use the inequality (see e.g. [18]) that (1 + 1 for any positive integer t. This shows that α(D) is a constant greater than 1. t )t < e < (1 + 1 t )t+1 = 1, case) gives that, for all large enough n, Pr[T ′ Now applying Theorem 3.3 to the Galton-Watson process which generates T ′ 1 (note that t = 1 in our 1 ≥ i=n 2−ci ≤ 2−Ω(n) for all large enough n. Hence for all large enough N, with probability at least 1 = n] ≤ 2−cn for some constant c. It follows that Pr[T ′ 1 − 1/N 3, T1 ≤ T ′ 1 = O(log N ). This completes the proof of Lemma 3.2. n] ≤ P∞ 4 Construction of almost k-wise independent random orderings An important observation that enables us to make some of our local algorithms run in polylogarithmic space is the following. In the construction of a random query tree T , we do not need to generate a random real number r(v) ∈ [0, 1] independently for each vertex v ∈ T ; instead only the relative orderings among the vertices in T matter. Indeed, when generating a random query tree, we only compare the ranks between a child node w and its parent node v to see if r(w) < r(v); the absolute values of r(w) and r(v) are irrelevant and are used only to facilitate our analysis in Section 3. Moreover, since (almost surely) all our computations in the local algorithms involve only a very small number of, say at most k, vertices, so instead of requiring a random source that generates total independent random ordering among all nodes in the graph, any pseudorandom generator that produces k-wise independent random ordering suffices for our purpose. We now give the formal definition of such orderings. Let m ≥ 1 be an integer. Let D be any set with m elements. For simplicity and without loss of generality, we may assume that D = [m]. Let R be a totally ordered set. An ordering of [m] is an injective function r : [m] → R. Note that we can project r to an element in the symmetric permutation group Sm in a natural way: arrange the elements {r(1), . . . , r(m)} in R in the monotone increasing order and call the permutation of [m] corresponding to this ordering the projection of r onto Sm and denote it by PSmr. In general the projection PSm is not injective. Let r = {ri}i∈I be any family of orderings indexed by I. The random ordering Dr of [m] is a distribution over a family of orderings r. For any integer 2 ≤ k ≤ m, we say a random ordering Dr is k-wise independent if for any subset S ⊆ [m] of size k, the restriction of the projection onto Sm of Dr over S is uniform over all the k! possible orderings among the k elements in S. A random ordering Dr is said to ǫ-almost k-wise independent if the statistical distance between Dr is at most ǫ from some k-wise independent random ordering. Note that our definitions of k-wise independent random ordering and almost k-wise independent random ordering are different from that of k-wise independent permutation and almost k-wise independent permutation (see e.g. [8]), where the latter requires that the function to be a permutation (i.e., the domain and the range of the function are the same set). In this 8 1 m2 -almost k-wise independent random ordering whose seed length is section we give a construction of O(k log2 m). In our later applications k = polylogm so the seed length of the almost k-wise independent random ordering is also polylogarithmic. Theorem 4.1. Let m ≥ 2 be an integer and let 2 ≤ k ≤ m. Then there is a construction of 1 k-wise independent random ordering over [m] whose seed length is O(k log2 m). m2 -almost Proof. For simplicity we assume that m is a power of 2. Let s = 4 log m. We generate s independent copies of k-wise independent random variables Z1, . . . , Zs with each Zℓ, 1 ≤ ℓ ≤ s, in {0, 1}m. By Theorem 2.4, the seed length of each random variable Zℓ is O(k log m) and therefore the total space needed to store these random seeds is O(k log2 m). Let these k-wise independent m-bit random variables be Z1 = z1,1, . . . , z1,m; Z2 = z2,1, . . . , z2,m; . . . . . . Zs = zs,1, . . . , zs,m. Now for every 1 ≤ i ≤ m, we view each r(i)def= z1,iz2,i · · · zs,i as an integer in {0, 1, . . . , 2s − 1} written in the s-bit binary representation and use r : [m] → {0, 1, . . . , 2s − 1} as the ranking function to order the m elements in the set. We next show that, with probability at least 1 − 1/m2, r(1), . . . , r(m) are distinct m integers. Let 1 ≤ i < j ≤ m be any two distinct indices. For every 1 ≤ ℓ ≤ s, since zℓ,1, . . . , zℓ,m are k-wise independent and thus also pair-wise independent, it follows that Pr[zℓ,i = zℓ,j] = 1/2. Moreover, as all Z1, . . . , Zs are independent, we therefore have Pr[r(i) = r(j)] = Pr[zℓ,i = zℓ,j for every 1 ≤ ℓ ≤ s] s Pr[zℓ,i = zℓ,j] = Yℓ=1 = (1/2)s = 1/m4. 1 − 1/m2, all these m numbers are distinct. Applying a union bound argument over all (cid:0)m 2(cid:1) distinct pairs of indices gives that with probability at least Since each Zℓ, 1 ≤ ℓ ≤ s, is a k-wise independent random variable in {0, 1}m, therefore for any subset {i1, . . . , ik} of k indices, (r(i1), . . . , r(ik)) is distributed uniformly over all 2ks tuples. By symmetry, conditioned on that r(i1), . . . , r(ik) are all distinct, the restriction of the ordering induced by the ranking function r to {i1, . . . , ik} is completely independent. Finally, since the probability that r(1), . . . , r(m) 1 are not distinct is at most 1/m2, it follows that the random ordering induced by r is m2 -almost k-wise independent. 5 LCA for Hypergraph Coloring We now apply the technical tools developed in Section 3 and Section 4 to the design and analysis of LCAs. Recall that a hypergraph H is a pair H = (V, E) where V is a finite set whose elements are called nodes or vertices, and E is a family of non-empty subsets of V , called hyperedges. A hypergraph is called 9 k-uniform if each of its hyperedges contains precisely k vertices. A two-coloring of a hypergraph H is a mapping c : V → {red, blue} such that no hyperedge in E is monochromatic. If such a coloring exists, then we say H is two-colorable. In this paper we assume that each hyperedge in H intersects at most d other hyperedges. Let N be the number of hyperedges in H. Here and after we think of k and d as fixed constants and all asymptotic forms are with respect to N. By the Lovász Local Lemma (see, e.g. [4]) when e(d + 1) ≤ 2k−1, the hypergraph H is two-colorable. Following [25], we let m be the total number of vertices in H. Note that m ≤ kN, so m = O(N ). For any vertex x ∈ V , we use E(x) to denote the set of hyperedges x belongs to. For any hypergraph H = (V, E), we define a vertex-hyperedge incidence matrix M ∈ {0, 1}m×N so that, for every vertex x and every hyperedge e, Mx,e = 1 if and only if e ∈ E(x). Because we assume both k and d are constants, the incidence matrix M is necessarily very sparse. Therefore, we further assume that the matrix M is implemented via linked lists for each row (that is, vertex x) and each column (that is, hyperedge e). Let G be the dependency graph of the hyperedges in H. That is, the vertices of the undirected graph G are the N hyperedges of H and a hyperedge Ei is connected to another hyperedge Ej in G if Ei ∩ Ej 6= ∅. It is easy to see that if the input hypergraph is given in the above described representation, then we can find all the neighbors of any hyperedge Ei in the dependency graph G (there are at most d of them) in O(log N ) time. 5.1 Overview of Alon's algorithm We now give a sketch of Alon's algorithm [2]; for a detailed description of the algorithm in the context of LCA see [25]. The algorithm runs in three phases. In the first phase, we go over all the vertices in the hypergraph in any order and color them in {red, blue} uniformly at random. During this process, if any hyperedge has too many vertices (above some threshold) in it are colored in one color and no vertex is colored in the other color, then this hyperedge is said to become dangerous. All the uncolored vertices in the dangerous hyperedges are then frozen and will be skipped during Phase 1 coloring. A hyperedge is called survived if it does not have vertices in both colors at the end of Phase 1. The basic lemma, based on the breakthrough result of Beck [5], claims that after Phase 1, almost surely all connected components of the dependency graph H of survived hyperedges are of sizes at most O(log N ). We then proceed to the second phase of the algorithm which repeats the same coloring process (with some different threshold parameter) for each connected component and gives rise to connected components of size O(log log N ). Finally in the third phase we perform a brute- force search for a valid coloring whose existence is guaranteed by the Lovász local lemma. As each of the connected components in Phase 3 has at most O(log log N ) vertices, the running time of each brute force search is thus bounded by polylogN. To turn Alon's algorithm into an LCA, Rubinfeld et al. [25] note that one may take the order that vertices are queried as the order to color the vertices and then in Phase 2 and Phase 3 focus only on the connected components in which the queried vertex lie. This leads to an LCA with polylogarithmic running time but the space complexity can be linear in the worst case (as the algorithm needs to remember the colors of all previously queried or colored vertices). In addition, the LCA is not query oblivious and not easily parallelizable. 5.2 New LCA for Hypergraph Coloring To remedy these, we add several new ingredients to the LCA in [25] and achieve an LCA with both time and space complexity are polylogarithmic. In addition, the LCA is query oblivious and easily parallelizable. 10 1st ingredient: bounded-degree dependency. We first make use of the following simple fact: the color of any fixed vertex in the hypergraph depends only on the colors of a very small number of vertices. Specif- ically, if vertex x lies in hyperedges E1, . . . , Ed′, then the color of x depends only on the colors of all the vertices in E1, . . . , Ed′. As every hyperedge is k-uniform and each hyperedge intersects at most d other hyperedges, the color of any vertex depends on at most the colors of D = k(d + 1) other vertices. 2nd ingredient: random permutation. Note that in the first phase of Alon's coloring algorithm, any order of the vertices will work. Therefore, we may apply the idea of random ordering in [20]. Specifically, suppose we are given a random number generator r : [m] → [0, 1] which assign a random number uniformly and independently to every vertex in the hypergraph. Suppose the queried vertex is x. Then we build a (random) query tree T rooted at x using BFS as follows: there are at most D other vertices such that the color of x depends on the colors of these vertices. Let y be any of such vertex. If r(y) < r(x), i.e. the random number assigned to y is smaller than that of x, then we add y as a child node of x in T . We build the query tree this way recursively until there is no child node can be added to T . By Theorem 3.1, with probability at least 1 − 1/m2, the total number of nodes in T is at most polylogm and is thus also at most polylogN. This implies that, if we color the vertices in T in the order from bottom to top (that is, we color the leaf nodes first, then the parent nodes of the leaf nodes and so on, and color the root node x last), then for any vertex x, with probability at least 1 − 1/m2 we can follow Alon's algorithm and color at most polylogN vertices (and ignore all other vertices in the hypergraph) before coloring x. Therefore the running time of the first phase of our new LCA is (almost surely) at most polylogN. 3rd ingredient: k-wise independent random ordering. The random permutation method requires linear space to store all the random numbers that have been revealed in previous queries in order to make the answers consistent. However, two useful observations enable us to reduce the space complexity of random ordering from linear to polylogarithmic. First, only the relative orderings among vertices matter: in building the query tree T we only check if r(y) < r(x) but the absolute value of r(x) and r(y) are irrelevant. There- fore we can replace the random number generator r with an equivalent random ordering function r ∈ Sm, where Sm is the symmetric group on m elements. Second, as the query tree size is at most polylogarith- mic almost surely, the random ordering function r need not be totally random but a polylogarithmic-wise independent permutation suffices2. Therefore we can use the construction in Theorem 4.1 of 1 m2 -almost k-wise independent random ordering of all the vertices in the hypergraph with k = polylogN. The space complexity of such a random ordering, or the seed length, is O(k log2 m) = polylogN. 4th ingredient: k-wise independent random coloring. Finally, the space complexity for storing all the random colors assigned to vertices is also linear in worst case. Once again we exploit the fact that all computations in LCAs are local to reduce the space complexity. Specifically, the proof of the basic lemma of Alon's algorithm (see e.g. [4, Claim 5.7.2]) is valid as long as the random coloring of the vertices is c log N- wise independent, where c is some absolute constant. Therefore we can replace the truly random numbers in {0, 1}m used for coloring with a c log N-wise independent random numbers in {0, 1}m constructed in Theorem 2.4 thus reducing the space complexity of storing random colors to O(log2 N ). 5.3 Pseudocode of the LCA and main result To put everything together, we have the following LCA for Hypergraph Coloring as illustrated in Fig. 1, Fig. 2 and Fig. 3. In the preprocessing stage, the algorithm generates O( log N log log N ) copies of pseudo-random 2 Since the full query tree has degree bound D, so the total number of nodes queried in building the random query tree T is at most DT , which is also at most polylogarithmic. 11 LCA for Hypergraph Coloring Preprocessing: 1. generate O( log N 2. generate a 1 log log N ) copies of c log N -wise independent random variables in {0, 1}m m2 -almost polylogN -wise independent random ordering over [m] Input: a vertex x ∈ V Output: a color in {red, blue} 1. Use BFS to grow a random query tree T rooted at x 2. Color the vertices in T bottom up 3. If x is colored red or blue, return the color Else run Phase 2 Coloring(x) Figure 1: Local computation algorithm for Hypergraph Coloring colors for every vertex in the hypergraph and a pseudorandom ordering of all the vertices. To answer each query, the LCA runs in three phases. Suppose the color of vertex x is queried. During the first phase, the algorithm uses BFS to build a random query tree rooted at x and then follows Alon's algorithm to color all the vertices in the query tree. If x gets colored in Phase 1, the algorithm simply returns that color; if x is frozen in Phase 1, then Phase 2 coloring is invoked. In the second phase, the algorithm first explores the connected components around x of survived hyperedges. Then Alon's algorithm is performed again, but this time only on the vertices in the connected component. For some technical reason, the random log log N ) times3, until a good coloring is found which makes all the surviving coloring process is repeated O( log N connected components after Phase 2 very small. If x gets colored in the good coloring, then that color is returned; otherwise the algorithm runs the last phase, in which a brute-force search is performed to find the color of x. The time and space complexity as well as the error bound of the LCA are easy to analyze and we have the following main result of LCA for Hypergraph Coloring: Theorem 5.1. Let d and k be such that there exist three positive integers k1, k2 and k3 such that the follow- ings hold: k1 + k2 + k3 = k, 16d(d − 1)3(d + 1) < 2k1, 16d(d − 1)3(d + 1) < 2k2, 2e(d + 1) < 2k3. Then there exists a (polylogN, polylogN, 1/N )-local computation algorithm which, given a hypergraph H and any sequence of queries to the colors of vertices (x1, x2, . . . , xs), returns a consistent coloring for all xi's which agrees with some 2-coloring of H. 6 LCA for Maximal Independent Set Recall that an independent set (IS) of a graph G is a subset of vertices such that no two vertices in the set are adjacent. An independent set is called a maximal independent set (MIS) if it is not properly contained in any other IS. 3This is why the algorithm generates many copies of independent pseudorandom colorings at the beginning of the LCA. 12 Phase 2 Coloring(x) Input: a vertex x ∈ V Output: a color in {red, blue} or FAIL 1. Start from E(x) to explore G in order to find the connected component C1(x) of survived hyperedges around x 2. If the size of the component is larger than c2 log N Abort and return FAIL 3. Repeat the following O( log N log log N ) times and stop if a good coloring is founda (a) Color all the vertices in C1(x) uniformly at random (b) Explore the dependency graph of GS1(x) (c) Check if the coloring is good 4. If x is colored in the good coloring, return that color Else run Phase 3 Coloring(x) a Following [25], let S1(x) be the set of surviving hyperedges in C1(x) after all vertices in C1(x) are either colored or are frozen. Now we explore the dependency graph of S1(x) to find out all the connected components. We say a Phase 2 coloring is good if all connected components in GS1 (x) have sizes at most c3 log log N, where c3 is some absolute constant. Figure 2: Local computation algorithm for Hypergraph Coloring: Phase 2 Phase 3 Coloring(x) Input: a vertex x ∈ V Output: a color in {red, blue} 1. Start from E(x) to explore G in order to find the connected component of all the survived hyperedges around x 2. Go over all possible colorings of the connected component and color it using a feasible coloring. 3. Return the color c of x in this coloring. Figure 3: Local computation algorithm for Hypergraph Coloring: Phase 3 13 In [24, 25], a two-phase LCA is presented for MIS. For completeness, we present the pseudocode of the LCA in Appendix A. Let G be a graph with maximum degree d and suppose the queried vertex is v. In the first phase, the LCA simulates Luby's algorithm for MIS [15]. However, instead of running the parallel algorithm for O(log n) rounds as the original Luby's algorithm, the LCA simulates the parallel algorithm for only O(d log d) rounds. Following an argument of Parnas and Ron [23], the sequential running time for simulating the parallel algorithm to determine whether a given node is in the MIS is dO(log d). If v or any of v's neighbors is put into the independent set during the first phase, then the algorithm return "Yes" or "No", respectively. If, on the other hand, v lies in some connected component of "surviving" vertices after running the first phase, then the algorithm proceeds to the second phase algorithm, in which a simple linear-time greedy search for an MIS of the component is performed. A key result proved in [24, 25] is that, after the first phase of the algorithm, almost surely all connected components have sizes at most O(poly(d) log n). Therefore the running time4 of the second phase is dO(log d) log n. To implement such a two-phase LCA and ensure that all answers are consistent, we need to maintain a random tape that keeps a record of all the generated random bits during previous runs, which implies the space complexity of the LCA is linear in the worst case. To see this, suppose two vertices u and v are connected in G and u is queried first. Suppose further that the LCA runs on u and finds out during the first phase that u is in the IS. If vertex v is queried at some time later, we need to ensure that, when simulating Luby's algorithm u is put in the IS in some round (hence v is deleted in the round after that). This in turn requires that we retrieve the random bits used during the run of LCA on u. A simple but crucial observation which enables us to reduce the space complexity of the LCA for MIS is, since all the computations are "local", we may replace the truly random bits used in the algorithm with random bits of limited independence constructed in Theorem 2.4. First we round the degree bound of G to d = 2⌈log d⌉. Note that d ≤ d < 2d. Now we can generate the probability 1/2 d used in Luby's algorithm (c.f. Figure 4) by tossing log d = ⌈log d⌉ independent fair coins. Since the second phase of the LCA is deterministic, we can therefore focus on the first phase only. The running time of the first phase is shown to be dO(log d) [25]. Following the notation in [25], for a vertex v in G, let Av be the event that v is a surviving vertex at the end of Phase 1 and let Bv be the event that v is in state "⊥" after running MISB for O(d log d) rounds, where MISB is a variant of MIS, a subroutine of the first phase algorithm. It was shown in [25] that Av ⊆ Bv (Claim 4.2) and for any subset of vertices W , Pr[all vertices in W are surviving vertices] = Pr[∩v∈W Av] ≤ Pr[∩v∈W Bv]. Following the proof of Lemma 4.6 in [25], a graph H on the vertices V (G) is called a dependency graph for {Bv}v∈V (G) if for all v the event Bv is mutually independent of all Bu such that (u, v) /∈ H. Let H 3 denote the "distance-3" graph of H, that is, vertices u and v are connected in H 3 if their distance in H is exactly 3. Let W be a subset of vertices in H 3. Then, since all vertices in W are at least 3-apart, all the events {Bv}v∈W are mutually independent, it follows that the probability that all vertices in W are surviving vertices satisfies Pr[∩v∈W Bv] = Yv∈W Pr[Bv]. Finally in the proof of Lemma 4.6 in [25], the size of W is taken to be c1 log n for some constant c1 to 4Note that we need to run a BFS starting from v to explore the connected component in which v lies. Each step of the BFS incurs a run on the explored node of the first phase LCA. 14 show that, almost surely all connected components of surviving vertices after Phase 1 are of sizes at most poly(d) log n. Now we try to replace the true random bits used in the LCA in [25] with pseudorandom bits of limited independence. Firstly, since the running time of the first phase is dO(log d), hence this is also the running time of the algorithm if the subroutine MIS is replaced with MISB. It follows that each event Bv depends on at most dO(log d) · log d = dO(log d) random bits. Secondly, the argument we sketched in the last paragraph is still valid as long as the events {Bv}v∈H 3 are c1 log n-wise independent. Such a condition is satisfied if the random bits used in the algorithm are k-wise independent, where k = dO(log d) · c1 log n = dO(log d) log n. Note that the total number of random bits used during the first phase for all vertices is m = dO(log d) · n. Therefore all we need is a k-wise independent random variable in {0, 1}m. By Theorem 2.4, such random variables can be constructed with seed length O(k log m) = dO(d log d) log2 n and each random bit can be computed in time O(k log m) = dO(d log d) log2 n. To put everything together, we proved the following theorem regarding the LCA for MIS5: Theorem 6.1. Let G be an undirected graph with n vertices and maximum degree d. Then there is a dO(d log d) log3 n, dO(log d) log2 n, 1/n)-local computation algorithm which, on input a vertex v, decides if v is in a maximal independent set. Moreover, the algorithm will give a consistent MIS for every vertex in G. Acknowledgments We would like to thank Tali Kaufman and Krzysztof Onak for enlightening discussions. References [1] N. Ailon, B. Chazelle, S. Comandur, and D. Liu. Property-preserving data reconstruction. Algorith- mica, 51(2):160 -- 182, 2008. [2] N. Alon. A parallel algorithmic version of the Local Lemma. Random Structures and Algorithms, 2:367 -- 378, 1991. [3] N. Alon, L. Babai, and A. Itai. A fast and simple randomized algorithm for the maximal independent set problem. Journal of Algorithms, 7:567 -- 583, 1986. [4] N. Alon and J. Spencer. The Probabilistic Method. John Wiley and Sons, second edition, 2000. [5] J. Beck. An algorithmic approach to the Lovász Local Lemma. Random Structures and Algorithms, 2:343 -- 365, 1991. [6] B. Chazelle and C. Seshadhri. Online geometric reconstruction. In SoCG, pages 386 -- 394, 2006. [7] M. Jha and S. Raskhodnikova. Testing and reconstruction of Lipschitz functions with applications to data privacy. In Proc. 52nd Annual IEEE Symposium on Foundations of Computer Science, 2011. [8] E. Kaplan, M. Naor, and O. Reingold. Derandomized constructions of k-wise (almost) independent permutations. Algorithmica, 55(1):113 -- 133, 2009. 5Note that the space complexity of storing the pseudorandom bits dominates the space complexity of local computation for each query. 15 [9] J. Katz and L. Trevisan. On the efficiency of local decoding procedures for error-correcting codes. In Proc. 32nd Annual ACM Symposium on the Theory of Computing, pages 80 -- 86, 2000. [10] F. Kuhn. Local multicoloring algorithms: Computing a nearly-optimal tdma schedule in constant time. In STACS, pages 613 -- 624, 2009. [11] F. Kuhn and T. Moscibroda. Distributed approximation of capacitated dominating sets. In SPAA, pages 161 -- 170, 2007. [12] F. Kuhn, T. Moscibroda, T. Nieberg, and R. Wattenhofer. Fast deterministic distributed maximal inde- pendent set computation on growth-bounded graphs. In DISC, pages 273 -- 287, 2005. [13] F. Kuhn, T. Moscibroda, and R. Wattenhofer. The price of being near-sighted. In Proc. 17th ACM-SIAM Symposium on Discrete Algorithms, pages 980 -- 989, 2006. [14] F. Kuhn and R. Wattenhofer. On the complexity of distributed graph coloring. In Proc. 25th ACM Symposium on Principles of Distributed Computing, pages 7 -- 15, 2006. [15] M. Luby. A simple parallel algorithm for the maximal independent set problem. SIAM Journal on Computing, 15(4):1036 -- 1053, 1986. Earlier version in STOC'85. [16] S. Marko and D. Ron. Distance approximation in bounded-degree and general sparse graphs. In APPROX-RANDOM'06, pages 475 -- 486, 2006. [17] A. Mayer, S. Naor, and L. Stockmeyer. Local computations on static and dynamic graphs. In Proceed- ings of the 3rd Israel Symposium on Theory and Computing Systems (ISTCS), 1995. [18] D. S. Mitrinovi´c. Analytic inequalities. Springer-Verlag, 1970. [19] M. Naor and L. Stockmeyer. What can be computed locally? SIAM Journal on Computing, 24(6):1259 -- 1277, 1995. [20] H. N. Nguyen and K. Onak. Constant-time approximation algorithms via local improvements. In Proc. 49th Annual IEEE Symposium on Foundations of Computer Science, pages 327 -- 336, 2008. [21] K. Onak. New Sublinear Methods in the Struggle Against Classical Problems. PhD thesis, MIT, 2010. [22] R. Otter. The multiplicative process. Annals of mathematical statistics, 20(2):206 -- 224, 1949. [23] M. Parnas and D. Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theoretical Computer Science, 381(1 -- 3):183 -- 196, 2007. [24] R. Rubinfeld, G. Tamir, S. Vardi, and N. Xie. Fast local computation algorithms. In Proc. 2nd Sympo- sium on Innovations in Computer Science, pages 223 -- 238, 2011. [25] R. Rubinfeld, G. Tamir, S. Vardi, and N. Xie. Fast local computation algorithms. Technical report, April 2011. http://arxiv.org/abs/1104.1377. [26] M. E. Saks and C. Seshadhri. Local monotonicity reconstruction. SIAM Journal on Computing, 39(7):2897 -- 2926, 2010. 16 MAXIMAL INDEPENDENT SET: PHASE 1 Input: a graph G and a vertex v ∈ V Output: {"true", "false", "⊥"} For i from 1 to r = 20d log d (a) If MIS(v, i) = "selected" return "true" (b) Else if MIS(v, i) = "deleted" return "false" (c) Else return "⊥" MIS(v, i) Input: a vertex v ∈ V and a round number i Output: {"selected", "deleted", "⊥"} 1. If v is marked "selected" or "deleted" return "selected" or "deleted", respectively 2. For every u in N (v) If MIS(u, i − 1) = "selected" mark v as " deleted" and return "deleted" 3. v chooses itself independently with probability 1 2d If v chooses itself (i) For every u in N (v) If u is marked "⊥", u chooses itself independently with probability 1 2d (ii) If v has a chosen neighbor return "⊥" (iii) Else mark v as "selected" and return "selected" Else return "⊥" Figure 4: Local computation algorithm for MIS: Phase 1 [27] S. Yekhanin. Locally decodable codes. In 6th International Computer Science Symposium in Russia, pages 289 -- 290, 2011. [28] Y. Yoshida, Y. Yamamoto, and H. Ito. An improved constant-time approximation algorithm for maxi- mum matchings. In Proc. 41st Annual ACM Symposium on the Theory of Computing, pages 225 -- 234, 2009. A Pseudocode of the LCA for Maximal Independent Set In this section we present the pseudocode of the LCA for Maximal Independent Set. This is taken from [25] with slight modifications and we also refer interested readers to [25] for detailed description and analysis of the algorithm. 17 MISB(v, i) Input: a vertex v ∈ V and a round number i Output: {"picked", "⊥"} 1. If v is marked "picked" return "picked" 2. v chooses itself independently with probability 1 2d If v chooses itself (i) For every u in N (v) u chooses itself independently with probability 1 2d (ii) If v has a chosen neighbor return "⊥" (iii) Else mark v as "picked" and return "picked" Else return "⊥" Figure 5: Algorithm MISB MAXIMAL INDEPENDENT SET: PHASE 2 Input: a graph G and a vertex v ∈ V Output: {"true", "false"} 1. Run BFS starting from v to grow a connected component of surviving vertices (If a vertex u is in the BFS tree and w ∈ N (u) in G, then w is in the BFS tree if and only if running the first phase LCA on w returns "⊥") 2. (Run the greedy search algorithm on the connected component for an MIS) Set S = ∅ Scan all the vertices in the connected component in order If a vertex u is not deleted add u to S delete all the neighbors of u 3. If v ∈ S return "true" else "false" Figure 6: Local computation algorithm for MIS: Phase 2 18
1905.04941
1
1905
2019-05-13T10:08:07
An improved algorithm for the submodular secretary problem with a cardinality constraint
[ "cs.DS" ]
We study the submodular secretary problem with a cardinality constraint. In this problem, $n$ candidates for secretaries appear sequentially in random order. At the arrival of each candidate, a decision maker must irrevocably decide whether to hire him. The decision maker aims to hire at most $k$ candidates that maximize a non-negative submodular set function. We propose an $(\mathrm{e} - 1)^2 / (\mathrm{e}^2 (1 + \mathrm{e}))$-competitive algorithm for this problem, which improves the best one known so far.
cs.DS
cs
An improved algorithm for the submodular secretary problem with a cardinality constraint Kaito Fujii University of Tokyo [email protected] May 14, 2019 Abstract We study the submodular secretary problem with a cardinality constraint. In this problem, n can- didates for secretaries appear sequentially in random order. At the arrival of each candidate, a decision maker must irrevocably decide whether to hire him. The decision maker aims to hire at most k candidates that maximize a non-negative submodular set function. We propose an (e − 1)2/(e2(1 + e))-competitive algorithm for this problem, which improves the best one known so far. 1 Introduction In the classical secretary problem, a decision maker aims to hire the best one out of n candidates. Each candidate has a real value that expresses his skill. The decision maker knows only the number n of candidates in the beginning. The candidates appear in random order one by one, and at the arrival of each candidate, his value is revealed. Just after observing the value, the decision maker must decide whether to hire this candidate or not. This decision is irrevocable, and the decision maker can hire only one candidate. The goal of this problem is to hire the candidate with the largest value with probability as high as possible. An asymptotically optimal strategy for this problem was stated by Dynkin [6]. This strategy ignores the first ⌊n/e⌋ candidates without hiring and hires the first candidate better than these first ⌊n/e⌋ candidates. This algorithm hires the best one with probability at least 1/e [6]. A multiple-choice variant was proposed by Kleinberg [15]. In contrast to the classical secretary problem, k candidates can be selected in this variant, where k ∈ Z>0 is the maximum number of hired candidates. The decision maker knows n and k in advance. Let V be the set of all candidates and w : V → R≥0 a non-negative weight of each candidate. At each arrival of candidates, the decision maker must decide whether to hire the candidate or not according to the revealed value of the candidate. The objective is to maximize the sum of values of the hired candidates, that is, Pv∈S w(v), where S ⊆ V is the set of the hired candidates. As a further extension of the multiple-choice secretary problem, Bateni et al. [3] and Gupta et al. [13] proposed submodular secretary problems, in which the objective function f : 2V → R≥0 is not the sum of values of the hired candidates, but a submodular set function. A set function f : 2V → R≥0 is called submodular if it satisfies f (S ∪ {v}) − f (S) ≥ f (T ∪ {v}) − f (T ) for all S ⊆ T ⊆ V and v ∈ V \ T . We assume that for any subset S of candidates that already appeared, the value of f (S) can be computed in O(1) time. Among various constraints for submodular secretary problems, in this study we focus on cardinality constraints, under which the decision maker can hire at most k candidates out of n candidates. Submodular secretary problems have many applications. A key application is online auctions [2], in which the seller decides who gets products in an online fashion out of buyers declaring their bids one by one. One of the goals is to design a mechanism that maximizes the utility of the agents. Submodularity of utility functions is often assumed due to its equivalence to the property of diminishing returns. Also, submodular 1 secretary problems are applied to machine learning tasks such as stream-based active learning [12] and the interpretation of neural networks [7]. The quality of an algorithm for submodular secretary problems is evaluated by its competitive ratio. Let A(f, σ) ⊆ V be the (possibly randomized) output of algorithm A, where f : 2V → R≥0 is the objective function and σ ∈ Σn is a permutation of n candidates. The competitive ratio α(A) of an algorithm A is defined as α(A) = inf f E[f (A(f, σ))] maxS ∗⊆V f (S∗) , where the expectation is taken over the random permutation and random factors in the algorithm. 1.1 Related work For the multiple-choice secretary problem, that is, the case where f is a linear function, (1 − O(1/√k))- competitive [15] and (1/e)-competitive [1] algorithms were proposed. For the submodular secretary problem with a cardinality constraint, Gupta et al. [13] proposed a 1/1417- competitive algorithm and Bateni et al. [3] proposed a 1/(8e2)-competitive algorithm. Several studies of submodular secretary problems assume the monotonicity of the objective function, which is defined as the condition that f (S) ≤ f (T ) for all S ⊆ T ⊆ V . Under the monotonicity assumption, Bateni et al. [3] proposed a 0.090-competitive algorithm and Feldman et al. [11] showed this algorithm achieves 0.170-approximation. The best one for the monotone case is (1 − O(1/√k))/e-approximation with exponential running time by Kesselheim and Tonnis [14]. Submodular secretary problems under more general constraints have been considered in several studies such as Ma et al. [16] and Feldman and Zenklusen [10]. Secretary problems with a set function lacking submodularity also have been studied, such as monotone subadditive functions by Rubinstein and Singla [18] and monotone functions with bounded supermodular degree by Feldman and Izsak [9]. Submodular maximization with a cardinality constraint in the offline setting has been studied extensively. In the offline setting, the ground set is given in advance and the objective value of any subset can be obtained from the beginning. The best algorithm known so far achieves 0.385-approximation by Buchbinder and Feldman [4]. Under the monotonicity assumption, the greedy algorithm is known to achieve (1 − 1/e)- approximation [17]. 1.2 Our result In this study, we propose an algorithm with an improved competitive ratio for the submodular secretary problem with a cardinality constraint. The objective function is assumed to be non-negative and submodular, but not necessarily monotone. Our algorithm is based on the one proposed for the monotone case by Bateni et al. [3]. We slightly modify their algorithm so that it works for the non-monotone case. In the analysis of the competitive ratio, we use a lemma proved by Buchbinder et al. [5], which was originally used for the offline setting. While Buchbinder et al. [5] designed a randomized algorithm and applied this lemma to the analysis of its approximation ratio, we utilize a random factor of the ordering of candidates. The resulting algorithm is (e − 1)2/(e2(1 + e)) ≈ 0.107-competitive. To the best of our knowledge, this competitive ratio improves the best one known so far, which is 1/(8e2) ≈ 0.0169 [3]. 2 Preliminaries Let V be a finite set of size n. The elements of V arrive one by one in random order, i.e., the order of V is chosen uniformly at random out of n! permutations. The non-negative submodular objective function f : 2V → R≥0 can be accessed through an value oracle, which returns the value of f (S) in O(1) time for any subset S of those who already arrived. At the arrival of element v ∈ V , the algorithm must decide whether to add it to the solution or reject it irrevocably. The algorithm can select at most k elements. We define the marginal gain of adding an element v ∈ V to the current solution S ⊆ V as f (vS) := f (S ∪ {v}) − f (S). 2 Algorithm 1 The modified classical secretary algorithm Require: A randomly ordered elements v1,··· , vn. 1: Generate n numbers from the uniform distribution on [0, 1] and sort them in ascending order. Let (ti)n i=1 be these sorted numbers. 2: Regard ti as the arrival time of the ith element vi. 3: Ignore all elements that arrive before time 1/e. 4: if there is no element that arrives before time 1/e then 5: Select the first element with probability 1/(et1). Otherwise, no element is selected. 6: else 7: 8: Let θ be the largest value of the elements that arrive before time 1/e. Select the first element with value at least θ. A continuous-time model [11] is a problem setting equivalent to the random order model. In this model, each element is assigned to an arrival time that is generated from the uniform distribution on [0, 1], and the decision maker can observe each element at its arrival time. We can transform a problem instance in the random order model to one in the continuous-time model. Suppose we generate n random numbers from the uniform distribution on [0, 1] and sort them in ascending order in advance. By assigning these values to each element in order of arrival, we can transform the random order model to the continuous-time model. 3 The modified classical secretary algorithm In this section, we describe a modified version of the classical secretary algorithm, which is used as a subroutine of our proposed method. The modified classical secretary algorithm is based on the continuous- time version of the classical secretary problem [11], which ignores all elements that arrive before time 1/e and selects the first element with value higher than all ignored elements. They proved that their method selects the best one with probability at least 1/e. However, we need another property: The probability that the algorithm selects each element must be upper-bounded. Their method does not satisfy this property if n is small. Thus we make a small modification to this algorithm, and obtain the one satisfying this property. This modification is applied only when there exists no element that arrives before time 1/e. In this case, the modified algorithm selects the first element with probability 1/(et1), where t1 is the time when the first element arrives, while the original one always selects it. This modified algorithm is described in Algorithm 1. Lemma 1. Algorithm 1 is 1/e-competitive and for each element v ∈ V , the probability that Algorithm 1 selects v is at most 1/e. Proof. Let v∗ ∈ V be an element with the largest value. Suppose v∗ appears after time 1/e and its arrival time is t∗ ∈ [1/e, 1]. Below, we fix the arrival time t∗ and consider the event that v∗ is selected by the algorithm. This event happens if one of the following two conditions holds. • v∗ is the first element and the algorithm decides to select v∗. • v∗ is not the first element, and v appears before time 1/e, where v is the best element among those who appear before time t∗. The probability that v∗ is the first element is equal to the probability that all other elements arrive after time t∗, then it is (1− t∗)n−1. Since the algorithm selects the first element with probability 1/(et1), the first condition holds with probability (1 − t∗)n−1/(et∗). To consider the second condition, we fix the set of elements S ⊆ V that arrive before time t∗. Then the largest element among them, v ∈ argmaxv∈Sw(v), is also determined. Under this condition, the probability that v arrives before time 1/e is 1/(et∗) since the arrival time of v conforms to the uniform distribution on 3 Algorithm 2 Our proposed method Input: A randomly ordered elements v1,··· , vn. 1: Generate n numbers from the uniform distribution on [0, 1] and sort them in ascending order. Let (ti)n i=1 be these sorted numbers. Regard ti as the arrival time of the ith element vi. that arrive from time (l − 1)/k to time l/k for each l ∈ [k]. 2: Partition V into k segments V1,··· , Vk, where Vl = {vi ∈ V ti ∈ [(l − 1)/k, l/k]} is the set of elements 3: Let S0 := ∅. 4: for each l = 1,··· , k do 5: Apply Algorithm 1 to Vl with weight f (vSl−1) for each v ∈ Vl. 6: 7: 8: if Algorithm 1 selects an element sl ∈ Vl and f (slSl−1) ≥ 0 then else Sl ← Sl−1 ∪ {sl}. Sl ← Sl−1. 9: 10: return Sk. [0, t∗]. Since this holds for any S, the second condition holds with probability {1 − (1 − t∗)n−1}/(et∗). In total, the probability that the algorithm selects v∗ is (1 − t∗)n−1 et∗ + 1 − (1 − t∗)n−1 et∗ dt∗ 1/e Z 1 =Z 1 1/e 1 e = 1 et∗ dt∗ Then this algorithm is 1/e-competitive. Let v ∈ V be any element and t be its arrival time. If v is selected, one of the following two conditions holds. • v is the first element and the algorithm decides to select v. • v is not the first element, v appears before time 1/e, and the value of v is less than that of v, where v is the best element among those who appear before time t. Since the second condition is stronger than the second condition for the optimal element v∗, the probability that one of these conditions is satisfied is less than that of v∗. Therefore, the probability that any element is selected is at most 1/e. 4 Algorithm and analysis In this section, we illustrate our proposed method and provide an analysis of its competitive ratio. Our proposed method utilizes the idea of the continuous-time model. To transform the random order model to the continuous-time model, we generate n random numbers from the uniform distribution on [0, 1] and sort them in ascending order in advance. Let t1 ≤ ··· ≤ tn be these numbers. By regarding ti as the arrival time of the ith element, we can obtain an instance of the continuous-time model. We partition the sequence of the elements into k segments V1,··· , Vk by separating [0, 1] into equal-length time windows. Then we apply Algorithm 1 to each segment with regarding the marginal gain f (vSl−1) as the weight for element v ∈ Vl, where Sl−1 is the solution just before segment Vl. If Algorithm 1 selects an element sl ∈ Vl and its marginal gain is non-negative, we add it to the solution. The detailed description of the algorithm is provided in Algorithm 2. In the proof, we utilize the following lemmas. 4 Lemma 2 (Lemma 2.2 of [8]). Let f : 2V → R be submodular. Denote by A(p) a random subset of A where each element appears with probability p (not necessarily independently). Then, E[f (A(p))] ≥ (1 − p)f (∅) + p · f (A). Lemma 3 (Lemma 2.2 of [5]). Let f : 2V → R be submodular. Denote by A(p) a random subset of A where each element appears with probability at most p (not necessarily independently). Then, E[f (A(p))] ≥ (1 − p)f (∅). Theorem 4. Algorithm 2 is (e − 1)2/(e2(1 + e))-competitive for any non-negative submodular objective function and cardinality constraint. Proof. Let S∗ ∈ argmaxS : S≤kf (S) be an optimal solution. Let U be a set with the largest objective value that has at most one element in each partition, i.e., U ∈ argmax{f (U ) U ⊆ S∗, ∀l ∈ [k] : U ∩ Vl ≤ 1}. Let U be a random subset of S∗ obtained by selecting an element uniformly at random from each non-empty S∗ ∩ Vl where l ∈ [k]. From the definition, we have E[f (U )] ≥ E[f ( U )]. with probability 1/k for each l ∈ [k]. Then we have From the independence between arrival times of elements, each element of S∗ is included in partition Vl Pr(Vl ∩ S∗ 6= ∅) = 1 −(cid:18)1 − 1 k(cid:19)S ∗ for each l ∈ [k]. From the linearity of expectation, we have k = E[ U] = E" k 1Vl∩S ∗6=∅# Xl=1 Xl=1 Pr(Vl ∩ S∗ 6= ∅) k(cid:19)S ∗! = k 1 −(cid:18)1 − e(cid:19) . ≥ S∗(cid:18)1 − 1 1 By considering the randomness of Vl for all l ∈ [k], we can see that each element in S∗ is included in U with the same probability, then we can define p := Pr(v ∈ U ) for all v ∈ S∗. Since E[ U] = pS∗, we have p ≥ 1 − 1/e. By applying Lemma 2, we obtain E[f (U )] ≥ E[f ( U )] ≥ (1 − p)f (∅) + pf (S∗) ≥ (1 − 1/e)f (S∗). (1) Fix partitions V1,··· , Vk and U . We consider the randomness of the ordering of each partition. Since Algorithm 1 selects each element in Vl with probability at most 1/e for each l ∈ [k] from Lemma 1, we have Pr(v ∈ Sk V1,··· , Vk, U ) ≤ 1/e for all v ∈ V . Let g(Sk) = f (Sk ∪ U ) − f (U ). By applying Lemma 3 to g, we have E[f (Sk ∪ U )V1,··· , Vk, U ] = E[g(Sk)V1,··· , Vk, U ] ≥ (1 − 1/e)g(∅) = (1 − 1/e)f (U ). (2) We consider the marginal gain of the algorithm obtained in the lth segment by fixing Sl−1. If U ∩ Vl 6= ∅, it is a singleton, and let ul be an element in U ∩ Vl. If U ∩ Vl = ∅, let ul be a dummy element that does not affect 5 the objective value. Define sl similarly as an element in Sk ∩ Vl or a dummy element. Since Algorithm 1 is 1/e-competitive and elements with negative marginal gain are not selected, we have E[f (slSl−1)V1,··· , Vk, U, Sl−1] ≥ 1 e max{f (ulSl−1), 0}. (3) j=1 Vj(cid:17). Combining the above inequalities, we obtain Let Ul = U ∩(cid:16)Sl E[f (Sk) V1,··· , Vk, U ] = E[f (slSl−1) V1,··· , Vk, U ] k k = Xl=1 Xl=1 Xl=1 Xl=1 ≥ = E(cid:20) 1 ≥ k k e V1,··· , Vk, U(cid:21) E[E[f (slSl−1) V1,··· , Vk, U, Sl−1] V1,··· , Vk, U ] max{f (ulSl−1), 0}(cid:12)(cid:12)(cid:12)(cid:12) E(cid:20) 1 f (ulSk ∪ Ul−1)(cid:12)(cid:12)(cid:12)(cid:12) E(cid:20) 1 e {f (Sk ∪ U ) − f (Sk)}(cid:12)(cid:12)(cid:12)(cid:12) E[f (Sk) V1,··· , Vk, U ] = E(cid:20) 1 V1,··· , Vk, U(cid:21) V1,··· , Vk, U(cid:21) . V1,··· , Vk, U(cid:21) 1 + e e f (Sk ∪ U )(cid:12)(cid:12)(cid:12)(cid:12) e(cid:19) f (U ). 1 ≥ 1 1 + e(cid:18)1 − (due to (3)) (due to the submodularity) By a simple calculation, we have (due to (2)) By taking the expectation about V1,··· , Vk and U and substituting (1), we obtain E[f (Sk)] ≥ 1 1 + e(cid:18)1 − 1 e(cid:19)2 f (S∗). Acknowledgement This study is supported by JSPS KAKENHI Grant Number JP 18J12405. References [1] Moshe Babaioff, Nicole Immorlica, David Kempe, and Robert Kleinberg. A knapsack secretary problem with applications. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX), pages 16 -- 28, 2007. [2] MohammadHossein Bateni. Secretary problems and online auctions. In Encyclopedia of Algorithms, pages 1910 -- 1913. 2016. [3] MohammadHossein Bateni, Mohammad Taghi Hajiaghayi, and Morteza Zadimoghaddam. Submodular secretary problem and extensions. ACM Trans. Algorithms, 9(4):32:1 -- 32:23, 2013. 6 [4] Niv Buchbinder and Moran Feldman. Constrained submodular maximization via a non-symmetric technique. CoRR, abs/1611.03253, 2016. [5] Niv Buchbinder, Moran Feldman, Joseph Naor, and Roy Schwartz. Submodular maximization with car- dinality constraints. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1433 -- 1452, 2014. [6] E. B. Dynkin. The optimum choice of the instant for stopping a markov process. Soviet Math. Dokl., (4):627 -- 629, 1963. [7] Ethan Elenberg, Alexandros G Dimakis, Moran Feldman, and Amin Karbasi. Streaming weak submod- ularity: Interpreting neural networks on the fly. In Advances in Neural Information Processing Systems (NIPS) 30, pages 4047 -- 4057. 2017. [8] Uriel Feige, Vahab S. Mirrokni, and Jan Vondr´ak. Maximizing non-monotone submodular functions. SIAM J. Comput., 40(4):1133 -- 1153, 2011. [9] Moran Feldman and Rani Izsak. Building a good team: Secretary problems and the supermodular degree. In Proceedings of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1651 -- 1670, 2017. [10] Moran Feldman and Rico Zenklusen. The submodular secretary problem goes linear. SIAM J. Comput., 47(2):330 -- 366, 2018. [11] Moran Feldman, Joseph Naor, and Roy Schwartz. Improved competitive ratios for submodular secretary In Approximation, Randomization, and Combinatorial Optimization. problems (extended abstract). Algorithms and Techniques (APPROX), pages 218 -- 229, 2011. [12] Kaito Fujii and Hisashi Kashima. Budgeted stream-based active learning via adaptive submodular maximization. In Advances in Neural Information Processing Systems (NIPS) 29, pages 514 -- 522, 2016. [13] Anupam Gupta, Aaron Roth, Grant Schoenebeck, and Kunal Talwar. Constrained non-monotone submodular maximization: Offline and secretary algorithms. In Proceedings of the 6th International Workshop on Internet and Network Economics (WINE), pages 246 -- 257, 2010. [14] Thomas Kesselheim and Andreas Tonnis. Submodular secretary problems: Cardinality, matching, and linear constraints. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX), pages 16:1 -- 16:22, 2017. [15] Robert D. Kleinberg. A multiple-choice secretary algorithm with applications to online auctions. In Proceedings of the 16th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 630 -- 631, 2005. [16] Tengyu Ma, Bo Tang, and Yajun Wang. The simulated greedy algorithm for several submodular matroid secretary problems. Theory Comput. Syst., 58(4):681 -- 706, 2016. [17] 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. [18] Aviad Rubinstein and Sahil Singla. Combinatorial prophet inequalities. In Proceedings of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1671 -- 1687, 2017. 7
1408.4490
2
1408
2016-10-05T21:07:41
Tractable Pathfinding for the Stochastic On-Time Arrival Problem
[ "cs.DS" ]
We present a new and more efficient technique for computing the route that maximizes the probability of on-time arrival in stochastic networks, also known as the path-based stochastic on-time arrival (SOTA) problem. Our primary contribution is a pathfinding algorithm that uses the solution to the policy-based SOTA problem---which is of pseudo-polynomial-time complexity in the time budget of the journey---as a search heuristic for the optimal path. In particular, we show that this heuristic can be exceptionally efficient in practice, effectively making it possible to solve the path-based SOTA problem as quickly as the policy-based SOTA problem. Our secondary contribution is the extension of policy-based preprocessing to path-based preprocessing for the SOTA problem. In the process, we also introduce Arc-Potentials, a more efficient generalization of Stochastic Arc-Flags that can be used for both policy- and path-based SOTA. After developing the pathfinding and preprocessing algorithms, we evaluate their performance on two different real-world networks. To the best of our knowledge, these techniques provide the most efficient computation strategy for the path-based SOTA problem for general probability distributions, both with and without preprocessing.
cs.DS
cs
Tractable Pathfinding for the Stochastic On-Time Arrival Problem Mehrdad Niknami1 and Samitha Samaranayake2 1 Electrical Engineering and Computer Science, UC Berkeley 2 School of Civil and Environmental Engineering, Cornell University Abstract. We present a new and more efficient technique for computing the route that maximizes the probability of on-time arrival in stochastic networks, also known as the path-based stochastic on-time arrival (SOTA) problem. Our primary contribution is a pathfinding algorithm that uses the solution to the policy-based SOTA problem-which is of pseudo- polynomial-time complexity in the time budget of the journey-as a search heuristic for the optimal path. In particular, we show that this heuristic can be exceptionally efficient in practice, effectively making it possible to solve the path-based SOTA problem as quickly as the policy- based SOTA problem. Our secondary contribution is the extension of policy-based preprocessing to path-based preprocessing for the SOTA problem. In the process, we also introduce Arc-Potentials, a more efficient generalization of Stochastic Arc-Flags that can be used for both policy- and path-based SOTA. After developing the pathfinding and preprocessing algorithms, we evaluate their performance on two different real-world networks. To the best of our knowledge, these techniques provide the most efficient computation strategy for the path-based SOTA problem for general probability distributions, both with and without preprocessing. 1 Introduction Modern advances in graph theory and empirical computational power have essentially rendered deterministic point-to-point routing a solved problem. While the ubiquity of routing and navigation tools in our everyday lives is a testament to the success and usefulness of deterministic routing technology, inaccurate predictions remain a fact of life, resulting in missed flights, late arrivals to meetings, and failure to meet delivery deadlines. Recent research in transportation engineering, therefore, has focused on the collection of traffic data and the incorporation of uncertainty into traffic models, allowing for the optimization of relevant reliability metrics desirable for the user. The point-to-point stochastic on-time arrival problem [1], or SOTA for short, concerns itself with this reliability aspect of routing. In the SOTA problem, the network is assumed to have uncertainty in the travel time across each link, represented by a strictly positive random variable. The objective is then to maximize the probability of on-time arrival when traveling between a given origin- destination pair with a fixed time budget.3 It has been shown that the SOTA solution can appreciably increase the probability of on-time arrival compared to the classical least expected travel time (LET) path [3], motivating the search for efficient solutions to this problem. 1.1 Variants There exist two primary variants of the SOTA problem. The path-based SOTA problem, which is also referred to as the shortest-path problem with on-time arrival reliability (SPOTAR) [4], consists of finding the a-priori most reliable path to the destination. The policy-based SOTA problem, on the other hand, consists of computing a routing policy-rather than a fixed path-such that, at every intersection, the choice of the next direction depends on the current state (i.e., the remaining time budget).4 While a policy-based approach provides better reliability when online navigation is an option, in some situations it can be necessary to determine the entire path prior to departure. The policy-based SOTA problem, which is generally solved in discrete-time, can be solved via a successive-approximation algorithm, as shown by Fan and Nie [5]. This approach was subsequently improved by Samaranayake et al. [3] to a pseudo-polynomial-time label-setting algorithm based on dynamic-programming with a sequence of speedup techniques and the use of zero-delay convolution [6, 7]. It was then demonstrated in Sabran et al. [8] that graph preprocessing techniques such as Reach [9] and Arc-Flags [10] can be used to further reduce query times for this problem. In contrast with the policy-based problem, however, no polynomial-time solu- tion is known for the general path-based SOTA problem [4]. In the special case of normally-distributed travel times, Nikolova et al. [11] present an 𝑂(𝑛𝑂(𝑙𝑜𝑔 𝑛))- algorithm for computing exact solutions, while Lim et al. [12] present a poly- logarithmic-time algorithm for approximation solutions. To allow for more general probability distributions, Nie and Wu [4] develop a label-correcting algorithm that solves the problem by utilizing the first-order stochastic dominance prop- erty of paths. While providing a solution method for general distributions, the performance of this algorithm is still insufficient to be of practical use in many real-world scenarios; for example, while the stochastic dominance approach pro- vides a reasonable computation time (on the order of half a minute per instance) for networks of a few hundred to a thousand vertices, it fails to perform well on metropolitan road networks, which easily exceed tens of thousands of vertices. In contrast, our algorithm easily handles networks of tens of thousands of edges in approximately the same amount of time without any kind of preprocessing.5 3 The target objective can in fact be generalized to utility functions other than the probability of on-time arrival [2] with little effect on our algorithms, but for our purposes, we limit our discussion to this scenario. 4 In this article, we only consider time-invariant travel-time distributions. The problem can be extended to incorporate time-varying distributions as discussed in [3]. 5 Parmentier and Meunier [13] have concurrently also developed a similar approach concerning stochastic shortest paths with risk measures. With preprocessing, our techniques further reduce the running time to less than half a second, making the problem tractable for larger networks.6 1.2 Contributions Our primary contribution in this article is a practically efficient technique for solving the path-based SOTA problem, based on the observation that the solution to the policy-based SOTA problem is in practice itself an extremely efficient heuristic for solving the path-based problem. Our secondary contribution is to demonstrate how graph preprocessing can be used to speed up the computation of the policy heuristic, and thus the optimal path, while maintaining correctness.7 Toward this goal, we present Arc- Potentials, a more efficient generalization of the existing preprocessing technique known as Stochastic Arc-Flags that can be used for both policy- and path-based preprocessing. After presenting these techniques, we evaluate the performance of our al- gorithms on two real-world networks while comparing the trade-off between their scalability (in terms of memory and computation time) and the speedups achieved. Our techniques, to the best of our knowledge, provide the most efficient computation strategy for the path-based SOTA problem with general probability distributions, both with and without preprocessing. 2 Preliminaries We are given a stochastic network in the form of a directed graph 𝐺 = (𝑉, 𝐸) where each edge (𝑖, 𝑗) ∈ 𝐸 has an associated probability distribution 𝑝𝑖𝑗(·) representing the travel time across that edge.8 The source is denoted by 𝑠 ∈ 𝑉 , the destination by 𝑑 ∈ 𝑉 , and the travel time budget by 𝑇 ∈ R+. For notational simplicity, we present the SOTA problem in continuous-time throughout this article, with the understanding that the algorithms are applied after discretization with a time interval of 𝛥𝑡. Definition 1 (SOTA Policy). Let 𝑢𝑖𝑗(𝑡) be the probability of arriving at the destination 𝑑 with time budget 𝑡 when first traversing edge (𝑖, 𝑗) ∈ 𝐸 and sub- sequently following the optimal policy. Let 𝛿𝑖𝑗 > 0 be the minimum travel time along edge (𝑖, 𝑗), i.e. min{𝜏 : 𝑝𝑖𝑗(𝜏 ) > 0}. Then, the on-time arrival probability 𝑢𝑖(𝑡) and the policy (optimal subsequent node) 𝑤𝑖(𝑡) at node 𝑖, can be defined via the dynamic programming equations below [1]. Note that 𝛥𝑡 must satisfy 𝛥𝑡 ≤ 𝛿𝑖𝑗 ∀(𝑖, 𝑗) ∈ 𝐸. 6 It should be noted that the largest network we consider only has approximately 71,000 edges and is still much smaller than networks used to benchmark deterministic shortest path queries, which can have millions of edges [14]. 7 As explained later, there is a potential pitfall that must be avoided when the preprocessed policy is to be used as a heuristic for the path. 8 We assume that at most one edge exists between any pair of nodes in each direction. ∫︁ 𝑡 𝑢𝑖𝑗(𝑡) = 𝑢𝑑(·) = 1 𝛿𝑖𝑗 𝑢𝑗(𝑡 − 𝜏 )𝑝𝑖𝑗(𝜏 ) 𝑑𝜏 𝑢𝑖(𝑡) = max 𝑗: (𝑖,𝑗)∈𝐸 𝑤𝑖(𝑡) = arg max 𝑗: (𝑖,𝑗)∈𝐸 𝑢𝑖𝑗(𝑡) 𝑢𝑖𝑗(𝑡) The solution to the policy-based SOTA problem can be obtained by solving this system of equations using dynamic programming as detailed in [3]. This requires evaluating a set of convolution integrals. The computation of the policy 𝑢𝑠(·) for a source 𝑠 and time budget 𝑇 using direct convolution takes 𝑂(𝐸𝑇 2) time, as computing 𝑢𝑠(𝑇 ) could in the worst case require convolutions of length 𝑂(𝑇 ) for each edge in the graph. However, by using an online convolution technique known as zero-delay convolution (ZDC) [15, 6], the time complexity can be reduced to 𝑂(𝐸𝑇 log2 𝑇 ). Justifications for the results and time complexity, including details on how to apply ZDC to the SOTA problem, can be found in [3, 7]. Assumptions. Our work, as with other approaches to both the policy-based and path-based SOTA problems, makes a number of assumptions about the nature of the travel time distributions. The three major assumptions are that the travel time distributions are (1) time invariant, (2) exogenous (not impacted by individual routing choices), and (3) independent. The time-invariance assumption- which prevents accounting for traffic variations throughout the day-can be relaxed under certain conditions as described in [3]. Furthermore, the exogeneity assumption is made even in the case of deterministic shortest path problems. This leaves the independence assumption as a major concern for this problem. It might, in fact, be possible to partially relax this assumption [3] to allow for conditional distributions at the cost of increasing the computation time by a factor linear in the number of states to be conditioned on. (If we assume the Markov property for road networks, the number of conditioning states becomes the in- degree of each vertex, a small enough constant that may make generalizations in this direction practical.) Nevertheless, we will only focus on the independent setting and make no claim to have solved the path-based SOTA problem in full generality, as the problem already lacks efficient solution methods even in this simplified setting. Our techniques should, however, provide a foundation that allows for relaxing these assumptions in the future. 3 Path-Based SOTA In the deterministic setting, efficient solution strategies (from Dijkstra's algorithm to state-of-the-art solutions) generally exploit the sub-path optimality property: namely, the fact that any optimal route to a destination node 𝑑 that includes some intermediate node 𝑖 necessarily includes the optimal path from 𝑖 to 𝑑. Unfortunately, this does not hold in the stochastic setting. Furthermore, blind enumeration of all possible paths in the graph is absolutely intractable for all but the most trivial networks, as the number of simple paths grows exponentially with the number of nodes in the graph. Naturally, this leads us to seek a heuristic Algorithm 1 Algorithm for computing the optimal SOTA path Notation: * is the convolution operator and ‖ is the concatenation operator for all 𝑖 ∈ 𝑉 , 0 ≤ 𝑡 ≤ 𝑇 do Compute the optimal policy's reliability10 𝑢𝑖(𝑡) 𝑄 ← PriorityQueue() 𝑄.Push(𝑢𝑠(𝑇 ), ([1.0], [𝑠])) while 𝑄 is not empty do (𝑟, (𝑞, 𝑃 )) ← 𝑄.PopMax() 𝑖 ← 𝑃 [𝑃 − 1] if 𝑖 = 𝑑 then return 𝑃 for all 𝑗 ∈ 𝐸.Neighbors(𝑖) do 𝑄.Push((𝑞 * 𝑢𝑗)[𝑇 ], (𝑞 * 𝐸.Cost(𝑖, 𝑗), 𝑃 ‖ [𝑗])) return nil ◁ Push (reliability, (cost dist., initial path)) ◁ Extract most reliable path so far ◁ Get the last node in the path ◁ Append new edge. ◁ No path found to guide us toward the optimal path efficiently, while not compromising its optimality. 3.1 Algorithm Consider a fixed path 𝑃 from the source 𝑠 to node 𝑖. Let 𝑞𝑃 𝑠𝑖(𝑡) be the travel time distribution along 𝑃 from node 𝑠 to node 𝑖, i.e., the convolution of the travel time distributions of every edge in 𝑃 . Upon arriving at node 𝑖 at time 𝑡, let the user follow the optimal policy toward 𝑑, therefore reaching 𝑑 from 𝑠 with 𝑠𝑖(𝑡)𝑢𝑖(𝑇 − 𝑡). The reliability of following path 𝑃 to node 𝑖 probability density 𝑞𝑃 and subsequently following the optimal policy toward 𝑑 is9: ∫︁ 𝑇 𝑟𝑃 𝑠𝑖(𝑇 ) = 𝑠𝑖(𝑡)𝑢𝑖(𝑇 − 𝑡) 𝑑𝑡 𝑞𝑃 0 Note that the route from 𝑠 → 𝑖 is a fixed path while that from 𝑖 → 𝑑 is a policy. The optimal path is found via the procedure in Algorithm 1. Briefly, starting at the source 𝑠, we add the hybrid (path + policy) solution 𝑟𝑃 𝑠𝑖(𝑇 ) for each neighbor 𝑖 of 𝑠 to a priority queue. Each of these solutions gives an upper bound on the solution (success probability). We then dequeue the solution with the highest upper bound, repeating this process until a path to the destination is found. Essentially, algorithm 1 performs an 𝐴* search for the destination, using the policy as a heuristic. While it is obvious that the algorithm would find the optimal path eventually if the search were allowed to continue indefinitely, it is less obvious that the first path found will be optimal. We show this by showing 9 The bounds of this integral can be slightly tightened through inclusion of the minimum travel times, but this has been omitted for simplicity. 10 Can be limited to those 𝑖 and 𝑡 reachable from 𝑠 in time 𝑇 , and can be further sped up through existing policy preprocessing techniques such as Arc-Flags. that the policy is an admissible heuristic for the path, and consequently, by the optimality of 𝐴* [16], the first returned path must be optimal. Proposition 1 (Admissibility). The solution to policy-based SOTA problem is an admissible heuristic for the optimal solution to the path-based SOTA problem using Algorithm 1. Proof. When finding a minimum cost path, an admissible heuristic is a heuristic that never overestimates the actual cost [17]. In our context, since the goal is to maximize the reliability (success probability), this corresponds to a heuristic that never underestimates the reliability of a routing strategy. The reliability of an optimal SOTA policy clearly provides an upper bound on the reliability of any fixed path with the same source, destination, and travel budget. (Otherwise, a better policy would be to simply follow the fixed path irrespective of the time remaining, contradicting the assumption that the policy is optimal.) Therefore, the SOTA policy is an admissible heuristic for the optimal SOTA path. 3.2 Analysis The single dominant factor in this algorithm's (in)efficiency is the length of the priority queue (i.e., the number of paths considered by the algorithm), which in turn depends on the travel time distribution along each road. As long as the number of paths considered is approximately linear in length of the optimal path, the path computation time is easily dominated by the policy computation time, and the algorithm finds the optimal path very quickly. In the worst-case scenario for the algorithm, the optimal path at a node corresponds to the direction for the worst policy at that node. Such a scenario, or even one in which the optimal policy frequently chooses a suboptimal path, could result in a large (even exponential) running time as well as space usage. However, it is difficult to imagine this happening in practice. As shown later, experimentally, we came across very few cases in which the path computation time dominated the policy computation time, and even in those cases, they were still quite reasonable and extremely far from such a worst-case scenario. We conjecture that such situations are extremely unlikely to occur in real-world road networks. An interesting open problem is to define characteristics (network structure, shape of distributions, etc.) that guarantee pseudo-polynomial running times in stochastic networks, similar in nature to the Highway Dimension property [18] in deterministic networks, which guarantees logarithmic query times when networks have a low Highway Dimension. 4 Preprocessing In deterministic pathfinding, preprocessing techniques such as Arc-Flags [10], reach-based routing [9, 19], contraction hierarchies [20], and transit node routing [21] have been very successfully used to decrease query times by many orders of magnitude by exploiting structural properties of road networks. Some of these approaches allow for pruning the search space based solely on the destination node, while others also take the source node into account, allowing for better pruning at the cost of additional preprocessing. The structure of the SOTA problem, however, makes it more challenging to apply such techniques to it. Previously, Arc-Flags and Reach have been successfully adapted to the policy-based problem in [8], resulting in Stochastic Arc-Flags and Directed Reach. While at first glance one may be tempted to directly apply these algorithms to the computation of the policy heuristic for the path-based problem, a naive application of source- dependent pruning (such as Directed Reach or source-based Arc-Flags) can result in an incorrect solution, as the policy needs to be recomputed for source nodes that correspond to different source regions. This effectively limits any preprocessing of the policy heuristic to destination-based (i.e., source-independent) techniques such as Stochastic Arc-Flags, precluding the use of source-based approaches such as Directed Reach for the policy computation. With sufficient preprocessing resources (as explained in section 5.2), however, one can improve on this through the direct use of path-based preprocessing-that is, pruning the graph to include only those edges which may be part of the most reliable path. This method allows us to simultaneously account for both source and destination regions, and generally results in a substantial reduction of the search space on which the policy needs to be computed. However, as path-based approaches require computing paths between all ≈ 𝑉 2 pairs of vertices in the graph, this approach may become computationally prohibitive for medium- to large-scale networks. In such cases, we would then need to either find alternate approaches (e.g. approximation techniques), or otherwise fall back to the less aggressive policy-based pruning techniques, which only require computing 𝑉 separate policies (one per destination). 4.1 Efficient Path-based Preprocessing Path-based preprocessing requires finding the optimal paths for each time budget up to the desired time budget 𝑇 for all source-destination pairs. Naively, this can be done by placing Algorithm 1 in a loop, executing it for all time budgets from 1 to 𝑇 . This requires 𝑇 times the work of finding the path for a single time budget, which is clearly prohibitive for any reasonable value of 𝑇 . However, we can do far better by observing that many of the computations in the algorithm are independent of the time budget and can be factored out when the path does not change with 𝑇 . To improve the efficiency of the naive approach in this manner, we make two observations. First, we observe that, in Algorithm 1, only the computation of the path's reliability (priority) in the priority queue ever requires knowledge of the time budget. Crucially, the convolution 𝑞 * 𝐸.Cost(𝑖, 𝑗) only depends on the maximum time budget 𝑇 for truncation purposes, which is a fixed value. This means that the travel time distribution of any path under consideration can be computed once for the maximum time budget, and re-used for all lower time budgets thereafter. Second, we observe that when a new edge is appended, the priority of the new path is the inner product of the vector 𝑞 and (the reverse of) the vector 𝑢𝑗, shifted by 𝑇 . As noted in the algorithm itself, this quantity in fact the convolution of the two aforementioned vectors evaluated at 𝑇 . Thus, when a new edge is appended, instead of recomputing the inner product, we can simply convolve the two vectors once, and thereafter look up the results instantly for other time budgets. Together, these two observations allow us to compute the optimal paths for all budgets far faster than would seem naively possible, making path-based preprocessing a practical option. 4.2 Arc-Potentials As noted earlier, Arc-Flags, a popular method for graph preprocessing, has been adapted to the SOTA problem as Stochastic Arc-Flags [8]. Instead of applying it directly, however, we present Arc-Potentials, a more natural generalization of Arc-Flags to SOTA that can still be directly applied to the policy- and path-based SOTA problems alike, while allowing for more efficient preprocessing. Consider partitioning the graph 𝐺 into 𝑅 regions (we choose 𝑅 = 𝑂(log 𝐸), described below), where 𝑅 is tuned to trade off storage space for pruning accuracy. In the deterministic setting, Arc-Flags allow us to preprocess and prune the search space as follows. For every arc (edge) (𝑖, 𝑗) ∈ 𝐸, Arc-Flags defines a bit-vector of length 𝑅 that denotes whether or not this arc belongs to an optimal path ending at some node in region 𝑅. We then pre-compute these Arc-Flags, and store them for pruning the graph at query time. (This approach has been extended to the dynamic setting [22] in which the flags are updated with low recomputation cost after the road network is changed.) Sabran et al. [8] apply Arc-Flags to the policy-based SOTA problem as follows: each bit vector is defined to represent whether or not its associated arc is realizable, meaning that it belongs to an optimal policy to some destination in the target region associated with each bit. The problem with this approach, however, is that it requires computing arc-flags for all target budgets (or more, practically, some ranges of budgets), each of which takes a considerable amount of space. Instead, we propose a more efficient alternative 2, which we call Arc-Potentials. Definition 2 (Arc-Potentials). For a given destination region 𝐷, we define the arc activation potential 𝜑𝑖𝑗 of the edge from node 𝑖 to node 𝑗 to be the minimum time budget at which the arc becomes part of an optimal policy to some destination 𝑑 ∈ 𝐷. The Arc-Potentials pruning algorithm only stores the "activation" potential of every edge. As expected, this implies that for large time budgets, every edge is potentially active. We could have further generalized the algorithm to allow for asymptotically exact pruning at relatively low cost by simply storing the actual potential intervals during which the arc is active, rather than merely their first activation potential. However, in our experiments this was deemed unnecessary as Arc-Potentials were already sufficient for significant pruning in the time budgets of interest in our networks. The computation of the set of realizable edges (and nodes) under a given policy is essentially equivalent to the computation of the policy itself, except that updates are performed in the reverse order (from the source to the destination). The activation potentials 𝜑 can then be obtained from this set. As with Arc-Flags, we limit the space complexity to 𝑂(𝐸𝑅) = 𝑂(𝐸 log 𝐸) by choosing 𝑅 to be proportional log 𝐸, tuning it as desired to increase the pruning accuracy. In our 𝑅. Note, however, experiments, we simply used a rectangular grid of size that the preprocessing time does not depend on 𝑅, as the paths between all ≈ 𝑉 2 pairs of nodes must be eventually computed. 𝑅 × √ √ 5 Experimental Results We evaluated the performance of our algorithms on two real-world test networks: a small San Francisco network with 2643 nodes and 6588 edges for which real- world travel-time data was available as a Gaussian mixture model [23], and a second (relatively larger) Luxembourg network with 30647 nodes and 71655 edges for which travel-time distributions were synthesized from road speed limits, as real-world data was unavailable. The algorithms were implemented in C++ (2003) and executed on a cluster of 1.9 GHz AMD OpteronTM 6168 CPUs. The SOTA queries were executed on a single CPU and the preprocessing was performed in parallel as explained below. The SOTA policies were computed as explained in [3, 7] using zero-delay convolution with a discretization interval of 𝛥𝑡 = 1 second.11 To generate random problem instances, we independently picked a source and a destination node uniformly at random from the graph and computed the least expected travel-time (LET) path between them. We then evaluated our pathfinding algorithm for budgets chosen uniformly at random from the 5th to 95th percentile of LET path travel times (those of practical interest) on 10, 000 San Francisco and 1000 Luxembourg problems instances. First, we discuss the speed of our pathfinding algorithm, and afterward, we evaluate the effectiveness and scalability of our preprocessing strategies. 5.1 Evaluation We first evaluate the performance of our path-based SOTA algorithm without any graph preprocessing. Experimental results, as can be seen in Figure 1, show that the run time of our solution is dominated by the time taken to obtain the solution to the policy-based SOTA problem, which functions as a search heuristic for the optimal path. The stochastic-dominance (SD) approach [4], which to our knowledge is the fastest published solution for the path-based SOTA problem with general probability distributions, takes, on average, between 7 and 18 seconds (depending on the variance of the link travel time distributions) to compute the optimal path 11 Recall that we must have 𝛥𝑡 ≤ min(𝑖,𝑗)∈𝐸 𝛿𝑖𝑗, which is ≈ 1 sec for our networks. Fig. 1: Running time of the pathfinding algorithm as a function of the travel time budget for random unpruned (i.e., non-preprocessed) instantiations of each network. We can see that the path computation time is dominated by the policy computation time, effectively reducing the path-based SOTA problem to the policy-based SOTA problem in terms of computation time. for 100 time-step budgets. For comparison, our algorithm solves for paths on the San Francisco network with budgets of up to 1400 seconds (= 1400 time-steps) in ≈ 7 seconds, even achieving query times below 1 second for budgets less than 550 seconds without any preprocessing at all. Furthermore, it also handles most queries on the 71655-edge Luxembourg network in ≈ 10 seconds (almost all of them in 20 seconds), where the network and time budgets are more than an order of magnitude larger than the 2950-edge network handled by the SD approach in the same amount of time. Of course, this speedup-which increases more dramatically with the problem size-is hardly surprising or coincidental; indeed, it is quite fundamental to the nature of the algorithm: by drawing on the optimal policy as an upper bound (and quite often an accurate one) for the reliability of the final path, it has a very clear and fundamental informational advantage over any search algorithm that lacks any knowledge of the final solution. This allows the algorithm to direct itself toward the final path in an intelligent manner. It is, however, less clear and more difficult to see how one might compare the performance of our generic discrete-time approach with Gaussian-restricted, continuous-time approaches [12, 24]. Such approaches operate under drastically different assumptions and, in the case of [12], use approximation techniques, which we have yet to employ for additional performance improvements. When the true travel times cannot be assumed to follow Gaussian distributions, however, our method, to the best of our knowledge, presents the most efficient means for solving the path-based SOTA problem. As we show next, combining our algorithm with preprocessing techniques allows us to achieve even further reductions in query time, making it more tractable for industrial applications on appropriately sized networks. Preprocessing. Figure 2 demonstrates policy-based and path-based preprocessing using Arc-Potentials for two random San Francisco and Luxembourg problem 8001000120014001600TimeBudget(s)0246810RunningTime(s)SanFranciscoPolicyPath15002000250030003500TimeBudget(s)0510152025LuxembourgPolicyPath instances. As can be seen in the figure, path-based preprocessing is in general much more effective than policy-based preprocessing. 0 regions (unpruned) 132 regions (policy-pruned) 102 regions (path-pruned) 0 regions (unpruned) 232 grid (policy-pruned) 172 regions (path-pruned) Fig. 2: Policy- vs. path-based pruning for random instances of San Francisco (𝑇 = 837 seconds, source at top) and Luxembourg (𝑇 = 3165 seconds, source at bottom). Light-gray edges are pruned from the graph and blue edges belong to the optimal path, whereas red edges belong to (sub-optimal) paths that were on the queue at the termination of the algorithm. Figure 3, summarized in table 1, shows how the computation times scale with the preprocessing parameters. As expected, path-based preprocessing performs much better than purely policy-based preprocessing, and both become faster as we use more fine-grained regions. Nevertheless, we see that the majority of the speedup is achieved via a small number of regions, implying that preprocessing can be very effective even with low amounts of storage. (For example, for a 17 × 17 grid in Luxembourg, this amounts to 71655 × 172 ≈ 21M floats.) Fig. 3: Running time of pathfinding algorithm as a function of the time budget for each network. Red dots represent the computation time of the policy, and blue crosses represent the computation of the path using that policy. 10−210−1100101RunningTime(s)SanFrancisco0regions(nopruning)10−210−1100RunningTime(s)10²regions(policypruning)10−210−1100RunningTime(s)26²regions(policypruning)10−310−210−1100RunningTime(s)10²regions(pathpruning)8001000120014001600TimeBudget(s)10−310−210−1100RunningTime(s)26²regions(pathpruning)10−210−1100101Luxembourg0regions(nopruning)10−210−110010117²regions(policypruning)10−210−110010134²regions(policypruning)10−210−110017²regions(pathpruning)15002000250030003500TimeBudget(s)10−210−134²regions(pathpruning) Table 1: The average query time with both policy-based and path-based pruning at various grid sizes and time budgets on the San Francisco network (left) and the Luxembourg network (right). We can see that in both cases, most of the speedup occurs at low granularity (and thus low space requirements). Grid/ Pruning Unpruned Time budget (seconds) 800 1000 1200 1400 1600 1.81 3.00 4.10 5.11 5.23 10 × 10, policy 0.30 0.69 1.11 1.66 1.72 26 × 26, policy 0.17 0.40 0.63 0.93 0.97 10 × 10, path 0.11 0.38 0.63 0.87 0.90 26 × 26, path 0.02 0.04 0.06 0.07 0.08 Grid/ Time budget (seconds) Pruning Unpruned 1500 2000 2500 3000 3500 0.54 1.29 3.53 6.27 9.95 17 × 17, policy 0.25 0.83 2.31 4.57 7.97 34 × 34, policy 0.21 0.71 2.09 3.79 7.07 17 × 17, path 0.03 0.06 0.09 0.13 0.18 34 × 34, path 0.02 0.04 0.06 0.08 0.12 5.2 Scalability Path-based preprocessing requires routing between all ≈ 𝑉 2 pairs of vertices, which is quadratic in the size of the network and intractable for moderate size networks. In practice, this meant that we had to preprocess every region lazily (i.e. on-demand), which on our CPUs took 9000 CPU-hours. It is therefore obvious that this becomes intractable for large networks, leaving policy-based preprocessing as the only option. One possible approach for large-scale path- based preprocessing might be to consider the boundary of each region rather than its interior [8]. While currently uninvestigated, such techniques may prove to be extremely useful in practice, and are potentially fruitful topics for future exploration. 6 Conclusion and Future Work We have presented an algorithm for solving the path-based SOTA problem by first solving the easier policy-based SOTA problem and then using its solution as a search heuristic. We have also presented two approaches for preprocessing the underlying network to speed up computation of the search heuristic and path query, including a generalization of the Arc-Flags preprocessing algorithm that we call Arc-Potentials. We have furthermore applied and implemented these algorithms on moderate-sized transportation networks and demonstrated their potential for high efficiency in real-world networks. While unobserved in practice, there remains the possibility that our algorithm may perform poorly on stochastic networks in which the optimal policy is a poor heuristic for the path reliability. Proofs in this direction have remained elusive, and determining whether such scenarios can occur in realistic networks remains an important step for future research. In the absence of theoretical advances, however, our algorithm provides a more tractable alternative to the state-of-the-art techniques for solving the path-based SOTA problem. While our approach is tractable for larger networks than were possible with previous solutions, it does not scale well enough to be used with regional or continental sized networks that modern deterministic shortest path algorithms can handle with ease. In the future, we hope to investigate how our policy- based approach might be combined with other techniques such as the first-order stochastic dominance [4] and approximation methods such approximate Arc- Flags [8] for further speedup, and to also look into algorithms that allow for at least a partial relaxation of the independence assumption. We hope that our techniques will provide a strong basis for even better algorithms to tackle this problem for large-scale networks in the foreseeable future. Bibliography [1] Yueyue Fan, Robert Kalaba, and JE Moore II. Arriving on time. Journal of Optimization Theory and Applications, 127(3):497–513, 2005. [2] Arthur Flajolet, S´ebastien Blandin, and Patrick Jaillet. Robust adaptive routing under uncertainty. arXiv:1408.3374, 2014. [3] Samitha Samaranayake, Sebastien Blandin, and Alexandre Bayen. A tractable class of algorithms for reliable routing in stochastic networks. Transportation Research Part C, 20(1):199–217, 2012. [4] Yu Marco Nie and Xing Wu. Shortest path problem considering on-time arrival probability. Transportation Research Part B: Methodological, 43(6): 597–613, 2009. [5] Yueyue Fan and Yu Nie. Optimal routing for maximizing travel time reliability. Networks and Spatial Economics, 6(3-4):333–344, 2006. [6] Brian C Dean. Speeding up stochastic dynamic programming with zero-delay convolution. Algorithmic Operations Research, 5(2):Pages–96, 2010. [7] Samitha Samaranayake, Sebastien Blandin, and Alexandre Bayen. Speedup techniques for the stochastic on-time arrival problem. In ATMOS, pages 83–96, 2012. [8] Guillaume Sabran, Samitha Samaranayake, and Alexandre Bayen. Precom- putation techniques for the stochastic on-time arrival problem. In ALENEX, pages 138–146. SIAM, 2014. [9] Ronald Gutman. Reach-based routing: A new approach to shortest path algorithms optimized for road networks. In ALENEX/ANALC, pages 100– 111, 2004. [10] Moritz Hilger, Ekkehard Kohler, Rolf Mohring, and Heiko Schilling. Fast point-to-point shortest path computations with arc-flags. Ninth DIMACS Implementation Challenge, 74:41–72, 2009. [11] Evdokia Nikolova, Jonathan Kelner, Matthew Brand, and Michael Mitzen- In macher. Stochastic shortest paths via quasi-convex maximization. Algorithms–ESA 2006. Springer, 2006. [12] Sejoon Lim, Christian Sommer, Evdokia Nikolova, and Daniela Rus. Practical route planning under delay uncertainty: Stochastic shortest path queries. Robotics, page 249, 2013. [13] Axel Parmentier and Fr´ed´eric Meunier. Stochastic shortest paths and risk measures. arXiv:1408.0272, 2014. [14] Daniel Delling, Peter Sanders, Dominik Schultes, and Dorothea Wagner. Engineering route planning algorithms. Algorithmics of Large and Complex Networks, 2:117–139, 2009. [15] William G Gardner. Efficient convolution without input/output delay. In Audio Engineering Society Convention 97. Audio Engineering Society, 1994. [16] Rina Dechter and Judea Pearl. Generalized best-first search strategies and the optimality of 𝐴*. Journal of the ACM (JACM), 32(3):505–536, 1985. [17] Stuart J. Russell and Peter Norvig. Artificial Intelligence: A Modern Ap- proach. Prentice-Hall, Inc., 1995. ISBN 0-13-103805-2. [18] Ittai Abraham, Amos Fiat, Andrew Goldberg, and Renato Werneck. Highway dimension, shortest paths, and provably efficient algorithms. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, pages 782–793. Society for Industrial and Applied Mathematics, 2010. [19] Andrew Goldberg, Haim Kaplan, and Renato Werneck. Reach for 𝐴*: Efficient point-to-point shortest path algorithms. In ALENEX, volume 6, pages 129–143. SIAM, 2006. [20] Robert Geisberger, Peter Sanders, Dominik Schultes, and Daniel Delling. Contraction hierarchies: Faster and simpler hierarchical routing in road networks. In Experimental Algorithms, pages 319–333. Springer, 2008. [21] Holger Bast, Stefan Funke, and Domagoj Matijevic. Transit: ultrafast shortest-path queries with linear-time preprocessing. 9th DIMACS Imple- mentation Challenge [1], 2006. [22] Gianlorenzo DAngelo, Daniele Frigioni, and Camillo Vitale. Dynamic arc- flags in road networks. In Experimental Algorithms, pages 88–99. Springer, 2011. [23] Timothy Hunter, Pieter Abbeel, and Alexandre Bayen. The path inference filter: model-based low-latency map matching of probe vehicle data. In Algorithmic Foundations of Robotics X, pages 591–607. Springer, 2013. [24] Sejoon Lim, Hari Balakrishnan, David Gifford, Samuel Madden, and Daniela Rus. Stochastic motion planning and applications to traffic. The Interna- tional Journal of Robotics Research, 2010.
1205.0192
2
1205
2012-05-11T11:22:55
Large-scale compression of genomic sequence databases with the Burrows-Wheeler transform
[ "cs.DS", "q-bio.GN" ]
Motivation The Burrows-Wheeler transform (BWT) is the foundation of many algorithms for compression and indexing of text data, but the cost of computing the BWT of very large string collections has prevented these techniques from being widely applied to the large sets of sequences often encountered as the outcome of DNA sequencing experiments. In previous work, we presented a novel algorithm that allows the BWT of human genome scale data to be computed on very moderate hardware, thus enabling us to investigate the BWT as a tool for the compression of such datasets. Results We first used simulated reads to explore the relationship between the level of compression and the error rate, the length of the reads and the level of sampling of the underlying genome and compare choices of second-stage compression algorithm. We demonstrate that compression may be greatly improved by a particular reordering of the sequences in the collection and give a novel `implicit sorting' strategy that enables these benefits to be realised without the overhead of sorting the reads. With these techniques, a 45x coverage of real human genome sequence data compresses losslessly to under 0.5 bits per base, allowing the 135.3Gbp of sequence to fit into only 8.2Gbytes of space (trimming a small proportion of low-quality bases from the reads improves the compression still further). This is more than 4 times smaller than the size achieved by a standard BWT-based compressor (bzip2) on the untrimmed reads, but an important further advantage of our approach is that it facilitates the building of compressed full text indexes such as the FM-index on large-scale DNA sequence collections.
cs.DS
cs
Doc-StartBIOINFORMATICS Large-scale compression of genomic sequence databases with the Burrows-Wheeler transform Anthony J. Cox,1, ∗ Markus J. Bauer, 1 Tobias Jakobi 2 and Giovanna Rosone 3 1Computational Biology Group, Illumina Cambridge Ltd., Chesterford Research Park, Little Chesterford, Essex CB10 1XL, United Kingdom 2Computational Genomics, CeBiTec, Bielefeld University, Bielefeld, Germany 3University of Palermo, Dipar timento di Matematica e Informatica,Via Archirafi 34, 90123 Palermo, Italy Received on XXXXX; revised on XXXXX; accepted on XXXXX Vol. 00 no. 00 2012 Pages 1–6 Associate Editor : XXXXXXX ABSTRACT Motivation: The Burrows-Wheeler transform (BWT) is the foundation of many algorithms for compression and indexing of text data, but the cost of computing the BWT of very large string collections has prevented these techniques from being widely applied to the large sets of sequences often encountered as the outcome of DNA sequencing experiments. In previous work (Bauer et al. (2011)), we presented a novel algorithm that allows the BWT of human genome scale data to be computed on very moderate hardware, thus enabling us to investigate the BWT as a tool for the compression of such datasets. Results: We first used simulated reads to explore the relationship between the level of compression and the error rate, the length of the reads and the level of sampling of the underlying genome and compare choices of second-stage compression algorithm. We demonstrate that compression may be greatly improved by a par ticular reordering of the sequences in the collection and give a novel ‘implicit sor ting’ strategy that enables these benefits to be realised without the overhead of sor ting the reads. With these techniques, a 45× coverage of real human genome sequence data compresses losslessly to under 0.5 bits per base, allowing the 135.3Gbp of sequence to fit into only 8.2Gbytes of space (trimming a small propor tion of low-quality bases from the reads improves the compression still fur ther). This is more than 4 times smaller than the size achieved by a standard BWT-based compressor (bzip2) on the untrimmed reads, but an impor tant fur ther advantage of our approach is that it facilitates the building of compressed full text indexes such as the FM- index (Ferragina and Manzini (2000)) on large-scale DNA sequence collections. Availability: Code to construct the BWT and SAP-array on large genomic data sets is par t of the BEETL library, available as a github respository at [email protected]:BEETL/BEETL.git. Contact: [email protected] ∗ to whom correspondence should be addressed c(cid:13) Oxford University Press 2012. 1 INTRODUCTION In this paper we present strategies for the lossless compression of the large number of short DNA sequences that comprise the raw data of a typical sequencing experiment. Much of the early work on the compression of DNA sequences was motivated by the notion that the compressibility of a DNA sequence could serve as a measure of its information content and hence as a tool for sequence analysis. This concept was applied to topics such as feature detection in genomes (Grumbach and Tahi (1994); Rivals et al. (1996); Milosavljevic and Jurka (1993)) and alignment-free methods of sequence comparison (Chen et al. (2002)) - a comprehensive review of the field up to 2009 is given by Giancarlo et al. (2009) . However, Grumbach and Tahi in 1994 have been echoed by many subsequent authors in citing the exponential growth in the size of nucleotide sequence databases as a reason to be interested in compression for its own sake. The recent and rapid evolution of DNA sequencing technology has given the topic more practical relevance than ever. The outcome of a sequencing experiment typically comprises a large number of short sequences - often called ‘reads’ - plus metadata associated with each read and a ‘quality score’ that estimates the confidence of each base. Tembe et al. (2010) and Deorowicz and Grabowski (2011) both describe methods for compressing the FASTQ file format in which such data is often stored. The metadata is usually highly redundant, whereas the quality scores can be hard to compress, and these two factors combine to make it hard to estimate the degree of compression achieved for the sequences themselves. However, both schemes employ judicious combinations of standard text compression methods such as Huffman and Lempel-Ziv, with which it is hard to improve substantially upon the naive method of using a different 2-bit code for each of the 4 nucleotide bases. For example, GenCompress (Chen et al. (2002)) obtains 1.92 bits per base (henceforth bpb) compression on the E.coli genome. An experimenter wishing to sequence a diploid genome such as a human might aim for 20-fold average coverage or more, with the intention of ensuring a high probability of capturing both alleles of any heterozygous variation. This oversampling creates an opportunity for compression that is additional to any redundancy 1 Cox et al. inherent in the sample being sequenced. However, in a whole- genome shotgun experiment, the multiple copies of each locus are randomly dispersed among the many millions of reads in the dataset, making this redundancy inaccessible to any compression method that relies on comparison with a small buffer of recently-seen data. This can be addressed by ‘reference-based’ compression (Kozanitis et al. (2010); Fritz et al. (2011)), which saves space by sorting aligned reads by the position they align to on a reference sequence and expressing their sequences as compact encodings of the differences between the reads and the reference. However this is fundamentally a lossy strategy that achieves best compression by retaining only reads that closely match the reference, limiting the scope for future reanalyses such as realignment to a refined reference (containing, perhaps, ethnicity specific haplotypes (Dewey et al. (2011))) or any sort of de novo discovery on reads that did not align well initially. Moreover, as Yanovsky (2011) points out, a reference-based approach is inapplicable to experiments for which a reference sequence is not clearly defined (metagenomics) or entirely absent (de novo). Yanovsky (2011) describes a lossless compression method ReCoil for sets of reads that works in external memory (i.e. via sequential access to files held on disk) and is therefore not constrained in scale by available RAM. A graph of similarities between the reads is first constructed and then each read is expressed as a traversal on that graph, encodings of these traversals then being passed to a general-purpose compressor (ReCoil uses 7-Zip1 ). The two-stage nature of this procedure is shared by the family of compression algorithms based on the Burrows-Wheeler transform (BWT). The BWT is simply a permutation of the letters of the text and so is not a compression method per se. Its usefulness for compression stems from the facts that the BWT tends to be more compressible than its originating text (since it tends to group symbols into ‘runs’ of like letters, which are easy to compress) and, remarkably, that the originating text can be reconstructed from it (thus allowing the BWT to represent the originating text without loss of information). Once generated, the BWT is compressed by standard techniques: a typical scheme would follow an initial move-to-front encoding with run length encoding and then Huffman encoding. The widely-used BWT-based compressor bzip22 divides a text into blocks of (at most, and by default) 900 kbytes and compresses each separately, so is only able to take advantage of local similarities in the data. Mantaci et al. (2005) gave the first extension of the BWT to a collection of sequences and used it as a preprocessing step for the simultaneous compression of the sequences of the collection. They show that this method is more effective than the technique used by a classic BWT-based compressor, because one could potentially access redundancy arising from these long-range correlations in the data. Until recently, computing the BWT of a large collection of sequences was prevented from being feasible on very large scales by the need either to store the suffix array of the set of reads in RAM (requiring 400Gbytes of RAM for a dataset of 1 billion 100-mer reads) or to resort to “divide-and- conquer then merge” strategies at considerable cost in CPU time. in Bauer et al. (2011), three of the present authors However, 1 www.7-zip.org, Igor Pavlov 2 www.bzip.org, Julian Seward 2 described fast and RAM-efficient methods capable of computing the BWT of sequence collections of the size encountered in human whole genome sequencing experiments, computing the BWT of collections as large as 1 billion 100-mers. Unlike the transformation in Mantaci et al. (2005), the algorithms in Bauer et al. (2011) require ordered and distinct ‘end-marker’ characters to be appended to the sequences in the collection, making the collection of sequences an ordered multiset, i.e. the order of the sequences in the collection is determined by the lexicographical order of these end-markers. It is easy to see that the ordering of sequences in the collection can affect the compression, since the same or similar sequences might be distant in the collection. We will outline different ordering strategies for the input sequences and will show their effect on simulated and real data. We have created an open-source C++ library BEETL that makes it practical to compute the BWT of large collections of DNA sequences and and thus enables the redundancy present in large- scale genomic sequence datasets to be fully exploited by generic second-stage compressors such as bzip2 and 7-Zip. We use simulated read collections of up to 60× redundancy to investigate the effect of genome coverage, sequencing error and read length on the level of compression. Furthermore, we show the effect of read trimming and choices of second-stage compressors on the level of compression. Finally, we describe an extension of our method that implicitly reorders sequences in the collection so as to drastically improve compression. 2 METHODS Consider a string s comprising k symbols from some finite ordered alphabet Σ = {c1 , c2 , . . . , cσ } of size σ . We mark the end of s by appending an additional symbol $ that we consider to be lexicographically smaller than any symbol in Σ. We can build k + 1 distinct suffixes from s by starting at different symbols of the string and continuing rightwards until we reach $. If we imagine placing then the Burrows-Wheeler these suffixes in alphabetical order, transform of s (Burrows and Wheeler (1994)) can be defined such that the i-th element of the BWT is the symbol in s that precedes the first symbol of the i-th member of this ordered list of suffixes. Each symbol in the BWT therefore has an associated suffix in the string. We recommend Adjeroh et al. (2008) for further reading. One way to generalize the notion of the BWT to a collection of m strings S = {s1 , . . . , sm } (see also Mantaci et al. (2005)) is to imagine that each member si of the collection is terminated by a distinct end marker $i such that $1 < · · · < $m . Moreover, we assume that the end markers are lexicographically smaller than any symbol in Σ. In Bauer et al. (2011), we give two related methods for computing the BWT of large collections of DNA sequences by making use of sequential reading and writing of files from disk. The first variant BCR requires 14 bytes of RAM for each sequence in the collection to be processed (and is hence capable of processing over a billion reads in 16Gbytes of RAM), whereas the second variant BCRext uses negligible RAM at the expense of a larger amount of disk I/O. To understand how a BWT string might be compressed, we can think of it as the concatenation of a set of ‘runs’ of like letters, each of which can be described by its constituent symbol c plus an integer i denoting the number of times c is repeated. We assume all runs are maximal, i.e. they do not abut another run of the same character. Intuitively, for two strings of the same length, we expect the string that consists of fewer (and hence, on average, longer) runs to compress to a smaller size. Given S , our strategy is to search for permutations S → S (cid:48) of the sequences in the collection such that the BWT of the permuted collection S (cid:48) can be more readily compressed than the BWT of S . For the BWT of S , we define a bit array called the SAP-array (for ‘same-as-previous’) whose elements are set to 1 if and only if the suffixes associated with their corresponding characters in the BWT are identical (their end markers excluded) to those associated with the characters that precede them. Thus each 0 value in the SAP- array denotes the start of a new SAP-interval in the BWT, within which all characters share an identical associated suffix. The BWTs of S and S (cid:48) can only differ within SAP-intervals that contains more than one distinct symbol. Within such an SAP- interval, the ordering of the characters is entirely determined by the ordering of the reads they are contained in, so best compression is achieved if we permute the characters so they are grouped into as few runs as possible. In doing this we are implicitly permuting the sequences in the collection. As illustrated by Figure 1, if the collection is sorted such that the reverses of the sequences are in lexicographic order (we call this reverse lexicographic order, or RLO for short), then the symbols in an SAP-interval of length l must group into at most φ runs, where φ ≤ σ is the number of distinct characters encountered within the interval. This compares with an upper bound up to l runs if no sorting is applied. We would therefore expect the RLO-sorting of a collection to compress better than the original and our experiments in the next section show this to be the case in practice. However, we wish our approach to scale to many millions of reads and so we would prefer to avoid sorting the collection as a preprocessing step. If we know the SAP-array of a BWT, it is a simple single-pass procedure to read both the BWT and its SAP-array from disk in tandem, identify SAP-intervals, sort the characters within them and output a modified BWT. We note there is scope to experiment with different heuristics - e.g. in Figure 1, placing the T prior to the two Gs in the ACCT-interval would eliminate another run by extending the run of Ts begun in the preceding ACCACT-interval. It remains to compute the SAP-array. In order to do this, we show that the method of BWT construction introduced by three of the present authors in Bauer et al. (2011) can be modified to compute the SAP-array alongside the BWT with minimal additional overhead. We do not attempt to describe this previous work in full detail, but the BWT construction algorithm proceeds in k stages, k being the length of the reads in the collection.3 At stage j , the j - suffixes (0 ≤ j ≤ k) of the reads (that is, the suffixes of length j , the 0-suffix being defined as the suffix that contains only the end marker $) are processed in lexicographic order and the characters that precede them are merged into a ‘partial BWT’. The partial BWT at step j can be thought of as the concatenation of σ + 1 segments Bj (0), Bj (1), . . . , Bj (σ), where each Bj (h) corresponds to the symbols in the partial BWT segments that precede all suffixes of S that are of length smaller or equal to Large-scale BWT compression j starting with c0 = $4 , for h = 0, and with ch ∈ Σ, for h = 1, . . . , σ . At each step j , with 0 < j ≤ k the main idea is to compute the positions of all characters that precede the j -suffixes in the old partial BWT in order to obtain an updated partial BWT that also contains the symbols associated with the suffixes of length j . The two variants BCR and BCRext of the Bauer et al. (2011) algorithm contrive in slightly different ways (with different trade-offs between RAM use and I/O) to arrange matters so that the symbols we have to insert into the partial BWT are processed by lexicographic order of their associated j -suffixes, which allows each segment of the partial BWT to be held on disk and accessed sequentially. Crucially, this also means that the characters in an SAP-interval will be processed consecutively. When we write a BWT character, we can also write its SAP status at the same time, since it is not going to change in subsequent iterations. We consider two suffixes u and v of length j of two different reads sr and st satisfying 1 ≤ r, t ≤ m and r (cid:54)= t. Both sr and st belong to S and assume that u is lexicographically less than v . Then, they are identical (up to the end-markers) and so the SAP status of v must be set to 1 if and only if the following conditions hold: the symbols associated with suffixes u(cid:48) and v (cid:48) of length (j − 1) of sr and st are equal which guarantees that u and v begin with the same symbol, and they are stored in the same BWT segment, implying that u(cid:48) and v (cid:48) begin with the same symbol. The SAP status of all suffixes between u(cid:48) and v (cid:48) must be set to 1 which ensures that all suffixes between u(cid:48) and v (cid:48) in iteration j − 1 coincide and have the length j − 1. Note that the symbols in the BWT segment associated with suffixes between u(cid:48) and v (cid:48) could be different from the symbol preceding u(cid:48) (and v (cid:48) ). Actually, we compute the SAP status of the suffixes u and v at the step j − 1 when we insert the corresponding suffixes u(cid:48) and v (cid:48) . In particular, when we copy the values from the old to the new partial BWT and insert the new m values, we can read the SAP values and verify the condictions stated above at the same time. It means that at the end of the iteration j − 1, we obtain the partial BWT and the SAP values of the next suffixes to insert and, at iteration j , we can directly set the SAP status of the j -suffixes and compute the SAP status for the suffixes of the next iteration. i.e. we can We can compute the SAP-interval by induction, compute the SAP status of the j -suffixes at iteration j − 1 by using the symbols associated with the (j − 1)-suffixes and their SAP values. At iteration j − 1, we assume that we know the SAP values of the (j − 1)-suffixes and we have to compute the SAP values of the j -suffixes need for the next iteration. For simplicity, we focus on the computation of the SAP values of a fixed BWT segment, i.e. we only consider the insertion of the (j − 1)-suffixes starting with the same symbol. In our implementation, we use a counter A for each symbol of the alphabet and a generic counter Z . The element A[h], for each h = 1, . . . , σ and ch ∈ Σ (we can ignore the end-marker because the reads have the same length and hence it does not appear in the partial BWT), contains the number of SAP intervals between the first position and the position of the last inserted symbol associated with a read sq (for some 1 ≤ q ≤ m) equal to ch in the considered BWT segment. The counter Z contains 3 Our implementation and, for simplicity, our description here assume all reads in S to have the same length, but this restriction is not in fact intrinsic to the algorithm. 4 In our implementation, we assume that all end-markers are equal, and sr [k] < st [k], if r < t. 3 Cox et al. the number of the SAP intervals between the first position and the position where we have to insert cp . The symbol cp is associated with the new suffix of length j − 1 of read st , with 1 ≤ t ≤ m, that we want to insert. If the value A[p] is equal to Z , then the SAP status of the j -suffix of st (obtained by concatenating cp (j − 1)- suffix of st ) must be set to 1, otherwise it is set to 0. We observe that if A[p] = Z holds true, then this implies that j -suffixes of sr and st are in the same SAP interval. B (0) SAP (0) 0 T 1 T 1 T 1 T B (1) SAP (1) 0 T 0 G 1 T G 1 0 C 0 T 1 G G 0 B (2) SAP (2) 0 C 0 A 1 A 1 A 1 A C 0 1 C 1 A C 1 B (3) SAP (3) 0 A A 1 0 $4 $2 0 B (4) SAP (4) 0 C C 1 1 C 1 C 0 $3 0 A $1 0 suffixes $1 $2 $3 $4 suffixes ACCAC T $2 ACCT$1 ACCT$2 ACCT$4 AC T $3 AGACCT$1 AGACCT$4 AT ACC T $2 suffixes CAC T $3 CCAC T $3 CCT$1 CCT$2 CCT$4 CT$1 CT$2 CT$3 CT$4 suffixes GACCT$1 GACCT$4 GAGACC T $4 GAT ACC T $2 suffixes T$1 T$2 T$3 T$4 T ACCAC T $3 T ACC T $2 T AGACC T $1 ⇒ BSAP (0) T T T T BSAP (1) T G G T C G T G BSAP (2) C A A A A A C C C BSAP (3) A A $4 $2 BSAP (4) C C C C $3 A $1 Fig. 1. Columnwise from left, we have the BWT of the collection {T AGACC T , GAT ACC T , T ACCAC T , GAGACC T }, = S the SAP bit and the suffix associated with each symbol. collection The the of BWT the shows side right-hand {T ACCAC T , T AGACC T , GAGACC T , GAT ACC T } obtained by sorting the elements of S into reverse lexicographic order (RLO). This permutes the symbols within SAP-intervals so as to minimise the number of runs. various coverage levels for compression both on the original reads and the BWT transform. We found the PPMd mode (-m0=PPMd) of 7-Zip to be a good choice of second-stage compressor for the BWT strings (referred to as PPMd (default) in the following). RLO-sorting the datasets led to a BWT that was slightly more compressible than the SAP-permuted BWT, but the difference was small (0.36bpb versus 0.38bpb at 60×, both over 30% less than the 0.55bpb taken up by the compressed BWT of the unsorted reads). In contrast, when gzip5 , bzip2 and default PPMd were applied to the original reads, each gave a compression level that was consistent across all levels of coverage and none was able to compress below 2 bits per base. However, a sweep of the PPMd parameter space yielded a combination -mo=16 -mmem=2048m that attained 0.50bpb on the 60× dataset (in the following we will refer to this parameter setting as PPMd (large)). This is because the E.coli genome is small enough to permit several-fold redundancy of the genome to be captured in the 2Gbytes of working space that this combination specifies. For a much larger genome such as human, this advantage disappears. Figure 3 summarizes results from a set of 192 million human reads6 previously analyzed by Yanovsky (2011): PPMd(large) compresses the BWT of the reads less well than PPMd(default), as well as being several times slower. We also investigated the effects of sequencing errors on the compression ratios by simulating 40× data sets of 100bp reads with different rates of uniformly distributed substitution error, finding that an error rate of 1.2% approximately doubled the size of the compressed BWT (0.90bpb, compared with 0.47bpb for error-free data at the same coverage). We were interested in the behaviour of BWT-based compression techniques as a function of the read length. To this end, we fixed a coverage of 40× and simulated error-free E.coli reads of varying lengths. As the read length increased from 50bp to 800bp, the size of the compressed BWTs shrank from 0.54bpb to 0.32bpb. This is not surprising since longer reads allow repetitive sequences to be grouped together, which could otherwise potentially be disrupted by suffixes of homologous sequences. Finally, we assessed the performance of the compressors on a typical human genome resequencing experiment7 , containing 135.3Gbp of 100-base reads, or about 45× coverage of the human genome. In addition to this set of reads, we created a second dataset by trimming the reads based on their associated quality scores according to the scheme described in bwa (Li and Durbin (2009)). Setting a quality score of 15 as the threshold removes 1.3% of the input bases. We again constructed the corresponding data sets in RLO and SAP order. Table 4 shows the improvement in terms of compression after the trimming. Eliminating 1.3% of the bases improves the compression ratio by about 4.5%, or compressing the entire 133.6Gbp down to 7.7Gbytes. 3 RESULTS Reads simulated from the E.coli genome (K12 strain) allowed us to assess separately the effects of coverage, read length and sequencing error on the level of compression achieved. First, a 60× coverage of error-free 100 base reads was subsampled into datasets as small as 10×. Figure 2 shows a summary plot of the compression ratios at 5 www.gzip.org, Jean-loup Gailly and Mark Adler 6 http://www.ebi.ac.uk/ena/data/view/SRX001540 7 Available at http://www.ebi.ac.uk/ena/data/view/ ERA015743 4 Large-scale BWT compression Input size BWT BWT-RLO BWT-SAP untrimmed 135.3Gbp 0.484 0.528 0.746 trimmed 133.6Gbp 0.721 0.504 0.462 Fig. 4. Different combinations of first-stage (BWT, SAP- and RLO- permuted BWT) and PPMd as the second-stage compression method compared on a 45× human data set. Values state the compression achieved in bits per input base. We trimmed the reads by following the strategy described for bwa which removed 1.3% of the bases. This leads to an improvement in terms of compression ratio of 4.5%. 4 DISCUSSION Analysing the SRX001540 dataset allowed us to compare our results with ReCoil, but the reads are noisier and shorter than more recent datasets and, at under 3×, the oversampling of the genome is too low to manifest the kind of coverage-induced compression that Figure 2 illustrates. Nevertheless, we were able to compress the data to 1.21bpb in just over an hour, compared to 1.34bpb achieved by ReCoil in 14 hours (albeit on a slower processor). On the more recent ERA015743 data we obtained 0.48bpb, allowing the 135.3Gbp of data to fit in 8.2Gbytes of space. In both cases, reordering the strings in the collection - implicitly or explicitly - is necessary for best compression. One situation where this might be problematic would be if the reads are paired - typically, sequenced from different ends of a library of DNA templates. An obvious way to capture this relationship would be to store the two reads in a pair at adjacent positions in S - i.e. the first two reads in the collection are reads 1 and 2 of the first read-pair, and so forth. If we wanted to retain this information after a change in ordering, we would incur the overhead of storing an additional pointer to associate each read with its mate. In Bauer et al. (2012), we give efficient algorithms for inverting the BWT and recovering the original reads. However, when augmented with relatively small additional data structures, the compressed BWT forms the core of the FM-index (Ferragina and Manzini (2000, 2005); Ferragina et al. (2007)) that allows count (“how many times does a k-mer occur in the dataset?”) and locate (“at what positions in the collection does the k-mer occur?”) queries. Several variants of this algorithmic scheme exist which make different tradeoffs between the compression achieved and the time needed for the count and locate operations. For instance, Ferragina et al. (2007) describes a variant of the FM-index that indexes a string T of length n within nHk (T )+ o(n) bits of storage, where Hk (T ) is the k-th order empirical entropy of T . This index counts the occurrences in T of a string of length p in O(p) time and it locates each occurrence of the query string in O(log1+n) time, for any constant 0 <  < 1. Most sequencing technologies associate a quality score with each sequenced base and Kozanitis et al. (2010) found that significant lossless compression of these scores can be hard to achieve, but also showed that a lossy reduction in resolution of the scoring scheme could obtain better compression while having limited impact on the accuracy of variant calls derived from the sequences. Future work we are pursuing would complement such approaches by using queries to a BWT-based index for de novo identification of bases that are not likely to be important in downstream variant calls, whose quality scores can then be discarded entirely. 5 Fig. 2. We simulated 60× coverage of error-free 100 base reads from the E.coli genome and subsampled this into datasets as small as 10×. We compared different compression schemes, both on the raw input sequences and the BWT. RLO denotes a reverse lexicographical ordering of the reads, SAP is the data set where all the reads are ordered according to the same-as- previous array. The x-axis gives the coverage level whereas the y -axis shows the number of bits used per input symbol. Gzip, Bzip2, PPMd (default) and PPMd (large) show compression achieved on the raw sequence data. BWT, BWT-SAP and BWT-RLO give compression results on the BWT using PPMd (default) as second-stage compressor. Stage 1 Reads BWT Method Stage 2 Bzip2 PPMd (default) PPMd (large) -mx9 Bzip2 PPMd (default) PPMd (large) -mx9 Bzip2 PPMd (default) PPMd (large) -mx9 BWT-SAP 3520 - Time Stage 1 Stage 2 905 324 5155 17974 818 353 4953 16709 601 347 3116 11204 3520 Compression 2.25 2.04 2.00 1.98 2.09 1.93 2.05 2.09 1.40 1.21 1.28 1.34 Fig. 3. Different combinations of first-stage (BWT, SAP-permuted BWT) and second-stage (bzip2 with default parameters, PPMd mode of 7-Zip with default parameters, PPMd mode of 7-Zip with -mo=16 -mmem=2048m, deflate mode of 7-Zip with -mx9) compression compared on 192 million human reads previous analyzed by Yanovsky (2011). Time is in CPU seconds, as measured on a single core of an Intel Xeon X5450 (Quad-core) 3GHz processor. Compression is in bits per base. 1020304050600.00.51.01.52.02.5coveragebits per baselllllllGzipBzip2PPMd (default)BWTPPMd (large)BWT−SAPBWT−RLO Cox et al. More broadly, many computationally intensive tasks in sequence analysis might be facilitated by having a set of reads in indexed form. For example, Simpson and Durbin (2010, 2011) show how the overlap of a set of reads can be computed from its FM-index and apply this insight to build a practical tool for de novo assembly. By making it feasible to index sets of reads on the scale necessary for whole human genome sequencing, our work raises the intriguing possibility of a new generation of algorithms that operate directly on sets of reads held in compressed index form. ACKNOWLEDGEMENT The authors would like to thank Dirk Evers for his support throughout this project. Funding: M.J.B. and A.J.C. are employees of Illumina Inc., a public company that develops and markets systems for genetic analysis, and receive shares as part of their compensation. Part of T.J.’s contribution was made while on a paid internship at Illumina’s offices in Cambridge, UK. REFERENCES Adjeroh, D., Bell, T., and Mukherjee, A. (2008). The Burrows-Wheeler Transform: Data Compression, Suffix Arrays, and Pattern Matching. Springer Publishing Company, Incorporated, 1st edition. Bauer, M. J., Cox, A. J., and Rosone, G. (2011). Lightweight BWT construction for very large string collections. In CPM 2011, volume 6661 of LNCS, pages 219–231. Springer. Bauer, M. J., Cox, A. J., and Rosone, G. (2012). Lightweight algorithms for constructing and inverting the BWT of string collections. Theoretical Computer Science. Available online 10 February 2012. Burrows, M. and Wheeler, D. J. (1994). A block sorting data compression algorithm. Technical report, DIGITAL System Research Center. Chen, X., Li, M., Ma, B., and Tromp, J. (2002). DNACompress: fast and effective DNA sequence compression. Bioinformatics, 18(12), 1696–1698. Deorowicz, S. and Grabowski, S. (2011). Compression of genomic sequences in FASTQ format. Bioinformatics, 27(6), 860–862. Dewey, F. E., Chen, R., Cordero, S. P., Ormond, K. E., Caleshu, C., Karczewski, K. J., Whirl-Carrillo, M., Wheeler, M. T., Dudley, J. T., Byrnes, J. K., Cornejo, O. E., Knowles, J. W., Woon, M., Sangkuhl, K., Gong, L., Thorn, C. F., Hebert, J. M., Capriotti, E., David, S. P., Pavlovic, A., West, A., Thakuria, J. V., Ball, M. P., Zaranek, A. W., Rehm, H. L., Church, G. M., West, J. S., Bustamante, C. D., Snyder, M., Altman, R. B., Klein, T. E., Butte, A. J., and Ashley, E. A. (2011). Phased whole-genome genetic risk in a family quartet using a major allele reference sequence. PLoS Genet, 7(9), e1002280. Ferragina, P. and Manzini, G. (2000). Opportunistic data structures with applications. In Proceedings of the 41st Annual Symposium on Foundations of Computer Science, pages 390–398, Washington, DC, USA. IEEE Computer Society. Ferragina, P. and Manzini, G. (2005). Indexing compressed text. J. ACM , 52, 552–581. Ferragina, P., Manzini, G., M akinen, V., and Navarro, G. (2007). Compressed representations of sequences and full-text indexes. ACM Trans. Algorithms, 3. Fritz, M. H., Leinonen, R., Cochrane, G., and Birney, E. (2011). Efficient storage of high throughput DNA sequencing data using reference-based compression. Genome Research, 21(5), 734–740. Giancarlo, R., Scaturro, D., and Utro, F. (2009). Textual data compression in computational biology: a synopsis. Bioinformatics, 25(13), 1575–1586. Grumbach, S. and Tahi, F. (1994). A new challenge for compression algorithms: Genetic sequences. In Information Processing and Management, volume 30, pages 875–886. Kozanitis, C., Saunders, C., Kruglyak, S., Bafna, V., and Varghese, G. (2010). Compressing genomic sequence fragments using SlimGene. In RECOMB, volume 6044 of LNCS, pages 310–324. Springer. Li, H. and Durbin, R. (2009). Fast and accurate short read alignment with Burrows- Wheeler transform. Bioinformatics, 25(14), 1754–1760. Mantaci, S., Restivo, A., Rosone, G., and Sciortino, M. (2005). An Extension of the Burrows Wheeler Transform and Applications to Sequence Comparison and Data Compression. In CPM 2005, volume 3537 of LNCS, pages 178—189. Milosavljevic, A. and Jurka, J. (1993). Discovering simple DNA sequences by the algorithmic significance method. Computer applications in the biosciences : CABIOS, 9(4), 407–411. Rivals, E., Dauchet, M., Delahaye, J., and Delgrange, O. (1996). Compression and genetic sequence analysis. Biochimie, 78(5), 315–22. Simpson, J. T. and Durbin, R. (2010). Efficient construction of an assembly string graph using the FM-index. Bioinformatics, 26(12), i367–i373. Simpson, J. T. and Durbin, R. (2011). Efficient de novo assembly of large genomes using compressed data structures. Genome Research. Published in Advance December 7, 2011. Tembe, W., Lowey, J., and Suh, E. (2010). G-SQZ: compact encoding of genomic sequence and quality data. Bioinformatics, 26(17), 2192–2194. Yanovsky, V. (2011). ReCoil - an algorithm for compression of extremely large datasets of DNA data. Algorithms for Molecular Biology, 6(1), 23. 6
1007.2021
4
1007
2011-10-06T00:46:31
Parameterizing by the Number of Numbers
[ "cs.DS", "cs.DM" ]
The usefulness of parameterized algorithmics has often depended on what Niedermeier has called, "the art of problem parameterization". In this paper we introduce and explore a novel but general form of parameterization: the number of numbers. Several classic numerical problems, such as Subset Sum, Partition, 3-Partition, Numerical 3-Dimensional Matching, and Numerical Matching with Target Sums, have multisets of integers as input. We initiate the study of parameterizing these problems by the number of distinct integers in the input. We rely on an FPT result for ILPF to show that all the above-mentioned problems are fixed-parameter tractable when parameterized in this way. In various applied settings, problem inputs often consist in part of multisets of integers or multisets of weighted objects (such as edges in a graph, or jobs to be scheduled). Such number-of-numbers parameterized problems often reduce to subproblems about transition systems of various kinds, parameterized by the size of the system description. We consider several core problems of this kind relevant to number-of-numbers parameterization. Our main hardness result considers the problem: given a non-deterministic Mealy machine M (a finite state automaton outputting a letter on each transition), an input word x, and a census requirement c for the output word specifying how many times each letter of the output alphabet should be written, decide whether there exists a computation of M reading x that outputs a word y that meets the requirement c. We show that this problem is hard for W[1]. If the question is whether there exists an input word x such that a computation of M on x outputs a word that meets c, the problem becomes fixed-parameter tractable.
cs.DS
cs
Parameterizing by the Number of Numbers(cid:63) Michael R. Fellows1, Serge Gaspers2, and Frances A. Rosamond1 1 School of Engineering and IT, Charles Darwin University, NT 0909, Australia. {michael.fellows,frances.rosamond}@cdu.edu.au 2 Institute of Information Systems, Vienna University of Technology, Vienna, Austria. [email protected] Abstract. The usefulness of parameterized algorithmics has often depended on what Niedermeier has called "the art of problem parameterization". In this paper we intro- duce and explore a novel but general form of parameterization: the number of numbers. Several classic numerical problems, such as Subset Sum, Partition, 3-Partition, Numerical 3-Dimensional Matching, and Numerical Matching with Target Sums, have multisets of integers as input. We initiate the study of parameterizing these problems by the number of distinct integers in the input. We rely on an FPT result for Integer Linear Programming Feasibility to show that all the above- mentioned problems are fixed-parameter tractable when parameterized in this way. In various applied settings, problem inputs often consist in part of multisets of integers or multisets of weighted objects (such as edges in a graph, or jobs to be scheduled). Such number-of-numbers parameterized problems often reduce to subproblems about tran- sition systems of various kinds, parameterized by the size of the system description. We consider several core problems of this kind relevant to number-of-numbers param- eterization. Our main hardness result considers the problem: given a non-deterministic Mealy machine M (a finite state automaton outputting a letter on each transition), an input word x, and a census requirement c for the output word specifying how many times each letter of the output alphabet should be written, decide whether there exists a computation of M reading x that outputs a word y that meets the requirement c. We show that this problem is hard for W [1]. If the question is whether there exists an input word x such that a computation of M on x outputs a word that meets c, the problem becomes fixed-parameter tractable. 1 Introduction Parameterized complexity and algorithmics has been developing for more than twenty years. Some important progress of the field has depended on what Niedermeier has called "the art of problem parameterization" (see Chapter 5 of his monograph [23]). For example, it was Cristina Bazgan who first suggested that the parameter might be k = 1/ in the study of the complexity of approximation, leading eventually to the study of EPTASs [3]. Here we explore, for the first time (to our knowledge), a parameterization that seems widely relevant: the number of numbers. Many problems take as input informa- tion that consists (in part) of multisets of integers or multisets of weighted objects, such as weighted edges in a weighted graph, the time-requirements of jobs to be (cid:63) A preliminary version of this paper appeared in the proceedings of IPEC 2010 [7]. M.R.F. and F.A.R. acknowledge support from the Australian Research Council. S.G. acknowledges partial support from the European Research Council (COMPLEX REASON, 239962), from Conicyt Chile (Basal-CMM), and from the Australian Research Council. 1 1 0 2 t c O 6 ] S D . s c [ 4 v 1 2 0 2 . 7 0 0 1 : v i X r a 2 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond scheduled, or the sequence of molecular weights of a spectrographic dataset. Our in- vestigations are of importance for problem input distributions where the number of distinct numerical values is small compared to the overall input size, and when the modeling of the problem allows rounding as a way to get to fewer distinct values. In classical complexity, this "parameterization" has been explored in distribution- sensitive algorithmics [29]. For example, while Ω(n log n) is a lower bound on sorting n values in the comparison model [18], a multiset of cardinality n and h distinct values can be sorted using O(n log h) comparisons [22]. It is perhaps surprising that this parameterization in the sense of Niedermeier's "art of problem parameterization" [23, 24] has not been considered before in parame- terized complexity, as it seems entirely well-motivated. While weighted combinatorial optimization problems have generally strong claims to model realism, it is often the case that, e.g., the jobs to be scheduled may be of certain standard sizes arising in a limited number of ways, or that the costs of the nodes in a network problem may depend on the model and vendor of the device, of which there are a limited num- ber of possibilities. Many similar scenarios easily come to mind. A bounded number of numbers may also arise naturally and implicitly in parameterized problems when numbers are associated to other parameterized aspects of a problem, such as alphabet size. As an initial foray, we first show that a number of classic NP-hard problems about multisets of integers, when parameterized in this way, become fixed-parameter tractable. The proofs are easy, and the knowledgeable reader might anticipate them almost as exercises today -- they use the relatively deep result that Integer Linear Programming, parameterized by the number of variables, is FPT. Until recently, as noted in the 2006 monograph by Niedermeier [23], there were not so many interesting applications of this fundamental result (see [1, 11, 12, 16] for some exceptions). At a deeper level of engagement with this parameterization, we describe some examples of how number-of-numbers parameterized problems reduce to numerical problems about Mealy machines, parameterized by the size of the description of the machine. We show that one basic problem about Mealy machines, parameterized in this way, is FPT, and that another is W [1]-hard. 2 Preliminaries Integer Linear Programming In the Integer Linear Programming Feasibility problem (ILPF), the input is an m × n matrix A of integers and an m-vector b of integers, the parameter is n, and the question is whether there exists an n-vector x of integers satisfying the m inequalities Ax ≤ b. ILPF, parameterized by the number of variables, was shown to be fixed-parameter tractable by Lenstra [20] and the running time has been improved by Kannan [17] and by Frank and Tardos [14]. Multisets Let A be a multiset. The cardinality of A, denoted A, is the total number of elements in A, including repeated memberships. The variety of A, denoted A, is the number of distinct elements in A. Element a has multiplicity m in A if it occurs m times in A. We denote the set of integers from 1 to n by [n] = {1, . . . , n}. Parameterizing by the Number of Numbers 3 Graphs Let G = (V, E) be a graph, v ∈ V be a vertex of G, and S ⊆ V be a subset of vertices of G. The subgraph of G induced on S is the graph G[S] = (S, E ∩ {uv : u, v ∈ S}). The set S is a clique of G if G[S] is complete, i.e. there is an edge between every two distinct vertices of G[S]. The set S is an independent set of G if G[S] is empty, i.e. G[S] has no edge. The neighborhood of v is the set of vertices incident to v and denoted N (v). The degree of v is d(v) = N (v). We also define NS(v) = N (v)∩ S and dS(v) = NS(v). Words Let Σ be an alphabet. The elements of Σ are called letters, and a word x of length n = x is a sequence of n letters. The symbol  denotes the empty letter. We denote the concatenation of two words x1, x2 ∈ Σ∗ by x1x2. The ith power of a word x is denoted xi or (x)i and represents the word xx . . . x . i times (cid:124) (cid:123)(cid:122) (cid:125) Parameterized Complexity We define the basic notions of Parameterized Complex- ity and refer to other sources [6, 13, 23] for an in-depth treatment. A parameterized problem is a set of pairs (I, k), the instances, where I is the main part and k is the parameter. A parameterized problem is fixed-parameter tractable if there exist a computable function f and an algorithm that solves any instance (I, k) of size n in time f (k)nO(1). FPT denotes the class of all fixed-parameter tractable parameterized decision problems. Parameterized complexity offers a completeness theory that allows the accumula- tion of strong theoretical evidence that some parameterized problems are not fixed- parameter tractable. This theory is based on a hierarchy of complexity classes FPT ⊆ W[1] ⊆ W[2] ⊆ W[3] ⊆ ··· ⊆ XP. where all inclusions are believed to be strict. Each class W[i] contains all parameter- ized decision problems that can be reduced to a canonical parameterized satisfiability problem Pi under parameterized reductions. These are many-to-one reductions where the parameter for one problem maps into the parameter for the other. More specifi- cally, a parameterized problem L reduces to a parameterized problem L(cid:48) if there is a mapping R from instances of L to instances of L(cid:48) such that 1. (I, k) is a Yes-instance of L if and only if (I(cid:48), k(cid:48)) = R(I, k) is a Yes-instance 2. there is a computable function g such that k(cid:48) ≤ g(k), and 3. there is a computable function f such that R can be computed in time f (k)·nO(1), of L(cid:48), where n denotes the size of (I, k). A parameterized problem L is then in W[i], for i ∈ N, if it has a parameterized reduction to the problem of deciding whether a Boolean decision circuit (a decision circuit is a circuit with exactly one output), with AND, OR, and NOT gates, of constant depth such that on each path from an input to the output, all but i gates have a constant number of inputs, parameterized by the number of ones in a satisfying assignment to the inputs of the circuit [6]. A parameterized problem is in XP if there exist computable functions f and g and an algorithm that solves any instance (I, k) of size n in time f (k)ng(k). 4 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond 3 Subset Sum and Partition We start with two classic problems on multisets and show that they are fixed-para- meter tractable, parameterized by the number of numbers. variety-Subset Sum (var -SubSum) Input: Parameter: k = A, the number of distinct integers in A. Question: Is there a multiset X ⊆ A such that(cid:80) A multiset A of integers and an integer s. a∈X a = s? A multiset A of integers. variety-Partition (var -Part) Input: Parameter: k = A. Question: The parameterizon of Subset Sum by X is W [1]-hard [9]. This hardness also holds for the parameterization of Partition by X as an easy reduction from Subset a∈A a)/2, a∈A a) − s a∈X a =(cid:80) Sum adds the integer ((cid:80) a∈A a)/2, and if s > ((cid:80) the reduction looks instead for the complement set A \ X that sums to ((cid:80) Is there a multiset X ⊆ A such that(cid:80) a∈A a) − 2s to A if s ≤ ((cid:80) b∈A\X b? and uses the previous construction. Our FPT results use a deep result of Lenstra, stating that Integer Linear Programming Feasibility (ILPF), parameterized by the number of variables, is FPT. They are obtained by very natural formulations of the respective problems as integer programs. Theorem 1. var-SubSum is fixed-parameter tractable. Proof. Given an instance (A, s) for var -SubSum, with A = k, we create an equiv- alent instance of ILPF whose number of variables is upper bounded by a function of k. Let a1, . . . , ak denote the distinct elements of A and let m1, . . . , mk denote their respective multiplicities in A. The ILPF instance has the integer variables x1, . . . , xk and the following inequalities and equalities. xi ≤ mi xi ≥ 0 xi · ai = s. k(cid:88) i=1 ∀i ∈ [k] ∀i ∈ [k] For each i ∈ [k], the variable xi represents the number of times ai occurs in X, the set summing to s in a valid solution. Using standard techniques in mathematical programming, these constraints can be transformed into the form Ax ≤ b. (cid:117)(cid:116) A very similar proof shows that var -Part is fixed-parameter tractable. Theorem 2. var-Part is fixed-parameter tractable. Parameterizing by the Number of Numbers 5 Proof. Given an instance A for var -Part, with A = k, we create an equivalent instance of ILPF whose number n of variables is upper bounded by a function of k. Let a1, . . . , ak denote the distinct elements of A and let m1, . . . , mk denote their respective multiplicities in A. The ILPF instance has the integer variables x1, . . . , xk and the following inequalities and equalities. xi ≤ mi xi ≥ 0 (cid:88) xi · ai = k(cid:88) b∈A\X b =(cid:80) a∈A i=1 that(cid:80) a∈X a =(cid:80) ∀i ∈ [k] ∀i ∈ [k] a/2. For each i ∈ [k], the variable xi represents the number of times ai occurs in X, such Using standard techniques in mathematical programming, these constraints can be transformed such that they respect the form Ax ≤ b. (cid:117)(cid:116) a∈A a/2 in a valid solution. 4 Other Classic Numerical Problems Using the ILPF machinery, we show in this section that several other problems, which are often used in NP-hardness proofs, become fixed-parameter tractable when parameterized by the number of numbers. Three multisets A, B, C of n integers each and an integer s. variety-Numerical 3-Dimensional Matching (var -Num3-DM) Input: Parameter: k = A ∪ B ∪ C. Question: Are there n triples S1, . . . , Sn, each containing one element from each of A, B, and C such that for every i ∈ [n],(cid:80) a = s? a∈Si Theorem 3. var-Num3-DM is fixed-parameter tractable. Proof. Let (A, B, C, s) be an instance for var -Num3-DM, with k1 = A, k2 = B, k3 = C, and k = A ∪ B ∪ C. Let a1, . . . , ak1 denote the distinct elements of A, b1, . . . , bk2 denote the distinct elements of B, and c1, . . . , ck3 denote the distinct elements of C. Also, let m1,a, . . . , mk1,a, m1,b, . . . , mk2,b, m1,c, . . . , mk3,c denote their respective multiplicities in A, B, and C. We create an instance of ILPF with at most k3 integer variables xi,j,(cid:96), for i ∈ [k1], j ∈ [k2], (cid:96) ∈ [k3]: (cid:88) (cid:88) (cid:88) xi,j,(cid:96) = 0 xi,j,(cid:96) = mi,a xi,j,(cid:96) = mj,b xi,j,(cid:96) = m(cid:96),c for each (i, j, (cid:96)) ∈ [k1] × [k2] × [k3] such that ai + bj + c(cid:96) (cid:54)= s ∀i ∈ [k1] ∀j ∈ [k2] ∀(cid:96) ∈ [k3] (j,(cid:96))∈([k2],[k3]) (i,(cid:96))∈([k1],[k3]) (i,j)∈([k1],[k2]) 6 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond A variable xi,j,(cid:96) represents the number of times the elements ai ∈ A, bj ∈ B and c(cid:96) ∈ C are used together to form a triple summing to s. The first constraint makes sure that such a triple is formed only if it sums to s. The remaining equalities make sure that each element of A ∪ B ∪ C appears in a triple. Thus n such triples are (cid:117)(cid:116) formed, all summing to s if the integer program is feasible. Note that the problem is also fixed-parameter tractable if parameterized by A∪ B only: we face a No-instance if C > {a + b : a ∈ A, b ∈ B}. A closely related, well known numerical problem, is the following. Three multisets A, B, S of n integers each. variety-Numerical Matching with Target Sums (var -NMTS) Input: Parameter: k = A ∪ B ∪ S. Question: Are there n triples C1, . . . , Cn ∈ A × B × S, such that the A- element and the B-element from each Ci sum to its S-element? Corollary 1. var-NMTS is fixed-parameter tractable. By the previous discussion, the natural parameterization by A ∪ B is also fixed- parameter tractable. A straightforward adaptation of the proof of Theorem 3 shows that variety-3-Partition is fixed-parameter tractable. variety-3-Partition (var -3-Part) Input: Parameter: k = A. Question: Are there n triples S1, . . . , Sn ⊆ A, all summing to the same A multiset A of 3n integers. number? s =(cid:80) Theorem 4. var-3-Part is fixed-parameter tractable. Proof. Let A be an instance for var -3-Part, with A = k and A = 3n. Let a∈A a/n. Let a1, . . . , ak denote the distinct elements of A and let m1, . . . , mk denote their multiplicities in A. We create an instance of ILPF with at most k3 integer variables xi,j,(cid:96), for i, j, (cid:96) ∈ [k]: xi,j,(cid:96) = 0 for each i, j, (cid:96) ∈ [k] such that ai + aj + a(cid:96) (cid:54)= s (xi,j,(cid:96) + xj,i,(cid:96) + xj,(cid:96),i) (cid:88) +2 ·(cid:88) j,(cid:96)∈[k] j,(cid:96)(cid:54)=i j∈[k] j(cid:54)=i (xi,i,j + xi,j,i + xj,i,i) +3 · xi,i,i = mi ∀i ∈ [k] A variable xi,j,(cid:96) represents the number of times the elements ai, aj and a(cid:96) are used together to form a triple summing to s. The first constraint makes sure that such a Parameterizing by the Number of Numbers 7 triple is formed only if it sums to s. The second set of equalities make sure that each element of A appears in a triple. Thus n such triples are formed, all summing to s if (cid:117)(cid:116) the integer program is feasible. 5 Mealy Machines In this section, we explore how far we can generalize the rather simple FPT results of the previous two sections. To this end, we investigate the parameterized complexity of two problems about Mealy Machines. Both problems can be viewed as parameterized problems implicitly parameterized by the number of numbers, because in each case the size of the alphabet is part of the parameterization, and each letter of the alphabet is associated with a census requirement. The richer structure of these problems means that a simple appeal to integer linear programming no longer suffices: one turns out to be FPT, and the other W[1]-hard. In Section 6, we show that other problems parameterized by the number of numbers reduce to these two seemingly general problems of this kind. Mealy machines [21] are finite-state transducers, generating an output based on their current state and input. They have important applications in cryptanalysis [2], computational linguistics [27], and control and system theory [30]. A deterministic Mealy machine is a dual-alphabet state transition system given by a 5-tuple M = (S, s0, Γ, Σ, T ): -- a finite set of states S, -- a start state s0 ∈ S, -- a finite set Γ , called the input alphabet, -- a finite set Σ, called the output alphabet, and -- a transition function T : S × Γ → S × Σ mapping pairs of a state and an input letter to the corresponding next state and output letter. The alphabets Γ and Σ may contain the empty letter , as in [28]. This eases some of the description, but all our results also hold if we restrict  /∈ Γ ∪ Σ. In a non-deterministic Mealy machine, the only difference is that the transition function is defined T : S × Γ → P(S × Σ) as for a given state and input letter, there may be more than one possibility for the next state and output letter. (Here P(X) denotes the powerset of a set X.) A census requirement c : Σ \ {} → N is a function assigning a non-negative integer to each letter of the output alphabet (except ). It is used to constrain how many times each letter should appear in the output of a Mealy machine. A word x ∈ Σ∗ meets the census requirement if every letter b ∈ Σ \ {} appears exactly c(b) times in x. The notion of census requirement is related to Parikh images [25]. Let Σ \ {} = {b1, . . . , bσ}. For x ∈ Σ∗, the Parikh image is Ψ (x) = (c(b1), . . . , c(bσ)), where c is the census requirement such that x meets c. The Parikh image of a language L is Ψ (L) = {Ψ (x) : x ∈ L}. Parikh's theorem [25] states that the Parikh image of a context-free language is semilinear, i.e., that for every context-free language there is a regular language with the same Parikh image. 8 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond Our first problem about Mealy machines asks whether there exists an input word and a computation of the Mealy machine such that the output word meets the census requirement. variety-Exists Word Mealy Machine (var -EWMM) Input: Parameter: S + Γ + Σ. Question: Does there exist a word x ∈ Γ ∗ for which a computation of M A non-deterministic Mealy machine M = (S, s0, Γ, Σ, T ), and a census requirement c : Σ \ {} → N. on input x generates an output y that meets c? Our proof that var -EWMM is fixed-parameter tractable is inspired by the proof from [10] showing that Bandwidth is fixed-parameter tractable when parameterized by the maximum number of leaves in a spanning tree of the input graph. We need the following definition and lemma from [10]. In a digraph D, two directed walks ∆ and ∆(cid:48) from a vertex s to a vertex t are arc-equivalent, if for every arc a of D, ∆ and ∆(cid:48) pass through a the same number of times. Lemma 1 ([10]). Any directed walk ∆ through a finite digraph D on n vertices from a vertex s to a vertex t of D is arc-equivalent to a directed walk ∆(cid:48) from s to t, where ∆(cid:48) has the form: (1) ∆(cid:48) consists of an underlying directed walk ρ from s to t of length at most n2, (2) together with some number of short loops, where each such short loop l begins and ends at a vertex of ρ, and has length at most n. The algorithm will first subdivide state transitions in order to make the underlying directed graph simple. As suggested by Lemma 1, the algorithm goes over all possible choices for selecting an underlying directed walk ρ starting from s0. For every short loop starting and ending at a vertex from ρ, the algorithm associates an integer variable representing the number of times this short loop is executed while moving along ρ. Again by Integer Linear Programming Feasibility, it can be checked whether there is a set of integers, representing the number of executions of the short loops, such that the number of times each output letter is written is compatible with the census requirement. Theorem 5. var-EWMM is fixed-parameter tractable. Proof. Let (M(cid:48) = (S(cid:48), s(cid:48) 0, Γ (cid:48), Σ(cid:48), T (cid:48)), c) be an instance for var -EWMM with k = S(cid:48) + Γ (cid:48) + Σ(cid:48). As M(cid:48) might have multiple transitions from one state to another, we first subdivide each transition in order to obtain a simple digraph underlying the Mealy machine (so we can use Lemma 1): create a new non-deterministic Mealy 0, Γ = Γ (cid:48) ∪ {}, and machine M = (S, s0, Γ, Σ, T ) such that, initially, S = S(cid:48), s0 = s(cid:48) Σ = Σ(cid:48) ∪ {}; for each transition t of T (cid:48) from a couple (si,(cid:104)i(cid:105)) to a couple (so,(cid:104)o(cid:105)), add a new state st to S and add the transition from (si,(cid:104)i(cid:105)) to (st,(cid:104)o(cid:105)) and the transition from (st, ) to (so, ) to T . Clearly, there is at most one transition between every two states in M . Parameterizing by the Number of Numbers 9 Our algorithm goes over all transition walks in M of length at most S2 that start from s0. There are at most S(S2) such transition walks and each such transition walk has at most SS short loops, as they have length at most S by Lemma 1. Let P = (s0, s1, . . . , sP) be such a transition walk and L = ((cid:96)1, (cid:96)2, . . . , (cid:96)L) be its short loops. It remains to check whether there exists a set of integers X = {x1, x2, . . . , xL} such that a word output by a computation of M moving from s0 to sP along the walk P , and executing xi times each short loop (cid:96)i, 1 ≤ i ≤ L, meets the census requirement. Note that if one such word meets the census requirement, then all such words meet the census requirement, as it does not matter in which order the short loops are executed. We verify whether such a set X exists by ILPF. Let Σ \ {} = {(cid:104)(cid:96), 1(cid:105),(cid:104)(cid:96), 2(cid:105), . . . ,(cid:104)(cid:96), σ(cid:105)}. Define m(i, j), for 1 ≤ i ≤ L, 1 ≤ j ≤ σ, to denote the number of times that M writes the letter (cid:104)(cid:96), j(cid:105) when it executes the loop (cid:96)i once. Define m(j), for 1 ≤ j ≤ σ, to be the number of times that M writes the letter (cid:104)(cid:96), j(cid:105) when it transitions from s0 to sP along the walk P . Then, we only need to verify that there exist integers x1, x2, . . . , xL such that L(cid:88) m(j) + xi · m(i, j) = c((cid:104)(cid:96), j(cid:105)), ∀j ∈ [σ]. i=0 By construction, S ≤ S(cid:48) + T (cid:48) ≤ S(cid:48) + S(cid:48)2 · Γ (cid:48) · Σ(cid:48) ≤ k + k4. As the number of integer variables of this program is at most L ≤ SS ≤ (k+k4)k+k4, and the number of transition walks that the algorithm considers is at most S(S2) ≤ (k+k4)k2+2k5+k8, (cid:117)(cid:116) var -EWMM is fixed-parameter tractable. We note that the proof in [10] concerned a special case of a deterministic Mealy machine where the input and output alphabet are the same, and all transitions that read a letter (cid:104)(cid:96)(cid:105) also write (cid:104)(cid:96)(cid:105). In our second Mealy machine problem, the question is whether, for a given input word, there is a computation of the Mealy machine which outputs a word that meets the census requirement. variety-Given Word Mealy Machine (var -GWMM) Input: Parameter: S + Γ + Σ Question: A non-deterministic Mealy machine M = (S, s0, Γ, Σ, T ), a word x ∈ Γ ∗, and a census requirement c : Σ \ {} → N. Is there a computation of M on input x generating an output y that meets c? By dynamic programming we show that two restrictions of this problem are in XP. In the first one, the census requirement is encoded in unary. This restriction of the problem seems lenient, especially when one is actually interested in finding the output word, as the census function acts then as a placeholder for the produced word. Theorem 6. var-GWMM is in XP if c is encoded in unary. Proof. Let Σ \ {} = σ and Σ \ {} = {b1, . . . , bσ}. Our dynamic programming algorithm computes the entries of a boolean table A. The table A has an entry A[s, c1, 10 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond . . . , cσ, i, p] for each state s ∈ S, each cj ∈ {0, . . . , c(bj)}, j ∈ [σ], each index i ∈ {0, . . . ,x}, and each integer p ∈ P = {0, . . . ,S − 1}. The entry A[s, c1, . . . , cσ, i, p] is set to true if there exists a computation of M reading the first i letters of x, outputting a word y in which the letter bj occurs cj times, for each j ∈ [σ], followed by p transitions that read  and write , and ending up in state s, and to false otherwise. Set A[s, c1, . . . , cσ, 0, 0] to true if s = s0 and c1 = . . . = cσ = 0, and to false i=1 ci, index i, otherwise. Compute the values of the table by increasing values of(cid:80)σ propagation integer p, and state number s: A[s, c1, . . . , cσ, i, p] = A[s(cid:48), c1, . . . , cj−1, cj − 1, cj+1, . . . , cσ, i − 1, p(cid:48)] (cid:95) (cid:95) (cid:95) (cid:95) ∨ ∨ ∨ s(cid:48)∈S,bj∈Σ\{},p(cid:48)∈P : (s,bj )∈T (s(cid:48),x[i]) s(cid:48)∈S,p(cid:48)∈P : (s,)∈T (s(cid:48),x[i]) s(cid:48)∈S,bj∈Σ\{},p(cid:48)∈P : (s,bj )∈T (s(cid:48),) s(cid:48)∈S:(s,)∈T (s(cid:48),) A[s(cid:48), c1, . . . , cσ, i − 1, p(cid:48)] A[s(cid:48), c1, . . . , cj−1, cj − 1, cj+1, . . . , cσ, i, p(cid:48)] A[s(cid:48), c1, . . . , cσ, i, p − 1] census requirement if and only if(cid:87) Finally, there exists an x-computation of M generating a word y that meets the s∈S,p∈P A[s, c(b1), . . . , c(bσ),x, p] is true. Denote by n is the length of the description of an input instance. The table has S·x·P· j=1c(bj) ≤ S2 · nσ+1 entries, and each entry can be computed in time O(S2 · σ). Π σ The running time of the algorithm is thus upper bounded by O(nσ+1 · k5), where k (cid:117)(cid:116) is the parameter. For the version where c is encoded in binary, a restriction on the input alphabet gives an XP algorithm as well. Corollary 2. var-GWMM is in XP if  /∈ Γ . Proof. If(cid:80) b∈Σ\{} c(b) > x, then return false, as M cannot output more than x letters. Otherwise, run the algorithm described in the proof of Theorem 6. Its running (cid:117)(cid:116) time is O(k5 · x · Π σ j=1c(bj)) = O(nσ+1 · k5). Note that the XP-results also hold if the parameter is only Σ. To show that var -GWMM is W [1]-hard, we reduce from the Multicolored Clique problem, which is W [1]-hard [26, 8]. Parameterizing by the Number of Numbers 11 Multicolored Clique (MCC) Input: An integer k and a connected undirected graph G = (V (1) ∪ V (2) . . . ∪ V (k), E) such that for every i ∈ [k], the vertices of V (i) induce an independent set in G. Parameter: k. Question: Is there a clique of size k in G? Clearly, a solution to this problem has one vertex from each color. Our parameterized reduction encodes G in the input word x of the Mealy machine M , and the description of M depends only on k. The Mealy machine is divided into k parts, one for each color class V (i), with 1 ≤ i ≤ k. Its ith part is responsible for selecting a vertex vi from V (i) and edges vivj for every vj ∈ V (j), with 1 ≤ j (cid:54)= i ≤ k. All consistency issues and communication is done via the census requirement. Within part i, we need to make sure that the selected edges are all incident to the selected vertex vi. This is achieved by making M output p times each letter (cid:104)l, i, j(cid:105), with 1 ≤ j (cid:54)= i ≤ k, if it selects the pth vertex in V (i). The census requirement for (cid:104)l, i, j(cid:105) is V (i) + 1, meaning that (cid:104)l, i, j(cid:105) needs to be output V (i) + 1 − p times later. To select an edge vivj, the machine M will be constrained to select this edge among the edges incident to vi. To achieve this, edges from V (i) to V (j) appear in x grouped by the vertex from V (i) on which they are incident. After each group of edges incident on one vertex from V (i), there is a special state where (cid:104)l, i, j(cid:105) is output if and only if the edge towards V (j) has already been selected. As (cid:104)l, i, j(cid:105) needs to be output exactly V (i) + 1 − p times, we force in this way that an edge is selected which is incident on vi. This enforces that all edges selected in the ith part are incident on the same vertex. It remains to make sure that distinct parts i and j select the same edge between V (i) and V (j). This is again achieved by a census requirement where a part of the census of letter (cid:104)l, ¯e, i, j(cid:105) is output in the ith part and the remaining part in the jth part of M . Theorem 7. var-GWMM is W [1]-hard. Proof. Let (k, G = (V (1) ∪ V (2) . . . ∪ V (k), E)) be an instance of MCC. Suppose V (i) = {vi,1, vi,2, . . . , vi,V (i)} is the vertex set of color i, for each color class i ∈ [k], E = {e1, e2, . . . , eE}, and E(i, j) = {e(i, j, 1), e(i, j, 2), . . . , e(i, j,E(i, j))} is the subset of edges with one vertex in color class i and the other in color class j, for i, j ∈ [k]. Moreover, suppose E(i, j) follows the same order as E, that is if ep = e(i, j, p(cid:48)), eq = e(i, j, q(cid:48)), and p ≤ q, then p(cid:48) ≤ q(cid:48). For a vertex vi,p and two integers j ∈ [k] \ {i} and q ∈ [dV (j)(vi,p) + 1], we define gap(vi,p, j, q) = t− s, where e(i, j, t) is the qth edge in E(i, j) incident to vi,p (respectively, t = E(i, j) if q = dV (j)(vi,p) + 1) and e(i, j, s) is the (q − 1)th edge in E(i, j) incident to vi,p (respectively, s = 0 if q = 1). We construct an instance (M = (S, s0, Γ, Σ, T ), x, c) for var -GWMM as follows. M 's input alphabet, Γ , is {(cid:104)i(cid:105),(cid:104)i, j(cid:105),(cid:104)¯e, i, j(cid:105),(cid:104)e, i, j(cid:105) : i, j ∈ [k], i (cid:54)= j}. M 's output alphabet, Σ, is {} ∪ {(cid:104)l, i, j(cid:105),(cid:104)l, ¯e, i, j(cid:105) : i, j ∈ [k], i (cid:54)= j}. The word x is defined 12 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond x := x1x2 . . . xk xi := xi,0xi,1 . . . xi,i−1xi,i+1xi,i+2 . . . xi,k(cid:104)i(cid:105) xi,0 := ((cid:104)i, 1(cid:105)(cid:104)i, 2(cid:105) . . .(cid:104)i, i − 1(cid:105)(cid:104)i, i + 1(cid:105)(cid:104)i, i + 2(cid:105) . . .(cid:104)i, k(cid:105))V (i) xi,j := (cid:104)i, j(cid:105)xi,j,1(cid:104)i, j(cid:105)xi,j,2 . . .(cid:104)i, j(cid:105)xi,j,V (i)(cid:104)i, j(cid:105) xi,j,p := (cid:104)¯e, i, j(cid:105)gap(vi,p,j,1)(cid:104)e, i, j(cid:105)(cid:104)¯e, i, j(cid:105)gap(vi,p,j,2)(cid:104)e, i, j(cid:105) . . .(cid:104)¯e, i, j(cid:105)gap(vi,p,j,dV (j)(vi,p))(cid:104)e, i, j(cid:105)(cid:104)¯e, i, j(cid:105)gap(vi,p,j,dV (j)(vi,p)+1). ∀i ∈ [k] ∀i ∈ [k] ∀i, j ∈ [k], i (cid:54)= j The census requirement c is, for every i, j ∈ [k], i (cid:54)= j, c((cid:104)l, i, j(cid:105)) := V (i) + 1 c((cid:104)l, ¯e, i, j(cid:105)) := E(i, j). On reading a subword xi, the Mealy machine will select a vertex vi,p in V (i) and one edge incident to vi,p for each color class j ∈ [k] \ {i}. The vertex vi,p is selected in the subword xi,0 of xi. Next, for each j ∈ [k] \ {i}, a vertex in V (i) and a vertex in V (j) are selected in the subword xi,j. The census requirement for (cid:104)l, i, j(cid:105) makes sure that the vertex from V (i) is vi,p. The subword xi,j,p ensures that vi,p and the vertex that is selected from V (j) are joined by an edge. Finally, the census requirement for (cid:104)l, ¯e, i, j(cid:105) is responsible for the inter-partition communication and makes sure that the edge selected in xi,j is equal to the edge selected in xj,i. The Mealy machine M consists of k parts. The ith part of M is depicted in Fig. 1. Its initial state is sv,1. There is a transition from the last state of each part, s(4) e,i,k, to the first state of the following part, sv,i+1 (from the kth part, there is a transition to a final state): it reads the letter (cid:104)i(cid:105) and writes the letter . We set (cid:104)l(cid:48), ¯e, i, j(cid:105) = (cid:104)l, ¯e, j, i(cid:105) for all i (cid:54)= j ∈ [k]. Note that, in the description of M , the letter (cid:104)l, i, j(cid:105) can only be output on reading (cid:104)i, j(cid:105), and (cid:104)l, ¯e, i, j(cid:105) can only be output on reading (cid:104)¯e, i, j(cid:105) or (cid:104)¯e, j, i(cid:105). Let us first verify that the parameter for var -GWMM is a function of k, and that there exists a function f such that the size of the instance for var -GWMM is f (k) · nO(1), where n is the number of vertices of G. We have Γ = k + 3 · k · (k − 1), Σ = 1 + 2· k· (k− 1), and S = 1 + k· (2 + 4· (k− 1)). The parameter of var -GWMM is thus bounded by a function of k. The length of x is O(k2 · n3). Now, we show that (M, x, c) is a Yes-instance for var -GWMM if and only if (G, k) is a Yes-instance for MCC. First, suppose (M = (S, s0, Γ, Σ, T ), x, c) is a Yes-instance for var -GWMM. We say that M selects a vertex vi,p if it makes a transition from state sv,i to state v,i reading (cid:104)i, k(cid:105) (respectively (cid:104)i, k − 1(cid:105) if i = k) for the pth time. In other words, s(cid:48) in the ith part of M , it reads p · (k − 1) − 1 letters of xi,0, staying in state sv,i and outputs the letter (cid:104)l, i, r(cid:105) for each letter (cid:104)i, r(cid:105) it reads; then it transitions to state s(cid:48) on reading (cid:104)i, k(cid:105) (respectively (cid:104)k, k − 1(cid:105) if i = k) and outputs (cid:104)l, i, k(cid:105) (respectively (cid:104)l, k, k − 1(cid:105)); in the state s(cid:48) v,i it outputs the empty letter for each letter (cid:104)i, r(cid:105) it reads. v,i Parameterizing by the Number of Numbers 13 Fig. 1. The ith part of the Mealy machine M . It does not have the states s(1) there is instead a transition from s(4) transition from s(4) at the last state. (Drawing all this would have cluttered the figure too much.) e,i,i, and s(4) e,i,i; e,i,i+1 reading (cid:104)i − 1(cid:105) and writing , and there is a e,k,k−1 to the last state reading (cid:104)k(cid:105) and writing . There are no transitions starting e,i,i−1 to s(1) e,i,i, s(2) e,i,i, s(3) We say that M selects an edge e(i, j, q) if it makes a transition from state s(2) e,i,j e,i,j after having read the letter (cid:104)¯e, i, j(cid:105) of xi,j,p exactly q times, where vi,p to state s(3) is the vertex of color i that e(i, j, q) is incident on. In other words, in the ith part of M , it transitions from the state s(1) e,i,j on reading the first letter of xi,j,p (if it did this transition any later, the census requirement of (cid:104)l, ¯e, i, j(cid:105) could not be met, as shown in the proof of Claim 2 below); then it stays in the state s(2) e,i,j until it has read q times the letter (cid:104)¯e, i, j(cid:105) of xi,j,p; then it transitions to the state s(3) e,i,j on reading (cid:104)e, i, j(cid:105); it stays in this state and outputs (cid:104)l(cid:48), ¯e, i, j(cid:105) for each letter (cid:104)¯e, i, j(cid:105) it reads until transitioning to the state s(4) e,i,j to the state s(2) e,i,j on reading the letter following xi,j,p. sv,is0v,is(1)e,i,1s(2)e,i,1s(3)e,i,1s(4)e,i,1s(1)e,i,2s(2)e,i,2s(3)e,i,2s(4)e,i,2s(1)e,i,ks(2)e,i,ks(3)e,i,ks(4)e,i,khi−1i,hi,1i,hl,i,1ihi,2i,hl,i,2i...hi,ki,hl,i,kihi,ki,hl,i,kihi,1i,hi,2i,...hi,ki,hi,1i,hi,1i,he,i,1i,h¯e,i,1i,h¯e,i,1i,hl,¯e,i,1ihe,i,1i,h¯e,i,1i,hl,¯e,i,1ihe,i,1i,he,i,1i,h¯e,i,1i,hl0,¯e,i,1ihi,1i,hl,i,1ihi,1i,hl,i,1ihe,i,1i,h¯e,i,1i,hi,2i,hi,2i,he,i,2i,h¯e,i,2i,h¯e,i,2i,hl,¯e,i,2ihe,i,2i,h¯e,i,2i,hl,¯e,i,2ihe,i,2i,he,i,2i,h¯e,i,2i,hl0,¯e,i,2ihi,2i,hl,i,2ihi,2i,hl,i,2ihe,i,2i,h¯e,i,2i,hi,ki,he,i,ki,h¯e,i,ki,h¯e,i,ki,hl,¯e,i,kihe,i,ki,h¯e,i,ki,hl,¯e,i,kihe,i,ki,he,i,ki,h¯e,i,ki,hl0,¯e,i,kihi,ki,hl,i,kihi,ki,hl,i,kihe,i,ki,h¯e,i,ki,hii, 14 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond The following claims ensure that the edge-selection and the vertex-selection are compatible, i.e., that exactly one edge is selected from color i to color j, and that this edge is incident on the selected vertex of color i. Claim 1. Let i be a color and let vi,p be the vertex selected in the ith part of M . In its ith part, M selects one edge incident to vi,p and to a vertex of color j, for each j ∈ [k] \ {i}. Proof. After M has selected vi,p, it has output p times each of the letters (cid:104)l, i, 1(cid:105), (cid:104)l, i, 2(cid:105), . . . ,(cid:104)l, i, i − 1(cid:105),(cid:104)l, i, i + 1(cid:105),(cid:104)l, i, i + 2(cid:105), . . . ,(cid:104)l, i, k(cid:105). For each j ∈ [k] \ {i}, the only other transitions that output (cid:104)l, i, j(cid:105) are the transition from s(3) e,i,j and a e,i,j. To meet the census requirement of V (i)+1 for (cid:104)l, i, j(cid:105), transition that loops on s(4) M selects an edge while reading xi,j,p. This edge is incident on vi,p by construction. (cid:117)(cid:116) e,i,j to s(4) The following claim makes sure that the edge selected from color i to color j is the same as the edge selected from color j to color i. Claim 2. Suppose M selects the edge e(i, j, q) in its ith part. Then, M selects the edge e(j, i, q) in its jth part. Proof. Before M selects e(i, j, q), it has output q(cid:48) ≤ q times the letter (cid:104)l, ¯e, i, j(cid:105). On selecting e(i, j, q) it transitions to the state s(3) e,i,j, and after the selection it outputs (cid:104)l(cid:48), ¯e, i, j(cid:105) for every letter (cid:104)¯e, i, j(cid:105) of xi,j,p it reads. As it reads dV (j)(vi,p)+1(cid:88) ( gap(vi,p, j, r)) − q = E(i, j) − q r=1 times the letter (cid:104)¯e, i, j(cid:105) of xi,j,p after it has selected e(i, j, q), the Mealy machine outputs E(i, j) − q times the letter (cid:104)l(cid:48), ¯e, i, j(cid:105) in its ith part. The only other transition where it outputs (cid:104)l, ¯e, i, j(cid:105) = (cid:104)l(cid:48), ¯e, j, i(cid:105) is the transition e,j,i that reads (cid:104)¯e, j, i(cid:105) and outputs (cid:104)l(cid:48), ¯e, j, i(cid:105). To meet in the jth part of M looping on s(3) the census requirement for (cid:104)l, ¯e, i, j(cid:105), this transition must be used exactly E(i, j)− q(cid:48) times. The only other transitions where it outputs (cid:104)l(cid:48), ¯e, i, j(cid:105) = (cid:104)l, ¯e, j, i(cid:105) are two transi- tions in the jth part of M : the transition from s(1) e,j,i and the transition looping e,j,i, both reading (cid:104)¯e, j, i(cid:105) and writing (cid:104)l, ¯e, j, i(cid:105). These transitions can be used at on s(2) most q(cid:48) times as the transition of the previous paragraph is used E(i, j) − q(cid:48) times. These transitions have to be used at least q times to meet the census requirement for (cid:104)l(cid:48), ¯e, i, j(cid:105). Thus, these transitions are used exactly q times and q = q(cid:48). e,j,i happens after having read q times the letter (cid:104)¯e, j, i(cid:105) of some vertex xj,i,p(cid:48), p(cid:48) ∈ [V (j)], which means that M selects the edge (cid:117)(cid:116) e(j, i, q) in its jth part. Finally, the transition from s(2) e,j,i to s(3) e,j,i to s(2) By Claims 1 and 2, the k vertices that are selected by M form a multicolored clique. Thus, (k, G = (V (1) ∪ V (2) . . . ∪ V (k), E)) is a Yes-instance for MCC. Parameterizing by the Number of Numbers 15 Now, suppose that (k, G = (V (1) ∪ V (2) . . . ∪ V (k), E)) is a Yes-instance for MCC. Let {v1,p1, v2,p2, . . . , vk,pk} be a multicolored clique in G. We will construct a word y meeting c such that a computation of M on input x generates y. For two adjacent vertices vi,pi and vj,pj , define edge(vi,pi, vj,pj ) = t such that e(i, j, t) = vi,pivj,pj . The word y is y1y2 . . . yk, where yi, for i ∈ [k], is ((cid:104)l, i, 1(cid:105)(cid:104)l, i, 2(cid:105) . . .(cid:104)l, i, i − 1(cid:105)(cid:104)l, i, i + 1(cid:105)(cid:104)l, i, i + 2(cid:105) . . .(cid:104)l, i, k(cid:105))pi yi,1yi,2 . . . yi,i−1yi,i+1yi,i+2 . . . yi,k and yi,j, for i (cid:54)= j ∈ [k], is (cid:104)l, ¯e, i, j(cid:105)edge(vi,pi ,vj,pj )(cid:104)l(cid:48), ¯e, i, j(cid:105)E(i,j)−edge(vi,pi ,vj,pj )(cid:104)l, i, j(cid:105)V (i)−pi+1. We note that y meets the census requirement c. Moreover, the computation of M on input x, which selects (as defined in the first part of the proof) exactly the vertices and edges of the multicolored clique {v1,p1, v2,p2, . . . , vk,pk}, outputs y. Thus (M = (cid:117)(cid:116) (S, s0, Γ, Σ, T ), x, c) is a Yes-instance for var -GWMM. The theorem holds if we restrict  /∈ Γ ∪ Σ. Indeed,  /∈ Γ in the target instance, and one can add a new letter e to Σ, which replaces  and has census requirement i,j∈[k],i(cid:54)=j(c((cid:104)l, i, j(cid:105)) + c((cid:104)l, ¯e, i, j(cid:105)). This instance is equivalent since the c(e) = x −(cid:80) modified M outputs one letter for each letter in x. 6 Applications In this section we sketch two examples that illustrate how number-of-numbers pa- rameterized problems may reduce to census problems about Mealy machines, param- eterized by the size of the machine. For another application, see [10]. Example 1: Heat-Sensitive Scheduling. In a recent paper Chrobak et al. [5] introduced a model for the issue of temperature-aware task scheduling for micropro- cessor systems. The motivation is that different jobs with the same time requirements may generate different heat loads, and it may be important to schedule the jobs so that some temperature threshold is not breached. In the model, the input consists of a set of jobs that are all assumed to be of unit length, with each job assigned a numerical heat level. If at time t the processor temperature is Tt, and if the next job that is scheduled has heat level H, then the processor temperature at time t + 1 is Tt+1 = (Tt + H)/2 It is also allowed that perhaps no job is scheduled for time t + 1 (that is, idle time is scheduled), in which case H = 0 in the above calculation of the updated temperature. The relevant decision problem is whether all of the jobs can be scheduled, meet- ing a specified deadline, in such a way that a given temperature threshold is never exceeded. This problem has been shown to be NP-hard [5] by a reduction from 3- Dimensional Matching. An image instance of the reduction, however, involves 16 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond arbitrarily many distinct heat levels asymptotically close to H = 2, for a tempera- ture threshold of 1. In the spirit of the "deconstruction of hardness proofs" advocated by Komusiewicz et al. [19] (see also [4, 24]), one might regard this problem as ripe for parameterization by the number of numbers, for example (scaling appropriately), a model based on 2k equally-spaced heat levels and a temperature threshold of k. Furthermore, if the heat levels of the jobs are only roughly classified in this way, it also makes sense to treat the temperature transition model similarly, as: Tt+1 = (cid:100)(Tt + H)/2(cid:101) The input to the problem can now be viewed equivalently as a census of how many jobs there are for each of the 2k + 1 heat levels, with the available potential units of idle time allowed to meet the deadline treated as "jobs" for which H = 0. Because of the ceiling function modeling the temperature transition, the problem now immediately reduces to var -EWMM, for a machine on k + 1 states (that represent the temperature of the processor) and an alphabet of size at most 2k +1. By Theorem 5, the problem is fixed-parameter tractable. Example 2: A Problem in Computational Chemistry. The parameterized problem of Weighted Splits Reconstruction for Paths that arises in com- putational chemistry [15] reduces to a special case of var -GWMM. The input to the problem is obtained from time-series spectrographic data concerning molecular weights. The problem as defined in [15] is equivalent to the following two-processor scheduling problem. The input consists of -- a sequence x of positive integer time gaps taken from a set of positive integers Γ , and -- a census requirement c on a set of positive integers Σ of job lengths. The question is whether there is a "winning play" for the following one-person two- processor scheduling game. At each step, first, Nature plays the next positive integer "gap" of the sequence of time gaps x -- this establishes the next immediate deadline. Second, the Player responds by scheduling on one of the two processors, a job that begins at the last stop-time on that processor, and ends at the immediate deadline. The Player wins if there is a sequence of plays (against x) that meets the census requirement c on job lengths. Fig. 2 illustrates such a game. Processor 1 Processor 2 x = 4 4 5 1 3 2 3 1 1 1 3 1 5 4 Fig. 2. A winning game for the census: 1 (1), 3 (3), 4 (1), 5 (2) This problem easily reduces to a special case of var -GWMM. Whether this special case is also W [1]-hard remains open. Parameterizing by the Number of Numbers 17 7 Concluding Remarks The practical world of computing is full of computational problems where inputs are "weighted" in a realistic model -- weighted graphs provide a simple example relevant to many applications. Here we have begun to explore parameterizing on the numbers of numbers as a way of mitigating computational complexity for problems that are numerically structured. One might view some of the impulse here as moving approximation issues into the modeling, as illustrated by Example 1 in Section 6. We believe this line of attack may be widely applicable. To date, there has been little attention to parameterized complexity issues in the context of cryptography, control theory, and other numerically structered areas of application. Number of numbers parameterization may provide some inroads into these underdeveloped areas. Our main FPT result, Theorem 5, has a poor worst-case running-time guarantee. Can this be improved -- at least in important special cases? Acknowledgment. We thank Iyad Kanj for stimulating conversations about this work. References 1. Noga Alon, Yossi Azar, Gerhard J. Woeginger, and Tal Yadid. Approximation schemes for scheduling on parallel machines. Journal of Scheduling, 1:55 -- 66, 1998. 2. Gregory V. Bard. Algebraic cryptanalysis. Springer, 2009. 3. Cristina Bazgan. Sch´emas d'approximation et complexit´e param´etr´ee. Master's thesis, Universit´e Paris Sud, 1995. 4. Nadja Betzler, Michael R. Fellows, Jiong Guo, Rolf Niedermeier, and Frances A. Rosamond. Fixed-parameter algorithms for kemeny rankings. Theoretical Computer Science, 410(45):4554 -- 4570, 2009. 5. Marek Chrobak, Christoph Durr, Mathilde Hurand, and Julien Robert. Algorithms for In Rudolf Fleischer and Jin- temperature-aware task scheduling in microprocessor systems. hui Xu, editors, AAIM 2008, volume 5034 of Lecture Notes in Computer Science, pages 120 -- 130. Springer, 2008. 6. Rodney G. Downey and Michael R. Fellows. Parameterized complexity. Springer-Verlag, New York, 1999. 7. Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond. Parameterizing by the number of numbers. In Venkatesh Raman and Saket Saurabh, editors, IPEC 2010, volume 6478 of Lecture Notes in Computer Science, pages 123 -- 134. Springer, 2010. 8. Michael R. Fellows, Danny Hermelin, Frances Rosamond, and St´ephane Vialette. On the parame- terized complexity of multiple-interval graph problems. Theoretical Computer Science, 410(1):53 -- 61, 2009. 9. Michael R. Fellows and Neal Koblitz. Fixed-parameter complexity and cryptography. In G´erard D. Cohen, Teo Mora, and Oscar Moreno, editors, AAECC 1993, volume 673 of Lec- ture Notes in Computer Science, pages 121 -- 131. Springer, 1993. 10. Michael R. Fellows, Daniel Lokshtanov, Neeldhara Misra, Matthias Mnich, Frances A. Rosamond, and Saket Saurabh. The complexity ecology of parameters: An illustration using bounded max leaf number. Theory of Computing Systems, 45(4):822 -- 848, 2009. 11. Michael R. Fellows, Daniel Lokshtanov, Neeldhara Misra, Frances A. Rosamond, and Saket Saurabh. Graph layout problems parameterized by vertex cover. In Seok-Hee Hong, Hiroshi Nagamochi, and Takuro Fukunaga, editors, ISAAC 2008, volume 5369 of Lecture Notes in Com- puter Science, pages 294 -- 305. Springer, 2008. 12. Jir´ı Fiala, Petr A. Golovach, and Jan Kratochv´ıl. Parameterized complexity of coloring problems: Treewidth versus vertex cover. Theoretical Computer Science, 412(23):2513 -- 2523, 2011. 18 Michael R. Fellows, Serge Gaspers, and Frances A. Rosamond 13. Jorg Flum and Martin Grohe. Parameterized Complexity Theory, volume XIV of Texts in The- oretical Computer Science. An EATCS Series. Springer, Berlin, 2006. 14. Andr´as Frank and ´Eva Tardos. An application of simultaneous diophantine approximation in combinatorial optimization. Combinatorica, 7(1):49 -- 65, 1987. 15. Serge Gaspers, Mathieu Liedloff, Maya J. Stein, and Karol Suchan. Complexity of splits recon- struction for low-degree trees. In Jan Kratochv´ıl, editor, WG 2011, volume 6986 of Lecture Notes in Computer Science. Springer, 2011. To appear. 16. Jens Gramm, Rolf Niedermeier, and Peter Rossmanith. Fixed-parameter algorithms for closest string and related problems. Algorithmica, 37(1):25 -- 42, 2003. 17. Ravi Kannan. Minkowski's convex body theorem and integer programming. Mathematics of Operations Research, 12(3):415 -- 440, 1987. 18. Donald E. Knuth. The Art of Computer Programming, Volume III: Sorting and Searching. Addison-Wesley, 1973. 19. Christian Komusiewicz, Rolf Niedermeier, and Johannes Uhlmann. Deconstructing intractabil- ity - a multivariate complexity analysis of interval constrained coloring. Journal of Discrete Algorithms, 9(1):137 -- 151, 2011. 20. Hendrik W. Lenstra. Integer programming with a fixed number of variables. Mathematics of Operations Research, 8(4):538 -- 548, 1983. 21. George H. Mealy. A method for synthesizing sequential circuits. Bell System Technical Journal, 34(5):1045 -- 1079, 1955. 22. Ian Munro and Philip M. Spira. Sorting and searching in multisets. SIAM Journal on Computing, 5(1):1 -- 8, 1976. 23. Rolf Niedermeier. Invitation to Fixed-Parameter Algorithms. Oxford Lecture Series in Mathe- matics and Its Applications. Oxford University Press, Oxford, 2006. 24. Rolf Niedermeier. Reflections on multivariate algorithmics and problem parameterization. In Jean-Yves Marion and Thomas Schwentick, editors, STACS 2010, volume 5 of LIPIcs, pages 17 -- 32. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2010. 25. Rohit J. Parikh. On context-free languages. Journal of the ACM, 13(4):570 -- 581, 1966. 26. Krzysztof Pietrzak. On the parameterized complexity of the fixed alphabet shortest common supersequence and longest common subsequence problems. Journal of Computer and System Sciences, 67(4):757 -- 771, 2003. 27. Emmanuel Roche and Yves Schabes. Finite-state language processing. The MIT Press, 1997. 28. John E. Savage. Models of computation - exploring the power of computing. Addison-Wesley, 1998. 29. Sandeep Sen and Neelima Gupta. Distribution-sensitive algorithms. Nordic Journal of Comput- ing, 6:194 -- 211, 1999. 30. Eduardo Sontag. Mathematical Control Theory: Deterministic Finite Dimensional Systems, Second Edition. Springer, 1998.
1205.1312
1
1205
2012-05-07T08:02:48
Converting online algorithms to local computation algorithms
[ "cs.DS" ]
We propose a general method for converting online algorithms to local computation algorithms by selecting a random permutation of the input, and simulating running the online algorithm. We bound the number of steps of the algorithm using a query tree, which models the dependencies between queries. We improve previous analyses of query trees on graphs of bounded degree, and extend the analysis to the cases where the degrees are distributed binomially, and to a special case of bipartite graphs. Using this method, we give a local computation algorithm for maximal matching in graphs of bounded degree, which runs in time and space O(log^3 n). We also show how to convert a large family of load balancing algorithms (related to balls and bins problems) to local computation algorithms. This gives several local load balancing algorithms which achieve the same approximation ratios as the online algorithms, but run in O(log n) time and space. Finally, we modify existing local computation algorithms for hypergraph 2-coloring and k-CNF and use our improved analysis to obtain better time and space bounds, of O(log^4 n), removing the dependency on the maximal degree of the graph from the exponent.
cs.DS
cs
Converting Online Algorithms to Local Computation Algorithms Yishay Mansour1 ⋆, Aviad Rubinstein1 ⋆⋆, Shai Vardi1 ⋆ ⋆ ⋆, and Ning Xie2 † 1 School of Computer Science, Tel Aviv University, Israel 2 CSAIL, MIT, Cambridge MA 02139, USA Abstract. We propose a general method for converting online algorithms to local computation algorithms,3 by selecting a random permutation of the input, and simulating running the online algorithm. We bound the number of steps of the algorithm using a query tree, which models the dependencies between queries. We improve previous analyses of query trees on graphs of bounded degree, and extend the analysis to the cases where the degrees are distributed binomially, and to a special case of bipartite graphs. Using this method, we give a local computation algorithm for maximal matching in graphs of bounded degree, which runs in time and space O(log3 n). We also show how to convert a large family of load balancing algorithms (related to balls and bins problems) to local computation algorithms. This gives several local load balancing algorithms which achieve the same approximation ratios as the online algorithms, but run in O(log n) time and space. Finally, we modify existing local computation algorithms for hypergraph 2-coloring and k-CNF and use our improved analysis to obtain better time and space bounds, of O(log4 n), removing the dependency on the maximal degree of the graph from the exponent. 1 Introduction 1.1 Background The classical computation model has a single processor which has access to a given input, and using an internal memory, computes the output. This is essentially the von Newmann architecture, which has been the driving force since the early days of com- putation. The class of polynomial time algorithms is widely accepted as the definition ⋆ [email protected]. Supported in part by the Google Inter-university center for Electronic Markets and Auctions, by a grant from the Israel Science Foundation, by a grant from United States-Israel Binational Science Foundation (BSF), by a grant from Israeli Centers of Research Excellence (ICORE), and by a grant from the Israeli Ministry of Science (MoS). ⋆⋆ [email protected]. ⋆ ⋆ ⋆ [email protected]. Supported in part by the Google Inter-university center for Electronic Markets and Auctions † [email protected]. Supported by NSF grants CCF-0728645, CCF-0729011 and CCF-1065125. 3 For a given input x, local computation algorithms support queries by a user to values of spec- ified locations yi in a legal output y ∈ F (x). 2 of efficiently computable problems. Over the years many interesting variations of this basic model have been studied, focusing on different issues. Online algorithms (see, e.g., [7]) introduce limitations in the time domain. An online algorithm needs to select actions based only on the history it observed, without access to future inputs that might influence its performance. Sublinear algorithms (e.g. [11, 15]) limit the space domain, by limiting the ability of an algorithm to observe the entire input, and still strive to derive global properties of it. Local computation algorithms (LCAs) [16] are a variant of sublinear algorithms. The LCA model considers a computation problem which might have multiple admis- sible solutions, each consisting of multiple bits. The LCA can return queries regarding parts of the output, in a consistent way, and in poly-logarithmic time. For example, the input for an LCA for a job scheduling problem consists of the description of n jobs and m machines. The admissible solutions might be the allocations of jobs to machines such that the makespan is at most twice the optimal makespan. On any query of a job, the LCA answers quickly the job's machine. The correctness property of the LCA guar- antees that different query replies will be consistent with some admissible solution. 1.2 Our results Following [2], we use an abstract tree structure - query trees to bound the number of queries performed by certain algorithms. We use these bounds to improve the upper bound the time and space requirements of several algorithms introduced in [2]. We also give a generic method of transforming online algorithms to LCAs, and apply it to obtain LCAs to maximal matching and several load balancing problems. 1.2.1 Bounds on query trees Suppose that we have an online algorithm where the reply to a query depends on the replies to a small number of previous queries. The reply to each of those previous queries depends on the replies to a small number of other queries and so on. These dependencies can be used to model certain problems using query trees – trees which model the dependency of the replies to a given query on the replies to other queries. Bounding the size of a query tree is central to the analyses of our algorithms. We show that the size of the query tree is O(log n) w.h.p., where n is the number of vertices. d, the degree bound of the dependency graph, appears in the constant. 4 This answers in the affirmative the conjecture of [2]. Previously, Alon et al. [2] show that the expected size of the query tree is constant, and O(logd+1 n) w.h.p.5 Our improvement is signif- icant in removing the dependence on d from the exponent of the logarithm. We also show that when the degrees of the graph are distributed binomially, we can achieve the same bound on the size of the query tree. In addition, we show a trivial lower bound of Ω(log n/ log log n). 4 Note that, however, the hidden constant is exponentially dependent on d. Whether or not this bound can be improved to have a polynomial dependency on d is an interesting open question. 5 Notice that bounding the expected size of the query tree is not enough for our applications, since in LCAs we need to bound the probability that any query fails. 3 We use these results on query trees to obtain LCAs for several online problems – maximal matching in graphs of bounded degree and several load balancing problems. We also use the results to improve the previous algorithms for hypergraph 2-coloring and k-CNF. 1.2.2 Hypergraph 2-coloring We modify the algorithm of [2] for an LCA for hyper- graph 2-coloring, and coupled with our improved analysis of query tree size, obtain an LCA which runs in time and space O(log4 n), improving the previous result, an LCA which runs O(logd+1 n) time and space. 1.2.3 k-CNF Building on the similarity between hypergraph 2-coloring and k-CNF, we apply our results on hypergraph 2-coloring to give an an LCA for k-CNF which runs in time and space O(log4 n). We use the query tree to transform online algorithms to LCAs. We simulate online algorithms as follows: first a random permutation of the items is generated on the fly. Then, for each query, we simulate the online algorithm on a stream of input items ar- riving according to the order of the random permutation. Fortunately, because of the nature of our graphs (the fact that the degree is bounded or distributed binomially), we show that in expectation, we will only need to query a constant number of nodes, and only O(log n) nodes w.h.p. We now state our results: 1.2.4 Maximal matching We simulate the greedy online algorithm for maximal matching, to derive an LCA for maximal matching which runs in time and space O(log3 n). 1.2.5 Load Balancing We give several LCAs to load balancing problems which run in O(log n) time and space. Our techniques include extending the analysis of the query tree size to the case where the degrees are selected from a binomial distribution with expectation d, and further extending it to bipartite graphs which exhibit the characteris- tics of many balls and bins problems, specifically ones where each ball chooses d bins at random. We show how to convert a large class of the "power of d choices" online algorithms (see, e.g., [3, 6, 18]) to efficient LCAs. 1.3 Related work Nguyen and Onak [13] focus on transforming classical approximation algorithms into constant-time algorithms that approximate the size of the optimal solution of problems such as vertex cover and maximum matching. They generate a random number r ∈ [0, 1], called the rank, for each node. These ranks are used to bound the query tree size. Rubinfeld et al. [16] show how to construct polylogarithmic time local computa- tion algorithms to maximal independent set computations, scheduling radio network broadcasts, hypergraph coloring and satisfying k-SAT formulas. Their proof technique uses Beck's analysis in his algorithmic approach to the Lovász Local Lemma [4], and a reduction from distributed algorithms. Alon et al. [2], building on the technique of 4 [13], show how to extend several of the algorithms of [16] to perform in polylogarith- mic space as well as time. They further observe that we do not actually need to assign each query a rank, we only need a random permutation of the queries. Furthermore, assuming the query tree is bounded by some k, the query to any node depends on at most k queries to other nodes, and so a k-wise independent random ordering suffices. They show how to construct a 1/n2-almost k-wise independent random ordering6 from a seed of length O(k log2 n). Recent developments in sublinear time algorithms for sparse graph and combinato- rial optimization problems have led to new constant time algorithms for approximating the size of a minimum vertex cover, maximal matching, maximum matching, minimum dominating set, and other problems (cf. [15, 11, 13, 20]), by randomly querying a con- stant number of vertices. A major difference between these algorithms and LCAs is that LCAs require that w.h.p., the output will be correct on any input, while optimiza- tion problems usually require a correct output only on most inputs. More importantly, LCAs reuire a consistent output for each query, rather than only approximating a given global property. There is a vast literature on the topic of balls and bins and the power of d choices. (e.g. [3, 6, 9, 18]). For a survey on the power of d choices, we refer the reader to [12]. 1.4 Organization of our paper The rest of the paper is organized as follows: Some preliminaries and notations that we use throughout the paper appear in Section 2. In Section 3 we prove the upper bound of O(log n) on the size of the query tree in the case of bounded and binomially distributed degrees. In section 4, we use this analysis to give improved algorithms for hypergraph 2-coloring and k-CNF. In Section 5 we give an LCA for finding a maximal matching in graphs of bounded degree. Section 6 expands our query tree result to a special case of bipartite graphs; we use this bound for bipartite graph to convert online algorithms for balls and bins into LCAs for the same problems. The appendices provide in-depth discussions of the hypergraph 2-coloring and analogous k-CNF LCAs, and a lower bound to the query tree size. 2 Preliminaries Let G = (V, E) be an undirected graph. We denote by NG(v) = {u ∈ V (G) : (u, v) ∈ E(G)} the neighbors of vertex v, and by degG(v) we denote the degree of v. When it is clear from the context, we omit the G in the subscript. Unless stated otherwise, all logarithms in this paper are to the base 2. We use [n] to denote the set {1, . . . , n}, where n ≥ 1 is a natural number. We present our model of local computation algorithms (LCAs): Let F be a com- putational problem and x be an input to F . Let F (x) = {y y is a valid solution for input x}. The search problem for F is to find any y ∈ F (x). 6 A random ordering Dr is said to be ǫ-almost k-wise independent if the statistical distance between Dr and some k-wise independent random ordering by at most ǫ. 5 A (t(n), s(n), δ(n))-local computation algorithm A is a (randomized) algorithm which solves a search problem for F for an input x of size n. However, the LCA A does not output a solution y ∈ F (x), but rather implements query access to y ∈ F (x). A receives a sequence of queries i1, . . . , iq and for any q > 0 satisfies the following: (1) after each query ij it produces an output yij , (2) With probability at least 1 − δ(n) A is consistent, that is, the outputs yi1 , . . . , yiq are substrings of some y ∈ F (x). (3) A has access to a random tape and local computation memory on which it can perform current computations as well as store and retrieve information from previous computations. We assume that the input x, the local computation tape and any random bits used are all presented in the RAM word model, i.e., A is given the ability to access a word of any of these in one step. The running time of A on any query is at most t(n), which is sublinear in n, and the size of the local computation memory of A is at most s(n). Unless stated otherwise, we always assume that the error parameter δ(n) is at most some constant, say, 1/3. We say that A is a strongly local computation algorithm if both t(n) and s(n) are upper bounded by O(logc n) for some constant c. Two important properties of LCAs are as follows. We say an LCA A is query order oblivious (query oblivious for short) if the outputs of A do not depend on the order of the queries but depend only on the input and the random bits generated on the random tape of A. We say an LCA A is parallelizable if A supports parallel queries, that is A is able to answer multiple queries simultaneously so that all the answers are consistent. 3 Bounding the size of a random query tree 3.1 The problem and our main results In online algorithms, queries arrive in some unknown order, and the reply to each query depends only on previous queries (but not on any future events). The simplest way to transform online algorithms to LCAs is to process the queries in the order in which they arrive. This, however, means that we have to store the replies to all previous queries, so that even if the time to compute each query is polylogarithmic, the overall space is linear in the number of queries. Furthermore, this means that the resulting LCA is not query-oblivious. The following solution can be applied to this problem ([13] and [2]): Each query v is assigned a random number, r(v) ∈ [0, 1], called its rank, and the queries are performed in ascending order of rank. Then, for each query x, a query tree can be constructed, to represent the queries on which x depends. If we can show that the query tree is small, we can conclude that each query does not depend on many other queries, and therefore a small number of queries need to be processed in order to reply to query x. We formalize this as follows: Let G = (V, E) be an undirected graph. The vertices of the graph represent queries, and the edges represent the dependencies between the queries. A real number r(v) ∈ [0, 1] is assigned independently and uniformly at random to every vertex v ∈ V ; we call r(v) the rank of v. This models the random permutation of the vertices. Each vertex v ∈ V holds an input x(v) ∈ R, where the range R is some finite set. The input is the content of the query associated with v. A randomized function F is defined inductively on the vertices of G such that F (v) is a (deterministic) function of x(v) as well as the 6 values of F at the neighbors w of v for which r(w) < r(v). F models the output of the online algorithm. We would like to upper bound the number of queries to vertices in the graph needed in order to compute F (v0) for any vertex v0 ∈ G, namely, the time to simulate the output of query v0 using the online algorithm. To upper bound the number of queries to the graph, we turn to a simpler task of bounding the size of a certain d-regular tree, which is an upper bound on the number of queries. Consider an infinite d-regular tree T rooted at v0. Each node w in T is assigned independently and uniformly at random a real number r(w) ∈ [0, 1]. For every node w other than v0 in T , let parent(w) denote the parent node of w. We grow a (possibly infinite) subtree T of T rooted at v as follows: a node w is in the subtree T if and only if parent(w) is in T and r(w) < r(parent(w)) (for simplicity we assume all the ranks are distinct real numbers). That is, we start from the root v0, add all the children of v0 whose ranks are smaller than that of v0 to T . We keep growing T in this manner where a node w′ ∈ T is a leaf node in T if the ranks of its d children are all larger than r(w′). We call the random tree T constructed in this way a query tree and we denote by T the random variable that corresponds to the size of T . Note that T is an upper bound on the number of queries since each node in T has at least as many neighbors as that in G and if a node is connected to some previously queried nodes, this can only decrease the number of queries. Therefore the number of queries is bounded by the size of T . Our goal is to find an upper bound on T which holds with high probability. We improve the upper bound on the query tree of O(logd+1 N ) given in [2] for the case when the degrees are bounded by a constant d and extend our new bound to the case that the degrees of G are binomially distributed, independently and identically with expectation d, i.e., deg(v) ∼ B(n, d/n). Our main result in this section is bounding, with high probability, the size of the query tree T as follows. Lemma 1. Let G be a graph whose vertex degrees are bounded by d or distributed independently and identically from the binomial distribution: deg(v) ∼ B(n, d/n). Then there exists a constant C(d) which depends only on d, such that Pr[T > C(d) log n] < 1/n2, where the probability is taken over all the possible permutations π ∈ Π of the vertices of G, and T is a random query tree in G under π. 3.2 Overview of the proof Our proof of Lemma 1 consists of two parts. Following [2], we partition the query tree into levels. The first part of the proof is an upper bound on the size of a single (sub)tree on any level. For the bounded degree case, this was already proved in [2] (the result is restated as Proposition 1). We extend the proof of [2] to the binomially distributed degrees case. In both cases the bound is that with high probability each subtree is of size at most logarithmic in the size of the input. The second part, which is a new ingredient of our proof, inductively upper bounds the number of vertices on each level, as the levels increase. For this to hold, it crucially 7 depends on the fact that all subtrees are generated independently and that the probability of any subtree being large is exponentially small. The main idea is to show that although each subtree, in isolation, can reach a logarithmic size, their combination is not likely to be much larger. We use the distribution of the sizes of the subtrees, in order to bound the aggregate of multiple subtrees. 3.3 Bounding the subtree size i 1 L+1 ], for i = 1, 2, · · · , L and IL+1 = [0, As in [2], we partition the query tree into levels and then upper bound the probability that a subtree is larger than a given threshold. Let L > 1 be a function of d to be determined later. First, we partition the interval [0,1] into L sub-intervals: Ii = (1 − L+1 , 1 − i−1 L+1 ]. We refer to interval Ii as level i. A vertex v ∈ T is said to be on level i if r(v) ∈ Ii. We consider the worst case, in which r(v0) ∈ I1. In this case, the vertices on level 1 form a tree T1 rooted at v0. Denote the number of (sub)trees on level i by ti. The vertices on level 2 will form a set of trees {T (1) }, where the total number of subtrees is at most the sum of the children of all the vertices in T1 (we only have inequality because some of the children of the vertices of T1 may be assigned to levels 3 and above.) The vertices on }. Note that all these subtrees {T (j) level i > 1 form a set of subtrees {T (1) i } are generated independently by the same stochastic process, as the ranks of all nodes in T are i.i.d. random variables. In the following analysis, we will set L = 3d. 2 , · · · , T (t2) 2 , · · · T (ti) i i For the bounded degree case, bounding the size of the subtree follows from [2]: Proposition 1 ([2]). 7 Let L ≥ d+1 be a fixed integer and let T be the d-regular infinite query tree. Then for any 1 ≤ i ≤ L and 1 ≤ j ≤ ti, Pr[T (j) i=n 2−ci ≤ 2−Ω(n), for all n ≥ β, where β is some constant. In particular, there is an absolute constant c0 depending on d only such that for all n ≥ 1, ≥ n] ≤ P∞ i Pr[T (j) i ≥ n] ≤ e−c0n. 3.3.1 The binomially distributed degrees case We are interested in bounding the subtree size also in the case that the degrees are not a constant d, but rather selected independently and identically from a binomial distribution with mean d. Proposition 2. Let T be a tree with vertex degree distributed i.i.d. binomially with deg(v) ∼ B(n, d/n). For any 1 ≤ i ≤ L and any 1 ≤ j ≤ ti, Pr[T (j) ≥ n] ≤ P∞ i=n 2−ci ≤ 2−Ω(n), for n ≥ β, for some constant β > 0. Proof. The proof of Proposition 2 is similar to the proof of Proposition 1 in [2]; we em- ploy the theory of Galton-Watson processes. For a good introduction to Galton-Watson branching processes see e.g. [10]. i 0, 1, 2, . . .}, with pk ≥ 0 and Pk pk = 1. Let f (s) = P∞ Consider a Galton-Watson process defined by the probability function p := {pk; k = k=0 pksk be the gen- erating function of p. For i = 0, 1, . . . , let Zi be the number of offsprings in the 7 In [2], this lemma is proved for the case of L = d+1. This immediately establishes Proposition 1, since the worse case is L = d + 1. 8 ith generation. Clearly Z0 = 1 and {Zi : i = 0, 1, . . .} form a Markov chain. Let m := E[Z1] = Pk kpk be the expected number of children of any individual. Let Z = Z0 + Z1 + · · · be the sum of all offsprings in all generations of the Galton-Watson process. The following result of Otter is useful in bounding the probability that Z is large. Theorem 1 ([14]). Suppose p0 > 0 and that there is a point a > 0 within the circle of convergence of f for which af ′(a) = f (a). Let α = a/f (a). Let t = gcd{r : pr > 0}, where gcd stands for greatest common divisor. Then Pr[Z = n] =   a 2παf ′′(a)(cid:17)1/2 t(cid:16) 0, α−nn−3/2 + O(α−nn−5/2), if n ≡ 1 (mod t); if n 6≡ 1 (mod t). In particular, if the process is non-arithmetic, i.e. gcd{r : pr > 0} = 1, and finite, then a αf ′′(a) is Pr[Z = n] = O(α−nn−3/2), and consequently Pr[Z ≥ n] = O(α−n). i We prove Proposition 2 for the case of tree T1 – the proof actually applies to all subtrees T (j) . Recall that T1 is constructed inductively as follows: for v ∈ N (v0) in T , we add v to T1 if r(v) < r(v0) and r(v) ∈ I1. Then for each v in T1, we add the neighbors w ∈ N (v) in T to T1 if r(w) < r(v) and r(w) ∈ I1. We repeat this process until there is no vertex that can be added to T1. Once again, we work with the worst case that r(v0) = 1. To upper bound the size of T1, we consider a related random process which also grows a subtree of T rooted at v0, and denote it by T ′ 1 is the same as that of T1 except for 1 and w is a child vertex of v in T , then we add w to the following difference: if v ∈ T ′ 1 as long as r(w) ∈ I1. In other words, we give up the requirement that r(w) < r(v). T ′ Clearly, we always have T1 ⊆ T ′ 1. The process that grows T ′ 1 and hence T ′ 1 ≥ T1. Note that the random process that generates T ′ 1 is in fact a Galton-Watson process, as the rank of each vertex in T is independently and uniformly distributed in [0, 1]. We take vertex v to be the parent node. Since I1 = 1/L, then for any vertex u ∈ V (G), u 6= v, the probability that u is a child node of v in T ′ 1 is d/n · 1/L = d/nL, as the random process that connects w to v and the random process that generates the rank of w are independent (each edge is chosen with probability d/n, and the probability that r(w) is in Iv = 1/L). It follows that we have a binomial distribution for the number of child nodes of v in T ′ 1: p = {(1 − q)n,(cid:18)n 1(cid:19)q(1 − q)n−1,(cid:18)n 2(cid:19)q2(1 − q)n−2, . . . , qn}, 9 1 when its where q := d/nL is the probability that a child vertex in T appears in T ′ 1 is parent vertex is in T ′ nq = d/L < 1, so from the classical result on the extinction probability of Galton- Watson processes (see e.g. [10]), the tree T ′ 1. Note that the expected number of children of a vertex in T ′ 1 is finite with probability one. The generating function of p is f (s) = (1 − q + qs)n, as the probability function {pk} obeys the binomial distribution pk = Pr[X = k] where X ∼ B(n, q). In addition, the convergence radius of f is ρ = ∞ since {pk} has only a finite number of non-zero terms. f ′(s) = nq(1 − q + qs)n−1 Solving the equation af ′(a) = f (a) yields anq(1 − q + qa)n−1 = (1 − q + qa)n and hence anq = 1 − q + qa. Consequently, solving for a gives a = 1 − q q(n − 1) = = = 1 − d/nL d(n − 1)/nL nL − d d(n − 1) 3n − 1 n − 1 . We can lower bound α as α = a f (a) = 1 f ′(a) L = = ≥ d(1 − q + q 3n−1 n−1 )n−1 3 3(n−1)(cid:17)n−1 (cid:16)1 + 2 3 e2/3 > 1. Finally we calculate f ′′(a): f ′′(a) = q2n(n − 1)(1 − q + qa)n−2 = = d2n(n − 1) n2L2 n − 1 9n (cid:18)1 + = Θ(1), + 3n − 1 n − 1 (cid:19)n−2 · d nL d nL (cid:18)1 − 3(n − 1)(cid:19)n−2 2 10 therefore a αf ′′(a) is a bounded constant. Now applying Theorem 1 to the Galton-Watson process which generates T ′ 1 (note that t = 1 in our case) gives that, there exists a constant n0 such that for n > n0, Pr[T ′ 1 ≥ n] ≤ P∞ i=n 2−ci ≤ 2−Ω(n) for all n > n0. Hence for all large enough n, with probabil- ⊓⊔ 1 = n] ≤ 2−cn for some constant c > 0. It follows that Pr[T ′ ity at least 1 − 1/n3, T1 ≤ T ′ 1 = O(log n). The following corollary stems directly from Propositions 1 and 2: Corollary 1. Let T be any infinite d-regular query tree or tree with vertex degree dis- tributed i.i.d. binomially with deg(v) ∼ B(n, d/n). For any 1 ≤ i ≤ L and any 1 ≤ j ≤ ti, with probability at least 1 − 1/n3, T (j) = O(log n). i 3.4 Bounding the increase in subtree size as we go up levels From Corollary 1 we know that the size of any subtree, in particular T1, is bounded by O(log n) with probability at least 1 − 1/n3 in both the degree d and the binomial degree cases. Our next step in proving Lemma 1 is to show that, as we increase the levels, the size of the tree does not increase by more than a constant factor for each level. That is, there exists an absolute constant η depending on d only such that if the number of vertices on level k is at most Tk, then the number of vertices on level k + 1, i=1 Ti + O(log n) ≤ 2ηTk + O(log n). Since there are L levels in total, this implies that the number of vertices on all L levels is at most O((2η)L log n) = O(log n). Tk+1 satisfies Tk+1 ≤ ηPk The following Proposition establishes our inductive step. Proposition 3. For any infinite query tree T with constant bounded degree d (or de- grees i.i.d. ∼ B(n, d/n)), for any 1 ≤ i < L, there exist constants η1 > 0 and i+1 ≥ η1η2 log n] < 1/n2 j=1 T (j) j=1 T (j) i η2 > 0 s.t. if Pti for all n > β, for some β > 0. ≤ η1 log n then Pr[Pti+1 i=1 zi. i=1 Zi. Assume that each vertex i on level ≤ k is the root of a tree of size zi on level k + 1. Notice that Proof. Denote the number of vertices on level k by Zk and let Yk = Pk Zk+1 = PYk By Proposition 1 (or Proposition 2), there are absolute constants c0 and β depending on d only such that for any subtree T (i) k = n] ≤ e−c0n. Therefore, given (z1, . . . , zYk), the probability of the forest on level k+1 consist- i=1 e−c0(zi−β) = e−c0(Zk+1−βYk). Notice that, given Yk (the number of nodes up to level k), there are at most(cid:0)Zk+1+Yk−1 (cid:1) ing of exactly trees of size (z1, . . . , zYk ) is at mostQYk < (cid:0)Zk+1+Yk (cid:1) vectors (z1, . . . , zYk ) that can realize Zk+1. k on level k and any n > β, Pr[T (i) Yk−1 Yk We want to bound the probability that Zk+1 = ηYk for some (large enough) con- stant η > 0. We can bound this as follows: Pr[Tk+1 = Zk+1] < (cid:18)Zk+1 + Yk Yk (cid:19)e−c0(Zk+1−βYk) 11 Yk e−c0(Zk+1−βYk) (cid:19)Yk < (cid:18) e · (Zk+1 + Yk) = (e(1 + η))Yk e−c0(η−β)Yk = eYk(−c0(η−β)+ln(η+1)+1) ≤ e−c0ηYk/2, It follows that there is some absolute constant c′ which depends on d only such that Pr[Tk+1 ≥ ηYk] ≤ e−c′ηYk . That is, if ηYk = Ω(log n), the probability that Tk+1 ≥ ηYk is at most 1/n3. Adding the vertices on all L levels and applying the union bound, we conclude that with probability at most 1/n2, the size of T is at most O(log n). ⊓⊔ 4 Hypergraph 2-coloring and k-CNF We use the bound on the size of the query tree of graphs of bounded degree to improve the analysis of [2] for hypergraph 2-coloring. We also modify their algorithm slightly to further improve the algorithm's complexity. As the algorithm is a more elaborate version of the algorithm of [2] and the proof is somewhat long, we only state our main theorem for hypergraph 2-coloring; we defer the proof to Appendix A. Theorem 2. Let H be a k-uniform hypergraph s.t. each hyperedge intersects at most d other hyperedges. Suppose that k ≥ 16 log d + 19. Then there exists an (O(log4 n), O(log4 n), 1/n)-local computation algorithm which, given H and any sequence of queries to the colors of vertices (x1, x2, . . . , xs), with probability at least 1 − 1/n2, returns a consistent coloring for all xi's which agrees with a 2-coloring of H. Moreover, the algorithm is query oblivious and parallelizable. Due to the similarity between hypergraph 2-coloring and k-CNF, we also have the following theorem; the proof is in Appendix B. Theorem 3. Let H be a k-CNF formula with k ≥ 2. Suppose that each clause inter- sects no more than d other clauses, and furthermore suppose that k ≥ 16 log d + 19. Then there exists a (O(log4 n), O(log4 n), 1/n)-local computation algorithm which, given a formula H and any sequence of queries to the truth assignments of variables (x1, x2, . . . , xs), with probability at least 1 − 1/n2, returns a consistent truth assign- ment for all xi's which agrees with some satisfying assignment of the k-CNF formula H. Moreover, the algorithm is query oblivious and parallelizable. 12 5 Maximal matching We consider the problem of maximal matching in a bounded-degree graph. We are given a graph G = (V, E), where the maximal degree is bounded by some constant d, and we need to find a maximal matching.A matching is a set of edges with the property that no two edges share a common vertex. The matching is maximal if no other edge can be added to it without violating the matching property. Assume the online scenario in which the edges arrive in some unknown order. The following greedy online algorithm can be used to calculate a maximal matching: When an edge e arrives, we check whether e is already in the matching. If it is not, we check if any of the neighboring edges are in the matching. If none of them is, we add e to the matching. Otherwise, e is not in the matching. We turn to the local computation variation of this problem. We would like to query, for some edge e ∈ E, whether e is part of some maximal matching. (Recall that all replies must be consistent with some maximal matching). We use the technique of [2] to produce an almost O(log n)-wise independent ran- dom ordering on the edges, using a seed length of O(log3 n).8 When an edge e is queried, we use a BFS (on the edges) to build a DAG rooted at e. We then use the greedy online algorithm on the edges of the DAG (examining the edges with respect to the ordering), and see whether e can be added to the matching. As the query tree is an upper-bound on the size of the DAG, we derive the following theorem from Lemma 1. Theorem 4. Let G = (V, E) be an undirected graph with n vertices and maximum degree d. Then there is an (O(log3 n), O(log3 n), 1/n) - local computation algorithm which, on input an edge e, decides if e is in a maximal matching. Moreover, the algo- rithm gives a consistent maximal matching for every edge in G. 6 The bipartite case and local load balancing We consider a general "power of d choices" online algorithm for load balancing. In this setting there are n balls that arrive in an online manner, and m bins. Each ball selects a random subset of d bins, and queries these bins. (Usually the query is simply the current load of the bin.) Given this information, the ball is assigned to one of the d bins (usually to the least loaded bin). We denote by LB such a generic algorithm (with a decision rule which can depend in an arbitrary way on the d bins that the ball is assigned to). Our main goal is to simulate such a generic algorithm. The load balancing problem can be represented by a bipartite graph G = ({V, U }, E), where the balls are represented by the vertices V and the bins by the vertices U . The random selection of a bin u ∈ U by a ball v ∈ V is represented by an edge. By defi- nition, each ball v ∈ V has degree d. Since there are random choices in the algorithm LB we need to specify what we mean by a simulation. For this reason we define the input to be the following: a graph G = ({V, U }, E), where V = n, U = m, and 8 Since the query tree is of size O(log n) w.h.p., we don't need a complete ordering on the vertices; an almost O(log n)-wise independent ordering suffices. 13 n = cm for some constant c ≥ 1. We also allocate a rank r(u) ∈ [0, 1] to every u ∈ U . This rank represents the ball's arrival time: if r(v) < r(u) then vertex v arrived before vertex u. Furthermore, all vertices can have an input value x(w). (This value represents some information about the node, e.g., the weight of a ball.) Given this input, the al- gorithm LB is deterministic, since the arrival sequence is determined by the ranks, and the random choices of the balls appear as edges in the graph. Therefore by a simulation we will mean that given the above input, we generate the same allocation as LB. We consider the following stochastic process: Every vertex v ∈ V uniformly and independently at random chooses d vertices in U . Notice that from the point of view of the bins, the number of balls which chose them is distributed binomially with X ∼ B(n, d/m). Let Xv and Xu be the random variables for the number of neighbors of vertices v ∈ V and u ∈ U respectively. By definition, Xv = d, since all balls have d neighbors, and hence each Xu is independent of all Xv's. However, there is a depen- dence between the Xu's (the number of balls connected to different bins). Fortunately this is a classical example where the random variables are negatively dependent (see e.g. [9]). 9 6.1 The bipartite case Recall that in Section 3, we assumed that the degrees of the vertices in the graph were independent. We would like to prove an O(log n) upper bound on the query tree T for our bipartite graph. As we cannot use the theorems of Section 3 directly, we show that the query tree is smaller than another query tree which meets the conditions of our theorems. The query tree for the binomial graph is constructed as follows: a root v0 ∈ V is selected for the tree. (v0 is the ball whose bin assignment we are interested in deter- mining.) Label the vertices at depth j in the tree by Wj. Clearly, W0 = {v0}. At each depth d, we add vertices one at a time to the tree, from left to right, until the depth is "full" and then we move to the next depth. Note that at odd depths (2j + 1) we add bin vertices and at even depths (2j) we add ball vertices. Specifically, at odd depths (2j + 1) we add, for each v ∈ W2j its d neighbors u ∈ N (v) as children, and mark each by u.10 At even depths (2j) we add for each node marked by u ∈ W2j−1 all its (ball) neighbors v ∈ N (u) such that r(v) < r(parent(u)), if they have not already been added to the tree. Namely, all the balls that are assigned to u by time A leaf is a node marked by a bin uℓ for whom all neighboring balls v ∈ N (uℓ) − {parent(uℓ)} have a rank larger than its parent, i.e., r(v) > r(parent(uℓ)). Namely, parent(uℓ) is the first ball to be assigned to bin uℓ. This construction defines a stochas- tic process F = {Ft}, where Ft is (a random variable for) the size of T at time t. (We start at t = 0 and t increases by 1 for every vertex we add to the tree). We now present our main lemma for bipartite graphs. 9 We remind the reader that two random variables X1 and X2 are negatively dependent if Pr[X1 > xX2 = a] < Pr[X1 > xX2 = b], for a > b and vice-versa. 10 A bin can appear several times in the tree. It appears as different nodes, but they are all marked so that we know it is the same bin. Recall that we assume that all nodes are unique, as this assumption can only increase the size of the tree. 14 Lemma 2. Let G = ({V, U }, E) be a bipartite graph, V = n and U = m and n = cm for some constant c ≥ 1, such that for each vertex v ∈ V there are d edges chosen independently and at random between v and U . Then there is a constant C(d) which depends only on d such that Pr[T < C(d) log n] > 1 − 1/n2, where the probability is taken over all of the possible permutations π ∈ Π of the vertices of G, and T is a random query tree in G under π. To prove Lemma 2, we look at another stochastic process F ′, which constructs a tree T ′: we start with a root v′ 0. Label the vertices at depth j in the tree by W ′ j. Assign every vertex y that is added to the tree a rank r(y) ∈ [0, 1] independently and uniformly at random. Similarly to T , W ′ 0}. At odd depths (2j + 1) we add to 2j, d children (from left to right). At even depths (2j) we add to each node each v′ ∈ W ′ u′ of different nodes u′ ∈ W ′ are i.i.d. Of the nodes added in this level, we remove all those vertices y′ for which r(y′) > r(parent(parent(y′))). u′ ∼ B(n, 2d/m) and the X ′ u′ children, where X ′ 0 = {v′ 2j−1, X ′ Importantly, the neighbor distributions of the vertices in the tree are independent of each other. If at any point T ′ has "more than half the bins", i.e., the sum of nodes on odd levels is at least m/2, we add n + m bin children of rank 0 to some even-level node in the tree. Given a tree T we define squash(T ) to be the tree T with the odd levels deleted, and a node v in level 2j is connected to node v′ in level 2j + 2 if v = parent(parent(v′)). Lemma 3. There is a constant C(d) which depends only on d such that for all large enough n, Pr[squash(T ′) > C(d) log n] < 1/n2. Because d·squash(T ′) ≥ T ′ ≥ squash(T ′), we immediately get the following corollary: Corollary 2. There is a constant C(d) which depends only on d such that for all large enough n, Pr[T ′ > C(d) log n] < 1/n2. We first make the following claim: Claim. squash(T ′) has vertex degree distributed i.i.d. binomially with deg(v) ∼ B(dn, 2d/m). 2j has d children, each with degree distributed binomially ∼ B(n, 2d/m). Proof. Each v ∈ W ′ For any independent r.v.'s Y1, Y2, · · · where ∀i > 0, Yi ∼ B(n, p), we know that q Xi=1 Yi ∼ B(qn, p). The Claim follows. ⊓⊔ We can now turn to the proof of Lemma 3: Proof. As long as squash(T ′) < m/2, the proof of the lemma follows the proof of Lemma 1 with slight modifications to constants and will therefore be omitted. 15 We notice that squash(T ′) < m/2 w.p. at least 1 − 1/n2: the proof of Lemma 1 is inductive - we show that at level I1, the size of the subtree is at most O(log n), and then bound the increase in tree size as we move to the next level. By the level IL, squash(T ′) = O(log n) w.p. at least 1−1/n2. Therefore it follows that squash(T ′) < m/2 w.p. at least 1 − 1/n2. ⊓⊔ Before we can complete the proof of Lemma 2, we need to define the notion of first order stochastic dominance: Definition 1 (First order stochastic dominance). We say a random variable X first order stochastically dominates (dominates for short) a random variable Y if Pr[X ≥ a] ≥ Pr[Y ≥ a] for all a and Pr[X ≥ a] > Pr[Y ≥ a] for some a. If X dominates Y , then we write X ≥ Y . Lemma 4. For every t, F ′ t first-order stochastically dominates Ft. Proof. Assume we add a (bin) vertex u ∈ U to T at time t, the random variable for the number of u's neighbors is negatively dependent on all other Xw, w ∈ Tt ∩ U . We label this variable ¯X = Xu{Xw}, w ∈ Tt. We first show that F ′ t ≥ Ft when T has less than m/2 bins, and then show that t ≥ Ft when T ′ has more than m/2 bins. (It is easy to see why this is enough). F ′ Assume Tt ∩U ≤ m/2. Xu is dependent on at most m/2 other random variables, Xw. Because the dependency is negative, Xu is maximized when ∀w, Xw = 0. Therefore, in the worst case, Xu is dependent on m/2 bins with 0 children. If m/2 bins have 0 children, all edges in G must be distributed between the remaining bins. Therefore ¯X ≤ X ′ When T ′ has more than m/2 bins, by the construction of F ′ vertices, and so F ′ t , it has more than m + n ⊓⊔ t trivially dominates Ft. u, where X ′ u ∼ B(n, 2d/m). Combining Corollary 2 and Lemma 4 completes the proof of Lemma 2. 6.2 Local load balancing The following theorem states our basic simulation result. Theorem 5. Consider a generic online algorithm LB which requires constant time per query, for n balls and m bins, where n = cm for some constant c > 0. There exists an (O(log n), O(log n), 1/n)-local computation algorithm which, on query of a (ball) vertex v ∈ V , allocates v a (bin) vertex u ∈ U , such that the resulting allocation is identical to that of LB with probability at least 1 − 1/n. Proof. Let K = C(d) log U for some constant C(d) depending only on d. K is the upper bound given in Lemma 2. (In the following we make no attempt to provide the exact values for C(d) or K.) We now describe our (O(log n), O(log n), 1/n)-local computation algorithm for LB. A query to the algorithm is a (ball) vertex v0 ∈ V and the algorithm will chose a (bin) vertex from the d (bin) vertices connected to v0. 16 We first build a query tree as follows: Let v0 be the root of the tree. For every u ∈ N (u0), add to the tree the neighbors of u, v ∈ V such that r(v) < r(v0). Continue inductively until either K nodes have been added to the random query tree or no more nodes can be added to it. If K nodes have been added to the query tree, this is a failure event, and assign to v0 a random bin in N (v0). From Lemma 2, this happens with probability at most 1/n2, and so the probability that some failure event will occur is at most 1/n. Otherwise, perform LB on all of the vertices in the tree, in order of addition to the tree, and output the bin to which ball v0 is assigned to by LB. ⊓⊔ A reduction from various load balancing algorithms gives us the following corollar- ies to Theorem 5. Corollary 3. (Using [6]) Suppose we wish to allocate m balls into n bins of uniform capacity, m ≥ n, where each ball chooses d bins independently and uniformly at ran- dom. There exists a (log n, log n, 1/n) LCA which allocates the balls in such a way that the load of the most loaded bin is m/n + O(log log n/ log d) w.h.p. Corollary 4. (Using [19]) Suppose we wish to allocate n balls into n bins of uniform capacity, where each ball chooses d bins independently at random, one from each of d groups of almost equal size θ( n d ). There exists a (log n, log n, 1/n) LCA, which allo- cates the balls in such a way that the load of the most loaded bin is ln ln n/(d−1) ln 2+ O(1) w.h.p. 11 Corollary 5. (Using [5]) Suppose we wish to allocate m balls into n ≤ m bins, where each bin i has a capacity ci, and Pi ci = m. Each ball chooses d bins at ran- dom with probability proportional to their capacities. There exists a (log n, log n, 1/n) LCA which allocates the balls in such a way that the load of the most loaded bin is 2 log log n + O(1) w.h.p. Corollary 6. (Using [5]) Suppose we wish to allocate m balls into n ≤ m bins, where each bin i has a capacity ci, and Pi ci = m. Assume that the size of a large bin is at least rn log n, for large enough r. Suppose we have s small bins with total capacity ms, and that ms = O((n log n)2/3). There exists a (log n, log n, 1/n) LCA which allocates the balls in such a way that the expected maximum load is less than 5. Corollary 7. (Using [8]) Suppose we have n bins, each represented by one point on a circle, and n balls are to be allocated to the bins. Assume each ball needs to choose d ≥ 2 points on the circle, and is associated with the bins closest to these points. There exists a (log n, log n, 1/n) LCA which allocates the balls in such a way that the load of the most loaded bin is ln ln n/ ln d + O(1) w.h.p. 11 In fact, in this setting the tighter bound is ln ln n d ln φd Fibonacci sequence, i.e. φd = limk→∞ and for k ≥ 1 Fd(k) = Pd i=1 Fd(k − i) + O(1), where φd is the ratio of the d-step kpFd(k), where for k < 0, Fd(k) = 0, Fd(1) = 1, 17 6.3 Random ordering In the above we assume that we are given a random ranking for each ball. If we are not given such random rankings (in fact, a random permutation of the vertices in U will also suffice), we can generate a random ordering of the balls. Specifically, since w.h.p. the size of the random query is O(log n), an O(log n)-wise independent random ordering12 suffices for our local computation purpose. Using the construction in [2] of 1/n2-almost O(log n)-wise independent random ordering over the vertices in U which uses space O(log3 n), we obtain (O(log3 n), O(log3 n), 1/n)-local computation algorithms for balls and bins. 12 See [2] for the formal definitions of k-wise independent random ordering and almost k-wise independent random ordering. 18 References [1] N. Alon. A parallel algorithmic version of the Local Lemma. Random Structures and Algorithms, 2:367–378, 1991. [2] N. Alon, R. Rubinfeld, S. Vardi, and N. Xie. Space-efficient local computation algorithms. In Proc. 23rd ACM-SIAM Symposium on Discrete Algorithms, pages 1132–1139, 2012. [3] Y. Azar, A. Z. Broder, A. R. Karlin, and E. Upfal. Balanced allocations. SIAM Journal on Computing, 29(1):180–200, 1999. [4] J. Beck. An algorithmic approach to the Lovász Local Lemma. Random Structures and Algorithms, 2:343–365, 1991. [5] P. Berenbrink, A. Brinkmann, T. Friedetzky, and L. Nagel. Balls into non-uniform bins. In Proceedings of the 24th IEEE International Parallel and Distributed Processing Sympo- sium (IPDPS), pages 1–10. IEEE, 2010. [6] P. Berenbrink, A. Czumaj, A. Steger, and B. Vöcking. Balanced allocations: The heavily loaded case. SIAM J. Comput., 35(6):1350–1385, 2006. [7] A. Borodin and Ran El-Yaniv. Online Computation and Competitive Analysis. Cambridge University Press, 1998. [8] John W. Byers, Jeffrey Considine, and Michael Mitzenmacher. Simple load balancing for distributed hash tables. In Proc. of Intl. Workshop on Peer-to-Peer Systems(IPTPS), pages 80–87, 2003. [9] D. Dubhashi and D. Ranjan. Balls and bins: A study in negative dependence. Random Structures and Algorithms, 13:99–124, 1996. [10] T. Harris. The Theory of Branching Processes. Springer, 1963. [11] S. Marko and D. Ron. Distance approximation in bounded-degree and general sparse graphs. In APPROX-RANDOM'06, pages 475–486, 2006. [12] M. Mitzenmacher, A. Richa, and R. Sitaraman. The power of two random choices: A survey of techniques and results. In Handbook of Randomized Computing, Vol. I, edited by P. Pardalos, S. Rajasekaran, J. Reif, and J. Rolim, pages 255–312. Norwell, MA: Kluwer Academic Publishers, 2001. [13] H. N. Nguyen and K. Onak. Constant-time approximation algorithms via local improve- ments. In Proc. 49th Annual IEEE Symposium on Foundations of Computer Science, pages 327–336, 2008. [14] R. Otter. The multiplicative process. Annals of mathematical statistics, 20(2):206–224, 1949. [15] M. Parnas and D. Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theoretical Computer Science, 381(1–3), 2007. [16] R. Rubinfeld, G. Tamir, S. Vardi, and N. Xie. Fast local computation algorithms. In Proc. 2nd Symposium on Innovations in Computer Science, pages 223–238, 2011. [17] R. Rubinfeld, G. Tamir, S. Vardi, and N. Xie. Fast local computation algorithms, 2011. [18] K. Talwar and U. Wieder. Balanced allocations: the weighted case. In Proc. 39th Annual ACM Symposium on the Theory of Computing, pages 256–265, 2007. [19] Berthold Vöcking. How asymmetry helps load balancing. J. ACM, 50:568–589, July 2003. [20] Y. Yoshida, Y. Yamamoto, and H. Ito. An improved constant-time approximation algo- rithm for maximum matchings. In Proc. 41st Annual ACM Symposium on the Theory of Computing, pages 225–234, 2009. 19 A Hypergraph two-coloring Recall that a hypergraph H is a pair H = (V, E) where V is a finite set whose ele- ments are called nodes or vertices, and E is a family of non-empty subsets of V , called hyperedges. A hypergraph is called k-uniform if each of its hyperedges contains pre- cisely k vertices. A two-coloring of a hypergraph H is a mapping c : V → {red, blue} such that no hyperedge in E is monochromatic. If such a coloring exists, then we say H is two-colorable. We assume that each hyperedge in H intersects at most d other hyperedges. Let n be the number of hyperedges in H. Here we think of k and d as fixed constants and all asymptotic forms are with respect to n. By the Lovász Local Lemma, when e(d + 1) ≤ 2k−1, the hypergraph H is two-colorable (e.g. [1]). Following [17], we let m be the total number of vertices in H. Note that m ≤ kn, so m = O(n). For any vertex x ∈ V , we use E(x) to denote the set of hyperedges x belongs to. For any hypergraph H = (V, E), we define a vertex-hyperedge incidence matrix M ∈ {0, 1}m×n so that, for every vertex x and every hyperedge e, Mx,e = 1 if and only if e ∈ E(x). Because we assume both k and d are constants, the incidence matrix M is necessarily very sparse. Therefore, we further assume that the matrix M is implemented via linked lists for each row (that is, vertex x) and each column (that is, hyperedge e). Let G be the dependency graph of the hyperedges in H. That is, the vertices of the undirected graph G are the n hyperedges of H and a hyperedge Ei is connected to another hyperedge Ej in G if Ei ∩ Ej 6= ∅. It is easy to see that if the input hypergraph is given in the above described representation, then we can find all the neighbors of any hyperedge Ei in the dependency graph G (there are at most d of them) in constant time (which depends on k and d). A natural question to ask is: Given a two-colorable hypergraph H, and a vertex v, can we quickly compute the coloring of v? Alon et al. gave ([2]) a polylog(n)-time and space LCA based on Alon's 3-phase parallel hypergraph coloring algorithm ([1]), where the exponent of the logarithm depends on d. We get rid of the dependence on d (in the exponent of the logarithm) using the improved analysis of the query tree in section 3, together with a modified 4-phase coloring algorithm. Our main result in this section is, given a two-colorable hypergraph H whose two- coloring scheme is guaranteed by the Lovász Local Lemma (with slightly weaker pa- rameters), we give a (O(log4 n), O(log4 n), 1/n) - local computation algorithm. We restate our main theorem: Theorem 6. Let H be a k-uniform hypergraph s.t. each hyperedge intersects at most d other hyperedges. Suppose that k ≥ 16 log d + 19. Then there exists an (O(log4 n), O(log4 n), 1/n)-local computation algorithm which, given H and any sequence of queries to the colors of vertices (x1, x2, . . . , xs), with probability at least 1 − 1/n2, returns a consistent coloring for all xi's which agrees with a 2-coloring of H. Moreover, the algorithm is query oblivious and parallelizable. In fact, we only need: k ≥ 3⌈log 16d(d − 1)3(d + 1)⌉ + ⌈log 2e(d + 1)⌉ 20 Throughout the following analysis, we set: k1 = k, and ki = ki−1 − ⌈log 16d(d − 1)3(d + 1)⌉ Notice that the theorem's premise simply implies that 2k4−1 ≥ e(d + 1), as required by the Lovász Local Lemma. A.1 The general phase - random coloring In each phase we begin with subsets Vi and Ei of V and E, such that each edge contains at least ki vertices. We sequentially assign colors at random to the vertices, as long as every monochromatic edge has at least ki+1 uncolored vertices. Once the phase is over we do not change this assignment. If an edge has all of its vertices besides ki+1 colored in one color, it is labeled dangerous. All the uncolored vertices in a dangerous edge are labeled saved and we do not color them in this phase. We proceed until all vertices in Vi are either red, blue, or saved. Let the survived hyperedges be all the edges that do not contain both red and blue vertices. Each survived edge contains some vertices colored in one color, and at least ki+1 saved vertices. Let Si be the set of survived edges after a random coloring in Phase i, and con- sider GSi, the restriction of G to Si The probability that GSi contains a connected component of size d3u at most Vi2−u ([1]). In particular, after repeating the random coloring procedure ti times, there is no connected component of size greater than d3u with probability (cid:0)Vi2−u(cid:1)ti If the query vertex x has been assigned a color in the i-th phase, we can simply return this color. Otherwise, if it is a saved vertex we let Ci(x) be the connected com- ponent containing x in GSi. Finally, since the coloring of Ci(x) is independent of all other uncolored vertices, we can restrict ourselves to Ei+1 = Ci(x) in the next phase. A.2 Phase 1: partial random coloring In the first phase we begin with the whole hypergraph, i.e. V1 = V , E1 = E, and k1 = k. Thus, we cannot even assign a random coloring to all the vertices in sublinear complexity. Instead, similarly to the previous sections, we randomly order the vertices of the hypergraph and use a query tree to randomly assign colors to all the vertices that arrive before x and may influence it. Note that this means that we can randomly assign the colors only once. If x is a saved vertex, we must compute E2 = C1(x), the connected component containing x in GS1. Notice that the size C1(x) is bounded w.h.p. Pr(cid:2)C1(x) > 4d3 log n(cid:3) < n2−4 log n = n−3 In order to compute C1(x), we run BFS on GS1. Whenever we reach a new node, we must first randomly assign colors to the vertices in its query tree, like we did for x's query tree. Since (w.h.p.) there are at most O(log n) edges in C1(x), we query for trees 21 LCA for Hypergraph Coloring Preprocessing: 1. Generate O(log n) independent ensembles, consisting each of O(log n)-wise inde- pendent random variables in {0, 1}m 2. Generate π, a 1 m2 -almost log2 n-wise independent random ordering over [m] Phase 1: Input: a vertex x ∈ V Out¯put¯: a color in {red, blue} 1. Use BFS to find the query tree T rooted at x, based on the ordering π 2. Randomly color the vertices in T according to the order defined by π 3. If x is colored red or blue, return the color 4. Else: (a) Starting from E (x)a run BFS in GS1 b in order to find the connected component E2 = C1(x) of survived hyperedges around x (b) Let V2 be the set of uncolored vertices in E2 Run Phase 2 Coloring(x, E2, V2) a Recall that E (x) is the set of hyperedges containing (x). b S1 denotes the set of survived hyperedges in E. Fig. 1. Local computation algorithm for Hypergraph Coloring vertices. of vertices in at most O(log n) edges. Therefore in total we color at most O(cid:0)log2(n)(cid:1) Finally, since we are only interested in O(cid:0)log2(n)(cid:1) vertices, we may consider a coloring which is only O(cid:0)log2(n)(cid:1)-wise independent, and a random ordering which is only n−3-almost O(cid:0)log2(n)(cid:1)-independent. Given the construction in [2], this can be done in space and time complexity O(cid:0)log4(n)(cid:1) A.3 Phase 2 and 3: gradually decreasing the component size Phase 2 and 3 are simply iterations of the general phase with parameters as described below. With high probability we have that E2 ≤ 4d3 log n, and each edge has k2 uncolored vertices. After at most t2 = log n repetitions of the random coloring proce- dure, we reach an assignment that leaves a size 2d3 log log n-connected component of survived edges with probability (cid:0)(cid:0)4d3k2 log n(cid:1) 2−2 log log n(cid:1)log n < n−3 Similarly, in the third phase we begin with E3 < 2d3 log log n, and after t3 = log n repetitions we reach an assignment that leaves a size log log n -connected component of survived edges with probability k4 (cid:18)(cid:0)2d3k3 log log n(cid:1) 2 − log log n d3 k4 (cid:19)log n < n−3 22 i ∈ 2, 3 Phase i Coloring(x,Ei,Vi) Input: a vertex x ∈ Vi and subsets Ei ⊆ E and Vi ⊆ V Out¯put¯: a ¯color in {red, blue} or FAIL 1. Repeat the following log n times and stop if a good coloring is founda (a) Sequentially try to color every vertex in Vi uniformly at random (b) Explore the dependency graph of GSi (c) Check if the coloring is good 2. If x is colored in the good coloring, return that color Else (a) Compute the connected connected component Ci(x) = Ei+1 and then also Vi+1 (b) Run Phase i + 1 Coloring(x, Ei+1, Vi+1) a Following [17], let Si be the set of survived hyperedges in Ei after all vertices in Vi are either colored or are saved. Now we explore the dependency graph of Si to find out all the connected components. We say a Phase 2 coloring is good if all connected components in GS2 have sizes at most 2d3 log log n. Similarly, we say a Phase 3 coloring is good if all connected components in GS3 have sizes at most log log n . k4 Fig. 2. Local computation algorithm for Hypergraph Coloring: Phase 2 and Phase 3 Phase 4 Coloring(x, E4, V4) Input: a vertex x ∈ V4 and subsets E4 ⊆ E and V4 ⊆ V Out¯put¯: a ¯color in {red, blue} 1. Go over all possible colorings of the connected component V4 and color it using a feasible coloring. 2. Return the color c of x in this coloring. Fig. 3. Local computation algorithm for Hypergraph Coloring: Phase 4 23 A.4 Phase 4: brute force Finally, we are left with a connected component of E4 < log log n , and each edge has k4 uncolored vertices. By the Lovasz Local Lemma, there must exists a coloring (see e.g. Theorem 5.2.1 in [1]). We can easily find this coloring via brute force search in time O(log n). k4 B k-CNF As another application, our hypergraph coloring algorithm can be easily modified to compute a satisfying assignment of a k-CNF formula, provided that the latter satisfies some specific properties. Let H be a k-CNF formula on m Boolean variables x1, . . . , xm. Suppose H has n clauses H = A1 ∧ · · · ∧ An and each clause consists of exactly k distinct literals.13 We say two clauses Ai and Aj intersect with each other if they share some variable (or the negation of that variable). As in the case for hypergraph coloring, k and d are fixed constants and all asymptotics are with respect to the number of clauses n (and hence m, since m ≤ kn). Our main result is the following. Theorem 7. Let H be a k-CNF formula with k ≥ 2. Suppose that each clause inter- sects no more than d other clauses, and furthermore suppose that k ≥ 16 log d + 19. Then there exists a (O(log4 n), O(log4 n), 1/n)-local computation algorithm which, given a formula H and any sequence of queries to the truth assignments of variables (x1, x2, . . . , xs), with probability at least 1 − 1/n2, returns a consistent truth assign- ment for all xi's which agrees with some satisfying assignment of the k-CNF formula H. Moreover, the algorithm is query oblivious and parallelizable. Proof [Sketch]: We follow a 4-phase algorithm similar to that of hypergraph two- coloring as presented in appendix A. In every phase, we sequentially assign random values to a subset of the remaining variables, maintaining a threshold of ki unassigned variables in each unsatisfied clause. Since the same (in fact, slightly stronger) bounds that hold for the connected components in the hyperedges dependency graph also hold for the clauses dependency graph ([17]), we can return an answer which is consistent with a satisfying assignment with probability at least 1 − 1/n2. ⊓⊔ C Lower bound on the size of the query tree We prove a lower bound on the size of the query tree. Theorem 8. Let G be a random graph whose vertex degree is bounded by d ≥ 2 or distributed independently and identically from the binomial distribution: deg(v) ∼ B(n, d/n) (d ≥ 2). Then Pr[T > log n/ log log n] > 1/n, 13 Our algorithm works for the case that each clause has at least k literals; for simplicity, we assume that all clauses have uniform size. 24 where the probability is taken over all random permutations π ∈ Π of the vertices, and T is the largest query tree in G (under π). Proof. For both the bounded degree and the binomial distribution cases, there exists a path of length at least k = log n/ log log n in the graph w.h.p. Label the vertices on the path v1, v2, . . . , vk. There are k! possible permutations of the weights of the vertices on the path. The probability of choosing the permutation in which w(v1) < w(v2) < . . . < (vk) is 1/k!. k! = (log n/ log log n)! < (log n/ log log n)log n/ log log n < n. Therefore, 1/k! > 1/n and so the probability of the query tree having size log n/ log log n is at least 1/n. ⊓⊔
1811.10767
1
1811
2018-11-27T01:52:13
The Batched Set Cover Problem
[ "cs.DS" ]
We introduce the batched set cover problem, which is a generalization of the online set cover problem. In this problem, the elements of the ground set that need to be covered arrive in batches. Our main technical contribution is a tight $\Omega(H_{m - 2^z + 1})$ lower bound on the competitive ratio of any fractional batched algorithm given an adversary that is required to produce batches of VC-dimension at least $z$, for some $z \in \mathbb{N}^0$. This restriction on the adversary is motivated by the fact that, in some real world applications, decisions are made after collecting batches of data of non-trivial VC-dimension. In particular, ridesharing systems rely on the batch assignment of trip requests to vehicles, and some related problems such as that of optimal congregation points for passenger pickups and dropoffs can be modeled as a batched set cover problem with VC-dimension greater than or equal to two. Furthermore, we note that while any online algorithm may be used to solve the batched set cover problem by artificially sequencing the elements in a batch, this procedure may neglect the rich information encoded in the complex interactions between the elements of a batch and the sets that contain them. Therefore, we propose a minor modification to an online algorithm found in [8] to obtain an algorithm that attempts to exploit such information. Unfortunately, we are unable to improve its analysis in a way that reflects this intuition. However, we present computational experiments that provide empirical evidence of a constant factor improvement in the competitive ratio. To the best of our knowledge, we are the first to use the VC-dimension in the context of online (batched) covering problems.
cs.DS
cs
The Batched Set Cover Problem Juan C. Mart´ınez Mori1 and Samitha Samaranayake2 1 Systems, Cornell University [email protected] 2 School of Civil and Environmental Engineering, Cornell University [email protected] Abstract. We introduce the batched set cover problem, which is a gen- eralization of the online set cover problem. In this problem, the elements of the ground set that need to be covered arrive in batches. Our main technical contribution is a tight Ω(Hm−2z +1) lower bound on the com- petitive ratio of any fractional batched algorithm given an adversary that is required to produce batches of VC-dimension at least z, for some z ∈ N0. This restriction on the adversary is motivated by the fact that, in some real world applications, decisions are made after collecting batches of data of non-trivial VC-dimension. In particular, ridesharing systems rely on the batch assignment of trip requests to vehicles, and some re- lated problems such as that of optimal congregation points for passenger pickups and dropoffs can be modeled as a batched set cover problem with VC-dimension greater than or equal to two. Furthermore, we note that while any online algorithm may be used to solve the batched set cover problem by artificially sequencing the elements in a batch, this procedure may neglect the rich information encoded in the complex interactions be- tween the elements of a batch and the sets that contain them. Therefore, we propose a minor modification to an online algorithm found in [8] to obtain an algorithm that attempts to exploit such information. Unfortu- nately, we are unable to improve its analysis in a way that reflects this intuition. However, we present computational experiments that provide empirical evidence of a constant factor improvement in the competitive ratio. To the best of our knowledge, we are the first to use the VC- dimension in the context of online (batched) covering problems. Keywords: set cover · batched · online · primal-dual · VC-dimension · ridesharing 1 Introduction 1.1 Background Let X = {1,··· , n} be a ground set of n elements and S = {S1,··· , Sm} be a collection of m subsets of X. A set cover is a sub-collection of S such that its union is X. The set cover problem is to find a minimum cardinality set cover of X. It is a classic NP-hard problem that is also hard to approximate to within a factor of (1 − α) ln n in polynomial time for any α > 0 [11,9]. 2 Mart´ınez Mori, J. C. and Samaranayake, S. In the online setting [2,7,8], the members of S are identified a priori, but the elements of the ground set that need to be covered, along with their respective set membership, are revealed sequentially. More precisely, the online set cover problem consists of a game between an algorithm and an oblivious adversary; one which knows the algorithm but not the realization of any random choices3. The adversary produces, in advance, a sequence σ = σ1, σ2,··· of elements of X, which it reveals to the algorithm one at a time. Upon the arrival of an element, the algorithm must either conclude that the element is already in the set cover, or irrevocably extend the set cover with a member of S containing the element. Alon et al. [2] gave a deterministic O(log m log n)-competitive algorithm for the online set cover problem and a nearly matching lower bound for any online algorithm. Buchbinder and Naor [7,8] later proposed a general scheme for the design and analysis of online algorithms, namely the primal-dual method4, and used it to obtain new algorithms for the online set cover problem. Their algo- rithms generally consist of two phases: i ) a deterministic O(log m) primal-dual subroutine for the fractional online set cover problem, which is optimal up to constant terms, and ii ) a randomized rounding procedure whose expected cost is O(log n) times the cost of the fractional solution, ultimately producing ran- domized O(log m log n)-competitive algorithms. The rounding procedure can be derandomized, producing deterministic O(log m log n)-competitive algorithms. 1.2 Contributions Herein we introduce the batched set cover problem, which is a generalization of the online set cover problem. However, as in [7,8], our focus is on its fractional counterpart; this corresponds to phase i ) of the primal-dual scheme. We im- mediately recover the integral case through the rounding procedures in phase ii ), which we leave untouched. In essence, the batched set cover problem differs from the online set cover problem in that the adversary produces a sequence of batches of elements of X. Thus, the online set cover problem is a special case of the batched set cover problem in which each element revealed by the adversary is its own batch. Note that the problem we consider is distinct from the capacitated online set cover problem with set requests treated by Bhawalkar et al. [5]. They argue that the uncapacitated problem is not meaningful because the elements in a batch can be thought of as arriving sequentially, whereas we argue that this is not always the case. Our main technical contribution is a tight lower bound on the compet- itive ratio of any fractional batched algorithm given a parametrized restriction on the adversary. Specifically, if we consider adversaries that are required to pro- duce batches of Vapnik Chervonenkis (VC)-dimension [12] at least z, for some z ∈ N0, any fractional batched algorithm is Ω(Hm−2z+1)-competitive. For z > 0, this bound is more generous (to the algorithm) than the Ω(Hm) bound of the online setting [7,8], which we recover when z = 0. 3 If the algorithm is deterministic, an oblivious adversary is equivalent to an adaptive adversary; one which makes requests adaptively in response to the algorithm [4]. 4 This scheme first appeared in the context of approximation algorithms [15]. The Batched Set Cover Problem 3 In addition, we propose a minor modification to an online algorithm found in [8] to obtain a dedicated batched algorithm. The main idea is the simultaneous update of the dual variables that correspond to unsatisfied primal constraints, which is reminiscent of a primal-dual algorithm in [14] for the generalized Steiner tree problem. Unfortunately, we are unable to analyze this algorithm in a way that exhibits the effects of the more generous (parametrized) bound. Alterna- tively, we provide computational results that suggest that while the greedy strat- egy proposed in [5] is inoffensive for the worst case instance given 0 ≤ z ≤ 1, it compromises on the competitive ratio obtained on the worst case instance given z > 1. Our experiments suggest that proposed algorithm improves on the competitive ratio obtained by the greedy strategy by some constant factor. The significance of this problem stems from the fact that, in some real-world applications, decisions are made after collecting a batch of data. Moreover, in many of these applications, batches of data are rarely produced by an absolute worst case adversary. The intent of our restricted adversarial model is to mimic the worst case instances that may effectively arise in the real world. For example, high-capacity ridesharing systems rely on the batch assignment of trip requests to vehicles [3], and some related problems such as that of optimal congregation points for passenger pickups and dropoffs can be modeled as a batched set cover problem. Intuitively, sequencing a batch of travel requests defeats the purpose of preparing the batch in the first place. Moreover, the batches that arise in this setting tend to have a VC-dimension greater than or equal to two, as the application revolves around exploiting the overlaps between distinct requests (see Section 2). Our results formalize this intuition. As listed in [5], further examples of applications of the batched set cover problem may be found in distributed computing, facility planning, and subscription markets. To the best of our knowledge, we are the first to use the VC-dimension in the context of online (batched) covering problems. The VC-dimension has been used successfully in the context of approximation algorithms for (offline) set cover problems [6,10], as well as in the context of improved running time bounds for unconstrained [1] and constrained [13] shortest path algorithms. In both of these settings, the algorithms exploit the low VC-dimension of the set systems on which they operate. Perhaps surprisingly, algorithms for the batched set cover problem may instead exploit the high VC-dimension of the set systems on which they operate, which we model as a restriction on the adversary. Intuitively, the reason is that the adversary is forced to reveal complex, intertwined batches. A dedicated algorithm attempts to exploit the richness of the information re- vealed, while a greedy algorithm is myopic to the interactions between the set memberships of the elements in a batch. 1.3 Organization In Section 2 we formally introduce our problems and definitions. In Section 3 we consider bounds for the online fractional set cover problem. We present a known lower bound of Ω(Hm) on the competitive ratio of any online algorithm. While the tightness of this lower bound (up to constants) follows immediately from 4 Mart´ınez Mori, J. C. and Samaranayake, S. the existence of O(Hm)-competitive fractional algorithms [7,8], we present an inductive proof that shows the tightness of the lower bound without the explicit need of a competitive algorithm. This technique is used in Section 4 to show the tightness of a Ω(Hm−2z+1) lower bound on the competitive ratio of any batched algorithm, given our restricted adversary parametrized by z. The reason for doing this is our argument that batching may offer a constant factor improvement in the competitive ratio. Hence, tightness up to constants is not informative enough for our purposes. In Section 5 we formalize the greedy strategy suggested in [5] and present our minor modification to an online algorithm found in [8]. We also present the results of our computational experiments. 2 Preliminaries Let xj ∈ {0, 1} be set to 1 if Sj is brought to the set cover and to 0 otherwise. Now, consider LP 1, which describes the linear programming relaxation of the offline set cover problem. We refer to LP 1 as the primal covering problem. Here, cj > 0 refers to the cost of bringing some set Sj ∈ S to the set cover, and the objective is to minimize the total cost incurred. In the unweighted case, cj = 1 for all j = 1,··· , m. Constraints (1.1) ensure that every element i = 1,··· , n in the ground set X is covered. Note that the set membership information of each element is encoded in its respective constraint. minimize s.t. (1.1) (cid:80) j:i∈Sj xj ≥ 1, i = 1,··· , n xj ≥ 0, j = 1,··· , m (LP 1) The primal covering problem has an associated dual packing problem, described in LP 2. We refer to this primal-dual formulation throughout this work. We will refer to the collection of sets in S that individually contain σi ∈ X by S(σi). m(cid:80) j=1 cjxj n(cid:80) i=1 yi maximize s.t. (2.1) (cid:80) i∈Sj yi ≤ cj, j = 1,··· , m yi ≥ 0, i = 1,··· , n (LP 2) In the fractional online setting [7,8], the objective function of LP 1 is known a priori, but constraints (1.1) are revealed one by one. This corresponds to the algorithm identifying the costs of the sets in S a priori, but the adversary revealing a sequence σ = σ1, σ2,··· of elements of X, along with their respective set membership, in an online fashion. Equivalently, the right hand side of the constraints (2.1) of LP 2 are known a priori, but the variables involved in them and in the objective function are revealed one by one. The Batched Set Cover Problem 5 Now, consider the following batched version of the set cover problem, which is also a game between an algorithm and an oblivious adversary. In the batched set cover problem, S is identified a priori, but the adversary produces a sequence β = β1, β2,··· of batches of elements of X, which it reveals one batch at a time. For instance, βk = {σk,1,··· , σk,βk} ⊆ X, where βk denotes the size of the kth batch. When a batch arrives, all of its elements, along with their respective set membership information, are revealed simultaneously. The fractional batched setting is analogous to the fractional online setting, except constraints (1.1) appear in tandem. Equivalently, the variables involved in the objective function and constraints (2.1) are revealed in tandem. Note that the online setting is trivially recovered when each batch is a singleton. We refer to the union of sets in S that individually cover the elements in βk = {σk,1,··· , σk,βk}, namely S(σk,1) ∪ ··· ∪ S(σk,βk), by S(βk). We define an instance I of the online set cover problem as a collection S together with the adversarial sequence. We introduce the following performance measures. The batched setting for both of these measures is analogous. Definition 1. An online algorithm ALGO is said to be c-competitive if for every instance I of the problem it outputs a solution of cost at most c · OPT(I), where OPT(I) is the cost of the optimal offline solution. Definition 2. An online adversary ADVO is said to be c-advantaged if it pro- duces an instance I such that every online algorithm ALGO outputs a solution of cost at least c· OPT(I), where OPT(I) is the cost of the optimal offline solution. Our analysis in Section 4 relies on imposing a minimum on the VC-dimension of any batch βk produced by the adversary. The VC-dimension was first proposed by Vapnik and Chernovekis [12], and it is a widely used measure of complexity in computational learning theory. We work with the following definitions. Definition 3 (Set System). A set system (X,S) is a ground set X together with a collection S of subsets of X. Definition 4 (Shattering). A subset B ⊆ X is said to be shattered by S if {S ∩ B : S ∈ S} = P(B), where P(B) is the power set of B. Definition 5 (VC-dimension). The VC-dimension of a set system (X,S) is the cardinality of the largest subset B ⊆ X to be shattered by S. We denote it by VCD(X,S). In particular, upon the arrival of a batch βk we obtain a set system (βk,S), where S is known a priori. Moreover, note that i ) restricting the adversary to produce batches βk with VC-dimension VCD(βk,S) ≥ z is only meaningful when m = S ≥ 2z; otherwise the adversary is unable to produce any batches, and ii ) by definition, any batch satisfying VCD(βk,S) ≥ z also satisfies βk ≥ z. This is illustrated in Figure 1, which showcases how a batch βk satisfying VCD(βk,S) ≥ z can be constructed with m = 2z and βk = z. Observe that in each of the cases, βk is shattered since each of its subsets is the intersection of βk with some 6 Mart´ınez Mori, J. C. and Samaranayake, S. S ∈ S. Of course, given z, there may be instances for which m > 2z, or for which the adversary produces batches satisfying βk > z, or both. We consider these cases in our analysis in Section 4. (a) VCD(βk,S) ≥ 0. (b) VCD(βk,S) ≥ 1. (c) VCD(βk,S) ≥ 2. (d) VCD(βk,S) ≥ 3. Fig. 1: Construction of S and βk satisfying VCD(βk,S) ≥ z, for z = 0, 1, 2, 3, with the minimum possible cardinality requirements on m = S and βk. The construction for z > 3 is analogous. The nodes labeled S1,··· , Sm represent the sets in S, whereas the circles around them represent the elements of βk ⊆ X they contain (i.e., constraints in LP 1). In a ridesharing context, we may interpret each S ∈ S as a possible congre- gation point (e.g., an intersection in a street network), whereas each constraint corresponds to the set of compatible congregation points (e.g., within walking distance) for each trip origin or destination. Note that the only reasons why we would have VCD(βk,S) ≤ 1 are if i ) βk ≤ 1, or ii ) βk > 1 but all the travel request form either a collection of proper subsets or a collection completely disjoint subsets of the possible congregation points. Given sufficiently high and heterogeneous demand, batches with VCD(βk,S) ≤ 1 are unlikely to arise; the batches that arise look more like the those in Figure 1 (c) and (d). S1S2S1S3S2S4S1S8S6S5S7S2S3S4S1 The Batched Set Cover Problem 7 3 Fractional Online Set Cover Lemma 1 (Variation of Buchbinder and Naor [8]). There exists an in- stance I∗ of the unweighted fractional online set cover problem such that any online algorithm is Ω (Hm)-competitive on this instance. Sj∈S (cid:84) Sj. Upon the arrival of σ1, ALGO must satisfy(cid:80) Proof. Consider the following instance I∗, which is particular to the sequence σ produced by an adversary in response to an arbitrary online algorithm ALGO. Let σ1 ∈ j:σ1∈Sj xj ≥ 1. Thus, it must let xj ≥ 1/m for at least one Sj ∈ S. Refer to such Sj ∈ S as S1 and to its corresponding variable as x1. Now, let σ2 ∈ Sj∈S\S1 Sj. Upon the arrival j:σ2∈Sj xj ≥ 1. Thus, it must let xj ≥ 1/(m − 1) for at least one Sj ∈ S \ S1. Again, refer to such Sj ∈ S \ S1 as S2 and to its corresponding variable as x2. In general, an adversary may continue revealing elements σi satisfying of σ2, ALGO must satisfy (cid:80) (cid:84) (cid:92) (cid:83) σi ∈ Sj∈S\ i(cid:48)<i Si(cid:48) Sj, (cid:83) (cid:83) (cid:48) (cid:48) i(cid:48)<i Si i(cid:48)<i Si forcing the algorithm to let xj ≥ 1/(m− i + 1) for at least one Sj ∈ S \ . as Si and to its corresponding variable as Refer to such Sj ∈ S \ xi. After m steps, the total cost ALGO(I∗) incurred by the algorithm, namely x1 + ··· + xm, is at least 1 m + 1 = Hm. + ··· + 1 2 + 1 m − 1 Meanwhile, the total cost OP T (I∗) incurred by an optimal offline solution is 1, which corresponds to simply letting xm = 1. Thus, Hm ≤ ALGO(I ∗) OP T (I∗) . Note that I∗ depends on ALGO only in the sense that the particular adver- sarial sequence σ produced is a response to the particular algorithm; the lower bound on the competitive factor, on the other hand, is independent of the al- gorithm. Thus, we may parametrize the instance I∗ in Lemma 1 by m = S to obtain the instance class I∗(m). In other words, I∗(m) refers to the instances that produce a lower bound of Hm on the competitive factor of any online algo- rithm as a result of the adversary following the strategy in the proof of Lemma 1. If we vary m, we obtain the family of instance classes I∗ = {I∗(m) : m ∈ Z+}. The tightness of this lower bound (up to constants) is an immediate result of the existence of O(log m)-competitive algorithms for the fractional online set cover problem [7,8]. In Lemma 3 we present a different approach to show that this lower bound is tight, this time without relying on a particular algorithm. We use Lemma 2, whose proof is in the Appendix. Lemma 2. Hr > 1 2 (Hr−t + Ht) for any integers r ≥ t ≥ 0. 8 Mart´ınez Mori, J. C. and Samaranayake, S. Lemma 3. There exists an online algorithm ALGO for the unweighted frac- tional online set cover problem such that any adversary is O(Hm)-advantaged. In particular, this bound is matched by any adversary that follows the strategy in the family of instance classes I∗, described in the proof of Lemma 1. Proof. By Lemma 1, there exists an adversary that is Hm-advantaged, namely one that follows the strategy of instance class I∗(m). We need to show that this is indeed the best an adversary can be guaranteed to achieve. We prove this by strong induction on m and by focusing on an arbitrary adversary ADVO. We will make use of the existence of a randomized algorithm ALGO that, in principle, produces specific outcomes with non-zero probability. Base Case (m = 1): When ADVO reveals any element σ1, it must be the case that σ1 ∈ S1. Then, ALGO must let x1 = 1, achieving a competitive factor of H1, as in I∗(1) Inductive Step: Assume, by way of strong induction, than the statement is true for m = 2,··· , w. We need to show that the statement is true for m = w + 1. By Lemma 1, there exists an adversary that is Hw+1-advantaged, namely one that follows the strategy of instance class I∗(w + 1). Now, consider the case in which ADVO deviates from the strategy of I∗(w + 1) on some arbitrary step i. Let σi∗ be the ith element according to the strategy of I∗(w + 1). If ADVO reveals an element σi such that S(σi) ∩ S(σi∗ ) is empty, the cost of the optimal solution increases by 1, which by Lemma 2 irrevocably decreases the advantage of ADVO. Therefore, suppose that ADVO reveals an element σi such that S(σi) ∩ S(σi∗ ) is non-empty. Then, with non-zero probability ALGO disregards all Sj ∈ S(σi) \ S(σi∗ ), if any, making such deviation futile. Thus, safely assume that ADVO instead reveals an element σi such that S(σi) ⊂ S(σi∗ ). Let t = S(σi), r = S(σi∗ ), and note that r > t. Let i(cid:48) > i be the first step after step i such that S(σi) ∩ S(σi(cid:48)) (cid:54)= ∅. As before, with non-zero probability ALGO disregards all Sj ∈ S(σi(cid:48)) \ S(σi), if any, so safely assume that ADVO reveals an element σi(cid:48) such that S(σi(cid:48)) ⊂ S(σi). Then, by the inductive hypothesis, given that element σi satisfied S(σi) ⊂ S(σi∗ ), the best ADVO can do is to recreate I∗(t) on the remainder of the steps, starting with i(cid:48). In particular, the best ADVO can do is to reveal an element σi(cid:48) such that S(σi(cid:48)) ⊂ S(σi) and S(σi(cid:48)) + 1 = S(σi). A symmetric argument can be made about concurrently recreating I∗(r − t) on the remainder of the steps, which is disjoint from I∗(t) after the ith step and hence increases the offline solution by one. However, by Lemma 2, this achieves a strictly lower competitive advantage for ADVO. 4 Fractional Batched Set Cover 4.1 General Case Lemma 4. There exists an instance I∗ of the unweighted fractional batched set cover problem such that any batched algorithm is Ω (Hm)-competitive on this instance. The Batched Set Cover Problem 9 Lemma 5. There exists a batched algorithm ALGB for the unweighted fractional batched set cover problem such that any adversary is O(Hm)-advantaged. Lemma 4 follows from the fact that the fractional online set cover problem is a special case of the fractional batched set cover problem, together with Lemma 1. In Section 4.2 we consider the case in which the adversary is imposed a mini- mum VC-dimension for any batch βk produced. In the proof of Lemma 7, we mention why an adversary never benefits from producing batches with a VC- dimension larger than the minimum required. This, together with Lemma 3, yields Lemma 5. 4.2 Restricted Adversary Our intent now is to characterize instance classes that distinguish the fractional batched set cover problem from the fractional online set cover problem. In partic- ular, we restrict the adversary in that it is forced to produce batches βk satisfying VCD(βk,S) ≥ z, for some z ∈ N0. Given z, we assume that m = S ≥ 2z and βk ≥ z, as described in Section 2. Lemma 6. There exists an instance I∗z of the unweighted fractional batched set cover problem, with an adversary satisfying VCD(βk,S) ≥ z for any batch βk, such that any batched algorithm is Ω (Hm−2z+1)-competitive on this instance. Proof. This proof is analogous to that of Lemma 1. Consider the following in- stance I∗z , which is particular to the sequence β produced by an adversary sat- isfying VCD(βk,S) ≥ z for any batch βk, in response to an arbitrary batched algorithm ALGB. In the following, our ordering of S1,··· , Sm ∈ S is arbitrary. Let β1 = {σ1,1,··· , σ1,z, σ1,z+1} such that S({σ1,1,··· , σ1,z}) is as in the diagrams in Figure 1 on sets S1,··· , S2z−1, S2z with β1∩S2z = β1, in addition to each σ1,q ∈ β1 being also contained in each Sj ∈ {S2z , S2z+1,··· , Sm}. This last property cannot decrease the VC-dimension, so β1 is a valid batch. Then, because of the constraint corresponding to σ1,z+1 ∈ β1, ALGB must let xj ≥ m−2z+1 for at least one Sj ∈ {S2z ,··· , Sm}. For clarity and without loss of generality, assume such Sj is S2z . Then, let β2 = {σ2,1,··· , σ2,z, σ2,z+1} such that S({σ2,1,··· , σ2,z}) is as in the diagrams in Figure 1 on sets S2,··· , S2z , S2z+1 with β2 ∩ S2z+1 = β2, in addition to each σ2,q ∈ β2 being also contained in each Sj ∈ {S2z+1,··· , Sm}. Then, because of the constraint corresponding to σ2,z+1 ∈ β2, ALGB must let m−2z−1+1 for at least one Sj ∈ {S2z+1,··· , Sm}. For clarity and without xj ≥ loss of generality, assume such Sj is S2z+1. In general, an adversary may continue revealing βk = {σk,1,··· , σk,z, σk,z+1} such that S({σk,1,··· , σk,z}) is as in the diagrams in Figure 1 on sets Sk,··· , S2z+k−2, S2z+k−1 with βk ∩ S2z+k−1 = βk, in addition to each σk,q ∈ βk being also contained in each Sj ∈ {S2z+k−1,··· , Sm}. Then, because of the constraint corresponding to σk,z+1 ∈ βk, ALGB must let xj ≥ m−2z−(k−1)+1 for at least one Sj ∈ {S2z+k−1,··· , Sm}. For clarity and without loss of generality, assume such Sj is S2z+k−1. 1 1 1 10 Mart´ınez Mori, J. C. and Samaranayake, S. After the m− 2z + 1 possible steps, the total cost ALGB(I∗z ) incurred by the algorithm, namely x2z + ··· + xm, is at least Hm−2z+1 = 1 m − 2z + 1 + 1 m − 2z + ··· + 1 2 + 1. Meanwhile, the total cost OP T (I∗z ) incurred by an optimal offline solution is 1, ∗ which corresponds to simply letting xm−2z+1 = 1. Thus, Hm−2z+1 ≤ ALGO(I z ) z ) . OP T (I∗ In simple terms, the adversary may capitalize on Sj ∈ {S2z ,··· , Sm} while assuming a sunk cost on Sj ∈ {S1,··· , S2z−1}. As in Section 3, we parametrize the instances I∗z in Lemma 6 by m. Thus, given z, we obtain the family of instance classes I∗z = {I∗z (m) : m ∈ Z+}. We recover the general case when z = 0. Analogous to Lemma 3, Lemma 7 shows the lower bound given z is tight. Its proof can be found in the Appendix. Lemma 7. There exists a batched algorithm ALGB for the unweighted fractional online set cover problem such that any adversary satisfying VCD(βk,S) ≥ z for any batch βk is O (Hm−2z+1)-advantaged. In particular, this bound is matched by any adversary that follows the strategy in the family of instance classes I∗z , described in the proof of Lemma 6. 5 Batched Algorithms 5.1 Analysis Note that since any batch βk could be artificially decomposed into a sequence of βk elements that are 'revealed' one at a time, any competitive algorithm for online set cover would produce a competitive feasible solution; we refer to this as the 'trivial' approach. More precisely, the trivial approach consists of two phases: i ) some (possibly randomized) subroutine that executes a mapping f : ), where σk,q(cid:48) is the q(cid:48)th element of the artificial sequence, βk → (σk,1(cid:48),··· , σk,b(cid:48) followed by ii ) any competitive algorithm for the online set cover problem. k An example of such approach is the O(log m)-competitive primal-dual sub- routine in Algorithm 1, which we refer to as ALGB,T , followed by any O(log n) rounding technique (i.e., the second phase of the primal-dual method). ALGB,T is a minor modification of the O(log m)-competitive Algorithm 2 in Section 4.2 of [8] for the batched setting. Note that d = maxk,q S(σk,q) ≤ m. Its correctness follows immediately from Theorem 4.2 of [8]. For conciseness, we only mention that the proof relies on showing three claims together with weak duality: i ) the algorithm produces a primal feasible solution to LP 1, ii ) the algorithm produces a dual feasible solution to LP 2, and iii ) the objective value of LP 1 is bounded above by O(log m) times the objective value of LP 2. Clearly, the complete algorithm is O(log m log n)-competitive. Nevertheless, unless βk = 1 for all k, the trivial approach may fail to leverage the rich information that is possibly implicit in the fact that all elements of a The Batched Set Cover Problem 11 Algorithm 1: ALGB,T : 'Trivial' batched algorithm. /* Upon the arrival of batch k := {σk,1,··· , σk,βk}: 1 for σk,q ∈ f ({σk,1,··· ,βk}) do */ j:σk,q∈Sj while (cid:80) exp xj ← 1 d xj < 1 do  ln (1+d) cj Increase yk,q continuously (cid:80) 2 3 4  − 1  ,∀j : σk,q ∈ Sj yk(cid:48),q(cid:48) k(cid:48),q(cid:48): σk(cid:48) ,q(cid:48)∈Sj end 5 6 end given batch are revealed simultaneously. We refer to an algorithm that attempts to leverage any such information as a 'dedicated' algorithm. We obtain such an algorithm if we replace ALGB,T with Algorithm 2, which we refer to as ALGB,D. Algorithm 2: ALGB,D: 'Dedicated' batched algorithm. /* Upon the arrival of batch k := {σk,1,··· , σk,βk}: 1 while ∃σk,q such that (cid:80)  ln (1+d) Increase yk,q continuously, ∀q : (cid:80)  − 1  ,∀j : ∃σk,q ∈ Sj exp xj ← 1 xj < 1 do j:σk,q∈Sj j:σk,q∈Sj (cid:80) xj < 1 yk(cid:48),q(cid:48) d cj 2 3 k(cid:48),q(cid:48): σk(cid:48) ,q(cid:48)∈Sj */ 4 end Note the difference in how the dual variables are updated: sequentially in ALGB,T and simultaneously in ALGB,D. This is reminiscent of the approach of increasing multiple variables at once in a primal-dual algorithm by [14] for the generalized Steiner tree problem. As expected, ALGB,D is also O(log m)- competitive5; it is also a minor modification of the O(log m)-competitive Algo- rithm 2 in Section 4.2 of [8], and its correctness also follows immediately from Theorem 4.2 of [8]. Unfortunately, we are unable to improve its analysis in a way that reflects the intuition that batching should improve the competitive factor obtained under certain conditions. For example, we expect batching to help in the families of instances I∗z , shown in Section 4 to produce a more generous lower bound on the competitive factor of any algorithm due to the VC-dimension re- quirement on the batches produced by the adversary. We leave presenting such 5 To be precise, both algorithms are 2 ln(1 + d)-competitive. 12 Mart´ınez Mori, J. C. and Samaranayake, S. an analysis as an open problem. As an alternative, in Section 5.2 we present the results of computational experiments that compare the performance (i.e., competitive factor) of ALGB,T and ALGB,D on instances of I∗z . 5.2 Computational Experiments Figure 2 (a) and (b) present the results of computational experiments that compare the worst-case performance (i.e., competitive factor) of ALGB,T and ALGB,D obtained on instances of I∗z , respectively, for various values of z and m. We discretize both algorithms with a step size of  = 0.001. We justify the use of instances of I∗z by the fact that it is not some arbitrary family of instance classes; Lemma 6 ans Lemma 7 imply it produces tight bounds. Also, note that because of the symmetric nature of the batches βk that arise in I∗z , the partic- ular order produced by the mapping f : βk → (σk,1(cid:48),··· , σk,βk(cid:48)) in ALGB,T is irrelevant for evaluating the worst-case performance of the trivial approach so long as σk,z+1 is the last element 'revealed'. This notion does not translate to ALGB,D, since the dual variable updates occur simultaneously. Also, recall that for instances in Iz the optimal offline solution is one. (a) ALGB,T . (b) ALGB,D. Fig. 2: Competitive ratio of (a) ALGB,T and (b) ALGB,D obtained on instances of I∗z for z = 0, 1, 2, 3, 4. The solid line indicates to the competitive ratio obtained by the algorithm, while the dashed line indicates the Ω(Hm−2z+1) lower bound on the competitive ratio of any batched algorithm. Note that for z = 0, 1, both algorithms match the theoretical lower bound. This is expected, as in both of these cases, per the description of I∗z , all the batches are singletons. On the other hand, for z > 1, neither of the algorithms match said lower bound. However, it can be observed that ALGB,D is closer than ALGB,T to the theoretical lower bound on the competitive ratio; this is not surprising as the algorithm has only be shown to be optimal up to constants. The 0102030405060m=S1.01.52.02.53.03.54.04.55.0ALGB,T(I∗z)/OPT(I∗z)z≥0z≥1z≥2z≥3z≥4z≥50102030405060m=S1.01.52.02.53.03.54.04.55.0ALGB,D(I∗z)/OPT(I∗z)z≥0z≥1z≥2z≥3z≥4z≥5 The Batched Set Cover Problem 13 improvement is more significant as z increases, though it is only by a constant factor; both curves remain logarithmic. These results provide empirical evidence of the benefits of batching when the VC-dimension is high. Acknowledgements The first author was funded through the Center for Transportation, Environ- ment, and Community Health (CTECH) as well as a Federal Highway Admin- istration (FHWA) Dwight David Eisenhower Transportation Fellowship. 14 Mart´ınez Mori, J. C. and Samaranayake, S. References 1. Abraham, I., Delling, D., Fiat, A., Goldberg, A.V., Werneck, R.F.: Vc-dimension and shortest path algorithms. In: International Colloquium on Automata, Lan- guages, and Programming. pp. 690 -- 699. Springer (2011) 2. Alon, N., Awerbuch, B., Azar, Y.: The online set cover problem. In: Proceedings of the 35th annual ACM Symposium on the Theory of Computation. pp. 100 -- 105 (2003) 3. Alonso-Mora, J., Samaranayake, S., Wallar, A., Frazzoli, E., Rus, D.: On- demand high-capacity ride-sharing via dynamic trip-vehicle assignment. Pro- ceedings of the National Academy of Sciences 114(3), 462 -- 467 (2017). https://doi.org/10.1073/pnas.1611675114 4. Ben-David, S., Borodin, A., Karp, R., Tardos, G., Wigderson, A.: On the power of randomization in on-line algorithms. Algorithmica 11(1), 2 -- 14 (1994) 5. Bhawalkar, K., Gollapudi, S., Panigrahi, D.: Online set In: LIPIcs-Leibniz International Proceedings requests. vol. set ics. https://doi.org/10.4230/LIPIcs.APPROX-RANDOM.2014.64 28. Schloss Dagstuhl-Leibniz-Zentrum fuer cover with in Informat- (2014). Informatik 6. Bronnimann, H., Goodrich, M.T.: Almost optimal set covers in finite vc-dimension. Discrete & Computational Geometry 14(4), 463 -- 479 (1995) 7. Buchbinder, N., Naor, J.: Online primal-dual algorithms for covering and packing problems. In: Proceedings of the 13th Annual European Symposium on Algorithms. pp. 689 -- 701 (2005) 8. Buchbinder, N., Naor, J.: The design of competitive online algorithms via a primal- dual approach. Foundations and Trends in Theoretical Computer Science 3(2-3), 93 -- 263 (2009). https://doi.org/10.1561/0400000024 9. Dinur, I., Steurer, D.: Analytical approach to parallel repetition. In: Proceedings of the Forty-sixth Annual ACM Symposium on Theory of Computing. pp. 624 -- 633. STOC '14, ACM (2014). https://doi.org/10.1145/2591796.2591884 10. Even, G., Rawitz, D., Shahar, S.M.: Hitting sets when the vc-dimension is small. Information Processing Letters 95(2), 358 -- 362 (2005) 11. Feige, U.: A threshold of ln n for approximating set cover. Journal of the ACM 45(4), 634 -- 652 (1998). https://doi.org/10.1145/285055.285059 12. Vapnik, V.N., Chervonenkis, A.Y.: On the uniform convergence of relative frequen- cies of events to their probabilities. In: Measures of complexity, pp. 11 -- 30. Springer (2015) 13. Vera, A., Banerjee, S., Samaranayake, S.: Computing constrained shortest-paths at scale (2017) 14. Williamson, D.P., Goemans, M.X., Mihail, M., Vazirani, V.V.: A primal-dual ap- proximation algorithm for generalized steiner network problems. Combinatorica 15(3), 435 -- 454 (1995). https://doi.org/10.1007/BF01299747 15. Williamson, D.P., Shmoys, D.B.: The Design of Approximation Algorithms. Cam- bridge University Press, New York, NY, USA, 1st edn. (2011) The Batched Set Cover Problem 15 Appendix 5.3 Proof of Lemma 2. Proof. Assume, without loss of generality, that r − t ≥ t. Note that Hr = 1 r + 1 r − 1 + ··· + 1 t + 1 + Ht. Likewise, note that 1 2 (Hr−t + Ht) = = = 1 2 1 2 1 2 (cid:18) 1 (cid:18) 1 (cid:18) 1 r − t r − t r − t + + + 1 r − t − 1 1 r − t − 1 1 r − t − 1 Clearly, 1 r + 1 r − 1 + ··· + 1 t + 1 > 1 2 so the proof is complete. 5.4 Proof of Lemma 7. (cid:18) 1 (cid:19) + 1 1 t − 1 1 t − 1 1 + ··· + 2 1 2 + ··· + + 1 + ··· + + 1 + + 1 t 1 2 1 (cid:19) (cid:19) + ··· + ··· t + 1 1 t + 1 + 1 t + + Ht. (cid:19) , + 1 r − t − 1 + ··· 1 t + 1 r − t Proof. This proof is analogous to that of Lemma 3. By Lemma 7, there exists an adversary satisfying VCD(βk,S) ≥ z for any batch βk that is Hm−2z+1- advantaged, namely one that follows the strategy of instance class I∗z (m). We need to show that this is indeed the best an adversary can be guaranteed to achieve. We prove this by strong induction on m and by focusing on an arbitrary batched adversary ADVB. We will make use of the existence of a randomized algorithm ALGB that, in principle, produces specific outcomes with non-zero probability. the adversary cannot produce any batches. Base Case (1 ≤ m < 2z). If m < 2z, the statement is vacously true because Base Case (m = 2z). When ADVB reveals any batch β1 = {σ1,1,··· , σ1,z}, it must be the case that S(β1) is as in the diagrams in Figure 1 on sets S1,··· , Sm=2z . Then, with non-zero probability, ALGB disregards any Sj /∈ {Sm}. In such case, ALGB lets xm = 1, achieving a competitive factor of H1. This is in agreement with the description of I∗z (1). Inductive Step. Assume, by way of strong induction, than the statement is true for m = 2z + 1,··· , w. We need to show that the statement is true for m = w + 1. By Lemma 6, there exists an adversary that is Hw+1−2z+1- advantaged, namely one that follows the strategy of instance class I∗z (w + 1). Now, consider the case in which ADVB deviates from the strategy of I∗z (w + 1) 16 Mart´ınez Mori, J. C. and Samaranayake, S. on some arbitrary step k. Let βk = {σk,1,··· , σk,l}, where l ≥ z, and let βk∗ = {σk∗,1,··· , σk∗,z, σk∗,z+1} be the kth batch according to the strategy of I∗z (w + 1). Further, denote S∩βk = ∩l q=1S(σk,q), with t = S∩βk, as well as S∩βk∗ = ∩z q=1S(σk∗,z), with r = S∩βk∗. If S∩βk∩S∩βk∗ = ∅, then the cost of the optimal offline solution increases by 1, which by Lemma 2 irrevocably decreases the advantage of ADVB. Therefore, suppose that ADVB reveals a batch βk such that S∩βk ∩ S∩βk∗ (cid:54)= ∅. Moreover, with non-zero probability ALGB disregards all Sj ∈ S(βk) \ S∩βk , so safely assume this is the case for the rest of the proof. Now, with non-zero probability ALGB disregards all Sj ∈ S∩βk \ S∩βk∗ , if any, making such deviation futile. Thus, safely assume that S∩βk ⊂ S∩βk∗ , implying that t < r. Let k(cid:48) > k be the first step after step k such that S∩βk ∩ S(βk(cid:48)) (cid:54)= ∅. As before, with non-zero probability ALGB disregards all Sj ∈ S(βk(cid:48))\S∩βk(cid:48) , so safely assume that this is the case for the rest of the proof. Then, with non-zero probability ALGB also disregards any Sj ∈ S∩βk(cid:48) \S∩βk , if any, so safely assume that S∩βk(cid:48) ⊂ S∩βk . Then, by the inductive hypothesis, given that batch βk satis- fied S∩βk ⊂ S∩βk∗ , the best ADVB can do is to recreate I∗z (t) on the remainder of the steps, starting with k(cid:48). In particular, this requires S∩βk(cid:48) ⊂ S∩βk and S∩βk(cid:48) + 1 = S∩βk. A symmetric argument can be made about concurrently recreating I∗z (r − t) on the remainder of the steps, which is disjoint from I∗z (t) after the kth step and hence increases the offline solution by one. However, by Lemma 2, this achieves a strictly lower competitive advantage for ADVB. Note that ADVB cannot be guaranteed to benefit from producing batches βk satisfying VCD(βk,S) > z because with non-zero probability ALGB disregards any Sj ∈ S(βk)\S∩βk , making such deviation futile with non-zero probability. In fact, a larger VC-dimension would involve more sets, possibly making t = S∩βk (and hence the attainable competitive advantage) smaller.
1306.3857
1
1306
2013-06-17T13:48:44
Computing Tree-depth Faster Than $2^{n}$
[ "cs.DS", "math.CO" ]
A connected graph has tree-depth at most $k$ if it is a subgraph of the closure of a rooted tree whose height is at most $k$. We give an algorithm which for a given $n$-vertex graph $G$, in time $\mathcal{O}(1.9602^n)$ computes the tree-depth of $G$. Our algorithm is based on combinatorial results revealing the structure of minimal rooted trees whose closures contain $G$.
cs.DS
cs
Computing Tree-depth Faster Than 2n Fedor V. Fomin(cid:63), Archontia C. Giannopoulou∗, and Micha(cid:32)l Pilipczuk∗ Department of Informatics, University of Bergen, {fominarchontia.giannopouloumichal.pilipczuk}@ii.uib.no P.O. Box 7803, N-5020 Bergen, Norway Abstract. A connected graph has tree-depth at most k if it is a sub- graph of the closure of a rooted tree whose height is at most k. We give an algorithm which for a given n-vertex graph G, in time O(1.9602n) computes the tree-depth of G. Our algorithm is based on combinatorial results revealing the structure of minimal rooted trees whose closures contain G. 1 Introduction The tree-depth of a graph G, denoted td(G), is the minimum number k such that there is a rooted forest F , not necessarily a subgraph of G, with the following properties. -- V (G) = V (F ), -- Every tree in F is of height at most k, i.e. the longest path between the root of the tree and any of its leaves contains at most k vertices, -- G is a subgraph of the closure of F , which is the graph obtained from F by adding all edges between every vertex of F and the vertices contained in the path from this vertex to the root of the tree that it belongs to. This parameter has increasingly been receiving attention since it was defined by Nesetril and Ossona de Mendez in [13] and played a fundamental role in the theory of classes of bounded expansion [14,15,16,17]. Tree-depth is a very natural graph parameter, and due to different applications, was rediscovered several times under different names as the vertex ranking number [2], the ordered coloring [10], and the minimum height of an elimination tree of a graph [13]. From the algorithmic perspective, it has been known that the problem of computing tree-depth is NP-hard even when restricted to bipartite graphs [2,13]. However, it also admits polynomial time algorithms for specific graph classes [6,12]. For example, when the input graph is a tree its tree-depth can be computed in linear time [20]. Moreover, as tree-depth is closed under minors, from the results of Robertson and Seymour [18,19], the problem is in FPT when parameterized by the solution size. In [2], Bodlaender et al. showed that the computation of tree- depth is also in XP when parameterized by treewidth. From the point of view (cid:63) Supported by European Research Council (ERC) Grant "Rigorous Theory of Pre- processing", reference 267959. of approximation, tree-depth can be approximated in polynomial time within a factor of O(log2 n) [4], where n is the number of vertices of the input graph. Moreover, there is a simple approximation algorithm that, given a graph G, re- turns a forest F such that G is contained in the closure of F and the height of F is at most 2td(G) [17]. Finally, it is easy to see that there exists an exact algorithm for the computation of tree-depth running in O∗(2n) time1. We are interested in tree-depth from the perspective of exact exponential time algorithms. Tree-depth is intimately related to another two well studied parameters, treewidth and pathwidth. The treewidth of a graph can be defined as the minimum taken over all possible completions into a chordal graph of the maximum clique size minus one. Similar, path-width can be defined in terms of completion to an interval graph. One of the equivalent definitions of tree-depth is as the largest clique size in a completion to a trivially perfect graph. These graph classes form the following chain trivially perfect ⊂ interval ⊂ chordal, corresponding to the parameters tree-depth, pathwidth, and treewidth. However, while for the computation of treewidth and pathwidth there exist O∗(cn), c < 2, time algorithms [7,8,11,21], to the best of our knowledge no such algorithm for tree-depth has been known prior to our work. In this paper, we construct the first exact algorithm which for any input graph G computes its tree- depth in time O∗(cn), c < 2. The running time of the algorithm is O∗(1.9602n). The approach is based on the structural characteristics of the minimal forest that defines the tree-depth of the graph. The rest of the paper is organized as follows. In Section 2 we give some basic definitions and preliminary combinatorial results on the minimal trees for tree-depth and in Section 3, based on the results from Section 2, we present the O(1.9602n) time algorithm for tree-depth. Finally, in Section 4 we conclude with open problems. 2 Minimal Rooted Forests for Tree-depth 2.1 Preliminaries For a graph G = (V, E), we use V (G) to denote V and E(G) to denote E. If S ⊆ V (G) we denote by G \ S the graph obtained from G after removing the vertices of S. In the case where S = {u}, we abuse notation and write G \ u instead of G \ {u}. We denote by G[S] the subgraph of G induced by set S. For S ⊆ V (G), the open neighborhood of S in G, NG(S), is the set {u ∈ G \ S ∃v ∈ S : {u, v} ∈ E(G)}. Again, in the case where S = {v} we abuse notation and write NG(v) instead of NG({v}). Given two vertices v and u we denote by distG(v, u) their distance in G. We use C(G) to denote the set of connected components of G. 1 The O∗(·) notation suppresses factors that are polynomial in the input size. 2 2.2 Tree-depth A rooted forest is a disjoint union of rooted trees. The height of a vertex x in a rooted forest F is the number of vertices of the path from the root (of the tree to which x belongs) to x and is denoted by height(x, F ). The height of F is the maximum height of the vertices of F and is denoted by height(F ). Let x, y be vertices of F . The vertex x is an ancestor of y if x belongs to the path linking y and the root of the tree to which y belongs. The closure clos(F ) of a rooted forest F is the graph with vertex set V (F ) and edge set {{x, y} x is an ancestor of y in F, x (cid:54)= y}. For every vertex y of F we denote by Py the unique path linking y and the root of the tree to which y belongs, and denote by p(y) the parent of y in F , i.e. the neighbor of y in Py. Vertices whose parent is y are called the children of y. We call a vertex x of F a branching point if x is not a root of F and degF (x) > 2 or if x is a root of F and degF (x) ≥ 2. For a vertex v of a rooted tree T , we denote by Tv the maximal subtree of T rooted in v. For example, if v is the root of T , then Tv = T . Let G be a graph. The tree-depth of G, denoted td(G), is the least k ∈ N such that there exists a rooted forest F on the same vertex set as G such that G ⊆ clos(F ) and height(F ) = k. Note that if G is connected then F must be a tree, and the tree-depth of a disconnected graph is the maximum of tree-depth among its connected components. Thus, when computing tree-depth we may focus on the case when G is connected and F is required to be a rooted tree. With every rooted tree T of height h we associate a sequence (t1, t2, t3, . . . ), where ti = {v height(v, T ) = i}, i ∈ N, that is, ti is the number of vertices of the tree T of height i, i ∈ N. Note that since T is finite, this sequence contains only finitely many non-zero values. 1, t1 2, t1 Let T1 and T2 be two rooted trees with heights h1 and h2, and corresponding 3, . . . ), respectively. We say that T1 ≺ T2 if sequences (t1 and only if there exists an i ∈ N such that t1 j , for every j > i. Note in particular that if h1 < h2, then taking i = h2 in this definition proves that T1 ≺ T2. 3, . . . ) and (t2 j = t2 i < t2 i and t1 1, t2 2, t2 Definition 1. Let G be a connected graph. A rooted tree T is minimal for G if 1. V (T ) = V (G) and G ⊆ clos(T ), and 2. there is no tree T (cid:48) such that V (T (cid:48)) = V (G), G ⊆ clos(T (cid:48)), and T (cid:48) ≺ T . The next observation follows from the definitions of ≺ and of tree-depth. Observation 1. Let G be a connected graph and T be a rooted tree for G such that V (T ) = V (G), G ⊆ clos(T ), and height(T ) > td(G). Then there exists a rooted tree T (cid:48) such that V (T (cid:48)) = V (G), G ⊆ clos(T (cid:48)), and height(T (cid:48)) < height(T ), and thus T (cid:48) ≺ T . The following combinatorial lemmata reveal the structures of minimal trees which will be handy in the algorithm. 3 Lemma 1. Let T 1 be a rooted tree with root r, v ∈ V (T 1), and T ∗ be a rooted tree with root r∗ such that T ∗ ≺ T 1 v . If T 2 is the rooted tree obtained from T 1 after considering the union of T 1 \ V (T 1 v ) with T ∗ and adding an edge between r∗ and p(v) (if p(v) exists), then T 2 ≺ T 1. As T ∗ ≺ T 1 Proof. Notice first that the claim trivially holds for the case where v = r as then v = T 1 and T 2 = T ∗. Thus, from now on we prove the claim assuming that T 1 v (cid:54)= r. Let then h be the height of the vertex p(v) in T 1. v , there exists an index i such that the number of vertices of height i in T ∗ is strictly smaller than the number of vertices of height i in T 1 v , and for every j > i, the number of vertices of height j is equal in both T ∗ and T 1 v . This implies that the number of vertices of height h + i in T 2 is strictly smaller than the number of vertices of height h + i in T 1, and for every j > h + i, the number of vertices of height j is equal in both T 1 and T 2. Thus, we again conclude that (cid:117)(cid:116) T 2 ≺ T 1. Lemma 2. Let G be a connected graph. If T is a minimal tree for G with root r then for every v ∈ V (T ), 1. G[V (Tv)] is connected, 2. Tv is a minimal tree for G[V (Tv)], and 3. if v(cid:48) ∈ V (Tv) is a branching point such that distTv (v, v(cid:48)) is minimum then NG(v) ∩ V (Tu) (cid:54)= ∅, for every child u of v(cid:48). Proof. We first prove (1). Assume in contrary that there exists a vertex v ∈ V (T ) such that the graph G[V (Tv)] is not connected. Notice that we may choose v in such a way that distT (r, v) is maximum. We first exclude the case where v = r. Indeed, notice that if v = r, then G[V (Tr)] = G is connected by the hypothesis. Thus, v (cid:54)= r. Notice also that if v is a leaf of T then Tv is the graph consisting of one vertex, so it is again connected. Therefore, v is not a leaf of T . Let v1, v2, . . . , vp be the children of v. The choice of v (maximality of distance from r) implies that G[V (Tvi)] is a connected component of G[V (Tv)]\ v, i ∈ [p]. Moreover, from the fact that G[V (Tv)] is not connected, it follows that there exists at least one i0 ∈ [p] such that NG(v) ∩ V (Tvi0 ) = ∅. Let T (cid:48) be the tree obtained from T by removing the edge {v, vi0} and adding the edge {p(v), vi0}. Observe that G ⊆ clos(T (cid:48)). Moreover, notice that by construction of T (cid:48), we may consider T (cid:48) as the tree obtained from the union of T \ V (Tp(v)) with T (cid:48) p(v) after p(v) ≺ Tp(v). adding the edge {p(v), p(p(v))} (if p(v) (cid:54)= r). It is easy to see that T (cid:48) Therefore, from Lemma 1, we end up with a contradiction to the minimality of T . To prove (2), we assume in contrary that there exists a vertex v ∈ V (T ) such that Tv is not a minimal tree for G[V (Tv)]. By the hypothesis that T is a minimal tree for G, it follows that v (cid:54)= r. As Tv is not a minimal tree for G[V (Tv)], there exists a rooted tree T (cid:48) with root r(cid:48) such that V (T (cid:48)) = V (Tv), G[V (Tv)] ⊆ clos(T (cid:48)), and T (cid:48) ≺ Tv. Let now T ∗ be the rooted tree obtained from the union of T \ V (Tv) with T (cid:48) after adding an edge between p(v) and r(cid:48). 4 Notice then that G ⊆ clos(T ∗). Moreover, from Lemma 1, we get that T ∗ ≺ T , a contradiction to the minimality of T . We now prove (3). Let v be a vertex of T and v(cid:48) be a branching point of Tv such that distTv (v, v(cid:48)) is minimum, that is, v(cid:48) is the highest branching point in Tv. Assume in contrary that there exists a child u of v(cid:48) such that NG(v)∩V (Tu) = ∅. Let T (cid:48) be the tree obtained from T by switching the position of the vertices v and v(cid:48), where T (cid:48) = T if v = v(cid:48). Notice that clos(T ) = clos(T (cid:48)) and T and T (cid:48) are isomorphic, hence T (cid:48) is also a minimal tree for G. Moreover, children of v in T (cid:48) are exactly children of v(cid:48) in T . Observe also that if w is a child of v(cid:48) in w)) ⊆ {v}. T , hence also a child of v in T (cid:48), then Tw = T (cid:48) w and NG[V (T (cid:48) As NG(v) ∩ V (Tu) = ∅, we obtain that G[V (T (cid:48) v)] is not connected. However, T (cid:48) is a minimal tree for G and therefore, from (1), G[V (T (cid:48) v)] is connected, a contradiction. This completes the proof of the last claim and of the lemma. (cid:117)(cid:116) v)](V (T (cid:48) 3 Computing tree-depth 3.1 The naive DP, and pruning the space of states To construct our algorithm, we need an equivalent recursive definition of tree- depth. 1 Proposition 1 ([13]). The tree-depth of a connected graph G is equal to td(G) = 1 + min v∈V (G) if V (G) = 1 max H∈C(G\v) td(H) otherwise (1) Proposition 1 already suggests a dynamic programming algorithm computing tree-depth of a given graph G in O∗(2n) time. Assume without loss of general- ity that G is connected, as otherwise we may compute the tree-depth of each connected component of G separately. For every X ⊆ V (G) such that G[X] is connected, we compute td(G[X]) using (1). Assuming that the tree-depth of all the connected graphs induced by smaller subsets of vertices has been already computed, computation of formula (1) takes polynomial time. Hence, if we em- ploy dynamic programming starting with the smallest sets X, we can compute td(G) in O∗(2n) time. Let us denote this algorithm by A0. The reason why A0 runs in pessimistic O∗(2n) time is that the number of subsets of V (G) inducing connected subgraphs can be as large as O(2n). There- fore, if we aim at reducing the time complexity, we need to prune the space of states significantly. Let us choose some ε, 0 < ε < 1 6 , to be determined later, and let G be a connected graph on n vertices. We define the space of states Sε as follows: Sε = {S ⊆ V (G) 1 ≤ S ≤(cid:0) 1 ∃X ⊆ V (G) : X ≤(cid:0) 1 2 − ε(cid:1) n and G[S] is connected, or 2 − ε(cid:1) n and G[S] ∈ C(G \ X)}. Observe that thus all the sets belonging to Sε induce connected subgraphs of G. The subsets S ∈ Sε considered in the first part of the definition will be called 5 (cid:19)(cid:19) time. n 2−ε)n ( 1 . Moreover, Proof. For sets of the first type, there are at most n · n 2 − ε(cid:1) n (cid:0) 1 n of the first type, and the ones considered in the second part will be called of the second type. Note that V (G) ∈ Sε since it is a subset of second type for X = ∅. (cid:1)(cid:17) Lemma 3. If G is a graph on n vertices, then Sε = O∗(cid:16)(cid:0) Sε may be enumerated in O∗(cid:18)(cid:18) (cid:18) (cid:19) (cid:0) 1 2 − ε(cid:1) n 2 − ε(cid:1) n. Moreover, one can enumerate them in O∗(cid:18)(cid:18) at most (cid:0) 1 (cid:0) 1 2 − ε(cid:1) n 2 − ε(cid:1) n in O∗(cid:18)(cid:18) (cid:19)(cid:19) all the vertex sets X of size at most(cid:0) 1 (cid:0) 1 2 − ε(cid:1) n time, and for each run a polynomial-time check whether it induces a connected subgraph. For the sets of the second type, we can in the same manner enumerate time, and for each of them take all of the at most n connected components of G \ X. (cid:117)(cid:116) In our algorithms we store the family Sε as a collection of binary vectors of length n in a prefix tree (a trie). Thus when constructing Sε we can avoid enumerating duplicates, and then test belonging to Sε in O(n) time. We now define the pruned dynamic programming algorithm Aε that for every X ∈ Sε computes value td∗(G[X]) defined as follows: sets S of size (cid:19)(cid:19) n n 1 td∗(G[X]) = H∈C(G[X]\v), V (H)∈Sε max td∗(H) if X = 1 otherwise (2) 1 + min v∈X We use convention that td∗(G[X]) = +∞ if X /∈ Sε. The algorithm Aε can be implemented in a similar manner as A so that its running time is O∗(Sε). We consider sets from Sε in increasing order of cardinalities (sorting Sε with respect to cardinalities takes O∗(Sε) time) and simply apply formula (2). Note that computation of formula (2) takes polynomial time, since we need to consider at most n vertices v, and for every connected component H ∈ C(G \ v) we can test whether its vertex set belongs to Sε in O(n) time. For a set S ∈ Sε and T being a minimal tree for G[S], we say that T is covered by Sε if V (Tv) ∈ Sε for every v ∈ S. The following lemma expresses the crucial property of td∗. Lemma 4. For any connected graph G and any subset S ⊆ V (G), it holds that td∗(G[S]) ≥ td(G[S]). Moreover, if S ∈ Sε and there exists a minimal tree T for G[S] that is covered by Sε, then td∗(G[S]) = td(G[S]). Proof. We first prove the first claim by induction with respect to the cardinality of S. If td∗(G[S]) = +∞ then the claim is trivial. Therefore, we assume that S ∈ Sε, there exists some r ∈ S such that td∗(G[S]) = 1 + maxH∈C(G[S]\r) td∗(H), and V (H) ∈ Sε for each H ∈ C(G[S] \ r). By the induction hypothesis, since V (H) ≤ S for each H ∈ C(G[S] \ r), we infer that td∗(H) ≥ td(H) for 6 each H ∈ C(G[S] \ r). On the other hand, by (1) we have that td(G[S]) ≤ 1 + maxH∈C(G[S]\r) td(H). Therefore, td(G[S]) ≤ 1 + max ≤ 1 + max td∗(H) = td∗(G[S]), H∈C(G[S]\r) td(H) H∈C(G[S]\r) and the induction step follows. We now prove the second claim, again by induction with respect to the cardinality of S. Let T be a minimal tree for G[S] that is covered by Sε. Let r be the root of T and let v1, v2, . . . , vp be the children of r in T . By (2) of Lemma 2, we have that Tvi is a minimal tree for G[V (Tvi )], for each i ∈ [p]. Moreover, since T was covered by Sε, then so does each Tvi. By the induction hypothesis we infer that td∗(G[V (Tvi )]) = td(G[V (Tvi )]) for each i ∈ [p], since V (Tvi) < S. Moreover, since T and each Tvi are minimal, we have that td(G[S]) = height(T ) = 1 + max i∈[p] height(Tvi) = 1 + max i∈[p] td(G[V (Tvi)]) = 1 + max i∈[p] td∗(G[V (Tvi)]) ≥ td∗(G[S]). The last inequality follows from the fact that, by (1) of Lemma 2, G[V (Tvi)] are connected components of G[S] \ r and moreover that their vertex sets belong to Sε. Hence, vertex r was considered in (2) when defining td∗(G[S]). We infer that td(G[S]) ≥ td∗(G[S]), and td(G[S]) ≤ td∗(G[S]) by the first claim, so (cid:117)(cid:116) td∗(G[S]) = td(G[S]). Lemma 4 implies that the tree-depth is already computed exactly for all 2 − ε)n, then td∗(G[S]) = td(G[S]). connected subgraphs induced by significantly less than half of the vertices. Corollary 1. For any connected graph G on n vertices and any S ∈ Sε, if S ≤ ( 1 Proof. If T is a minimal tree for G[S], then for every v ∈ V (T ), G[V (Tv)] is connected by (1) of Lemma 2, and V (Tv) ≤ ( 1 2 −ε)n. Hence, for every v ∈ V (T ) it holds that V (Tv) ∈ Sε and the corollary follows from Lemma 4. (cid:117)(cid:116) Finally, we observe that for any input graph G the algorithm Aε already computes the tree-depth of G unless every minimal tree for G has a very special structure. Let T be a minimal tree for G. A vertex v ∈ V (G) is called problematic 2 − ε)n. We say that a minimal if (i) V (Tv) > ( 1 tree T for G is problematic if it contains some problematic vertex. 2 − ε)n, and (ii) V (Pp(v)) > ( 1 Corollary 2. For any connected graph G, if G admits a minimal tree that is not problematic, then td∗(G) = td(G). Proof. We prove that any minimal tree T for G that is not problematic, is in fact covered by Sε. Then the corollary follows from Lemma 4. 7 G[V (Tv)] is connected by (1) of Lemma 2. Hence if V (Tv) ≤(cid:0) 1 V (Pp(v)) ≤(cid:0) 1 2 − ε(cid:1) n, then it 2 − ε(cid:1) n, since v is not problematic. Note then that NG(V (Tv)) ⊆ Take any v ∈ V (G); we need to prove that V (Tv) ∈ Sε. First note that trivially holds that V (Tv) ∈ Sε by the definition of Sε. Otherwise we have that V (Pp(v)) and so G[V (Tv)] is a connected component of V (G) \ V (Pp(v)). Conse- (cid:117)(cid:116) quently, V (Tv) is a subset of second type for X = V (Pp(v)). 3.2 The algorithm Corollary 2 already restricts cases when the pruned dynamic program Aε misses the minimal tree: this happens only when all the minimal trees for the input graph G are problematic. Therefore, it remains to investigate the structure of problematic minimal trees to find out, if some problematic minimal tree could have smaller height than the one computed by Aε. problematic, we have that Z >(cid:0) 1 Let G be the input graph on n vertices. Throughout this section we assume that G admits some problematic minimal tree T . Let v be a problematic vertex in T . Let moreover v(cid:48) be the highest branching point in Tv (possibly v(cid:48) = v if v is already a branching point in T ), or v(cid:48) be the only leaf of Tv in case Tv does not contain any branching points. Let Z = V (Pv(cid:48)); observe that since v is of T rooted in NT (Z \{v(cid:48)}), that is, in the children of vertices of Z \{v(cid:48)} that do not belong to Z, and let R1, R2, . . . , Rb be the subtrees of T rooted in children of v(cid:48). Note that trees Q1, Q2, . . . , Qa, R1, R2, . . . , Rb are pairwise disjoint, and by the definition of a minimal tree we have that NG(V (Qi)), NG(V (Rj)) ⊆ Z for any i ∈ [a], j ∈ [b]. See Figure 1 for reference. 2 − ε(cid:1) n. Let Q1, Q2, . . . , Qa be all the subtrees Let Q = (cid:83)a i=1 V (Qi) and R = (cid:83)b Z ⊇ NG(V (Rj) ∪(cid:83)a j=1 V (Rj). For any problematic mini- mal tree T and a problematic vertex v in it, we say that v defines the sets Z, Q1, Q2, . . . , Qa, R1, R2, . . . , Rb, Q, R in T . Observation 2. If b > 0, then Z = NG(V (Rj) ∪ Q) for any j ∈ [b]. Proof. As NG(V (Qi)), NG(V (Rj)) ⊆ Z for any i ∈ [a], j ∈ [b], we have that Take any z ∈ Z, and let z(cid:48) be the highest branching point in Tz; note that z(cid:48) is always defined since b > 0 and thus v(cid:48) is a branching point. If z(cid:48) = v(cid:48), then by (3) of Lemma 2 we infer that z ∈ NG(V (Rj)), j ∈ [b]. Otherwise, we have that if z(cid:48) ∈ Z \ {v(cid:48)}. Since z(cid:48) is a branching point, there exists some subtree Qi rooted in a child of z(cid:48). We can again use (3) of Lemma 2 to infer that z ∈ NG(V (Qi)), so also z ∈ NG(Q). (cid:117)(cid:116) i=1 V (Qi)). We proceed to proving the reverse inclusion. Observe that if b = 0, then we trivially have that Z = V (G) \ Q. Observation 3. Q < 2εn. 2 − ε(cid:1) n and V (Tv) > Proof. Since v is problematic, we have that V (Pp(v)) >(cid:0) 1 2 − ε(cid:1) n. Observe also that V (Pp(v)) ∪ V (Tv) = Z ∪ R by the definition of Z. (cid:0) 1 Since V (Pp(v)) ∩ V (Tv) = ∅ we have that: Z ∪ R = V (Pp(v)) ∪ V (Tv) > (1 − 2ε)n. 8 r Q1 Q2 Q Z Qa R1 v v(cid:48) R2 . . . Rb R Fig. 1. A problematic minimal tree T rooted at r, the problematic vertex v, the branch- ing vertex v(cid:48) in Tv, the set Z (the set consisting of white vertices), and the sets Qi, i ∈ [a], and Rj, j ∈ [b]. We would like to remark here that the figure only aims to facilitate identification of the above sets and that it is possible that, for some such tree T , the vertices in Z \ v(cid:48) have more children or there exists a vertex q in Q such that height(q, T ) > height(r, T ) for every vertex r ∈ R. Since Q = V (G) \ (Z ∪ R), the claim follows. Observation 4. R <(cid:0) 1 Proof. Since R = V (G) \ (Z ∪ Q) and Z >(cid:0) 1 2 + ε(cid:1) n − Q. 2 − ε(cid:1) n, we have that R = V (G) \ (Z ∪ Q) = n − Z − Q < + ε (cid:117)(cid:116) (cid:117)(cid:116) (cid:18) 1 2 (cid:19) (cid:18) 1 4 n − Q. (cid:19) + ε 2 n − Q 2 . Observation 5. If b > 0, then b ≥ 2 and min j∈[b] V (Rj) < Proof. If b > 0 then v(cid:48) is a branching point and it has at least two children. It follows that b ≥ 2. For the second claim, observe that since b ≥ 2 we have that (cid:117)(cid:116) minj∈[b] V (Rj) ≤ R/2 and the claim follows from Observation 4. We can proceed to the description of our main algorithm, denoted further A. Similarly as before, without loss of generality let us assume that G is connected. First, the algorithm constructs the family Sε using Lemma 3, and runs the algo- . rithm Aε on it. Note that these steps can be performed in time O∗(cid:16)(cid:0) (cid:1)(cid:17) n 2−ε)n ( 1 9 (cid:18) 1 (cid:19) (cid:18) 1 (cid:19) ε 2 (cid:18) 1 4 (cid:19) 3ε 2 We can therefore assume that the value td∗(G[S]) is computed for every S ∈ Sε, and in particular for S = V (G). Now the algorithm proceeds to checking whether a better problematic mini- mal tree T with problematic vertex v can be constructed. We adopt the notation introduced in the previous paragraphs for a problematic minimal tree T . We aim at identifying set Z and sets V (Q1), V (Q2), . . . , V (Qa), V (R1), V (R2), . . . , V (Rb). Without loss of generality assume that if b > 0, then V (R1) has the smallest car- dinality among V (R1), V (R2), . . . , V (Rb), i.e., V (R1) ≤ V (R2), . . . ,V (Rb). Let then Y = Q ∪ R1 if b > 0, and Y = Q if b = 0. The algorithm branches into at most (n + 1) subbranches, in each fixing the expected cardinality y of Y . Note that by Observations 3 and 5 and the fact that ε < 1 6 we may assume that y < Q + n − Q Then the algorithm branches into (cid:0)n ε 2 = + 4 2 Q 2 y 4 + + n < (cid:1) subbranches, in each fixing a different n. + subset of vertices of size smaller than y as the set Y . Note that sets V (Q1), V (Q2), . . . , V (Qa), V (R1) are then defined as vertex sets of connected compo- nents of G[Y ]. The algorithm branches further into (n + 1) cases. In one case the algorithm assumes that b = 0 and therefore concludes that Q = Y . In other cases the algorithm assumes that b > 0 and picks one of the components of G[Y ] assuming that its vertex set is V (R1), thus recognizing Q as Y \ V (R1), i.e., the union of vertex sets of remaining components of G[Y ]. In the case when b = 0 the algorithm concludes that Z = V (G) \ Q. In the cases when b > 0, the algorithm concludes that Z = NG(Y ) using Observation 2. Having identified Z, the sets V (R1), V (R2), . . . , V (Rj) can be recognized as ver- tex sets of connected components of V (G) \ (Z ∪ Q). Observations 2, 3, and 5 ensure that for every problematic minimal tree T for G, there will be at least one subbranch where sets Z, V (Q1), V (Q2), . . . , V (Qa), V (R1), V (R2), . . . , V (Rb) are fixed correctly. Observe also that in each of at most (n + 1) branches where y has been fixed, we produced at most (n + 1) ·(cid:0)n (cid:1) subbranches. We per- form also sanity checks: whenever any produced branch does not satisfy any of Observations 2, 3, 4 or 5, or the fact that V (R1) is a smallest set among V (R1), V (R2), . . . , V (Rj), we terminate the branch immediately. The algorithm now computes td(G[V (Qi)]) and td(G[V (Rj)]) for all i ∈ [a], j ∈ [b]. Recall that by Corollary 1, for any set X ⊆ V (G) such that G[X] is connected and X ≤ ( 1 2 − ε)n, we have that td(G[X]) = td∗(G[X]), and hence the value td(G[X]) has been already computed by algorithm Aε. Since Q ≤ 2εn 6 , we infer that this is the case for every set V (Qi) for i ∈ [a], and values and ε < 1 td(G[V (Qi)]) are already computed. The same holds for every Rj assuming that V (Rj) ≤ ( 1 2 − ε)n, i.e., we have no guarantee that the algorithm Aε computed td(G[V (Rj0)]) correctly. Note that by Observation 4 and the fact that ε < 1 6 , there can be at most one such j0. Furthermore, if this is the case, then by Observation 5 we have that Assume then that there exists some j0 such that V (Rj0 ) > ( 1 2 − ε)n. y 10 b ≥ 2 and V (Rj0) cannot be the smallest among sets V (R1), V (R2), . . . , V (Rb); hence, j0 (cid:54)= 1 and V (Rj0) ⊆ V (G)\ (Z ∪ Y ). Therefore, we must necessarily have that y = Y ≤ V (G) − Z − V (Rj0 ) < n − − ε n − − ε n = 2εn, (cid:19) (cid:18) 1 (cid:18) 1 2 2 (cid:19) (cid:18) 1 (cid:18) 1 2 (cid:19) (cid:19) − ε n − y = n − y. + ε 2 and moreover V (Rj0 ) ≤ V (G) − Z − Y < n − y 2 +ε)n−y 2−ε)n ( 1 2 Formally, if none of these assertions holds, the branch would be terminated by the sanity check. To compute td(G[V (Rj0 )]) we employ the naive dynamic programming routine on G[V (Rj0 )], i.e., algorithm A0. Observe, however, that in this application we do not need to recompute the values for subsets of size at 2 −ε)n, since the values for them were already computed by the algorithm most ( 1 6 , the application of algorithm Aε. Therefore, since Rj0 ≤(cid:0) 1 2 + ε(cid:1) n−y and ε < 1 A takes at most O∗((cid:0)( 1 (cid:1)) time. Summarizing, for every choice of y (recall that y < (cid:0) 1 rithm produced at most (n + 1) ·(cid:0)n could have used extra O∗((cid:0)( 1 2 +ε)n−y 2−ε)n ( 1 (cid:1) n), the algo- (cid:1) branches, and in branches with y < 2εn it (cid:1)) time for computing values td(G[V (Rj)]) 4 + 3ε whenever there was no guarantee that algorithm Aε computed them correctly. We arrive at the situation where in each branch the algorithm already identi- fied set Z, sets V (Q1), V (Q2), . . . , V (Qa), V (R1), V (R2), . . . , V (Rb), and values td(G[V (Qi)]) and td(G[V (Rj)]) for i ∈ [a], j ∈ [b]. Note, however, that the algorithm does not have yet the full knowledge of the shape of tree T , because we have not yet determined in which order the vertices of Z appear on the path Pv(cid:48), and thus we do not know where the trees Qi and Rj are attached to this path. Fortunately, it turns out that finding an optimum such ordering of vertices of Z is polynomial-time solvable. For i ∈ [a + b] let Mi = Qi if i ≤ a and Mi = Ri−a otherwise, and let hi = td(G[V (Mi)]). Note that since T is minimal, by (2) of Lemma 2 we have that hi = height(Mi) for each i ∈ [a + b]. Let also Zi = NG(V (Mi)); note that since G ⊆ clos(T ), we have that Zi ⊆ Z. Let σ be an ordering of Z, i.e., σ is a bijective function from Z to [Z]. Finally, we define the weight of σ as follows: (cid:18) Z, max i∈[a+b] (cid:19) µ(σ) = max (max(σ(Zi)) + hi) . (3) Lemma 5. Let G be the input graph, and let Z,{V (Mi)}i∈[a+b] be any parti- tioning of vertices of G such that Zi = NG(V (Mi)) is a subset of Z for any i ∈ [a + b]. Moreover, let hi = td(G[V (Mi)]) and for σ being an ordering of Z, let µ(σ) be defined by (3). Then td(G) ≤ µ(σ) for any ordering σ of Z. However, if G admits a problematic minimal tree T and Z,{V (Mi)}i∈[a+b] are defined by any problematic vertex in this tree, then td(G) = minσ µ(σ). 11 Proof. We first prove that td(G) ≤ µ(σ) for any such partitioning {V (Mi)}i∈[a+b], Z of V (G) and ordering σ of Z. Construct a rooted tree T (cid:48) as follows. First, cre- ate a path on vertex set Z, where the vertices are ordered as in ordering σ and σ−1(1) is the root of the tree. Then, for every i ∈ [a + b] construct a min- imal tree Ti for G[V (Mi)], and attach its root using one edge to the vertex σ−1(mi), where mi = max(σ(Zi)). Observe that every neighbor of V (Mi) is before σ−1(mi) in the ordering σ, and hence it follows that G ⊆ clos(T (cid:48)). Con- sequently, td(G) ≤ height(T (cid:48)). However, by the definition of T (cid:48) and of µ(σ), we have height(T (cid:48)) = µ(σ). Thus td(G) ≤ µ(σ). We proceed to the second claim. Assume that T is a problematic minimal tree for G and assume that Z,{V (Mi)}i∈[a+b] are defined by any problematic vertex v in this tree. We adopt the notation used for T in this section. Let σ0 be the order of vertices of Z on the path Pv(cid:48). For a tree Mi, for i ∈ [a + b], let zi ∈ Z be the parent of the root of Mi; hence, for i > a we have zi = v(cid:48). Observe that, then td(G) = height(T ) = max(Z, maxi∈[a+b] σ0(zi) + hi). Since G ⊆ clos(T ), we infer that σ0(zi) ≥ σ0(w) for any w ∈ Zi. Hence height(T ) ≥ µ(σ0) by the definition of µ. Consequently, td(G) ≥ µ(σ0), and so td(G) = minσ µ(σ) by the (cid:117)(cid:116) first claim. We are left with the following scheduling problem. Given a set Z of size at most n, a family number of subsets Zi ⊆ Z for i ∈ [a + b] and corresponding integers hi ≤ n, we would like to compute the minimum possible µ(σ) among orderings σ of Z. Let this problem be called Minimum Ordering with Inde- pendent Delays (MOID, for short). Lemma 6. Minimum Ordering with Independent Delays is polynomial- time solvable. Proof. Observe that since Z ≤ n and hi ≤ n, for any ordering σ we have that µ(σ) ≤ 2n. We therefore iterate through all possible values M from Z to 2n, and for each M we check whether there exists some σ with µ(σ) ≤ M . The first M for which this test returns a positive outcome is equal to minσ µ(σ). For a given M , construct an auxiliary bipartite graph H with Z on one side and {1, 2, . . . ,Z} on the other side. We put an edge between an element z and an index j if and only if the following holds: for every Zi to which z belongs, it holds that j + hi ≤ M . It is easy to verify that orderings σ of Z with µ(σ) ≤ M correspond one-to-one to perfect matchings in H. Indeed, if we are given an ordering σ with µ(σ) ≤ M , then we have that for every z ∈ Z and Zi to which z belongs, it holds that σ(z) + hi ≤ M by the definition of µ(σ). Hence, {z, σ(z)} is an edge in H and {{z, σ(z)} z ∈ Z} is a perfect matching in H. On the other hand, if we are given a perfect matching {{z, jz} z ∈ Z} in H, then we may define an ordering σ of Z by putting σ(z) = jz. Then for every z ∈ Z and Zi to which z belongs, we have that {z, σ(z)} is an edge in H and, consequently, σ(z) + hi ≤ M . As we chose z and Zi arbitrarily, it follows that maxi∈[a+b] (max(σ(Zi)) + hi) ≤ M and so µ(σ) ≤ M . 12 also solved in O(n +(cid:80)a+b Therefore, to solve the MOID problem it suffices to construct H in polyno- mial time and run any polynomial-time algorithm for finding a perfect matching (cid:117)(cid:116) in H. We remark that Minimum Ordering with Independent Delays can be i=1 Zi) time using greedy arguments. Since we are not interested in optimizing polynomial factors, in the proof of Lemma 6 we used the more concise matching argument to keep the description simple. We leave finding a faster algorithm for MOID to the reader as an interesting exercise. Concluding, in every subbranch algorithm A constructs an instance of MOID and solves it in polynomial time using the algorithm of Lemma 6. Lemma 5 ensures that none of the values found in subbranches will be larger than td(G), and that if G admits a problematic minimal tree T then td(G) will be found in at least one subbranch. Therefore, by Corollary 2 we can conclude the algorithm A by outputting the minimum of td∗(G), computed by Aε, and the values returned by subbranches. Let us proceed with the analysis of the running time of algorithm A. First, we have enumerated Sε and run the algorithm Aε, which took T1(n) = O∗(cid:18)(cid:18) (cid:19)(cid:19) n 2 − ε(cid:1) n (cid:0) 1 (cid:1) since y <(cid:0) 1 (cid:1) n n 4 + 3ε (cid:0) 1 2 is bounded by (n + 1)2 ·(cid:0) time. Then we created a number of subbranches. For every subbranch with y ≥ 2εn we have spent polynomial time, and the number of these subbranches 6 . Hence, on 4 + 3ε 2 ( 1 these subbranches we spent (cid:1) n and ε < 1 (cid:19)(cid:19) n 2 )n 4 + 3ε T2(n) = O∗(cid:18)(cid:18) (cid:32) (cid:19) · (cid:1), y max y<2εn 2 +ε)n−y 2−ε)n ( 1 T3(n) = O∗ If we now let ε = 1 time in total. Finally, for every subbranch with y < 2εn we have spent at most (cid:1)) time. As the number of such branches is bounded by (n+1)·(cid:0)n O∗((cid:0)( 1 the total time spent on these branches is also easily shown that for any y < 1 (cid:32)(cid:18)n (cid:18)( 1 2 + ε)n − y 10 , then T1(n), T2(n) = O∗((cid:0) n 2 − ε)n ( 1 5 n, it holds that(cid:0)n (cid:19)(cid:33)(cid:33) (cid:1)) = O∗(1.9602n). It can be (cid:1) ·(cid:0) 3 (cid:1) = O∗(1.9602n). To prove this, we can use the following simple combinatorial bound:(cid:0)n1 (cid:1)·(cid:0)n2 (cid:1) ≤ (cid:0)n1+n2 (cid:1). This inequality can be proved by combinatorial interpretation as follows: (cid:18) 3 (cid:19) (cid:18)n 5 n − y 2 5 n k1+k2 every choice of k1 elements from a set of size n1 and of k2 elements from a set of size n2, defines uniquely a choice of k1 + k2 elements from the union of these (cid:18) 8 sets, which is of size n1 + n2. Therefore, we obtain: 5 n − y 1 5 n (cid:18) 3 5 n − y 5 n − y = O∗(1.828n). (cid:18)n (cid:19) 5 n−y 2 5 n (cid:18) 8 5 n 1 5 n = y · 1 · y (cid:19) ≤ (cid:19) ≤ 2 5 n y (cid:19) k1 k2 . (cid:19) y 13 Consequently, T1(n), T2(n), T3(n) = O∗(1.9602n), and the whole algorithm runs in O∗(1.9602n) time. 4 Conclusion In this work we gave the first exact algorithm computing the tree-depth of a graph faster than O∗(2n). As Bodlaender et al. [3] observe, both pathwidth and treewidth can be reformulated as vertex ordering problems and thus computed by a simple dynamic programming algorithm similar to the classical Held-Karp algorithm in time O∗(2n) [9]. For example, computing the optimum value of treewidth is equivalent to finding an elimination ordering which minimizes the sizes of cliques created during the elimination process. As far as tree-depth is concerned, Nesetril and Ossona de Mendez [17] give an alternative definition of tree-depth in terms of weak-colorings, which in turn are defined also via ver- tex orderings; however, it is unclear whether this definition can be used for an algorithm working in O∗(2n) time. Interestingly enough, for many of vertex ordering problems, like Hamiltonicity, treewidth, or pathwidth, an explicit al- gorithm working in time O∗(cn) for some c < 2 can be designed, see [1,7,21]. On the other hand, for several other vertex permutation problems no such algo- rithms are known. The two natural problems to attack are (i) the computation of cutwidth, and (ii) the Minimum Feedback Arc Set in Digraph problem; see [3,5] for definitions and details. It is known that the cutwidth of a graph can be com- puted in time O∗(2t), where t is the size of a vertex cover in the graph [5]; thus the problem is solvable in time O∗(2n/2) on bipartite graphs. We leave existence of faster exponential algorithms for these problems as an open question. References 1. A. Bjorklund. Determinant sums for undirected hamiltonicity. In Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS 2010), pages 173 -- 182. IEEE, 2010. 2. H. L. Bodlaender, J. S. Deogun, K. Jansen, T. Kloks, D. Kratsch, H. Muller, and Z. Tuza. Rankings of graphs. SIAM J. Discrete Math., 11(1):168 -- 181, 1998. 3. H. L. Bodlaender, F. V. Fomin, A. M. C. A. Koster, D. Kratsch, and D. M. Thi- likos. A note on exact algorithms for vertex ordering problems on graphs. Theory Comput. Syst., 50(3):420 -- 432, 2012. 4. H. L. Bodlaender, J. R. Gilbert, H. Hafsteinsson, and T. Kloks. Approximat- ing treewidth, pathwidth, frontsize, and shortest elimination tree. J. Algorithms, 18(2):238 -- 255, 1995. 5. M. Cygan, D. Lokshtanov, M. Pilipczuk, M. Pilipczuk, and S. Saurabh. On cutwidth parameterized by vertex cover. Algorithmica, pages 1 -- 14, 2012. 6. J. S. Deogun, T. Kloks, D. Kratsch, and H. Muller. On the vertex ranking problem for trapezoid, circular-arc and other graphs. Discrete Applied Mathematics, 98(1- 2):39 -- 63, 1999. 7. F. V. Fomin, D. Kratsch, I. Todinca, and Y. Villanger. Exact algorithms for treewidth and minimum fill-in. SIAM J. Comput., 38(3):1058 -- 1079, 2008. 14 8. F. V. Fomin and Y. Villanger. Treewidth computation and extremal combinatorics. Combinatorica, 32(3):289 -- 308, 2012. 9. M. Held and R. M. Karp. A dynamic programming approach to sequencing prob- lems. Journal of SIAM, 10:196 -- 210, 1962. 10. M. Katchalski, W. McCuaig, and S. M. Seager. Ordered colourings. Discrete Mathematics, 142(1-3):141 -- 154, 1995. 11. K. Kitsunai, Y. Kobayashi, K. Komuro, H. Tamaki, and T. Tano. Computing directed pathwidth in O(1.89n) time. In Proceedings of the 7th International Sym- posium on Parameterized and Exact Computation (IPEC), volume 7535 of Lecture Notes in Computer Sci., pages 182 -- 193. Springer, 2012. 12. T. Kloks, H. Muller, and C. K. Wong. Vertex ranking of asteroidal triple-free graphs. Inf. Process. Lett., 68(4):201 -- 206, 1998. 13. J. Nesetril and P. O. de Mendez. Tree-depth, subgraph coloring and homomorphism bounds. Eur. J. Comb., 27(6):1022 -- 1041, 2006. 14. J. Nesetril and P. O. de Mendez. Grad and classes with bounded expansion I. Decompositions. Eur. J. Comb., 29(3):760 -- 776, 2008. 15. J. Nesetril and P. O. de Mendez. Grad and classes with bounded expansion II. Algorithmic aspects. Eur. J. Comb., 29(3):777 -- 791, 2008. 16. J. Nesetril and P. O. de Mendez. Grad and classes with bounded expansion III. Restricted graph homomorphism dualities. Eur. J. Comb., 29(4):1012 -- 1024, 2008. 17. J. Nesetril and P. O. de Mendez. Sparsity - Graphs, Structures, and Algorithms, volume 28 of Algorithms and combinatorics. Springer, 2012. 18. N. Robertson and P. D. Seymour. Graph Minors. XIII. The Disjoint Paths Problem. J. Comb. Theory, Ser. B, 63(1):65 -- 110, 1995. 19. N. Robertson and P. D. Seymour. Graph Minors. XX. Wagner's conjecture. J. Comb. Theory, Ser. B, 92(2):325 -- 357, 2004. 20. A. A. Schaffer. Optimal Node Ranking of Trees in Linear Time. Inf. Process. Lett., 33(2):91 -- 96, 1989. 21. K. Suchan and Y. Villanger. Computing pathwidth faster than 2n. In Proceed- ings of the 4th International Workshop on Parameterized and Exact Computation (IWPEC 2009), volume 5917, pages 324 -- 335. Springer, 2009. 15
1411.7346
3
1411
2018-12-07T01:30:55
A Chasm Between Identity and Equivalence Testing with Conditional Queries
[ "cs.DS", "cs.CC", "cs.LG", "math.PR", "math.ST", "math.ST" ]
A recent model for property testing of probability distributions (Chakraborty et al., ITCS 2013, Canonne et al., SICOMP 2015) enables tremendous savings in the sample complexity of testing algorithms, by allowing them to condition the sampling on subsets of the domain. In particular, Canonne, Ron, and Servedio (SICOMP 2015) showed that, in this setting, testing identity of an unknown distribution $D$ (whether $D=D^\ast$ for an explicitly known $D^\ast$) can be done with a constant number of queries, independent of the support size $n$ -- in contrast to the required $\Omega(\sqrt{n})$ in the standard sampling model. It was unclear whether the same stark contrast exists for the case of testing equivalence, where both distributions are unknown. While Canonne et al. established a $\mathrm{poly}(\log n)$-query upper bound for equivalence testing, very recently brought down to $\tilde O(\log\log n)$ by Falahatgar et al. (COLT 2015), whether a dependence on the domain size $n$ is necessary was still open, and explicitly posed by Fischer at the Bertinoro Workshop on Sublinear Algorithms (2014). We show that any testing algorithm for equivalence must make $\Omega(\sqrt{\log\log n})$ queries in the conditional sampling model. This demonstrates a gap between identity and equivalence testing, absent in the standard sampling model (where both problems have sampling complexity $n^{\Theta(1)}$). We also obtain results on the query complexity of uniformity testing and support-size estimation with conditional samples. We answer a question of Chakraborty et al. (ITCS 2013) showing that non-adaptive uniformity testing indeed requires $\Omega(\log n)$ queries in the conditional model. For the related problem of support-size estimation, we provide both adaptive and non-adaptive algorithms, with query complexities $\mathrm{poly}(\log\log n)$ and $\mathrm{poly}(\log n)$, respectively.
cs.DS
cs
A Chasm Between Identity and Equivalence Testing with Conditional Queries Jayadev Acharya∗ Cl´ement L. Canonne† Gautam Kamath‡ December 10, 2018 Abstract A recent model for property testing of probability distributions (Chakraborty et al., ITCS 2013, Canonne et al., SICOMP 2015) enables tremendous savings in the sample complexity of testing algorithms, by allowing them to condition the sampling on subsets of the domain. In particular, Canonne, Ron, and Servedio (SICOMP 2015) showed that, in this setting, testing identity of an unknown distribution D (i. e., whether D = D∗ for an explicitly known D∗) can be done with a constant number of queries (i. e., samples), independent of the support size n -- in contrast to the required Ω(√n) in the standard sampling model. However, it was unclear whether the same stark contrast exists for the case of testing equivalence, where both distributions are unknown. Indeed, while Canonne et al. established a poly(log n)-query upper bound for equivalence testing, very recently brought down to O(log log n) by Falahatgar et al. (COLT 2015), whether a dependence on the domain size n is necessary was still open, and explicitly posed by Fischer at the Bertinoro Workshop on Sublinear Algorithms (2014). In this article, we answer the question in the affirmative, showing that any testing algorithm for equiv- alence must make Ω(cid:0)√log log n(cid:1) queries in the conditional sampling model. Interestingly, this demonstrates a gap between identity and equivalence testing, absent in the standard sampling model (where both problems have sampling complexity nΘ(1)). We also obtain results on the query complexity of uniformity testing and support-size es- timation with conditional samples. In particular, we answer a question of Chakraborty et al. (ITCS 2013) showing that non-adaptive uniformity testing indeed requires Ω(log n) queries in the conditional model. This is an exponential improvement on their previous lower bound of Ω(log log n), and matches up to polynomial factors their poly(log n) upper bound. For the prob- lem of support-size estimation, we provide both adaptive and non-adaptive algorithms, with query complexities poly(log log n) and poly(log n), respectively, and complement them with a qualitatively tight lower bound of Ω(log n) conditional queries for non-adaptive algorithms. ∗Cornell University. [email protected]. Supported by a Cornell University Start Up, and NSF CRII-CIF- 1657471. Part of this work was done when the author was a postdoctoral researcher at MIT. †Stanford University. [email protected]. Supported by a Motwani Postdoctoral Fellowship. Part of this work was performed while the author was a graduate student at Columbia University, and supported by NSF grants CCF-1115703 and NSF CCF-1319788. ‡Simons Institute for the Theory of Computing. [email protected]. Supported as a Microsoft Research Fellow, as part of the Simons-Berkeley Research Fellowship program. This work was supported by ONR N00014-12-1-0999, and NSF grants CCF-0953960 (CAREER) and CCF-1101491. 1 1 Introduction "No, Virginia, there is no constant-query tester."1 Understanding properties and characteristics of an unknown probability distribution is a funda- mental problem in statistics, and one that has been thoroughly studied. However, it is only since the work of Goldreich and Ron [GR00] and Batu et al. [BFR+00] that the problem has been considered through the lens of theoretical computer science, more particularly in the setting of property testing. In this framework, an unknown "huge object" -- here a probability distribution over a humongous domain -- can be accessed only by making a few local inspections, and the goal is to decide whether the object satisfies some prespecified property. While most of the literature focuses on the large sample regime and studies error exponents and rates of convergence, more recent testing algorithms look at these problems in the small-sample regime focusing on the probability of errors and sample complexity. (We refer the reader to [Fis01, Ron08, Ron10, Gol10] for an introduction and surveys on the general field of property testing. Moreover, due to the specificities of our model we will interchangeably use the terms sample and query complexity, referring to conditional samples as "queries.") Over the subsequent decade, a flurry of work explored this new area, resulting in a better and often complete understanding of a number of questions in property testing of distributions, or distribution testing (see, e. g. [GR00, BFF+01, BKR04, Pan08, RS09, ADJ+11, BFRV11, Rub12, ILR12, ADJ+12, CDVV14, VV17] or [Can15] for a survey). In many cases, these culminated in provably sample-optimal algorithms, all of which required at least an nΩ(1) dependence on the domain size n in the sample complexity -- a dependence which, while sublinear, can still be prohibitively large. However, the standard setting of distribution testing, where one only obtains independent samples from an unknown distribution D, does not encompass all scenarios one may encounter. In recent years, alternative models have thus been proposed to capture more specific situations [GMV06, CFGM16, CRS15, LRR13, CR14]. Among these is the conditional oracle model [CFGM16, CRS15] which will be the focus of our work. In this setting, the testing algorithm is given the ability to sample from conditional distributions: that is, to specify a subset S of the domain and obtain samples from DS, the distribution induced by D on S (the formal definition of the model can be found in Definition 2.1). The hope is that allowing a richer set of queries to the unknown underlying distributions might significantly reduce the number of samples the algorithms need, thereby sidestepping the strong lower bounds that hold in the standard sampling model. 1.1 Motivation for the conditional model A recent trend in testing and learning circumvents these impossibility results by providing a more flexible type of queries than independent samples. One example can be found in the recent paradigm of active learning [Das05, Set09] (and its testing counterpart, active testing [BBBY12]), which modifies and generalizes the usual unsupervised learning paradigm. In this setting, the algorithm is provided with unlabeled examples only, but can then adaptively request the label of any of these examples. While not directly comparable to these two frameworks (which are not applicable to the study of probability distributions), the conditional sampling model we shall work on shares some similarity in spirit. Specifically, it provides the algorithm with some additional power, and the ability to perform (some type of) more powerful queries to the object to be learned or tested. The setting of conditional sampling is related to that of group testing, where the objective is to identify a set of defective individuals among a large population, by querying whether suitably chosen 1The curious reader is referred to [Wik17]. 2 subsets contain at least one defective individual. Group testing has been a field of interest since the 40's and has remained an active area of research since (see, e. g. [Dor43, DH00, ND00, CJSA14]). The type of queries allowed in this framework is reminiscent of conditional sampling, where one obtains samples conditioned on a subset. This connection between group testing and conditional sampling is explored in greater detail in [ACK15]. Of course, a crucial aspect of designing and studying these new models of learning and testing is to understand how justified and natural they are, and argue that they do indeed capture natural situations. In the case of distribution testing, the conditional access model does meet these criteria, as discussed in [CFGM16] and [CRS15]. Namely, besides the purely theoretical aspect of helping understand the key aspects and limitations of the underlying statistical problems, this framework is characteristic of situations which arise in natural and social sciences. At a very high-level, any scenario where an experimenter or practitioner is able to restrict the set of possible outcomes of an experiment or poll -- e. g., in chemistry, where one might control some factor such as the acidity of a solution; or in sociology by performing stratified polling -- provides this experimenter with the sort of access granted by the conditional model. 1.2 Background and previous work We focus in this paper on proving lower bounds for testing two extremely natural properties of distributions, namely equivalence testing ("are these two distributions identical?") and support-size estimation ("how many different outcomes can actually be observed?"). Along the way, we use some of the techniques we develop to obtain an upper bound on the query complexity of the latter. We state below an informal definition of these two problems, along with closely related ones (uniformity and identity testing). Hereafter, "oracle access" to a distribution D over [n] = {1, . . . , n} means access to samples generated independently from D, and "far" is with respect to the total variation distance dTV(D1, D2) = supS⊆[n](D1(S) − D2(S)) between probability distributions. Moreover, as in usual in property testing, in all the problems below we allow the algorithms to be randomized. In the description of the results below, we will often consider the distance parameter ε as a constant (and focus on the domain size n as the key parameter). Uniformity testing: granted oracle access to D, decide whether D equals U[n] (the uniform dis- tribution on [n]) or is far from it; Identity testing: granted oracle access to D and the full description of a fixed D∗, decide whether D equals D∗ or is far from it; Equivalence (closeness) testing: granted independent oracle accesses to D1, D2 (both un- known), decide whether D1 and D2 are equal or far from each other. Support-size estimation: granted oracle access to D, return a multiplicative approximation of the size of the support2 supp(D) ={ x : D(x) > 0 }. It is not difficult to see that each of the second and third problems generalizes the previous, and therefore has query complexity at least as big. All of these tasks are known to require sample complexity nΩ(1) in the standard sampling model (SAMP); yet, as prior work [CFGM16, CRS15] shows, their complexity decreases tremendously when one allows the more flexible type of access to the distribution(s) provided by a conditional sampling oracle (COND). For the problems of 2For this problem, it is typically assumed that all points in the support have probability mass at least Ω(1)/n, as without such guarantee it becomes impossible to give any non-trivial estimate (consider for instance a distribution D such that D(i) ∝ 1/2in). 3 uniformity testing and identity testing, the sample complexity even becomes a constant provided the testing algorithm is allowed to be adaptive (i. e., when the next queries it makes can depend on the samples it previously obtained). for the tight bounds on these problems). The uniformity testing problem exemplifies the savings granted by conditional sampling -- as Testing uniformity and identity. The identity testing question is a generalization of uniformity testing, where D∗ is taken to be the uniform distribution over [n]. The complexity of both tasks is well-understood in the sampling model; in particular, it is known that for both uniformity and identity testing Θ(cid:0)√n/ε2(cid:1) samples are necessary and sufficient (see [GR00, BFR+10, Pan08, VV17] Canonne, Ron, and Servedio [CRS15] showed, in this setting only O(cid:0)1/ε2(cid:1) adaptive queries3 are has constant sample complexity as well, namely O(cid:0)1/ε4(cid:1) -- very recently improved to a near-optimal O(cid:0)1/ε2(cid:1) by Falahatgar et al. [FJO+15]. The power of the COND model is evident from the fact that a task requiring polynomially many samples in the standard model can now be achieved with a number of samples independent of the domain size n. sufficient (and this is optimal, up to logarithmic factors). They further prove that identity testing The aforementioned algorithms crucially leverage the ability to make adaptive conditional queries to the probability distributions. Restricting the study to non-adaptive algorithms, Chakraborty et al. [CFGM16] describe a poly(log n, 1/ε)-query non-adaptive tester for uniformity, showing that even without the full power of conditional queries one can still get an exponential improvement over the standard sampling setting. They also obtain an Ω(log log n) lower bound for this problem, and leave open the possibility of improving this lower bound to a logarithmic dependence. We answer this question, establishing in Theorem 1.3 that any non-adaptive uniformity tester must perform Ω(log n) conditional queries. Testing equivalence. The equivalence testing problem has been extensively studied over the past decade, and its sample complexity is now known to be Θ(max(n2/3/ε4/3,√n/ε2)) in the sampling model [BFR+10, Val11, CDVV14]. In the COND setting, Canonne, Ron, and Servedio showed that equivalence testing is possible with only poly(log n, 1/ε) queries. Concurrent to our work, Falahatgar et al. [FJO+15] brought this upper bound down to O(cid:0)(log log n)/ε5(cid:1), a doubly exponential improvement over the nΩ(1) samples needed in the standard sampling model. However, these results still left open the possibility of a constant query complexity -- given that both uniformity and identity testing admit constant- query testers, it is natural to wonder where equivalence testing lies.4 This question was posed by Fischer at the Bertinoro Workshop on Sublinear Algorithms 2014 [Sublinear.info, Problem 66]. We make decisive progress in answering it, ruling out the possibility of any constant-query tester for equivalence. Along with the upper bound of Falahatgar et al. [FJO+15], our results nearly settle the dependence on the domain size, showing that (log log n)Θ(1) samples are both necessary and sufficient. Support-size estimation. Raskhodnikova et al. [RRSS09] showed that obtaining additive es- timates of the support size requires sample complexity almost linear in n. Subsequent work by Valiant and Valiant [VV11, VV10a] settles the question, establishing that Θ(n/ log n) samples are 3Here and throughout, we use the notation O(f ) to hide polylogarithmic dependencies on the argument, i. e., for expressions of the form O(f logc f ) (for some absolute constant c). 4It is worth noting that an Ω(logc n) lower bound was known for equivalence testing in a weaker version of the conditional oracle, PAIRCOND (where the tester's queries are restricted to being either [n] or subsets of size 2 [CRS15]). 4 both necessary and sufficient. Note that the proof of the Valiants' lower bound translates to multi- plicative approximations as well, as it hinges on the hardness of distinguishing a distribution with support s ≤ n from a distribution with support s + εn ≥ (1 + ε)s. To the best of our knowledge, the question of getting a multiplicative-factor estimate of the support size of a distribution given con- ditional sampling access has not been previously considered. We provide upper and lower bounds for both the adaptive and non-adaptive versions of this problem. 1.3 Our results We make significant progress in each of the problems introduced in the previous section, yielding a better understanding of their query complexities. We prove four results pertaining to the sample complexity of equivalence testing, support-size estimation, and uniformity testing in the COND framework. Our main result gives a lower bound on the sample complexity of testing equivalence with adaptive queries under the COND model, resolving in the negative the question of whether constant- query complexity was achievable [Sublinear.info, Problem 66]. 4 , must have query complexity Ω(cid:0)√log log n(cid:1). Theorem 1.1 (Testing Equivalence). Any adaptive algorithm which, given COND access to un- known distributions D1, D2 on [n], distinguishes with probability at least 2/3 between (a) D1 = D2 and (b) dTV(D1, D2) ≥ 1 Combined with the recent O(log log n) upper bound of Falahatgar et al. [FJO+15], this almost set- tles the sample complexity of this question. Furthermore, as the related task of identity testing can be performed with a constant number of queries in the conditional sampling model, this demon- strates an intriguing and intrinsic difference between the two problems. Our result also shows an interesting contrast with the usual sampling model, where both identity and equivalence testing have polynomial sample complexity. Next, we establish a logarithmic lower bound on non-adaptive support-size estimation, for any (large enough) constant factor. This improves on the result of Chakraborty et al. [CFGM16], which gave a doubly logarithmic lower bound for constant factor support-size estimation. Theorem 1.2 (Non-Adaptive Support-Size Estimation). Any non-adaptive algorithm which, given COND access to an unknown distribution D on [n], estimates the size of its support up to a factor γ ≥ √2 must have query complexity Ω(cid:16) log n log2 γ(cid:17). Moreover, the approach used to prove this theorem also implies an analogous lower bound on non- adaptive uniformity testing in the conditional model, answering a conjecture of Chakraborty et al. [CFGM16]. Theorem 1.3 (Non-Adaptive Uniformity Testing). Any non-adaptive algorithm which, given COND access to an unknown distribution D on [n] and parameter ε ∈ (0, 1/4), distinguishes with prob- ability at least 2/3 between (a) D = U[n] and (b) dTV(D,U[n]) ≥ ε, must have query complexity Ω((log n)/ε). We note that these results complement polylog(n)-query upper bounds on non-adaptive support- size estimation and uniformity testing, the former of which we sketch in this paper, and the latter obtained by Chakraborty et al. [CFGM16]. This shows that both of these problems have query complexity logΘ(1) n in the non-adaptive case. Finally, we conclude with an upper bound for adaptive support-size estimation. Specifically, we provide a O(log log n)-query algorithm for support-size estimation. This shows that the question becomes double exponentially easier when conditional samples are allowed. 5 Theorem 1.4 (Adaptive Support-Size Estimation). Let τ > 0 be any constant. There exists an adaptive algorithm which, given COND access to an unknown distribution D on [n] (guaranteed to have probability mass at least τ /n on every element of its support) and accuracy parameter ε ∈ (0, 1), makes O(cid:0)(log log n)/ε3(cid:1) queries to the oracle5 and returns a value ω such that the following holds. With probability at least 2/3, ω ∈ [ 1 1+ε · ω, (1 + ε) · ω], where ω = supp(D). Problem COND model Standard model Testing equivalence Estimating support size (adaptive) Estimating support size (non-adaptive) Testing uniformity (non-adaptive) ε3 O(poly(log n, 1/ε)) (Section 5.4) ε5 O(cid:16) log log n (cid:17) [FJO+15] Ω(cid:0)√log log n(cid:1) (Theorem 1.1) O(cid:16) log log n (cid:17) (Theorem 1.4) Ω(cid:0)√log log n(cid:1) [CFGM16] (†) O(cid:16) log5 n ε6 (cid:17) [CFGM16] Ω(cid:16) log n ε (cid:17) (Theorem 1.3) Ω(log n) (Theorem 1.2) Θ(cid:16)max(cid:16) n2/3 ε4/3 , n1/2 ε2 (cid:17)(cid:17) [CDVV14] Θ(cid:16) n log n(cid:17) [VV10a] Θ(cid:16)√n ε2 (cid:17) [Pan08] Table 1: Summary of results. Note that the lower bound (†) can also be easily derived from our lower bound on testing equivalence. 1.3.1 Relation to the Ron-Tsur model Recent work of Ron and Tsur [RT16] studies a model which is slightly different -- and more favorable to the algorithm -- than ours. In their setting, the algorithm still performs queries consisting of a subset of the domain, as in our case. However, the algorithm is also given the promise that the distribution is uniform on a subset of the domain, and whenever a query set contains 0 probability mass the oracle explicitly indicates this is the case. Their paper provides a number of results for support-size estimation in this model. We point out two connections between our work and theirs. First, our Ω(log n) lower bound for non-adaptive support-size estimation (Theorem 1.2) holds in the model of Ron and Tsur. Al- though lower bounds in the conditional sampling setting do not apply directly to their model, our construction and analysis do carry over, and provide a nearly tight answer to a question left unan- swered in their paper. Also, our O(log log n)-query algorithm for adaptive support-size estimation (Theorem 1.4) can be seen as generalizing their result to the weaker conditional sampling model (most significantly, when we are not given the promise that the distribution be uniform). 1.4 Techniques and proof ideas Lower bound on adaptive equivalence testing. we have to deal with one main conceptual issue: adaptivity. While the standard sampling model does not, by definition, allow any choice on what the next query to the oracle should be, this is no longer the case for COND algorithms. Quantifying the power that this grants an algorithm makes things much more difficult. To handle this point, we follow the approach of Chakraborty et [CFGM16] and focus on a restricted class of algorithms they introduce, called "core adaptive al. In order to prove our main lower bound, Theorem 1.1, 5We remark that the constant in the O depends polynomially on 1/τ . 6 testers" (see Section 2.2 for a formal definition). They show that this class of testers is equivalent to general algorithms for the purpose of testing a broad class of properties, namely those which are invariant to any permutation of the domain. Using this characterization, it remains for us to show that none of these structurally much simpler core testers can distinguish whether they are given conditional access to (a) a pair of random identical distributions (D1, D1), or (b) two distributions (D1, D2) drawn according to a similar process, which are far apart. At a high level, our lower bound works by designing instances where the property can be tested if and only if the support size is known to the algorithm. Our construction randomizes the support size by embedding the instance into a polynomially larger domain. Since the algorithm is only allowed a small number of queries, Yao's Minimax Principle allows us to argue that, with high probability, a deterministic algorithm is unable to "guess" the support size. This separates queries into several cases. First, in a sense we make precise, it is somehow "predictable" whether or not a query will return an element previously observed. If this occurs, it is similarly predictable which element the query will return. On the other hand, if a fresh element is observed, the query set is either "too small" or "too large." In the former case, the query will entirely miss the support, and the sampling process is identical for both types of instance. In the latter case, the query will hit a large portion of the support, and the amount of information gleaned from a single sample is minimal. At a lower level, this process itself is reminiscent of the "hard" instances underlying the lower bound of Canonne, Ron, and Servedio [CRS15] for testing identity (with a PAIRCOND oracle), with one pivotal twist. As in their work, both D1 and D2 are uniform within each of ω(1) "buckets" whose size grows exponentially and are grouped into "bucket-pairs." Then, D2 is obtained from D1 by internally redistributing the probability mass of each pair of buckets, so that the total mass of each pair is preserved but each particular bucket has mass going up or down by a constant factor (see Section 3.1 for details of the construction). However, we now add a final step, where in both D1 and D2 the resulting distribution's support is scaled by a random factor, effectively reducing it to a (randomly) negligible fraction of the domain. Intuitively, this last modification has the role of "blinding" the testing algorithm. We argue that unless its queries are on sets whose size somehow match (in a sense formalized in Section 3.2) this random size of the support, the sequences of samples it will obtain under D1 and D2 are almost identically distributed. The above discussion crucially hides many significant aspects and technical difficulties which we address in Section 3. Moreover, we observe that the lower bound we obtain seems to be optimal with regard to our proofs techniques (specifically, to the decision tree approach), and not an artifact of our lower bound instances. Namely, there appear to be conceptual barriers to strengthening our result, which would require new ideas. Lower bound on non-adaptive support-size estimation. Turning to the (non-adaptive) lower bound of Theorem 1.2, we define two families of distributions D1 and D2, where an instance is either a draw (D1, D2) from D1 × D2, or simply (D1, D1). Any distribution in D2 has support size γ times that of its corresponding distribution in D1. Yet, we argue that no non-adaptive deterministic tester making too few queries can distinguish between these two cases, as the tuple of samples it will obtain from D1 or (the corresponding) D2 is almost identically distributed (where the randomness is over the choice of the instance itself). To show this last point, we analyze separately the case of "small" queries (conditioning on sets which turn out to be much smaller than the actual support size, and thus with high probability will not even intersect it) and the "large" ones (where the query set S is so big compared to the support T that a uniform sample from S ∩ T is essentially indistinguishable from a uniform sample from S). We conclude the proof by invoking 7 Yao's Principle, carrying the lower bound back to the setting of non-adaptive randomized testers. Interestingly, this argument essentially gives us Theorem 1.3 "for free." Indeed, the big-query- set case above is handled by proving that the distribution of samples returned on those queries is indistinguishable, both for D1 and D2, from samples obtained from the actual uniform distribu- tion. Considering again the small-query-set case separately, this allows us to argue that a random distribution from (say) D1 is indistinguishable from uniform. Upper bound on support-size estimation. Our algorithm for estimating the support size within a constant factor (Theorem 1.4) is simple in spirit, and follows a guess-and-check strategy. In more detail, it first obtains a "reference point" outside the support, to check whether subsequent samples it may consider belong to the support. Then, it attempts to find a rough upper bound on the size of the support, of the form 22j (so that only log log n many options have to be considered); by using its reference point to check if a uniform random subset of this size contains, as it should, at least one point from the support. Once such an upper bound has been obtained using this double-exponential strategy, a refined bound is then obtained via a binary search on the new range of values for the exponent, {2j−1, . . . , 2j}. Not surprisingly, our algorithm draws on similar ideas as in [RT16, Sto85], with some additional machinery to supplement the differences in the models. Interestingly, as a side-effect, this upper bound shows our analysis of Theorem 1.1 to be tight up to a quadratic improvement. Indeed, the lower bound construction we consider (see Section 3.1) can be easily "defeated" if an estimate of the support size is known, and therefore cannot yield better than a Ω(log log n) lower bound. Similarly, this further shows that the adaptive lower bound for support-size estimation of Chakraborty et al. [CFGM16] is also tight up to a quadratic improvement. Organization. The rest of the paper describes details and proofs of the results mentioned in the above discussion. In Section 2, we introduce the necessary definitions and some of the tools we shall use. Section 3 covers our main result on adaptive equivalence testing, Theorem 1.1. In Section 4 we prove our lower bounds for support-size estimation and uniformity testing, and Section 5 details our upper bounds for support-size estimation. The corresponding sections may be read independently. 2 Preliminaries 2.1 Notation and sampling models All throughout this paper, we denote by [n] the set {1, . . . , n}, and by log the logarithm in base 2. A probability distribution over a (countable) domain [n] is a non-negative function D : [n] → [0, 1] such that Px∈[n] D(x) = 1. We denote by US the uniform distribution on a set S. Given a distribution D over [n] and a set S ⊆ [n], we write D(S) for the total probability mass Px∈S D(x) assigned to S by D. Finally, for S ⊆ [n] such that D(S) > 0, we denote by DS the conditional distribution of D restricted to S, that is DS(x) = D(x)/D(S) for x ∈ S and DS(x) = 0 otherwise. As is usual in distribution testing, in this work the distance between two distributions D1, D2 on [n] will be the total variation distance. dTV(D1, D2) def= 1 2kD1 − D2k1 = 1 2 Xx∈[n] D1(i) − D2(i) = max S⊆[n] (D1(S) − D2(S)) (1) which takes value in [0, 1]. 8 In this work, we focus on the setting of conditional access to the distribution, as introduced and studied in [CFGM16, CRS15]. We reproduce below the corresponding definition of a conditional oracle, henceforth referred to as COND. Definition 2.1 (Conditional access model). Fix a distribution D over [n]. A COND oracle for D, denoted CONDD, is defined as follows: the oracle takes as input a query set S ⊆ [n], chosen by the algorithm, that has D(S) > 0. The oracle returns an element i ∈ S, where the probability that element i is returned is DS (i) = D(i)/D(S), independently of all previous calls to the oracle. Note that as described above the behavior of CONDD(S) is undefined if D(S) = 0, i. e., the set S has zero probability under D. Various definitional choices could be made to deal with this. These choices do not make a significant difference in most situations, as adaptive algorithms can include in their next queries a sample previously obtained; while our lower bounds can be thought of as putting exponentially small probability mass of elements outside the support. For this reason, and for convenience, we shall hereafter assume, following Chakraborty et al., that the oracle returns in this case a sample uniformly distributed in S. Furthermore, as in [CRS15, CFGM16] we do not take the complexity of specifying the set S to the oracle into account, and indeed allow arbitrary sets as queries.6 Finally, recall that a property P of distributions over [n] is a set consisting of all distributions that have the property. The distance from D to a property P, denoted dTV(D,P), is then de- fined as infD′∈P dTV(D,P). We use the standard definition of testing algorithms for properties of distributions over [n], tailored for the setting of conditional access to an unknown distribution. Definition 2.2 (Property tester). Let P be a property of distributions over [n]. A t-query COND testing algorithm for P is a randomized algorithm T which takes as input n, ε ∈ (0, 1], as well as access to CONDD. After making at most t(ε, n) calls to the oracle, T either returns ACCEPT or REJECT, such that the following holds: • if D ∈ P, T returns ACCEPT with probability at least 2/3; • if dTV(D,P) ≥ ε, T returns REJECT with probability at least 2/3. We observe that the above definitions can be straightforwardly extended to the more general setting of pairs of distributions, where given independent access to two oracles CONDD1, CONDD2 the goal is to test whether (D1, D2) satisfies a property (now a set of pairs of distributions). This will be the case in Section 3, where we will consider equivalence testing, that is the property Peq ={ (D1, D2) : D1 = D2 }. 2.2 Adaptive Core Testers In order to deal with adaptivity in our lower bounds, we will use ideas introduced by Chakraborty et al. [CFGM16]. These ideas, for the case of label-invariant properties7 allow one to narrow down 5Recall that a non-adaptive tester is an algorithm whose queries do not depend on the answers obtained from previous ones, but only on its internal randomness. Equivalently, it is a tester that can commit "upfront" to all the queries it will make to the oracle. 6We further observe that, besides the general CONDD oracle which allows these arbitrary query sets, the authors of [CRS15] introduce two weaker variants of the conditional model (the "pair-cond" PAIRCONDD and "interval-cond" INTCONDD oracles) which restrict algorithms to "simple" queries. 7Recall that a property is label-invariant (or symmetric) if it is closed under relabeling of the elements of the support. More precisely, a property of distributions (resp. pairs of distributions) P is label-invariant if for any distribution D ∈ P (resp. (D1, D2) ∈ P) and permutation σ of [n], one has D ◦ σ ∈ P (resp. (D1 ◦ σ, D2 ◦ σ) ∈ P). 9 the range of possible testers and focus on a restricted class of such algorithms called adaptive core testers. These core testers do not have access to the full information of the samples they draw, but instead only get to see the relations (inclusions, equalities) between the queries they make and the samples they get. Yet, Chakraborty et al. [CFGM16] show that any tester for a label-invariant property can be converted into a core tester with same query complexity; thus, it is enough to prove lower bounds against this -- seemingly -- weaker class of algorithms. We here rephrase the definitions of a core tester and the view they have of the interaction with the oracle (the configuration of the samples), tailored to our setting. Definition 2.3 (Atoms and partitions). Given a family A = (A1, . . . , At) ⊆ [n]t, the atoms gener- ated by A are the (at most) 2t distinct sets of the form Tt r=1 Cr, where Cr ∈ {Ar, [n] \ Ar}. The family of all atoms, denoted At(A), is the partition generated by A. This definition essentially captures "all sets (besides the Ai) about which something can be learned from querying the oracle on the sets of A." Now, given such a sequence of queries A = (A1, . . . , At) and pairs of samples s = ((s(1) t , we would like to summarize "all the label-invariant information available to an algorithm that obtains ((s(1) 1 , s(2) t )) upon querying A1, . . . , At for D1 and D2." This calls for the following definition. , s(2) t )) ∈ A2 1 × ··· × A2 1 ), . . . , (s(1) 1 ), . . . , (s(1) 1 , s(2) , s(2) t t Definition 2.4 (t-configuration). Given A = (A1, . . . , At) and s = ((s(1) t-configuration of s consists of the 6t2 bits indicating, for all 1 ≤ i, j ≤ t, whether , s(2) j j ))1≤j≤t as above, the • s(k) • s(k) i = s(ℓ) j , for k, ℓ ∈ {1, 2}; and i ∈ Aj, for k ∈ {1, 2}. (relations between samples) (relations between samples and query sets) In other terms, it summarizes which is the unique atom Si ∈ At(A) that contains s(k) collisions between samples have been observed. i , and what As aforementioned, the key idea is to argue that, without loss of generality, one can restrict one's attention to algorithms that only have access to t-configurations, and generate their queries in a specific (albeit adaptive) fashion. Definition 2.5 (Core adaptive tester). A core adaptive distribution tester for pairs of distributions is an algorithm T that acts as follows. • In the i-th phase, based only on its own internal randomness and the configuration of the i−1) -- whose labels previous queries A1, . . . , Ai−1 and samples obtained (s(1) it does not actually know, T provides: 1 ), . . . , (s(1) i−1, s(2) 1 , s(2) -- a number kA i (How many fresh, not-already-seen elements of each particular atom A should be included in the next query.) for each A ∈ At(A1, . . . , Ai−1), between 0 and(cid:12)(cid:12)(cid:12) i ⊆ {1, . . . , i − 1} (Which of the samples s(k) i−1 will be included in the next query. The labels of these samples are unknown, but are indexed by the index of the query which returned them.) j }1≤j≤i−1(cid:12)(cid:12)(cid:12) A \ {s(1) 1 , . . . , s(k) , K (2) , s(2) j i -- sets K (1) • based on these specifications, the next query Ai is drawn (but not revealed to T ) by 10 -- drawing uniformly at random a set Λi in n Λ ⊆ [n] \ {s(1) j , s(2) j }1≤j≤i−1 : ∀A ∈ At(A1, . . . , Ai−1), Λ ∩ A = kA i o . (2) That is, among all sets, containing only "fresh elements," whose intersection with each atom contains as many elements as T requires. -- adding the selected previous samples to this set: Γi def =n s(1) j : j ∈ K (1) i o ∪n s(2) j : j ∈ K (2) i o ; Ai def = Λi ∪ Γi . (3) This results in a set Ai, not fully known to T besides the samples it already got and decided to query again; in which the labels of the fresh elements are unknown, but the proportions of elements belonging to each atom are known. i ∼ (D1)Ai and s(2) • samples s(1) i ∼ (D2)Ai are drawn (but not disclosed to T ). This defines the i-configuration of A1, . . . , Ai and (s(1) i ), which is revealed to T . Put differently, the algorithm only learns (i) to which of the Aℓ the new sample belongs, and (ii) if it is one of the previous samples, in which stage(s) and for which of D1, D2 it has already seen it. 1 ), . . . , (s(1) 1 , s(2) , s(2) i After t = t(ε, n) such stages, T returns either ACCEPT or REJECT, based only on the configuration of A1, . . . , At and (s(1) t ) (which is all the information it ever had access to). 1 ), . . . , (s(1) 1 , s(2) , s(2) t Note that in particular, T does not know the labels of samples it got, nor the actual queries it makes: it knows all about their sizes and sizes of their intersections, but not the actual "identity" of the elements they contain. 2.3 On the use of Yao's Principle in our lower bounds We recall Yao's Principle (e. g., see Chapter 2.2 of [MR95]), a technique which is ubiquitous in the analysis of randomized algorithms. Consider a set S of instances of some problem: what this principle states is that the worst-case expected cost of a randomized algorithm on instances in S is lower-bounded by the expected cost of the best deterministic algorithm on an instance drawn randomly from S. As an example, we apply it in a standard way in Section 4: instead of considering a randomized algorithm working on a fixed instance, we instead analyze a deterministic algorithm working on a random instance. (We note that, importantly, the randomness in the samples returned by the COND oracle is "external" to this argument, and these samples behave identically in an application of Yao's Principle.) On the other hand, our application in Section 3 is slightly different, due to our use of adaptive core testers. Once again, we focus on deterministic algorithms working on random instances, and the randomness in the samples is external and therefore unaffected by Yao's Principle. However, we stress that the randomness in the choice of the set Λi is also external to the argument, and therefore unaffected -- similar to the randomness in the samples, the algorithm has no control here. Another way of thinking about this randomness is via another step in the distribution over instances: after an instance (which is a pair of distributions) is randomly chosen, we permute the labels on the elements of the distribution's domain uniformly at random. We note that since the property in question is label-invariant, this does not affect its value. We can then use the model as stated in Section 2.2 for ease of analysis, observing that this can be considered an application of the principle of deferred decisions (as in Chapter 3.5 of [MR95]). 11 2.4 Chernoff bounds for Binomials and Hypergeometrics We will make extensive use of Chernoff-style bounds in this work. Recall that the Binomial(n, p) distribution describes the distribution of the number of successes when we run n independent Bernoulli trials, each with success probability p. Lemma 2.6 (Chernoff Bound for Binomials). Let X ∼ Binomial(n, p) and µ = E[X] = np. Then ∀δ ∈ (0, 1), Pr[X − µ ≥ δµ ] ≤ 2 exp − δ2µ 3 ! . We will also need a similar Chernoff-style bound for the hypergeometric distribution. The Hypergeometric(n, K, N ) distribution describes the distribution of the number of successes when we draw n times without replacement from a population of size N , in which K objects have the pertinent feature (and thus count as successes). Note that if the drawing were done with replacement, and K/N = p, then this would be equivalent to Binomial(n, p). Sampling without replacement introduces negative correlation between the probability of each draw being successful. This type of negative correlation generally "helps" with concentration, allowing one to prove similar concentration bounds (see, e. g., [Chv79, DR96], Theorem 1.17 of [AD11]). Lemma 2.7 (Chernoff Bound for Hypergeometrics). Let X ∼ Hypergeometric(n, K, N ) and µ = E[X] = nK/N . Then, ∀δ ∈ (0, 1), Pr[X − µ ≥ δµ ] ≤ 2 exp − δ2µ 3 ! . 3 A Lower Bound for Equivalence Testing We prove our main lower bound on the sample complexity of testing equivalence between unknown distributions. We construct two priors Y and N over pairs of distributions (D1, D2) over [n]. Y is a distribution over pairs of distributions of the form (D, D), namely the case when the distributions are identical. Similarly, N is a distribution over (D1, D2) with dTV(D1, D2) ≥ 1 4 . We then show that no algorithm T making O(cid:0)√log log n(cid:1) queries to CONDD1, CONDD2 can distinguish between a draw from Y and N with constant probability (over the choice of (D1, D2), the randomness in the samples it obtains, and its internal randomness). We describe the construction of Y and N in Section 3.1, and provide a detailed analysis in Section 3.2. 3.1 Construction We now summarize how a pair of distribution is constructed under Y and N . (Each specific step will be described in more detail in the subsequent paragraphs.) 1. Effective Support (a) Pick kb from the set {0, 1, . . . , 1 (b) Let b = 2kb and m def= b · n1/4. 2 log n} at random. 2. Buckets 12 (a) Choose ρ and r such that P2r (b) Divide {1, . . . , m} into intervals B1, . . . , B2r with Bi = b · ρi. i=1 ρi = n1/4. 3. Distributions D1. (a) For each i ∈ [2r], assign probability mass 1 (b) For each i ∈ [r] independently, pick πi to be a Bernoulli trial with Pr(πi = 0) = 1 2r uniformly over Bi to generate distribution 2 ; if 4r over B2i−1 and B2i, respectively, else 3 4r πi = 0 then assign probability mass 1 and 1 4r , respectively. This generates a distribution D2. 4r and 3 4. Support relabeling (a) Pick a permutation σ ∈ Sn of the total support n. (b) Relabel the symbols of D1 and D2 according to σ. 5. Output: Generate (D1, D1) for Y, and (D1, D2) otherwise. Dj(i) B1B2 B3 B4 (. . . ) m i n Figure 1: A no-instance (D1, D2) (before permutation). We now describe the various steps of the construction in greater detail. Effective support. Both D1 and D2, albeit distributions on [n], will have (common) sparse support. The support size is taken to be m def= b · n1/4. Note that, from the above definition, m is chosen uniformly at random from products of n1/4 with powers of 2, resulting in values in [n1/4, n3/4]. In this step b will act as a random scaling factor. The objective of this random scaling is to induce uncertainty in the algorithm's knowledge of the true support size of the distributions, and to prevent it from leveraging this information to test equivalence. In fact one can verify that the class of distributions induced for a single value of b, namely all distributions have the same value of m, then one can distinguish the Y and N cases with only O(1) conditional queries. The test would 13 (roughly) go as follows. Since Bi is known, one can choose a random subset S of the domain which (with high probability) has no intersection with Bi for i ≤ 2r − 2, a O(1) size intersection with B2r−1, and a O(ρ) size intersection with B2r. Perform O(1) conditional queries over the set S, for both distributions. Given these queries, we can then identify which elements of S belong to B2r−1 or B2r -- namely, those which occur at most once belong to B2r, and those which occur at least twice belong to B2r−1. In a Y instance, then in both distributions, a 1/2 fraction of queries will belong to B2r−1, whereas in a N instance, one distribution will have either a 1/4 or 3/4 fraction of queries in B2r−1, allowing us to distinguish the two cases. Buckets. Our construction is inspired by the lower bound of Canonne, Ron, and Servedio [CRS15, Theorem 8] for the more restrictive PAIRCOND access model. We partition the support into 2r consecutive intervals (henceforth referred to as buckets) B1, . . . , B2r, where the size of the i-th i=1 bρi = bn1/4, i. e., the buckets fill bucket is bρi. We note that r and ρ will be chosen such that P2r the effective support. Distributions. We output a pair of distributions (D1, D2). Each distribution that we construct is uniform within any particular bucket Bi. In particular, the first distribution assigns the same mass 1/2r to each bucket. Therefore, points within Bi have the same probability mass 1/2rbρi. For the Y case, the second distribution is identical to the first. For the N case, we pair buckets in r consecutive bucket-pairs Π1, . . . , Πr, with Πi = B2i−1 ∪ B2i. For the second distribution D2, we consider the same buckets as D1, but repartition the mass 1/r within each Πi. More precisely, in each pair, one of the buckets gets now total probability mass 1/4r while the other gets 3/4r (so that the probability of every point is either decreased by a factor 1/2 or increased by 3/2). The choice of which goes up and which goes down is done uniformly and independently at random for each bucket-pair determined by the random choices of the πi. Random relabeling. The final step of the construction randomly relabels the symbols, namely is a random injective map from [m] to [n]. This is done to ensure that no information about the individual symbol labels can be used by the algorithm for testing. For example, without this the algorithm can consider a few symbols from the first bucket and distinguish the Y and N cases. As mentioned in Section 2.3, for ease of analysis, the randomness in the choice of the permutation is, in some sense, deferred to the randomness in the choice of Λi during the algorithm's execution. Summary. A no-instance (D1, D2) is thus defined by the following parameters: the support size m, the vector (π1, . . . , πr) ∈ {0, 1}r (which only impacts D2), and the final permutation σ of the domain. A yes-instance (D1, D1) follows an identical process, however, ~π has no influence on the final outcome. See Figure 1 for an illustration of such a (D1, D2) when σ is the identity permutation and thus the distribution is supported over the first m natural numbers. Values for ρ and r. By setting r = log n/(8 log ρ) + O(1), we have as desired P2r i=1 Bi = m and there is a factor (1 + o(1))n1/4 between the height of the first bucket B1 and the one of the last, B2r. It remains to choose the parameter ρ itself; we shall take it to be 2√log n, resulting in 8√log n + O(1). (Note that for the sake of the exposition, we ignore technical details such r = 1 as the rounding of parameters, e. g., bucket sizes; these can be easily taken care of at the price of cumbersome case analyses, and do not bring much to the argument.) 14 3.2 Analysis We now prove our main lower bound, by analyzing the behavior of core adaptive testers (as per Definition 2.5) on the families Y and N from the previous section. In Section 3.2.1, we ar- gue that, with high probability, the sizes of the queries performed by the algorithm satisfy some specific properties. Conditioned upon this event, in Section 3.2.2, we show that the algorithm will get similar information from each query, whether it is running on a yes-instance or a no-instance. Before moving to the heart of the argument, we state the following fact, straightforward from the construction of our no-instances. Fact 3.1. For any (D1, D2) drawn from N , one has dTV(D1, D2) = 1/4. Moreover, as allowing more queries can only increase the probability of success, we hereafter focus on a core adaptive tester that performs exactly q = 1 that it can only distinguish between yes and no-instances with probability o(1). 10√log log n (adaptive) queries; and will show 3.2.1 Banning "bad queries" , K (2) As mentioned in Section 3.1, the draw of a yes or no-instance involves a random scaling of the size of the support of the distributions, meant to "blind" the testing algorithm. Recall that a testing algorithm is specified by a decision tree, which at step i, specifies how many unseen elements from each atom to include in the query ({kA i }) and which previously seen elements to include in the query (sets K (1) , as defined in Section 2.2), where the algorithm's choice depends on the observed configuration at that time. Note that, using Yao's Principle (as discussed in Section 2.3), these choices are deterministic for a given configuration -- in particular, we can think of all {kA i } and K (1) i values satisfy with high probability some particular conditions with respect to the choice of distribution, where the randomness is over the choice of the support size. in the decision tree as being fixed. In this section, we show that all kA i i , K (2) i i First, we recall an observation from [CFGM16], though we modify it slightly to apply to con- figurations on pairs of distributions and we apply a slightly tighter analysis. This essentially limits the number of states an algorithm could be in by a function of how many queries it makes. Proposition 3.2. The number of nodes in a decision tree corresponding to a q-sample algorithm is at most 26q2+1. Proof. As mentioned in Definition 2.4, an i-configuration can be described using 6i2 bits, resulting in at most 26i2 i-configurations. Since each i-configuration leads us to some node on the i-th level of the decision tree, the total number of nodes can be upper bounded by summing over the number of i-configurations for i ranging from 0 to q, giving us the desired bound. For the sake of the argument, we will introduce a few notions applying to the sizes of query sets: namely, the notions of a number being small, large, or stable, and of a vector being incomparable. Roughly speaking, a number is small if a uniformly random set of this size does not, in expectation, hit the largest bucket B2r -- in other words, the set is likely to be disjoint from the support. On the other hand, it is large if we expect such a set to intersect many bucket-pairs (i. e., a significant fraction of the support). The definition of stable numbers is slightly more quantitative: a number β is stable if a random set of size β, for each bucket Bi, is either disjoint from Bi or has an intersection with Bi of size close to the expected value. In the latter case, we say the set concentrates over Bi. Finally, a vector of values (βj) is incomparable if the union of random sets S1, . . . , Sm of sizes β1, . . . , βm contains 15 (with high probability) an amount of mass D(cid:16)Sj Sj(cid:17) which is either much smaller or much larger than the probability D(s) of any single element s. We formalize these concepts in the definitions below. To motivate them, it will be useful to bear in mind that, from the construction described in Section 3.1, the expected intersection of a uniform random set of size β with a bucket Bi is of size βbρi/n; while the expected probability mass from Bi it contains (under either D1 or D2) is β/2rn. Definition 3.3. Let q be an integer, and let ϕ = Θ(q5/2). A number β is said to be small if β < n bρ2r ; it is large (with relation to some integer q) if β ≥ n Note that the latter condition equivalently means that, in expectation, a set of large size will intersect at least ϕ + 1 bucket-pairs (as it hits an expected 2ϕ + 1 buckets, since β B2r−2ϕ /n ≥ 1). From the above definitions we get that, with high probability, a random set of any fixed size will in expectation either hit many or no buckets. bρ2r−2ϕ . log n (cid:17). Proposition 3.4. A number is either small or large with probability 1 − O(cid:16) ϕ log ρ Proof. A number β is neither large nor small if ρ2ϕn βρ2r . The ratio of the endpoints of the interval is ρ2ϕ. Since b = 2kb, this implies that at most log ρ2ϕ = 2ϕ log ρ values of kb could result in a fixed number falling in this range. As there are Θ(log n) values for kb, the proposition follows. βρ2r ≤ b ≤ n The next definition characterizes the sizes of query sets for which the expected intersection with any bucket is either close to 0 (less than 1/α, for some threshold α), or very big (more than α). (It will be helpful to keep in mind that we will eventually use this definition with α = poly(q).) A vector of numbers is said to be α-stable if all numbers it contains are α-stable. Definition 3.5. A number β is said to be α-stable (for α ≥ 1) if, for each j ∈ [2r], β /∈ h n Proposition 3.6. A number is α-stable with probability 1 − O(cid:16) r log α log n (cid:17). Proof. Fix some j ∈ [2r]. A number β does not satisfy the definition of α-stability for this j if αβρj ≤ b ≤ nα βρj . Since b = 2kb, this implies that at most log 2α values of kb could result in a fixed number falling in this range. Noting that there are Θ(log n) values for kb and taking a union bound over all 2r values for j, the proposition follows. bρji. αbρj , αn n The following definition characterizes the sizes of query sets which have a probability mass far from the probability mass of any individual element. (For the sake of building intuition, the reader may replace ν in the following by the parameter b of the distribution.) Definition 3.7. A vector of numbers (β1, . . . , βℓ) is said to be (α, τ )-incomparable with respect to ν (for τ ≥ 1) if the two following conditions hold. • (β1, . . . , βℓ) is α-stable. • Let ∆j be the minimum ∆ ∈ {0, . . . , 2r} such that βj νρ2r−∆ For all i ∈ [2r], τ 2rνρi , n 1 τ 2rνρii. 1 2rn Pℓ j=1 βj∆j 6∈h ≤ 1 α , or 2r if no such ∆ exists. 16 Recall from the definition of α-stability of a number that a random set of this size either has essentially no intersection with a bucket or "concentrates over it" (i. e., with high probability, the probability mass contained in the intersection with this bucket is very close to the expected value). The above definition roughly captures the following. For any j, ∆j is the number of buckets that will concentrate over a random set of size βj. The last condition asks that the total probability mass from D1 (or D2) enclosed in the union of m random sets of size β1, . . . , βℓ be a multiplicative factor of τ from the individual probability weight 1/2rbρi of a single element from any of the 2r buckets. Proposition 3.8. Given that a vector of numbers of length ℓ is α-stable, it is (α, q2)-incomparable log n (cid:17). with respect to b with probability at least 1 − O(cid:16) r log q Proof. Fix any vector (β1, . . . , βℓ). By the definition above, for each value b such that (β1, . . . , βℓ) is α-stable, we have αρ2r n ≤ ρ∆j b βj · < βj · αρ2r+1 n , j ∈ [ℓ] or, equivalently, log αβj n log ρ + 2r + log b log ρ ≤ ∆j < log αβj n log ρ + 2r + log b log ρ + 1, j ∈ [ℓ]. Writing λj def= log αβj n log ρ + 2r for j ∈ [ℓ], we obtain that ℓ ℓ Xj=1 Xj=1 βj∆jb = b βj(λj + O(1)) + Xj=1 j=1 βj(λj + O(1)) ≪ log b · Pℓ j=1 βj. Then, for any fixed i ∈ j=1 βj∆jb /∈ [n/(200qρi), 200qn/ρi]. This is essentially, with the assumption equation (4) above, requiring that • If it is the case that log ρ ·Pℓ [2r], to meet the second item of the definition of incomparability we need Pℓ βj. (4) ℓ b log b log ρ b log b /∈ " n log ρ j=1 βj 2q2ρiPℓ , 2q2n log ρ j=1 βj# . ρiPℓ Recalling that b log b = kb2kb, this means that O(log q/ log log q) values of kb are to be ruled out. (Observe that this is the number of possible "bad values" for b without the condition from the case distinction above; since we add an extra constraint on b, there are at most this many values to avoid.) • Conversely, if log ρ ·Pℓ b /∈" j=1 βj(λj + O(1)) ≫ log b ·Pℓ ρiPℓ 2q2ρiPℓ j=1 βj(λj + O(1)) n log ρ , ruling out this time O(log q) values for kb. j=1 βj the requirement becomes 2q2n log ρ j=1 βj(λj + O(1))# . • Finally, the two terms are comparable only if log b = Θ(cid:16) log ρ·Pℓ given that log b = kb, this rules out this time O(1) values for kb. j=1 βj(λj+O(1))·(cid:16)Pℓ j=1 βj(cid:17)−1(cid:17); 17 A union bound over the 2r possible values of i, and the fact that kb can take Θ(log n) values, complete the proof. We put these together to obtain the following lemma. Lemma 3.9. With probability at least 1 − O(cid:18) 26q2 +q(r log α+ϕ log ρ)+26q2 for the decision tree corresponding to a q-query algorithm: log n (r log q) (cid:19), the following holds • the size of each atom is α-stable and either large or small; • the size of each atom, after excluding elements we have previously observed,8 is α-stable and either large or small; • for each i, the vector (kA i )A∈At(A1,...,Ai) is (α, q2)-incomparable (with respect to b). Proof. From Proposition 3.2, there are at most 26q2+1 tree nodes, each of which contains one vector i )A, and at most 2q atom sizes. The first point follows from Proposition 3.4 and Proposition 3.6 (kA and applying the union bound over all 26q2+1 · 2 · 2q sizes, where we note the additional fac- tor of 2 comes from either including or excluding the old elements. The latter point follows from Proposition 3.8 and applying the union bound over all 26q2+1 nodes in the tree (each containing a single kA i vector). 3.2.2 Key lemma: bounding the variation distance between decision trees In this section, we prove a key lemma on the variation distance between the distribution on leaves of any decision tree, when given access to either an instance from Y or N . This lemma will in turn directly yield Theorem 1.1. Hereafter, we set the parameters α (the threshold for stability), ϕ (the parameter for smallness and largeness) and γ (an accuracy parameter for how well things def concentrate over their expected value) as follows.9 α = 1/ϕ = q−5/2. (Recall further that q = 1 def = q5/2 and γ def = q7, ϕ 10√log log n.) Lemma 3.10. Conditioned on the events of Lemma 3.9, consider the distribution over leaves of any decision tree corresponding to a q-query adaptive algorithm when the algorithm is given a yes- instance, and when it is given a no-instance. These two distributions have total variation distance o(1). Proof. This proof is by induction on 1 ≤ i ≤ q. We will have three inductive hypotheses, E1(t), E2(t), and E3(t). Assuming all three hold for all t < i, we prove E1(i). Additionally assuming E1(i), we prove E2(i) and E3(i). Roughly, the first inductive hypothesis states that the query sets behave similarly to as if we had picked a random set of that size. It also implies that whether or not we get an element we have seen before is "obvious" based on past observances and the size of the query we perform. The second states that we never observe two distinct elements from the same bucket-pair. The third states that the next sample is distributed similarly in either a yes-instance or a no-instance. Note that this distribution includes both features which our algorithm can observe (i. e., the atom which 8More precisely, we mean to say that for each i ≤ q, for every atom A defined by the partition of (A1, . . . , Ai), the values kA i and A \ {s(1) i are α-stable and either large or small; 1 , s(2) 1 , . . . , s(1) i−1, s(2) i−1} − kA 9This choice of parameters is not completely arbitrary: combined with the setting of q, r and ρ, they ensure a total bound o(1) on variation distance and probability of "bad events" as well as a (relative) simplicity and symmetry in the relevant quantities. 18 the sample belongs to and if it collides with a previously seen sample), as well as those which it can not (i. e., which bucket-pair the observed sample belongs to). It is necessary to show the latter, since the bucket-pair a sample belongs to may determine the outcome of future queries. More precisely, the three inductive hypotheses are as follows: • E1(i): In either a yes-instance or a no-instance, the following occurs: For an atom S in the partition generated by A1, . . . , Ai, let S′ = S \ {s(1) i−1, s(2) i−1}. For every such S′, let ℓS′ α , or 0 if no such ℓ exists. We claim that ℓS′ ∈ {0, . . . , 2r− ϕ− 2}∪{2r}, and say S′ is small if ℓS′ = 2r and large otherwise. Additionally: 1 , s(2) be the largest index ℓ ∈ {0, . . . , 2r} such that S′bρℓ 1 , . . . , s(1) n ≤ 1 i i i . n p1 p2 , S′ ∩ Bj = 0; Furthermore, let p1 and p2 be the probability mass contained in Λi and Γi, respectively. Then -- for j ≤ ℓS′ -- for j > ℓS′, S′ ∩ Bj lies in [1 − iγ, 1 + iγ] S′bρj p1+p2 ≤ O(cid:16) 1 • E2(i): No two elements from the set {s(1) • E3(i): Let T yes q2(cid:17) (that is, either almost all the probability mass comes from i } belong to the same bucket-pair. be the random variable representing the atoms and bucket-pairs10 containing i ), as well as which of the previous samples they intersect with, when the i-th query is elements which we have not yet observed, or almost all of it comes from previously seen ones). p1+p2 ≤ O(cid:16) 1 1 , . . . , s(1) q2(cid:17) or , s(2) (s(1) performed on a yes-instance, and define T no 1 , s(2) , s(2) i i , T no O(cid:0)1/q2 + 1/ρ + γ + 1/ϕ(cid:1) = o(1). similarly for no-instances. Then dTV(cid:0)T yes i (cid:1) ≤ We will show that E1(i) holds with probability 1 − O(cid:0)2i exp(−2γ2α/3)(cid:1) and E2(i) holds with probability 1 − O(i/ϕ). Let T yes be the random variable representing the q-configuration and the bucket-pairs containing each of the observed samples in a yes-instance, and define T no similarly for a no-instance. We note that this random variable determines which leaf of the decision tree we reach, which E3(q) bounds. We can then take a union bound over all i ∈ [q] to upper bound the probability that E1(i) and E2(i) do not hold, and use E3(i) and the coupling interpretation of total variation distance to upper bound the probability that T yes ever differ. Any of these "failure" events happens with probability at most O(2q exp(− 2γ2α q + q ϕ ) = o(1) (from our choice of α, γ, ϕ). This upper bounds the total variation distance between T yes and T no, giving the desired result. and T no i ) + q2 ρ + qγ + q ϕ + 1 3 i We proceed with the inductive proofs of E1(i), E2(i), and E3(i), noting that the base cases hold trivially for all three of these statements. Throughout this proof, recall that Λi is the set of unseen support elements which we query, and Γi is the set of previously seen support elements which we query. Lemma 3.11. Assume that E1(t), E2(t), E3(t) hold for all 1 ≤ t ≤ i − 1. Then E1(i) holds with probability at least 1 − O(cid:16)2i exp(cid:16)− 2γ2α Proof. We start with the first part of E1(i) (the statement prior to "Furthermore"). Let S (and the corresponding S′) be any atom as in E1(i). First, we note that ℓS′ ∈ {0, . . . , 2r − ϕ− 2}∪{2r} since we are conditioning on Lemma 3.9: S′ is α-stable and either large or small, which enforces this condition. 3 (cid:17)(cid:17) = 1 − 2i−Ω(q2). 10If a sample s(k) i does not belong to any bucket (if the corresponding i-th query did not intersect the support), it is marked in T yes i with a "dummy label" to indicate so. 19 Next, suppose S′ is contained in some other atom T generated by A1, . . . , Ai−1, and let T ′ = T \{s(1) . We argue about T ′∩ Bj i−1}. Since S′ ≤ T ′, this implies that ℓT ′ ≤ ℓS′ i−1, s(2) 1 , s(2) 1 , . . . , s(1) for three regimes of j: • The first case is j ≤ ℓT ′ probability 1. . By the inductive hypothesis, T ′ ∩ Bj = 0, so S′ ∩ Bj = 0 with • The next case is ℓT ′ < j ≤ ℓS′. Recall from the definition of a core adaptive tester that S′ will be chosen uniformly at random from all subsets of T ′ of appropriate size. By the inductive hypothesis, T ′ ∩ Bj T ′ ∈ [1 − (i − 1)γ, 1 + (i − 1)γ] bρj n , and therefore E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3) ∈ [1 − (i − 1)γ, 1 + (i − 1)γ] S′ bρj n , implying E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3) ≤ 2 αρℓS′−j ; where the inequality is by the definition of ℓS′ and using the fact that (i − 1)γ ≤ 1. Us- ing a Chernoff bound for hypergeometric random variables (Lemma 2.7), and writing µ def= E[S′ ∩ Bj] for conciseness, 1 − µ µ (cid:19) µ(cid:21) Pr(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12) ≥ 1(cid:3) = Pr(cid:20)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12) ≥ (cid:18)1 + 3µ ! (1 − µ)2 −j(cid:19) , αρℓS′ −j and (1− µ)2 ≥ 1/2 for n sufficiently ≤ exp − ≤ exp(cid:18)− 1 12 where the second inequality holds because µ ≤ 2/αρℓS′ large. • The final case is j > ℓS′. As in the previous one, E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3) ∈ [1 − (i − 1)γ, 1 + (i − 1)γ] S′ bρj n , implying E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3) ≥ where the inequality is by the definition of ℓS′, α-stability, and using the fact that (i − 1)γ ≤ 1/2. Using again a Chernoff bound for hypergeometric random variables (Lemma 2.7), αρj−ℓS′ 2 −1 ; Pr"(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12) − E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3) ≥ γS′ bρj n # ≤ Pr(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12) − E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3) ≥ γ2E(cid:2)(cid:12)(cid:12)S′ ∩ Bj(cid:12)(cid:12)(cid:3)(cid:3) ≤ 2 exp − ≤ 2 exp(cid:18)− (2γ)2E[S′ ∩ Bj] −1(cid:19) , 3 γ2αρj−ℓS′ ! 2 3 where the first inequality comes from 2(1− (i− 1)γ) ≥ 1, the second is from Chernoff bound, and the third follows from E[S′ ∩ Bj] ≥ αρj−ℓS′ −1/2. 20 Since we wish to prove the statement for all buckets Bj simultaneously, we take a union bound over all j. Recall that we want to bound the probability that S′ satisfies two conditions, for j ≤ ℓS′, S′ ∩ Bj = 0; and for j > ℓS′, S′ ∩ Bj lies in [1 − iγ, 1 + iγ] S′bρj . Using bounds from all three of these regimes of j, and a union bound, the probability that S′ does not satisfy the conditions of E1(i) is at most n Xj≤ℓT ′ 0 + XℓT ′ <j≤ℓS′ exp(cid:18)− 1 12 αρℓS′ −j(cid:19) + Xj>ℓS′ 2 exp(cid:18)− 2 3 γ2αρj−ℓS′ −1(cid:19) . This probability is maximized when ℓS′ = ℓT ′ = 0, in which case it is 2r Xj=1 2 exp(cid:18)− 2 3 γ2αρj−1(cid:19) ≤ ∞ Xj=1 2 exp(cid:18)− 2 3 γ2αρj−1(cid:19) ≤ 3 exp(cid:18)− 2 3 γ2α(cid:19) . Taking a union bound over at most 2i sets gives us the desired probability bound. Finally, we prove the remainder of E1(i) (the statement following "Furthermore"); this will follow from the definition of incomparability (Definition 3.7). • First, we focus on Γi. Suppose that Γi contains at least one element with positive probability mass (if not, the statement trivially holds). Let p′2 be the probability mass of the heaviest element in Γi. Since our inductive hypothesis implies that Γi has no elements in the same bucket pair, the maximum possible value for p2 is p2 ≤ p′2 + 3p′2 ρ + 3p′2 ρ3 + ··· ≤ p′2 + 3p′2 ρ ≤ (1 + o(1))p′2 ∞ Xk=0 1 ρ2k = 1 + 3 ρ ρ2 ρ2 − 1! p′2 Therefore, p2 ∈ [p′2, (1 + o(1))p′2]. Supposing this heaviest element belongs to bucket j, we can say that p2 ∈ [ 1 2 , (1 + o(1)) 3 2 ] 2rbρj . 1 • Next, we focus on Λi. Consider some atom A, from which we selected kA elements which have not been previously observed: call the set of these elements A′. In the first part of this proof, we showed that for each bucket Bk, either A′ ∩ Bk = 0 or A′ ∩ Bk ∈ [1 − iγ, 1 + iγ]A′ bρk/n. In the latter case, noting that iγ ≤ 1 2 and that the probability of 4rbρk , the probability mass contained by A′ ∩ Bk an individual element in Bk is within [1, 3] belongs to [1, 9]A′8rn . Recalling the definition of ∆A as stated in Definition 3.7, as shown earlier in this proof, this non-empty intersection happens for exactly ∆A buckets. Therefore, the 4i 1 total probability mass in Λi is in the interval h 1 4 , 9 2rn PA∈At(A1,...,Ai) kA Recall that we are conditioning on Lemma 3.9 which states that the vector (kA i )A∈At(A1,...,Ai) is (α, q2)-incomparable with respect to b. Applying this definition to the bounds just obtained on the probability masses in Λi and Γi gives Lemma 3.11. i ∆A. 1 Lemma 3.12. Assume that E1(t), E2(t), E3(t) hold for all 1 ≤ t ≤ i − 1, and additionally E1(i) holds. Then E2(i) holds with probability at least 1 − O(cid:16) i ϕ(cid:17). Proof. We focus on s(1) small atom intersects any of the buckets, so let us condition on the fact that s(1) i ∈ Γi, the conclusion is trivial, so suppose s(1) i ∈ Λi. From E1(i), no belongs to some . If s(1) i i 21 i large atom S. Since we want s(1) to fall in a distinct bucket-pair from 2(i − 1) + 1 other samples, there are at most 2i − 1 bucket-pairs which s(1) should not land in. Using E1(i), the maximum probability mass contained in the intersection of these bucket-pairs and S is (1 + iγ)(2i− 1)S/rn. Similarly, using the definition of a large atom, the minimum probability mass contained in S is (1 − iγ)ϕS/rn. Taking the ratio of these two terms gives an upper bound on the probability of breaking this invariant, conditioned on landing in S, as O(i/ϕ), where we note that 1+iγ 1−iγ = O(1). Since the choice of which large atom was arbitrary, we can remove the conditioning. Taking a union bound for s(1) gives the result. and s(2) i i i Lemma 3.13. Assume that E1(t), E2(t), E3(t) hold for all 1 ≤ t ≤ i − 1, and additionally E1(i) holds. Then E3(i) holds. Proof. We fix some setting of the intersection history, i. e., the configuration and the bucket-pairs the past elements belong to, and show that the results of the next query will behave similarly, whether the instance is a yes-instance or a no-instance. We note that, since we are assuming the inductive hypotheses hold, certain settings which violate these hypotheses are not allowed. We also note that s(1) for the remainder of this proof. First, we condition that, based on the setting of the past history, si will either come from Λi or Γi is distributed identically in both instances, so we focus on si def= s(2) i i -- this event happens with probability 1 − O(cid:0)1/q2(cid:1). probability 1−O(cid:16) 1 q2(cid:17), or Γi with probability 1−O(cid:16) 1 Proposition 3.14. In either a yes-instance or a no-instance, si will either come from Λi with based on the fixed configuration and choice for the bucket-pairs of previously seen elements. q2(cid:17), where the choice of which one is deterministic Proof. This is simply a rephrasing of the portion of E1(i) following "Furthermore." We now try to bound the total variation distance between T yes conditioning on this In the case when it does not hold, we trivially bound the total variation distance by 1, and T no i i event. incurring a cost of O(cid:0)1/q2(cid:1) to the total variation distance between the unconditioned variables. Since our target was for this quantity was O(cid:0)1/q2 + 1/ρ + γ + 1/ϕ(cid:1), it remains to show, in the conditioned space, that the total variation distance in either case is at most O(1/ρ + γ + 1/ϕ) = O(1/q5/2). We break this into two cases, the first being when s comes from Γi. In this case, we incur a cost in total variation distance which is O(1/ρ): Proposition 3.15. In either a yes-instance or a no-instance, condition that si comes from Γi. Then one of the following holds: • Γi ∩ Bj = 0 for all j ∈ [2r], in which case si is distributed uniformly at random from the elements of Γi; • or Γi∩Bj 6= 0 for some j ∈ [2r], in which case si will be equal to some s ∈ Γi with probability 1 − O(1/ρ), where the choice of s is deterministic based on the fixed configuration and choice for the bucket-pairs of previously seen elements. Proof. The former case follows from the definition of the sampling model. For the latter case, let p be the probability mass of the heaviest element in Γi. Since our inductive hypothesis implies that Γi has no elements in the same bucket-pair, the maximum possible value for the rest of the elements is 3p ρ + 3p ρ3 + 3p ρ5 + ··· ≤ 3p ρ 1 ρ2k = 3p ρ ρ2 ρ2 − 1 = O(cid:18) p ρ(cid:19). ∞ Xk=0 22 Since the ratio of this value and p is O(1/ρ), with probability 1 − O(1/ρ) the sample returned is the heaviest element in Γi. Finally, we examine the case when s comes from Λi: Proposition 3.16. Condition that si comes from Λi. Then either: • Λi ∩ Bj = 0 for all j ∈ [2r], in which case dTV(T yes • or Λi ∩ Bj 6= 0 for some j ∈ [2r], in which case dTV(T yes , T no i i i ) = 0; , T no i ) ≤ O(cid:16)γ + 1 q5/2(cid:17) ϕ(cid:17) = O(cid:16) 1 Proof. The former case follows from the definition of the sampling model -- since Λi does not intersect any of the buckets, the sample will be labeled as such. Furthermore, the sample returned will be drawn uniformly at random from Λi, and the probability of each atom will be proportional to the cardinality of its intersection with Λi, in both the yes and the no-instances. We next turn to the latter case. Let X be the event that, if the intersection of Λi and some atom A has a non-empty intersection with an odd number of buckets, then si does not come from the unpaired bucket. Note that E1(i) and the definition of a large atom imply that an unpaired bucket can only occur if the atom intersects at least ϕ bucket-pairs: conditioned on the sample coming from a particular atom, the probability that it comes from the unpaired bucket is O(1/ϕ). Since the choice of A was arbitrary, we may remove the conditioning, and note that Pr(X ) = 1− O(1/ϕ). Since dTV(T yes i , T no i ) ≤ dTV(T yes ≤ dTV(T yes i i i , T no , T no i X ) Pr(X ) + dTV(T yes X ) + O(1/ϕ), i , T no i ¯X ) Pr( ¯X ) (5) it remains to show that dTV(T yes i , T no i X ) ≤ O(γ). First, we focus on the distribution over atoms, conditioned on X . Let N A be the number of bucket-pairs with which A intersects both buckets, i. e., conditioned on X , the sample could come from 2N A buckets, and let N def= PA∈At(A1,...,Ai) N A. By E1(i), the maximum amount of probability mass that can be assigned to atom A is (1+γ)SN A/rn (1+γ)SN/rn , so the total variation distance in the distribution incurred by this atom is at most O(γN A/N ). Summing over all atoms, we get the desired result of O(γ). (1−γ)SN/rn , and the minimum is (1−γ)SN A/rn Finally, we bound the distance on the distribution over bucket-pairs, again conditioned on X . By E1(i) only large atoms will contain non-zero probability mass, so condition on the sample coming from some large atom A. Let N A be the number of bucket-pairs with which A intersects both buckets, i. e., conditioned on X , the sample could come from 2N A buckets. Using E1(i), the maximum amount of probability mass that can be assigned to any intersecting bucket-pair is (1 + γ)Arn ((1 − γ)Arn N A)−1, and the minimum is (1 − γ)Arn ((1 + γ)Arn N A)−1, so the total variation distance in the distribution incurred by this bucket-pair is at most O(γ/N A). Summing this differ- ence over all N A bucket-pairs, we get 1−γ2 = O(γ). Since the choice of large atom A was arbitrary, we can remove the conditioning on the choice of atom. The statement follows by applying the union bound on the distribution over bucket-pairs and the distribution over atoms. This concludes the proof of Proposition 3.16. 2γ We note that in both cases, the cost in total variation distance which is incurred is O( 1 ρ + γ + 1 ϕ ), which implies E3(i) -- proving Lemma 3.13 . This concludes the proof of Lemma 3.10. 23 With Lemma 3.10 in hand, the proof of the main theorem is straightforward. Proof of Theorem 1.1. Conditioned on Lemma 3.9, Lemma 3.10 implies that the distribution over the leaves in a yes-instance vs. a no-instance is o(1). Since an algorithm's choice to accept or reject depends deterministically on which leaf is reached, this bounds the difference between the conditional probability of reaching a leaf which accepts. Since Lemma 3.9 occurs with probability 1 − o(1), the difference between the unconditional probabilities is also o(1). 4 Lower Bounds for Non-Adaptive Algorithms In this section, we prove our lower bounds for non-adaptive support-size estimation and uniformity testing, restated here. Theorem 1.2 (Non-Adaptive Support-Size Estimation). Any non-adaptive algorithm which, given COND access to an unknown distribution D on [n], estimates the size of its support up to a factor γ ≥ √2 must have query complexity Ω(cid:16) log n log2 γ(cid:17). Theorem 1.3 (Non-Adaptive Uniformity Testing). Any non-adaptive algorithm which, given COND access to an unknown distribution D on [n] and parameter ε ∈ (0, 1/4), distinguishes with prob- ability at least 2/3 between (a) D = U[n] and (b) dTV(D,U[n]) ≥ ε, must have query complexity Ω((log n)/ε). These two theorems follow from the same argument, which we outline below before turning to the proof itself. (Note that we will, in this section, establish Theorem 1.3 for constant ε, i. e., ε = 1/4; before explaining in Section 4.1 how to derive the general statement as a corollary.) Structure of the proof. By Yao's Minimax Principle, we consider deterministic tests and study their performance over random distributions, chosen to be uniform over a random subset of carefully picked size. The proof of Theorem 1.2 then proceeds in 3 steps: in Lemma 4.2, we first argue that all queries made by the deterministic tester will (with high probability over the choice of the support size s) behave very "nicely" with regard to s, i. e., not be concentrated around it. Then, we condition on this to bound the total variation distance between the sequence of samples obtained in the two cases we "oppose," a random distribution from a family D1 and the corresponding one from a family D2. In Lemma 4.4 we show that the part of total variation distance due to samples from the small queries is zero, except with probability o(1) over the choice of s. Similarly, Lemma 4.4 allows us to say (comparing both cases to a third "reference" case, a honest-to-goodness uniform distribution over the whole domain, and applying a triangle inequality) that the remaining part of the total variation distance due to samples from the big queries is zero as well, except again with probability o(1). Combining these three lets us to conclude by properties of the total variation distance, as (since the queries are non-adaptive) the distribution over the sequence of samples is a product distribution. (Moreover, applying Lemma 4.4 as a stand-alone enables us, with little additional work, to obtain Theorem 1.3, as our argument in particular implies distributions from D1 are hard to distinguish from uniform.) The families D1 and D2. Fix γ ≥ √2 as in Theorem 1.2; writing β def= γ2, we define the set (6) =(cid:26) βkn1/4 : 0 ≤ k ≤ S def log n 2 log β (cid:27) = {n1/4, βn1/4, β2n1/4, . . . , , n3/4} A no-instance (D1, D2) ∈ D1 × D2 is then obtained by the following process: 24 • Draw s uniformly at random from S. • Pick a uniformly random set S1 ⊆ [n] of size s, and set D1 to be uniform on S1. • Pick a uniformly random set S2 ⊆ [n] of size βs, and set D2 to be uniform on S2. (Similarly, a yes-instance is obtained by first drawing a no-instance (D1, D2), and discarding D2 to keep only (D1, D1) ∈ D1 × D1.) We will argue that no algorithm can distinguish with high probability between the cases (D1, D2) ∼ D1 × D2 and (D1, D2) ∼ D1 × D1, by showing that in both cases D1 and D2 gen- erate transcripts indistinguishable from those the uniform distribution U[n] would yield. This will imply Theorem 1.2, as any algorithm to estimate the support within a multiplicative γ would imply a distinguisher between instances of the form (D1, D1) and (D1, D2) (indeed, the support sizes of D1 and D2 differ by a factor β = γ2). (As for Theorem 1.3, observe that any distribution D1 ∈ D1 has constant distance from the uniform distribution on [n], so that a uniformity tester must be able to tell D1 apart from U[n].) 80000 log n log2 β Small and big query sets. Let T be any deterministic non-adaptive algorithm making qT ≤ q = 1 queries. Without loss of generality, we can assume T makes exactly q queries, and denote them by A1, . . . , Aq ⊆ [n]. Moreover, we let ai = Ai, and (again without loss of generality) write a1 ≥ ··· ≥ aq. As a preliminary observation, note that for any A ⊂ [n] and 0 ≤ s ≤ n we have ES S ∩ A = A s n where the expectation is over a uniform choice of S among all(cid:0)n will lead us to divide the query sets Ai in two groups, depending on the expected size of their intersection with the (random) support. s(cid:1) subsets of size s. This observation With this in mind, the following definition will be crucial to our proof. Intuitively, it captures the distribution of sizes of intersection of various query sets with the randomly chosen set S. Definition 4.1. Let s ≥ 1, and A = {a1, . . . , aq} be any set of q integers. For a real number t > 0, define (7) Ct(s) def = (cid:12)(cid:12)(cid:12)(cid:12) (cid:26) i ∈ [q] : ais n ∈ (cid:16)β−t, βt(cid:17)(cid:27)(cid:12)(cid:12)(cid:12)(cid:12) to be the number of t-hit points of A (for s). The next result will be crucial to prove our lower bounds: it roughly states that if we consider the ai and scale them by the random quantity s/n, then the distribution of the random variable generated has an exponential tail with respect to t. Lemma 4.2 (Hitting Lemma). Fix A as in the previous definition. If s is drawn uniformly at random from S, then with probability at least 99/100. Ct(s) t < 2 100 . sup t>0 (8) Proof. Without loss of generality, assume that the ai are in decreasing order. We will work in the logarithmic domain: a number ai contributes to Ct(s) if and only if log s ∈ [log(n/ai) − Indeed, we can restate the lemma in an additive form. Let A = t log β, log(n/ai) + t log β]. 25 {α1, . . . , αm} be any set of numbers in [0, log n]. These are defined as transformations of ai's: αi , log(n/ai). In the additive restating, x will play the role of log s, or equivalently, s = 2x. For a point x ∈ [0, log n], let ℓx j denote the distance of x from the jth point to its left and right, respectively, from the set A. More precisely, if αγ ≤ x ≤ αγ+1, ℓx , x − αγ+1−j. If we consider j / log β is the least value of t such that Ct(2x) = j. Therefore, if only points to the left of x, ℓx tx j , 1 Observe that Ct(2x) is a piecewise-constant function which is monotone non-decreasing in t. jo, then we are guaranteed that j ≤ Ctx log β minnℓx (2x) ≤ 2j. j and rx j , rx j j Therefore, the supremum of Ct(2x) t is attained at one of these discontinuities: Ct(2x) sup t>0 t = {t : ∀δ>0,Ct−δ (2x)<Ct(2x)} We can in turn upper bound this by looking at the set of all tx discontinuous points: However, we note that in this case, Crx for instance, suppose that ℓx j < rx max Ct(2x) . t j . Note that this may ignore some j / log β will not be considered. j , then rx j / log β(2x) Crx j / log β ≤ rx Therefore, j / log β(2x) = 2Ctx j (2x): j / log β(2x) ≤ 2Cℓx j / log β(2x) j / log β(2x) 2Cℓx Crx j / log β ≤ ℓx ℓx j / log β = (2x) 2Ctx j tx j . Ct(2x) t sup t>0 ≤ max {tx j : j∈[q]} (2x) 2Ctx j tx j ≤ max {tx j : j∈[q]} 4j tx j = max {tx j : j∈[q]} 4j log β min{ℓx j , rx j } We would like to upper bound this term by 2/100. Equivalently, we satisfy the lemma conditions if min j j (cid:26) tx j (cid:27) ≥ 200 log β. For a constant c > 0, let Sc be the set of all points x (where recall s = 2x is selected according to the distribution S) such that violate this inequality for c: min j j (cid:26) tx j (cid:27) ≤ c. We would like to upper bound the probability that a randomly selected x violates this inequality for c = 200 log β by 1/100. Equivalently, since x is selected uniformly at random from log n 2 log β different values, we would like to upper bound the size of S200 log β by log n/200 log β. We do this with the following claim. Claim 4.3. Sc ≤ 2cq. Substituting in c = 200 log β and q = log n/80000 log2 β will give the desired result. j /j < c. Let Si Proof of Claim 4.3. We consider the set of points in Sc,ℓ ⊂ Sc that satisfy ℓx j /j < c for some j, and show that their measure is at most cq. An identical bound holds for the set of points of Sc for c,ℓ ⊂ Sc,ℓ be the set of points in Sc,ℓ that satisfy minjn tx j o < c with respect which rx to the set {α1, . . . , αi}. We will show by induction that Si c,ℓ = [α1, α1 + c]. Suppose by induction that Si c,ℓ < ci. Let xi be c,ℓ. Then it is clear that xi > αi, in fact xi ≥ αi + c. Furthermore, For the first point α1, the set S1 the right-most point in the set Si c,ℓ < ci. j 26 j /j = c for some j. Moreover, we claim that [αi, xi] ∈ Si either xi = log n, or ℓxi c,ℓ. Indeed, for the same j that ℓxi j /j < c, all points in [αi, xi] satisfy the condition. If xi = log n, then the result holds trivially. We therefore consider the point αi+1 and prove the inductive step for xi < log n. There are two cases: If αi+1 ≥ xi: In this case, Si+1 c,ℓ = Si c,ℓ∪[αi+1, xi+1]. We have to show that xi+1 ≤ αi+1 +c. Suppose to the contrary that xi+1 > αi+1 + c ≥ xi + c. Then there is a point αh for h ≤ i, such that i+2−h < c, and then αi+1+c−αh xi+1−αh i+2−h < c, so that however, this implies that αi+1 ∈ Si c,ℓ, contradicting the assumption of this case. αi+1 − αh i + 1 − h < c, If αi+1 < xi: In this case, Si+1 on the contrary that xi+1 > xi + c > αi+1 + c. Let h be the index such that xi+1−αh therefore, xi+c−αh c,ℓ ∪ [xi, xi+1]. We have to show that xi+1 ≤ xi + c. Suppose i+2−h < c, and c,ℓ = Si i+2−h < c, implying that xi − αh i + 1 − h contradicting that xi is the rightmost point of Si < c, c,ℓ. This concludes the proof of the hitting lemma. We proceed to show how to use this lemma to bound the contribution of various types of queries to the distinguishability of D1 and D2. In particular, we will apply Lemma 4.2 to the set of query sizes {a1, . . . , aq}. Recall that the ai are non-increasing. If aq′s/n ≤ 1 let q′ def= q + 1, otherwise define q′ as the largest integer such that aq′s/n > 1. We partition the queries made by T in two: A1, . . . , Aq′ are said to be big, while Aq′+1, . . . , Aq are small queries. Lemma 4.4. With probability at least 1 − 2−10, a random distribution from D1 or from D2 does not intersect with any small query. Proof. Let s be the random size drawn for the definition of the instances. We first claim that E[(cid:12)(cid:12)Aq′+j ∩ S(cid:12)(cid:12)] ≤ β−50j for all j ≥ 1, where the expectation is over the uniform choice of set S1 for D1. Indeed, by contradiction suppose there is a j ≥ 1 such that E[(cid:12)(cid:12)Aq′+j ∩ S(cid:12)(cid:12)] = By definition of q′, for 1 ≤ i ≤ j, n > β−50j. aq′+is aq′+js 1 ≥ n > β−50j. Therefore, the queries Aq′, Aq′+1, . . . , Aq′+j contribute to C50j, and we obtain C50j contradicting Lemma 4.2. Thus, the expected intersection can be bounded as follows: 50j ≥ j E[(cid:12)(cid:12)(Aq′+1 ∪ Aq′+2 ··· ∪ Aq) ∩ S(cid:12)(cid:12)] ≤ E[(cid:12)(cid:12)Aq′+1 ∩ S(cid:12)(cid:12)] + E[(cid:12)(cid:12)Aq′+2 ∩ S(cid:12)(cid:12)] + ··· + E[Aq ∩ S] 50j = 2 100 , ≤ β−50 + β−100 + . . . ≤ 2−12, since β ≥ 2. From this, we obtain the result holds for D1 by Markov's inequality. The same applies to D2 with probability of intersection at most 2−10, proving the lemma. 27 We now turn our attention to the sets with large intersections. We will show that under D1 and D2, the results of querying the sets A1, . . . Aq′ are indistinguishable from simply picking elements uniformly from the sets A1, . . . , Aq′. More precisely, we establish the following. Lemma 4.5. Let η∗ = 2−10 and ηs = 1/100; and fix ℓ ∈ {1, 2}. At least an 1 − ηs fraction of elements s1, . . . , sq′ ∈ A1 × A2, . . . , Aq′ satisfy , (9) Pr ℓ (cid:2) (s1, . . . , sq′)(cid:3) ∈ [1 − 5η∗, 1 + 5η∗] · 1 A1 . . .(cid:12)(cid:12)Aq′(cid:12)(cid:12) under CONDDℓ. where Prℓ(cid:2) (s1, . . . , sq′)(cid:3) denotes the probability that s1 . . . sq′ are the results of the queries A1, . . . , Aq′ As this holds for most distributions in both D1 and D2, this implies the queries are indistin- guishable from the product distribution over A1×A2, . . . , Aq′ (which is the one induced by the same queries on the uniform distribution over [n]) in either case, with probability at least 1 − ηs − 5η∗. Proof of Lemma 4.5. From standard Chernoff-like concentration bounds for hypergeometric ran- dom variables (Lemma 2.7), we obtain the claim below. Claim 4.6. Suppose A is a set of size a, and S is a uniformly chosen random set of size s. Then, for n (cid:3) < e−η2· as all η ∈ (0, 1], we have Pr(cid:2)A ∩ S > (1 + η) as 3n . We use this to show that indeed all the Ai ∩ S concentrate around their expected values for 1 ≤ j ≤ q′. First note that, as a consequence of Lemma 4.2, it is the case that these expected values satisfy aq′−js/n ≥ β50(j+1) for every 0 ≤ j ≤ q′− 1 (with probability at least 99/100). Conditioning on this, we first invoke Claim 4.6 on Aj with η = 3 · β20(j+1), and then apply a union bound to obtain 3n and Pr(cid:2)A ∩ S < (1 − η) as n (cid:3) < e−η2· as Pr(cid:20)∃j ∈ [q′] s.t. Aj ∩ S /∈h1 − 4 · β−20(j+1), 1 + 4 · β−20(j+1)i · ajs n (cid:21) < e−β10 (10) i. e., with high probability all intersections simultaneously concentrate around their expected values. Note that since s is at most n3/4, each Ai under consideration has size at least nβ50/n3/4 > n1/4. Therefore, the probability that a random selection of elements from A1, . . . , Aq′ exhibits no collision is at least q′ Yi=1 Ai − q′ Ai ≥ (cid:18)1 − q′ n1/4(cid:19)q′ ≥ 1 − (q′)2 n1/4 > 1 − log2 n n1/4 . We henceforth condition on this event. Let N = (cid:0)n number of such sets for which equation (10) holds. Let sq′ (s1, . . . , sq′) ∈ A1 × ··· × Aq′, let N (sq′ and let N0(sq′ 1 ) of them satisfy equation (10). 1 ) = (cid:0)n−q′ s(cid:1) be the number of outcomes for the set S. We write N0 ≥ N (1 − e−β10 ) for the 1 denote s1 . . . sq′. For a set of distinct 1 , s−q′(cid:1) be the number of sets of size s that contain sq′ , for a randomly chosen sq′ 1 we have By Markov's inequality, with probability at least 1 − e−β9 1 )/N (sq′ N0(sq′ Prh sq′ 1 i ≥ . For any such sq′ 1 , 1 ) q′ 1 ) > 1 − e2−β9 N0(sq′ 1 ) Yi=1 N · ≥ (1 − 6 · β−19) Ai ∩ S ≥ (1 − e2−β9 Yi=1 1 ai q′ , 28 s(s − 1) . . . (s − q′ + 1) n(n − 1) . . . (n − q′ + 1) · (1 − 4 · β−19) q′ Yi=1 n ais for large n and as S > n1/4. Since the sum of probabilities of elements is at most 1, the other side of the inequality in Lemma 4.5 follows. Proof of Theorem 1.2 and Theorem 1.3. Let T1 (resp. T2, TU ) be the distribution over transcripts generated by the queries A1, . . . , Aq when given conditional access to the distribution D1 from a no- instance (resp. D2, resp. uniform U[n]); that is, a distribution over q-tuples in A1 × ··· × Aq. Since the queries were non-adaptive, we can break T1 (and similarly for T2, TU ) in T big according to q′, and use Lemma 4.5 and Lemma 4.4 separately to obtain dTV(T1, T2) ≤ ηs + η∗ + 2−10 < 1/50 and dTV(T1, TU ) ≤ ηs + η∗ + 2−10 < 1/50 (for the latter, recalling that queries that do not intersect the support receive samples exactly uniformly distributed in the query set) -- thus establishing both theorems. 1 × T small 1 4.1 On the dependence on ε in Theorem 1.3 We remark that Theorem 1.3, by establishing a lower bound of Ω(log n) queries for non-adaptive testing of uniformity with constant distance parameter 1/4, immediately implies, by a standard argument, an Ω((log n)/ε) lower bound for distance parameter ε ∈ (0, 1/4). In more detail, this is a consequence of the following reduction: any q(n, ε)-query non-adaptive tester for uniformity T can be used, given conditional access to some distribution D on [n], on the mixture distribution Dε def= 4εD + (1 − 4ε)U[n] , (11) for which a conditional oracle can be easily simulated given a conditional oracle for D. Moreover, answering q(n, ε) to Dε can be done with an expected 4εq(n, ε) conditional queries to D. As it is immediate to see that dTV(Dε,U[n]) = 4ε dTV(D,U[n]), we get that T can be used to obtain a tester for non-adaptive testing of uniformity with constant distance parameter 1/4, with query complexity O(εq(n, ε)) for every ε < 1/4 (converting the expected query complexity to a worst- case one is straightforward via Markov's inequality followed by success probability amplification by a constant number of repetitions). Therefore, the lower bound of Theorem 1.3 implies that q(n, ε) = Ω((log n)/ε), as claimed. It is also worth noting that the above argument does not yield an analogue statement for support-size estimation via Theorem 1.2. Indeed, mixing the distribution D with the uniform distribution does not preserve the support size in that case (nor the guarantee that every point of the support has probability mass at least τ /n). 5 An Upper Bound for Support-Size Estimation In this section, we prove our upper bound for constant-factor support-size estimation, reproduced below. Theorem 1.4 (Adaptive Support-Size Estimation). Let τ > 0 be any constant. There exists an adaptive algorithm which, given COND access to an unknown distribution D on [n] (guaranteed to have probability mass at least τ /n on every element of its support) and accuracy parameter ε ∈ (0, 1), makes O(cid:0)(log log n)/ε3(cid:1) queries to the oracle11 and returns a value ω such that the following holds. With probability at least 2/3, ω ∈ [ 1 1+ε · ω, (1 + ε) · ω], where ω = supp(D). Before describing and analyzing our algorithm, we shall need the following results, that we will use as subroutines: the first one will help us detecting when the support is already dense. 11We remark that the constant in the O depends polynomially on 1/τ . 29 The second, assuming the support is sparse enough, will enable us to find an element with zero probability mass, which can afterwards be used as a "reference" to verify whether any given element is inside or outside the support. Finally, the last one will use such a reference point to check whether a candidate support size σ is smaller or significantly bigger than the actual support size. Lemma 5.1. Given τ > 0 and COND access to a distribution D such that each support element has probability at least τ /n, as well as parameters ε ∈ (0, 1/2), δ ∈ (0, 1), there exists an algorithm TestSmallSupport (Algorithm 2) that makes O(cid:0)1/(τ ε2) + 1/τ 2(cid:1) · log(1/δ) queries to the oracle, and satisfies the following. (i) If supp(D) ≥ (1 − ε/2)n, then it returns ACCEPT with probability at least 1 − δ; (ii) if supp(D) ≤ (1 − ε)n, then it returns REJECT with probability at least 1 − δ. Lemma 5.2. Given COND access to a distribution D, an upper bound m < n on supp(D), as well as parameter δ ∈ (0, 1), there exists an algorithm GetNonSupport (Algorithm 3) that makes O(cid:16)log2 1 m(cid:17) queries to the oracle, and returns an element r ∈ [n] such that r /∈ supp(D) with probability at least 1 − δ. Lemma 5.3. Given COND access to a distribution D, inputs σ ≥ 2 and r /∈ supp(D), as well as parameters ε ∈ (0, 1/2), δ ∈ (0, 1), there exists an algorithm IsAtMostSupportSize (Algorithm 4) that makes O(cid:0)1/ε2(cid:1) log(1/δ) queries to the oracle, and satisfies the following. The algorithm returns either yes or no, and (i) if σ ≥ supp(D), then it returns yes with probability at least 1 − δ; (ii) if σ > (1 + ε) supp(D), then it returns no with probability at least 1 − δ. δ log−2 n We defer the proofs of these 3 lemmata to the next subsections, and now turn to the proof of the theorem. Proof. The algorithm is given in Algorithm 1, and at a high-level works as follows: if first checks whether the support size is big (an 1 − O(ε) fraction of the domain), in which case it can already stop and return a good estimate. If this is not the case, however, then the support is sparse enough to efficiently find an element r outside the support, by taking a few uniform points, comparing and ordering them by probability mass (and keeping the lightest). This element r can then be used as a reference point in a (doubly exponential) search for a good estimate: for each guess ω, a random subset S of size roughly ω is taken, a point x is drawn from DS, and x is compared to r to check if D(x) > 0. If so, then S intersects the support, meaning that ω is an upper bound on ω; repeating until this is no longer the case results in an accurate estimate of ω. Algorithm 1 EstimateSupportD 1: if TestSmallSupportD(ε, 1 2: end if 3: Call GetNonSupportD((1 − ε 4: for j from 0 to log1+ε log1+ε n do 5: Set ω ← (1 + ε)(1+ε)j Call IsAtMostSupportSizeD(ω, r, ε, if . 10 ) returns ACCEPT then return ω ← (1 − ε2)n 2 )n, 1 10 ) to obtain a non-support reference point r. 1 100·(j+1)2 ) to check if ω is an upper bound on ω. that IsAtMostSupportSizeD((1 + ε)i, r, ε, the call returned no then Perform a binary search on {(1 + ε)j−1, . . . , (1 + ε)j} to find i∗, the smallest i ≥ 2 such return ω ← (1 + ε)i∗−1. 10(j+1) ) returns no. 1 6: 7: 8: 9: end if 10: 11: end for 30 In the rest of this section, we formalize and rigorously argue the above. Conditioning on each of the calls to the subroutines TestSmallSupport, GetNonSupport and IsAtMostSupportSize being correct (which overall happens except with probability at most 1/10+1/10+P∞j=1 1/(100j2)+ 1/10 < 1/3 by a union bound), we show that the output ω of EstimateSupport is indeed within a factor (1 + ε) of ω. • If the test on Step 1 passes, then by Lemma 5.1 we must have supp(D) > (1 − ε)n. Thus, the estimate we return is correct, as [(1 − ε)n, n] ⊆ [ω/(1 + ε), (1 + ε)ω]. • Otherwise, if it does not then by Lemma 5.1 it must be the case that supp(D) < (1 − ε/2)n. Therefore, if we reach Step 3 then (1−ε/2)n is indeed an upper bound on ω, and GetNonSupport will return a point r /∈ supp(D) as expected. The analysis of the rest of the algorithm is straight- forward: from the guarantee of IsAtMostSupportSize, the binary search will be performed for the first index j such that ω ∈ [(1 + ε)(1+ε)j−1 ]; and will be on a set of (1 + ε)j−1 values. Similarly, for the value i∗ eventually obtained, it must be the case that (1 + ε)i∗ > ω (by contrapositive, as no was returned by the subroutine) but (1 + ε)i∗−1 ≤ (1 + ε)ω (again, as the subroutine returned yes). But then, ω = (1 + ε)i∗−1 ∈ (ω/(1 + ε), (1 + ε)ω] as claimed. Query complexity. The query complexity of our algorithm originates from the following different steps: , (1 + ε)(1+ε)j • the call to TestSmallSupport, which from Lemma 5.1 costs O(cid:0)1/ε2(cid:1) queries; • the call to GetNonSupport, on Step 3, that from the choice of the upper bound also costs O(cid:0)1/ε2(cid:1) queries; • the (at most) log1+ε log1+ε n = O((log log n)/ε) calls to IsAtMostSupportSize on Step 6. Observing that the query complexity of IsAtMostSupportSize is only O(cid:0)1/ε2(cid:1) · log(1/δ), (j+1)2 at the j-th iteration this step costs at most and from the choice of δ = 1 O(cid:18) 1 ε2(cid:19) · log1+ε log1+ε n Xj=1 queries. O(cid:16)log(j2)(cid:17) = O(cid:18) 1 ε2 log1+ε log1+ε n(cid:19) = O(cid:18) 1 ε3 log1+ε log1+ε n(cid:19) • Similarly, Step 8 results in at most j ≤ log log n calls to IsAtMostSupportSize with δ set to 1/(10(j + 1)), again costing O(cid:16) 1 ε3 log log n(cid:17) queries. ε2(cid:17) · log j = O(cid:16) 1 ε2 log1+ε log1+ε n(cid:17) = O(cid:16) 1 (cid:17), as claimed. Gathering all terms, the overall query complexity is O(cid:16) log log n ε3 5.1 Proof of Lemma 5.1 Hereafter, we assume without loss of generality that τ < 2: indeed, if τ ≥ 2 then the support is of size at most n/2, and it suffices to return REJECT to meet the requirements of the lemma. We will rely on the (easy) fact below, which ensures that any distribution with dense support and minimum non-zero probability τ /n put significant mass on "light" elements. Fact 5.4. Fix any ε ∈ [0, 1). Assume D satisfies both supp(D) ≥ (1 − ε)n and D(x) ≥ τ /n for def= { x ∈ [n] : D(x) ∈ [τ /n, 2/n] }, we have Lε ≥ (1/2 − ε)n and x ∈ supp(D). Then, setting Lε D(Lε) ≥ (1/2 − ε)τ . 31 Proof. As the second claim follows directly from the first and the minimum mass of elements of Lε, it suffices to prove that Lε ≥ (1/2 − ε)n. This follows from observing that 1 = D([n]) ≥ D([n] \ Lε) ≥ (supp(D) − Lε) 2 n ≥ 2(1 − ε) − 2Lε n and rearranging the terms. it Description and intuition. The algorithm (as described in Algorithm 2) works as follows: first takes enough uniformly distributed samples s1, . . . , sm to get (with high probability) an ac- curate enough fraction of them falling in the support to distinguish between the two cases. The issue is now to detect those mj which indeed are support elements; note that we do not care about underestimating this fraction in case (b) (when the support is at most (1− ε)n, but importantly do not want to underestimate it in case (a) (when the support size is at least (1 − ε/2)n). To perform this detection, we take constantly many samples according to D (which are therefore ensured to be in the support), and use pairwise conditional queries to sort them by increasing probability mass (up to approximation imprecision), and keep only the lightest of them, t. In case (a), we now from Fact 5.4 that with high probability our t has mass in [1/n, 2/n], and will therefore be either much lighter than or comparable to any support element: this will ensure that in case (a) we do detect all of the mj that are in the support. This also works in case (b), even though Fact 5.4 does not give us any guarantee on the mass of t. Indeed, either t turns out to be light (and then the same argument ensures that our estimate of the number of "support" elements mj is good), or t is too heavy -- and then our estimate will end up being smaller than the true value. But this is fine, as the latter only means we will reject the distribution (as we should, since we are in the small-support case). Correctness. Let η be the fraction of the elements sj that are in the support of the distribution. By a multiplicative Chernoff bound and a suitable constant in our choice of m, we get that (i) if supp(D) ≥ 1 − ε/2, then Pr[ η < 1 − 3ε/4 ] ≤ 1/12, while (ii) if supp(D) ≤ 1 − ε/2, then Pr[ η ≥ 1 − 3ε/4 ] ≤ 1/12. We hereafter condition on this (i. e., η being a good enough estimate). We also condition on all calls to Compare yielding results as per specified, which by a union bound overall happens except with probability 1/12 + 1/12 = 1/6, and break the rest of the analysis in two cases. (a) Since the support size ω is in this case at least (1−ε/2)n, from Fact 5.4 we get that D(Lε/2) ≥ 1−ε 2 τ ≥ τ 4 . Therefore, except with probability at most (1 − τ /4)k < 1/12, at least one of the tj will belong to Lε/2. When this happens, and by the choice of parameters in the calls to Compare, we get that t ∈ Lε/2; that is D(t) ∈ [τ /n, 2/n]. But then the calls to the routine on Step 15 will always return either a value (since t is "comparable" to all x ∈ Lε/2 -- i. e., has probability within a factor 2/τ of them) or High (possible for those sj that have weight greater than 2/n), unless sj has mass 0 (that is, is not in the support). Therefore, the fraction of points marked as support is exactly η, which by the foregoing discussion is at least 1 − 3ε/4: the algorithm returns ACCEPT at Step 20. (b) Conversely, if ω ≤ (1 − ε)n, there will be a fraction 1 − η > 3ε/4 of the sj having mass 0. However, no matter what t is it will still be in the support and therefore have D(t) ≥ τ /n: for these sj, the call to Compare on Step 15 can thus only return Low. This means that there can only be less than (1− 3 4 ε)m points marked "support" among the sj, and hence that the algorithm will return REJECT as it should. 32 Algorithm 2 TestSmallSupportD Require: COND access to D; accuracy parameter ε ∈ (0, 1/2), threshold τ > 0, probability of 1: Repeat the following O(log(1/δ)) times and return the majority vote. 2: loop failure δ Draw m def= Θ(cid:16) 1 Draw k def= Θ(cid:16) 1 for all 1 ≤ i < j ≤ k do ε2(cid:17) independent samples s1, . . . , sm ∼ U[n]. τ(cid:17) independent samples t1, . . . , tk ∼ D. Call Compare({ti},{tj}, η = 1 if Compare returned High or a value ρ then 2 , K = 2, 1 4k2 ) to get a 2-approx. ρ of D(tj ) ⊲ Order the tj D(ti) , High or Low. else Record ti (cid:22) tj Record tj ≺ tj end if end for Set t to be (any of the) smallest elements tj according to (cid:22). for all 1 ≤ j ≤ m do Call Compare({t},{sj}, η = 1 if Compare returned High or a value ρ ≥ 1/2 then end if Record sj as "support." 2 , K = 2 τ , 1 ⊲ Find the fraction of support elements among the mj 4m ) to get either a value ρ, High or Low. 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 21: 19: 20: end for if the number of elements sj marked "support" is at least (1− 3 else return REJECT end if 22: 23: end loop 4 ε)m then return ACCEPT Overall, the inner loop of the algorithm thus only fails with probability at most 1/12+ 1/6+ 1/12 = 1/3, (where the 3 events contributing to the union bound are (i) when η fails to be a good estimate, (ii) when the calls to Compare fail to yield results as claimed, and (iii) when no tj hits Lε/2 in case (a)). Repeating independently log(1/δ) times and taking the majority vote boosts the probability of success to 1 − δ. Query complexity. The sample complexity comes from the k2 calls on Step 4 (each costing ting of m and because of the log(1/δ) repetitions, this results in an overall query complexity O(log k) queries) and the m calls on Step 15 (each costing O(cid:16) 1 O(cid:16)(cid:16) 1 ε(cid:17) log 1 δ(cid:17). τ ε2 log 1 τ 2 log 1 τ + 1 τ log m(cid:17) queries). By the set- 5.2 Proof of Lemma 5.2 As described in Algorithm 3, the subroutine is fairly simple: using its knowledge of an upperbound on the support size, it takes enough uniformly distributed samples to have (with high probability) at least one falling outside the support. Then, it uses the conditional oracle to "order" these samples according to their probability mass, and returns the lightest of them -- i. e., one with zero probability mass. 33 Algorithm 3 GetNonSupportD(m, δ) Require: COND access to D; upper bound m on supp(D), probability of failure δ Ensure: Returns r ∈ [n] such that, with probability at least 1 − δ, r /∈ supp(D) 1: Set k def=llog 2 mm. δ log−1 n 2: Draw independently k points s1, . . . , sk ∼ U[n] 3: for all 1 ≤ i < j ≤ k do Call Compare({si},{sj}, η = 1 if Compare returned High or a value ρ then 2 , K = 2, δ 2k2 ) to get a 2-approx. ρ of D(sj ) D(si) , High or Low. 4: 5: 6: 7: 8: else Record si (cid:22) sj Record sj ≺ sj end if 9: 10: end for 11: return arg min(cid:22){s1, . . . , sk} ⊲ Return (any) minimal element for (cid:22). Correctness. It is straightforward to see that provided at least one of the sj falls outside the support and that all calls to Compare behave as expected, then the procedure returns one of the "lightest" elements sj, i. e. a non-support element. By a union bound, the latter holds with probability at least 1 − δ/2; as for the former, since m is by assumption an upper bound on the support size it holds with probability at least 1− (m/n)k ≥ 1− δ/2 (from our setting of k). Overall, the procedure's output is correct with probability at least 1 − δ, as claimed. Query complexity. The query complexity of GetNonSupport is due to the(cid:0)k 2(cid:1) calls to Compare, m(cid:17)). and is therefore O(cid:16)k2 log k (In our case, we shall eventually take m = (1 − ε/2)n and δ = 1/10, thus getting k = O(1/ε) and a query complexity of O(cid:0)1/ε2(cid:1).) δ(cid:17) because of our setting for η and K (which is in turn O(cid:16)log2 1 δ log−2 n 5.3 Proof of Lemma 5.3 Our final subroutine, described in Algorithm 4, essentially derives from the following observation: a random set S of size (approximately) σ obtained by including independently each element of the domain with probability 1/σ will intersect the support on ω/σ points on expectation. What we can test given our reference point r /∈ supp(D), however, is only whether S ∩ supp(D) = ∅. But this is enough, as by repeating sufficiently many times (taking a random S and testing whether it intersects the support at all) we can distinguish between the two cases we are interested in. Indeed, the expected fraction of times S includes a support element in either cases is known to the algorithm and differs by roughly Ω(ε), so O(cid:0)1/ε2(cid:1) repetitions are enough to tell the two cases apart. 34 δ ∈ [ 1 Algorithm 4 IsAtMostSupportSizeD(σ, r, ε, δ) Require: COND access to D; size σ ≥ 2, non-support element r, accuracy ε, probability of failure Ensure: Returns, with probability at least 1−δ, yes if σ ≤ supp(D) and no if σ > (1+ε)supp(D). σ(cid:17)σ 1: Set α ← (cid:16)1 − 1 τ 2(cid:17) times do for m = O(cid:16) 1 2: Repeat the following O(log(1/δ)) times and return the majority vote. 3: loop 4: 4 , e−1], τ ← α(α− ε 2 − 1) = Θ(ε). Draw a subset S ⊆ [n] by including independently each x ∈ [n] with probability 1/σ. Draw x ∼ DS. Call Compare({x},{r}, η = 1 Record yes if Compare returned Low, no otherwise. 100m ) ⊲ Low if S ∩ supp(D) 6= ∅; ρ ∈ [ 1 2 , K = 1, 2 , 2) o.w. 1 5: 6: 7: 8: 9: end for 10: 11: end loop return yes if at least m(cid:0)α + τ 2(cid:1) "yes"'s were recorded, no otherwise. ⊲ Thresholding. Correctness. We condition on all calls to Compare being correct: by a union bound, this overall happens with probability at least 99/100. We shall consider the two cases σ ≤ ω and σ > (1 + ε)ω, and focus on the difference of probability p of recording yes on Step 8 between the two, in any fixed of the m iterations. In both cases, note p is exactly (1 − 1/σ)ω. σ(cid:17)σ • If σ ≤ ω, then we have p ≤ (cid:16)1 − 1 σ(cid:17)σ/(1+ε) • If σ > (1 + ε)ω, then p > (cid:16)1 − 1 = α. > (cid:16)1 − 1 σ(cid:17)σ(1−ε/2) = α1−ε/2. As α ∈ [ 1 4 , e−1], the difference between the two is τ = α(α−ε/2 − 1) = Θ(ε). Thus, repeating the atomic test of Step 4 O(cid:0)1/τ 2(cid:1) before thresholding at Step 10 yields the right answer with constant probability, then brought to 1 − δ by the outer repeating and majority vote. Query complexity. Each call to Compare at Step 7 costs O(log m) queries, and is in total repeated O(m log(1/δ) times. By the setting of m and τ , the overall query complexity is therefore ε2 log 1 O(cid:16) 1 δ(cid:17). ε log 1 5.4 A Non-Adaptive Upper Bound In this section, we sketch how similar -- yet less involved -- ideas can be used to derive a non- adaptive upper bound for support-size estimation. For simplicity, we describe the algorithm for 2-approximation: adapting it to general (1 + ε)-approximation is straightforward. The high-level idea is to perform a simple binary search (instead of the double exponential search from the preceding section) to identify the greatest lower bound on the support size of the form k = 2j. For each guess k ∈ {2, 4, 8 . . . , n}, we pick uniformly at random a set S ⊆ [n] of cardinality k, and check whether DS is uniform using the non-adaptive tester of Chakraborty et al. [CFGM16, Theorem 4.1.2]. If DS is found to be uniform for all values of k, we return n as our estimate (as the distribution is close to uniform on [n]); otherwise, we return n/k, for the smallest k on which DS was found to be far from uniform. Indeed, DS can only be far from uniform if S contains points from the support of D, which intuitively only happens if n/k = Ω(1). To be more precise, the algorithm proceeds as follows, where τ > 0 is an absolute constant. 35 for all k ∈ {2, 4, . . . , n} do Set a counter ck ← 0. for m = O(log log n) times do Pick uniformly at random a set S ⊆ [n] of k elements. Test (non-adaptively) uniformity of DS on S, with the tester of [CFGM16]. if the tester rejects then increment ck. end if end for if ck > τ · m then return ω ← n k . end if end for return ω ← n. The query complexity is easily seen to be poly log n, from the O(log n) calls to the poly(log n) tester of [CFGM16, Theorem 4.1.2]. As for correctness, it follows from the fact that for any set S with mass D(S) > 0 which contains at least an η fraction of points outside the support, it holds that DS is η-far from US. Acknowledgments. Cl´ement Canonne would like to thank Dana Ron and Rocco Servedio for the many helpful discussions and remarks that influenced the lower bound construction of Section 3. The authors are grateful to L´aszl´o Babai, Robert Krauthgamer, and the anonymous reviewers for their helpful and detailed comments. References [ACK15] Jayadev Acharya, Cl´ement L. Canonne, and Gautam Kamath. Adaptive estimation in weighted group testing. In IEEE Internat. Symp. Information Theory (ISIT'15), 2015. [AD11] Anne Auger and Benjamin Doerr. Theory of Randomized Search Heuristics: Founda- tions and Recent Developments. Series on theoretical computer science. World Scientific, 2011. [ADJ+11] Jayadev Acharya, Hirakendu Das, Ashkan Jafarpour, Alon Orlitsky, and Shengjun Pan. Competitive closeness testing. In Proc. 24th Ann. Conf. on Learning Theory (COLT'11), volume 19 of JMLR Proceedings, pages 47 -- 68. JMLR.org, 2011. Accessible at JMLR. [ADJ+12] Jayadev Acharya, Hirakendu Das, Ashkan Jafarpour, Alon Orlitsky, Shengjun Pan, and In Proc. Ananda Theertha Suresh. Competitive classification and closeness testing. 25th Ann. Conf. on Learning Theory (COLT'12), pages 22.1 -- 22.18, 2012. Accessible at JMLR. [BBBY12] Maria-Florina Balcan, Eric Blais, Avrim Blum, and Liu Yang. Active property testing. In Proc. 53rd FOCS, pages 21 -- 30. IEEE Comp. Soc. Press, 2012. [BFF+01] Tugkan Batu, Eldar Fischer, Lance Fortnow, Ravi Kumar, Ronitt Rubinfeld, and Patrick White. Testing random variables for independence and identity. In Proc. 42nd FOCS, pages 442 -- 451. IEEE Comp. Soc. Press, 2001. 36 [BFR+00] Tugkan Batu, Lance Fortnow, Ronitt Rubinfeld, Warren D. Smith, and Patrick White. Testing that distributions are close. In Proc. 41st FOCS, pages 189 -- 197. IEEE Comp. Soc. Press, 2000. This is a preliminary version of [BFR+10]. [BFR+10] Tugkan Batu, Lance Fortnow, Ronitt Rubinfeld, Warren D. Smith, and Patrick White. Testing closeness of discrete distributions. (abs/1009.5397), 2010. This is a long version of [BFR+00]. [BFRV11] Arnab Bhattacharyya, Eldar Fischer, Ronitt Rubinfeld, and Paul Valiant. Testing monotonicity of distributions over general partial orders. In Proc. 2nd Conf. on Inno- vations in Theoret. Comput. Sci. (ITCS'11), pages 239 -- 252, 2011. [BKR04] Tugkan Batu, Ravi Kumar, and Ronitt Rubinfeld. Sublinear algorithms for testing In Proc. 36th STOC, pages 381 -- 390. ACM monotone and unimodal distributions. Press, 2004. [Can15] Cl´ement L. Canonne. A Survey on Distribution Testing: your data is Big, but is it Blue? Electron. Colloq. on Comput. Complexity (ECCC), April 2015. [CDVV14] Siu-On Chan, Ilias Diakonikolas, Gregory Valiant, and Paul Valiant. Optimal algo- rithms for testing closeness of discrete distributions. In Proc. 25th Ann. ACM-SIAM Symp. on Discrete Algorithms (SODA'14), pages 1193 -- 1203. ACM Press, 2014. [CFGM16] Sourav Chakraborty, Eldar Fischer, Yonatan Goldhirsh, and Arie Matsliah. On the power of conditional samples in distribution testing. SIAM J. Comput., 45(4):1261 -- 1296, 2016. Preliminary version in ITCS'13. [Chv79] Vasek Chv´atal. The tail of the hypergeometric distribution. Discrete Mathematics, 25(3):285 -- 287, 1979. [CJSA14] Chun Lam Chan, Sidharth Jaggi, Venkatesh Saligrama, and Samar Agnihotri. Non- adaptive group testing: Explicit bounds and novel algorithms. IEEE Trans. Inform. Theory, 60(5):3019 -- 3035, 2014. Preliminary version in ISIT'12. [CR14] Cl´ement L. Canonne and Ronitt Rubinfeld. Testing probability distributions under- In Proc. 41st Internat. Colloq. on Automata, Languages and lying aggregated data. Programming (ICALP'14), pages 283 -- 295. Springer, 2014. [CRS15] Cl´ement L. Canonne, Dana Ron, and Rocco A. Servedio. Testing probability distribu- tions using conditional samples. SIAM J. Comput., 44(3):540 -- 616, 2015. [Das05] Sanjoy Dasgupta. Analysis of a greedy active learning strategy. In Proc. Advances in Neural Information Processing Systems (NIPS'05), pages 337 -- 344. MIT Press, 2005. [DH00] Dingzhu Du and Frank K. Hwang. Combinatorial Group Testing and Its Applications. Applied Mathematics. World Scientific, 2000. [Dor43] Robert Dorfman. The detection of defective members of large populations. Ann. Math. Statist., 14(4):436 -- 440, 12 1943. [DR96] Devdatt P. Dubhashi and Desh Ranjan. Balls and Bins: A Study in Negative Depen- dence. Random Structures Algorithms, 13:99 -- 124, 1996. 37 [Fis01] Eldar Fischer. The art of uninformed decisions: A primer to property testing. Bulletin of the European Association for Theoretical Computer Science, 75:97 -- 126, 2001. [FJO+15] Moein Falahatgar, Ashkan Jafarpour, Alon Orlitsky, Venkatadheeraj Pichapathi, and Ananda Theertha Suresh. Faster algorithms for testing under conditional sampling. In Proc. 28th Ann. Conf. on Learning Theory (COLT'15), JMLR Proceedings, pages 607 -- 636, 2015. [GMV06] Sudipto Guha, Andrew McGregor, and Suresh Venkatasubramanian. Streaming and sublinear approximation of entropy and information distances. In Proc. 17th Ann. ACM-SIAM Symp. on Discrete Algorithms (SODA'06), pages 733 -- 742. ACM Press, 2006. [Gol10] Oded Goldreich, editor. Property Testing: Current Research and Surveys. Springer, 2010. LNCS 6390. [GR00] Oded Goldreich and Dana Ron. On testing expansion in bounded-degree graphs. Tech- nical report, Electron. Colloq. on Comput. Complexity (ECCC), 2000. [ILR12] Piotr Indyk, Reut Levi, and Ronitt Rubinfeld. Approximating and Testing k-Histogram Distributions in Sub-linear Time. In Proc. 31st Symp. on Principles of Database Systems (PODS'12), pages 15 -- 22, 2012. [LRR13] Reut Levi, Dana Ron, and Ronitt Rubinfeld. Testing properties of collections of distri- butions. Theory of Computing, 9(8):295 -- 347, 2013. [MR95] Rajeev Motwani and Prabhakar Raghavan. Randomized Algorithms. Cambridge Uni- versity Press, New York, NY, USA, 1995. [ND00] Hung Q. Ngo and Ding-Zhu Du. A Survey on Combinatorial Group Testing Algorithms with Applications to DNA Library Screening. In DIMACS Ser. in Discr. Math. and Theoret. Comput. Sci., 2000. [Pan08] Liam Paninski. A coincidence-based test for uniformity given very sparsely sampled discrete data. IEEE Trans. Inform. Theory, 54(10):4750 -- 4755, 2008. [Ron08] Dana Ron. Property Testing: A Learning Theory Perspective. Foundations and Trends in Machine Learning, 1(3):307 -- 402, 2008. Preliminary version in COLT'07. [Ron10] Dana Ron. Algorithmic and analysis techniques in property testing. Found. Trends Theor. Comput. Sci., 5:73 -- 205, 2010. [RRSS09] Sofya Raskhodnikova, Dana Ron, Amir Shpilka, and Adam Smith. Strong lower bounds for approximating distributions support size and the distinct elements problem. SIAM J. Comput., 39(3):813 -- 842, 2009. Preliminary version in FOCS'07. [RS09] Ronitt Rubinfeld and Rocco A. Servedio. Testing monotone high-dimensional distribu- tions. Random Structures Algorithms, 34(1):24 -- 44, January 2009. Preliminary version in STOC'05. [RT16] Dana Ron and Gilad Tsur. The power of an example: Hidden set size approximation using group queries and conditional sampling. ACM Trans. Comput. Theory, 8(4):15:1 -- 15:19, 2016. 38 [Rub12] Ronitt Rubinfeld. Taming Big Probability Distributions. XRDS, 19(1):24 -- 28, Septem- ber 2012. [Set09] Burr Settles. Active learning literature survey. Computer Sciences Technical Report 1648, University of Wisconsin -- Madison, 2009. [Sto85] Larry J. Stockmeyer. On approximation algorithms for #P. SIAM J. Comput., 14(4):849 -- 861, 1985. [Sub] List of Open Problems in Sublinear Algorithms: Problem 66. Bertinoro Work- shop on Sublinear Algorithms 2014 (suggested by Eldar Fischer). Available at http://sublinear.info/66. [Val11] Paul Valiant. Testing symmetric properties of distributions. SIAM J. Comput., 40(6):1927 -- 1968, 2011. Preliminary version in STOC'08. [VV10a] Gregory Valiant and Paul Valiant. A CLT and tight lower bounds for estimating entropy. Electron. Colloq. on Comput. Complexity (ECCC), 2010. [VV10b] Gregory Valiant and Paul Valiant. Estimating the unseen: A sublinear-sample canonical estimator of distributions. Electron. Colloq. on Comput. Complexity (ECCC), 2010. [VV11] Gregory Valiant and Paul Valiant. The power of linear estimators. In Proc. 52nd FOCS, pages 403 -- 412, October 2011. See also [VV10a] and [VV10b]. [VV17] Gregory Valiant and Paul Valiant. An automatic inequality prover and instance opti- mal identity testing. SIAM J. Comput., 46(1):429 -- 455, 2017. Preliminary version in FOCS'14. [Wik17] Wikipedia. Yes, Virginia, there is a Santa Claus -- Wikipedia, The Free Encyclopedia, 2017. https://en.wikipedia.org/w/index.php?title=Yes,_Virginia,_there_is_a_Santa_Claus&oldid=805832621 [Online; accessed 05-November-2017]. 39
1612.00958
1
1612
2016-12-03T11:34:53
Reconfiguring Ordered Bases of a Matroid
[ "cs.DS", "math.CO" ]
For a matroid with an ordered (or "labelled") basis, a basis exchange step removes one element with label $l$ and replaces it by a new element that results in a new basis, and with the new element assigned label $l$. We prove that one labelled basis can be reconfigured to another if and only if for every label, the initial and final elements with that label lie in the same connected component of the matroid. Furthermore, we prove that when the reconfiguration is possible, the number of basis exchange steps required is $O(r^{1.5})$ for a rank $r$ matroid. For a graphic matroid we improve the bound to $O(r \log r)$.
cs.DS
cs
Reconfiguring Ordered Bases of a Matroid Anna Lubiw∗ Vinayak Pathak∗ November 5, 2018 Abstract For a matroid with an ordered (or "labelled") basis, a basis exchange step removes one element with label l and replaces it by a new element that results in a new basis, and with the new element assigned label l. We prove that one labelled basis can be reconfigured to another if and only if for every label, the initial and final elements with that label lie in the same connected component of the matroid. Furthermore, we prove that when the reconfiguration is possible, the number of basis exchange steps required is O(r1.5) for a rank r matroid. For a graphic matroid we improve the bound to O(r log r). 1 Introduction Broadly speaking, "reconfiguration" is about changing one structure to a related one via discrete steps. Examples include changing one triangulation of a point set in the plane to another via "flips", or changing one independent set of a graph to another by adding/deleting single vertices. More broadly, other examples are to sort a list by swapping pairs of adjacent elements, or to change a basic solution of a linear program to an optimum one via pivots. Central questions are: to test whether one configuration can be changed to another using the discrete steps; and to compute, or bound, the number of steps required. Reconfigura- tion problems have been considered for a long time, and explicit attention was drawn to complexity issues by Ito et al. [5] and by van den Heuvel [4]. A fundamental result about matroids is that any basis B can be reconfigured to any other basis B(cid:48) using a sequence of basis exchange steps. In each basis exchange one element of the current basis is replaced by a new element to yield a new basis. The number of basis exchange steps needed to reconfigure B to B(cid:48) is the difference B − B(cid:48). In this paper we explore a "labelled" version of basis reconfiguration where the elements of each of the two initial bases are labelled with unique labels from {1, . . . , r}, where r is the rank of the matroid. For a basis exchange in this labelled setting, the new element gets the same label as the replaced element. More precisely, if l is the labelling function on B and e ∈ B is replaced with e(cid:48) ∈ E \ B, then e(cid:48) gets assigned the label l(e). In standard matroid terminology, a "labelled" basis is an "ordered" basis. We consider two questions: 1 1. When can one labelled basis of a matroid be reconfigured to another labelled basis of the matroid using a sequence of basis exchanges? 2. What is the number of basis exchanges needed in the worst case? Note that such labelled reconfiguration is not always possible -- for example, a matroid may have a single basis B, in which case there is no way to reconfigure from one labelling of B to a different labelling. Results. In this paper we prove that one labelled basis can be reconfigured to another if and only if for every label, the element with that label in the first basis and the element with that label in the second basis lie in the same connected component of the matroid. Equivalently, for a given basis, the permutations of labels achievable by sequences of basis exchange steps is a product of symmetric groups, one for each connected component of the matroid. Furthermore, we prove that if one labelled basis can be reconfigured to another then O(r1.5) basis exchange steps always suffice, where r is the rank of the matroid. In the special case of graphic matroids, our problem is the following: given two spanning trees of an n-vertex graph, with the edges of the spanning trees labelled with the labels {1, 2, . . . , n− 1}, reconfigure the first labelled spanning tree to the second via basis exchange steps. Reconfiguration is possible if and only if for every label, the edge with that label in the first spanning tree and the edge with that label in the second spanning tree lie in the same 2-connected component of the graph. This was proved by Hernando et al. [3]. In this case we can prove a tighter bound: O(n log n) basis exchange steps are always sufficient. The rest of the paper is organized as follows. Subsections 1.1 and 1.2 contain notation and background. In Section 2 we prove the results for graphic matroids, and in Section 3 we prove the results for general matroids. 1.1 Preliminaries For a matroid M of rank r, a labelled basis (or "ordered basis") is a tuple T = (B, l) where B is a basis and l : B → {1, . . . , r} is a function that assigns a unique label to each element of B. For label i, the element with that label is given by l−1(i). If a basis exchange step replaces e ∈ B with e(cid:48) ∈ E \ B, then e(cid:48) is assigned the label l(e). Two bases are said to be the same if they have the same elements and the elements are assigned the same labels. Matroid Properties. For basic definitions and properties of matroids, see Oxley [8]. In the remainder of this section, we summarize the properties that we will use. Note that we are now referring to standard unlabelled matroids. Recall the basis exchange property of matroids: Property 1. For any two bases B1 and B2 of a matroid M and an element x ∈ B1 − B2, there exists y ∈ B2 − B1 such that (B1 − {x}) ∪ {y} is also a basis. By Property 1 any basis of a matroid can be reconfigured into any other using at most r basis exchange steps. 2 The pairs of elements that can participate in exchanges can be characterized exactly. Let B be a basis. Adding an element e /∈ B to B creates a unique circuit C called the fundamental circuit of e with respect to B. [8, Exercise 5, Section 1.2] Given a basis B, and an element e /∈ B, let C Property 2. be the fundamental circuit of e with respect to B. Then the set of elements e(cid:48) such that (B − {e(cid:48)}) ∪ {e} is a basis are precisely the elements e(cid:48) ∈ C. The fundamental graph of basis B, denoted SB, is the bipartite graph with a vertex for each element of the matroid, and an edge (e, f ) for every e ∈ B and f ∈ E − B such that e, f form a basis exchange, i.e. (B − {e}) ∪ {f} is a basis. Note that the closed neighbourhood of f ∈ E − B is f 's fundamental circuit. For a matroid M with element set E and a set T ⊆ E, the matroid that results from contracting T is denoted M/T . Property 3. For matroid M, and sets T ⊆ E and X ⊆ E − T rM/T (X) = rM (X ∪ T ) − rM (T ). This property implies that we can augment an independent set as follows: Property 4. If T is independent in matroid M and A is independent in M/T then T ∪ A is independent in M . The concept of graph connectivity generalizes to matroids. For any matroid M , define the relation ψ on the elements of M by e ψ f if and only if either e = f or there exists a circuit of M that contains both e and f . It can be shown that the relation ψ is an equivalence relation and we say that each equivalence class defines a connected component. In the case of a graphic matroid, the equivalence classes are the 2-connected components or blocks of the graph. We will use Menger's theorem for graphs, see [10, chapter 9], which says that the max- imum number of vertex-disjoint paths from vertex s to vertex t is equal to the minimum number of vertices whose removal disconnects s and t. We will also use the generalization of Menger's theorem to matroids, which is known as Tutte's linking theorem [11], see [8]. The statement of this theorem will be given where we use it in Section 3.2. 1.2 Relationship to Triangulations Our present study of reconfiguring labelled matroid bases was prompted by related results on reconfiguring labelled triangulations [2]. The set of triangulations of a point set (or a simple polygon) in the plane has some matroid-like properties. In particular, given a point set P , let E be the set of all line segments d such that the endpoints of d are in P and no other point of P lies on d, and let I be the set of all subsets of pairwise non-crossing segments of E. Then the set system (E,I) is an independence system, but fails the third matroid axiom: if I1 and I2 are in I and 3 I2 > I1, there does not always exist an element e of I2 − I1 such that I1 ∪ {e} ∈ I. (As a simple example consider five points 1, 2, 3, 4, 5 in convex position where I1 contains segments (1, 3) and (1, 4) and I2 contains segment (2, 5).) However, the maximal sets in I all have the same cardinality -- this is because maximal sets of non-crossing segments correspond to triangulations and all triangulations contain the same number of edges. The failure of the third matroid axiom for triangulations means that the greedy algorithm does not in general find a minimum weight triangulation of a point set, and in fact the problem is NP-hard even for Euclidean weights [7]. On the other hand, triangulations share some of the reconfiguration properties of matroids -- any triangulation can be reconfigured to any other triangulation via a sequence of elementary exchange steps called "flips" where one segment is removed and a new segment (the oppo- site chord of the resulting quadrilateral, if it is convex) is added [1]. Furthermore, there is evidence that results analogous to the ones we prove here for reconfiguring labelled matroid bases carry over to labelled triangulations [2]. One intriguing possibility is a more general result that encompasses both the case of matroids and of triangulations. 2 Reconfiguring ordered bases of a graphic matroid In this section we concentrate on graphic matroids. We characterize when one labelled spanning tree of an n-vertex graph can be reconfigured to another labelled spanning tree of the graph. Our first result provides a bound of O(n2) exchange steps for the reconfiguration. In the second subsection we improve this to O(n log n). The first result (with the O(n2) bound) extends immediately to general matroids, but we give the details for the graphic matroid case for the sake of readers who may wish to learn only about labelled reconfiguration of spanning trees. 2.1 When are two ordered bases reconfigurable? Theorem 1. Given two labelled spanning trees T1 and T2 of an n-vertex graph G, we can reconfigure one to the other if and only if for each label i, the edge with that label in T1 and the edge with that label in T2 lie in the same 2-connected component of G. Moreover, when reconfiguration is possible, it can be accomplished with O(n2) basis exchange steps. Proof. The 'only if' direction is clear because an exchange of edge e to e(cid:48) can be performed only if both e and e(cid:48) lie in the same 2-connected component. For the 'if' direction, we will provide an explicit exchange sequence to reconfigure T1 to T2. First, pick any (unlabelled) spanning tree B and reconfigure both T1 and T2 to B while ignoring the labels. This takes O(n) exchange steps. Let σ1 be the sequence of exchanges that reconfigures T1 to B and σ2 be the sequence that reconfigures T2 to B. Obviously, the labels of the edges of B obtained from the two sequences will not match in general. Below, we give an exchange sequence σ of length at most O(n2) to rearrange the labels in B. Thus performing σ1 followed by σ followed by the reverse of σ2 reconfigures T1 to T2 with O(n2) exchange steps. 4 The problem is now reduced to the following: given one spanning tree B and two labellings of it, T1 = (B, l1) and T2 = (B, l2), reconfigure T1 to T2 using O(n2) exchanges. We will do this by repeatedly swapping labels. More precisely, let i be a label, let e1 = l−1 1 (i) be the edge with label i in T1 and let e2 = l−1 2 (i) be the edge with label i in T2, and suppose that e1 (cid:54)= e2. We will show that with O(n) exchanges we can swap the labels of e1 and e2 in T1 while leaving all other labels unchanged. This moves label i to the correct place for T2, and repeating over all labels solves the problem and takes O(n2) exchanges. Since e1 and e2 lie in the same 2-connected component of G (by hypothesis), there must exist a cycle C of G that goes through both e1 and e2. Let t be the number of edges of C \ B. Then t ≥ 1. We will argue by induction on t that 6t− 3 exchanges suffice to swap the labels of e1 and e2. Let f be an edge of C \ B. If f is the only edge of C \ B, then we can perform the swap directly: use Property 2 to exchange e1 with f , e2 with e1, and, finally, f with e2. This sequence returns us to B and swaps the labels of e1 and e2 while leaving all other labels unchanged. Thus the case of t = 1 can be solved with 3 exchanges. More generally, f is not the only edge of C \ B. Adding f to B creates a cycle C(cid:48) that must contain an edge f(cid:48) ∈ B \ C. Using Property 2 we exchange f with f(cid:48). The result is a new spanning tree B(cid:48) whose intersection with C is strictly increased, so C \ B(cid:48) is smaller. Also note that B(cid:48) contains e1 and e2. By induction, we can swap the labels of e1 and e2 in B(cid:48) with at most 6(t − 1) − 3 exchanges, leaving all other labels unchanged. After that, we exchange f(cid:48) and f to return to B with original labels except that the labels of e1 and e2 are now swapped. The total number of exchanges is at most 6(t − 1) − 3 + 6 = 6t − 3 2.2 Tightening the bound In this section we show that the O(n2) bound on the number of exchanges from the previous section can be improved. Note that the common spanning tree B we chose in the previous section, to reconfigure both T1 and T2 to, was completely arbitrary. We could have perhaps chosen a spanning tree that made the task of swapping labels easier. That is precisely what we do in this section. Observe that it is sufficient to consider a 2-connected graph G since for a general graph we can just repeat the argument inside each of its 2-connected components. We will construct a spanning tree B of G whose fundamental graph (as defined in Section 1.1) has diameter O(log n). This proves our result based on: Lemma 1. Let G be a 2-connected graph, and B be a spanning tree of G whose fundamental graph SB has diameter d. Then for any two edges of B there is an exchange sequence of length O(d) that swaps the labels of those two edges while leaving other labels unchanged. Proof. Let e and f be two edges of B, and suppose the shortest path between them in SB has length t < d. We will prove by induction on t that we can swap the labels of e and f with 3t − 3 exchanges. Let e1 and e2 be the two vertices that occur immediately after e on a shortest path from e to f in SB. Then the cycle formed by adding e1 to B contains both e and e2 by Property 2, and by the same property, we can perform the following exchanges: 5 e1 with e, then e2 with e1, then e with e2. This exchange sequence returns us to B while swapping the labels of e and e2, and leaving other labels unchanged. In the basis case of the induction t = 2 and e2 = f and this completes the swap with 3 exchanges. In the general case, the distance between e2 and f in SB is t − 2. By induction, we can swap the labels of e2 and f with 3(t− 2)− 3 exchanges. After that we repeat the first 3 exchanges to complete the swap of the labels of e and f . All other labels are unchanged. The total number of exchanges is 6 + 3(t − 2) − 3 = 3t − 3. Thus it remains to construct a spanning tree B such that the diameter of SB is O(log n). We will construct our spanning tree by repeatedly contracting cycles. For a 2-connected graph G with edge set E(G) and for a cycle C ⊆ E(G), let G/C denote the graph obtained by contracting C. Note that E(G/C) = E(G) − E(C). Contracting C creates blocks that are the maximal subgraphs of G/C that are 2-connected. In order to get a bound on the diameter of SB we will need the following: Lemma 2. Any 2-connected graph G with m edges contains a cycle C such that all blocks of G/C have at most m/2 edges. Proof. Let C be the cycle that minimizes the size of the largest block obtained upon con- tracting it. We claim that all blocks of G/C have at most m/2 edges. Suppose not. Then there exists a block H of size bigger than m/2. We will derive a contradiction. Some edges of E(H) are incident on vertices of C in G; let those vertices be {v1, . . . , vk} in clockwise order along C. There are two paths between v1 and v2 along the cycle C in G, one clockwise and one counterclockwise. Let P be the one that is counterclockwise and thus contains all vertices of {v1, . . . , vk}. There also exists a path P (cid:48) between v1 and v2 that uses only the vertices of H. We define C(cid:48) to be P ∪ P (cid:48). We claim that the size of the largest block of G/C(cid:48) is smaller than the size of the largest block of G/C, hence reaching a contradiction. First, note that no block of G/C(cid:48) contains an edge of H and an edge not in H. For consider edges e and e(cid:48) in G/C(cid:48) with e in H and e(cid:48) not in H. Any path from e to e(cid:48) in G must go through a vertex of C, and in particular, must go through a vertex of P , since P contains all vertices of C that have an edge of H incident to them. Because C(cid:48) contains all of P , therefore e and e(cid:48) are in different blocks of G/C(cid:48). Now G/C(cid:48) contains two kinds of blocks: those that contain edges of H and those that do not. Blocks of the first kind must have size at most the size of H from the argument above. In fact, they must be strictly smaller than H since C(cid:48) contains at least one edge of H. Blocks of the second kind must also be smaller than H since at worst, such a block contains all edges of G that are not edges of H, and there are at most m/2 such edges. We are now ready to construct our spanning tree B. Lemma 3. Given a 2-connected graph G, there exists a spanning tree B such that the diameter of SB is O(log n). Proof. The algorithm for constructing B proceeds in iterations i = 1, 2, . . .. In iteration i we will add a set Bi to B. In the first iteration we find the cycle C of Lemma 2 such that all 6 Figure 1: Adding a minimal set of edges P (in dashed red) to create a 2-connection between Bi−1 (thick edges) and C i (thin edges). P may consist of two, one, or zero disjoint paths as shown in (a), (b), or (c), respectively. blocks of G/C are of size at most m/2. Let B1 be all edges but one of C, and contract those edges (equivalently, contract C) thus breaking the graph G into several blocks. In general, in any iteration, we start with the collection of blocks produced in the previous iteration, contract a connected set of edges inside each block, and add those edges to Bi. After each contraction we eliminate loops and parallel edges. Each iteration reduces the number of vertices of G by contracting a set of edges. The algorithm terminates once the graph G is left with just one vertex. We now describe what happens to one of the blocks that is dealt with in iteration i. For i ≥ 2, let H i−1 be a block at the beginning of iteration i − 1, and let Bi−1 be the edges of H i−1 that we contract and add to B in the (i − 1)st iteration. Let b be the vertex that Bi−1 gets contracted to, and let H i be one of the blocks formed by the contraction. Then in iteration i, we pick the edges of H i to be contracted and added to Bi, as follows. Let C i be the cycle of Lemma 2 for H i. Observe that C i may or may not include vertex b. Let e be an edge of C i. As in the first iteration, we will add to Bi all edges of C i except e. However, we may need to add more edges in order to maintain connectivity of B, and to ensure that SB has small diameter. In H i−1 the sets of edges Bi−1 and C i are disjoint. We will use the fact that H i−1 is 2-connected and apply Menger's Theorem, see [10, chapter 9], to find a set of edges that connect Bi−1 and C i. More precisely, let s be a new vertex adjacent to all endpoints of edges in Bi−1 and t be a new vertex adjacent to all endpoints of edge in C i. Because H i−1 is 2-connected, we must remove at least 2 vertices to disconnect s and t. Then, by Menger's Theorem, there are two internally vertex-disjoint paths from s to t. Let P be a minimal set of edges of H i−1 that form two such paths. Note that if C i includes vertex b, one or both of the paths will have no edges of H i−1. See Figure 1. Observe that the two paths of P go from two distinct vertices that are joined by a path in Bi−1 to two distinct vertices that are joined by a path in C i − {e}. Thus, a cycle, D, is formed by P together with a non-empty subset of Bi−1 and a non-empty subset of C i −{e}. Let f be an edge of P (if P is non-empty). By minimality of P , there is no cycle in P −{f}. Add to Bi the set (C i − {e}) ∪ (P − {f}). This completes the description of how we handle 7 Bi -1Ci Bi -1Ci e ffe Bi -1Ci e (a)(b)(c) one block in iteration i. We handle other blocks the same way, adding further edges to Bi for each other block. This completes the description of the algorithm. To establish the correctness of the algorithm, first note that after each iteration B = ∪i j=1Bj is connected and contains no cycle. Thus, when the algorithm terminates, B spans all vertices of G and contains no cycle. It remains to prove that the diameter of SB is O(log n). In each iteration of the algorithm, we reduce the size of each block by at least half, and thus the algorithm terminates in at most O(log n) iterations. To complete the proof we will show that for each i, every edge in Bi has a path of length O(1) in SB to some edge in Bi−1. Referring to the step of the construction described above, note that the fundamental circuit of e in Bi contains all of C i. Thus e is joined by an edge of SB to every edge of C i. If P is empty, then the fundamental circuit of e also includes an edge of Bi−1 and we are done. Otherwise, the fundamental circuit of f in B contains all of D, which includes all of P together with at least one edge of C i and at least one edge of Bi−1. Thus f is joined by an edge of SB to every edge of P , and to at least one edge of C i and to at least one edge of Bi−1. Therefore, in SB every edge of Bi is within distance 4 of some edge of Bi−1. Lemmas 1, 2, and 3 give us the following strengthened form of Theorem 1. Theorem 2. If T1 and T2 are two labelled spanning trees of an n-vertex graph G and for each label i, the edge with that label in T1 and the edge with that label in T2 lie in the same 2-connected component of G then we can reconfigure T1 to T2 using O(n log n) basis exchange steps. 3 Reconfiguring ordered bases of a general matroid In this section we turn to general matroids. We generalize the result of the previous sec- tion that characterizes when one labelled basis of a rank r matroid can be reconfigured to another labelled basis of the matroid and prove a bound of O(r2) exchange steps for the reconfiguration. In the second subsection we improve this bound to O(r1.5), a weaker bound than was possible for graphic matroids. 3.1 Connectivity Our goal is to follow the proof of Theorem 1, which used edge contraction, cycles, and 2-connectivity in a graph. Observe that contraction of edges in a graph corresponds to contraction of elements in a matroid, cycles in a graph correspond to circuits in a matroid, and 2-connectivity in a graph corresponds to connectivity in a matroid (every pair of elements is contained in some circuit). With these correspondences, it is easy to check that every step of the proof of Theorem 1 goes through for matroids and thus we get the following theorem, which we state without proof. 8 Theorem 3. Given two labelled bases T1 and T2 of a rank r matroid M , we can reconfigure one to the other if and only if for each label i, the element with that label in T1 and the element with that label in T2 lie in the same block of M . Moreover, when reconfiguration is possible, it can be accomplished with O(r2) basis exchange steps. 3.2 A tighter bound for general matroids In order to tighten the O(r2) bound on the number of exchanges needed for labelled basis reconfiguration in general matroids, we would like to follow the approach we used for graphic matroids in Section 2.2. Lemma 1 carries over directly so it suffices to build a basis B whose fundamental graph SB has small diameter. For graphic matroids of rank r, we achieved √ diameter O(log r) but for general matroids we will only achieve a weaker bound of diameter r). Our starting point for graphic matroids was Lemma 2 which proved that there is a O( cycle whose contraction cuts the size of a block in half. For general matroids the analogous result is conjectured to be true, but we must rely on the following weaker result, attributed to Seymour, and with an explicit proof in [6, Corollary 1.4]. Lemma 4. Let C be the biggest circuit of a connected matroid M . Then the biggest circuit of M/C is strictly smaller than C. Using this lemma we can follow the approach we used for graphic matroids to prove the following bound. Theorem 4. If T1 and T2 are two labelled bases of a rank r matroid M and for each label i, the element with that label in T1 and the element with that label in T2 lie in the same connected component of M then we can reconfigure T1 to T2 using O(r1.5) basis exchange steps. Proof. Following the idea of the proof of Theorem 2, we will prove the bound by showing √ that every connected component of the matroid has a basis B whose fundamental graph SB r). We do this using almost exactly the algorithm of Lemma 3 with one has diameter O( difference: instead of picking the cycle of Lemma 2 in each block in each iteration, we will pick the biggest circuit and use Lemma 4. As before, the algorithm for constructing B proceeds in iterations i = 1, 2, . . .. In iteration i we will add a set Bi to B. In the first iteration we find the the largest circuit C in M and let B1 be all elements but one of C. We contract those elements, thus breaking the matroid into several connected components. In general, in any iteration i, we start with the collection of connected components produced in the previous iteration, contract some elements inside each component, and add those elements to Bi. After each contraction we eliminate loops and parallel elements. Each iteration reduces the number of elements of M and the algorithm terminates when no elements are left. We now describe what happens to one of the connected components that is dealt with in iteration i. For i ≥ 2, let H i−1 be a connected component at the beginning of iteration i − 1, and let Bi−1 be the elements of H i−1 that we contract and add to B in the (i − 1)st 9 iteration. Let H i be one of the connected components formed by the contraction. Then in iteration i, we pick the elements of H i to be contracted and added to Bi, as follows. Let C i be the biggest circuit of H i and let e be an element of C i. As before, we will put C i − {e} into Bi, but, as before, we may need to add elements to connect the independent set Bi−1 with the circuit C i. We will be working in the matroid H i−1 which we abbreviate as H. Since C i is a circuit in H i, we have C i−1 = rH i(C i). Now, H i is a connected component of H/Bi−1, so by Property 3, rH i(C i) = rH(C i ∪ Bi−1) − rH(Bi−1). Thus rH(C i ∪ Bi−1) = Bi−1 + C i − 1, which means that C i ∪ Bi−1 has co-rank 1 and contains a unique circuit. If C i is independent in H then C i ∪ Bi−1 has a circuit formed by the elements of C i In this case we add to Bi the set C i − {e}. together with at least one element of Bi−1. Observe that this set is independent in H and that the fundamental circuit of e contains all elements of C i−1 and at least one element of Bi−1. In the graphic case, this corresponds to Figure 1 (right). We will prove below that Bi has the properties we need. Otherwise, C i is not independent in H. In this case, the circuit in C i ∪ Bi−1 is C i, and we will need to add more elements to Bi in order to connect Bi−1 with C i. We will use the matroid analogue of Menger's Theorem which is known as Tutte's Linking Theorem [11]. This theorem applies to two disjoint sets of elements in a matroid. In our case the matroid is H, and the disjoint sets are Bi−1 and C i − {e}, both of which are independent in H. To ease notation, let A = C i − {e}. The analogue of a separating set of vertices is κH(Bi−1, A), defined as the minimum, over sets X that contain Bi−1 and exclude A, of rH(X) + rH(E − X) − rH(E). Since H is connected, this minimum is at least 1. In notation, we have: κH(Bi−1, A) = min Bi−1⊆X⊆E\A rH(X) + rH(E − X) − rH(E) ≥ 1. The analogue of vertex-disjoint paths in Menger's theorem is (cid:117)H/P (Bi−1, A), defined as the maximum over sets P , of rH/P (Bi−1) + rH/P (A) − rH/P (Bi−1 ∪ A). According to the version of Tutte's Linking Theorem stated as equation (8.16) in Ox- ley [8], there exists a set of elements P such that (cid:117)H/P (Bi−1, A) = κH(Bi−1, A). (1) As in the proof of the generalization of Tutte's Linking Theorem due to Geelen, Gerards, and Whittle [8, proof of Theorem 8.5.7], we will choose P to be a minimal set such that equation (1) holds. As shown in their proof, such a minimal P is independent, and is skew to Bi−1 and A. Two sets are skew if the rank of their union is the sum of their ranks. In our case, Bi−1 and A are independent, so skewness implies that Bi−1 ∪ P and A ∪ P are independent. Applying Property 3 to (cid:117)H/P (Bi−1, A) yields (cid:117)H/P (Bi−1, A) = rH(Bi−1 ∪ P ) + rH(A ∪ P ) − rH(P ) − rH(Bi−1 ∪ A ∪ P ). (2) 10 When P is independent and skew to Bi−1 and A this becomes: (cid:117)H/P (Bi−1, A) = Bi−1 + A + P − rH(Bi−1 ∪ A ∪ P ). (3) From this, it is clear that if the value of equation (1) is greater than 1, then we can delete elements of P to obtain a minimal P with (cid:117)H/P (Bi−1, A) = 1. For the remainder of the proof we define P to be a minimal set with (cid:117)H/P (Bi−1, A) = 1. From equation (3) we know that Bi−1 ∪ A∪ P has co-rank 1. There must be a unique circuit D in Bi−1∪A∪P and D must contain all elements of P (by minimality of P ) and at least one element of Bi−1 (since A ∪ P is independent) and at least one element of A (since Bi−1 ∪ P is independent). Let f be an element of P and add to Bi the set (C i − {e}) ∪ (P − {f}). Observe that this set is independent in H. The fundamental circuit of e contains all the elements of C i, and the fundamental circuit of f contains all the elements of P and at least one element of Bi−1 and at least one element of C i. Before proceeding with the proof we will mention why the above analysis was separated into two cases depending on whether or not C i is independent in H. Observe that if C i is independent in H, then the minimal set P that connects Bi−1 and C i−{e} is in fact P = {e} itself, and when we choose f to be an element of P then f = e. It would be rather strange in this case (though strictly speaking, correct) to say that we add (C i − {e}) ∪ (P − {f}) to Bi. That is why we treated the case where C i is independent in H as a separate case. To complete the proof of the Theorem we must show that the final B, defined as ∪Bi, is a √ r). Since we continue until everything is contracted basis and that the diameter of SB is O( away, it is clear that B spans the matroid. Because each Bi is independent after contracting all Bj for j < i, Property 4 implies that B is independent in the matroid M . Thus B is a basis. √ We now analyze the diameter of SB. We first observe that the algorithm terminates in √ r) iterations. This is because the number of possible iterations for which there exists r) and once the size of the r) more √ O( √ a block containing a circuit of size Ω( biggest circuit in each block has been reduced to O( iterations. To complete the proof we will show that for each i, every edge in Bi has a path of length O(1) in SB to some edge in Bi−1. We will refer to the step of the construction described above. As noted above, the fundamental circuit of e in B contains all of C i. Thus e is joined by an edge of SB to every element of C i. If P is empty, then the fundamental circuit of e also includes an element of Bi−1 and we are done. Otherwise, as noted above, the fundamental circuit of f in B contains all of P together with at least one element of C i and at least one element of Bi−1. Thus f is joined by an edge of SB to every element of P , and to at least one element of C i and to at least one element of Bi−1. Therefore, in SB every element of Bi is within distance 4 of some element of Bi−1. r) can be at most O( √ r), there can be at most O( 11 4 Conclusion We studied the reconfiguration of labelled bases of a rank r matroid and provided an upper bound of O(r log r) on the worst-case reconfiguration distance for graphic matroids, and a bound of O(r1.5) for general matroids. The obvious next question is whether this is tight. The only lower bound we have so far is Ω(r). Another natural question is to find the minimum number of basis exchange steps needed to transform one given labelled basis to another. It an open question whether this problem is NP-hard or polynomial-time solvable. Acknowledgements We could not have proved these results without major help from Jim Geelen. The results first appeared in the second author's PhD thesis [9]. Theorem 1 was proved jointly with Sander Vendonschot and Prosenjit Bose. References [1] P. Bose and F. Hurtado. Flips in planar graphs. Computational Geometry: Theory and Applications 42:60 -- 80, 2009, doi:10.1016/j.comgeo.2008.04.001. [2] P. Bose, A. Lubiw, V. Pathak, and S. Verdonschot. Flipping edge-labelled triangula- tions. CoRR, 2013, arXiv:1310.1166v2. [3] C. Hernando, F. Hurtado, M. Mora, and E. Rivera-Campo. Grafos de ´arboles etique- tados y grafos de ´arboles geom´etricos etiquetados. Proc. X Encuentros de Geometra Computacional, pp. 13-19, 2003. [4] J. van den Heuvel. The complexity of change. Surveys in Combinatorics, vol. 409, pp. 127 -- 160. Cambridge University Press, 2013. [5] T. Ito, E. D. Demaine, N. J. A. Harvey, C. H. Papadimitriou, M. Sideri, R. Uehara, and Y. Uno. On the complexity of reconfiguration problems. Theoretical Computer Science 412(12):1054 -- 1065, 2011, doi:10.1016/j.tcs.2010.12.005. [6] N. McMurray, T. J. Reid, B. Wei, and H. Wu. Largest circuits in matroids. Advances in Applied Mathematics 34(1):213 -- 216, 2005, doi:10.1016/j.aam.2004.09.002. [7] W. Mulzer and G. Rote. Minimum-weight triangulation is NP-hard. J. ACM 55(2):11:1 -- 11:29, 2008, doi:10.1145/1346330.1346336. [8] J. Oxley. Matroid Theory, second edition. Oxford University Press, 2011. [9] V. Pathak. Reconfiguring Triangulations. Ph.D. thesis, University of Waterloo, 2014. 12 [10] A. Schrijver. Combinatorial Optimization: Polyhedra and Efficiency. Springer, 2002. [11] W. T. Tutte. Menger's theorem for matroids. J. Res. Nat. Bur. Standards Sect. B 69:49 -- 53, 1965. 13
1802.09333
1
1802
2018-02-20T04:06:33
The Cut and Dominating Set Problem in A Steganographer Network
[ "cs.DS", "cs.MM" ]
A steganographer network corresponds to a graphic structure that the involved vertices (or called nodes) denote social entities such as the data encoders and data decoders, and the associated edges represent any real communicable channels or other social links that could be utilized for steganography. Unlike traditional steganographic algorithms, a steganographer network models steganographic communication by an abstract way such that the concerned underlying characteristics of steganography are quantized as analyzable parameters in the network. In this paper, we will analyze two problems in a steganographer network. The first problem is a passive attack to a steganographer network where a network monitor has collected a list of suspicious vertices corresponding to the data encoders or decoders. The network monitor expects to break (disconnect) the steganographic communication down between the suspicious vertices while keeping the cost as low as possible. The second one relates to determining a set of vertices corresponding to the data encoders (senders) such that all vertices can share a message by neighbors. We point that, the two problems are equivalent to the minimum cut problem and the minimum-weight dominating set problem.
cs.DS
cs
The Cut and Dominating Set Problem in A Steganographer Network Hanzhou Wu1†, Wei Wang1‡, Jing Dong1‡, Hongxia Wang2 and Lizhi Xiong3 1Institute of Automation, Chinese Academy of Sciences, Beijing 100190, China 2School of Inf. Sci. & Technol., Southwest Jiaotong U., Chengdu 611756, China 3School of Comp. & Softw., Nanjing U. of Inf. Sci. & Technol., Nanjing 210044, China † [email protected], ‡{wwang,jdong}@nlpr.ia.ac.cn 8 1 0 2 b e F 0 2 ] S D . s c [ 1 v 3 3 3 9 0 . 2 0 8 1 : v i X r a Abstract. A steganographer network corresponds to a graphic struc- ture that the involved vertices (or called nodes) denote social entities such as the data encoders and data decoders, and the associated edges represent any real communicable channels or other social links that could be utilized for steganography. Unlike traditional steganographic algo- rithms, a steganographer network models steganographic communication by an abstract way such that the concerned underlying characteristics of steganography are quantized as analyzable parameters in the network. In this paper, we will analyze two problems in a steganographer network. The first problem is a passive attack to a steganographer network where a network monitor has collected a list of suspicious vertices correspond- ing to the data encoders or decoders. The network monitor expects to break (disconnect) the steganographic communication down between the suspicious vertices while keeping the cost as low as possible. The second one relates to determining a set of vertices corresponding to the data encoders (senders) such that all vertices can share a message by neigh- bors. We point that, the two problems are equivalent to the minimum cut problem and the minimum-weight dominating set problem. Keywords: Steganographer network, steganography, steganalysis, cut, dominating set, graph, social networks. 1 Introduction Steganography [1] has been extensively studied in past twenty years. As a means to secret communication, different from cryptography, steganography refers to the art of hiding a message into an innocent digital object also called cover by slightly modifying the noise-like components of the host. The resulting object also called stego will not introduce any noticeable artifacts and will be sent to the receiver. As steganography even conceals the presence of communication, it serves an important role in information security nowadays. A number of advanced steganographic algorithms and novel perspectives have been reported in the literature such as [2], [3], [4], [5], [6], [7], [8], [9], [10]. A most important requirement [8] for any reliable steganographic system is that it should 2 H. Wu et al. be impossible (or say very hard) for an eavesdropper to distinguish between ordinary objects and objects containing hidden information. The mainstream design concept of steganography is to minimize the data embedding impact on the cover for a required payload, which involves at least two aspects for achieving superior steganographic performance. The first is to find the most suitable cover elements for data embedding. For example, complex texture areas within an image would be quite desirable for steganography. The second is to maximize data embedding efficiency. For the former, nowadays, we often focus on designing a suited function for the cover elements that can expose the data embedding impact. For the latter, cover codes are the key technologies. Steganography can be also utilized for malicious purposes, which gives the life of another important research topic called steganalysis. A core work in ste- ganalysis is to detect whether a given digit object was embedded with a message or not. The conventional steganalysis algorithms regard this problem as a bi- nary classification task, which involves feature engineering and classifiers. Due to the advancement of steganography that tends to alter the cover regions that are quite hard to detect, conventional featured-based steganalysis algorithms re- lying on sophisticated manual feature design has been pushed to the limit and become very hard to improve. To overcome this difficulty, in-deep studies can be performed on moving the success achieved by deep convolutional neural net- works (deep CNNs) in computer vision to steganalysis [11], [12], [13], [14]. It is pointed that, estimating the payload size within a stego, extracting the em- bedded information and identifying steganographic senders/receivers are all the important yet quite challenging research topics in steganalysis. As mentioned in [15], with the rapidly development of social media services such as Facebook and Twitter, it would be quite desirable to study the social behaviors, protocols and any other scenarios of steganography. In this sense, we may not care about the details of the used steganographic algorithms, but rather quantize the concerned characteristics of steganography as analyzable parameters for problem optimization. An effective way to analyze steganographic activities is to model it in a social network, which consists of a set of vertices and a set of edges. The vertices represent social entities such as the data encoders and data decoders, and the associated edges represent any real communicable channels or other social links used for steganography. In [15], the authors model steganography in an additive-risk social network and present a communication strategy that aims to minimize the steganographic risk by choosing a set of edges with the minimum sum of weights. In this paper, we present a passive attack to steganography in a steganogra- pher network. We assume that the attacker serves as a network monitor, and has collected a list of suspicious vertices that are corresponding to the data encoders and data decoders in advance. Here, the "suspicious vertices" mean that they are with a high probability representing the steganographic actors though they may be misjudged in practice. One may use the conventional steganalysis algorithms or other anomaly detection algorithms to construct the suspicious vertex-set. We study such a passive attack that, the network monitor hopes to remove a set The Cut and Dominating Set Problem in A Steganographer Network 3 Fig. 1. An example for steganographer network where the weights represent the cor- responding removel costs. of edges so that the suspicious vertices cannot communicate via steganography while the removal cost could be minimized. In addition to the above-mentioned attack, we also analyze a new communication scenario in the steganographer net- work that all the vertices will serve as either a data encoder or a data decoder. The optimization task is to select a set of vertices (encoders) out such that all vertices can share a message by edges and the steganographic communication activities are performed between adjacent vertices in the network. Similarly, we expect to keep the vertex-selection risk as low as possible. The rest of this paper are organized as follows. The related work is presented in Section 2. In Section 3, we introduce the proposed passive attack. We analyze a new communication scenario in a steganographer network in Section 4. Finally, we conclude this paper in Section 5. 2 Related Work A steganographer network corresponds to a graph G(V, E), where V = {v1, v2, ..., vn} represents the set of vertices and E = {e1, e2, ..., em} represents the set of edges. Every edge ek ∈ E involves with a pair of vertices, i.e., ek = (vi, vj). We say G is undirected meaning that all e ∈ E have no orientation. Namely, (vi, vj) is equivalent to (vj, vi). A path (if any) between vi and vj corresponds to such a vertex sequence (vq1, vq2 , ..., vqt) that vq1 = vi, vqt = vj and (vqk−1, vqk ) ∈ E for all 2 ≤ k ≤ t. G is connected if and only if for any two vertices in G, there exists at least one path between them. In G, a path between vi and vj implies that, vi can share a message with vj along the path. In [15], the authors present a communication strategy that aims to minimize the overall steganographic risk by determining a subtree supporting the required vertices. Mathematically, they use S = {s1, s2, ..., sn1} ⊂ V and 4 H. Wu et al. Fig. 2. Two ways to remove a set of edges making S and T unconnected where S = {v1} and T = {v5, v7, v8}. T = {t1, t2, ..., tn2} ⊂ V to denote the encoder set and decoder set. For each si ∈ S, its individual decoder set is denoted by Ti ⊂ T , meaning that, si hopes to send a message to each of Ti. Here, ∪n1 i=1Ti = T . The optimization task is to find such a subset of E that it enables all si ∈ S to send a message to all decoders in Ti, and the overall risk can be minimized. Namely, Eopt(S, T ) = arg min Eusable⊂E R(S, T, Eusable), (1) where R(S, T, Eusable) denotes the risk over Eusable ⊂ E. By assuming an additive-risk network, the optimization task is defined as: (cid:88) Eopt(S, T ) = arg min Eusable⊂E ei∈Eusable wi, (2) where wi > 0 is a real number representing the risk of ei. The authors in [15] have pointed that Eq. (2) is equivalent to solving the Steiner Tree Problem (STP) problem [16], which is NP-hard. The STP is seen as a generalization of two other combinatorial optimization problems, i.e., the shortest path problem and the minimum spanning tree (MST) problem. If the STP deals with only two terminals, it reduces to finding a shortest path. If all vertices are terminals, it is equivalent to the MST problem. Therefore, one may employ the existing approximation algorithms designed for the STP to find the suitable strategy for steganographic communication. The authors also analyze the steganographic communication from a proba- bilistic graph perspective. They have proved that, a multiplicative probabilistic graph is equivalent to an additive weighted graph, meaning that, by translat- ing the probabilistic network into a weighted network, one could find the suited communication strategy in a similar way. The Cut and Dominating Set Problem in A Steganographer Network 5 Fig. 3. Vertex insertion and edge insertion in a steganographer network. 3 Passive Attack to Steganographer Network From a monitor point, even if a steganographer does not use the optimized communication strategy, he can still communicate a message with the desired receiver since there may exist multiple communicable paths in the network. This requires the monitor to remove a set of edges corresponding to the channels such that the steganographer cannot communicate with the receiver. However, edge removal may result in a high cost or risk. We study this problem in this section. Mathematically, we expect to remove a set of edges Eopt such that S cannot communicate with T via steganography, while the removal operation could result in the lowest risk (cost), i.e., Eopt(S, T ) = arg min Erem⊂E R(S, T, Erem). (3) We assign a weight wi > 0 to ei ∈ E. wi represents the cost of removing ei from G. We assume an additive G, i.e., R(S, T, Erem) = (cid:88) ei∈Erem wi, (4) which makes the problem amenable to mathematical analysis and the additive assumption is reasonable since two edges far away to each other have ignorable interaction and interaction between edges near to each other can be scored by weights. In the real-world, for the network monitor, it is very likely that he cannot identify Ti for si, meaning that, he may aim to disconnect the links between S and T , rather than that between si and Ti for all 1 ≤ i ≤ n1. This assumption has been utilized in this section. We define the simplest attack for which S = 1 as single encoder attack. We expect to find a subset of E such that there has no path between s1 and each vertex in T by removing the selected edges. And, the sum of weights should be minimum. Fig. 1 shows a steganographer network. Assuming 6 H. Wu et al. that, S = {v1} and T = {v5, v7, v8}. Fig. 2 provides two ways to divide S and T into two different connected components. It is seen that, different sets of edges corresponds to different costs, e.g., the cost for Fig. 2 (a) is 13 + 17 + 31 = 61, and that for Fig. 2 (b) is 27. We should find a method to separate S and T with the lowest cost. Notice that, we assume that S ∩ T = ∅. In graph theory, a cut is defined as a partition of the vertices of a graph into two disjoint subsets. Specifically, a cut C = (A, B) divides V into two subsets A and B. The cut-set of C corresponds to an edge-set {(u, v) ∈ Eu ∈ A, v ∈ B}. Notice that, A∩ B = ∅ and A∪ B = V . If a ∈ V and b ∈ V are specified vertices of G, we then say a-b cut is a cut in which a ∈ A and b ∈ B. In a weighted graph, the weight of a cut is defined as the sum of weights of edges belonging to the cut. A cut is therefore called as minimum cut if its weight is not larger than that of any other cut. Obviously, the minimum cut is not unique. A directed graph is called as a flow network if each edge has a capacity and receives a flow. A flow in a directed graph must satisfy the restriction that the amount of flow into a vertex is equal to the amount of flow out of the vertex, unless it is the source vertex which has only outgoing flow, or sink vertex which has only incoming flow. Mathematically, the capacity of a directed edge vi → vj is a mapping c : E (cid:55)→ R+, denoted by c(vi, vj). It represents the maximum amount of flow that can pass through vi → vj. It is noted that, c(vj, vi) is different from c(vi, vj). If vi → vj /∈ E, one may consider c(vi, vj) = 0. A flow is a mapping f : E (cid:55)→ R+ subject to two constraints [17]: and (cid:88) vi→vj∈E f (vi, vj) = vj→vi∈E f (vi, vj) ≤ c(vi, vj),∀ vi → vj ∈ E, (cid:88) f (vj, vi),∀ vi ∈ V \ {a, b}, (5) (6) where a is the source vertex and b is the sink vertex. Without the loss of generality, an undirected graph can be treated as "di- rected" since an undirected edge (vi, vj) ∈ E can be decomposed into two di- rected edges vi → vj and vj → vi. For simplicity, we sometimes use vi → vj to represent a directed edge from vi to vj and vj → vi from vj to vi though (vi, vj) ∈ E is undirected in G in this paper. It also means that, vi → vj ∈ E and vj → vi ∈ E. With Eqs. (5, 6), the value of a flow is defined by f = (cid:80) f =(cid:80) v∈V f (a, v) or v∈V f (v, b). It means the amount of flow from the source vertex to the sink vertex. The maximum flow problem is therefore to maximize f, namely, to route as much flow as possible from a to b. Notice that, if a → v /∈ E, one may set f (a, v) = 0 ≤ c(a, v) = 0. A lot of practical algorithms can be applied for determining the maximum flow such as [18], [19], [20]. For a steganographer network, by regarding the weights as the flow capacity, we can determine the maximum flow between any two vertices. Therefore, an undirected steganogra- pher network can be translated as a flow network. A necessary preprocessing is to decompose each edge into two directed edges, for which both the newly assigned weights should equal the original one. The Cut and Dominating Set Problem in A Steganographer Network 7 Fig. 4. Vertex contraction in a steganographer network: (a) vertex contraction and (b) a new graph. The max-flow min-cut theorem [17] states that, Theorem 1. In a flow network, the maximum amount of flow passing through the source vertex is equal to the weight of the minimum cut. It indicates that, the smallest weight sum of the edges which if removed would disconnect the source vertex from the sink vertex is equal to the weight of the minimum cut, which is also equal to the maximum flow from the source to the sink. In order to find Eopt(S, T ) shown in Eq. (3), we need to determine the maximum flow in G(V, E). Then, we construct the minimum cut. The edges in the minimum cut will constitute Eopt(S, T ). The maximum flow problem generally deals with only one source vertex and one sink vertex. However, we have n1 ≥ 1 or n2 ≥ 1, indicating that, we cannot directly use a maximum flow algorithm in the steganographer network since there may be multiple source vertices, i.e., s1, s2, ..., sn1, or multiple sink vertices, i.e., t1, t2, ..., tn2 . A way to address this issue is to insert a new super-source vertex vs and a super-sink vertex vt into G(V, E), i.e., (7) For each si ∈ S, we insert an edge (vs, si) into E. Then, for each ti ∈ T , we V = V ∪ {vs, vt}. insert (ti, vt) into E. Therefore, E = E ∪ {(vs, si)1 ≤ i ≤ n1} ∪ {(ti, vt)1 ≤ i ≤ n2}. (8) Thereafter, we assign an infinite large weight to each of the new edges to represent the cost of removing it from the new graph. We take Fig. 3 for ex- planation. In Fig. 3, we have S = {v1, v8} and T = {v3, v7, v9}. A super-source vertex v10 (i.e., vs) and a super-sink vertex v11 (i.e., vt) are inserted. Five new edges with the infinite large weight are inserted as well. In applications, one could assign a very large weight (that is larger than the sum of weights of all 8 H. Wu et al. original edges) to the new edges, instead of the infinite large weight. Accordingly, a new graph can be built, as shown in Fig. (3). To find the maximum flow from v10 to v11, we should decompose all edges shown in Fig. (3) into two directed edges. By treating the weights of edges as the flow capacity, the maximum flow from v10 to v11 can be determined as 61. And, the corresponding minimum cut is {(v1, v3), (v1, v9), (v2, v9), (v8, v7)}. It means that, the minimum cost making S and T unconnected is 61, and Eopt(S, T ) = {(v1, v3), (v1, v9), (v2, v9), (v8, v7)}. Another way to determine Eopt(S, T ) is vertex contraction. The contraction of a set of vertices produces a graph in which all vertices in the set are replaced with a single vertex such that the single vertex is adjacent to the union of the vertices to which the vertices in the set were originally adjacent. In vertex contraction, it does not matter if two vertices in S or T are connected by an edge, which (if any) is simply removed during contraction. In detail, we initialize G(cid:48)(V (cid:48), E(cid:48)) as V (cid:48) = ∅ and E(cid:48) = ∅. For each (vi, vj) ∈ E, we skip it if {vi, vj} ⊂ S or {vi, vj} ⊂ T . Otherwise, if vi /∈ S ∪ T and vj /∈ S ∪ T , we update V (cid:48) as V (cid:48) = V (cid:48) ∪ {vi, vj} and E(cid:48) as E(cid:48) = E(cid:48) ∪ {(vi, vj)}. The weights assigned to edges should be processed as well. If vi ∈ S and vj ∈ T , we first update V (cid:48) as V (cid:48) = V (cid:48) ∪ {vs, vt} and then update E(cid:48) = E(cid:48) ∪ {(vs, vt)}. The weight of (vi, vj) will be added to (vs, vt). If vi ∈ S and vj /∈ T , we first update V (cid:48) as V (cid:48) = V (cid:48) ∪ {vs, vj} and then update E(cid:48) = E(cid:48) ∪ {(vs, vj)}. The weight of (vi, vj) will be added to (vs, vj). It is similar to process other cases. In this way, a new graph can be finally constructed. Thereafter, by computing the maximum flow from vs to vt in the new graph, the minimum cost can be obtained, and the minimum cut can be constructed as well. Fig. 4 shows an example, in which {v1, v8} and {v3, v7, v9} are replaced with vs and vt, respectively. It is seen that, the maximum flow in the new graph is identical to the maximum flow shown in Fig. 3, which has verified the correctness. Notice that, in Fig. 4 (b), after determining out the minimum cut {(vs, vt), (v2, vt)} in G(cid:48)(V (cid:48), E(cid:48)). We have to further construct the minimum cut for G(V, E). Clearly, it is observed that (vs, vt) is corresponding to {(v1, v3), (v1, v9), (v8, v7)}, and (v2, vt) corresponds to (v2, v9). Therefore, we have Eopt(S, T ) = {(v1, v3), (v1, v9), (v2, v9), (v8, v7)}. Remark. For a given directed graph, one can determine the maximum flow from the source vertex to the sink vertex by any efficient maximum flow algo- rithm. After calling a maximum flow algorithm, the flow information passing through each vertex can be identified. Notice that, the flow passing through an edge will be not larger than its capacity. To determine the cut, one can find the set of vertices that are reachable from the source vertex in the corresponding residual graph [17]. All edges involving a reachable vertex and a non-reachable vertex constitute the minimum cut. This can be completed by applying depth- first search (DFS) technique with a time complexity of O(V + E). 4 Steganographic Strategy Between Neighbors It seems to be interesting and reasonable that the steganographic communication in a steganographer network is only available between adjacent vertices (or say The Cut and Dominating Set Problem in A Steganographer Network 9 Fig. 5. Three examples of dividing all vertices into two sets S and T : a vertex marked as "1" means it belongs to S and "0" for T . between neighbors). This scenario looks closer to reality comparing with the case that an encoder in G should participate in the path planning for steganographic communication. The reason is that an edge between any two vertices does not only represent the steganographic channel between them, but also, to a certain extent, shows the social relationship between them. Thus, it may be not desirable sometimes for a vertex to communicate a message along a predetermined network path with another vertex that is not a neighbor. In this section, we will analyze steganography between neighbors within the steganographer network. Mathematically, for a given G(V, E), all vertices will serve as either a data encoder or a data decoder. One may assume that, G(V, E) is a subnetwork determined from a complex network in which the vertices may serve as more complex roles. Therefore, it can be said that, we actually deal with a simplified model in this paper even though the complex cases are not explicit for us at present. We are to choose a set of vertices from V to constitute S mentioned previously and the rest will constitute T , i.e., T = V \S. We define the neighbor- set of v ∈ V as N (v) = {u(u, v) ∈ E}. It is required that, for any v ∈ T , there should exist at least one u ∈ S such that u ∈ N (v). It ensures that, any vertex in V can either hold a message by itself (in S) or receive a message directly from a neighbor belonging to S. Accordingly, all vertices can share a message. The determination of S corresponds to a binary network game [21]. Clearly, each individual vertex v ∈ V must choose an action g(v) ∈ X = {0, 1}, where action g(v) = 0 indicates it servers as a data decoder, and g(v) = 1 for a data encoder. Therefore, it is required that (cid:88) u∈N (v) ∀v ∈ V, g(u) ≥ 1 − g(v). (9) the number of data encoders, i.e.,(cid:80) ing(cid:80) Fig. 5 shows three examples of dividing V into two sets S and T . It is seen that, there exist lots of legal solutions. An intuitive requirement is to minimize v∈V g(v), subject to Eq. (9). Simply minimiz- v∈V g(v), however, indicates that all vertices essentially have no difference and have the same importance (or say that they have the same risk/cost). From a generalized viewpoint, we can assign a positive weight w(v) to each v ∈ V to 10 H. Wu et al. evaluate the cost or risk of marking v as a member of S. By assuming an additive G(V, E), under the constraint of Eq. (9), our task is to minimize g(v) · w(v), (10) (cid:88) v∈V which is a typical 0-1 integer linear programming (ILP) problem. In graph theory, the family of vertex/edge covering problems involves a broad range of NP-hard optimization problems, among which the minimum-weight dominating set (MWDS) problem has played a prominent role in various real- world domains such as social networks, wireless ad-hoc networks, communication networks, and industrial applications [22]. For G(V, E), a dominating set D is a subset of V such that each v ∈ V \ D is adjacent to at least one member of D. The MWDS problem aims to find a dominating set Dmin that minimizes the total positive weights assigned to the vertices in the dominating set, namely (cid:88) v∈D Dmin = arg min D⊂V w(v), (11) (12) subject to ∀u ∈ V \ D, N (u) ∩ D (cid:54)= ∅. Obviously, the ILP problem shown in Eqs. (9, 10) is equivalent to the MWDS problem. Since the MWDS problem is known as a NP-hard problem, generally we have to use approximation algorithms to find the near-optimal solution unless all NP problems can be effectively solved [23] or G(V, E) has a small size (or has some special topological structure). For steganography between neighbors in G, a core research is therefore to design effective approximation algorithms for the MWDS problem. 5 Conclusion and Discussion In this paper, we introduce two simplified optimization problems in a steganog- rapher network theoretically. Both problems are proven to be equivalent to the minimum cut problem (or say the maximum flow problem since they are dual to each other) and the minimum-weight dominating set problem, respectively. The optimal/near-optimal solutions to the corresponding problems can be found by exploiting graph-modification techniques (e.g., vertex contraction) as well as related deterministic/approximation algorithms used in graph theory. For the passive attack, to identify the suspicious vertices, one may use ste- ganalysis algorithms or anomaly detection algorithms designed for complex net- works. On the one hand, these approaches provide the attacker access to finding both suspicious vertices and edges (corresponding to suspicious channels). On the other hand, the suspicious edges will help the attacker to evaluate the cost of removing an edge from the steganographer network. Notice that, the cost of removing an edge may take into account the local topological characteristics since a steganographer network may contain community features. For example, The Cut and Dominating Set Problem in A Steganographer Network 11 the edges connecting two communities may be assigned with a high cost. The suited definition of cost of removing an edge will be the future work. Another reasonable explanation for steganography between neighbors is that, a vertex may have not complete information on the steganographer network. It may lead each vertex to send a message via steganography to its neighbors or receive a message via steganography directly from its neighbors. We propose to find the MWDS in the steganographer network, which, however, has implied that the vertices know the complete information about the network or there should exist an ideal "super-vertex " that can access the whole network structure and can communicate with each vertex in the network. From the viewpoint of game theory, in case that each vertex has incomplete information about the whole network, the determination of the suited dominating set is more difficult since a vertex may only use its local information and may be affected by its neighbors' actions. Moreover, the determination of weights assigned to vertices in practice is not explicit to us either. We will focus on this problem in future. Acknowledgement This work was supported by the National Natural Science Foundation of China under Grant Nos. 61502496, U1536120, and U1636201, and the National Key Re- search and Development Program of China under Grant No. 2016YFB1001003. References 1. Cox, I., Miller, M., Bloom, J., Fridrich, J., Kalker, T.: Digital watermarking and steganography. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA (2008) 2. Holub, V., Fridrich, J., Denemark, T.: Universal distortion function for steganogra- phy in an arbitrary domain. EURASIP J. Inf. Security, 2014(1): 1-13 (2014) 3. Guo, L., Ni, J., Su, W., Tang C., Shi, Y.: Using statistical image model for JPEG steganography: uniform embedding revisited. IEEE Trans. Inf. Forensics Security, 10(12): 2669-2680 (2015) 4. Li, B., Wang, M., Li, X., Tan, S., Huang, J.: A strategy of clustering modification directions in spatial image steganography. IEEE Trans. Inf. Forensics Security, 10(9): 1905-1917 (2015) 5. Tang, W., Tan, S., Li, B., Huang, J.: Automatic steganographic distortion learning using a generative adversarial network. IEEE Signal Process. Lett., 24(10): 1547- 1551 (2017) 6. Zhou., W., Zhang, W., Yu, N.: A new rule for cost reassignment in adaptive steganography. IEEE Trans. Inf. Forensics Security, 12(11): 2654-2667 (2017) 7. Wu, H., Wang, H.: Multibit color-mapping steganography using depth-first search. In: Proc. IEEE Int. Symp. Biometrics Security Technol., pp. 224-229 (2013) 8. Wu, H., Wang, H., Zhao, H., Yu, X.: Multi-layer assignment steganography using graph-theoretic approach. Multimed. Tools Appl., 74(18): 8171-8196 (2015) 9. Filler, T., Judas, J., Fridrich, J.: Minimizing additive distortion in steganography us- ing syndrome-trellis codes. IEEE Trans. Inf. Forensics Security, 6(3): 920-935 (2011) 12 H. Wu et al. 10. Ma, S., Zhao, X., Guan, Q., Zhao, C.: The a priori knowledge based secure pay- load estimation for additive model. In: IS&T Int. Symp. Electronic Imaging: Media Watermarking, Security, and Forensics, pp. 16-21 (2017) 11. Xu, G., Wu, H., Shi, Y.: Structural design of convolutional neural networks for steganalysis. IEEE Signal Process. Lett., 23(5): 708-712 (2016) 12. Xu, G., Wu, H., Shi, Y.: Ensemble of CNNs for steganalysis: an empirical study. In: Proc. ACM Workshop Inf. Hiding Multimed. Security, pp. 103-107 (2016) 13. Xu, G.: Deep convolutional neural network to detect J-UNIWARD. In: Proc. ACM Workshop Inf. Hiding & Multimed. Security, pp. 67-73 (2017) 14. Ye, J., Ni, J., Yi, Y.: Deep learning hierarchical representations for image steganal- ysis. IEEE Trans. Inf. Forensics Security, 12(11): 2545-2557 (2017) 15. Wu, H., Wang, W., Dong, J., Xiong, Y., Wang, H.: A simply study to steganography on social networks. In: Proc. China Inf. Hiding Workshop, to appear (2018) (online availble: arXiv:1712.03621, https://arxiv.org/abs/1712.03621) 16. Chlebik, M., Chlebikova, J.: The Steiner tree problem on graphs: inapproximability results. Theoret. Comput. Sci., 406(3): 207-214 (2008) 17. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to algorithms. The MIT Press, Cambridge (2009) 18. Ford, L.R., Fulkerson, D.R.: Maximal flow through a network. Classic Papers in Combinatorics, pp. 243-248 (2009) 19. Edmonds, J., Karp, R.M.: Theoretical improvements in algorithmic efficiency for network flow problems. J. ACM, 19(2): 248-264 (1972) 20. Dinic, E.A.: Algorithm for solution of a problem of maximum flow in a network with power estimation. Doklady Akademii Nauk SSSR, 11(5): 1277-1280 (1970) 21. Galeotti, A., Goyal, S., Jackson, M.O., Vega-Redondo, F., Yariv, L.: Network games. The Review of Economic Studies, 77(1): 218-244 (2010) 22. Wang, Y., Cai, S., Yin, M.: Local search for minimum weight dominating set with two-level configuration checking and frequency based scoring function. J. Artificial Intelligence Research, 58(2017): 267-295 (2017) 23. Feige, U.: A threshold of ln(n) for approximating set cover. J. ACM, 45(4): 634-652 (1998)
1611.00665
1
1611
2016-11-02T16:09:26
Combinatorial Prophet Inequalities
[ "cs.DS" ]
We introduce a novel framework of Prophet Inequalities for combinatorial valuation functions. For a (non-monotone) submodular objective function over an arbitrary matroid feasibility constraint, we give an $O(1)$-competitive algorithm. For a monotone subadditive objective function over an arbitrary downward-closed feasibility constraint, we give an $O(\log n \log^2 r)$-competitive algorithm (where $r$ is the cardinality of the largest feasible subset). Inspired by the proof of our subadditive prophet inequality, we also obtain an $O(\log n \cdot \log^2 r)$-competitive algorithm for the Secretary Problem with a monotone subadditive objective function subject to an arbitrary downward-closed feasibility constraint. Even for the special case of a cardinality feasibility constraint, our algorithm circumvents an $\Omega(\sqrt{n})$ lower bound by Bateni, Hajiaghayi, and Zadimoghaddam \cite{BHZ13-submodular-secretary_original} in a restricted query model. En route to our submodular prophet inequality, we prove a technical result of independent interest: we show a variant of the Correlation Gap Lemma for non-monotone submodular functions.
cs.DS
cs
Combinatorial Prophet Inequalities Aviad Rubinstein∗ Sahil Singla† November 3, 2016 Abstract We introduce a novel framework of Prophet Inequalities for combinatorial valuation func- tions. For a (non-monotone) submodular objective function over an arbitrary matroid feasibility constraint, we give an O(1)-competitive algorithm. For a monotone subaddi- tive objective function over an arbitrary downward-closed feasibility constraint, we give an O(log n log2 r)-competitive algorithm (where r is the cardinality of the largest feasible subset). Inspired by the proof of our subadditive prophet inequality, we also obtain an O(log n· log2 r)-competitive algorithm for the Secretary Problem with a monotone subadditive objective function subject to an arbitrary downward-closed feasibility constraint. Even for the special case of a cardinality feasibility constraint, our algorithm circumvents an Ω(√n) lower bound by Bateni, Hajiaghayi, and Zadimoghaddam [BHZ13] in a restricted query model. En route to our submodular prophet inequality, we prove a technical result of inde- pendent interest: we show a variant of the Correlation Gap Lemma [CCPV07, ADSY12] for non-monotone submodular functions. 1 Introduction The Prophet Inequality and Secretary Problem are classical problems in stopping theory. In both problems a decision maker must choose one of n items arriving in an online fashion. In the Prophet Inequality, each item is drawn independently from a known distribution, but the order of arrival is chosen adversarially. In the Secretary Problem, the decision maker has no prior information about the set of items to arrive (except their cardinality, n), but the items are guaranteed to arrive in a uniformly random order. Historically, there are many parallels between the research of those two problems. The classic (single item) variants of both problems were resolved a long time ago: in 1963 Dynkin gave a tight e-competitive algorithm for the Secretary Problem [Dyn63]; a little over a decade later Krengel and Sucheston [KS77] gave a tight 2-competitive algorithm for the Prophet Inequality. Motivated in part by applications to mechanism design, multiple-choice variants of both problems have been widely studied for the past decade in the online algorithms com- munity. Instead of one item, the decision maker is restricted to selecting a feasible subset of ∗([email protected]) Electrical Engineering and Computer Sciences, UC Berkeley, Berkeley, CA. This work was supported by Microsoft Research PhD Fellowship, NSF grant CCF1408635, and Templeton Foundation grant 3966. †([email protected]) Computer Science Department, Carnegie Mellon University, Pittsburgh, PA. This work was supported by CMU Presidential Fellowship and NSF awards CCF-1319811, CCF-1536002, and CCF- 1617790 1 the items. The seminal papers of [HKP04, Kle05] introduced a secretary problem subject to a cardinality constraint (and [Kle05] also obtained a 1− O(1/√r)-competitive algorithm). In 2007, Hajiaghayi et al. followed with a prophet inequality subject to cardinality constraint [HKS07]. In the same year, Babaioff et al. introduced the famous matroid secretary problem [BIK07]; in 2012 Kleinberg and Weinberg introduced (and solved!) the analogous matroid prophet inequality. For general downward-closed constraints, O(log n log r)-competitive algo- rithms were recently obtained for both the problems [Rub16]. In all the works mentioned in the previous paragraph, the goal is to maximize the sum of selected items' values, i.e. an additive objective is optimized. For the secretary problem, there has also been significant work on optimizing more general, combinatorial objective functions. A line of great works [BHZ13, FNS11, BUCM12, FZ15] on secretary problem with submodular valuations culminated with a general reduction by Feldman and Zenklusen [FZ15] from any submodular function to additive (linear) valuations with only O(1) loss. Going beyond submodular is an important problem [FI15], but for subadditive objective functions there is a daunting Ω(√n) lower bound on the competitive ratio for restricted value queries [BHZ13]. Surprisingly, this line of work on combinatorial secretary problems has seen no parallels In this work we break the ice by introducing a new in the world of prophet inequalities. framework of combinatorial prophet inequalities. Combinatorial Prophet Inequalities: Our main conceptual contribution is a general- ization of the Prophet Inequality setting to combinatorial valuations. Roughly, on each of n days, the decision maker knows an independent prior distribution over k potential items that could appear.1 She also has access to a combinatorial (in particular, submodular or monotone subadditive) function f that describes the value of any subset of the n· k items (see Section 2 for a formal definition and further discussion). We obtain the following combinatorial prophet inequalities: Theorem 1.1 (Submodular Prophet; informal). There exists an efficient randomized O(1)- competitive algorithm for (non-monotone) submodular prophet over any matroid. Theorem 1.2 (Monotone Subadditive Prophet; informal). There exists an O(log n · log2 r)- competitive algorithm for monotone subadditive prophet inequality subject to any downward- closed constraints family. Subadditive Secretary Problem: Building on the techniques of our subadditive prophet inequality, we go back to the secretary world and prove a (computationally inefficient) O(log n· log2 r)-competitive algorithm for the subadditive secretary problem subject to any downward- closed feasibility constraint. As noted earlier, this algorithm circumvents the impossibility result of Bateni et al. [BHZ13] for efficient algorithms2. Theorem 1.3 (Monotone Subadditive Secretary; informal). There exists an O(log n· log2 r)- competitive algorithm for monotone subadditive secretaries subject to any downward-closed constraints family. 1Note that some notion of independence assumption is necessary as even for the single choice problem, if values are arbitrarily correlated then every online algorithm is Ω(n) competitive [HK92]. 2In fact, for general downward-closed constraint, even with additive valuations one should not expect efficient algorithms with membership queries [Rub16]. 2 Non-monotone correlation gap: En route to Theorem 1.1, we prove a technical contribu- tion that is of independent interest: a constant correlation gap for non-monotone submodular functions. For a monotone submodular function f , [CCPV07] showed that the expected value of f over any distribution of subsets is at most a constant factor larger than the expectation over subsets drawn from the product distribution with the same marginals. This bound on the correlation gap has been very useful in the past decade with applications in optimization [CVZ14], mechanism design [ADSY12, Yan11, BCK12, BH16], influence in social networks [RSS15, BPR+16], and recommendation systems [KSS13]. It turns out (see Example 4.1) that when f is non-monotone, the correlation gap is unbounded, even for n = 2! Instead, we prove a correlation gap for a related function: fmax(S) , max T ⊆S f (T ). (Note that fmax is monotone, but may not be submodular.) Theorem 1.4 (Non-monotone correlation gap; informal). For any (non-monotone) submod- ular function f , the function fmax has a correlation gap of O(1). 1.1 Further related work Secretary Problem In recent years, following the seminal work of Babaioff, Immorlica, and Kleinebrg [BIK07], there has been extensive work on the matroid secretary problem, where the objective is to maximize the sum of values of secretaries subject to a matroid constraint. For general matroids, there has been sequence of improving competitive ratio with the state of the art being O(log log r) [Lac14, FSZ15]. Obtaining a constant competitive ratio for general matroids remains a central open problem, but constant bounds are known for many special cases (see survey by Dinitz [Din13] and references therein). Other variants have also been considered, such as a hiring that returns for a second (or potentially k-th) interview [Var15], or secretaries whose order of arrival has exceptionally low entropy [KKN15]. Of special in- terest to us is a recent paper by Feldman and Izsak [FI15] that considers matroid secretary problems with general monotone objective functions, parametrized by the supermodular de- gree. For objective f with supermodular degree D+ f and general matroid constraint, they obtain a competitive ratio of O(cid:16)D+ 2 f + D+ log r(cid:17). Their results are incomparable to our Theorem 1.3, but the motivation is related-obtaining secretary algorithms beyond submodular functions. f 3 f log D+ Prophet Inequality The connection between multiple-choice prophet inequalities and mechanism design was recognized in the seminal paper by Hajiaghayi et al. [HKS07]. In particular, they proved a prophet inequality for uniform matroids; their bound was later im- proved by Alaei [Ala11]. Chawla et al. further developed the connection between prophet inequalities and mechanism design, and proved, for general matroids, a variant of the prophet inequality where the algorithm may choose the order in which the items are viewed. The ma- troid prophet inequality was first explicitly formulated by Kleinberg and Weinberg [KW12], who also gave a tight 2-competitive algorithm. In a different direction, Alaei, Hajiaghayi, and Liaghat [AHL12] considered a variant they call prophet-inequality matching, which is useful for online ad allocation. More generally, for intersection of a constant number of matroid, knapsack, and matching constraints, Feldman, Svensson, and Zenklusen [FSZ16] gave an O(1)-competitive algorithm; this is a corollary of their online contention reslution 3 schemes (OCRS), which we also use heavily (see Section 3.1.2). Azar, Kleinberg, and Wein- berg [AKW14] considered a limited information variant where the algorithm only has access to samples from each day's distributions. Esfandiari et al. [EHLM15] considered a mixed notion of "Prophet Secretary" where the items arrive in a uniformly random order and draw their values from known independent distributions. Finally, for general downward-closed constraint, [Rub16] gave O(log n log r)-competitive algorithms for both Prophet Inequality and Secretary Problem; these algorithms are the basis of our algorithms for the respective subadditive problems. Other notions of online submodular optimization Online submodular optimization has been studied in contexts beyond secretary. In online submodular welfare maximization, there are m items, n people, and each person has a monotone submodular value function. Given the value functions, the items are revealed one-by-one and the problem is to immedi- ately and irrevocably allocate it to a person, while trying to maximize the sum of all the value functions (welfare). The greedy strategy is already half competitive. Kapralov et al. [KPV13] showed that for adversarial arrival greedy is the best possible in general (competitive ratio of 1/2), but under a "large capacities" assumption, a primal-dual algorithm can obtain 1− 1/e- competitive ratio [DHK+13]. For random arrival Korula et al. [KMZ15] showed that greedy can beat half; obtaining 1 − 1/e in this settings remains open. Buchbinder et al. [BFS15] considered the problem of (monotone) submodular maximiza- tion with preemption, when the items are revealed in an adversarial order. Since sublinear competitive ratio is not possible in general with adversarial order, they consider a relaxed model where we are allowed to drop items (preemption) and give constant-competitive algo- rithms. Submodular maximization has also been studied in the streaming setting, where we have space constraints but are again allowed to drop items [BMKK14, CK15, CGQ15]. The "learning community" has looked into experts and bandits settings for submodular optimization. In these settings, different submodular functions arrive one-by-one and the al- gorithm, which is trying to minimize/ maximize its value, has to select a set before seeing the function. The function is then revealed and the algorithm gets the value for the selected set. The goal is to perform as close as possible to the best fixed set in hindsight. Since submod- ular minimization can be reduced to convex function minimization using Lov´asz extension, sublinear regrets are possible [HK12]. For submodular maximization, the usual benchmark is a 1 − 1/e multiplicative loss and an additive regret [SG08, GK10, GKS14]. subadditive functions. Interestingly, to the best of our knowledge none of those problems have been studied for 1.2 Organization We begin by defining our model for combinatorial prophet inequalities in Section 2; in Sec- tion 3 we develop some necessary notation and recall known results; in Section 4 we formalize and prove our correlation gap for non-monotone submodular functions; and in Section 5 we prove the submodular prophet inequality. The subadditive prophet and secretary algorithms share the following high level approach: use a lemma of Dobzinski [Dob07] to reduce subadditive to XOS objective functions; then solve the XOS case using the respective (prophet and secretary) algorithms of [Rub16] for additive objective function and general downward closed feasibility constraint. It turns out that the secretary case is much simpler since we can use the additive downward-closed algorithm of [Rub16] as black-box; we present it in Section 6. For the prophet inequality, we have to make 4 changes to the already highly non-trivial algorithm of [Rub16] for the additive, downward- closed case; we defer this proof to Section 7. 2 Combinatorial but Independent Functions In this section, we define and motivate what we mean by "submodular (or subadditive) valuations over independent items". Recall that in the classic prophet inequality, a gambler is asked to choose one of n independent non-negative random payoffs. In multiple choice prophet inequalities [HKS07], the gambler chooses multiple payoffs, subject to some known-in-advance feasibility constraint, and receives their sum. Here, we are interested in the case where the gambler's utility is not additive over the outcomes of the random draws: For example, instead of monetary payoffs, at each time period the gambler can choose to receive a random item, say a car, and the utility from owning multiple cars diminishes quickly. As another example, the gambler receives monetary payoffs, but his marginal utility for the one-millionth dollar is much smaller than for the first. Formally, we define: Definition 2.1 (C Valuations over Independent Items). Let C be a class of valuation functions (in particular, we are interested in C ∈ {submodular, monotone subadditive}). Consider: • n sets U1, . . . , Un and distributions D1, . . . ,Dn, where Di returns a single item from Ui. • A function f : {0, 1}U → R+, where U ,Sn • For X ∈Qi Ui and subset S ⊆ [n], let vX(S) , f(cid:0){Xi : i ∈ S}(cid:1). Let D be a distribution over valuation functions v (·) : 2n → R+. We say that D is "C over independent items" if it can be written as the distribution that first samples X ∼×i Di, and then outputs valuation function vX(·). i=1 Ui and f ∈ C. Related notions in the literature Combinatorial functions over independent items have been considered before. Agrawal et [ADSY12], for example, consider a different, incomparable framework defined via the al. generalization of submodular and monotone functions to non-binary, ordered domains (e.g. f :×Ui → R+ is submodular if f (max{X, Y}) + f (min{X, Y}) ≤ f (X) + f (Y)). In our definition, per contra, there is no natural way to define a full order over the set of items potentially available on each time period. For example, if we select an item on Day 1, an item X2 on Day 2 may have a larger marginal contribution than item Y2, but a lower contribution if we did not select any item on Day 1. Another relevant definition has been considered in probability theory [Sch99] and more recently in mechanism design [RW15]. The latter paper considers auctioning n items to a buyer that has a random, "independent" monotone subadditive valuation over the items. Now the seller knows which items she is selling them, but different types of buyers may perceive each item differently. This is captured via an attribute of an item, which describes how each buyer values a bundle containing this item. Formally, Definition 2.2 (Monotone Subadditive Valuations over Independent Items [Sch99, RW15]). We say that a distribution D over valuation functions v (·) : 2n → R is subadditive over independent items if: 5 1. All v (·) in the support of D exhibit no externalities. Formally, let ΩS = ×i∈S Ωi, where each Ωi is a compact subset of a normed space. There exists a distribution DX over Ω[n] and functions VS : ΩS → R such that D is the distribution that first samples X ← DX and outputs the valuation function v (·) with v (S) = VS (hXiii∈S) for all S. 2. All v (·) in the support of D are monotone and subadditive. 3. The private information is independent across items. That is, the DX guaranteed in Property 1 is a product distribution. For monotone valuations, Definition 2.1 is stronger than Definition 2.2 as it assumes that the valuation function is defined over every subset of U =S Ui, rather than just the support of D. However, it turns out that for monotone subadditive functions Definitions 2.1 and 2.2 are equivalent. Observation 1. A distribution D is subadditive over independent items according to Definition 2.1 if and only if it is subadditive over independent items according to Definition 2.2. Proof sketch. It's easy to see that Definition 2.1 implies Definition 2.2: We can simply iden- tify between the set of attributes Ωi on day i and the set of potential items Ui, and let In the other direction, we again identify between each Ui and Ωi. For feasible set S which consists of only one item in Ui for each i ∈ R, we can let XS be the corresponding vector in VS (hXiii∈S) , f(cid:0){Xi : i ∈ S}(cid:1). Observe that the desiderata of Definition 2.2 are satisfied. Q Ωi, and define f(cid:0)S(cid:1) , VXS (R). Definition 2.1 requires that we define f (·) over any subset of U ,S Ui. We do this by taking the maximum of f (·) over all feasible subsets. Namely, for set T ⊆ U , let RT ⊆ [n] denote again the set of i's such that T ∩ Ui ≥ 1. We set: f (T ) , max S⊆T s.t. VXS (RT ). ∀i S∩Ui≤1 Now f (·) is monotone subadditive because it is maximum of monotone subadditive functions. 3 Preliminaries 3.1 Submodular and Matroid Preliminaries A set function f : {0, 1}n → R+ is a submodular function if for all S, T ⊆ [n] it satisfies f (S∪T )+f (S∩T ) ≤ f (S)+f (T ). For any e ∈ [n] and S ⊆ [n], let fS(e) denote f (S∪e)−f (S). We recall some notation for to extend submodular functions from the discrete hypercube {0, 1}n to relaxations whose domain is the continuous hypercube [0, 1]n. For any vector x ∈ [0, 1]n, let S ∼ x denote a random set S that contains each element i ∈ [n] independently w.p. xi. Moreover, let 1S denote a vector of length n containing 1 for i ∈ S and 0 for i 6∈ S. Definition 3.1. We define important continuous extensions of any set function f . Multilinear extension F : F (x) , ES∼x[f (S)]. 6 Concave closure f +: f +(x) , max Continuous relaxation f ∗: f ∗(x) , min α n XS⊆[n] αSf (S) XS S⊆[n](cid:26)f (S) + Xi∈[n]\S αS = 1 and XS fS(e) · xi(cid:27). αS1S = xo. 3.1.1 Some Useful Results Lemma 3.2 (Correlation gap [CCPV07]). For any monotone submodular function and x ∈ [0, 1]n, F (x) ≤ f +(x) ≤ f ∗(x) ≤(cid:18)1 − 1 e(cid:19)−1 F (x). Lemma 3.3 (Lemma 2.2 of [BFNS14]). Consider any submodular function f and any set A ⊆ [n]. Let S be a random subset of A that contains each element of S w.p. at most p (not necessarily independently), then ES[f (S)] ≥ (1 − p) · f (∅). Lemma 3.4 (Lemma 2.3 of [FMV11]). For any non-negative submodular function f and any sets A, B ⊆ [n], E S∼1A/2 T ∼1B /2 [f (S ∪ T )] ≥ 1 4 (f (∅) + f (A) + f (B) + f (A ∪ B)) . Lemma 3.5 (Theorem 2.1 of [FMV11]). For any non-negative submodular function f , any set A ⊆ [n] and p ∈ [0, 1], F (1A · p) ≥ p(1 − p) · max T ⊆A f (T ). We can now prove the following useful variant of the previous two lemmata (see also an alternative self-contained proof in Appendix A). Lemma 3.6. Consider any non-negative submodular function f and 0 ≤ L ≤ H ≤ 1. Let S∗ be a set that maximizes f , and let x ∈ [0, 1]n be such that for all i ∈ [n], L ≤ xi ≤ H. Then, F (x) ≥ L(1 − H) · f (S∗). exactly L. Proof. Imagine a process in which in which we construct the random set T ∼ x, i.e. set T containing each element e independently w.p. xe, in two steps. In the first step we construct set T ′ by selecting every element independently w.p. In the second step we construct set T containing each element e independently w.p. (xe − L)/(1 − L). It's easy to verify that the union of the two sets T ′ ∪ T contains each element e independently with probability exactly xe. From Lemma 3.5, we know that at the end of first step, the generated set has expected value E[f (T ′)] ≥ L(1−L)f (S∗). Now, we argue that the second step does not "hurt" the value by a lot. We note that in the second step each element is added w.p. at most (H − L)/(1− L) because xe ≤ H. Let g(S) := f (S ∪ T ′) be a non-negative submodular function. We apply Lemma 3.3 on g to get E[g( T )] ≥ (1 − H)/(1 − L) · g(∅), which implies E[f (T ′ ∪ T )] ≥ (1 − H)/(1 − L) · E[f (T ′)]. Together, we get F (x) = E[T ′ ∪ T ] ≥ L(1− L)(1− H)/(1− L)f (S∗) = L(1− H)f (S∗). 7 3.1.2 Online Contention Resolution Schemes Given a point x in the matroid polytope P of matroid M, many submodular maximization applications like to select each element i independently with probability xi and claim that the selected set S has expected value F (x) [CVZ14]. The difficulty is that S need not be feasible in M, and we can only select T ⊆ S that is feasible. Chekuri et al. [CVZ14] introduced the notion of contention resolution schemes (CRS) that describes how, given a random S, one can find a feasible T ⊆ S such that the expected value f (T ) will be close to F (x). Recently, Feldman, Svensson, and Zenklusen gave online contention resolution schemes (OCRS). Informally, it says that the decision of whether to select element i ∈ S into T can be made online, even before knowing the entire set S [FSZ16]. In particular, we will need their definition of greedy OCRS; we define it below and state the results from [FSZ16] that we use in our O(1)-submodular prophet inequality result over matroids. Definition 3.7 (Greedy OCRS). Let x belong to a matroid polytope P and S ∼ x. A greedy OCRS defines a downward-closed family Fx of feasible sets in the matroid. All elements reveal one-by-one if they belong to S, and when element i ∈ [n] reveals, the greedy OCRS selects it if, together with the already selected elements, the obtained set is in Fx. Lemma 3.8 (Theorems 1.8 and 1.10 of [FSZ16]). Given a non-negative submodular function f , a matroid M, and a vector x in the convex hull of independent sets in M, there exists a deterministic greedy OCRS that outputs a set T satisfying ET [F (1T /2)] ≥ (1/16) · F (x). 3.2 Subadditive and Downward-Closed Preliminaries A set function f : {0, 1}n → R+ is subadditive if for all S, T ⊆ [n] it satisfies f (S∪T ) ≤ f (S)+ f (T ). It's monotone if f (S) ≤ f (T ) for any S ⊆ T . A set function f : {0, 1}n → R+ is an XOS (alternately, fractionally subadditive) function if there exist linear functions Li : {0, 1}n → R+ such that f (S) = maxi{Li(S)}. (See Feige [Fei09] for illustrative examples.) Lemma 3.9 ([Dob07, Lemma 3]). Any subadditive function v : 2n → R+ can be (cid:16) logS 2e (cid:17)- approximated by an XOS functionbv : 2n → R+; i.e. for every S ⊆ [n], Furthermore, the XOS function has the formbv (S) = maxT ⊆[n] pT ·T ∩ S for an appropriate bv (S) ≤ v (S) ≤(cid:18) log S 2e (cid:19)bv (S) . choice of pT 's. Theorem 3.10 ([Rub16]). When items take values in {0, 1}, there are O (log n)-competitive algorithms for (additive) Downward-Closed Secretary and Downward-Closed Prophet. 4 Correlation Gap for non-monotone submodular functions For monotone submodular functions, [CCPV07] proved that F (x) ≥ (1 − 1/e)f +(x). (4.1) This result was later rediscovered by [ADSY12], who called the ratio between f +(x) and F (x) correlation gap. It's useful in many applications since it says that up to a constant 8 factor, picking items independently is as good as the best correlated distribution with the same element marginals. What is the correct generalization of (4.1) to non-monotone submodular functions? It is tempting to conjecture that F (x) ≥ c· f +(x) for some constant c > 0. However, the following example shows that even for a function as simple as the directed cut function on a two-vertex graph, this gap may be unbounded. Example 4.1. Let f be the directed cut function on the two-vertex graph u → v; f (∅) = 0, f ({u}) = 1, f ({v}) = 0, and f ({u, v}) = 0. Let x = (ǫ, 1 − ǫ). Then, i.e. F (x) = ǫ2 ≪ ǫ = f +(x). It turns out that the right way to generalize (4.1) to non-monotone submodular functions is to first make them monotone: Definition 4.2 (fmax). fmax(S) , max T ⊆S f (T ). For non-monotone submodular f , we have that fmax is monotone, but it may no longer be submodular, as shown by the following example: Example 4.3 (fmax is not submodular). Let f be the directed cut function on the four- vertex graph u → v → w → x. In particular, f ({v}) = 1, f ({u, v}) = 1, f ({v, w}) = 1, and f ({u, w}) = 2. fmax({u, v}) − fmax({v}) = 1 − 1 < 2 − 1 = fmax({u, v, w}) − fmax({v, w}). Finally, we are ready to define correlation gap for non-monotone functions: Definition 4.4 (Correlation gap). The correlation gap of any set function f is max x∈[0,1]n max α≥0( f +(x) Fmax(x)(cid:12)(cid:12)(cid:12)XS αS = 1 and XS αS1S = x) , where Fmax is the multilinear extension of fmax. Notice that for monotone f , we have that fmax ≡ f , so Definition 4.4 generalizes the correlation gap for monotone submodular functions. Furthermore, one could replace f + with f + max in Definition 4.4; observe that the resulting definition is equivalent. Theorem 4.5 (Non-monotone correlation gap). For any (non-monotone non-negative) sub- modular function f , the correlation gap is at most 200. While the constant can be improved slightly, we have not tried to optimize it, focusing instead on clarity of exposition. Our proof goes through a third relaxation, f ∗ 1/2. Definition 4.6 (f ∗ 1/2). For any set function f and any x ∈ [0, 1]n, f ∗ 1/2(x) , min S⊆[n](cid:26)ET ∼1S/2(cid:2)f (T ) + Xi∈[n]\S fT (e) · xi(cid:3)(cid:27). 9 Below, we will prove (Lemma 4.7) that f +(x) ≤ 4 · f ∗ 1/2(x). We then show (Lemma 4.9) that f ∗ 1/2(x) ≤ 50 · F (x/2), which implies f +(x) ≤ 4 · f ∗ 1/2(x) ≤ 200 · F (x/2). (4.2) Finally, to finish the proof of Theorem 4.5, it suffices to show that F (x/2) ≤ Fmax(x). This is easy to see since drawing T according to x/2 is equivalent to drawing S according to x, and then throwing out each element from S independently with probability 1/2. For Fmax(x), on the other hand, we draw the same set S and then take the optimal subset. 4.1 Proof that f +(x) ≤ 4 · f ∗ Lemma 4.7. For any x ∈ [0, 1]n and non-negative submodular function f : {0, 1}n → R+, 1/2(x) f +(x) ≤ 4 · f ∗ 1/2(x). We first prove the following auxiliary claim: Claim 4.8. For any sets S, T ⊆ [n], ET1/2∼1T /2[f ((S \ T ) ∪ T1/2] ≥ 1 4 f (S). Proof. Define a new auxiliary function h(U ) , f ((S \ T ) ∪ U ). Observe that h continues to be non-negative and submodular. We now have, E T1/2∼1T /2[f ((S \ T ) ∪ T1/2] = E T1/2∼1T /2[h(T1/2)] 1 4 1 4 ≥ = h(T ) f (S) (Lemma 3.6 for L = H = 1/2) (Definition of h). Proof of Lemma 4.7. Fix x, and let S∗ = S∗(x) denote the optimal set that satisfies f ∗ ET ∼1S∗ /2(cid:2)f (T ) +Pi∈[n]\S∗ fT (e)xi(cid:3). Let {αS} be the optimal distribution that satisfies f +(x) =PS αSf (S). Then, 1 4PS αSf (S) 4 f +(x) = 1 1/2(x) = (Claim 4.8) αS · E αS · ET ∼1S∗ /2[f ((S \ S∗) ∪ T )] αS · ET ∼1S∗ /2 [f (T ) + fT (S \ S∗)] ≤XS =XS T ∼1S∗ /2f (T ) + Xi∈S\S∗ fT (e) ≤XS = ET ∼1S∗ /2f (T )XS fT (e) αS Xi∈S\S∗ αS +XS T ∼1S∗ /2f (T ) + Xi∈[n]\S∗ fT (e)xi = f ∗ 1/2(x) = E 10 (submodularity) (usingXS αS1S = x). 4.2 Proof that f ∗ 1/2(x) ≤ 50 · F (x/2) The proof of the following lemma is similar to Lemma 5 in [CCPV07]. Lemma 4.9. . f ∗ 1/2(x) ≤ 50 · F (x/2) . Proof. Consider an exponential clock running for each element i ∈ [n] at rate xi. Whenever the clock triggers, we update set S to S∪{i}. For t ∈ [0, 1], let S(t) denote the set of elements in S by time t. Thus, each element belongs to S(1) w.p. 1 − exp(−xi), which is between xi(1 − 1 e ) and xi. Let V (t) , ET ∼1S(t)/2[f (T )], i.e. expected value of set that picks each element in S(t) independently w.p. 1 2 . Our goal is to show that: f ∗ 1/2(x) ≤(cid:18) 2 1 − e−1/2(cid:19) · E[V (1)] ≤(cid:18) 2 1 − e−1/2(cid:19)(cid:18) 4(e − 1) e − 2 (cid:19) · F (x/2) . (4.3) We begin with the second inequality of (4.3). Consider the auxiliary submodular function g(S) , ET ∼1−exp(−x)[f (S ∩ T )], and let G denote its multilinear extension. Let S∗ be a maximizer of g, and observe that V (1) = G(1[n]/2) ≤ g(S∗). Observe further that, with slight abuse of notation, F (x/2) = G(cid:16) defined since for any xi ∈ [0, 1], we have x/2 1−exp(−x)(cid:17); this is well- 1 2 ≤ xi/2 1 − exp(−xi) ≤ e 2(e − 1) < 1. Moreover, since xi/2 1−exp(−xi) is bounded, Lemma 3.6 gives F (x/2) ≥ 1 2 ·(cid:18)1 − e 2(e − 1)(cid:19) · g(S∗) = e − 2 4(e − 1) g(S∗) = Ω(1) · g(S∗). We now turn to the first inequality of (4.3). Consider an infinitesimal interval interval (t, t + dt]. For any i /∈ S(t) the exponential clock triggers with probability xi dt, so it contributes to V (t + dt) with probability xi/2 dt. The probability that two clocks trigger in the same infinitesimal is negligible (O(dt2)). Therefore, E[V (t + dt) − V (t)] = E 1 E S(t) ≥ 2(cid:16)f ∗ T ∼1S(t)/2 Xj∈[n]\S xi 2 fT (j) dt − O(dt2) (cid:17) dt − O(dt2). Dividing both sides by dt and taking the limit as dt → 0, we get: 1/2(x) − ES(t)ET ∼1S(t)/2E[f (T )] } E[V (t)] {z 2(cid:16)f ∗ 1/2(x) − E[V (t)](cid:17). d dt E[V (t)] ≥ 1 11 To solve the differential inequality, let φ(t) = E[V (t)] and ψ(t) = exp( t 2 ) φ(t). We get . Since ψ(0) = φ(0) = 0, dφ 2 (f ∗ dt ≥ 1 integration over t gives 1/2(x) − φ(t)) and dψ dt = exp( t 2 )( dφ dt + φ(t) 2 ) ≥ exp( t 2 ) f ∗ 1/2(x) 2 E[V (t)] = φ(t) = exp(−t/2) ψ(x) ≥ f ∗ 1/2(x) 2 (1 − exp(−t/2)). In particular, plugging in t = 1 completes the proof of the first inequality in (4.3). 5 Submodular Prophets over Matroids Definition 5.1 (Submodular Matroid Prophet). The offline inputs to the problem are: • n sets U1, . . . , Un; we denote their union U ,Sn • a (not necessarily monotone) non-negative submodular function f : {0, 1}U → R+; • n distributions Di over subset Ui; and • a matroid M over [n] i=1 Ui; On the i-th time period, the algorithm observes an element Xi ∈ Ui drawn according to Di, independently from outcomes and actions on past and future days. The algorithm must decide (immediately and irrevocably) whether to add i and Xi to sets W and XW , respectively, subject to W remaining independent in M. The objective is to maximize f (XW ). Theorem 5.2. There is a randomized algorithm with a competitive ratio of O(1) for any Submodular Matroid Prophet Proof overview The main ingredients in the proof of Theorem 5.2 are known online con- tention resolution schemes (OCRS) due to Feldman, Svensson, and Zenklusen [FSZ16], and our new bound on the correlation gap for non-monotone submodular functions (Theorem 4.5). Let x ∈ [0, 1]U denote the vector of probabilities that each element realizes (i.e. x(i,j) = Di(j)). A naive proof plan proceeds as follows: Select elements online using the OCRS (w.r.t x); obtain a constant factor approximation to F (x); use a "correlation gap" to show a constant factor approximation of f +(x); finally, observe that f +(x) is an upper bound on OP T . There are two problems with that plan: First, the OCRS of Feldman et al. applies when elements realize independently. The realization of different elements for the same day is obviously correlated (exactly one element realizes), so we cannot directly apply their OCRS. The second problem is that for non-monotone submodular function, it is in general not true that F (x) approximates f +(x) (see Example 4.1). The solution to both obstacles is working with x/2 instead of x. In Section 4 we showed that F (x/2) is a constant factor approximation of f +(x) (Ineq. (4.2)). Then, in Subsection 5.1, we give an algorithm that approximates the selection of the greedy OCRS on x/2. Our plan is then to show: ALG = Ω(E S∼OCRS(x/2)[f (S)]) = Ω(F (x/2)) = Ω(f +(x)) = Ω(OP T ). (Subsection 5.1) (Lemma 3.8) (Ineq. (4.2)) 12 5.1 Applying the OCRS to our setting In this subsection we show an algorithm that obtains, in expectation, 1/2 of the expected value of the OCRS with probabilities x/2. Our algorithm uses the greedy OCRS as a black box. On each day, the algorithm (sequen- tially) feeds the OCRS a subset of the elements Ui that can potentially arrive on that day. The subset on each day is chosen at random; it is correlated with the element that actually arrives on that day, and independent from the subsets chosen on other days. The guarantee is that the distribution over sequences fed into the OCRS is identical to the distribution induced by x/2. Reduction P i xi,j x/2({(i,j)}) For each i, let Ui denote the set of elements that can arrive on day i, and fix some (arbitrary) order over Ui. For a subset Si ⊆ Ui, let P i x/2(Si) denote the probability that the set Si is exactly the outcome of sampling from Ui according to x/2. When element (i, j) arrives on day i, the algorithm feeds into the OCRS a random set Ti drawn from the following distribution. , the algorithm feeds just element (i, j), i.e. Ti = {(i, j)}; notice With probability that this guarantees Pr [Ti = {(i, j)}] = P i x/2({(i, j)}). Otherwise, the algorithm lets Ti be a random subset of Ui, drawn according to x/2, conditioned on Ti 6= 1. This guarantees that the probability mass on subsets of size 6= 1 is also allocated according to x/2. Now, if the algorithm fed the singleton {(i, j)} and the OCRS selected it, then the al- gorithm also takes {(i, j)}; otherwise the algorithm does not take {(i, j)}. (In particular, if Ti 6= 1, the algorithm ignores the decisions of the OCRS.) Analyzing the reduction Observe that on each day the distribution over Ti's is identical to the distribution P i x/2(·). Since the Ti's are also independent, it means that the distribution of inputs to the OCRS is indeed distributed according to x/2. Conditioning on (i, j) is being fed (i.e., with probability xi,j/2), P i x/2(·) assigns at least 1/2 probability to the event where no other element is also being fed (this is precisely the reason we divide x by 2): Pr[Ti = {(i, j)} Ti ∋ (i, j)] ≥ 1/2. Since the OCRS is greedy, for any history on days 1, . . . , i − 1, if it selects (i, j) when observing set Ti ∋ (i, j), it would also select (i, j) when observing only this element on day i. Furthermore, since the OCRS is only allowed to select one element on day i, conditioning on the OCRS selecting (i, j), the future days (i + 1, . . . , n) proceed independently of whether the algorithm also selected (i, j). Therefore, conditioning on the greedy OCRS selecting any set SOCRS, the algorithm selects a subset TALG ⊆ SOCRS where each element appears with probability at least 1/2. Finally, to argue that the algorithm obtains at least 1/2 of the expected value of the set selected by the OCRS, fix the set SOCRS selected by the OCRS, and consider the submodular function g( ¯T ) , f (SOCRS \ ¯T ). Setting ¯T , TALG \ SOCRS, we have that f (TALG) = g( ¯T ). Thus by Lemma 3.3, E[f (TALG)] ≥ 1 2 E[g(∅)] = 1 2 E[f (SOCRS)]. 13 6 Subadditive Secretary over Downward-Closed Constraints Definition 6.1 (Monotone Subadditive Downward-Closed Secretary). Consider n items, a monotone subadditive valuation function from subsets of items to R+, and an arbitrary downward-closed set system F over the items; both f and F are adversarially chosen. The algorithm receives as input n (but not F or f ). The items arrive in a uniformly random order. Initialize W as the empty set. When item i arrives, the algorithm observes all feasible subsets of items that have already arrived, and their valuation in f . The algorithm then decides (immediately and irrevocably) whether to add i to the set W , subject to the constraint that W remains a feasible set in F. The goal is to maximize f (W ). Theorem 6.2. There is a deterministic algorithm for Monotone Subadditive Downward- Closed Secretary that achieves a competitive ratio of O(cid:0)log n · log2 r(cid:1). Proof. Let T ⋆ be the set chosen by the offline algorithm (OP T = f (T ⋆)). By Lemma 3.9 there exists a pT ⋆ such that for every S ⊆ T ⋆: f (S) ≥ pT ⋆ S ∩ T ⋆ ; OP T = f (T ⋆) = O (pT ⋆ T ⋆ log T ⋆) = O (pT ⋆ T ⋆) log r. (6.1) (6.2) Assume that we know pT ⋆ (discussed later). We define a new feasibility constraint F ′ as follows: a set T ⊆ [n] is feasible in F ′ iff it is feasible in F and for every subset S ⊆ T , we have f (S) ≥ pT ⋆ S. Notice that because we also force the condition on all subsets of T , F ′ is downward-closed and it does not depend on the order of arrival. We run the algorithm for {0, 1}-valued (additive) Downward-Closed Secretary (as guaranteed by Theorem 3.10) with feasibility constraint F ′ where all values are 1. By (6.1), log r(cid:17). Therefore, the additive {0, 1}-values T ⋆ is feasible in F ′, and by (6.2) pT ⋆ T ⋆ = Ω(cid:16) OP T algorithm returns a set T ALG of size(cid:12)(cid:12)T ALG(cid:12)(cid:12) = Ω(cid:16) pT ⋆ log n log r(cid:17). Furthermore, T ALG is also feasible in F ′, i.e. f (T ALG) ≥ pT ⋆(cid:12)(cid:12)T ALG(cid:12)(cid:12) = Ω(cid:18) OP T log n log r(cid:19) . (6.3) OP T Guessing pT ⋆ Finally, we don't actually know pT ⋆, but we can guess it correctly, up to a constant factor, with probability 1/ log r. We run the classic secretary algorithm over the first n/2 items, where we use the value of the singleton f ({i}) as "the value of item i": Observe the first n/4 items and select none; then take the next item whose value is larger than every item observed so far. With constant probability this algorithm selects the item with the largest value, which we denote by M . Also, with constant probability the algorithm sees the item with the largest value too early and does not select it. Assume that this is the case. Since we obtained expected value of Ω (M ) on the first n/2 items we can, without loss of generality, ignore values less than M/r. In particular, we know that pT ⋆ ∈ [M/r, M ]. Pick α ∈ {M/r, M/(2r), . . . , M/2, M} uniformly at random, and use it instead of pT ⋆ to define F ′. With probability 1/ log r, pT ⋆ ∈ [α, 2α], in which case the algorithm returns a set T ALG satisfying (6.3). 14 7 Subadditive Prophet Definition 7.1 (Monotone Subadditive Downward-Closed Prophet). The offline inputs to the problem are: • n sets U1, . . . , Un; we denote their union U ,Sn • a monotone non-negative subadditive function f : {0, 1}U → R+; • n distributions Di over subset Ui; and • a feasibility constraint F over [n]. i=1 Ui; On the i-th time period, the algorithm observes an element Xi ∈ Ui drawn according to Di, independently from outcomes and actions on past and future days. The algorithm must decide (immediately and irrevocably) whether to add i and Xi to sets W and XW , respectively, subject to the constraint that W remains feasible in F. The objective is to maximize f (XW ). Let r denote the maximum cardinality of a feasible set S ∈ F. Theorem 7.2. There is a deterministic algorithm for Monotone Subadditive Downward- Closed Prophet that achieves a competitive ratio of O(cid:0)log n · log2 r(cid:1). The proof of Theorem 7.2 consists of three steps: in Subsection 7.1 we reduce monotone subadditive valuations over independent items to monotone XOS subadditive valuations over independent items, with a loss of O (log r), using a lemma of Dobzinski [Dob07]. Then in Subsection 7.2 we use a standard reduction from general XOS valuations to XOS with {0, 1} marginal contributions, losing another factor of O (log r). Finally, in Subsection 7.3 we use techniques from [Rub16] to give an O (log n)-competitive algorithm for monotone XOS with {0, 1} marginal contributions. 7.1 Subadditive to XOS Definition 7.3 (Monotone XOS Downward-Closed Prophet). For any set M and items [n], the offline inputs to the problem are: • n sets U1, . . . , Un of valuations vectors in RM • a monotone XOS function bf : {0, 1}U → R+ m∈MXu∈S bf (S) , max + ; we denote their union U ,Sn um for S ∈ {0, 1}U ; i=1 Ui; • n distributions Di over subset Ui; and • a feasibility constraint F over [n], which is a collection of subsets of [n]. On the i-th time period, the algorithm observes a valuations vector Xi ∈ Ui drawn according to Di, independently from outcomes and actions on past and future days. The algorithm must decide (immediately and irrevocably) whether to add i and Xi to sets W and XW , respectively, subject to the constraint that W remains feasible in F. The objective is to maximize bf (XW ). 15 Below (Proposition 7.4) we give an O (log n · log r)-competitive algorithm for Monotone XOS Downward-Closed Prophet. By Dobzinski's lemma (Lemma 3.9), this implies an O(cid:0)log n · log2 r(cid:1)-competitive algorithm for Monotone Subadditive Downward-Closed Prophet. Proposition 7.4. There is a deterministic algorithm for Monotone XOS Downward- Closed Prophet that achieves a competitive ratio of O (log n · log r). 7.2 XOS to XOS with {0, 1} coefficients Below (Proposition 7.5), we give an O (log n)-competitive algorithm for Monotone XOS Downward-Closed Prophet in the special case where all the vectors v ∈ U are in {0, 1}M . First, let us show why this would imply Proposition 7.4. Proof of Proposition 7.4 from Proposition 7.5. We recover separately the contributions from "tail" events (a single item taking an exceptionally high value) and the "core" contribution that is spread over many items. Run the better of the following two algorithms: Tail Let OP T denote the expected offline optimum value. Whenever we see a feasible item whose valuations vector Xi has value at least 2OP T , we select it. For item i, let pi = Pr [Xi ≥ 2OP T ]. We have OP T ≥ 2OP T · Pr [∃i : Xi ≥ 2OP T ] = 2OP T ·(cid:16)1 −Y (1 − pi)(cid:17) . Dividing by OP T and rearranging, we get and thus 1/2 ≤Y (1 − pi) ≤ e− P pi, X pi ≤ ln 2. Therefore the probability that we want to take an item but can't is at most ln 2, so this algorithm achieves at least a (1 − ln 2)-fraction of the expected contribution from values greater than 2OP T . Core Observe that we can safely ignore values less than OP T /2r, as those can contribute a total of at most OP T /2. Partition all remaining values into 2+log r intervals [OP T /2r, OP T /r] , . . . , [OP T, 2OP T ]. The expected contribution from the values in each interval is Ω (1/ log r)- fraction of the expected offline optimum without values greater than 2OP T . Pick the interval with the largest expected contribution, round down all the values in this interval, and run expected contribution from values less than or equal to 2OP T . the algorithm guaranteed by Proposition 7.5. This achieves an Ω(cid:16) 7.3 XOS with {0, 1} coefficients Proposition 7.5. When the Xi's take values in {0, 1}M , there is a deterministic algorithm for Monotone XOS Downward-Closed Prophet that achieves a competitive ratio of O (log n). log n·log r(cid:17)-fraction of the 1 16 7.3.1 A dynamic potential function At each iteration, the algorithm maintains a target value τ and a target probability π, where π is the probability (over future realizations) that the current restricted prophet beats τ . We say that an outcome (i.e. a pair of item and valuations vector) is good if selecting it does not decrease the probability of beating the target value by a factor greater than n2, and bad otherwise. Notice that all the bad items together contribute at most a (1/n)-fraction of the probability of beating τ . A key ingredient is that τ is updated dynamically. If the probability of observing a good outcome is too low (less than 1/4), we deduct 1 from τ . We show (Lemma 7.9) that this increases π by a factor of at least 2. Since π decreases by at most an n2 factor when we select an item, and increases by a factor of 2 whenever we deduct 1 from τ : we balance 2 log n deductions for every item the algorithm selects, and this gives the O (log n) competitive ratio. So far our algorithm is roughly as follows: set a target value τ ; whenever the probability π of reaching the target τ drops below 1/4, decrease τ ; if π > 1/4, sit and wait for a good outcome - one will arrive with probability at least 1/4 (we actually do this with Pr[A] instead of π, where A is a closely related event). There is one more subtlety: what should the algorithm do if no good outcomes arrive? In other words, what if the probability of observing a good outcome is neither very low nor very close to 1, say 1/2 or even 1− 1 log n ? On one hand, we can't decrease τ again, because we are no longer guaranteed a significant increase in π; on the other hand, after, say Θ(cid:0)log2 n(cid:1) iterations, we still have a high probability of having an iteration where none of the good outcomes arrive. (If no good outcomes are coming, we don't want the algorithm to wait forever...) Fortunately, there is a simple solution: the algorithm waits for the last item with a good outcome in its support; if, against the odds, no good outcomes have yet been observed, the algorithm "hallucinates" that this last item has a good valuations vector, and selects it. In expectation, at most a constant fraction of the items we select are "hallucinated", so the competitive ratio is still O (log n). 7.3.2 Notation We let OP T denote the expected (offline) optimum. W is the set of items selected so far (W for "Wins"), and ℓW , max {i ∈ W} is the index of the last selected item. Let F denote the family of all feasible subsets of [n]. For any T ⊆ [n], let FT denote the family of feasible sets whose intersection with {1, . . . , max (T )} is exactly T . i )m∈M ∈ {0, 1}M denote the random vector drawn for the i-th item. We use Let Xi = (X m zi to refer to the observed realization of Xi. Our algorithm will maintain a subset M ′ ⊆ M . We let VM ′(cid:0)F, X[n](cid:1) , max S∈F max m∈M ′Xi∈S (Xi)m denote the value of optimum offline solution (note that this is also a random variable). Let τ = τ (W ) be the current target value, and π = π (τ, W ) denotes the current target probability: π (τ, W ) , PrhVM ′(cid:16)FW , X[n](cid:17) > τ X[ℓW ] = z[ℓW ]i . For each yj ∈ supp(cid:16)Xj(cid:17), we define πj,yj = πj,yj (τ, W ) to be the probability of reaching τ , given that: • zj = yj, 17 • j is the next item we select, and • item j actually contributes 1 to the offline optimum. Formally, πj,yj (τ, W ) , Pr(cid:2)VM ′∩yj(cid:0)FW +j, X[n](cid:1) > τ X[ℓW ]∪[j] =(cid:0)z[ℓW ], yj(cid:1)(cid:3) , j = 1. We say that a future outcome (j, yj) is good if πj,yj ≥ n−2·π and j is feasible (and otherwise where we slightly abuse notation and also use yj to denote the set of m ∈ M such that ym it is bad), and let G = {good (j, yj)} denote the set of good future outcomes. Finally, A , A (π, τ, W ) , is the event that at least one of the good outcomes occur. 7.3.3 Updated proof plan and the algorithm The idea is to always maintain a threshold τ such that probability of one of the good outcomes to occur is large, i.e. Pr[A] is at least a constant 1 4 . The way we do this is by showing in Claim 7.6 that at any time during the execution of the algorithm, conditioned on what all has happened till now, the probability π that the offline algorithm achieves the threshold τ gives a lower bound on Pr[A]. Hence, whenever Pr[A] goes below 1 4 , we decrease the threshold τ , which increases π due to Lemma 7.9 and, indirectly, increases Pr[A] by Claim 7.6. due to Ledoux to show that in the beginning τ = OP T /2 satisfies π > 1 4 . Initialize τ ← OP T /2, M ′ ← M , and W ← ∅. Lemma 7.8 uses a concentration bound After each update to W , decrease τ until Pr [A] ≥ 1/4, or until W > τ . When Pr [A] ≥ 1/4, reveal the values of items until observing a good outcome. When we observe a good outcome zj, add j to W and restrict M ′ to its intersection with zj. Since we restrict M to M ′, this gives us that at any time VM ′ (F, XW ) = W. If we reach the last item with good outcomes in its support, and none of the good outcomes realize, add this last item to G and subtract 1 from τ (without modifying M ′). See also pseudocode in Algorithm 1. We first claim that π gives us a lower bound on Pr[A] because most of the mass in π comes from good outcomes. Claim 7.6. At any point during the run of the algorithm, Pr[A (π, τ, W )] ≥(cid:18)1 − 1 n(cid:19) π(W, τ ). Proof. For each (j, yj) /∈ G, we have, by definition of G, πj,yj (W, τ ) < n−2 · π (W, τ ) . Summing over all (j, yj) /∈ G, 18 Algorithm 1 Prophet ; M ′ ← M ; W ← ∅ 2 1. τ ← OP T 2. while τ > W: # π is the probability that, given the history, the offline optimum can still beat τ . (a) π ← Pr(cid:2)VM ′(cid:0)FW , X[n](cid:1) > τ X[ℓW ] = z[ℓW ](cid:3) (b) G ←(cid:8)(j, yj) : j > ℓW AND πj,yj ≥ n−2 · π(cid:9) ∩(cid:16)SS∈FW # G is the set of good and feasible outcomes. S(cid:17) (c) if Pr [A] ≥ 1/4 # A good outcome is likely occur. i. j∗ ← min{j ∈ G : (j, zj ) ∈ G} ii. if j∗ = ∞ # Wait for a good and feasible outcome. # No good outcomes. A. j∗ ← max G B. τ ← τ − 1 # Select the last potentially good item. # Adjust the target value to account for select an item with value 0 iii. else # j∗ is actually a good item. A. M ′ ← M ′ ∩ zj iv. W ← W ∪ {j∗} (d) else i. τ ← τ − 1 # decrease target value τ until Pr [A] ≥ 1/4. 19 Xj Xyj:(j,yj) /∈G Pr [yj] · πj,yj (W, τ ) ≤Xj Xyj :(j,yj) /∈G Pr [yj] ·(cid:0)n−2 · π (W, τ )(cid:1) n−2 · π (W, τ ) ≤Xj ≤ n−1 · π (W, τ ) . Thus, most of π comes from good (j, yj)'s: Pr[A] =Xj Xyj :(j,yj)∈G Pr [yj] · πj,yj (W, τ ) ≥ (1 − 1/n) π (W, τ ) . (7.1) 7.3.4 Concentration for the beginning Theorem 7.7. [Led97, Theorem 2.4] There exists some constant K > 0 such that the fol- lowing holds. Let Yi's be independent (but not necessarily identical) random variables in some space S; let C be a countable class of measurable functions f : S → [0, 1]; and let Z = supf ∈CPn i=1 f (Yi). Then, t t To make the connection to our setting, let Yi be the vector in [0, 1]F ×M whose (S, m)-th coordinate is X m i=1 fS,m (Yi) is simply i the value of the set S under the m-th summation in the XOS representation of the valuation function. Let C , {fS}S∈F . The above concentration inequality can now be written as K · log(cid:18)1 + Pr [Z ≥ E [Z] + t] ≤ exp(cid:18)− E [Z](cid:19)(cid:19) . if i ∈ S, and 0 otherwise. Let fS,m (Yi) , [Yi]S,m, soPn Pr(cid:2)V (cid:0)F, X[n](cid:1) ≥ OP T + t(cid:3) ≤ exp(cid:18)− K · log(cid:18)1 + t OP T(cid:19)(cid:19) . t Lemma 7.8. Assume OP T ≥ Ω (log n). Then, Pr(cid:20)V (cid:0)F, X[n](cid:1) ≥ OP T 2 (cid:21) > 1/4. Proof. We have, OP T = ∞ −OP T Pr(cid:2)V (cid:0)F, X[n](cid:1) ≥ OP T + t(cid:3) dt, which can be decomposed as to integrals over [−OP T,−OP T /2], [OP T,∞]. The first two integrals can be easily bounded as (7.2) (7.3) [−OP T /2, OP T ], and −OP T /2 −OP T Pr(cid:2)V (cid:0)F, X[n](cid:1) ≥ OP T + t(cid:3) dt ≤ −OP T /2 −OP T 1 · dt ≤ OP T 2 20 and OP T −OP T /2 ∞ OP T For the third integral we use the concentration bound (7.2): 2 ≤ OP T −OP T /2 3OP T Pr(cid:2)V (cid:0)F, X[n](cid:1) ≥ OP T + t(cid:3) dt ≤ OP T Pr(cid:2)V (cid:0)F, X[n](cid:1) ≥ OP T /2(cid:3) dt · Pr(cid:20)V (cid:0)F, X[n](cid:1) > 2 (cid:21) . K · log(cid:18)1 + exp(cid:18)− Pr(cid:2)V (cid:0)F, X[n](cid:1) ≥ OP T + t(cid:3) dt ≤ ∞ exp(cid:18)− K(cid:19) dt ≤ ∞ = hKe−t/Ki∞ = K · e−OP T /K, OP T(cid:19)(cid:19) dt t t OP T OP T OP T t which is negligible since OP T = ω (1). Plugging into (7.3), we have: OP T ≤ OP T 2 + 3OP T 2 and after rearranging we get · Pr(cid:20)V (cid:0)F, X[n](cid:1) > OP T 2 (cid:21) + o (1) , Pr(cid:20)V (cid:0)F, X[n](cid:1) > OP T 2 (cid:21) ≥ 1/3 − o (1) . 7.3.5 Main lemma Lemma 7.9. At any point during the run of the algorithm, if Pr [A] ≤ 1/4, then subtracting 1 from τ doubles π; i.e. π (W, τ − 1) ≥ 2π (W, τ ) . Proof of Lemma 7.9. Consider the event that the optimum solution (conditioned on the items W we already selected and the realizations z[ℓW ] we have already seen) reaches τ . We can write it as a union of disjoint events, depending on the next item j > ℓW that is part of the optimum solution, and its possible realizations yj: π (W, τ ) =Xj Xyj Pr [yj] · Pr(cid:2)VM ′∩yj(cid:0)FW ∪{j}, X[n](cid:1) > τ X[ℓW ]∪[j] =(cid:0)z[ℓW ], yj(cid:1)(cid:3) } πj,yj (W,τ ) {z . We break the RHS into the sum over (j, yj)'s that are good and the sum over those that are bad. Now, Claim 7.6 gives Xj Xyj:(j,yj)∈G Pr [yj] · πj,yj (W, τ ) ≥ (1 − 1/n) π (W, τ ) . (7.4) Since yj ∈ {0, 1}M , each item can contribute at most 1 to the offline optimum. Therefore: 21 Pr(cid:2)VM ′∩yj(cid:0)FW ∪{j}, X[n](cid:1) > τ X[ℓW ]∪[j] =(cid:0)z[ℓW ], yj(cid:1)(cid:3) } πj,yj =πj,yj (τ,W ) {z Plugging into (7.4), we have ≤ πj,0 (W, τ − 1) (1 − 1/n) π (W, τ ) ≤ Xj Xyj:(j,yj)∈G Pr [yj] · πj,0 (W, τ − 1) ≤ Xj ≤ Xj Pr [(j, yj) ∈ G] · πj,0 (W, τ − 1) Pr [(j, yj) ∈ G] · π (W, τ − 1) , (7.5) where the second inequality follows because πj,0 (W, τ − 1) doesn't depend on yj, and the third because conditioning on the j-th item being 0 can only decrease the probability of reaching τ − 1. Recall that A is the union of all the events (j, yj) ∈ G. Therefore, Pr [A] ≥Xj Pr [(j, yj ) ∈ G] (1 − Pr [A]) Plugging in Pr [A] < 1/4, we get that Pj Pr [(j, yj) ∈ G] < 1/3. Plugging into (7.5) and rearranging, we get π (W, τ − 1) ≥ π (W, τ ) . 3n n − 1 7.3.6 Putting it all together Lemma 7.10. At any point during the run of the algorithm, τ ≥ OP T 2 − (2 log n + 1) · W − 2 Proof. We prove by induction that at any point during the run of the algorithm, log π ≥ −2 − (2 log n + 1) · W +(cid:18) OP T 2 − τ(cid:19) . (7.6) After initialization, log π ≥ −2 by Lemma 7.8. By definition of G, whenever we add an item to W , we decrease log π by at most 2 log n - hence the 2 log n·W term. Notice that when the algorithm "hallucinates" a 1, we also decrease τ by 1 to correct for the hallucination - at any point during the run of the algorithm, this has happened at most W times. Recall that we may also decrease τ in the last line of Algorithm 1 (in order to increase π); whenever we do this, τ decreases by 1, but π doubles (by Lemma 7.9), so log π increases by 1, and Inequality (7.6) is preserved. Finally, since π is a probability, we always maintain log π ≤ 0. We are now ready to complete the proof of Theorem 7.2. 22 OP T Proof of Proposition 7.5. The algorithm always terminates after at most O (OP T ) decreases to the value of τ . By Lemma 7.10, when the algorithm terminates, we have W ≥ τ ≥ 2 − (2 log n + 1) · W − 2, and therefore in particular W ≥ OP T −4 4 log n+4 . Finally, recall that sometimes the algorithm "hallucinates" good realizations, i.e. for some items i ∈ W that we select, Xi = 0. However, each time we add an item, the probability that we add a zero-value item is at most 3/4 (by the condition Pr [A] > 1/4). Therefore in expectation the value of the algorithm is at least W /4. Acknowledgements The second author thanks Anupam Gupta for introducing him to submodular optimization. References [ADSY12] Shipra Agrawal, Yichuan Ding, Amin Saberi, and Yinyu Ye. Price of correlations in stochastic optimization. Operations Research, 60(1):150–162, 2012. [AHL12] Saeed Alaei, MohammadTaghi Hajiaghayi, and Vahid Liaghat. Online prophet- inequality matching with applications to ad allocation. In ACM Conference on Electronic Commerce, EC '12, Valencia, Spain, June 4-8, 2012, pages 18–35, 2012. [AKW14] Pablo Daniel Azar, Robert Kleinberg, and S. Matthew Weinberg. Prophet in- equalities with limited information. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 1358–1377, 2014. [Ala11] Saeed Alaei. Bayesian combinatorial auctions: Expanding single buyer mech- anisms to many buyers. In IEEE 52nd Annual Symposium on Foundations of Computer Science, FOCS 2011, Palm Springs, CA, USA, October 22-25, 2011, pages 512–521, 2011. [BCK12] Anand Bhalgat, Tanmoy Chakraborty, and Sanjeev Khanna. Mechanism design for a risk averse seller. In Internet and Network Economics - 8th International Workshop, WINE 2012, Liverpool, UK, December 10-12, 2012. Proceedings, pages 198–211, 2012. [BFNS14] Niv Buchbinder, Moran Feldman, Joseph Seffi Naor, and Roy Schwartz. Submod- ular maximization with cardinality constraints. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1433–1452. SIAM, 2014. [BFS15] [BH16] Niv Buchbinder, Moran Feldman, and Roy Schwartz. Online submodular max- imization with preemption. In Proceedings of the Twenty-Sixth Annual ACM- SIAM Symposium on Discrete Algorithms, pages 1202–1216. SIAM, 2015. Eric Balkanski and Jason D. Hartline. Bayesian budget feasibility with posted pricing. In Proceedings of the 25th International Conference on World Wide Web, WWW 2016, Montreal, Canada, April 11 - 15, 2016, pages 189–203, 2016. 23 [BHZ13] MohammadHossein Bateni, Mohammad Taghi Hajiaghayi, and Morteza Zadi- moghaddam. Submodular secretary problem and extensions. ACM Trans. Algo- rithms, 9(4):32, 2013. [BIK07] Moshe Babaioff, Nicole Immorlica, and Robert Kleinberg. Matroids, secretary problems, and online mechanisms. In Proceedings of the Eighteenth Annual ACM- SIAM Symposium on Discrete Algorithms, SODA 2007, New Orleans, Louisiana, USA, January 7-9, 2007, pages 434–443, 2007. [BMKK14] Ashwinkumar Badanidiyuru, Baharan Mirzasoleiman, Amin Karbasi, and An- dreas 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. [BPR+16] Ashwinkumar Badanidiyuru, Christos H. Papadimitriou, Aviad Rubinstein, Lior Seeman, and Yaron Singer. Locally adaptive optimization: Adaptive seeding for monotone submodular functions. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 414–429, 2016. [BUCM12] Siddharth Barman, Seeun Umboh, Shuchi Chawla, and David L. Malec. Secre- tary problems with convex costs. In Automata, Languages, and Programming - 39th International Colloquium, ICALP 2012, Warwick, UK, July 9-13, 2012, Proceedings, Part I, pages 75–87, 2012. [CCPV07] Gruia Calinescu, Chandra Chekuri, Martin P´al, and Jan Vondr´ak. Maximizing a submodular set function subject to a matroid constraint. In Integer programming and combinatorial optimization, pages 182–196. Springer, 2007. [CGQ15] Chandra Chekuri, Shalmoli Gupta, and Kent Quanrud. Streaming algorithms for submodular function maximization. In International Colloquium on Automata, Languages, and Programming, pages 318–330. Springer, 2015. [CK15] [CVZ14] Amit Chakrabarti and Sagar Kale. Submodular maximization meets streaming: Matchings, matroids, and more. Mathematical Programming, 154(1-2):225–247, 2015. Chandra Chekuri, Jan Vondr´ak, and Rico Zenklusen. Submodular function max- imization via the multilinear relaxation and contention resolution schemes. SIAM J. Comput., 43(6):1831–1879, 2014. [DHK+13] Nikhil R. Devanur, Zhiyi Huang, Nitish Korula, Vahab S. Mirrokni, and Qiqi Yan. Whole-page optimization and submodular welfare maximization with online bidders. In ACM Conference on Electronic Commerce, EC '13, Philadelphia, PA, USA, June 16-20, 2013, pages 305–322, 2013. [Din13] [Dob07] Michael Dinitz. Recent advances on the matroid secretary problem. SIGACT News, 44(2):126–142, 2013. Shahar Dobzinski. Two randomized mechanisms for combinatorial auctions. In Approximation, Randomization, and Combinatorial Optimization. Algorithms 24 and Techniques, 10th International Workshop, APPROX 2007, and 11th Inter- national Workshop, RANDOM 2007, Princeton, NJ, USA, August 20-22, 2007, Proceedings, pages 89–103, 2007. [Dyn63] E. B. Dynkin. The optimum choice of the instant for stopping a markov process. Sov. Math. Dokl., 1963. [EHLM15] Hossein Esfandiari, MohammadTaghi Hajiaghayi, Vahid Liaghat, and Morteza In Algorithms - ESA 2015 - 23rd Annual Monemizadeh. Prophet secretary. European Symposium, Patras, Greece, September 14-16, 2015, Proceedings, pages 496–508, 2015. [Fei09] [FI15] Uriel Feige. On maximizing welfare when utility functions are subadditive. SIAM Journal on Computing, 39(1):122–142, 2009. Moran Feldman and Rani Izsak. Building a good team: Secretary problems and the supermodular degree. CoRR, abs/1507.06199, 2015. [FMV11] Uriel Feige, Vahab S Mirrokni, and Jan Vondrak. Maximizing non-monotone submodular functions. SIAM Journal on Computing, 40(4):1133–1153, 2011. [FNS11] Moran Feldman, Joseph Naor, and Roy Schwartz. Improved competitive ra- tios for submodular secretary problems (extended abstract). In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques - 14th International Workshop, APPROX 2011, and 15th International Workshop, RANDOM 2011, Princeton, NJ, USA, August 17-19, 2011. Proceedings, pages 218–229, 2011. [FSZ15] [FSZ16] Moran Feldman, Ola Svensson, and Rico Zenklusen. A simple O (log log(rank))- competitive algorithm for the matroid secretary problem. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 1189–1201, 2015. Moran Feldman, Ola Svensson, and Rico Zenklusen. Online contention resolution schemes. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 1014–1033, 2016. [FZ15] Moran Feldman and Rico Zenklusen. The submodular secretary problem goes linear. In Foundations of Computer Science (FOCS), 2015 IEEE 56th Annual Symposium on, pages 486–505. IEEE, 2015. [GK10] Daniel Golovin and Andreas Krause. Adaptive submodularity: A new approach to active learning and stochastic optimization. In COLT, pages 333–345, 2010. [GKS14] Daniel Golovin, Andreas Krause, and Matthew Streeter. Online submodular max- imization under a matroid constraint with application to learning assignments. arXiv preprint arXiv:1407.1082, 2014. [HK92] Theodore P Hill and Robert P Kertz. A survey of prophet inequalities in optimal stopping theory. Contemp. Math, 125:191–207, 1992. 25 [HK12] Elad Hazan and Satyen Kale. Online submodular minimization. Journal of Ma- chine Learning Research, 13(Oct):2903–2922, 2012. [HKP04] Mohammad Taghi Hajiaghayi, Robert D. Kleinberg, and David C. Parkes. Adap- tive limited-supply online auctions. In Proceedings 5th ACM Conference on Elec- tronic Commerce (EC-2004), New York, NY, USA, May 17-20, 2004, pages 71– 80, 2004. [HKS07] Mohammad Taghi Hajiaghayi, Robert D. Kleinberg, and Tuomas Sandholm. Au- tomated online mechanism design and prophet inequalities. In Proceedings of the Twenty-Second AAAI Conference on Artificial Intelligence, July 22-26, 2007, Vancouver, British Columbia, Canada, pages 58–65, 2007. [KKN15] Thomas Kesselheim, Robert D. Kleinberg, and Rad Niazadeh. Secretary problems with non-uniform arrival order. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015, pages 879–888, 2015. [Kle05] Robert D. Kleinberg. A multiple-choice secretary algorithm with applications to online auctions. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2005, Vancouver, British Columbia, Canada, Jan- uary 23-25, 2005, pages 630–631, 2005. [KMZ15] Nitish Korula, Vahab Mirrokni, and Morteza Zadimoghaddam. Online submod- ular welfare maximization: Greedy beats 1/2 in random order. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, pages 889–898. ACM, 2015. [KPV13] Michael Kapralov, Ian Post, and Jan Vondr´ak. Online submodular welfare maxi- mization: Greedy is optimal. In Proceedings of the Twenty-Fourth Annual ACM- SIAM Symposium on Discrete Algorithms, pages 1216–1225. Society for Industrial and Applied Mathematics, 2013. [KS77] [KSS13] [KW12] [Lac14] Ulrich Krengel and Louis Sucheston. Semiamarts and finite values. Bull. Amer. Math. Soc., 83(4):745–747, 07 1977. Pushmeet Kohli, Mahyar Salek, and Greg Stoddard. A fast bandit algorithm for recommendation to users with heterogenous tastes. In Proceedings of the Twenty- Seventh AAAI Conference on Artificial Intelligence, July 14-18, 2013, Bellevue, Washington, USA., 2013. Robert Kleinberg and S. Matthew Weinberg. Matroid prophet inequalities. In Proceedings of the 44th Symposium on Theory of Computing Conference, STOC 2012, New York, NY, USA, May 19 - 22, 2012, pages 123–136, 2012. Oded Lachish. O(log log rank) competitive ratio for the matroid secretary prob- lem. In 55th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 326–335, 2014. [Led97] Michel Ledoux. On Talagrand's deviation inequalities for product measures. ESAIM: Probability and Statistics, 1:63–87, 1997. 26 [RSS15] [Rub16] [RW15] Aviad Rubinstein, Lior Seeman, and Yaron Singer. Approximability of adaptive seeding under knapsack constraints. In Proceedings of the Sixteenth ACM Confer- ence on Economics and Computation, EC '15, Portland, OR, USA, June 15-19, 2015, pages 797–814, 2015. Aviad Rubinstein. Beyond matroids: secretary problem and prophet inequal- ity with general constraints. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 324–332, 2016. Aviad Rubinstein and S. Matthew Weinberg. Simple mechanisms for a subad- ditive buyer and applications to revenue monotonicity. In Proceedings of the Sixteenth ACM Conference on Economics and Computation, EC '15, Portland, OR, USA, June 15-19, 2015, pages 377–394, 2015. [Sch99] Gideon Schechtman. Concentration, results and applications, 1999. [SG08] [Var15] [Yan11] Matthew Streeter and Daniel Golovin. An online algorithm for maximizing sub- modular functions. In Advances in Neural Information Processing Systems, pages 1577–1584, 2008. Shai Vardi. The returning secretary. In 32nd International Symposium on The- oretical Aspects of Computer Science, STACS 2015, March 4-7, 2015, Garching, Germany, pages 716–729, 2015. Qiqi Yan. Mechanism design via correlation gap. In Proceedings of the twenty- second annual ACM-SIAM symposium on Discrete Algorithms, pages 710–719. SIAM, 2011. A Missing Proofs Lemma 3.6. Consider any submodular function f and L, H ∈ [0, 1]. Let S∗ be a set that maximizes f , and let x ∈ [0, 1]n such that for all i ∈ [n], L ≤ xi ≤ H. Then, F (x) ≥ (1 − H)(1 − L)f (∅) + (1 − H)L · f (S∗) Proof. Assume, wlog, that S∗ = {1, . . . , k}. By submodularity, at each step after we add another element, the potential marginal gain of all other elements decreases. In particular, if we add the elements in S∗ in any order, they all have non-negative marginal contribution (since each has a non-negative marginal contribution when added last). Let x≤i denote the restriction of x to [i]. We first show by induction that for every i ≤ k, F (x≤i) ≥ (1 − L)f (∅) + L · f ([i]). Denote Si , S ∩ [i]. We have that F (x≤i) is at least: ES∼xhf (Si)i ≥ ES∼xhf (Si−1) + f (Si ∪ [i − 1]) − f ([i − 1])i = F (x≤i−1) + ES∼xhf (Si ∪ [i − 1]) − f ([i − 1])i ≥ F (x≤i−1) + xi(cid:16)f ([i]) − f ([i − 1])(cid:17) ≥ F (x≤i−1) + L(cid:16)f ([i]) − f ([i − 1])(cid:17) (Submodularity) (Submodularity) (f ([i]) − f ([i − 1]) ≥ 0). 27 Finally by the induction hypothesis, F (x≤i−1) ≥ (1 − L)f (∅) + L · f ([i − 1]). In particular, we now have that F (x≤k) ≥ (1 − L)f (∅) + L · f (S∗). It is left to argue that the rest of the elements do not hurt the value too much. Consider any Si ⊆ S∗, and let B∗ = B∗(Sk) = {k + 1, . . . , ℓ} be the worst set that we could add to Sk, i.e. the B that minimizes f (Sk ∪ B). Let Bj , {k + 1, . . . , ℓ} ⊆ B∗, and let Tj denote the intersection of Bj with a set T ⊆ T ∗ sampled according to x. Now consider two options for adding elements from T ∗ to Sk: 1. deterministically, or 2. independently at random with probabilities sampled according to x. Since f is non-negative, we have that even when we add all the bad elements deterministically, X f (Sk ∪ Bj) − f (Sk ∪ Bj−1) = f (Sk ∪ B∗) − f (Sk) ≥ −f (Sk). (A.1) When we add the elements at random, we have (by submodularity) that the marginal contri- bution of each bad element can only increase compared to its contribution in the first case. Therefore, ET [f (Sk ∪ T ) − f (Sk)] =X ET [f (Sk ∪ Tj) − f (Sk ∪ Tj−1)] ≥X xj (f (Sk ∪ Bj) − f (Sk ∪ Bj−1)) ≥X H (f (Sk ∪ Bj) − f (Sk ∪ Bj−1)) ≥ −Hf (Sk) (Submodularity) (f (Sk ∪ Bj) − f (Sk ∪ Bj−1) ≤ 0) (Inequality (A.1)). So far we have ET [f (Sk ∪ T )] ≥ (1 − H)f (Sk). Finally, the marginal contribution of the remaining elments {ℓ + 1, . . . , n} is non-negative by submodularity (if it were negative, we could get a worse set B′). Therefore, for every Sk, adding the rest of the elements can decrease the value by at most a factor of 1 − H. 28
1804.08236
1
1804
2018-04-23T03:21:10
How Bad is the Freedom to Flood-It?
[ "cs.DS" ]
Fixed-Flood-It and Free-Flood-It are combinatorial problems on graphs that generalize a very popular puzzle called Flood-It. Both problems consist of recoloring moves whose goal is to produce a monochromatic ("flooded") graph as quickly as possible. Their difference is that in Free-Flood-It the player has the additional freedom of choosing the vertex to play in each move. In this paper, we investigate how this freedom affects the complexity of the problem. It turns out that the freedom is bad in some sense. We show that some cases trivially solvable for Fixed-Flood-It become intractable for Free-Flood-It. We also show that some tractable cases for Fixed-Flood-It are still tractable for Free-Flood-It but need considerably more involved arguments. We finally present some combinatorial properties connecting or separating the two problems. In particular, we show that the length of an optimal solution for Fixed-Flood-It is always at most twice that of Free-Flood-It, and this is tight.
cs.DS
cs
How Bad is the Freedom to Flood-It? Rémy Belmonte The University of Electro-Communications, Chofu, Tokyo, Japan [email protected] Mehdi Khosravian Ghadikolaei Université Paris-Dauphine, PSL Research University, CNRS, UMR, LAMSADE, 75016 Paris, France [email protected] Masashi Kiyomi Yokohama City University, Yokohama, Japan [email protected] Michael Lampis Université Paris-Dauphine, PSL Research University, CNRS, UMR, LAMSADE, 75016 Paris, France [email protected] Yota Otachi Kumamoto University, Kumamoto, Japan [email protected] 0000-0002-0087-853X Abstract Fixed-Flood-It and Free-Flood-It are combinatorial problems on graphs that generalize a very popular puzzle called Flood-It. Both problems consist of recoloring moves whose goal is to produce a monochromatic ("flooded") graph as quickly as possible. Their difference is that in Free-Flood-It the player has the additional freedom of choosing the vertex to play in each move. In this paper, we investigate how this freedom affects the complexity of the problem. It turns out that the freedom is bad in some sense. We show that some cases trivially solvable for Fixed-Flood-It become intractable for Free-Flood-It. We also show that some tractable cases for Fixed-Flood-It are still tractable for Free-Flood-It but need considerably more involved arguments. We finally present some combinatorial properties connecting or separating In particular, we show that the length of an optimal solution for Fixed- the two problems. Flood-It is always at most twice that of Free-Flood-It, and this is tight. 2012 ACM Subject Classification Mathematics of computing → Graph algorithms, Theory of computation → Parameterized complexity and exact algorithms Keywords and phrases flood-filling game, parameterized complexity Funding This work is partially supported by JSPS and MAEDI under the Japan-France Inte- grated Action Program (SAKURA) Project GRAPA 38593YJ. 1 Introduction Flood-It is a popular puzzle, originally released as a computer game in 2006 by LabPixies (see [2]). In this game, the player is presented with (what can be thought of as) a vertex-colored grid graph, with a designated special pivot vertex, usually the top-left corner of the grid. In each move, the player has the right to change the color of all vertices contained in the same monochromatic component as the pivot to a different color of her choosing. Doing this 8 1 0 2 r p A 3 2 ] S D . s c [ 1 v 6 3 2 8 0 . 4 0 8 1 : v i X r a 23:2 How Bad is the Freedom to Flood-It? judiciously gradually increases the size of the pivot's monochromatic component, until the whole graph is flooded with one color. The goal is to achieve this flooding with the minimum number of moves. See Figure 1 for an example. Figure 1 A flooding sequence on a 3 × 3 grid. Each move in this example changes the color of the top-left monochromatic component. Under such a restriction, the depicted sequence is shortest. Following the description above, Flood-It immediately gives rise to a natural optimization problem: given a vertex-colored graph, determine the shortest sequence of flooding moves that wins the game. This problem has been extensively studied in the last few years (e.g. [13, 16, 18, 17, 10, 6, 21, 7, 19, 12]; a more detailed summary of known results is given below), both because of the game's popularity (and addictiveness!), but also because the computational complexity questions associated with this problem have turned out to be surprisingly deep, and the problem has turned out to be surprisingly intractable. The goal of this paper is to add to our understanding of this interesting, puzzle-inspired, optimization problem, by taking a closer look at the importance of the pivot vertex. As explained above, the classical version of the game only allows the player to change the color of a special vertex and its component and has been studied under the name Fixed- Flood-It [16, 18, 17] (or Flood-It in some papers [2, 21, 6, 7, 12]). However, it is extremely natural to also consider a version where the player is also allowed to play a different vertex of her choosing in each turn. This has also been well-studied under the name Free-Flood-It [2, 13, 16, 18, 17, 6, 21]. See Figure 2. Figure 2 A flooding sequence with no restriction on selected monochromatic components. This is shorter than then one in Figure 1. Since both versions of this problem have been studied before, the question of the impact of the pivot vertex on the problem's structure has (at least implicitly) been considered. Intuitively, one would expect Free-Flood-It to be a harder problem; after all, the player has to choose a color to play and a vertex to play it on, and is hence presented with a larger set of possible moves. The state of the art seems to confirm this intuition, as only some of the positive algorithmic results known for Fixed-Flood-It are known also for Free-Flood-It, while there do exist some isolated cases where Fixed-Flood-It is tractable and Free-Flood-It is hard, for example co-comparability graphs [8, 10] and grids of height 2 [2, 17]. Nevertheless, these results do not completely pinpoint the added complexity brought by the task of selecting a vertex to play, as the mentioned algorithms for Fixed-Flood-It are already non-trivial, and hence the jump in complexity is likely to be the result of the combination of the tasks of picking a color and a vertex. More broadly, [6] presented a generic reduction from Fixed-Flood-It to Free-Flood-It that preserves a number of 11122233331122233331112221111222222222211122233311222111111111111111 R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:3 crucial parameters (number of colors, optimal value, etc.) and gives convincing evidence that Free-Flood-It is always at least as hard as Fixed-Flood-It, but not necessarily harder. Our Results We investigate the complexity of Free-Flood-It, mostly from the point of view of parameterized complexity,1 as well as the impact on the combinatorics of the game of allowing moves outside the pivot. Our first result is to show that Free-Flood-It is W[2]-hard parameterized by the number of moves in an optimal solution. We recall that for Fixed-Flood-It this parameterization is trivially fixed-parameter tractable: when a player has only k moves available, then we can safely assume that the graph uses at most (roughly) k colors, hence one can easily consider all possible solutions in FPT time. The interest of our result is, therefore, to demonstrate that the task of deciding which vertex to play next is sufficient to make Free-Flood-It significantly harder than Fixed-Flood-It. Indeed, the W[2]-hardness reduction we give, implies also that Free-Flood-It is not solvable in no(k) time under the ETH. This tightly matches the complexity of a trivial algorithm which considers all possible vertices and colors to be played. This is the first concrete example showing a case where Fixed-Flood-It is essentially trivial, but Free-Flood-It is intractable. Motivated by this negative result we consider several other parameterizations of the problem. We show that Free-Flood-It is fixed-parameter tractable when parameterized by the number of possible moves and the clique-width. This result is tight in the sense that the problem is hard when parameterized by only one of these parameters. It also implies the fixed-parameter tractability of the problem parameterized by the number of colors and the modular-width. In a similar vein, we present a polynomial kernel when Free-Flood-It is parameterized by the input graph's neighborhood diversity and number of colors. An analogous result was shown for Fixed-Flood-It in [7], but because of the freedom to select vertices, several of the tricks used there do not apply to Free-Flood-It, and our proofs are slightly more involved. Our previously mentioned reduction also implies that Free-Flood-It does not admit a polynomial kernel parameterized by vertex cover, under standard assumptions. This result was also shown for Fixed-Flood-It in [7], but it does not follow immediately for Free-Flood-It, as the reduction of [6] does not preserve the graph's vertex cover. Motivated by the above results, which indicate that the complexity of the problem can be seriously affected if one allows non-pivot moves, we also study some more purely combinatorial questions with algorithmic applications. The main question we pose here is the following. It is obvious that for all instances the optimal number of moves for Free-Flood-It is upper-bounded by the optimal number of moves for Fixed-Flood-It (since the player has strictly more choices), and it is not hard to construct instances where Fixed-Flood-It needs strictly more moves. Can we bound the optimal number of Fixed-Flood-It moves needed as a function of the optimal number of Fixed-Flood-It moves? Somewhat surprisingly, this extremely natural question does not seem to have been explicitly considered in the literature before. Here, we completely resolve it by showing that the two optimal values cannot be more than a factor of 2 apart, and constructing a family of simple instances where they are exactly a factor of 2 apart. As an immediate application, this gives a 2-approximation for Free-Flood-It for every case where Fixed-Flood-It is known to be tractable. We also consider the problem's monotonicity: Fixed-Flood-It has the nice property that even an adversary that selects a single bad move cannot increase the optimal (that is, in 1 For readers unfamiliar with the basic notions of this field, we refer to standard textbooks [4, 9]. 23:4 How Bad is the Freedom to Flood-It? the worst case a bad move is a wasted move). We construct minimal examples which show that Free-Flood-It does not have this nice monotonicity property, even for extremely simple graphs, that is, making a bad move may not only waste a move but also make the instance strictly worse. Such a difference was not explicitly stated in the literature, while the monotonicity of Fixed-Flood-It was seem to be known or at least assumed. The only result we are aware of is the monotonicity of Free-Flood-It on paths shown by Meeks and Scott [16]. Known results In 2009, the NP-hardness of Fixed-Flood-It with six colors was sketched by Elad Verbin as a comment to a blog post by Sariel Har-Peled [23]. Independently to the blog comment, Clifford et al. [2] and Fleischer and Woeginger [8] started investigations of the complexity of the problem, and published the conference versions of their papers at FUN 2010. Here we mostly summarize some of the known results on Free-Flood-It. For more complete lists of previous result, see e.g. [10, 13, 7]. Free-Flood-It is NP-hard if the number of colors is at least 3 [2] even for trees with only one vertex of degree more than 2 [13, 6], while it is polynomial-time solvable for general graphs if the number of colors is at most 2 [2, 16, 13]. Moreover, it is NP-hard even for height-3 grids with four colors [16]. Note that this result implies that Free-Flood-It with a constant number colors is NP-hard even for graphs of bounded bandwidth. If the number of colors is unbounded, then it is NP-hard for height-2 grids [17], trees of radius 2 [6], and, proper interval graphs and caterpillars [10]. Also, it is known that there is no constant-factor approximation with a factor independent of the number of colors unless P = NP [2]. There are a few positive results on Free-Flood-It. Meeks and Scott [18] showed that every colored graph has a spanning tree with the same coloring such that the minimum number of moves coincides in the graph and the spanning tree. Using this property, they showed that if a graph has only a polynomial number of vertex subsets that induce connected subgraphs, then Free-Flood-It (and Fixed-Flood-It) on the graph can be solved in polynomial time. This in particular implies the polynomial-time solvability on subdivisions of a fixed graph. It is also known that Free-Flood-It for interval graphs and split graphs is fixed-parameter tractable when parameterized by the number of colors [10]. Preliminaries 2 For a positive integer k, we use [k] to denote the set {1, . . . , k}. Given a graph G = (V, E), a coloring function col: V → [cmax], where cmax is a positive integer, and u ∈ V , we denote by Comp(col, u) the maximal set of vertices S such that for all v ∈ S, col(u) = col(v) and there exists a path from u to v such that for all its internal vertices w we have col(w) = col(u). In other words, Comp(col, u) is the monochromatic connected component that contains u under the coloring function col. Given G, col, a move is defined as a pair (u, i) where u ∈ V , i ∈ [cmax]. The result of the move (u, c) is a new coloring function col0 defined as follows: col0(v) = c for all v ∈ Comp(col, u); col0(v) = col(v) for all other vertices. In words, a move consists of changing the color of u, and of all vertices in the same monochromatic component as u, to c. Given the above definition we can also define the result of a sequence of moves (u1, c1), (u2, c2), . . . , (uk, ck) on a colored graph with initial coloring function col0 in the natural way, that is, for each i ∈ [k], coli is the result of move (ui, ci) on coli−1. R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:5 The Free-Flood-It problem is defined as follows: given a graph G = (V, E), an integer k, and an initial coloring function col0, decide if there exists a sequence of k moves (u1, c1), (u2, c2), . . . , (uk, ck) such that the result colk obtained by applying this sequence of moves on col0 is a constant function (that is, ∀u, v ∈ V we have colk(u) = colk(v)). In the Fixed-Flood-It problem we are given the same input as in the Free-Flood-It problem, as well as a designated vertex p ∈ V (the pivot). The question is again if there exists a sequence of moves such that colk is monochromatic, with the added constraint that we must have ui = p for all i ∈ [k]. We denote by OPTFree(G, col), OPTFixed(G, col, p) the minimum k such that for the input (G, col) (or (G, col, p) respectively) the Free-Flood-It problem (respectively the Fixed-Flood-It problem) admits a solution. 2.1 Graph parameters Vertex cover number: A set S ⊆ V is a vertex cover of a graph G = (V, E) if each edge in E has at least one end point in S. The minimum size of a vertex cover of a graph is its vertex cover number. By vc(G), we denote the vertex cover number of G. Neighborhood diversity: Let G = (V, E) be a graph. For each vertex v ∈ V , we denote the neighborhood of v by NG(v). The closed neighborhood of v is the set NG[v] := {v}∪NG(v). We omit the subscript G when the underlying graph is clear from the context. Two vertices u, v ∈ V are true twins in G if N[u] = N[v] and are false twins in G if N(u) = N(v). Two vertices are twins if they are true twins or false twins. Note that true twins are adjacent and false twins are not. The neighborhood diversity of G, denoted nd(G), is the minimum number k such that V can be partitioned into k sets of twin vertices. It is known that nd(G) ≤ 2vc(G) + vc(G) for every graph G [14]. Given a graph, its neighborhood diversity and the corresponding partition into sets of twins can be computed in polynomial time [14]; in fact, using fast modular decomposition algorithms, the neighborhood diversity of a graph can be computed in linear time [15, 22]. Modular-width: Let H be a graph with k ≥ 2 vertices v1, . . . , vk, and let H1, . . . , Hk be k graphs. The substitution H(H1, . . . , Hk) of the vertices of H by H1, . . . , Hk is the graph 1≤i≤k V (Ei)∪{{u, w} u ∈ V (Hi), w ∈ V (Hj),{vi, vj} ∈ E(H)}. For each i, the set V (Hi) is called a module of H(H1, . . . , Hk). The modular-width of G, denoted mw(G), is defined recursively as follows: 1≤i≤k V (Hi) and the edge setS with the vertex setS If G has only one vertex, then mw(G) = 1. If G is the disjoint union of graphs G1, . . . , Gh, then mw(G) = max1≤i≤h mw(Gi). If G is a connected graph with two or more vertices, then mw(G) = min H,H1,...,HV (H) max{V (H), mw(H1), . . . , mw(HV (H))}, where the minimum is taken over all tuples of graphs (H, H1, . . . , Hk) such that G = H(H1, . . . , HV (H)). A recursive substitution structure giving the modular-width can be computed in linear- time [15, 22]. It is known that mw(G) ≤ nd(G) for every graph G [11]. Clique-width: A k-expression is a rooted binary tree such that each leaf has label ◦i for some i ∈ {1, . . . , k}, each non-leaf node with two children has label ∪, and each non-leaf node with only one child has label ρi,j or ηi,j (i, j ∈ {1, . . . , k}, i 6= j). a ◦i-node represents a graph with one i-vertex; Each node in a k-expression represents a vertex-labeled graph as follows: 23:6 How Bad is the Freedom to Flood-It? a ∪-node represents the disjoint union of the labeled graphs represented by its children; a ρi,j-node represents the labeled graph obtained from the one represented by its child by replacing the labels of the i-vertices with j; an ηi,j-node represents the labeled graph obtained from the one represented by its child by adding all possible edges between the i-vertices and the j-vertices. A k-expression represents the graph represented by its root. The clique-width of a graph G, denoted by cw(G), is the minimum integer k such that there is a k-expression representing a graph isomorphic to G. From their definitions, cw(G) ≤ mw(G) holds for every graph G. Figure 3 shows relationships among the graph parameters introduced above together with the well-known treewidth and pathwidth (see [4] for definitions of these two parameters). Figure 3 Graph parameters. Each segment implies that the one above is more general than the one below. For example, bounded modular-width implies bounded clique-width but not vice versa. 3 W[2]-hardness of Free-Flood-It The main result of this section is that Free-Flood-It is W[2]-hard when parameterized by the minimum length of any valid solution (the natural parameter). The proof consists of a reduction from Set Cover, a canonical W[2]-complete problem. Before presenting the construction, we recall two basic observations by Meeks and Vu [19], both of which rest on the fact that any single move can (at most) eliminate a single color from the graph, and this can only happen if a color induces a single component. (cid:73) Lemma 3.1 ([19]). For any graph G = (V, E), and coloring function col that uses cmax distinct colors, we have OPTFree(G, col) ≥ cmax − 1. (cid:73) Lemma 3.2 ([19]). For any graph G = (V, E), and coloring function col that uses cmax distinct colors, such that for all c ∈ [cmax], G[col−1(c)] is a disconnected graph, we have OPTFree(G, col) ≥ cmax. The proof of Theorem 3.6 relies on a reduction from a special form of Set Cover, which we call Multi-Colored Set Cover (MCSC for short). MCSC is defined as follows: (cid:73) Definition 3.3. In Multi-Colored Set Cover (MCSC) we are given as input a set of elements R and k collections of subsets of R, S1, . . . ,Sk. We are asked if there exist k sets S1, . . . , Sk such that for all i ∈ [k], Si ∈ Si, and ∪i∈[k]Si = R. Observe that MCSC is just a version of Set Cover where the collection of sets is given to us pre-partitioned into k parts and we are asked to select one set from each part to form a set cover of the universe. It is not hard to see that any Set Cover instance (S, R) where we are asked if there exists a set cover of size k can easily be transformed to an equivalent MCSC instance simply by setting Si = S for all i ∈ [k], since the definition of MCSC does clique-widthtreewidthpathwidthmodular-widthneighborhooddiversityvertexcovernumber R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:7 ... ... ... ... ... ... L1 I1 L2 I2 Lk Ik ... ... ... ... ... ... ... ... R ... ... ... u Figure 4 The graph G = (V, E) of Free-Flood-It constructed from the given MCSC instance. All the vertices in each Ii have color i and all black vertices have color k + 1. Boxes containing black vertices have size 3k. Also each vertex in Li has k neighbors with degree 1 colored 1, ..., k. not require that the sub-collections Si be disjoint. We conclude that known hardness results for Set Cover immediately transfer to MCSC, and in particular MCSC is W[2]-hard when parameterized by k. Construction We are now ready to describe our reduction which, given a MCSC instance with universe R and k collections of sets Si, i ∈ [k], produces an equivalent instance of Free-Flood-It, that is, a graph G = (V, E) and a coloring function col on V . We construct this graph as follows: for every set S ∈ Si, construct a vertex in V . The set of vertices in V corresponding to sets of Si is denoted by Ii and col(v) = i for each v ∈ Ii. I1 ∪ ... ∪ Ik induces an independent set colored {1, ..., k}. for each i ∈ [k], construct 3k new vertices, denoted by Li and connect all of them to all vertices of Ii such that Li ∪ Ii induces a complete bipartite graph of size 3k × Ii. Then set col(v) = k + 1 for each v ∈ Li, for all i ∈ [k]. for each vertex v ∈ Li for 1 ≤ i ≤ k, construct k new leaf vertices connected to v with distinct colors 1, ..., k. for each element e ∈ R, construct a vertex e. For each S ∈ Si such that e ∈ S we connect e to the vertex of Ii that represents S. add a special vertex u with col(u) = k + 1 which is connected it to all vertices in Ii for i ∈ [k]. An illustration of G is shown in Fig.4. In the following we will show that (G, col) as an instance of Free-Flood-It is solvable with at most 2k moves if and only if the given MCSC instance has a set cover of size k which contains one set of each Si. (cid:73) Lemma 3.4. If (S1, . . . ,Sk, R) is a YES instance of MCSC then OPTFree(G, col) ≤ 2k. 23:8 How Bad is the Freedom to Flood-It? Proof. Suppose that there is a solution S1, . . . , Sk of the given MCSC instance, with Si ∈ Si, for i ∈ [k] and ∪i∈[k]Si = R. Recall that for each Si there is a vertex in Ii in the constructed graph representing Si. Our first k moves consist of changing the color of each of these k vertices to k + 1 in some arbitrary order. Observe that in the graph resulting after these k moves the vertices with color k + 1 form a single connected component: because ∪Si is a set cover, all vertices of R have a neighbor with color k + 1; all vertices with color k + 1 in some Ii are in the same component as u; and all vertices of ∪i∈[k]Li are connected to one of the vertices we played. Furthermore, observe that this component dominates the graph: all remaining vertices of ∪Ii, as well as all leaves attached to vertices of ∪i∈[k]Li are dominated by the vertices of ∪i∈[k]Li. Hence, we can select an arbitrary vertex with color k + 1, say u, and cycle through the colors 1, . . . , k on (cid:74) this vertex to make the graph monochromatic. Now we establish the converse of Lemma 3.4. (cid:73) Lemma 3.5. If OPTFree(G, col) ≤ 2k, then (S1, . . . ,Sk, R) is a YES instance of MCSC. Proof. Suppose that there exists a sequence of at most 2k moves solving (G, col). We can assume without loss of generality that the sequence has length exactly 2k, since performing a move on a monochromatic graph keeps the graph monochromatic. Let (u1, c1), . . . , (u2k, c2k) be a solution, let col0 = col, and let coli denote the coloring of G obtained after the first i moves. The key observation that we will rely on is the following: (i) For all i ∈ [k], there exist j ∈ [k], v ∈ Ii such that colj(v) = k + 1. In other words, we claim that for each group Ii there exists a vertex that received color k + 1 at some point during the first k moves. Before proceeding, let us prove this claim. Suppose for contradiction that the claim is false. Then, there exists a group Ii such that no vertex in that group has color k + 1 in any of the colorings col0, . . . , colk. We now consider the vertices of Li and their attached leaves. Since Li contains 3k > k + 2 vertices, there exist two vertices v1, v2 of Li such that {u1, . . . , uk} contains neither v1, v2, nor any of their attached leaves. In other words, there exist two vertices of Li on which the winning sequence does not change colors by playing them or their private neighborhood directly. However, since v1, v2 only have neighbors in I1 (except for their attached leaves), and no vertex of I1 received color k + 1, we conclude that colk(v1) = colk(v2) = k + 1, that is, the colors of these two vertices have remained unchanged, and the same is true for their attached leaves. Consider now the graph G with coloring colk: we observe that this coloring uses k + 1 distinct colors, and that each color induces a disconnected graph. This is true for colors 1, . . . , k because of the leaves attached to v1, v2, and true of color k + 1 because of v1, v2 and the fact that no vertex of Ii has color k + 1. We conclude that OPTFree(G, colk) ≥ k + 1 by Lemma 3.2, which is a contradiction, because the whole sequence has length 2k. Because of claim (i) we can now conclude that for all i ∈ [k] there exists a j ∈ [k] such that colj−1(uj) = i. In other words, for each color i there exists a move among the first k moves of the solution that played a vertex which at that point had color i. To see that this is true consider again for contradiction the case that for some i ∈ [k] this statement does not hold: this implies that vertices with color i in col0 still have color i in col1, . . . , colk, which means that no vertex of Ii has received color k + 1 in the first k moves, contradicting (i). As a result of the above, we therefore claim that for all j ∈ [k], we have colj−1(uj) 6= k+1. In other words, we claim that none of the first k moves changes the color of a vertex that at that point had color k + 1. This is because, as argued, for each of the other k colors, R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:9 there is a move among the first k moves that changes a vertex of that color. We therefore conclude that for all vertices v for which col0(v) = k + 1 we have colj(v) = k + 1 for all j ∈ [k]. In addition, because in col0 all colors induce independent sets, each of the first k moves changes the color of a single vertex. Because of claim (i), this means that for each i ∈ [k] one of the first k moves changes the color of a single vertex from Ii to k + 1. We select the corresponding set of Si in our MCSC solution. We now observe that, since all vertices of ∪i∈[k]Li retain color k + 1 throughout the first k moves, colk is a coloring function that uses k + 1 distinct colors, and colors 1, . . . , k induce disconnected graphs (because of the leaves attached to the vertices of each Li). Thanks to Lemma 3.2, this means that col−1 k (k + 1) must induce a connected graph. Hence, all vertices of R have a neighbor with color k + 1 in colk, which must be one of the k vertices played in the first k moves; hence the corresponding element is dominated by our solution and we have a valid set cover selecting one set from each Si. (cid:74) We are now ready to combine Lemmas 3.4 and 3.5 to obtain the main result of this section. (cid:73) Theorem 3.6. Free-Flood-It is W[2]-hard parameterized by OPTFree, that is, param- eterized by the length of the optimal solution. Furthermore, if there is an algorithm that decides if a Free-Flood-It instance has a solution of length k in time no(k), then the ETH is false. Proof. The described construction, as well as Lemmas 3.4 and 3.5 give a reduction from MCSC, which is W[2]-hard parameterized by k, to an instance of Free-Flood-It with k +1 colors, where the question is to decide if OPTFree(G, col) ≤ 2k. Furthermore, it is known that MCSC generalizes Dominating Set, which does not admit an algorithm running in time no(k), under the ETH [4]. Since our reduction only modifies k by a constant, we odtain (cid:74) the same result for Free-Flood-It. We note that because of Lemma 3.1 we can always assume that the number of colors of a given instance is not much higher than the length of the optimal solution. As a result, Free-Flood-It parameterized by OPTFree is equivalent to the parameterization of Free-Flood-It by OPTFree + cmax and the result of Theorem 3.6 also applies to this parameterization. 3.1 Kernel lower bound for Free-Flood-It As a byproduct of the reduction above, we can show a kernel lower bound for Free-Flood-It parameterized by the vertex cover number. Let P and Q be parameterized problems. A polynomial-time computable function f : Σ∗ × N → Σ∗ × N is a polynomial parameter transformation from P to Q if there is a polynomial p such that for all (x, k) ∈ Σ∗ × N, (x, k) ∈ P if and only if (x0, k0) = f(x, k) ∈ Q, and k0 ≤ p(k). If such a function exits, then P is polynomial parameter reducible to Q. (cid:73) Proposition 3.7 ([1]). Let P and Q be parameterized problems, and P 0 and Q0 be unpa- rameterized versions of P and Q, respectively. Suppose P 0 is NP-hard, Q0 is in NP, and P is polynomial parameter reducible to Q. If Q has a polynomial kernel, then P also has a polynomial kernel. 23:10 How Bad is the Freedom to Flood-It? (cid:73) Theorem 3.8. Free-Flood-It parameterized by the vertex cover number admits no polynomial kernel unless PH = Σp 3. Proof. The reduction in this section can be seen as a polynomial parameter transformation from MCSC parameterized by the solution size k and the size R of the universe to Free- Flood-It parameterized by the vertex cover number with a polynomial p(k,R) = 3k2 +R. To see this observe that the black vertices in Figure 4 form a vertex cover of size 3k2 + R. Since MCSC is NP-hard and the decision version of Free-Flood-It is in NP, Proposi- tion 3.7 implies that if Free-Flood-It parameterized by the vertex cover number has a polynomial kernel, then MCSC parameterized by k and R also has a polynomial kernel. It is known that Set Cover (and thus MCSC) parameterized simultaneously by k and 3 [5]. This completes the proof. (cid:74) R does not admit a polynomial kernel unless PH = Σp Clique-width and the number of moves 4 In this section, we consider as a combined parameter for Free-Flood-It the length of an optimal solution and the clique-width. We show that this case is indeed fixed-parameter tractable by using the theory of the monadic second-order logic on graphs. As an application of this result, we also show that combined parameterization by the number of colors and the modular-width is fixed-parameter tractable. To prove the main claim, we show that Free-Flood-It with a constant length of optimal solutions is an MSO1-definable decision problem. The syntax of MSO1 (one-sorted monadic second-order logic) of graphs includes (i) the logical connectives ∨, ∧, ¬, ⇔, ⇒, (ii) variables for vertices and vertex sets, (iii) the quantifiers ∀ and ∃ applicable to these variables, and (iv) the following binary relations: u ∈ U for a vertex variable u and a vertex set variable U; adj(u, v) for two vertex variables u and v, where the interpretation is that u and v are adjacent; equality of variables. If G models an MSO1 formula ϕ with an assignment X1, . . . , Xq ⊆ V (G) to the q free variables in ϕ, then we write hG, X1, . . . , Xqi = ϕ. It is known that, given a graph of clique-width at most w, an MSO1 formula ϕ, and an assignment to the free variables in ϕ, the problem of deciding whether G models ϕ with the given assignment is solvable in time O(f(ϕ, w) · n3), where f is a computable function and ϕ is the length of ϕ [3, 20]. (cid:73) Theorem 4.1. Given an instance (G, col) of Free-Flood-It such that G has n vertices and clique-width at most w, it can be decided in time O(f(k, w)·n3) whether OPTFree(G, col) ≤ k, where f is some computable function. Proof. Let Vi (1 ≤ i ≤ cmax) be the set of color i vertices in the input graph. We construct an MSO1 formula ϕ with cmax free variables X1, . . . , Xcmax such that OPTFree(G, col) ≤ k if and only if G models ϕ with the assignment Xi := Vi for 1 ≤ i ≤ cmax. We can define the desired formula ϕ(X1, . . . , Xcmax) as follows: ϕ(X1, . . . , Xcmax) :=W 1≤c1,...,ck≤k ∃v1,v2,...,vk∈V (G)W 1≤c≤k ∀u∈V (G) colorc,k(u), where colorc,i(u) for 0 ≤ i ≤ k implies that the color of u is c after the moves (v1, c1), . . . (vi, ci). R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:11 We define colorc,i(u) recursively as follows. We first set colorc,0(u) := (u ∈ Xi). This is correct as we assign Vi to Xi. For 1 ≤ i ≤ k, we set (colorc,i−1(u) ∨ SameCCCi−1(u, vi) colorc,i(u) = colorc,i−1(u) ∧ ¬SameCCCi−1(u, vi) c = ci, c 6= ci, where SameCCCi(u1, u2) implies that u1 and u2 are in the same monochromatic component after the moves (v1, c1), . . . (vi, ci). The formula precisely represent the recursive nature of the color of the vertices. That is, a vertex u is of color c after the ith move (vi, ci) if and only if either its color is changed to c by the i move, or it was already of color c before the ith move and its color is not changed by the i move. Given that colorc,i(u) is defined for all c and u, defining SameCCCi(u1, u2) is a routine: SameCCCi(u1, u2) =W 1≤c≤k ∃S⊆V (G)(u1, u2 ∈ S) ∧ (∀u∈S colorc,i(u)) ∧ (∀T⊆S (T = ∅) ∨ ∃x∈T∃y∈S\T adj(x, y)). Since k ≥ cmax − 1 by Lemma 3.1, it holds that ϕ is bounded by a function of k. (cid:74) (cid:73) Corollary 4.2. Given an integer k and an instance (G, col) of Free-Flood-It such that G has n vertices and modular-width at most w, it can be decided in time O(f(cmax, w) · n3) whether OPTFree(G, col) ≤ k, where f is some computable function. Proof. Observe that for every connected graph G of modular-width at most w, it holds that OPTFree(G, col) ≤ w + cmax − 2: we pick one vertex v from a module M; we next color one vertex in each module except M with col(v); we then play at v with the remaining cmax − 1 colors. Thus we can assume that k ≤ w + cmax − 2. Since the modular-width of a graph is at most its clique-width by their definitions, Theorem 4.1 gives an O(g(w + cmax, w) · n3)-time algorithm for some computable g, which can be seen as an O(f(cmax, w) · n3)-time algorithm (cid:74) for some computable f. 5 Neighborhood diversity and the number of colors Since the modular-width of a graph is upper bounded by its neighborhood diversity, Corol- lary 4.2 in the previous section implies that Free-Flood-It is fixed-parameter tractable when parameterized by both the neighborhood diversity and the number of colors. Here we show that Free-Flood-It admits a polynomial kernel with the same parameterization. This section is devoted to a proof of the following theorem. (cid:73) Theorem 5.1. Free-Flood-It admits a kernel of at most nd(G)· cmax ·(nd(G)+ cmax −1) vertices. Fellows et al. [7] observed that for Fixed-Flood-It, a polynomial kernel with the same parameterization can be easily obtained since twin vertices of the same color can be safely contracted. In Free-Flood-It, this is true for true twins but not for false twins. See Figure 5a. Though it might be still possible to show something like "if there are more than some constant number of false twins with the same color, then one can remove one of them without changing the minimum number of moves," here we show a weaker claim. Our reduction rules are as follows: Rule TT: Let u and v be true twins of the same color in (G, col). Remove v. 23:12 How Bad is the Freedom to Flood-It? (a) Removing a false twin is not safe. (b) Removing a twin color is not safe. Figure 5 Simple reductions that do not work for Free-Flood-It. Rule FT: Let F be a set of false-twin vertices of the same color in (G, col) such that F = nd(G) + cmax. Remove arbitrary one vertex in F. Observe that after applying TT and FT exhaustively in polynomial time, the obtained graph can have at most nd(G) · cmax · (nd(G) + cmax − 1) vertices. This is because each set of twin vertices can contain at most nd(G) + cmax − 1 vertices. Hence, to prove Theorem 5.1, it suffices to show the safeness of the rules. (cid:73) Lemma 5.2. Rule TT is safe. Proof. Let u and v be true twins of the same color. Observe that removing v is equivalent to contracting the edge {u, v}. Since u and v are in the same monochromatic component, (cid:74) the lemma holds. To guarantees the safeness of FT, we need the following technical lemmas. (cid:73) Lemma 5.3. Let (G, col) be an instance of Free-Flood-It and x, y ∈ V (G) be false-twin vertices of the same color c. A sequence (u1, c1), . . . , (uk, ck) with ui /∈ {x, y} for 1 ≤ i ≤ k is a valid flooding sequence for (G, col) if and only if it is a valid flooding sequence for (G − x, colG−x). Proof. Let (G0, col0) = (G − x, colG−x). If a neighbor of x and y has color c, then the lemma trivially holds. Hence, in what follows, we assume that none of the vertices adjacent to x and y has color c. Assume that (u1, c1), . . . , (uk, ck) is valid for at least one of (G, col) and (G0, col0). Then there is a move that changes the color of a neighbor of y to c since ui 6= y for 1 ≤ i ≤ k. Let (ui, ci) be the first such move. The first part (u1, c1), . . . , (ui−1, ci−1) of the sequence has the same effect to (G, col) and (G0, col0). That is, the monochromatic components and connection among them are the same in (G, coli−1) and (G0, col0 i−1) except that (G, coli−1) contains the monochromatic component {x}. Note that {y} is a monochromatic component of color c in both (G, coli−1) i−1), and {y} and {x} have the same adjacent monochromatic components in and (G0, col0 (G, coli−1). Let C be the set of monochromatic components of color c in (G, coli−1) that are adjacent to Comp(coli−1, ui). Similarly, let C0 be the set of monochromatic components of color c in (G0, col0 i−1, ui). Observe that Comp(coli−1, ui) = Comp(col0 Now we apply the move (ui, ci). It follows that Comp(coli, ui) = Comp(coli−1, ui) ∪ C0∈C0 C0. Since Comp(coli, ui) \ C∈C C and Comp(col0 Comp(col0 i, ui) include y, the compo- nents Comp(coli, ui) and Comp(col0 i, ui) have the same adjacent monochromatic compo- nents. Also, for each u /∈ Comp(coli, ui), Comp(coli−1, u) = Comp(col0 the sequence, i.e. (ui+1, ci+1), . . . , (uk, ck), has the same effect to (G0, col0 Therefore, (G, colk) is constant if and only if so is (G0, col0 i) are equivalent and thus the remaining of i) and (G, coli). (cid:74) i−1) that are adjacent to Comp(col0 i−1, ui), C0 = C \ {{x}}, and {y} ∈ C ∩ C0. This implies that (G, coli) and (G0, col0 i−1, u) holds. S i, ui) = Comp(col0 i, ui) = {x} and both Comp(coli, ui) and Comp(col0 i−1, ui) ∪S k). 222112221211232112113 R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:13 (cid:73) Lemma 5.4. Let S be a set of false-twin vertices with the same color in (G, col). If S ≥ OPTFree(G, col) + 2, then OPTFree(G, col) = OPTFree(G − x, colG−x) for every x ∈ S. Proof. We first show that OPTFree(G, col) ≤ OPTFree(G − x, colG−x) for every x ∈ S. Let (u1, c1), . . . , (uk, ck) be an optimal valid flooding sequence for (G − x, colG−x). Assume that OPTFree(G, col) ≥ k (otherwise we are done). Since S \{x} ≥ OPTFree(G, col) + 1 ≥ k + 1, there is a vertex y ∈ S\{x} such that ui 6= y for 1 ≤ i ≤ k. By Lemma 5.3, (u1, c1), . . . , (uk, ck) is valid for (G, col) as well. Next we show the other direction. Since S is a set of monochromatic false-twin vertices, it suffices to show that OPTFree(G, col) ≥ OPTFree(G − x, colG−x) for some x ∈ S. Let (u1, c1), . . . , (uk, ck) be an optimal valid flooding sequence of (G, col). Since S ≥ OPTFree(G, col) + 2 = k + 2, there are two vertices x, y ∈ S such that ui /∈ {x, y} for 1 ≤ i ≤ k. By Lemma 5.3, (u1, c1), . . . , (uk, ck) is valid for (G − x, colG−x) as well. (cid:74) (cid:73) Corollary 5.5. Rule FT is safe. Proof. Let G be a connected graph and col a coloring of G with cmax colors. Observe that (G, col) admits a flooding sequence of length nd(G)+ cmax −2 as follows. Let T be a maximal set of twin vertices of G and c be a color used in T. For each maximal set of twin vertices T 0 6= T of G, pick a vertex u ∈ T 0 and play the move (u, c). After these nd(G) − 1 moves, the vertices of color c form a connected dominating set of G. Now pick a vertex v of color c and play the move (v, c0) for each c0 ∈ [cmax] \ {c}. These cmax − 1 moves make the coloring constant. Now for some color class C and a false-twin class I of (G, col), if C ∩ I ≥ cmax + nd(G), then we can remove an arbitrary vertex in C ∩ I while preserving the optimal number of (cid:74) steps by Lemma 5. This implies the safeness of FT. Note that using the concept of twin colors, Fellows et al. [7] further reduced the number of colors in instances of Fixed-Flood-It and obtained a (nonpolynomial-size) kernel parameterized by the neighborhood diversity. They say that two colors are twin if the colors appear in the same family of the maximal sets of twin vertices. They observed that, in Fixed-Flood-It, removing one of twin colors reduced the fewest number of moves exactly by 1. Unfortunately, this is not the case for Free-Flood-It. See Figure 5b. Relation Between Fixed and Free Flood-It 6 The main theorem of this section is the following: (cid:73) Theorem 6.1. For any graph G = (V, E), coloring function col on G, and p ∈ V we have OPTFree(G, col) ≤ OPTFixed(G, col, p) ≤ 2OPTFree(G, col). Theorem 6.1 states that the optimal solutions for Free-Flood-It and Fixed-Flood-It can never be more than a factor of 2 apart. It is worthy of note that we could not hope to obtain a constant smaller than 2 in such a theorem, and hence the theorem is tight. (cid:73) Theorem 6.2. There exist instances of Fixed-Flood-It such that OPTFixed(G, col, p) = 2OPTFree(G, col) Proof. Consider a path on 2n + 1 vertices properly colored with colors 1, 2. If we set the pivot to be one of the endpoints then OPTFree = 2n. However, it is not hard to obtain a Free-Flood-It solution with n moves by playing every vertex at odd distance from the (cid:74) pivot. 23:14 How Bad is the Freedom to Flood-It? Before we proceed to give the proof of Theorem 6.1, let us give a high-level description of our proof strategy and some general intuition. The first inequality is of course trivial, so we focus on the second part. We will establish it by induction on the number of non-pivot moves performed by an optimal Free-Flood-It solution. The main inductive argument is based on observing that a valid Free-Flood-It solution will either at some point play a neighbor u of the component of p to give it the same color as p, or if not, it will at some point play p to give it the same color as one of its neighbors. The latter case is intuitively easier to handle, since then we argue that the move that changed p's color can be performed first, and if the first move is a pivot move we can easily fall back on the inductive hypothesis. The former case, which is the more interesting one, can be handled by replacing the single move that gives u the same color as p, with two moves: one that gives p the same color as u, and one that flips p back to its previous color. Intuitively, this basic step is the reason we obtain a factor of 2 in the relationship between the two versions of the game. The inductive strategy described above faces some complications due to the fact that rearranging moves in this way may unintentionally re-color some vertices, which makes it harder to continue the rest of the solution as before. To avoid this we define a somewhat generalized version of Free-Flood-It, called Subset-Free-Flood-It. (cid:73) Definition 6.3. Given G = (V, E), a coloring function col on G, and a pivot p ∈ V , a set-move is a pair (S, c), with S ⊆ V and S = Comp(col, u) for some u ∈ V , or {p} ⊆ S ⊆ Comp(col, p). The result of (S, c) is the coloring col0 that sets col0(v) = c for v ∈ S; and col0(v) = col(v) otherwise. We define Subset-Free-Flood-It as the problem of determining the minimum number of set-moves required to make a graph monochromatic, and Subset-Fixed-Flood-It as the same problem when we impose the restriction that every move must change the color of p, and denote as OPTS-Free, OPTS-Fixed the corresponding optimum values. Informally, a set-move is the same as a normal move in Free-Flood-It, except that we are also allowed to select an arbitrary connected monochromatic set S that contains p (even if S is not maximal) and change its color. Intuitively, one would expect moves that set S to be a proper subset of Comp(col, p) to be counter-productive, since such moves split a monochromatic component into two pieces. Indeed, we prove below in Lemma 6.4 that the optimal solutions to Fixed-Flood-It and Subset-Fixed-Flood-It coincide, and hence such moves do not help. The reason we define this version of the game is that it gives us more freedom to define a solution that avoids unintentionally recoloring vertices as we transform a given Free-Flood-It solution to a Fixed-Flood-It solution. (cid:73) Lemma 6.4. For any graph G = (V, E), coloring function col on G, and pivot p ∈ V we have OPTFixed(G, col, p) = OPTS-Fixed(G, col, p). Proof. First, observe that OPTS-Fixed(G, col, p) ≤ OPTFixed(G, col, p) is trivial, as any solution of Fixed-Flood-It is a solution to Subset-Fixed-Flood-It by playing the same sequence of colors and always selecting all of the connected monochromatic component of p. of Subset-Fixed-Flood-It, where by definition we have p ∈ Si for all i ∈ [k]. We would like to prove that (p, c1), (p, c2), . . . , (p, ck) is a valid solution for Fixed-Flood-It. Let coli be the result of the first i set-moves of the former solution, and col0 i be the result of the first i moves of the latter solution. We will establish by induction the following: 1. For all i ∈ [k] we have Comp(coli, p) ⊆ Comp(col0 2. For all i ∈ [k], u ∈ V \ Comp(col0 Let us also establish the converse inequality. Consider a solution (S1, c1), (S2, c2), . . . , (Sk, ck) i, p) we have coli(u) = col0 i(u). i, p). R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:15 The statements are true for i = 0. Suppose that the two statements are true after i − 1 moves. The first solution now performs the set-move (Si, ci) with Si ⊆ Comp(coli−1, p) ⊆ Comp(col0 i−1, p). We now have that Comp(coli, p) contains Si plus the neighbors of Si which have color ci in coli−1. Such vertices either also have color ci in col0 i−1, or are contained in Comp(col0 i, p), which establishes the first condition. To see that the second condition continues to hold observe that every vertex for which coli−1(u) 6= coli(u) or col0 i, p); the colors of other vertices remain unchanged. Since in the end Comp(colk, p) = V the first condition ensures that Comp(col0 (cid:74) i−1, p); in both cases they are included in Comp(col0 i−1(u) 6= col0 i(u) belongs in Comp(col0 k, p) = V . We are now ready to state the proof of Theorem 6.1. Proof of Theorem 6.1. As mentioned, we focus on proving the second inequality as the first inequality follows trivially from the definition of the problems. Given a graph G = (V, E), an initial coloring function col = col0, and a pivot p ∈ V , we suppose we have a solution to Free- Flood-It (u1, c1), (u2, c2), . . . , (uk, ck). In the remainder, we denote by coli the coloring that results after the moves (u1, c1), . . . , (ui, ci). We can immediately construct an equivalent solution to Subset-Free-Flood-It from this, producing the same sequence of colorings: (Comp(col0, u1), c1), (Comp(col1, u2), c2), . . . , (Comp(colk−1, uk), ck). We will transform this solution to a solution of Subset-Fixed-Flood-It of length at most 2k, and then invoke Lemma 6.4 to obtain a solution for Fixed-Flood-It of length at most 2k. More precisely, we will show that for any G, col, p we have OPTS-Fixed(G, col, p) ≤ 2OPTS-Free(G, col, p). For a solution S = (S1, c1), (S2, c2), . . . , (Sk, ck) to Subset-Free-Flood-It we define the number of bad moves of S as b(S) = {(Si, ci) p 6∈ Si}. We will somewhat more strongly prove the following statement for all G, col, p: for any valid Subset-Free-Flood-It solution S, we have OPTS-Fixed(G, col, p) ≤ S + b(S) Since S + b(S) ≤ 2S, the above statement will imply the promised inequality and the theorem. We prove the statement by induction on S + 2b(S). If S + 2b(S) ≤ 2 then S is already a Subset-Fixed-Flood-It solution, so the statement is trivial. Suppose then that the statement holds when S + 2b(S) ≤ n and we have a solution S with S + 2b(S) = n + 1. We consider the following cases: • The first move (S1, c1) has p ∈ S1. By the inductive hypothesis there is a Subset- Fixed-Flood-It solution of length at most S + b(S) − 1 for (G, col1, p). We build a solution for Subset-Fixed-Flood-It by appending this solution to the move (S1, c1), since this is a valid move for Subset-Fixed-Flood-It. • There exists a move (Si, ci) with Si = Comp(coli−1, u), for some u ∈ N(Comp(coli−1, p))\ Comp(coli−1, p) such that ci = coli−1(p). That is, there exists a move that plays a vertex u that currently has a different color than p, and as a result of this move the component of u and p merge, because u receives the same color as p and u has a neighbor in the component of p. Consider the first such move. We build a solution S0 as follows: we keep moves (S1, c1) . . . (Si−1, ci−1); we add the moves (Comp(coli−1, p), coli−1(u)), (Comp(coli−1, p)∪ Comp(coli−1, u), coli−1(p)); we append the rest of the previous solution (Si+1, ci+1), . . .. To see that S0 is still a valid solution we observe that Comp(coli−1, p)∪Comp(coli−1, u) is monochromatic and connected when we play it, and that the result of the first i − 1 moves, plus the two new moves is exactly coli. We also note that S0 + b(S0) = S + b(S) because we replaced one bad move with two good moves. However, S0 + 2b(S0) < S + 2b(S), hence 23:16 How Bad is the Freedom to Flood-It? by the inductive hypothesis there exists a Subset-Fixed-Flood-It solution of the desired length. • There does not exist a move as specified in the previous case. We then show that this reduces to the first case. If no move as described in the previous case exists and the initial coloring is not already constant, S must have a move (Si, ci) where {p} ⊆ Si ⊆ Comp(col0, p) and ci = coli−1(u) for u ∈ N(Comp(col0, p))\Comp(col0, p). In other words, this is a good move (it changes the color of p), that adds a new vertex u to the connected monochromatic component of p. Such a move must exist, since if the initial coloring is not constant, the initial component of p must be extended, and we assumed that no move that extends it by recoloring one of its neighbors exists. Consider the first such good move (Si, ci) as described above. We build a solution S0 as follows: the first move is (Comp(col0, p), col0(u)), where u is, as described above, the neighbor of Comp(col0, p) with coli−1(u) = ci. For j ∈ [i − 1] we add the move (Sj, cj) if u 6∈ Sj, or the move (Comp(colj−1, u) ∪ Comp(col0, p), cj) if u ∈ Sj. In other words, we keep other moves unchanged if they do not affect u, otherwise we add to them Comp(col0, p). We observe that these moves are valid since we maintain the invariant that Comp(col0, p) and u have the same color and since none of the first i − 1 moves of S changes the color of p (since we selected the first such move). The result of these i moves is exactly coli. We now append the remaining move (Si+1, ci+1), . . ., and we have a solution that starts with a good move, has the same length and the same (or smaller) number of bad moves as S and is still (cid:74) valid. We have therefore reduced this to the first case. As we mentioned before, this combinatorial theorem implies 2-approximability of Free- Flood-It for the cases where Fixed-Flood-It is polynomial-time solvable. Also, as Fixed- Flood-It admits a (cmax − 1) approximation [2],2 we have a 2(cmax − 1) approximation for Free-Flood-It. (cid:73) Corollary 6.5. Free-Flood-It admits a 2(cmax − 1) approximation, where cmax is the number of used colors. 7 Non-monotonicity of Free-Flood-It We now consider the (non-)monotonicity of the problem. A game has the monotonicity property if no legal move makes the situation worse. That is, if Fixed-Flood-It (or Free-Flood-It) has the monotonicity property, then no single move increases the minimum number of steps to make the input graph monotone. We believe that the monotonicity of Fixed-Flood-It was known as folklore and used implicitly in the literature. On the other hand, we are not sure that the non-monotonicity of Free-Flood-It was widely known. The only result we are aware of is by Meeks and Scott [16] who showed that on paths Free- Flood-It has the monotonicity property. In the following, we show that Free-Flood-It loses its monotonicity property as soon as the underlying graph becomes a path with one attached vertex. To be self-contained, we start with proving the following folklore, which says that Fixed- Flood-It is monotone. (cid:73) Lemma 7.1. Let (G, col) is an instance of Fixed-Flood-It with pivot p. For every color c, it holds that OPTFixed(G, col0) ≤ OPTFixed(G, col), where (G, col0) is the result of the move (p, c). 2 Their proof was only for grids, but it just works for the general case. R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:17 Figure 6 Non-monotonicity of Free-Flood-It. Proof. Let (p, c1), . . . , (p, ck) be an optimal solution for (G, col). We show that this se- quence is valid for (G, col0) too. Let col = col0 and for i ≥ 1, let coli be the coloring obtained from coli−1 by applying the ith move (p, ci). We define col0 i in the analogous way. Observe that since all moves are played on the pivot p, we have Comp(coli, v) ∈ {Comp(col, v), Comp(coli, p)} and Comp(col0 i, p)} for every v ∈ V (G) and for every i. i, v) ∈ {Comp(col0, v), Comp(col0 It suffices to show that Comp(coli, p) ⊆ Comp(col0 i, p) for all i. This obviously holds i, p) for some i ≥ 0. Let v ∈ V (G) \ when i = 0. Assume that Comp(coli, p) ⊆ Comp(col0 {p} such that Comp(col, v) is not contained in but adjacent to Comp(coli, p), and thus contained in Comp(coli+1, p). Since Comp(coli, p) ⊆ Comp(col0 i, p), the monochromatic component Comp(col, v) is either contained in or adjacent to Comp(col0 i, p). Therefore, i+1, p). This implies that Comp(coli+1, p) ⊆ Comp(col, v) is contained in Comp(col0 Comp(col0 (cid:74) i+1, p). Meeks and Scott [16] showed the following monotonicity of Free-Flood-It on paths. (cid:73) Proposition 7.2 ([16, Lemma 4.1]). Let G be a path, col a vertex coloring of G, (v, c) a move, and (G, col0) the result of the move. Then, OPTFree(G, col0) ≤ OPTFree(G, col). One may wonder whether the monotonicity property holds in general for Free-Flood-It. The following example, however, shows that it does not hold even for some graphs very close to paths. See the two instances in Figure 6. The instance (G, col0) is obtained from (G, col) by playing the move (v, 3). We show that OPTFree(G, col) < OPTFree(G, col0). Observe that OPTFree(G, col) = 3: by Lemma 3.2, OPTFree(G, col) ≥ 3, and the sequence (u, 2), (u, 1), (u, 1) floods the graph. Suppose that OPTFree(G, col0) ≤ 3. By Lemma 3.2, the first move in each optimal solution of (G, col0) has to make the subgraph induced by some color connected, and then the second move has to remove the connected color. We can see that 2 is the only color that can play this role. If the first move is not played on u, then it is played on one of the two color-2 vertices and then the second move is played on the other color-2 vertex. Such a sequence of two moves cannot make either of color-1 or color-3 vertices connected. Thus by Lemma 3.2, it still needs at least two moves. Hence we can conclude that the first move is (u, 2). Now the second move has to remove the color 2, and thus has to be played on u (or equivalently on any vertex in the monochromatic component including u). No matter which color we choose, we end up with an instance with at least two colors that are not connected. Again by Lemma 3.2, this instance needs more than one step, and thus OPTFree(G, col0) > 3. References 1 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. doi: 10.1016/j.jcss.2009.04.001. 2122113321231133vv(G,col)(G,col(cid:48))uu 23:18 How Bad is the Freedom to Flood-It? 2 Raphaël Clifford, Markus Jalsenius, Ashley Montanaro, and Benjamin Sach. The com- plexity of flood filling games. Theory Comput. Syst., 50(1):72 -- 92, 2012. doi:10.1007/ s00224-011-9339-2. 3 Bruno Courcelle, Johann A. Makowsky, and Udi Rotics. Linear time solvable optimization problems on graphs of bounded clique-width. Theory Comput. Syst., 33(2):125 -- 150, 2000. doi:10.1007/s002249910009. 4 Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. doi:10.1007/978-3-319-21275-3. 5 Michael Dom, Daniel Lokshtanov, and Saket Saurabh. Kernelization lower bounds through colors and ids. ACM Trans. Algorithms, 11(2):13:1 -- 13:20, 2014. doi:10.1145/2650261. 6 Michael R. Fellows, Uéverton dos Santos Souza, Fábio Protti, and Maise Dantas da Silva. Tractability and hardness of flood-filling games on trees. Theor. Comput. Sci., 576:102 -- 116, 2015. doi:10.1016/j.tcs.2015.02.008. 7 Michael R. Fellows, Fábio Protti, Frances A. Rosamond, Maise Dantas da Silva, and Uéver- ton dos Santos Souza. Algorithms, kernels and lower bounds for the Flood-It game pa- rameterized by the vertex cover number. Discrete Applied Mathematics, 2017. in press. doi:10.1016/j.dam.2017.07.004. 8 Rudolf Fleischer and Gerhard J. Woeginger. An algorithmic analysis of the honey-bee game. Theor. Comput. Sci., 452:75 -- 87, 2012. doi:10.1016/j.tcs.2012.05.032. Jörg Flum and Martin Grohe. Parameterized Complexity Theory. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2006. 9 10 Hiroyuki Fukui, Yota Otachi, Ryuhei Uehara, Takeaki Uno, and Yushi Uno. On com- plexity of flooding games on graphs with interval representations. In TJJCCGG 2012, volume 8296 of Lecture Notes in Computer Science, pages 73 -- 84, 2013. doi:10.1007/ 978-3-642-45281-9_7. Jakub Gajarský, Michael Lampis, and Sebastian Ordyniak. Parameterized algorithms for modular-width. In IPEC 2013, volume 8246 of Lecture Notes in Computer Science, pages 163 -- 176, 2013. doi:10.1007/978-3-319-03898-8_15. 12 Wing-Kai Hon, Ton Kloks, Fu-Hong Liu, Hsiang Hsuan Liu, and Hung-Lung Wang. Flood- 11 it on AT-free graphs. CoRR, abs/1511.01806, 2015. arXiv:1511.01806. 13 Aurélie Lagoutte, Mathilde Noual, and Eric Thierry. Flooding games on graphs. Discrete Applied Mathematics, 164:532 -- 538, 2014. doi:10.1016/j.dam.2013.09.024. 14 Michael Lampis. Algorithmic meta-theorems for restrictions of treewidth. Algorithmica, 64(1):19 -- 37, 2012. 15 Ross M. McConnell and Jeremy P. Spinrad. Modular decomposition and transitive orien- tation. Discrete Mathematics, 201(1-3):189 -- 241, 1999. 16 Kitty Meeks and Alexander Scott. The complexity of flood-filling games on graphs. Discrete Applied Mathematics, 160(7 -- 8):959 -- 969, 2012. doi:10.1016/j.dam.2011.09.001. 17 Kitty Meeks and Alexander Scott. The complexity of Free-Flood-It on 2 × n boards. Theor. Comput. Sci., 500:25 -- 43, 2013. doi:10.1016/j.tcs.2013.06.010. 18 Kitty Meeks and Alexander Scott. Spanning trees and the complexity of flood-filling games. Theory Comput. Syst., 54(4):731 -- 753, 2014. doi:10.1007/s00224-013-9482-z. 19 Kitty Meeks and Dominik K. Vu. Extremal properties of flood-filling games. CoRR, abs/1504.00596, 2015. arXiv:1504.00596. Sang-il Oum. Approximating rank-width and clique-width quickly. ACM Transactions on Algorithms, 5, 2008. Article No. 10. doi:10.1145/1435375.1435385. 21 Uéverton dos Santos Souza, Fábio Protti, and Maise Dantas da Silva. An algorithmic analysis of Flood-it and Free-Flood-it on graph powers. Discrete Mathematics & Theoretical Computer Science, 16(3):279 -- 290, 2014. URL: http://dmtcs.episciences.org/2086. 20 R. Belmonte, M. Khosravian Ghadikolaei, M. Kiyomi, M. Lampis, and Y. Otachi 23:19 22 Marc Tedder, Derek G. Corneil, Michel Habib, and Christophe Paul. Simpler linear- In ICALP 2008 doi: time modular decomposition via recursive factorizing permutations. (1), volume 5125 of Lecture Notes in Computer Science, pages 634 -- 645, 2008. 10.1007/978-3-540-70575-8_52. Elad Verbin. Comment to "Is this game NP-Hard? by Sariel Har-Peled. http://sarielhp. org/blog/?p=2005#comment-993, 2009. Accessed: 2018-01-18. 23
1806.06430
1
1806
2018-06-17T19:05:49
Subspace Embedding and Linear Regression with Orlicz Norm
[ "cs.DS", "cs.LG" ]
We consider a generalization of the classic linear regression problem to the case when the loss is an Orlicz norm. An Orlicz norm is parameterized by a non-negative convex function $G:\mathbb{R}_+\rightarrow\mathbb{R}_+$ with $G(0)=0$: the Orlicz norm of a vector $x\in\mathbb{R}^n$ is defined as $ \|x\|_G=\inf\left\{\alpha>0\large\mid\sum_{i=1}^n G(|x_i|/\alpha)\leq 1\right\}. $ We consider the cases where the function $G(\cdot)$ grows subquadratically. Our main result is based on a new oblivious embedding which embeds the column space of a given matrix $A\in\mathbb{R}^{n\times d}$ with Orlicz norm into a lower dimensional space with $\ell_2$ norm. Specifically, we show how to efficiently find an embedding matrix $S\in\mathbb{R}^{m\times n},m<n$ such that $\forall x\in\mathbb{R}^{d},\Omega(1/(d\log n)) \cdot \|Ax\|_G\leq \|SAx\|_2\leq O(d^2\log n) \cdot \|Ax\|_G.$ By applying this subspace embedding technique, we show an approximation algorithm for the regression problem $\min_{x\in\mathbb{R}^d} \|Ax-b\|_G$, up to a $O(d\log^2 n)$ factor. As a further application of our techniques, we show how to also use them to improve on the algorithm for the $\ell_p$ low rank matrix approximation problem for $1\leq p<2$.
cs.DS
cs
Subspace Embedding and Linear Regression with Orlicz Norm Alexandr Andoni 1 Chengyu Lin 1 Ying Sheng 1 Peilin Zhong 1 Ruiqi Zhong 1 8 1 0 2 n u J 7 1 ] S D . s c [ 1 v 0 3 4 6 0 . 6 0 8 1 : v i X r a Abstract We consider a generalization of the classic lin- ear regression problem to the case when the loss is an Orlicz norm. An Orlicz norm is parameterized by a non-negative convex func- tion G : R+ → R+ with G(0) = 0: the Orlicz norm of a vector x ∈ Rn is defined as kxkG = inf {α > 0 Pn i=1 G(xi/α) ≤ 1} . We consider the cases where the function G(·) grows subquadratically. Our main result is based on a new oblivious embedding which embeds the column space of a given matrix A ∈ Rn×d with Orlicz norm into a lower dimensional space with ℓ2 norm. Specifically, we show how to efficiently find an embedding matrix S ∈ Rm×n, m < n such that ∀x ∈ Rd, Ω(1/(d log n)) · kAxkG ≤ kSAxk2 ≤ O(d2 log n) · kAxkG. By applying this subspace embedding technique, we show an approximation algorithm for the regression prob- lem minx∈Rd kAx−bkG, up to a O(d log2 n) fac- tor. As a further application of our techniques, we show how to also use them to improve on the algorithm for the ℓp low rank matrix approxima- tion problem for 1 ≤ p < 2. 1. Introduction Numerical linear algebra problems play a significant role in machine learning, data mining, and statistics. One of the most important such problems is the regression prob- lem, see some recent advancements in, e.g., (Zhong et al., 2016; Bhatia et al., 2015; Jain & Tewari, 2015; Liu et al., 2014; Dhillon et al., 2013). In a linear regression prob- lem, given a data matrix A ∈ Rn×d with n data points A1, A2,··· , An in Rd and the response vector b ∈ Rn, the goal is to find a set of coefficients x∗ ∈ Rd such that x∗ = arg minx∈Rd l(Ax − b), (1) *Equal contribution 1Computer Science Department, Columbia University, New York City, NY 10027, U.S.A.. Cor- respondence to: Peilin Zhong <[email protected]>. Proceedings of the 35 th International Conference on Machine Learning, Stockholm, Sweden, PMLR 80, 2018. Copyright 2018 by the author(s). i=1 y2 2 = Pn where l : Rn → R+ is the loss function. When l(y) = kyk2 i , then the problem is the classic least square regression problem (ℓ2 regression). While there has been extensive research on efficient algorithms for solving ℓ2 regression, it is not always a suitable loss function to use. sion - with l(y) = kyk1 = Pn In many settings, alternative choices for a loss function lead to qualitatively better solutions x∗. For example, a popular such alternative is the least absolute deviation (ℓ1) regres- i=1 yi - which leads to solutions that are more robust than those of ℓ2 regression In a nutshell, the ℓ2 re- (see (Wikipedia; Gorard, 2005). gression is suitable when the data contains Gaussian noise, whereas ℓ1 - when the noise is Laplacian or sparse. A further popular class of loss functions l(·) arises from M-estimators, defined as l(y) = Pn i=1 M (yi) where M (·) is an M-estimator function (see (Zhang, 1997) for a list of M-estimators). The benefit of (some) M-estimators is that they enjoy advantages of both ℓ1 and ℓ2 regression. For example, when M (·) is the Huber function (Huber et al., 1964), then the regression looks like ℓ2 regression when yi is small, and looks like ℓ1 regression otherwise. However, these loss functions come with a downside: they depend on the scale, and rescaling the data may give a completely different solution! Our contributions. We introduce a generic algorithmic technique for solving regression for an entire class of loss functions that includes the aforementioned examples, and in particular, a "scale-invariant" version of M-estimators. Specifically, our class consists of loss functions l(y) that are Orlicz norms, defined as follows: given a non-negative convex function G : R+ → R+ with G(0) = 0, for x ∈ Rn, we can define kxkG to be an Orlicz norm with respect to G(·): kxkG , inf {α > 0 Pn i=1 G(xi/α) ≤ 1} . Note that ℓp norm, for p ∈ [1,∞), is a special case of Or- licz norm with G(x) = xp. Another important example is the following "scale-free" version of M-estimator. Taking f (·) to be a Huber function, i.e. f (x) = (cid:26) x2/2 x ≤ δ δ(x − δ/2) otherwise for some constant δ, we take G(x) = f (f−1(1)x). Then the norm kxkG looks like ℓ2 norm when x is flat, and looks like ℓ1 norm when x is sparse. Figure 1 shows the unit norm ball of this kind of Orlicz norm. Subspace Embedding and Linear Regression with Orlicz Norm Figure 1. Unit norm balls of Orlicz norm induced by normalized Huber functions with different δ. Our main result is a generic algorithm for solving any re- gression problem Eqn. (1) with any loss function that is a "nice" Orlicz norm; see Section 2 for a formal definition of "nice", and think of it as subquadratic for now. Our main result employs the concept of subspace em- beddings, which is a powerful tool for solving numeri- cal linear algebra problems, and as such has many appli- cations beyond regression. We say that a subspace em- bedding matrix S ∈ Rm×n embeds the column space of A ∈ Rn×d (n > m) with u-norm into a sub- space with v-norm, if ∀x ∈ Rd, we have kAxku/α ≤ kSAxkv ≤ βkAxku where αβ is called distortion (approx- imation). A long line of work studied ℓ2 regression prob- lem based on ℓ2 subspace embedding techniques; see, e.g., (Clarkson & Woodruff, 2009; 2013; Nelson & Nguyen, 2013). Furthermore, there are works on ℓp regression problem based on ℓp subspace embedding techniques (see, e.g. (Sohler & Woodruff, 2011; Meng & Mahoney, 2013; Clarkson et al., 2013; Woodruff & Zhang, 2013)), and sim- ilarly for M-estimators (Clarkson & Woodruff, 2015). Our overall results are composed of four parts: 1. We develop the first subspace embedding method for all "nice" Orlicz norms. The embedding obtains a distortion factor polynomial in d, which was recently shown necessary (Wang & Woodruff, 2018). 2. Using the above subspace embedding, we obtain the first approximation algorithm for solving the linear re- gression problem with any "nice" Orlicz norm loss. 3. As a further illustration of the power of the subspace embedding method, we employ it towards improving on the best known result for another problem: ℓp low rank approximation for 1 ≤ p < 2 from (Song et al., 2017), which is the "ℓp-version of PCA". 4. Finally, we complement our theoretical results with experimental evaluation of our algorithms. Our exper- iments reveal that that the solution of regression un- der the Orlicz norm induced by Huber loss is much better than the solution given by regression under ℓ1 or ℓ2 norms, under natural noise distributions in prac- tice. We also perform experiments for Orlicz regres- sion with different Orlicz functions G and show their behavior under different noise settings, thus exhibiting the flexibility of our framework. To the best of our knowledge, our algorithms are the first low distortion embedding and regression algorithms for general Orlicz norm. For the problem of low rank approx- imation under ℓp norm, p ∈ [1, 2), our algorithms achieve simultaneously the best approximation and the best running time. In contrast, all the previous algorithms achieve either the best approximation, or the best running time, but not both at the same time. Our algorithms for subspace embedding and regression are simple, and in particular are not iterative. In particular, for the subspace embedding, the embedding matrix S is gener- ated independently of the data. In the regression problem, we multiply the input with the embedding matrix, and thus reduce to the ℓ2 regression problem, for which we can use any of the known algorithm. Technical discussion. Next we highlight some of our techniques used to obtain the theoretical results. Subspace embedding. Our starting point is a technique introduced in (Andoni et al., 2017) for the Orlicz norms, which can be seen as an embedding that has guarantees for a fixed vector only. In contrast, our main challenge here ized exponential" random variable, i.e., drawn from a dis- is to obtain an embedding for all vectors x ∈ Rn in a cer- tain d-dimensional subspace. Consider a random diagonal matrix D ∈ Rn×n with each diagonal entry is a "general- tribution with cumulative distribution function 1 − e−G(x). Then, for a fixed x ∈ Rd, (Andoni et al., 2017) show that kD−1Axk∞ is not too small with high probability. We can the dilation bound on kD−1AxkG, to argue that ∀x ∈ Rd, kD−1Axk∞ is not too small. combine this statement together with a net argument and The other direction is more challenging - to show that for a given matrix A ∈ Rn×d, and any fixed x ∈ Rd, kD−1AxkG cannot be too large. Once we show this "di- lation bound", we combine it with the well-conditioned ba- sis argument (similar to (Dasgupta et al., 2009)), and prove that ∀x ∈ Rd, kD−1AxkG cannot be too large. Overall, we have that ∀x ∈ Rd, kD−1AxkG ≤ O(d2 log n) · kAxkG, and kD−1Axk∞ ≥ Ω(1/(d log n)) · kAxkG. Since ℓ2 norm is sandwiched by k · kG and ℓ∞ norm, we have that ∀x ∈ Rd, Ω(1/(d log n)) · kAxkG ≤ kD−1Axk2 ≤ O(d2 log n) · kAxkG. Then, the remaining part is to use standard techniques (Woodruff & Zhang, 2013; Woodruff, 2014) to perform the ℓ2 subspace embedding for the col- umn space of D−1A. See Theorem 16 for details. The actual proof of the dilation bound is the most techni- cally intricate result. Traditionally, since the pth power of the ℓp norm is the sum of the pth power of all the entries, it is easy to bound the expectation by using linearity of the expectation. However it is impossible to apply this analysis to Orlicz norm directly since Orlicz norm is not an "entry- wise" norm. Instead, we exploit a key observation that the Orlicz norm of vectors which are on the unit ball can be Subspace Embedding and Linear Regression with Orlicz Norm seen as the sum of contribution of each coordinate. Thus, we propose a novel analysis for any fixed vector by analyz- ing the behavior of the normalized vector which is on the unit Orlicz norm ball. To extend the dilation bound for a fixed vector to all the vectors in a subspace, we general- ize the definition of ℓp norm well-conditioned basis to the Orlicz norm case, and then show that the Auerbach basis provides a good basis for Orlicz norm. To the best of our knowledge, this is the first time Auerbach basis are used to analyze the dilation bound of an embedding method for a norm distinct from an ℓp norm. See Section 3 for details. Regression with Orlicz norm. Here, given a matrix A ∈ Rn×d, a vector b ∈ Rn, the goal is to solve Equation 1 with Orlicz norm loss function. We can now solve this prob- lem directly using the subspace embedding from above, in particular by applyingit to the column space of [A b]. We obtain an O(d3 log2 n) approximation ratio, which we can further improve by observing that it actually suffices to have the dilation bound on kD−1Ax∗kG only for the optimal solution x∗ (as opposed to for an arbitrary x). Us- ing this observation, we improve the approximation ratio to O(d log2 n). See Theorem 18 for details. We evaluate the algorithm's performance and show that it performs well (even when n is not much larger than d). See Section 5. This connection allows us to consider the following prob- ℓp low rank matrix approximation. The ℓp norm is a spe- cial case of the Orlicz norm k · kG, where G(x) = xp. lem: given A ∈ Rn×d, n ≥ d ≥ k ≥ 1, find a rank-k matrix B ∈ Rn×d such that kA − Bkp is minimized. Here we consider the case of 1 ≤ p < 2 and k = ω(log n). The best known algorithm for this problem is from (Song et al., 2017), which uses the dense p-stable transform to achieves k2 · poly(log n) approximation ratio. It has the down- side that its runtime does not compare favorably to the golden standard of runtime linear in the sparsity of the input. To improve the runtime, one can apply the sparse p-stable transform and achieve input sparsity runtime, but that comes at the cost of an Ω(k6) factor loss in the approx- imation ratio. Using the above techniques, we develop an algorithm with best of both worlds: k2 · poly(log n) approximation ratio and the input sparsity running time at the same time. In par- ticular, the main inefficiency of the algorithm (Song et al., 2017) is the relaxation from ℓp norm to ℓ2 norm, which incurs a further poly(k) approximation factor. In contrast, the embedding based on exponential random variables em- beds ℓp norm to ℓ2 norm directly, without further approxi- mation loss. Our embedding also comes with its own pit- falls - as we need to deal with mixed norms - thus re- quiring a new analysis. See Theorem 23 for details. 2. Notations and preliminaries In this paper, we denote R+ to be the set of nonnegative reals. Define [n] = {1, 2,··· , n}. Given a matrix A ∈ Rn×d, ∀i ∈ [n], j ∈ [d], Ai and Aj denotes the ith row and the jth column of A respectively. nnz(A) denotes the num- ber of nonzero entries of A. The column space of A ∈ Rd is {y ∃x ∈ Rd, y = Ax}. ∀p 6= 2, kAkp , (P Ai,jp)1/p, i.e. entrywise p-norm. kAkF defines the Frobenius norm of A, i.e. (P A2 i,j)1/2. A† denotes the Moore-Penrose pseudoinverse of A. Given an invertible function f (·), let f−1(·) be the inverse function of f (·). If f (·) is not in- vertible in (−∞, +∞) but it is invertible in [0, +∞), then we denote f−1(·) to be the inverse function of f (·) in do- main [0, +∞). inf and sup denote the infimum and supre- mum respectively. f′(x), f′+(x), f′ −(x) denote the deriva- tive, right derivative and left derivative of f (x), respec- tively. Similarly, define f′′(x) for the second derivatives, and we define f′′+(x) = limh→0+ (f′(x + h) − f′+(x))/h. In the following, we give the definition of Orlicz norm. 0 ≤ x ≤ 1 x > 1 Definition 1 (Orlicz norm). For any nonzero monotone nondecreasing convex function G : R+ → R+ with G(0) = 0. Define Orlicz norm k · kG as: ∀n ∈ Z, n ≥ 1, x ∈ Rn,kxkG = inf {α > 0 Pn i=1 G(xi/α) ≤ 1} . For any function G1(·) which is valid to define an Orlicz norm, we can always "simplify/normalize" the function to get another function G2 such that computingk·kG1 is equiv- alent to computing k · kG2. : R+ → R+ which Fact 2. Given a function G1 can induce an Orlicz norm k · kG1 (Definition 1), de- : R+ → R+ as the following: fine function G2 G2(x) = (cid:26) G1(G−1 1 (1)x) where s = sx − (s − 1) sup{(G2(y) − G2(x)) /(y − x) 0 ≤ x ≤ y ≤ 1} . Then k · kG2 is a valid Orlicz norm. Furthermore, ∀n ∈ Z, n ≥ 1, x ∈ Rn, we have kxkG1 = kxkG2/G−1 Thus, without loss of generality, in this paper we con- sider the Orlicz norm induced by function G which satis- fies G(1) = 1, and G(x) is a linear function for x > 1. In addition, we also require that G(x) grows no faster than quadratically in x. Thus, we define the property P of a function G : R → R+ as the following: 1) G is a nonzero monotone nondecreasing convex function in [0,∞); 2) G(0) = 0, G(1) = 1,∀x ∈ R, G(x) = G(−x); 3) G(x) is a linear function for x > 1, i.e. ∃s > 0,∀x > 1, G(x) = sx + (1 − s); 4) ∃δG > 0 such that G is twice differentiable on interval (0, δG). Furthermore, G′+(0) and G′′+(0) exist, and either G′+(0) > 0 or G′′+(0) > 0; 5) ∃CG > 0,∀0 < x < y, G(y)/G(x) ≤ CG(y/x)2. 1 (1). The condition 1 is required to define an Orlicz norm. The conditions 2,3 are required because we can always do the simplification/normalization (see Fact 2). The condition 4 is required for the smoothness of G. The condition 5 is due to the subquadratic growth condition. Subquadratic Subspace Embedding and Linear Regression with Orlicz Norm Table 1. Some of M-estimators. HUBER (cid:26) x2/2 c(x − c/2) x ≤ c x > c ℓ1 − ℓ2 "FAIR" 2(p1 + x2/2 − 1) c2 (x/c − log(1 + x/c)) i=1 G(xi) with sketch size sub-polynomial in the dimension n, as shown by (Braverman & Ostrovsky, 2010). For example, growth condition is necessary for sketching Pn if G(x) = xp for some p > 2, then k · kG is the same as k · kp. It is necessary to take Ω(n1−2/p) space to sketch ℓp norm in n-dimensional space. Condition 5 is also nec- essary for 2-concave property, (Kwapien & Schuett, 1985; Kwapie & Schtt, 1989) shows that k · kG can be embedded into ℓ1 space if and only if G is 2-concave. Although (Schtt, 1995) gives an explicit embedding to ℓ1, it cannot be com- puted efficiently. There are many potential choices of G(·) which satisfies property P, the following are some examples: 1) G(x) = xp for some 1 ≤ p ≤ 2. In this case k · kG is ex- actly the ℓp norm k · kp; 2) G(x) can be a normalized M- estimator function (see (Zhang, 1997)), i.e. define f (x) to be one of the functions in Table 1. and let G(x) = (cid:26) f (f−1(1)x) −(1)x − (G′ G′ −(1) − 1) x ≤ 1 x > 1 . The following presents some useful properties of function G with property P. See Appendix for details of proofs of the following Lemmas. Lemma 3. Given a function G(·) with property P, then ∀0 ≤ x ≤ 1, x2/CG ≤ G(x) ≤ x. Lemma 4. Given a function G(·) with property P, then ∀x ∈ Rn,kxk2/√CG ≤ kxkG ≤ kxk1. Lemma 5. Given a function G(·) with property P, then ∀0 < x < y, we have y/x ≤ G(y)/G(x). Lemma 6. Given a function G(·) with property P, there exist a constant αG > 0 which may depend on G, such that ∀0 ≤ a, b, if ab ≤ 1, then G(a)G(b) ≤ αGG(ab). 3. Subspace embedding for Orlicz norm using exponential random variables In this section, we develop the subspace embedding under the Orlicz norms which are induced by functions G with the property P. We first show how to embed the subspace with k·kG norm into a subspace with ℓ2 norm, and then we use dimensionality reduction techniques for the ℓ2 norm. Overall, we will prove Theorem 16 stated at the end of this section. Before discussing the details, we give formal defi- nitions of subspace embedding. Definition 7 (Subspace embedding for Orlicz norm). Given a matrix A ∈ Rn×d, if S ∈ Rm×n satisfies ∀x ∈ Rd,kAxkG/α ≤ kSAxkv ≤ βkAxkG where α, β ≥ 1,k · kv is a norm (can still be k · kG), then we say S embeds the column space of A with Orlicz norm into the column space of SA with v-norm. The distortion is αβ. If the distortion and the v-norm are clear from the context, we just say S is a subspace embedding matrix for A. Definition 8 (Subspace embedding for ℓ2 norm). Given a matrix A ∈ Rn×d, if S ∈ Rm×n satisfies ∀x ∈ Rd, (1 − ε)kAxk2 2, then we say S is a subspace embedding of column space of A. 2 ≤ (1 + ε)kAxk2 2 ≤ kSAxk2 There are many choices of ℓ2 subspace embedding matrix A satisfying the above definition. Examples are: random sign JL matrix (Achlioptas, 2003; Clarkson & Woodruff, 2009), fast JL matrix (Ailon & Chazelle, 2009), and sparse embedding matrices (Clarkson & Woodruff, 2013; Meng & Mahoney, 2013; Nelson & Nguyen, 2013). The main technical thrust is to embed k · kG into ℓ2 norm. As the embedding matrix, we use S = ΠD−1 where Π is one of the above ℓ2 embedding matrices and D is a di- agonal matrix of which diagonal entries are i.i.d. random variables draw from the distribution with CDF 1 − e−G(t). Equivalently, each entry on the diagonal of D is G−1(u), where u is an i.i.d. sample from the standard exponential distribution, i.e. CDF is 1 − e−t. In Section 3.1, we will prove that ∀x ∈ Rd, kD−1AxkGwill not be too large. In Section 3.2, we will show that ∀x ∈ Rd, kD−1Axk∞ can- kD−1Axk2 is a good estimator to kAxkG. In Section 3.3, not be too small. Then due to Lemma 4, we know that we show how to put all the ingredients together. 3.1. Dilation bound f We construct a randomized linear map f : Rn → Rn: 7−→ (x1/u1, x2/u2, ..., xn/un) where each (x1, x2, ..., xn) ui is drawn from a distribution with CDF 1 − e−G(t). No- tice that for proving the dilation bound, we do not need to assume ui are independent. Theorem 9. Given x ∈ Rn, let k · kG be an Orlicz norm induced by function G(·) which has property P, and let f (x) = (x1/u1, x2/u2, ..., xn/un), where each ui is drawn from a distribution with CDF 1 − e−G(t). Then with probability at least 1 − δ − O(1/n19), kf (x)kG ≤ O(αGδ−1 log(n))kxkG, where αG is a constant may de- pend on function G(·). Proof sketch: By taking union bound, we have ∀i ∈ [n], ui ≥ G−1(1/n20) with high probability. Let α = kxkG. For γ ≥ 1, we want to upper bound the prob- ability that kf (x)kG ≥ γα. This is equivalent to upper bound the probability that kf (x)/(γα)kG ≥ 1. Notice that Pr(kf (x)/(γα)kG ≥ 1) = Pr(P G(xi/α·1/(γui)) ≥ 1). By Markov inequality, it suffices to bound the expectation ofP G(xi/α·1/(γui)) conditioned on ui are not too small. By lemma 6,P G(xi/α· 1/(γui)) ≤ αG/γ ·P G(xi/α)· 1/G(ui). Because ui is not too small, the conditional ex- pectation of 1/G(ui) is roughly O(log n). So the probabil- Subspace Embedding and Linear Regression with Orlicz Norm ity that kf (x)kG ≥ γα is bounded by O(αG log n/γ), set γ = O(log n)αG/δ, we can complete the proof. See ap- pendix for the details of the whole proof. The final step is to use a well-conditioned basis; see details in appendix.We then obtain the following theorem. Theorem 10. Let G(·) be a function which has property P. Given a matrix A ∈ Rn×m with rank d ≤ n, let D ∈ Rn×n be a diagonal matrix of which each entry on the diagonal is drawn from a distribution with CDF 1 − e−G(t). Then, with probability at least 0.99, ∀x ∈ Rm,kD−1AxkG ≤ O(αGd2 log n)kAxkG, where αG ≥ 1 is a constant which only depends on G(·). 3.2. Contraction bound f As in Section 3.1, we construct a randomized linear map f : Rn → Rn: (x1, x2, ..., xn) 7−→ (x1/u1, x2/u2, ..., xn/un) where each ui is an i.i.d. random variable drawn from a distribution with CDF 1−e−G(t). Notice that the difference from proving the dilation bound is that we need ui to be independent here. We use the following theorem: Theorem 11 (Lemma 3.1 of (Andoni et al., 2017)). Given x ∈ Rn, let k · kG be an Orlicz norm induced by function G(·) which has property P, and let f (x) = (x1/u1, x2/u2, ..., xn/un) , where each ui is an i.i.d ran- dom variable drawn from a distribution with CDF 1 − e−G(t). Then for α ≥ 1, with probability at least 1 − e−α, kf (x)k∞ ≥ kxkG/α. By combining the result with the net argument (see ap- pendix), and Theorems 11, 10, we get the following: Theorem 12. G(·) is a function with property P. Given a matrix A ∈ Rn×m with rank d ≤ n, let D ∈ Rn×n be a diagonal matrix of which each entry on the diagonal is an i.i.d. random variable drawn from the distribution with CDF 1 − e−G(t). Then, with probability at least 0.98, ∀x ∈ Rm, Ω(1/(α′Gd log n))kAxkG ≤ kD−1Axk∞, where α′G ≥ 1 is a constant which only depends on G(·). Proof sketch: Set ε = 1/poly(nd), we can build an ε-net (see Appendix) N for the column space of A. By taking the union bound over all the net points, we have ∀x ∈ N, kD−1xk∞ is not too small. Due to Theorem 10, we have ∀x in the column space of A, kD−1xkG is not too large. Now, for any unit vector y in the column space of A, we can find the closest point x ∈ N, and kx − yk2 ≤ ε. Since kD−1yk∞ ≥ kD−1xk∞ −kD−1(y− x)k∞, kD−1xk∞ is not too small, and kD−1(y − x)k∞ is not too large, we can get a lower bound for kD−1yk∞. See appendix for details. 3.3. Putting it all together We now combine Theorem 12, Theorem 10, and Lemma 4, to get the following theorem. Theorem 13. Let G(·) be a function which has property P. Given a matrix A ∈ Rn×m with rank d ≤ n, let D ∈ Rn×n be a diagonal matrix of which each entry on the diagonal is an i.i.d. random variable drawn from the distribution with CDF 1 − e−G(t). Then, with probability at least 0.98, ∀x ∈ Rm, Ω(1/(α′Gd log n))kAxkG ≤ kD−1Axk2 ≤ O(α′′Gd2 log n)kAxkG, where α′′G, α′G ≥ 1 are two con- stants which only depend on G(·). The above theorem successfully embeds k·kG into ℓ2 space. We now use ℓ2 subspace embedding to reduce the dimen- sion. The following two theorems provide efficient ℓ2 sub- space embeddings. Theorem 14 ( (Clarkson & Woodruff, 2013)). Given ma- trix A ∈ Rn×m with rank d. Let t = Θ(d2/ε2), S = ΦY ∈ Rt×n, where Y ∈ Rn×n is a diagonal matrix with each diagonal entry independently uniformly chosen to be ±1, Φ ∈ Rt×n is a binary matrix with Φh(i),i = 1,∀i ∈ [n], and remaining entries 0. Here h : [n] → [t] is a random hashing function such that for each i ∈ [n], h(i) is uni- formly distributed in [t]. Then with probability at least 0.99, ∀x ∈ Rm, (1− ε)kAxk2 2. Fur- thermore, SA can be computed in nnz(A) time. Theorem 15 (See e.g. (Woodruff, 2014)). Given matrix 2 ≤ (1 + ε)kAxk2 2 ≤ kSAxk2 be a random matrix of i.i.d. standard Gaussian variables A ∈ Rn×m with rank d. Let t = Θ(d/ε2), S ∈ Rt×n scaled by 1/√t. Then with probability at least 0.99, ∀x ∈ Rm, (1 − ε)kAxk2 2 ≤ (1 + ε)kAxk2 2. 2 ≤ kSAxk2 We conclude the full theorem for our subspace embedding: Theorem 16. Let G(·) be a function which has property P. Given a matrix A ∈ Rn×d, d ≤ n, let D ∈ Rn×n be a diagonal matrix of which each entry on the diagonal is an i.i.d. random variable drawn from the distribution with CDF 1 − e−G(t). Let Π1 ∈ Rt1×n be a sparse em- bedding matrix (see Theorem 14) and let Π2 ∈ Rt2×t1 be a random Gaussian matrix (see Theorem 15) where t1 = Ω(d2), t2 = Ω(d). Then, with probability at least 0.9, ∀x ∈ Rd, Ω(1/(α′Gd log n))kAxkG ≤ kΠ2Π1D−1Axk2 ≤ O(α′′Gd2 log n)kAxkG, where α′′G, α′G ≥ 1 are two constants which only depend on G(·). Furthermore, Π2Π1D−1A can be computed in nnz(A) + poly(d) time. 4. Applications In this section, we discuss regression problem with Orlicz norm error measure, and low rank approximation problem with ℓp norm, which is a special case of the Orlicz norms. 4.1. Linear regression under Orlicz norm We give the definition of regression problem as follow. Definition 17. Function G(·) has property P. Given A ∈ Rn×d, b ∈ Rn, the goal is to solve the following minimiza- tion problem minx∈Rd kAx − bkG. Theorem 18. Let G(·) have property P. Given A ∈ Rn×d, b ∈ Rn, Algorithm 1 can output a solution x ∈ Rd Subspace Embedding and Linear Regression with Orlicz Norm Algorithm 1 Linear regression with Orlicz norm k · kG 1: Input: A ∈ Rn×d, b ∈ Rn. 2: Output: x. 3: Let t1 = Θ(d2), t2 = Θ(d). 4: Let Π1 ∈ Rt1×n be a random sparse embedding matrix, Π2 ∈ Rt2×t1 be a random gaussian matrix, and D ∈ Rn×n be a random diagonal matrix with each diagonal entry inde- pendently drawn from distribution whose CDF is 1 − e−G(t). (See Theorem 16.) 5: Compute x = (Π2Π1D−1A)†Π2Π1D−1b. such that with probability at least 0.8, kAx − bkG ≤ O(βGd log2 n) minx∈Rd kAx − bkG, where βG is a con- stant which may depend on G(·). In addition, the running time of Algorithm 1 is nnz(A) + poly(d). Proof sketch: space embedding for column space of Let S = Π2Π1D−1 be the sub- Let [A b]. x∗ = arg minx∈Rd kAx − bkG. Due to Theorem 16, kAx − bkG is bounded by O(d log n)kS(Ax − b)k2 ≤ O(d log n)kS(Ax∗ − b)k2 ≤ O(d log n)kD−1(Ax∗ − b)k2. Due to Theorem 9, kD−1(Ax∗ − b)k2 ≤ O(1)kD−1(Ax∗ − b)kG ≤ O(log n)kAx∗ − bkG. 4.2. Regression with combined loss function In this section, we want to point out that our technique can be used on solving regression problem with more general cost function. Recall that the goal is to solve the minimiza- tion problem minx∈Rd kAx− bkG. Now, we consider there are multiple goals, and we want to minimize a linear com- bination of the costs. Now we give the definition of regres- sion problem with combined cost function. Definition 19. Suppose function G1(·), G2(·), ..., Gk(·) Given A1 ∈ Rn1×d, A2 ∈ satisfies property P. Rn2×d, ..., Ak ∈ Rnk×d, b1 ∈ Rn1 , b2 ∈ Rn2 , ..., bk ∈ Rnk , the goal is to solve the following minimization prob- lem minx∈Rd Pk The idea of solving this problem is that we can embed every term into l1 space, and then merge them into one term. By the standard technique, there is a way to embed l2 space to l1 space. We show the embedding as below. For the com- pleteness, we put the proof of this lemma to the appendix. i=1 kAix − bikGi . Lemma 20. Let Q ∈ Rt×n be a random matrix with each entry drawn uniformly from i.i.d. N (0, 1) Gaussian distri- bution. Let B = (pπ/2/t) · Q. If t = Ω(ǫ−2n log(nǫ−1)), then with probability at least 0.98, ∀x ∈ Rn,kBxk1 ∈ ((1 − ǫ)kxk2, (1 + ǫ)kxk2). Theorem 21. Let k > 0 be a constant, and G1(·), G2(·), ..., Gk(·) Given A1 ∈ Rn1×d, A2 ∈ Rn2×d, ..., Ak ∈ Rnk×d, b1 ∈ Rnk , Algorithm 2 Rn1 , b2 ∈ can output a solution x ∈ Rd such that with least 0.7, Pk i=1 kAi x − bikGi ≤ O(β′Gd log2 n) minx∈Rd Pk i=1 kAix − bikGi, where β′G is ∈ probability at satisfy property P. Rn2, ..., bk Algorithm 2 Linear regression with combined loss functions 1: Input: A1 ∈ Rn1×d, A2 ∈ Rn2×d, ..., Ak ∈ Rnk ×d, b1 ∈ Rn1 , b2 ∈ Rn2 , ..., bk ∈ Rnk 2: Output: x. 3: Let t1 = Θ(d2), t2 = Θ(d), t3 = Θ(t2 log(t2)). 4: Let Π(1) 2 , · · · , Π(k) 1 ∈ Rt1×n1 , · · · Π(k) 1 ∈ Rt1×nk be k random sparse embedding matrices, Π(1) ∈ Rt2×t1 be k ran- dom Gaussian matrices, and D(1) ∈ Rn1×n1 , · · · , D(k) ∈ Rnk ×nk be k random diagonal matrices where each diag- onal entry of D(i) is independently drawn from distribu- tion whose CDF is 1 − e−Gi(t). (See Theorem 16.) Let Q(1), · · · , Q(k) ∈ Rt3×t2 be random matrices with each entry drawn uniformly from i.i.d. N (0, 1) Gaussian dis- 2 j=1 nj , D ∈ RPk tribution. ∀i ∈ [k], let B(i) = (pπ/2/t3) · Q(i) (see Lemma 20.) Let B ∈ Rkt3×kt2 , Π2 ∈ Rkt2×kt1 , Π1 ∈ Rkt1×Pk j=1 nj be four block diago- nal matrices such that ∀i ∈ [k], the ith block of B, Π2, Π1, D is B(i), Π(i) 5: Let A = [A⊤ BΠ2Π1D−1. 1 , D(i) respectively. 2 , ..., A⊤ k ]⊤, b = [b⊤ 2 , Π(i) 1 , A⊤ k ]⊤ and S = j=1 nj ×Pk 1 , b⊤ 2 , ..., b⊤ 6: Use classical method of solving l1 regression to get x = arg minx∈Rd kS(Ax − b)k1. [A b]. i=1 nnz(Ai) + poly(d). a constant which may depend on G1(·), G2(·), ..., Gk(·). the running time of Algorithm 2 is In addition, Pk Proof Sketch: Let A = [A⊤1 , A⊤2 , ..., A⊤k ]⊤, b = [b⊤1 , b⊤2 , ..., b⊤k ]⊤, and S = BΠ2Π1D−1 be the sub- space embedding for column space of Let Si = B(i)Π(i) b)k1 = Pk arg minx∈Rd Pk and Lemma 20, Pk i=1 kAi x − bikGi O(d log n)Pk b)k1 ≤ O(d log n)kS(Ax∗ − b)k1 = Pk bi)k1. Due to Theorem 16, Pk O(log n)Pk i=1 kAix∗ − bikGi . 2 Π(i) 1 (D(i))−1. Notice that ∀x,kS(Ax − Let x∗ = i=1 kSi(Aix − bi)k1. i=1 kAix − bikGi . Due to Theorem 16 is bounded by i=1 kSi(Ai x − bi)k1 = O(d log n)kS(Ax − i=1 kSi(Aix∗ − i=1 kSi(Aix∗ − bi)k1 ≤ One application of the above Theorem is to solve the LASSO (Least Absolute Shrinkage Sector Operator) re- gression. In LASSO regression problem, the goal is to min- imize kAx − bk2 2 + λkxk1, where λ is a parameter of reg- ularizer. It is easy to show that it is equivalent to minimize kAx − bk2 + λ′kxk1 for some other parameter λ′. When we look at kAx − bk2 + λ′kxk1, we can set A1 = A, b1 = b, A2 = λ′I, b2 = 0, G1(·) ≡ x2, G2(·) ≡ x, then we are able to apply Theorem 21 to give a good approximation. The merit of our algorithm is that it is very simple, and can be computed very fast. 4.3. ℓp norm low rank approximation using exponential random variables We discuss a special case of Orlicz norm k · kG, ℓp norm, i.e. G(x) ≡ xp for p ∈ [1, 2]. When rank pa- Subspace Embedding and Linear Regression with Orlicz Norm rameter k is ω(log n + log d), by using exponential ran- dom variables, we can significantly improve the approx- imation ratio of input sparsity time algorithms shown by (Song et al., 2017). The high level ideas combine the re- sults of (Woodruff & Zhang, 2013; Song et al., 2017) and the dilation bound in Section 3. We define the problem in the following. See Appendix for the proof of Theorem 23. Definition 22. Let p ∈ [1, 2]. Given A ∈ Rn×d, n ≥ d, k ∈ Z, 1 ≤ k ≤ min(n, d), the goal is to solve the following minimization problem: minU∈Rn×k,V ∈Rk×d kU V − Akp p. Algorithm 3 ℓp norm low rank approximation using exponential random variables. 1: Input: A ∈ Rn×d, k ∈ Z, min(n, d) ≥ k ≥ 1. 2: Output: U ∈ Rn×k, V ∈ Rk×d. 3: Let t1 = Θ(k2), t2 = Θ(k), t3 = Θ(k log k). 4: Let Π1, S1 ∈ Rt1×n be two random sparse embedding matri- ces, Π2, S2 ∈ Rt2×t1 be two random gaussian matrices, and D1, D2 ∈ Rn×n be two random diagonal matrices with each diagonal entry independently drawn from distribution whose CDF is 1 − e−tp . (See Theorem 16.) 5: Let T2, R ∈ Rd×t3 be two random matrix, with i.i.d. entries drawn from standard p-stable distribution. 6: Let S = S2S1D−1 7: Solve X, Y = arg minX∈Rt2×k ,Y ∈Rk×t3 kT1ARXY SAT2− 1 , T1 = Π2Π1D−1 2 . T1AT2k2 F . 8: U = AR X, V = Y SA. Theorem 23. Let 1 ≤ p ≤ 2. Given A ∈ Rn×d, n ≥ d, k ∈ Z, 1 ≤ k ≤ min(n, d), with probability at least 2/3, U , V outputted by Algorithm 3 satisfies: k U V − Akp p ≤ α minU∈Rn×k,V ∈Rk×d kU V − Akp = O(min((k log k)4−p log2p+2 n, (k log k)4−2p log4+p n)). In addition, the running time of Algorithm 3 is nnz(A) + (n + d)poly(k). p, where α 5. Experiments Implementation setups can be seen in appendix. 5.1. Orlicz Norm Linear Regression In this section, we show that our algorithm i) has reason- able and predictable performance under different scenarios and ii) is flexible, general and easy to use. We perform 3 sets of experiments. The first is to compare its perfor- mance with the standard ℓ1 and ℓ2 regression under dif- ferent noise assumptions and dimensions of the regression problem; the second is to compare the performance of Or- licz regression with different G under different noise as- sumptions; the third is to experiment with Orlicz function G that is different from standard ℓp and Huber function. We evaluate the performance of our Orlicz norm linear regres- sion algorithm on simulated data. Comparison with ℓ1 and ℓ2 regression We would like to see whether Orlicz norm linear regression leads to ex- pected performance relative to ℓ1 and ℓ2 regression. We choose our Orlicz norm k · kG to be induced by the normal- ized Huber function where the Huber function is defined Table 2. Comparisons of different regressions in different noise and dimension settings; each entry is the error of ℓ1, ℓ2, Orlicz norm regression. As expected, ℓ2/ℓ1 regression lead to best perfor- mance under Sparse/Gaussian noise setting, and the performance of Orlicz norm regression lies in between. Gaussian Sparse Mixed balance overconstraint 211.2/194.5/197.3 25.3/30.7/30.0 37.9/37.8/37.5 25.3/20.0/24.9 2e-9/1.6/1.5 8.7/7.6/7.5 as f (x) = (cid:26) x2/2 δ · (x − δ/2) o.w. x ≤ δ . We chose the pa- rameter δ to be 0.75. Intuitively, it is between ℓ1 and ℓ2 norm (see Figure 1). In all the simulations, we generate ma- trix A ∈ Rn×d, ground truth x∗ ∈ Rd, and b to be Ax∗ plus some particular noise. We evaluate the performance of each algorithm by the ℓ2 distances between the output x and the ground truth x∗. In terms of algorithm details, since n, d are not too large in our simulation, we did not apply the ℓ2 subspace embedding to reduce the dimension; we only use reciprocal exponential random diagonal embedding matrix to embed k · kG to ℓ2 norm (see Theorem 13)1. i) n = We experiment with two n, d combinations, 200, d = 10 ii) n = 100, d = 75, and 3 noise setting with i) Gaussian noise ii) sparse noise and iii) mixed noise (addi- tion of i) and ii)), altogether 2× 3 = 6 setting. The detail of data simulation can be seen in appendix. For each experi- ment we repeat 50 times and compute the mean. The results are shown in Table 2. Orlicz norm regression has better per- formance than ℓ1 and ℓ2 when the noise is mixed. When the noise is Gaussian or sparse, Orlicz norm regression works better than ℓ1 and ℓ2 respectively. We did not experiment with Huber loss regression, since if we rescale the data and make it small/large in absolute values, the Huber regres- sion will degenerate into respectively ℓ2/ℓ1 regression (see Introduction). See appendix for results on approximation ratio. Choice of δ for G as a normalized Huber function We compare the performance of Orlicz norm regression in- duced by G as normalized Huber loss function with dif- ferent δ under different noise assumptions. We fix n = 500, d = 30 and generate A and x as in the first set of ex- periments (see appendix). The noise is a mixture of N (0, 5) Gaussian noise and sparse noise on 1% entries with dif- ferent scale of uniform noise from [−skAx∗k2, skAx∗k2], where scale s is chosen from [0, 0.5, 1, 2]. Under each noise assumptions with different scale s, we compare the performance of Orlicz norm regression induced by G with δ from [0.05, 0.1, 0.2, 0.4, 1, 2]. We repeat each experiment 50 times and report the mean of the ℓ2 distance between output x and the ground truth x∗. The result is shown in Figure 2. When the scale is 0/2, the noise is almost Gaus- sian/sparse and we expect ℓ2/ℓ1 norm and thus large/small 1We use MATLAB's linprog to solve ℓ1 regression. Subspace Embedding and Linear Regression with Orlicz Norm Table 3. Orlicz regression with different choices of G, mean of the ℓ2 distances between the output and the ground truth in 50 repetitions of experiments. ℓ1 ℓ1.5 ℓ2 Gδ=0.25 Gδ=0.75 17.0 45.0 909.8 60.2 405.7 Gℓ1.5 14.7 δ to perform the best; anything scale lying in between these extremes will have an optimal δ in between. We observe the expected trend: as s increases, the performance is optimal with smaller δ. x ≤ δ δ0.5 · (x − δ/3) o.w. Beyond Huber function - A General Framework We explore a variant Orlicz function G and evaluate it under a particular setting; the evaluation criteria is the same as the first set of the experiments. The G is of the same form aforementioned, except that it now grows at the or- der of x1.5 when x is small. We denote it by Gℓ1.5 , which is the normalization of function f , and f is de- fined as: f (x) = (cid:26) x1.5/1.5 . We generate a 500 × 30 matrix A and the ground truth vec- tor x∗ in the same way as before, and then add N (0, 5) Gaussian noises and 1 sparse outlier with scale s = 100. We find that the modified Gℓ1.5 under this settings out- performs ℓ1, ℓ2, ℓ1.5, Gδ=0.25, Gδ=0.75 regression by a sig- nificant amount where Gδ=0.25, Gδ=0.75 are Orlicz norm induced by regular normalized Huber function with δ = 0.25, 0.75 respectively. The results are shown in Table 3. This experiment demonstrates that our algorithm is i) flexi- ble enough to combine the advantage of norm functions, ii) general for any function that satisfies the nice property, and iii) easy to experiment with different settings, as long as we can compute G and G−1. 5.2. ℓ1 low rank matrix approximation In this section, we evaluate the performance of the ℓ1 low rank matrix approximation algorithm. We mainly com- pare the ℓ1 norm error of our algorithm with the error of (Song et al., 2017) and standard PCA. Inputs are a matrix A ∈ Rn×d and a rank parameter k; the goal is to output a rank k matrix B such that kA − Bk1 is as small as pos- sible. The details of implementations are in the appendix. For each input, we run the algorithm 50 times and pick the best solution. Figure 2. Performance of Orlicz regression with G induced by dif- ferent δ under different scale of sparse noise. The larger the sparse noise, the smaller the δ that leads to the best performance, which makes the norm closer to ℓ1 Datasets. We first run experiment on synthetic data: we randomly choose two matrices U ∈ R2000×5, V ∈ R5×2000 with each entry drawn uniformly from (0, 1) Then we randomly choose 100 entries of U V , and add random outliers uniformly drawn from (−100, 100) on those en- tries, thus we can get a matrix A ∈ R2000×2000. In our experiment, kAk1 is about 5.0 × 106. Then, we run experiments on real datasets diabetes and glass in UCI repository(Bache & Lichman, 2013). The data matrix of diabetes has size 768 × 8, and the data matrix of glass has size 214 × 9. For each data matrix, we randomly add out- liers on 1% number of entries. For each dataset, we evaluate the kA − Bk1. The result for the experiment on synthetic data is shown in Table 4, and the results for diabetes and glass are shown in Figure 3. The running time of algorithm in (Song et al., 2017) on dia- betes and on glass are 5.69 and 11.97 seconds respectively, with ours being 3.18 and 3.74 seconds respectively. We also find that our algorithm consistently outperforms the other two alternatives (the y-coordinates are at log scale with base 10). 106 105 104 1 2 3 Cauchy embedding only Ours, Cauchy+Exponential PCA 4 5 diabetes 6 105 104 103 102 1 Cauchy embedding only Ours, Cauchy+Exponential PCA 2 3 4 glass 5 6 7 8 Figure 3. ℓ1 norm error v.s. target rank. Table 4. ℓ1 rank-5 approximation on the synthetic data. Opt PCA (Song et al., 2017) Ours ℓ1 loss (×104 ) 0.50 3.53 1.36 1.04 6. Conclusion and Future Work We presented an efficient subspace embedding algorithm for orlicz norm and demonstrated its usefulness in regres- sion/low rank approximation problem on synthetic and real datasets. Nevertheless, O(d log2 n) is still a large theo- retical approximation factor, and hence it is worth i) in- vestigating whether the theoretical approximation ratio can be smaller if input are under some statistical distribution ii) calculating the actual approximation ratio with ground truth obtained by some slower but more accurate opti- mization algorithm. It is also worth examining whether our exponential embedding sketching method preserves the statistical properties of the regression error, since we as- sumed a different noise distribution from Gaussian/double- exponential as a starting point (Raskutti & Mahoney, 2014; Lopes et al., 2018). Subspace Embedding and Linear Regression with Orlicz Norm Acknowledgements Research supported in part by Simons Foundation (#491119 to Alexandr Andoni), NSF (CCF-1617955, CCF- 1740833), and Google Research Award. References Achlioptas, Dimitris. Database-friendly random projec- tions: Johnson-lindenstrauss with binary coins. Journal of computer and System Sciences, 66(4):671–687, 2003. Ailon, Nir and Chazelle, Bernard. The fast johnson– lindenstrauss transform and approximate nearest neigh- bors. SIAM Journal on Computing, 39(1):302–322, 2009. Andoni, Alexandr, Nikolov, Aleksandar, Razenshteyn, Ilya, and Waingarten, Erik. Approximate near neighbors for general symmetric norms. In Proceedings of the Forty- ninth annual ACM symposium on Theory of computing, 2017. Bache, Kevin and Lichman, Moshe. Uci machine learn- ing repository. URL http://archive. ics. uci. edu/ml, 901, 2013. Bhatia, Kush, Jain, Prateek, and Kar, Purushottam. Ro- bust regression via hard thresholding. In Cortes, C., Lawrence, N. D., Lee, D. D., Sugiyama, M., and Gar- nett, R. (eds.), Advances in Neural Information Process- ing Systems 28, pp. 721–729. Curran Associates, Inc., 2015. Braverman, Vladimir and Ostrovsky, Rafail. Zero-one fre- quency laws. In Proceedings of the forty-second ACM symposium on Theory of computing, pp. 281–290. ACM, 2010. Cavazza, Jacopo and Murino, Vittorio. People counting by huber loss regression. Cavazza, Jacopo and Murino, Vittorio. gression with adaptive huber loss. arXiv:1606.01568, 2016. Active re- arXiv preprint Chierichetti, Flavio, Gollapudi, Sreenivas, Kumar, Ravi, Lattanzi, Silvio, Panigrahy, Rina, and Woodruff, David P. Algorithms for ℓp low rank approximation. arXiv preprint arXiv:1705.06730, 2017. Clarkson, Kenneth L and Woodruff, David P. Numerical linear algebra in the streaming model. In Proceedings of the forty-first annual ACM symposium on Theory of computing, pp. 205–214. ACM, 2009. Clarkson, Kenneth L and Woodruff, David P. Low rank approximation and regression in input sparsity time. In Proceedings of the forty-fifth annual ACM symposium on Theory of computing, pp. 81–90. ACM, 2013. Clarkson, Kenneth L and Woodruff, David P. Sketching for m-estimators: A unified approach to robust regression. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 921–939. Soci- ety for Industrial and Applied Mathematics, 2015. Clarkson, Kenneth L, Drineas, Petros, Magdon-Ismail, Malik, Mahoney, Michael W, Meng, Xiangrui, and Woodruff, David P. The fast cauchy transform and faster robust linear regression. In Proceedings of the Twenty- Fourth Annual ACM-SIAM Symposium on Discrete Algo- rithms, pp. 466–477. Society for Industrial and Applied Mathematics, 2013. Dasgupta, Anirban, Drineas, Petros, Harb, Boulos, Kumar, Ravi, and Mahoney, Michael W. Sampling algorithms and coresets for ℓp regression. SIAM Journal on Com- puting, 38(5):2060–2078, 2009. Dhillon, Paramveer, Lu, Yichao, Foster, Dean P, and Ungar, Lyle. New subsampling algorithms for fast least squares regression. In Burges, C. J. C., Bottou, L., Welling, M., Ghahramani, Z., and Weinberger, K. Q. (eds.), Advances in Neural Information Processing Systems 26, pp. 360– 368. Curran Associates, Inc., 2013. Drineas, Petros, Mahoney, Michael W, Muthukrishnan, S, and Sarl´os, Tam´as. Faster least squares approximation. Numerische Mathematik, 117(2):219–249, 2011. Geppert, Leo N, Ickstadt, Katja, Munteanu, Alexander, Quedenfeld, Jens, and Sohler, Christian. Random projec- tions for bayesian regression. Statistics and Computing, pp. 1–23, 2015. Gorard, Stephen. Revisiting a 90-year-old debate: the ad- vantages of the mean deviation. British Journal of Edu- cational Studies, 53(4):417–430, 2005. Huber, Peter J et al. Robust estimation of a location pa- rameter. The Annals of Mathematical Statistics, 35(1): 73–101, 1964. Jain, Prateek and Tewari, Ambuj. Alternating minimiza- tion for regression problems with vector-valued outputs. In Cortes, C., Lawrence, N. D., Lee, D. D., Sugiyama, M., and Garnett, R. (eds.), Advances in Neural Informa- tion Processing Systems 28, pp. 1126–1134. Curran As- sociates, Inc., 2015. Kwapie, Stanisaw and Schtt, Carsten. Some combinato- rial and probabilistic inequalities and their application to banach space theory ii. Studia Mathematica, 95(2):141– 154, 1989. Subspace Embedding and Linear Regression with Orlicz Norm Kwapien, Stanislaw and Schuett, Carsten. Some combina- torial and probabilistic inequalities and their application to banach space theory. Studia Mathematica, 82:91–106, 1985. Liu, Han, Wang, Lie, and Zhao, Tuo. Multivariate re- gression with calibration. In Ghahramani, Z., Welling, M., Cortes, C., Lawrence, N. D., and Weinberger, K. Q. (eds.), Advances in Neural Information Processing Sys- tems 27, pp. 127–135. Curran Associates, Inc., 2014. Lopes, Miles E, Wang, Shusen, and Mahoney, Error estimation for randomized least- arXiv preprint Michael W. squares algorithms via the bootstrap. arXiv:1803.08021, 2018. Mahoney, Michael W et al. Randomized algorithms for ma- trices and data. Foundations and Trends R(cid:13) in Machine Learning, 3(2):123–224, 2011. Mangasarian, Olvi L and Musicant, David R. Robust linear and support vector regression. IEEE Transactions on Pat- tern Analysis and Machine Intelligence, 22(9):950–955, 2000. Meng, Xiangrui and Mahoney, Michael W. Low-distortion subspace embeddings in input-sparsity time and applica- tions to robust linear regression. In Proceedings of the forty-fifth annual ACM symposium on Theory of comput- ing, pp. 91–100. ACM, 2013. Nelson, Jelani and Nguyen, Huy L. Osnap: Faster numer- ical linear algebra algorithms via sparser subspace em- beddings. In Foundations of Computer Science (FOCS), 2013 IEEE 54th Annual Symposium on, pp. 117–126. IEEE, 2013. Owen, Art B. A robust hybrid of lasso and ridge regression. Contemporary Mathematics, 443:59–72, 2007. Raskutti, Garvesh and Mahoney, Michael. A statistical perspective on randomized sketching for ordinary least- squares. arXiv preprint arXiv:1406.5986, 2014. Rasmussen, Carl Edward. Gaussian processes for machine learning. 2006. Schtt, Carsten. On the embedding of 2-concave orlicz spaces into l1. Studia Mathematica, 113(1):73–80, 1995. Sohler, Christian and Woodruff, David P. Subspace embed- dings for the ℓ1-norm with applications. In Proceedings of the forty-third annual ACM symposium on Theory of computing, pp. 755–764. ACM, 2011. Song, Zhao, Woodruff, David P, and Zhong, Peilin. Low rank approximation with entrywise ℓ1-norm er- ror. In Proceedings of the 49th Annual Symposium on the Theory of Computing. ACM, arXiv preprint arXiv:1611.00898, 2017. Wang, Ruosong and Woodruff, David P. Tight bounds for ℓp oblivious subspace embeddings. arXiv preprint arXiv:1801.04414, 2018. Wikipedia. https://en.wikipedia.org/wiki/ Least_absolute_deviations. Woodruff, David and Zhang, Qin. Subspace embeddings and ℓp regression using exponential random variables. In Conference on Learning Theory, pp. 546–567, 2013. Woodruff, David P. Sketching as a tool for numerical lin- ear algebra. Foundations and Trends in Theoretical Com- puter Science, 10(1-2):1–157, 2014. Zhang, Zhengyou. Parameter estimation techniques: A tu- torial with application to conic fitting. Image and vision Computing, 15(1):59–76, 1997. Zhong, Kai, Jain, Prateek, and Dhillon, Inderjit S. Mixed In Lee, linear regression with multiple components. D. D., Sugiyama, M., Luxburg, U. V., Guyon, I., and Garnett, R. (eds.), Advances in Neural Information Pro- cessing Systems 29, pp. 2190–2198. Curran Associates, Inc., 2016. A. Related Works Existing literature studied the robust regression with re- spect to Huber loss function (Mangasarian & Musicant, 2000; Owen, 2007). Such regression can be applied to solve many problems like the people counting prob- lem (Cavazza & Murino). To speed up the regression process, some dimensional reduction techniques can be used to reduce the number of observations (Geppert et al., 2015), also faster algorithms have been proposed to address the robust regression with reasonable assump- tion (Bhatia et al., 2015). Besides, different models of re- gression were explored, such as Gaussian process regres- sion (Rasmussen, 2006), active regression with adaptive Huber loss (Cavazza & Murino, 2016). Recent years, there are lots of randomized sketching and embedding techniques developed for solving numerical linear algebra problems. There is a long line of works, e.g. (Achlioptas, 2003; Clarkson & Woodruff, 2013; Nelson & Nguyen, 2013) for ℓ2 subspace embedding, and works, e.g. (Sohler & Woodruff, 2011; Meng & Mahoney, 2013; Woodruff & Zhang, 2013; Wang & Woodruff, 2018) for ℓp subspace embedding. For more related works, we refer readers to the book (Woodruff, 2014). Based on sketching/embedding techniques, there is a line of works studied ℓ2 and ℓp regressions, e.g. (Clarkson & Woodruff, Subspace Embedding and Linear Regression with Orlicz Norm 2013; Drineas et al., 2011; Meng & Mahoney, 2013; Nelson & Nguyen, 2013). (Clarkson & Woodruff, 2015) studied linear regression with M-estimator error measure. We refer to the survey (Mahoney et al., 2011) for more details. 2013; Woodruff & Zhang, Frobenius norm low rank matrix approximation problem is also known as PCA problem. This problem is well studied. The fastest algorithm is shown by (Clarkson & Woodruff, 2013). For the entrywise ℓp norm low rank approximation problem, there is no known algorithm with theoretical guar- antee until the work (Song et al., 2017). (Song et al., 2017) works only for 1 ≤ p ≤ 2. Recently, (Chierichetti et al., 2017) gives algorithms for all p ≥ 1. But either the run- ning time is not in polynomial or the rank of the output is not exact k. B. Proof of Fact 2. Proof. Notice that G1 is a nonzero nondecreasing con- thus G−1 1 (1) exists, and G2 is a vex function on R+, nonzero nondecreasing function. In addition because y−x (G2(y) − G2(x)) 0 ≤ x ≤ y ≤ 1o , G2 s = supn 1 is also convex. Thus k · kG2 is Orlicz norm. Let x ∈ Rn. Notice that if α > 0 satisfies Pn i=1 G1(xi/α) ≤ 1, then ∀i ∈ [n], G1(xi/α) ≤ 1. It means that xi ≤ G−1 1 (1)α, thus Pn i=1 G1(xi/α) ≤ 1. Similarly if α satisfies Pn i=1 G2(xi/α) ≤ 1, then 1 (1)xi/α) = Pn Pn i=1 G1(G−1 i=1 G2(xi/α) ≤ 1. Therefore, kxkG1 = kxkG2/G−1 1 (1). 1 (1)α)) = Pn i=1 G2(xi/(G−1 C. Proof of Lemma 3. Due to convexity of G and G(1) = 1, G(0) = 0, ∀x ∈ [0, 1], G(x) ≤ xG(1) + (1 − x)G(0) = x. Since x ≤ 1, G(1)/G(x) ≤ CG(1/x)2, we have G(x) ≥ x2/CG. D. Proof of Lemma 4. With out loss of generality, we can assume ∀i ∈ [n], xi ≥ 0. Let x ∈ Rn, α = kxkG. We have Pn i=1 G(xi/α) = 1. If xi/α ≤ 1, due to the convexity of G, G(xi/α) ≤ G(1) · xi/α + G(0) · (1 − xi/α) = G(1) · xi/α = xi/α. If xi/α > 1, then G(xi/α) > 1 which contradicts to Pn i=1 G(xi/α) = 1. Thus, kxkG ≤ kxk1. kx/αk2 i=1 CGG(xi/α) = CG. 2 = Pn Then i=1(xi/α)2 ≤ Pn kxk2 ≤ pCGα. E. Proof of Lemma 5. Due to the convexity of G(·) and G(0) = 0, ∀0 < x < y, we have G(x) ≤ G(y)x/y + G(0)(1 − x/y) = G(y)x/y. Thus, y/x ≤ G(y)/G(x). F. Proof of Lemma 6. x−0 − c < c G(ab) ≤ G(b)/G(ab) ≤ CG/a2 ≤ 4CG. It is easy to see that ∀x > 0, G(x) 6= 0, since otherwise for y > x, the condition G(y)/G(x) < CG(y/x)2 would be violated. Let s = G′+(1). There are several cases. If a ≥ 1 or b ≥ 1. Without loss of generality, assume a ≥ 1.G(a)G(b)/G(ab) = (sa − (s − 1))G(b)/G(ab) ≤ saG(b)/G(ab). since ab ≥ b, G(ab)/G(b) ≥ a. Therefore, G(a)G(b)/G(ab) ≤ saG(b)/G(ab) ≤ s. If a, b ≤ 1, 0.5 ≤ a ≤ 1 or 0.5 ≤ b ≤ 1, we want to show G(a)G(b)/G(ab) is still bounded. Without loss of general- ity, assume that 0.5 ≤ a ≤ 1. Then G(a)G(b)/G(ab) = G(a) G(b) If a, b ≤ 0.5 and G′(0) > 0. Let G′(0) = c > 0. Therefore, there is a constant δ1 which may depend on G such that ∀x ∈ (0, δ1), G(x)−G(0) 2 . Therefore, ∀x ∈ (0, δ1], G(x) > c 2 x. Due to Lemma 5, ∀x > δ1, G(x)/x > G(δ1)/δ1 > c/2. Therefore, ∀x, G(x) ≥ c 2 x. Since b ≤ 0.5, ab ≤ a ≤ 1. Since G is convex, G(a) ≤ 1−ab G(ab) + a−ab 1−a 1−ab . Therefore, G(a) ≤ G(ab) + (1 − a)/(1 − ab) ≤ G(ab) + 2a. Simi- larly, G(b) ≤ 2b+G(ab). Then we have G(a)G(b) ≤ (2b+ G(ab))(2a + G(ab)) ⇒ G(a)G(b)/G(ab) ≤ ab/G(ab) + (2a + 2b) + G(ab) ≤ 2/c + 2 + 1 ≤ 2/c + 3. If a, b ≤ 0.5, G′+(0) = 0, G′′+(0) = c2 > 0. Let ǫ = c2/4. Since G is twice differentiable in (0, δG) and G′+(0), G′′+(0) exist, by Taylor's Theorem, there is a con- stant δ2 > 0 which may depend on G such that G(x) − (G(0) + G′+(0)x + c2x2/2) ≤ ǫx2. Therefore, ∀x ∈ (0, δ2), G(x) ≥ c2x2/4, G(x) ≤ c2x2. Hence, ∀a, b ∈ (0, δ2], G(a)G(b)/G(ab) ≤ G(a)G(b) b2 ≤ 4 c2 2 = 4c2. Consider a or b > δ2. Without loss of c2 generality, assume a > δ2. Similar to the previous argu- ment, G(a)G(b)/G(ab) ≤ G(a) G(b) G(ab) ≤ G(b)/G(ab) ≤ CGb2/(ab)2 ≤ CG/δ2 2. Thus G(a)G(b)/G(ab) is bounded by CG/δ2 2 in this case. 1−ab G(ab) + a−ab 1−ab G(1) = 1−a c2a2b2/4 ≤ 4 c2 G(a) G(b) a2 G. Proof of Theorem 9 Without loss of generality, we assume ∀i ∈ [n], xi ≥ 0. Fix i ∈ [n], we have Pr(ui ≥ G−1(1/n20)) = e−G(G−1(1/n20)) ≥ 1− 1/n20. Define E to be the event that ∀i ∈ [n], ui ≥ G−1(1/n20). By taking union bound over n coordinates, E happens with probability at least 1 − 1/n19. Subspace Embedding and Linear Regression with Orlicz Norm Let α = kxkG. Then, for any γ ≥ 1, we have H. Proof of Theorem 10 Pr(kf (x)kG ≥ γα) = Pr(kf (x)kG ≥ γα E ) Pr(E ) + Pr(kf (x)kG ≥ γα ¬E ) Pr(¬E ) ≤ Pr(kf (x)kG ≥ γα E ) Pr(E ) + Pr(¬E ) = Pr(kf (x)/(γα)kG ≥ 1 E ) Pr(E ) + Pr(¬E ) ≤ E n G(cid:18)xi/α · Xi=1 E(cid:18)G(cid:18)xi/α · Xi=1 = n 1 γui(cid:19) E! Pr(E ) + 1/n19 γui(cid:19) E(cid:19) Pr(E ) + 1/n19. 1 1 Let r = G−1(1/n20). For a fixed i ∈ [n], E(cid:18)G(cid:18)xi/α · =Z ∞ G(cid:18) xi/α G(xi/α)Z ∞ γui(cid:19) E(cid:19) Pr(E ) uγ (cid:19) e−G(u)G′(u)du γ Z 1 G(cid:18) xi/α u (cid:19) e−G(u)dG e−G(u)dG + G(xi/α) + 1 γ 1 γ ≤ ≤ 1 1 r r r 1 γ Z 1 G(cid:18) xi/α αGG(xi/α)Z 1 1 γ r ≤ 1 γ G(xi/α) + ≤O(log n) αG γ G(xi/α), u (cid:19) e−G(u)dG 1 G(u) e−G(u)dG where αG is a constant may depend on G(·). The first inequality follows by G(xi/α · 1/(γu)) ≤ 1/γ · G(xi/α · 1/u) + (1 − 1/γ) · G(0) ≤ G(xi/α · 1/u)/γ ≤ G(xi/α)/γ. The second inequality follows by R ∞ r e−xdx ≤ 1. The third inequality follows by Lemma 6. Since xi/α ≤ 1, then there is an αG such that G(u)G(xi/α· 1/u) ≤ αGG(xi/α). The last inequality fol- lows byR ∞ 1/n20 e−x/xdx = O(log n). Thus, we have Similar to (Dasgupta et al., 2009), we can define a well con- ditioned basis for Orlicz norm. Definition 24 (Well conditioned basis for Orlicz norm). Given a matrix A ∈ Rn×m with rank d, let U ∈ Rn×d be a matrix which has the same column space of A. If U satis- fies 1. ∀x ∈ Rd, kxk∞ ≤ βkU xkG, 2. Pd i=1 kUikG ≤ α , then U is an (α, β, G)-well conditioned basis of A. Fortunately, the such good basis exists for Orlicz norm. Theorem 25 (See Connection to Auerbach basis in Section 3.1 of (Dasgupta et al., 2009)). Given a matrix A ∈ Rn×m with rank d and norm k·kG, there exist a matrix U ∈ Rn×d which is a (d, 1, G) well conditioned basis of A. Proof of Theorem 10. Notice that D−1Ax is exactly the same as f (Ax). There is a matrix U ∈ Rn×d which is (d, 1, G)-well conditioned basis of A. Since ∀x ∈ Rm, there is always a vector y ∈ Rd such that Ax = U y, we only need to prove that with probability at least 0.99, ∀x ∈ Rd,kD−1U xkG ≤ O(αGd2 log n)kU xkG, where D, αG are the same as stated in the Theorem. Ac- cording to Theorem 9, if we look at a fixed i ∈ [d], then with probability at least 1 − 0.01/d, kD−1UikG ≤ O(αGd log(n)). By taking union bound, with probability at least 0.99, ∀i ∈ [d], kD−1UikG ≤ O(αGd log(n)). Now we have, for any x ∈ Rd, Xi=1 xikD−1UikG kD−1U xkG ≤ d ≤ kxk∞ d Xi=1 kD−1UikG d Xi=1 ≤ O(αGd log(n))kxk∞ ≤ O(αGd2 log(n))kU xkG. kUikG 1 γui(cid:19) E(cid:19) Pr(E ) n Xi=1 E(cid:18)G(cid:18)xi/α · Xi=1 αG γ n ≤O(log n) G(xi/α) ≤ O(log n) Then, αG γ . The first inequality follows by triangle inequality. The third inequality follows by ∀i ∈ [d], kD−1UikG ≤ O(αGd log(n)). The forth inequality follows by (d, 1, G)- well conditioned basis. Pr(kf (x)kG ≥ γα) ≤ O(log n) αG γ + 1/n19. I. Proof of Theorem 12 It is equivalent to Pr(kf (x)kG ≤ γα) ≥ 1 − O(log n) αG γ − 1/n19. Set γ = O(log n) αG δ , we complete the proof. Now, in the following, we present the concept of ε-net. Definition 26 (ε-net for ℓ2 norm). Given A ∈ Rn×m with rank d, let S be the ℓ2 unit ball in the column space of A, i.e. S = {y kyk2 = 1,∃x ∈ Rm, y = Ax}. Let N ⊂ S, if ∀x ∈ S,∃y ∈ N such that kx − yk2 ≤ ε, then we say N is an ε-net for S. Subspace Embedding and Linear Regression with Orlicz Norm The following theorem gives an upper bound of the size of ε-net. Theorem 27 (Lemma 2.2 of (Woodruff, 2014)). Given A ∈ Rn×m with rank d, let S be the ℓ2 unit ball in the column space of A. There exist an ε-net N for S, such that N ≤ (1 + 4/ε)d. It suffices to prove ∀x ∈ Rm,kAxk2 = 1 we have Ω(1/(α′Gd log n))kAxkG ≤ kD−1Axk∞. Let D ∈ Rn×n be a diagonal matrix of which each entry on the diago- random variable drawn from the distribu- nal is an i.i.d. tion with CDF 1 − e−G(t). Let α′G ≥ 1 be a sufficiently large constant. Let S be the ℓ2 unit ball in the column space of A. Let t1 = Θ(α′Gd log n), t2 = Θ(αGd2 log n), where αG is the parameter stated in Theorem 10. Set ε = O(1/(√nCGt1t2)). There exist an ε-net N for S, and N = eO(d(log n+log(CGα′ GαG))). By taking union bound over the net points, according to Theorem 11, with probability at least 0.99, ∀x ∈ N,kD−1xk∞ ≥ Ω(1/(α′Gd log n))kxkG. (2) Also due to Theorem 10, with probability at least 0.99, J. Proof of Theorem 13 Due to Theorem 12 and Theorem 10, with probability at least 0.98, ∀x ∈ Rm, Ω(1/(α′Gd log n))kAxkG ≤ kD−1Axk∞ ≤ kD−1Axk2. And kD−1Axk2 ≤ √CGkD−1AxkG ≤ O(√CGα′Gd2 log n)kAxkG. K. Proof of Theorem 16 Due to Theorem 14 and Theorem 15, with probability at least 0.95, ∀x, kΠ2Π1D−1Axk2 is a constant approxima- tion to kΠ1D−1Axk2 and kΠ1D−1Axk2 is a constant ap- proximation to kD−1Axk2. Combining with Theorem 13, we complete the proof. L. Proof of Theorem 18 Let x∗ = arg minx∈Rd kAx−bkG. Due to Theorem 9, with probability at least 0.99, kD−1(Ax∗ − b)kG ≤ O(αG log n)kAx∗ − bkG. (4) Now let A′ = [A b] ∈ Rn×(d+1). Due to Theorem 16, with probability at least 0.9, we have ∀x ∈ Rd+1, Ω(1/(α′Gd log n))kA′xkG ≤ kΠ2Π1D−1A′xk2. (5) ∀x ∈ S,kD−1xkG ≤ O(αGd2 log n)kxkG. (3) Then, By taking union bound, with probability at least 0.98, the above two events will happen. Then, in this case, consider a y ∈ S, let x ∈ N such that kx − yk2 ≤ ε, let z = x − y, we have t1 kzkG − t2pCGkzkG 1 t2 kD−1yk∞ ≥ kD−1xk∞ − kD−1zk∞ t1kxkG − t2pCGkzkG ≥ 1 t1kykG − ≥ 1 t1kykG − 2t2pCGkzkG ≥ 1 t1kykG − O( ≥ ≥ Ω(1/t1)kykG = Ω(1/(α′Gd log n))kykG. √CGt1 2 ) The first inequality follows by triangle inequality. The second inequality follows by Equation 2, Equation 3, and Lemma 4, i.e. kD−1zk∞ ≤ kD−1zk2 ≤ √CGkD−1zkG. The third inequality follows by triangle inequality. The forth inequality follows by t1, CG ≥ 1. The fifth inequality follows by Lemma 4: kzkG ≤ kzk1 ≤ √nkzk2 = √nε = O(1/(CGt1)). The sixth inequality follows by Lemma 4: kykG ≥ 1√CGkyk2 = 1/√CG. kAx − bkG ≤ O(α′Gd log n)kΠ2Π1D−1(Ax − b)k2 ≤ O(α′Gd log n)kΠ2Π1D−1(Ax∗ − b)k2 ≤ O(α′Gd log n)kD−1(Ax∗ − b)k2 ≤ O(α′GpCGd log n)kD−1(Ax∗ − b)kG ≤ O(αGα′GpCGd log2 n)kAx∗ − bkG. follows by x follows Equation inequality inequality first second 5. The = The (Π2Π1D−1A)†Π2Π1D−1b, which is the optimal so- lution for minx∈Rd kΠ2Π1D−1(Ax − b)k2. The third inequality follows by Theorem 14 and Theorem 15. The forth inequality follows by Lemma 4. The last inequality follows by Equation 4. Let βG = α′G√CG, we complete by the proof of the correctness of Algorithm 1. For the running time, according to Theorem 16, comput- ing Π2Π1D−1A and Π2Π1D−1b needs nnz(A) + poly(d) time. Since Π2Π1D−1A has size poly(d), computing x = (Π2Π1D−1A)†Π2Π1D−1b needs poly(d) running time. The total running time is nnz(A) + poly(d). M. proof of Lemma 20 Before we prove the Lemma, we need following tools. Subspace Embedding and Linear Regression with Orlicz Norm k k π Xi=1 , (1 + ε)r 2 zi ∈ (1 − ε)r 2 Lemma 28 (Concentration bound for sum of half normal random variables). For any k i.i.d. random Gaussian vari- ables z1, z2,··· , zk, we have that π!! ≥ 1 − e−Ω(kε2). Pr 1 Lemma 29. Let G ∈ Rk×m be a random matrix with each entry drawn uniformly from i.i.d. N (0, 1) Gaussian distri- bution. With probability at least 0.99, G2 ≤ 10√km. Proof. Since E(cid:0)kGk2 F = km(cid:1) , we have that Pr(kGk2 F ≥ 100km) ≤ 0.01. Thus, with probability at least 0.99, we have kGk2 ≤ kGkF ≤ 10√km. Now, let us prove the lemma. Proof of Lemma 20. Without loss of generality, we only need to prove ∀x ∈ Rn with kxk2 = 1, we have kBxk1 ∈ (1 − ε, 1 + ε). Let set S = {v v ∈ Rn,kvk2 = 1}. Due to Theorem 27, we can find a set G ⊂ S which satisfies that ∀u ∈ S there exists v ∈ G such that ku − vk2 ≤ (ε/(1000n))10 and G ≤ (4000n/ε)20n. Let k ≥ cε−2n ln(n/ε) where c is a sufficiently large con- stant. By Lemma 28, we have that for a fixed v ∈ G, with probability at least 1 − e−1000n ln(4000n/ε),kBvk1 ∈ (1 − ε, 1 + ε). By taking union bound over all the points in G, we have Pr (∀v ∈ G,kBvk1 ∈ (1 − ε, 1 + ε)) ≥ 1 − e−980n ln(4000n/ε) ≥ 0.99. Now, consider ∀x ∈ Rn with kxk2 = 1, i.e. x ∈ S, we can find v ∈ G such that kv − xk2 ≤ (ε/(1000n))10, and let u = v − x. Then, con- ditioned on kBk2 ≤ 10√tn ·pπ/2/t, we have kBxk1 ∈(kBvk1 − kBuk1,kBvk1 + kBuk1) ⊆(1 − (ε + √tkBk2kuk2), 1 + (ε + √tkBk2kuk2)) ⊆(1 − 2ε, 1 + 2ε) where the first relation follows by triangle inequality, the second relation follows by kBuk1 ≤ √tkBuk2 ≤ √tkBk2kuk2, and the last relation follows by kuk2 ≤ (ε/(1000n))10,kBk2 ≤ 10√tn ·pπ/2/t. According to Lemma 29, we know that with probability at least 0.99, we have kBk2 ≤ 10√tn ·pπ/2/t. By taking union bound, we have with probability at least 0.98, ∀x ∈ S,kBxk1 ∈ (1 − 2ε, 1 + 2ε). By adjusting the ε, we complete the proof. N. Proof of Theorem 21 Without loss of generality, we assume constant k ≤ 2. Otherwise, we can always adjust constants in all the re- lated theorems and lemmas to make larger k work. Let i=1 kAix−bikGi. By Theorem 9 and taking union bound, we have that with probability at least 0.98, x∗ = arg minx∈Rd Pk ∀i ∈ {1, 2, · · · , k}, k(D(i))−1(Aix∗ − bi)kGi ≤ O(αGi log n)kAix∗ − bikGi . (6) Now let A′i = [Ai bi] ∈ Rni×(d+1). Due to Theorem 16 and union bound, with probability at least 0.8, we have ∀x ∈ Rd+1, Ω(1/(α′ Gi d log ni))kA′ ixkGi ≤ kΠ(i) 2 Π(i) 1 (D(i))−1A′ ixk2. (7) Then, k k Xi=1 Xi=1 Xi=1 k ≤ ≤ kAi x − bikGi O(α′ Gi d log n)kΠ(i) 2 Π(i) 1 (D(i))−1(Ai x − bi)k2 O(α′ Gi d log n)kB(i)Π(i) 2 Π(i) 1 (D(i))−1(Ai x − bi)k1 ≤O(max i∈[k] Gi d log n)kBΠ2Π1D−1(Ax − b)k1 α′ ≤O(max i∈[k] Gi d log n)kBΠ2Π1D−1(Ax∗ − b)k1 α′ k kB(i)Π(i) 2 Π(i) 1 (D(i))−1(Aix∗ − bi)k1 kΠ(i) 2 Π(i) 1 (D(i))−1(Aix∗ − bi)k2 k(D(i))−1(Aix∗ − bi)k2 ≤O(max i∈[k] ≤O(max i∈[k] ≤O(max i∈[k] ≤O((max k α′ α′ Gi d log n) Gi d log n) Xi=1 Xi=1 Xi=1 i∈[k]pCGi )(max Gi d log n) i∈[k] α′ k α′ Gi )d log n) k(D(i))−1(Aix∗ − bi)kGi k Xi=1 ≤O((max i∈[k] αGi )(max i∈[k]pCGi )(max i∈[k] Gi )d log2 n) α′ kAix∗ − bikGi . k Xi=1 The first inequality follows by Equation 7. The second inequality follows by Lemma 20. The forth inequality follows by x is the optimal solution for Subspace Embedding and Linear Regression with Orlicz Norm minx∈Rd kBΠ2Π1D−1(Ax − b)k1. The sixth inequal- ity follows by Lemma 20. ity follows by Theorem 14 and Theorem 15. eighth inequality follows by Lemma 4. inequality follows by Equation 6. The seventh inequal- The The last Let β′G = (maxi∈[k] αGi)(maxi∈[k]pCGi )(maxi∈[k] α′Gi), we com- plete the proof of the correctness of Algorithm 2. ing Π2Π1D−1A and Π2Π1D−1b needs Pk For the running time, according to Theorem 16, comput- i=1 nnz(Ai) + poly(d) time. Due to Lemma 20, the size of B is poly(d). To compute BΠ2Π1D−1A and BΠ2Π1D−1b, we need additional poly(d) time. Since BΠ2Π1D−1A has size poly(d), computing the optimal solution of minx∈Rd kBΠ2Π1D−1(Ax−b)k1 by using linear program- ming needs poly(d) running time. The total running time is Pk i=1 nnz(Ai) + poly(d). O. Proof of Theorem 23 Before we prove the Theorem, we need to show following Lemmas. Lemma 30 ((Song et al., 2017)). Let A ∈ Rn×d, R ∈ Rd×t3, k be the same as in the Algorithm 3, then with prob- ability at least 0.9, min X∈Rt3×k ,Y ∈Rk×d kARXY − Akp p ≤O((k log k)1−p/2 log n) min U ∈Rn×k,V ∈Rk×d kU V − Akp p. Lemma 31 ((Woodruff & Zhang, 2013)). Let 1 ≤ p ≤ 2. Given a matrix A ∈ Rn×d, d ≤ n, let D ∈ Rn×n be a diagonal matrix of which each entry on the diagonal is an i.i.d. random variable drawn from the distribution with CDF 1 − e−tp . Let Π1 ∈ Rt1×n be a sparse embedding matrix (see Theorem 18) and let Π2 ∈ Rt2×t1 be a random Gaussian matrix (see Theorem 19) where t1 = Ω(d2), t2 = Ω(d). Then, with probability at least 0.9, ∀x ∈ Rd, Ω(1/ min{(d log d)1/p, (d log d log n)1/p−1/2})kAxkp ≤kΠ2Π1D−1Axk2. Lemma 32. Let A ∈ Rn×d, S ∈ Rt2×n, R ∈ Rd×t3, k be the same as in the Algorithm 3, then with probability at least 0.9, min X∈Rt2×k ,Y ∈Rk×t2 kARXY SA − Akp p ≤β min U ∈Rn×k,V ∈Rk×d kU V − Akp p, Let U∗ = ARX∗, V = (SU∗)†SA. min{k log k, (k log k log n)1−p/2}. We have Let γ = kU ∗ V − Akp p ≤2p−1kU ∗( V − V ∗)kp p + 2p−1kU ∗V ∗ − Akp p d kSU ∗( V − V ∗)ikp 2 + 2p−1kU ∗V ∗ − Akp p (kS(U ∗ V − A)ik2 + kS(U ∗V ∗ − A)ik2)p ≤O(γ) ≤O(γ) d Xi=1 Xi=1 d d Xi=1 Xi=1 + 2p−1kU ∗V ∗ − Akp p ≤O(γ) ≤O(γ) (2kS(U ∗V ∗ − A)ik2)p + 2p−1kU ∗V ∗ − Akp p kD−1 1 (U ∗V ∗ − A)ikp 2 + 2p−1kU ∗V ∗ − Akp p 1 (U ∗V ∗ − A)kp ≤O(γ)kD−1 p + 2p−1kU ∗V ∗ − Akp ≤O(γ) logp(nd)kU ∗V ∗ − Akp p =O(γ logp(n))kU ∗V ∗ − Akp p. p + 2p−1kU ∗V ∗ − Akp p The first inequality follows by convexity of xp. The sec- ond inequality follows by Lemma 31. The third inequality follows by triangle inequality. The forth inequality follows by V = (SU∗)†SA. The fifth inequality follows by The- orem 14 and Theorem 15. The sixth inequality follows by p ≤ 2. The seventh inequality follows by Theorem 9. Due to Lemma 30, we have kU ∗V ∗ − Akp p ≤O((k log k)1−p/2 log n) min U ∈Rn×k,V ∈Rk×d kU V − Akp p. Thus, we have kARXY SA − Akp p ≤ kU ∗ V − Akp p min X,Y ≤O(min((k log k)2−p/2 logp+1 n, (k log k)2−p log2+p/2 n)) · min U,V kU V − Akp p. Lemma 33 ((Song et al., 2017)). Let A ∈ Rn×d, S ∈ Rt2×n, R ∈ Rd×t3, k, T2 ∈ Rd×t3 be the same as in the Algorithm 3, then with probability at least 0.9, if for α ≥ 1, X, Y satisfy kAR X Y SAT2 − AT2kp X,Y kARXY SAT2 − AT2kp p, p ≤ α min where then β = O(min((k log k)2−p/2 logp+1 n, (k log k)2−p log2+p/2 n)). Proof. Let X ∗, V ∗ = arg min X∈Rt3×k ,V ∈Rk×d kARXV − Akp p. p ≤ αO(log n) min kAR X Y SA − Akp Lemma 34. Let A ∈ Rn×d, S ∈ Rt2×n, R ∈ Rd×t2, k, T1 ∈ Rt2×n, T2 ∈ Rd×t3 be the same as in the X,Y kARXY SA − Akp p. Subspace Embedding and Linear Regression with Orlicz Norm Algorithm 3, then with probability at least 0.9, if for α ≥ 1 t3 Xi=1 kT1(AR X Y SAT2 − AT2)ikp 2 ≤ α min X,Y t3 Xi=1 kT1(ARXY SAT2 − AT2)ikp 2, then kAR X Y SAT2 − AT2kp where β = O(min(k log k logp n, (k log k)1−p/2 log1+p/2 n)). X,Y kARXY SAT2 − AT2kp p, p ≤ αβ min inequality follows by p ≤ 2. The sixth inequality follows by the property of X, Y . The seventh inequality follows by Theorem 14 and Theorem 15. The eighth inequality fol- lows by p ≤ 2. Then the ninth inequality follows by Theo- rem 9. Now let us prove Theorem: Proof. Notice that X, Y = arg min X∈Rt2×k ,Y ∈Rk×t3 kT1ARXY SAT2 − T1AT2k2 F , we have Proof. Let X∗, Y ∗ = arg min X,Y t3 Xi=1 kT1(ARXY SAT2 − AT2)ikp 2. ≤O((k log k)1/p−1/2)(min X,Y kT1(ARXY SAT2 − AT2)ikp 2) 1 p . t3 Xi=1 kT1(AR X Y SAT2 − AT2)ikp 2)1/p ( t3 Xi=1 It means ( t3 Xi=1 kT1(AR X Y SAT2 − AT2)ikp 2) ≤O((k log k)1−p/2)(min X,Y kT1(ARXY SAT2 − AT2)ikp 2). t3 Xi=1 According to Lemma 34, we have kAR X Y SAT2 − AT2kp p ≤ β1 min X,Y kARXY SAT2 − AT2kp p, where β1 = O(min((k log k)2−p/2 logp n, (k log k)2−p log1+p/2 n)). Due to Lemma 33, we have kAR X Y SA − Akp p ≤ O(β1 log n) min Then, according to Lemma 32, we have X,Y kARXY SA − Akp p. kAR X Y SA − Akp p ≤ β2 min U∈Rn×k,V ∈Rk×d kU V − Akp p, where β2 = O(min((k log k)4−p log2p+2 n, (k log k)4−2p log4+p n)). For the running time: SA, T1A can be computed in nnz(A) time. Thus, total running time is nnz(A) + (n + d)poly(k). Let L = AR, N = SAT2, M = AT2. Let γ = min{k log k, (k log k log n)1−p/2}. Let H = X Y and let H∗ = X∗Y ∗. We have kL HN − M kp p ≤2p−1kL HN − LH ∗Nkp p + 2p−1kLH ∗N − M kp p t3 ≤O(γ) ≤O(γ) kT1(L HN − LH ∗N )ikp 2 + 2p−1kLH ∗N − M kp p (kT1(L HN − M )ik2 + kT1(LH ∗N − M )ik2)p ≤O(γ) (kT1(L HN − M )ikp 2 + kD−1 2 (LH ∗N − M )ikp 2) ≤O(γ)( kT1(L HN − M )ikp 2 + kD−1 2 (LH ∗N − M )kp p) t3 Xi=1 Xi=1 t3 Xi=1 t3 Xi=1 t3 Xi=1 t3 Xi=1 + 2p−1kLH ∗N − M kp p + 2p−1kLH ∗N − M kp p + 2p−1kLH ∗N − M kp p + 2p−1kLH ∗N − M kp p + 2p−1kLH ∗N − M kp p ≤O(γ)(α kT1(LH ∗N − M )ikp 2 + kD−1 2 (LH ∗N − M )kp p) ≤O(γ)(α kD−1 2 (LH ∗N − M )ikp 2 + kD−1 3 (LH ∗N − M )kp p) ≤O(γ)αkD−1 2 (LH ∗N − M )kp p + 2p−1kLH ∗N − M kp p ≤O(γ logp(n))αkLH ∗N − M kp p. The first inequality follows by convexity of xp. The sec- ond inequality follows by Lemma 31. The third inequality follows by triangle inequality. The forth inequality follows by convexity of xp, Theorem 14 and Theorem 15. The fifth P. Implementation Setups We implement all the algorithms in MATLAB. We ran ex- periments on a machine with 16G main memory and Intel Core [email protected] CPU. The operating system is Ubuntu 14.04.5 LTS. All the experiments were in single threaded mode. Subspace Embedding and Linear Regression with Orlicz Norm Q. Data Simulation for Comparison with ℓ1 S. Implementation Detail for Low Rank Approximation • For our algorithm, set t1 = 4k, t2 = 8t1, set S ∈ Rt1×n, T1 ∈ Rt2×n to be two random cauchy matri- ces, and set R ∈ Rd×t1, T2 ∈ Rd×t2 to be two em- bedding matrices with exponential random variables (see Theorem 16.) We solve the minimization prob- F , and set lem minX,Y kT1ARXY SAT2 − T1AT2k2 B = ARXY SA. • For algorithm in (Song et al., 2017), we set t1 = 4k, t2 = 8t1. We set S ∈ Rt1×n, T1 ∈ Rt2×n, R ∈ Rd×t1, T2 ∈ Rd×t2 to be four random cauchy matrices. We solve the minimization prob- lem minX,Y kT1ARXY SAT2 − T1AT2k2 F , and set B = ARXY SA. • For PCA, we project A onto the space spanned by top k singular vectors to get B. and ℓ2 Regression We generate a matrix A ∈ Rn×d, x∗ ∈ Rd as following: set each entry of the first d + 5 rows of A as i.i.d. standard random Gaussian variable, each entry of x∗ as i.i.d. stan- dard random Gaussian variable. For n ≥ i ≥ d + 6, we uniformly choose p ∈ [d + 5], and set Ai = Ap, bi = bp. We perform experiments under 3 different noise assump- tions and 2 dimension combinations of N, d and in total 3 × 2 = 6 experiments. The 3 different noise assumptions are, respectively i) N (0, 50) Gaussian noise with on all the entries of Ax∗; ii) sparse noise, where we randomly pick 3% number of entries of Ax∗, and add uniform random noise from [−kAx∗k2,kAx∗k2] on each entry to get b; iii) mixed noise, which is N (0, 5) Gaussian noise plus sparse noise. The 2 different dimension combinations are i) bal- ance, where n = 100 ≈ d = 75; ii) overconstraint, where n = 200 ≫ d = 10. R. Experiments on Approximation Ratio Here is a documentation of our preliminary experiments on calculating the actual approximation ratio for the experi- ment settings mentioned in Section 5.1, Comparison with ℓ1 and ℓ2 regression. The approximation ratio of interest is calculated as follows: kAx′−bkG , where x′ is the output kAx∗−bkG of our novel embedding based algorithm and x∗ is the opti- mal solution. Since k · kG is convex, we can formulate this problem as a convex optimization problem and use a vanilla gradient descent algorithm to calculate the optimal solution. We heuristically stop our gradient descent algorithm when the one step brings less than 10−7 improvement on the loss function and set the learning rate to be 0.001. Admittedly, we have not yet thoroughly and rigidly examined the con- vergence of the vanilla gradient descent algorithm (a direc- tion of future work), and hence such calculation of approx- imation ratio is only a preliminary attempt. Under the mixed noise setting, we varied different scale s of the uniform noise to be 0, 1, 2, 3 and delta to be 0.1, 0.25, 0.5, 0.75. With n = 200, d = 10, for each of these 4 * 4 = 16 settings, we run the algorithm repeat- edly for 50 times, and the worst approximation ratio is 1.06 among these 800 runs. Experimentally, it is far below the theoretical guarantee d log2(n) ≈ 584 ≫ 1.06, and the ap- proximation ratio is robust among different noise settings. For n = 100, d = 75, due to time limit, we only run each of the 16 settings for 5 times, and the worst approximation ratio is 1.31.
1504.04650
2
1504
2015-11-09T16:37:48
A Faster FPTAS for the Unbounded Knapsack Problem
[ "cs.DS" ]
The Unbounded Knapsack Problem (UKP) is a well-known variant of the famous 0-1 Knapsack Problem (0-1 KP). In contrast to 0-1 KP, an arbitrary number of copies of every item can be taken in UKP. Since UKP is NP-hard, fully polynomial time approximation schemes (FPTAS) are of great interest. Such algorithms find a solution arbitrarily close to the optimum $\mathrm{OPT}(I)$, i.e. of value at least $(1-\varepsilon) \mathrm{OPT}(I)$ for $\varepsilon > 0$, and have a running time polynomial in the input length and $\frac{1}{\varepsilon}$. For over thirty years, the best FPTAS was due to Lawler with a running time in $O(n + \frac{1}{\varepsilon^3})$ and a space complexity in $O(n + \frac{1}{\varepsilon^2})$, where $n$ is the number of knapsack items. We present an improved FPTAS with a running time in $O(n + \frac{1}{\varepsilon^2} \log^3 \frac{1}{\varepsilon})$ and a space bound in $O(n + \frac{1}{\varepsilon} \log^2 \frac{1}{\varepsilon})$. This directly improves the running time of the fastest known approximation schemes for Bin Packing and Strip Packing, which have to approximately solve UKP instances as subproblems.
cs.DS
cs
A Faster FPTAS for the Unbounded Knapsack Problem∗ Department of Computer Science, Kiel University, 24098 Kiel, Germany Klaus Jansen Stefan E. J. Kraft {kj,stkr}@informatik.uni-kiel.de 5 1 0 2 v o N 9 ] S D . s c [ 2 v 0 5 6 4 0 . 4 0 5 1 : v i X r a Abstract The Unbounded Knapsack Problem (UKP) is a well-known variant of the famous 0-1 Knapsack Problem (0-1 KP). In contrast to 0-1 KP, an arbitrary number of copies of every item can be taken in UKP. Since UKP is NP-hard, fully polynomial time approximation schemes (FPTAS) are of great interest. Such algorithms find a solution arbitrarily close to the optimum OPT(I), i.e. of value at least (1 − ε)OPT(I) for ε > 0, and have a running time polynomial in the input length and 1 ε. For over thirty years, the best FPTAS was due to Lawler with a running time in O(n + 1 ε2 ), where n is the number of knapsack items. We present an improved FPTAS with a running time in O(n + 1 ε) and a space bound in ε log2 1 O(n + 1 ε). This directly improves the running time of the fastest known approximation schemes for Bin Packing and Strip Packing, which have to approximately solve UKP instances as subproblems. ε3 ) and a space complexity in O(n + 1 ε2 log3 1 Introduction 1 An instance I of the Knapsack Problem (KP) consists of a list of n items a1, . . . , an, n ∈ N, where every item has a profit pj ∈ (0, 1] and a size sj ∈ (0, 1]. Moreover, we have the knapsack size c = 1. In the 0-1 Knapsack Problem (0-1 KP), a subset V ⊂ {a1, . . . , an} has to be chosen such that the total profit of V is maximized and the total size of the items in V is at most c. Mathematically, the j=1 sjxj ≤ c; xj ∈ {0, 1} ∀j}. In this paper, we focus on the unbounded variant (UKP) where an arbitrary number of copies of every item is allowed, i.e. we problem is defined by max{Pn want to determine max{Pn j=1 pjxjPn j=1 pjxjPn j=1 sjxj ≤ c; xj ∈ N ∀j}. 1.1 Known Results The 0-1 Knapsack Problem and other variants of KP are well-known NP-hard problems [5]. They can be optimally solved in pseudo-polynomial time by dynamic programming [1, 18]. Furthermore, fully polynomial time approximation schemes (FPTAS) are known for different variants of KP. An FPTAS is a family of algorithms (Aε)ε>0, where for every ε > 0 the algorithm Aε finds for a given instance I a solution of profit Aε(I) ≥ (1− ε)OPT(I). The value OPT(I) denotes the optimal value for I. FPTAS have a running time polynomial in 1 ε and the input length. ∗Research supported by DFG project JA612/14-2, "Entwicklung und Analyse von effizienten polynomiellen Approximationsschemata für Scheduling- und verwandte Optimierungsprobleme" 1 ε) + 1 ε log( 1 ε2 log( 1 ε} + 1 ε3 log2( 1 ε) · min{n, 1 ε)}). Assuming that n ∈ Ω( 1 The first FPTAS for 0-1 KP was presented by Ibarra and Kim [8] with a running time in ε), n}) and a space complexity in O(n + 1 ε2 · min{ 1 O(n log n + 1 ε2 log( 1 ε3 ). Lawler [21] improved the running time to O( 1 ε4 + log( 1 ε)n). In 1981, Magazine and Oguz [23] presented a method to decrease the space complexity of the dynamic program so that their FPTAS runs in time O(n2 log(n) 1 ε2 ) and ε ). (The paper focuses on the improved space complexity without a partitioning needs space in O( n and reduction of the items as done e.g. by Lawler. Without it, Lawler's basic algorithm has in fact a time and space complexity in O( n2 ε ).) The currently fastest known algorithm is due to Kellerer and Pferschy [16, 17, 18, pp. 166 -- 183] with a space bound in O(n + 1 ε2 ) and a running time in O(n min{log n, log 1 ε), this is in O(n log( 1 ε)). For UKP, Ibarra and Kim [8] presented the first FPTAS by extending their 0-1 KP algorithm. ε) and a space complexity in O(n + 1 Their UKP algorithm has a running time in O(n + 1 ε3 ). Kellerer et al. [18, pp. 232 -- 234] have moreover described an FPTAS with a running time in O(n log(n) + 1 ε2 ). In 1979, Lawler [21] presented his FPTAS with a running time in O(n + 1 ε), this is still the best known FPTAS. The study of KP is not only interesting in itself, it is moreover motivated by column generation for optimization problems like the famous Bin Packing Problem and Strip Packing Problem. In the former problem, a set J of n items of size in (0, 1] has to be packed in as few unit-sized bins as possible. In the latter problem, a set J of n rectangles of width (0, 1] and height (0, 1] has to be packed in a strip of unit width such that the height of the packing is minimized. Many algorithms for optimization problems like Bin Packing have to solve linear programs (LPs), but enumerating all columns of the linear programs would take too much time. One way to avoid this is the consideration of the dual of the LP and to (approximately or exactly) solve a separation problem, e.g. KP, to find violated inequalities of the dual. These inequalities correspond to columns in the primal LP: the columns needed for solving the LP are therefore generated and added dynamically. Examples can be found in [6, 14]. ε4 log 1 ε)) and a space bound in O(n + 1 ε3 ) and a space complexity in O(n + 1 ε2 ). For n ∈ Ω( 1 ε2 (n + log 1 ε log 1 2 for the absolute approximation ratio c. The bound 3 Since Bin Packing and Strip Packing are NP-complete [5], several approximation algorithms have been found for both problems. However, no efficient (i.e. polynomal-time) algorithm A for BP or SP can achieve A(J) ≤ c · OPT(J) for c < 3 2 and all problem instances J unless P = NP [5]: we have c ≥ 3 2 is due to the fact that a polynomial algorithm could otherwise distinguish between the optimum of 2 or 3 for BP instances and therefore solve the NP-complete Partition Problem in polynomial time [5]. Since only such small instances prevent an absolute ratio better than 3 2, larger instances may allow for a better approximation ratio. So-called asymptotic fully polynomial-time approximation schemes (AFPTAS) (Aε)ε>0 are therefore especially interesting. They find for every ε > 0 and instance J a solution of value at most (1 + ε)OPT(J) + f( 1 ε. Roughly speaking, AFPTAS achieve an approximation ratio of c = (1 + ε) for large problem instances. For Bin Packing, the first AFPTAS was presented by Karmarkar and Karp [14] with f( 1 ε) = ε2 ). In 1991, Plotkin et al. [24] described an improved algorithm with a smaller additive term ε) = O( 1 ε)n). The AFPTAS by Shachnai and ε)n) for general ε) and the O( 1 f( 1 ε6 log3( 1 Yehezkely [25] has the same additive term and a running time in O( 1 instances. Currently, the AFPTAS in [10] has the smallest additive term f( 1 fastest running time in O( 1 ε), and have a running time polynomial in the input length and 1 ε)) and running time in O( 1 ε) + log( 1 ε) = O(log2 1 ε) + log( 1 ε6 log6( 1 ε log( 1 ε6 log 1 ε + log( 1 ε)n). 2 The first AFPTAS for Strip Packing was presented by Kenyon and Rémila [19] with f( 1 Bougeret et al. [2] and Sviridenko [26] independently improved the additive term to f( 1 The algorithm in [2] needs time in O( 1 AFPTAS. ε) = O( 1 ε2 ). ε log 1 ε). ε) + n log n), which is the currently fastest known Both algorithms in [2, 10] solve UKP instances for column generation. A faster FPTAS for UKP ε) = O( 1 ε6 log( 1 therefore directly yields faster AFPTAS for Bin Packing and Strip Packing. 1.2 Our Result We have derived an improved FPTAS for UKP that is faster and needs less space than Lawler's algorithm. Theorem 1. There is an FPTAS for UKP with a running time in O(n + 1 complexity in O(n + 1 ε)) and a space ε2 log3( 1 ε log2( 1 ε)). Not only the improved running time, but also the improved space complexity is interesting because "for higher values of 1 ε the space requirement is usually considered to be a more serious bottleneck for practical applications than the running time" [18, p. 168]. Nevertheless, the improved time complexity has direct practical consequences. Let KP(d, ε) be the running time to find a (1 − ε) approximate solution to a UKP instance with d items. The Bin Packing algorithm in [10] has the running time O(KP(d, ¯ε ε2 ) (where ¯ε ∈ Θ(ε) and d ∈ O( 1 Corollary 2. There is an AFPTAS (Aε)ε>0 for Bin Packing that finds for ε ∈ (0, 1 J in Aε(J) ≤ (1 + ε)OPT(J) + O(log2( 1 ε)). By using the new FPTAS for UKP, we get the following result: ε)n) if we assume that KP(d, ¯ε 2] a packing of 6) ∈ Ω( 1 ε + log( 1 ε3 log 1 6) · 1 ε log 1 (cid:18) 1 ε)) bins. Its running time is in ε5 log4 1 (cid:18)1 + log (cid:19) (cid:19) n ε ε . O 6), d ln ln( d Similarly, the Strip Packing algorithm in [2] (see also [9]) has a running time in O(d( 1 ε)} + n log n) where again d ∈ O( 1 ln d) max{KP(d, ¯ε FPTAS yields the following improved AFPTAS: Corollary 3. There is an AFPTAS (Aε)ε>0 for Strip Packing that finds a packing for J of total height Aε(J) ≤ (1 + ε)OPT(J) + O( 1 ε2 + ε) and ¯ε ∈ Θ(ε). The new ε)). Its running time is in ε log 1 (cid:18) 1 ε log( 1 ε5 log4 1 ε O (cid:19) (cid:18)1 (cid:19) ε + log n . The result in this paper was first presented at IWOCA 2015 [12]. The final publication will be available at link.springer.com. For readers acquainted with column generation or linear programs, it should be noted that the LP solved has the form min{cT x Ax ≥ b, x ≥ 0}. It is indeed a fractional covering problem where the columns of A represent configurations: a configuration assigns item slots to one bin (for Bin Packing) or to one shelf of the strip (for Strip Packing) such that the slots fit into the bin or the strip. The primal LP is then approximately solved with a method by Grigoriadis et al. [7] (see also [9]). The columns (i.e. configurations) are generated by solving so-called block problems, which are UKP instances in this case. When the LP has been solved, each item is placed in a slot that has at 3 least the size of the item. As a feasible solution to the LP has been found, there are enough slots for all items. Because of the unboundedness, some configurations may indeed assign more item slots of a certain size to the strip or to one or several bins than there are items in the considered Strip or Bin Packing instance. This does not represent a problem because the supernumerary item slots are simply left empty in the final solution. For comparison, Plotkin et al. [24] solve the LP with a decomposition method where the block problem has additional constraints on the knapsack variables: it is a Bounded Knapsack Problem where a limited number dj ∈ N of copies for every item aj may be taken. 1.3 Techniques Most algorithms for UKP [8, 18, 21] rely on 0-1 KP algorithms. The 0-1 KP algorithms determine a first lower bound P0 for OPT(I). Based on a threshold T depending on P0, the items are partitioned into large(-profit) items with pj ≥ T and small(-profit) items with pj < T. A subset of the large items is taken, which is sufficient for an approximate solution. Its profits are then scaled and the well-known dynamic programming by profits applied to the subset. All combinations of large items (packed by the dynamic program) and small items (which are greedily added) are checked and the best one returned. For UKP, copies of the items in the reduced large item set are taken to transform the UKP instance into a 0-1 KP instance. Our algorithm also first reduces the number of large items. However, we further preprocess the remaining large items by taking advantage of the unboundedness: large items of similar profit [2kT, 2k+1T) are iteratively combined ("glued") together to larger items. Apart from two special cases that can be easily solved, we prove for this new set G a structure property: there are approximate solutions where at most one large item from every interval [2kT, 2k+1T) is used, i.e. only O(log 1 ε) items in total. As a next step, a large item aeff−c that consists of several copies of the most efficient small item aeff is introduced. We prove that there are now approximate solutions to the large items G ∪ {aeff−c} of cardinality O(log 1 4 P0. Instead of exact dynamic programming, we use approximate dynamic programming: the profits in [ 1 4 P0, 2P0] are divided into intervals of equal length. During the execution of the dynamic program, we eliminate dominated solutions and store for each interval at most one solution of smallest size. The combination of approximate dynamic programming with the structure properties yields the considerable improvement in the running time and the space complexity. The algorithm then returns the best combination of large items (packed by the dynamic program) and copies of the small item aeff (added greedily). ε) and that additionally use at least one item of profit at least 1 2 Preliminaries We introduce some useful notation. The profit of an item a is denoted by p(a) and its size by s(a). If a = aj, we also write p(aj) = pj and s(aj) = sj. Let V = {xa : a a ∈ I, xa ∈ N} be a multiset of items, i.e. a subset of items in I with their multiplicities. We naturally define the total profit Let v ≤ c = 1 be a part of the knapsack. The corresponding optimum profit for the volume a∈I s(a)xa ≤ v; a ∈ I; xa ∈ N}. Obviously, xa>0 p(a)xa and the total size s(V ) :=P a∈I p(a)xa P p(V ) :=P v is denoted by OPT (I, v) = max{P OPT(I) = OPT (I, c) holds. xa>0 s(a)xa. 4 We assume throughout the paper that basic arithmetic operations as well as computing the logarithm can be performed in O (1). Finally, we have a remark about the use of "item" and "item copy" when we consider a solution to a UKP instance. Remark 4. Let I, I be two sets of knapsack items with I ⊆ I. In the 0-1 Knapsack Problem, a sentence like "the solution to I uses at most one item in I" is obvious: if the solution uses one item in I, all other items of the solution are in I \ I. Consider now UKP. When we talk about solutions, we would formally have to distinguish between an item a0 ∈ I in the instance and the item copies of a0 that a solution V = {xa : a a ∈ I, xa ∈ N} uses. In this paper, we however use the expressions "item" and "item copy" interchangeably when talking about solutions. As an example, let us consider the sentence "the solution to I uses at most one item in I." It means that the solution contains item copies of items in I, but at most one item copy whose corresponding item is in I. To be more precise, the multiset V uses only one item a ∈ I a0∈I xa0 ≤ 1. Similarly, "the solution V uses at most two items in I" means that there are only two item copies with a multiplicity xa > 0. We have xa ≤ 1, but xa00 = 0 for all other a00 ∈ I, i.e. P whose corresponding item(s) are in I: we haveP The interchangeable use of "item" and "item copy" allows for shorter sentences. Moreover, it is a0∈I xa0 ≤ 2. based upon 0-1 KP where "item" and "item copy" are in fact identical. 1 s(a). Fill the knapsack with as many copies of ameff as possible, i.e. take b p(a) 2.1 A First Approximation We present a simple approximation algorithm for OPT(I). Take the most efficient item ameff := s(ameff)c c=1= arg maxa∈I b s(ameff)c copies of ameff. Then the following holds: s(ameff)c ≥ 1 Theorem 5. We have P0 := p(ameff) · b O (n) and space O (1). Proof. Suppose first that ameff can greedily fill the knapsack completely. Then p(ameff) · b OPT(I). Otherwise, one additional item ameff exceeds the capacity c. Then p(ameff) · b p(ameff) ≥ OPT(I). 2OPT(I), and the theorem follows. Otherwise p(ameff) · b 1 also proves the theorem. s(ameff)c = s(ameff)c + s(ameff)c ≥ OPT(I) − p(ameff) ≥ 2OPT(I), which To determine P0, we only have to check all items (which can be done in O (n)) and to save the 2OPT(I). The value P0 can be found in time 2OPT(I), then p(ameff) · b s(ameff)c ≥ p(ameff) ≥ 1 If p(ameff) ≤ 1 c c c c c c most efficient item (which only needs time in O (1)). (The proof is taken from [18, p. 232, 21]) Assumption 1. From now on, we assume without loss of generality that ε ≤ 1 κ ∈ N. Otherwise, we replace ε by the corresponding log2( 2 ε) = κ holds. Similar to Lawler [21], we introduce the threshold T and a constant K: 1 2κ−1 such that 2κ−1 ≤ ε < 1 1 4 and ε = 1 2κ−1 for 2κ−2 . Note that 1 2κ−1 P0 T := 1 2 εP0 = 1 2 5 (1) and K := 1 4 1 log2( 2 ε) + 1 εT = 1 4 1 κ + 1 1 2κ−1 T = 1 8 1 κ + 1 (cid:19)2 (cid:18) 1 2κ−1 P0 . (2) We will see later that these values are indeed the right choice for the algorithm. (A derivation of these values is presented in [20, Subsection 5.8.1].) 3 Reducing the Items We first partition the items into large(-profit) and small(-profit) items, and only keep the most efficient small item: IL := {a ∈ I p(a) ≥ T} , IS := I \ IL, and aeff := arg max (cid:26) p(a) s(a) (cid:27) (cid:12)(cid:12)(cid:12) p(a) < T . Theorem 6. The sets IL, IS and the item aeff can be found in time O (n) and space O (n). This is also the space needed to save IL. Proof. Obvious. Similar to Lawler, we now reduce the item set IL. Note that we have OPT(I) ≤ 2P0 according to Theorem 5, and one item cannot have a profit larger than OPT(I) ≤ 2P0. Hence, the large item profits are in the interval [T, 2P0]. We partition this interval into Note that L(κ) =h2κT, 2κ+1T (cid:17) = L(k) := [2kT, 2k+1T) for k ∈ {0, . . . , κ + 1} . (cid:19) 1 2κ−1 P0, 2κ+1 1 2 1 2κ−1 P0 (cid:20) 2κ 1 2 = [P0, 2P0) . For convenience, we directly set L(κ+1) := {2P0}. We further split the L(k) into disjoint sub-intervals, each of length 2kK: :=h2kT + γ · 2kK, 2kT + (γ + 1)2kK (cid:17) for γ ∈n0, . . . , 2κ+1(κ + 1) − 1o L(k) γ Note that indeed L(k) =S (k) γ holds because γ L (3) . (4) 2kT + (γ + 1)2kKγ=2κ+1(κ+1)−1 = 2kT + 2κ+1(κ + 1)2kK (2)= 2kT + 2κ+1(κ + 1)2k 1 4 = 2kT + 2kT = 2k+1T . 1 κ + 1 1 2κ−1 T Similar to above, we set L (κ+1) 0 := {2P0}. The idea is to keep only the smallest item a for every profit interval L items are sufficient to determine an approximate solution. (k) γ . We will see that these 6 Definition 7. For an item a with p(a) ≥ T, let k(a) ∈ N be the interval such that p(a) ∈ L(k(a)) and γ(a) ∈ N be the sub-interval such that p(a) ∈ L be the smallest item for the profit interval L (k) . Let a γ (k(a)) γ(a) (k) γ , i.e. := arg minn a(k) γ s(a) a ∈ IL and p(a) ∈ L(k) γ o for all k and γ . Algorithm 1 shows the algorithm to determine the a IL,red :=[ [ (k) γ . They form the reduced set of large items γ } . {a(k) As in [21], we now prove that IL,red is sufficient for an approximation. k γ Algorithm 1: The algorithm to determine the a (k) γ . for k = 0, . . . , κ do for γ = 0, . . . , 2κ+1(κ + 1) − 1 do := ∅; (k) γ a := ∅; (κ+1) a 0 for a ∈ IL do Determine (k(a), γ(a)); (k(a)) if s(a γ(a) ) > s(a) or a (k(a)) S a γ(a) Output: IL,red :=S := a; γ{a k γ } (k) γ(a) = ∅ then (k(a)) Lemma 8. Let 0 ≤ v ≤ c = 1. Then and OPT ({aeff}, c − v) ≥ OPT (IS, c − v) − T OPT (IL,red, v) ≥ 1 − ε 4 ! 1 log2( 2 ε) + 1 OPT (IL, v) . Proof. For the first inequality, there are two possibilities: either copies of aeff can be taken such that the entire capacity c − v is used. Then obviously OPT ({aeff}, c − v) = OPT (IS, c − v) holds. Otherwise, we have similar to the proof of Theorem 5 that OPT({aeff}, c − v) + p(aeff) = s(aeff)c · p(aeff) + p(aeff) ≥ OPT (IS, c − v). Thus, OPT({aeff}, c − v) ≥ OPT(IS, c − v) − p(aeff) ≥ b c−v For the second inequality, take an optimal solution (xa)a∈I such that OPT (IL, v) =P OPT(IS, c − v) − T. The first inequality follows. p(a)xa. in IL,red. Obviously, the solution stays feasible, Replace now every item a by its counterpart a a∈IL (k(a)) γ(a) 7 i.e. the volume v will not be exceeded, because an item may only be replaced by a smaller one. This (cid:19) 1 κ + 1 1 2κ−1 (5) (cid:19) 1 2κ−1 · p(a)xa solution has the total profitP p(a (k(a)) γ(a) ) ≥ p(a)≥2k(a)T≥ by the definition of the L p(a a∈IL p(a) − 2k(a)K 1 (cid:18)1 p(a) − 1 κ + 1 (k(a)) γ(a) )xa. Moreover, we have (cid:18) (2)= p(a) − 1 (cid:19) 4 p(a) = p(a) · (cid:18) 1 2κ−1 κ + 1 4 1 2κ−1 2k(a)T 1 − 1 4 (k) γ . We get OPT (IL,red, v) ≥ X p(a (cid:18) a∈IL 1 − 1 4 1 − ε 4 = = (5)≥ X (cid:19) ! (k(a)) γ(a) )xa 1 1 2κ−1 κ + 1 1 log2( 2 ε) + 1 1 − 1 4 1 κ + 1 a∈IL OPT (IL, v) OPT (IL, v) . (The reasoning is partially taken directly from or close to the one by Lawler in [21].) Theorem 9. The set IL,red has O( 1 ε) items. Algorithm 1 needs time in O(n + 1 space in O( 1 ε) for the construction and for saving IL,red. ε log2 1 ε log2 1 ε log2 1 ε) and ε ·( 1 ε log2 1 (k) (κ+1) γ , including the item a 0 ε)) = O( 1 ε log 1 (k) γ . Finally, the running time is obviously bounded by O(n + 1 , is bounded by O((κ + 1)· (2κ+1(κ + 1)− Proof. The number of items a 1+1)) = O(log 1 ε). The space needed is asymptotically bounded by the space required to save the a ε): the values k(a) and γ(a) can be found in O(1) because we assume that the logarithm can be determined in O (1). Remark 10. If there is one item a with the profit p(a) = 2P0, i.e. whose profit attains the upper bound, one optimum solution obviously consists of this single item. During the partition of I into IL and IS, it can easily be checked whether such an item is contained in I. Since the algorithm can directly stop if this is the case, we will from now on assume without loss of generality that such an item does not exist and that a ε log2 1 = ∅. (κ+1) 0 4 A Simplified Solution Structure In this section, we will transform IL,red into a new instance G whose optimum OPT(G, v) is only slightly smaller than OPT(IL,red, v) and where the corresponding solution has a special structure. This new transformation will allow us later to faster construct the approximate solution. First, we define (cid:12)(cid:12) p(a) ∈ L(k)o =n a ∈ IL,red (cid:12)(cid:12) p(a) ∈h2kT, 2k+1T (cid:17)o . I(k) :=n a ∈ IL,red Note that the items are already partitioned into the I(k) because of the way IL,red has been constructed. 8 Definition 11. Let a1, a2 be two knapsack items with s(a1) + s(a2) ≤ c. The gluing operation ⊕ combines them into a new item a1⊕ a2 with p(a1⊕ a2) = p(a1)+ p(a2) and s(a1⊕ a2) = s(a1)+ s(a2). Thus, the gluing operation is only defined on pairs of items whose combined size does not exceed c. The basic idea for the new instance G is as follows: we first set G(0) := I(0). Then, we construct a1 ⊕ a2 for all a1, a2 ∈ G(0) (which also includes the case a1 = a2), which yields the item set H(1) := {a1 ⊕ a2 a1, a2 ∈ G(0)}. Note that p(a1 ⊕ a2) ∈ [2T, 4T) = L(1). For every profit γ , we keep only the item of smallest size in I(1) ∪ H(1), which yields the item set G(1). (1) interval L This procedure is iterated for k = 1, . . . , κ − 1: the set G(k) contains the items with a profit in [2kT, 2k+1T) = L(k) (see Fig. 1(a)). Gluing like above yields the item set H(k+1) with profits in [2k+1T, 2k+2T) = L(k+1) (see Fig. 1(b)). By taking again the smallest item in H(k+1) ∪ I(k+1) for (k) (k+1) , the set G(k+1) is derived (see Fig. 1(c)). The item in G(k) with a profit in L every L is γ γ (k) denoted by a γ We finish when G(κ) has been constructed. We are in the case where I(κ+1) = ∅, i.e. a (κ+1) 0 = ∅, and it is explained at the beginning of Section 5 that it is not necessary to construct G(κ+1) from (κ+1) the items in G(κ). Hence, we also have a 0 Note that we may glue items together that already consist of glued items. For backtracking, we (k) γ has already been an γ which two items in G(k−1) have formed it or whether a (k) save for every a item in I(k). Algorithm 2 presents one way to construct the sets G(k). for every k and γ. = ∅. (k) Remark 12. One item a γ (k) size of a γ combinations because an arbitrary number of item copies can be taken in UKP. is in fact the combination of several items in IL,red. The profit and represent feasible item is equal to the total profit and size of these items. The a (k) γ The item set G := κ[ G(k) k=0 has for every 0 ≤ v ≤ c a solution near the original optimum OPT (IL,red, v) as shown below in Theorem 14. It is additionally proved that at most one item of every G(k) for k ∈ {0, . . . , κ − 1} is needed. First, we introduce a definition for the proof. Definition 13. Let I0 be a set of knapsack items with p(a) ≥ T for every a ∈ I0. For a knapsack volume v ≤ c and k0 ∈ {0, . . . , κ}, a solution is structured for k = k0 if it fits into v and uses for every k ∈ {0, . . . , k0} at most one item copy with a profit in L(k). We denote by OPT≤k0 (I0, v) the corresponding optimum profit. For instance, the solution for (cid:16) OPT≤k0 G(0) ∪ . . . ∪ G(k0) ∪ G(k0+1) ∪ I(k0+2) ∪ . . . ∪ I(κ), v (cid:17) fits into the volume v, and it uses only one item from every G(k) for k ∈ {0, . . . , k0}. It may however use an arbitrary number of item copies e.g. in G(k0+1) or I(k0+2). 9 (a) The items in G(k) and I(k+1). The height of every item a corresponds to its size s(a) while its position on the axis (k) γ = [2kT +γ2kK, 2kT +(γ+1)2kK). corresponds to its profit p(a). The axis is partitioned into the profit sub-intervals L (b) The set I(k+1) together with the newly constructed items in H(k+1) (c) The new set G(k+1) after keeping only the smallest item with a profit in L because it is the smallest item in its profit sub-interval L (k+1) γ . (k+1) γ . For instance, a4 ⊕ a4 is kept Figure 1: Principle of deriving G(k+1) from G(k) and I(k+1) 10 2kT+γ·2kK2kT2k+1TG(k)2k+1T+γ·2k+1K2k+1T2k+2Ta0a3s(a3)a4a0a1a3a4I(k+1)2k+1T+γ·2k+1K2k+1T2k+2Ta0a0a0⊕a0a3⊕a1a0a4⊕a3a3a3⊕a3a4⊕a4a4⊕a42k+1T+γ·2k+1K2k+1T2k+2TG(k+1)a0a1a0a4⊕a3a4a4⊕ Algorithm 2: The construction of the item sets G(k). for k = 0, . . . , κ do for γ = 0, . . . , 2κ+1(κ + 1) − 1 do := a (k) (k) a γ ; γ Backtrack(a (k) γ ) := a (k) γ ; G(0) := I(0); for k = 0, . . . , κ − 1 do for γ0 = γ, . . . , 2κ+1(κ + 1) − 1 do for γ = 0, . . . , 2κ+1(κ + 1) − 1 do γ0 ) ≤ c then (k) (k) γ ) + s(a γ ⊕ a (k) (k) a := a γ0 ; (k+1) if s(a) < s(a γ(a) ) or a if s(a γ(a) = ∅ then (k+1) (k+1) a := a; γ(a) Backtrack(a (k+1) γ(a) ) := (a (k) γ , a (k) γ0 ); (k+1) 0 , . . . , a (k+1) 2κ+1(κ+1)−1 G(k+1) :=na k0+1[ OPT≤k0 o;  ≥ Theorem 14. For v ≤ c and k0 ∈ {0, . . . , κ − 1}, we have κ[ G(k) ∪ I(k), v k=0 k=k0+2 1 − ε 4 1 log2( 2 ε) + 1 !k0+1 OPT (IL,red, v) . Proof. The proof idea is quite simple: we iteratively replace the items in I(k0+1) by their counterpart in G(k0+1) and also replace every pair of item copies in G(k0) by the counterpart in G(k0+1). This directly follows the way to construct the item sets G(k) presented in Algorithm 2. Formally, the statement is proved by induction over k0. Let k0 = 0. Take an optimum solution to G(0) ∪ I(1) ∪ . . . ∪ I(κ) = I(0) ∪ I(1) ∪ . . . ∪ I(κ) = IL,red. For ease of notation, we directly write each item as often as it appears in the solution. We have three sub-sequences: • Let ¯a1, . . . , ¯aη (η ∈ N) be the items from G(0) = I(0) in the optimal solution for OPT(IL,red, v). We assume that η is odd (the case where η is even is easier and handled below.) • Let ¯aη+1, . . . , ¯aη+ξ (ξ ∈ N) be the items from I(1) in the optimal solution for OPT(IL,red, v). λ (λ ∈ N) be the remaining items from I(2) ∪ . . . ∪ I(κ) in the optimal solution for • Let ¯a0 OPT(IL,red, v). This set is denoted by Λ. As defined above, the total profit of these items is written as p(Λ). 1, . . . , ¯a0 Figure 2(a) illustrates the packing. (Figure 2 shows the case for general k.) We have G(0) ∪ I(1) ∪ . . . ∪ I(κ), v p(¯ai) + p(¯aj) + p(Λ) . (6) OPT(cid:16) η+ξX j=η+1 (cid:17) = ηX i=1 11 (1) γ(¯a2i−1⊕¯a2i) =: a ρ(i) in G(1) (for i ∈ {1, . . . ,b η (1) In the first step, every pair of items ¯a2i−1 and ¯a2i from G(0) for i ∈ {1, . . . ,b η 2c} is replaced by ¯a2i−1 ⊕ ¯a2i ∈ H(1) (see Fig. 2(b)). In the second step, every item ¯a2i−1 ⊕ ¯a2i is again replaced 2c}). Only item ¯aη by the corresponding item a (1) remains unchanged. Moreover, ¯aj from I(1) is replaced by the corresponding a ρ(j) for j ∈ {η + 1, . . . , η + ξ} (see Fig. 2(c)). Note that this new solution is indeed feasible because the (1) γ are at most as large as the original ones. Moreover, the corresponding items replacing items a (1) (1) ρ(j) must exist by the construction of G(1). Thus, we have a (feasible) solution that a ρ(i) and a consists of the item ¯aη ∈ G(0), the items a 1, . . . , ¯a0 in I(2), . . . , I(κ): this solution respects the structure of OPT≤k0(·, v) for k0 = 0. (If η is even, no item in G(0) is used.) ρ(j) in G(1), and the remaining items ¯a0 (1) Let now ¯a be an item ¯a2i−1 ⊕ ¯a2i or ¯aj. It can be proved as for Inequality (5) that (1) γ(¯aj) =: a (1) ρ(i) and a λ 1 − ε 4 p(a γ(¯a)) ≥ (1) ! 1 log2( 2 ε) + 1 2 cX b η i=1 p(¯a2i−1 ⊕ ¯a2i) p(¯a) . (7) η+ξX j=η+1 p(a (1) ρ(i)) + p(a (1) ρ(j)) + p(Λ) Thus, we have OPT≤0 + i=1 (cid:16) (7)≥ p(¯aη) + 1 − ε 4 (cid:17) ≥ p(¯aη) + G(0) ∪ G(1) ∪ I(2) ∪ . . . ∪ I(κ), v ! b η 2 cX 1 1 − ε ! η+ξX log2( 2 4 ε) + 1 1 ! ηX log2( 2 ε) + 1 ! OPT(cid:16) ! p(¯aj) + p(Λ) p(¯ai) + η+ξX 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 − ε 4 1 − ε 4 1 − ε 4 OPT (IL,red, v) . ≥ (6)= = j=η+1 i=1 j=η+1 p(¯aj) + p(Λ) G(0) ∪ I(1) ∪ . . . ∪ I(κ), v  (cid:17) The statement for k0 = 1, . . . , κ − 1 now follows by induction. The proof is almost identical to the case k0 = 0 above, the only difference is that there are additionally the items in G(0), . . . , G(k0−1) that remain unchanged like the items I(k0+2), . . . , I(κ). Only the items in G(k0) and I(k0) are replaced. Lemma 15. OPT(G ∪ {aeff}) ≤ OPT(IL,red ∪ IS) ≤ OPT(IL ∪ IS) = OPT(I) ≤ 2P0 holds. Proof. G consists of items in IL,red or of items that can be obtained by gluing several items in IL,red together. Every combination of items in G can therefore be represented by items in IL,red. Moreover, we have aeff ∈ IS. The first inequality follows. Since IL,red ⊆ IL, the second inequality is obvious. The last inequality follows from Theorem 5. 12 (a) The current solution to G(0) ∪ ··· ∪ G(k) ∪ I(k+1) ∪ ··· ∪ I(κ). The structure of OPT≤k−1(·, v) is respected, i.e. at most one item from ev- ery G(0), . . . , G(k−1) is used. (b) The items in G(k) are pair- wise glued to- gether with the possible excep- tion of one item. (c) The items in H(k+1) ∪ I(k+1) are replaced by their counterparts in G(k+1). Now, at most one item in G(k) is part of the solution, and the structure for OPT≤k(·, v) is respected. Figure 2: The principle of the proof for Theorem 14 13 a4a4a4a3a0a1a4G(k)I(k+1)G(0),...,G(k−1)I(k+2),...,I(κ)a4a4a4⊕a3a0⊕a1a4G(k)H(k+1)I(k+1)a4a4a4⊕a1a1a4a4⊕G(k)G(k+1)G(0),...,G(k−1)I(k+2),...,I(κ) Up to now, we have (only) reduced the original item set I to G ∪ {aeff}. = ∅. Consider the optimum structured (κ+1) Lemma 16. Assume as mentioned in Remark 10 that a 0 solutions to G ∪ {aeff} for k0 = κ − 1 (see Definition 13). This means that at most one item is used from every G(k) for k ∈ {0, . . . , κ − 1}. (The item aeff has a profit p(aeff) < T such that it does not have to satisfy any structural conditions.) Then there are two possible cases: G∪{aeff} is 2P0, and the solution consists of two item copies of the item a • One solution uses (at least) two items in G(κ). This is the case if and only if the optimum for (κ) 0 ) = P0. • Every solution uses at most one item in G(κ). Then, OPT≤κ−1(G, v0) = OPT≤κ(G, v0) holds (κ) 0 with p(a for all values 0 ≤ v0 ≤ c, and there is a value 0 ≤ v ≤ c such that OPT≤κ (G, v) + OPT ({aeff} , c − v) = OPT≤κ−1 (G, v) + OPT ({aeff} , c − v) 1 − ε 4 ≥ 1 log2( 2 ε) + 1 !κ+1 OPT(I) − T . Moreover, OPT≤κ(G, v) uses at least one item in G(κ−2) ∪ G(κ−1) ∪ G(κ), and/or we have OPT ({aeff} , c − v) ≥ 1 4 P0. can be used, and we have p(a Proof. Note that IL,red does not contain any item with the profit 2P0 (see Remark 10). By construction, this is still the case for G. Suppose now that one solution to G ∪ {aeff} uses more than one item in G(κ). Since items in G(κ) have profits in [P0, 2P0), only two copies of the item (κ) (κ) a 0 ) = P0. In fact, 2P0 is the maximum possible profit because 0 OPT(G∪{aeff}) ≤ OPT(I) ≤ 2P0 holds as we have seen in Lemma 15. Thus, the "only if" direction has been proved. The "if"-direction is obvious. Suppose now that every structured solution to G ∪ {aeff} for k0 = κ − 1 uses at most one item in G(κ). Thus, OPT≤κ−1(G, v0) = OPT≤κ(G, v0) holds for all 0 ≤ v0 ≤ c. Let v ≤ c now be the volume the large items IL occupy in an optimum solution to I. Then obviously OPT(I) = OPT (IL, v) + OPT (IS, c − v) holds. We have the following inequality: OPT≤κ (G, v) + OPT ({aeff} , c − v) = OPT≤κ−1 (G, v) + OPT ({aeff} , c − v) 1 − ε 4 1 − ε 4 1 − ε 4 1 − ε 4 Thm. 14≥ Lem. 8≥ ≥ = 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 !κ OPT (IL,red, v) + OPT ({aeff} , c − v) !κ+1 !κ+1 !κ+1 OPT (IL, v) + OPT (IS, c − v) − T (OPT (IL, v) + OPT (IS, c − v)) − T OPT(I) − T . For the final property, suppose that no item in G(κ−2) ∪ G(κ−1) ∪ G(κ) is used in a solution for OPT≤κ(G, v). Then we have OPT≤κ (G, v) ≤ κ−3X maxn p(a) a ∈ G(k)o ≤ κ−3X k=0 2 · 2kT < 2κ−1T (1)= 1 2 P0 . k=0 14 (8) On the other hand, Inequality (8) together with (1 − δ)k ≥ (1 − k · δ) for δ < 1 yields ! 1 − ε (cid:19) log2( 2 4 ε) + 1 OPT(I) − 1 κ + 1 1 − ε 4 2 εOPT(I) OPT(I) − T (cid:19) OPT≤κ (G, v) + OPT ({aeff} , c − v) ≥ (cid:18) 2 εP0 ≥ (cid:18) (1)= 1 − ε 4 ε≤1/4≥ 3 4OPT(I) ≥ 3 OPT(I) − 1 4 P0 . Hence, OPT({aeff} , c − v) ≥ 1 Definition 17. Take d P0/4 aeff−c. 4 P0 holds. The final property of the second case follows. p(aeff)e items aeff. If their total size is at most c, they are glued together to Obviously, aeff−c consists of the smallest number of items aeff whose total profit is at least P0 4 . Moreover, aeff−c is a large item. Definition 18. Take a knapsack volume v ≤ c. Consider the following solutions to G ∪ {aeff−c} of size at most v: • They are structured for k = κ, i.e. they use for every k ∈ {0, . . . , κ} at most one item in G(k). • They additionally use the item aeff−c at most once and at least one item a ∈ G(κ−2) ∪ G(κ−1) ∪ G(κ) ∪ {aeff−c}. 4 P0. These special solutions are The optimal profit for such solutions of total size at most v is denoted by OPTSt(G∪{aeff−c}, v). Hence, these solutions have a profit of at least p(a) ≥ 2κ−2T = 1 called structured solutions with a lower bound (on the profit). If v is too small such that such a solution does not exist, we set OPTSt(G ∪ {aeff−c}, v) = 0. Theorem 19. In the second case of Lemma 16, there is a value 0 ≤ v ≤ c such that 1 − ε 4 1 log2( 2 ε) + 1 !κ+1 OPTSt (G ∪ {aeff−c} , v) + OPT ({aeff} , c − v) ≥ OPT(I) − T . Proof. Like in the proof of Lemma 16, let v0 be the volume the large items IL occupy in an optimum solution to I so that OPT(IL, v0) + OPT(IS, c − v0) = OPT(I). Consider an optimum solution for OPT≤κ(G, v0) and suppose that it does not use any item in G(κ−2) ∪ G(κ−1) ∪ G(κ). Lemma 16 states that OPT({aeff}, c − v0) has a profit of at least 1 4 P0. Thus, a subset of the item copies of aeff can be replaced by aeff−c, and c − v0 ≥ s(aeff−c). We set v := v0 + s(aeff−c). Note that OPTSt(G ∪ {aeff−c}, v) ≥ OPT≤κ(G, v0) + p(aeff−c). Moreover, OPT≤κ(G, v0) = OPT≤κ−1(G, v0) 15 holds because we are in the second case of Lemma 16. We get the following inequalities: OPTSt (G ∪ {aeff−c} , v) + OPT ({aeff} , c − v) ≥ OPT≤κ = OPT≤κ−1(cid:0)G, v0(cid:1) + OPT(cid:0){aeff} , c − v0(cid:1) (cid:0)G, v0(cid:1) + p(aeff−c) + OPT(cid:0){aeff} , c − v0 − s(aeff−c)(cid:1) !κ OPT(cid:0)IL,red, v0(cid:1) + OPT(cid:0){aeff} , c − v0(cid:1) !κ+1 OPT(cid:0)IL, v0(cid:1) + OPT(cid:0)IS, c − v0(cid:1) − T !κ+1(cid:0)OPT(cid:0)IL, v0(cid:1) + OPT(cid:0)IS, c − v0(cid:1)(cid:1) − T !κ+1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 OPT(I) − T . 1 − ε 4 1 − ε 4 1 − ε 4 1 − ε 4 Thm. 14≥ Lem. 8≥ ≥ = Note that OPT({aeff}, c − v) is well-defined -- and therefore the entire chain of inequalities feasible -- because c − v = c − v0 − s(aeff−c) ≥ 0. Suppose now that the optimal solution uses at least one item in G(κ−2) ∪ G(κ−1) ∪ G(κ). We can then directly set v := v0, and the proof is similar to the first case above. Roughly speaking, a solution in the first case of this proof satisfies the lower bound of the theorem and uses at most one item in every G(k), but no item in G(κ−2), G(κ−1) or G(κ). This implies that enough items aeff are part of the solution such that a subset of them can be replaced by aeff−c. So far, we have not constructed an actual solution. We have only shown in Theorem 19 that there is a solution to G ∪ {aeff−c} ∪ {aeff} that is close to OPT(I) and that is a structured solution with a lower bound. Theorem 20. The cardinality of G(k) is in O( 1 constructs G in time O( 1 ε)) and space O( 1 and the backtracking information. The item aeff−c can be constructed in time O (1). Proof. The statement for aeff−c is trivial: the number of items aeff−c to glue together can be determined by division. ε) items. Algorithm 2 ε), which also includes the space to store G ε), i.e. G has O( 1 ε log 1 ε log2 1 ε2 log3( 1 The number of items in G(k) and G can be derived like the number of items in IL,red in Theorem 9. The running time of Algorithm 2 is obviously dominated by the second for-loop. It is in ε log2 1 (cid:18) κ ·(cid:16)2κ+1(κ + 1)(cid:17)2(cid:19) O = O log (cid:18)1 (cid:19) ε (cid:18)1 ε · log 1 ε (cid:19)2! (cid:18) 1 ε2 log3(cid:18)1 ε (cid:19)(cid:19) . = O (k) The space complexity is dominated by the space to save the a γ which is again asymptotically equal to the number of items in G. and the backtracking information, 16 5 Finding an Approximate Structured Solution by Dynamic Pro- gramming The previous section has presented three cases: 1. The instance I has one item of profit 2P0: return this item for an optimum solution, and OPT(I) = 2P0 (see Remark 10). 2. If this is not the case, and G has one item of profit P0 and size at most c 2, two copies of this item are an optimum solution to G ∪ {aeff} (see Lemma 16). Undoing the gluing returns an optimum solution with OPT(I) = 2P0. 3. Otherwise, there is an approximate structured solution to G ∪ {aeff−c} ∪ {aeff} with a lower bound (see Theorem 19). The first two cases can be easily checked, which is the reason why it has not been necessary to construct the set G(κ+1). We will from now on assume that we are in the third case: a solution uses at most one item from every G(k) for k ∈ {0, . . . , κ} as well as aeff−c at most once. At the same time, at least one item a ∈ G(κ−2) ∪ G(κ−1) ∪ G(κ) ∪ {aeff−c} is chosen. (See Definition 18.) We use dynamic programming to find for all 0 ≤ v ≤ c the corresponding set of large items V ⊆ G ∪ {aeff−c} with s(V ) ≤ v. For convenience, let G(κ+1) := {aeff−c}. We introduce tuples (p, s, k) similar to Lawler [21]. For profit p with 0 ≤ p ≤ 2P0 and size 0 ≤ s ≤ c, the tuple (p, s, k) states that there is an item set of size s whose total profit is p. Moreover, the set has only items in G(k) ∪ ··· ∪ G(κ+1) and respects the structure above. The dynamic program is quite simple: start with the dummy tuple set F (κ+2) := {(0, 0, κ + 2)}. For k = κ + 1, . . . , κ − 2, the tuples in F (k) are recursively constructed by F (k) :=n(p, s, k) (p, s, k + 1) ∈ F (k+1)o ∪n(p + p(a), s + s(a), k) (p, s, k + 1) ∈ F (k+1), a ∈ G(k), s + s(a) ≤ c o . Note that (0, 0, k + 1) ∈ F (k+1), which guarantees that F (k) also contains the tuples (p(a), s(a), k) for a ∈ G(k) if k ∈ {κ + 1, . . . , κ − 2}. For k ∈ {κ − 3, . . . , 0}, this tuple (0, 0, k + 1) is no longer considered to form the new tuples, which guarantees that tuples of the form (p + p(a), s + s(a), k) for a ∈ G(k) have p, s 6= 0. The recursion becomes ∪n(p + p(a), s + s(a), k) (p, s, k + 1) ∈ F (k+1) \ {(0, 0, k + 1)} , a ∈ G(k), s + s(a) ≤ c o . F (k) :=n(p, s, k) (p, s, k + 1) ∈ F (k+1)o The actual item set corresponding to (p, s, k) can be reconstructed by saving backtracking information. Definition 21. A tuple (p2, s2, k) is dominated by (p1, s1, k) if p2 ≤ p1 and s2 ≥ s1. As in [21], dominated tuples (p, s, k + 1) are now removed from F (k+1) before F (k) is constructed. This does not affect the outcome: dominated tuples only stand for sets of items with a profit not larger and a size not smaller than non-dominated tuples. A non-dominated tuple (p, s, k) is therefore optimal, i.e. the profit p can only be obtained with items of size at least s if items in G(k), . . . , G(κ+1) are considered. 17 Lemma 22. A tuple (p, s, k) ∈ F (k) stands for a structured solution with a lower bound (see Definition 18). Therefore, we have p ≥ 2κ−2T if p > 0. For every v ≤ c, there is a tuple (p, s, 0) ∈ F (0) with p = OPTSt(G ∪ {aeff−c}, v) and s ≤ v. Proof. This lemma directly follows from the dynamic program: tuples use at most one item from every G(k). For k ∈ {κ−2, . . . , κ+1}, a tuple with p > 0 represents an item set that uses at least one item in G(k), . . . , G(κ+1), and such an item has a profit of at least 2κ−2T. Tuples for k ≤ κ − 3 with p > 0 are only derived from tuples that use at least one item in G(κ−2), . . . , G(κ+1). If dominated tuples are not removed, the dynamic program obviously constructs tuples for all possible structured solutions with a lower bound, especially the optimum combinations for every 0 ≤ v ≤ c. Removing dominated tuples does not affect the tuples that stand for the optimum item combinations so that the second property still holds. While the dynamic program above constructs the desired tuples, their number may increase dramatically until F (0) is obtained. We therefore use approximate dynamic programming for the tuples with profits in [ 1 4 P0, 2P0]. This method is inspired by the dynamic programming used in [15] (see also [18, pp. 97 -- 112]). Definition 18 and Lemma 22 state that a tuple (p, s, k) with p > 0 satisfies p ≥ 2κ−2T. 4 P0, 2P0] = Apart from (0, 0, k), all tuples have therefore profits in the interval [2κ−2T, 2P0] (1)= [ 1 [2κ−2T, . . . , 2κ+1T]. We partition this interval into sub-intervals of length 2κ−2K. We get [2κ−2T, 2P0] = h2κ−2T + ξ · 2κ−2K, 2κ−2T + (ξ + 1)2κ−2K (cid:17) ∪ {2P0} ξ0[ ξ0[ ξ=0 ξ=0 =: (κ−2) L ξ ∪ L (κ−2) ξ0+1 (κ−2) ξ (κ−2) ξ for ξ0 := 7(κ + 1)2κ+1 − 1. (A short calculation shows that 2κ−2T + (ξ0 + 1)2κ−2K = 2P0.) The approximate dynamic program keeps for every ξ ∈ {0, . . . , ξ0 + 1} only the tuple (p, s, k) with p ∈ L that has the smallest size s. The dominated tuples are removed when all tuples for k have been constructed. The modified dynamic program is presented in Algorithm 3 and shown in Figure 3. The sets of these non-dominated tuples are denoted by D(k). For convenience, (p(ξ), s(ξ), k) ∈ D(k) denotes the smallest tuple with a profit in L . We again save the backtracking information during the execution of the algorithm. Lemma 23. Let D(k) be the set D(k) from Algorithm 3 before the dominated tuples are removed. A tuple (p, s, k) ∈ D(k) for k = κ + 1, . . . , 0 stands for a structured solution with a lower bound. Therefore, we have p ≥ 2κ−2T if p > 0. This is also true for (p, s, k) ∈ D(k). Proof. The proof is almost identical to the one of Lemma 22. In fact, the proof is not influenced by keeping only the tuple of smallest size in every profit interval L Theorem 24. Let k ∈ {0, . . . , κ + 1}. For every (non-dominated) tuple (¯p, ¯s, k) ∈ F (k), there is a tuple (p, s, k) ∈ D(k) such that 1 − ε 4 !κ−k+1 s ≤ ¯s . (κ−2) ξ . ¯p and p ≥ 1 log2( 2 ε) + 1 18 Algorithm 3: The approximate dynamic programming D(κ+2) := {(0, 0, κ + 2)}; Backtrack(0, 0, κ + 2) := ∅; for k = κ + 1, . . . , 0 do D(k) := ∅; for (p(ξ), s(ξ), k + 1) ∈ D(k+1) do D(k) := D(k) ∪ {(p(ξ), s(ξ), k)}; Backtrack(p(ξ), s(ξ), k) := Backtrack(p(ξ), s(ξ), k + 1); for a ∈ G(k) do for (p, s, k + 1) ∈ D(k+1) \ {(0, 0, k + 1)} do (p0, s0, k) := (p + p(a), s + s(a), k); (κ−2) Determine ξ0 for (p0, s0, k) such that p0 ∈ L ξ0 if s0 < s(ξ0) or (p(ξ0), s(ξ0), k) = ∅ then // Construction of new tuples ; // Only new tuples of smaller size are kept D(k) := D(k) \ {(p(ξ0), s(ξ0), k)}; (p(ξ0), s(ξ0), k) := (p0, s0, k); Backtrack(p(ξ0), s(ξ0), k) := ((p, s, k + 1), a); D(k) := D(k) ∪ {(p(ξ0), s(ξ0), k)}; if k ≥ κ − 2 then // Construction of (possible) tuples (p(a), s(a), k) for k ≥ κ − 2 (κ−2) Determine ξ0 for p(a) such that p(a) ∈ L ξ0 if s(a) < s(ξ0) or (p(ξ0), s(ξ0), k) = ∅ then ; D(k) := D(k) \ {(p(ξ0), s(ξ0), k)}; (p(ξ0), s(ξ0), k) := (p(a), s(a), k); Backtrack(p(ξ0), s(ξ0), k) := (a); D(k) := D(k) ∪ {(p(ξ0), s(ξ0), k)}; Remove dominated tuples from D(k); 19 (a) The tuples in D(k+1) (b) The new tuples are constructed with the items in G(k). (c) Only the tuple of smallest size is kept for every (κ−2) L ξ , which yields D(k),. . . (d) . . . and removing the dominated tuples yields D(k). Figure 3: The principle of the approximate dynamic programming 20 sp2κ−2K(p(ξ),s(ξ),k+1)(p(ξ+1),s(ξ+1),k+1)sp+s(a)+p(a)(p(ξ)+p(a),s(ξ)+s(a))sps2p2s1p1<2κ−2K≥sps2p2(p,s)=(p(ξ0),s(ξ0),k)sp>< Proof. This statement is trivial for (¯p, ¯s, k) = (0, 0, k) because (0, 0, k) ∈ D(k) (this tuple is never removed in the construction of F (k) and D(k)). Suppose now that (¯p, ¯s, k) 6= (0, 0, k). The theorem is proved by induction for k = κ + 1, . . . , 0. The statement is evident for k = κ + 1. If aeff−c exists (i.e. enough copies of aeff can be glued together without exceeding the capacity c), then we have F (κ+1) = D(κ+1) = {(0, 0, κ + 1), (p(aeff−c), s(aeff−c), κ + 1)} . If aeff−c does not exist, then we have F (κ+1) = D(κ+1) = {(0, 0, κ + 1)}. Suppose that the statement is true for k + 1, . . . , κ + 1. As defined in Lemma 23, D(k) is the set D(k) before the dominated tuples are removed. Let (¯p, ¯s, k) ∈ F (k). There are two cases. In the first case, we have (¯p, ¯s, k +1) ∈ F (k+1). By the induction hypothesis, there is a tuple (p1, s1, k + 1) ∈ D(k+1) such that the inequalities p1 ≥ ¯p(1 − ε ε )+1)κ−(k+1)+1 4 and s1 ≤ ¯s hold (see Fig. 4(a)). Note that this implies (p1, s1, k + 1) 6= (0, 0, k + 1) and therefore p1 ≥ 2κ−2T by Lemma 23. Let ξ1 be the index such that p1 ∈ L . During the execution of Algorithm 3, (p1, s1, k + 1) yields the tuple (p1, s1, k), which may only be replaced in D(k) by a tuple . Thus, there must be a tuple (p2, s2, k) ∈ D(k) of a smaller size, but with a profit still in L with s2 ≤ s1 and p2 ∈ L (see Fig. 4(b)). Let now (p, s, k) ∈ D(k) be the tuple that dominates (p2, s2, k) (which can of course be (p2, s2, k) itself), i.e. p ≥ p2 and s ≤ s2 (see Fig. 4(c)). For the profit, we have (κ−2) ξ1 (κ−2) ξ1 (κ−2) ξ1 1 log2( 2 p ≥ p2 ≥ p1 − 2κ−2K 1 − ε 4 p16=0= p1 · ! 1 log2( 2 ε) + 1 (1),(2)= p1 · 1 − 2κ−2K p1 1 − ε 4 ≥ ¯p · ! Lem. 23≥ p1 · 1 − 2κ−2K !κ−k+1 2κ−2T ! 1 log2( 2 ε) + 1 . The lower bound on the profit is therefore true for (p, s, k). We have s ≤ s2 ≤ s1 ≤ ¯s for the bound on the size (see also Fig. 4(c)). Consider now the second case where (¯p, ¯s, k) ∈ F (k), but (¯p, ¯s, k + 1) /∈ F (k+1). Therefore, (¯p, ¯s, k) is a new (non-dominated) tuple with (¯p, ¯s, k) = (p + p(a), s + s(a), k) for the right item a ∈ G(k) and tuple (p, s, k + 1) ∈ F (k+1). By the induction hypothesis, there must be a tuple (p1, s1, k + 1) ∈ D(k+1) such that p1 ≥ p(1 − ε ε )+1)κ−(k+1)+1 and s1 ≤ s (see Fig. 5(a)). Thus, 4 !κ−(k+1)+1 the following inequality holds: !κ−(k+1)+1 1 log2( 2 ≥ (p(a) + p) · 1 − ε 4 1 log2( 2 ε) + 1 p1 + p(a) ≥ p(a) + p · 1 − ε 4 = ¯p · 1 − ε 4 1 log2( 2 ε) + 1 1 !κ−(k+1)+1 log2( 2 ε) + 1 . There are two possibilities: either k ≥ κ− 2, i.e. p(a) ≥ 2κ−2T holds, and p1 + p(a) ≥ 2κ−2T directly follows. Otherwise, we have k ≤ κ − 3. Then, the identity (¯p, ¯s, k) = (p + p(a), s + s(a), k) 6= (0, 0, k) implies that (p, s, k + 1) 6= (0, 0, k + 1) holds because the tuple (0, 0, k + 1) is not used to form any new tuple in D(k) and therefore in D(k). This again implies that p1 6= 0 and therefore p1 + p(a) ≥ p1 ≥ 2κ−2T as seen in Lemma 23. 21 (a) Since (¯p, ¯s, k + 1) ∈ F (k+1), there must be a corre- sponding tuple (p1, s1, k + 1) ∈ D(k+1) by the induc- tion hypothesis whose profit can be bounded from below. (b) By construction, there must be a tuple (p2, s2, k) ∈ D(k) with a profit in the same interval L as (p1, s1, k). This makes it possible to bound p2 from below. (κ−2) ξ1 (c) There may be a tuple (p, s, k) ∈ D(k) that domi- nates (p2, s2, k). Since p ≥ p2, the bound still holds. Figure 4: The first case of the proof for Theorem 24: we have (¯p, ¯s, k) ∈ F (k) and also (¯p, ¯s, k + 1) ∈ F (k+1). We set Q := (1 − ε 4 1 log2( 2 ε )+1). 22 sp(¯p,¯s,k+1)=(¯p,¯s,k)¯p¯s(p1,s1,k+1)=(p1,s1,k)p1s1≤p1≥(1−Q)κ−(k+1)+1¯psp(¯p,¯s,k)¯p¯s(p1,s1,k)s1(p2,s2,k)p2s2≤≤L(κ−2)ξ1p2≥(1−Q)κ−k+1¯psp(¯p,¯s,k)¯s¯p(p1,s1,k)s1(p2,s2,k)s2(p,s,k)sp≤≤≤p≥p2≥(1−Q)κ−k+1¯p (κ−2) ξ1 Thus, there is an index ξ1 such that p1 +p(a) ∈ L . Similar to above, the tuple (p1 +p(a), s1 + s(a), k) is formed during the construction of D(k) (see Fig. 5(b)). It may only be replaced by a tuple of smaller size. Hence, there must be (p2, s2, k) ∈ D(k) with p2 ∈ L . Let (p, s, k) ∈ D(k) be the tuple that dominates (p2, s2, k) (see Fig. 5(c)). We get 1 − 2κ−2K p1 + p(a) 1 1 − ε log2( 2 4 ε) + 1 p1+p(a)6=0= ! (1),(2)= (p1 + p(a)) · !κ−k+1 (p1 + p(a)) · p1+p(a)≥2κ−2T (κ−2) ξ1 ! ! p p2 ≥ p1 + p(a) − 2κ−2K 1 − 2κ−2K (p1 + p(a)) · 2κ−2T 1 1 − ε log2( 2 4 ε) + 1 ¯p · ≥ ≥ ≥ . We have similar to above s ≤ s2 ≤ s1 + s(a) ≤ s + s(a) = ¯s for the bound on the size (see also Fig. 5(c)). Remark 25. As can be seen, the proof of Theorem 24 is only possible because it is guaranteed that p1 or p1 + p(a) is at least 2κ−2T. In fact, this is achieved by the construction of the glued item set G with its structured solution (Theorem 14). Hence, we can prove Lemma 16, and with the introduction of aeff−c, we have the structure property of Definition 18 with a corresponding solution (Theorem 19). This shows that p1 ≥ 2κ−2T or p1 + p(a) ≥ 2κ−2T (see also Lemma 22 and 23). Without the structure, a dynamic program like Algorithm 3 would also have to generate tuples (p, s, k) with p < 2κ−2T for k ≤ κ − 3. Hence, we would need for the same approximation ratio with a smaller length than 2κ−2K, and we would have to save more profit sub-intervals like L tuples. Both would increase the asymptotic running time and space complexity as can be seen in the proof of Theorem 27. Corollary 26. For every v ≤ c, there is a tuple (p, s, 0) ∈ D(0) such that s ≤ v and (κ−2) ξ 1 − ε 4 p ≥ 1 log2( 2 ε) + 1 !κ+1 OPTSt (G ∪ {aeff−c} , v) . ε log2 1 ε). Proof. Lemma 22 states that there is a tuple (¯p, ¯s, 0) ∈ F (0) with ¯p = OPTSt(G ∪ {aeff−c} , v) and ¯s ≤ v. Theorem 24 implies that there is a tuple (p, s, 0) ∈ D(0) with the desired property. ε2 log3 1 Theorem 27. Algorithm 3 constructs all tuple sets D(k) for k = κ + 1, . . . , 0 in time O( 1 ε). The space needed for the algorithm and to save the D(k) as well as the backtracking information is in O( 1 Proof. Let us first bound the space complexity. The profit interval [ 1 4 P0, 2P0] is partitioned into O(ξ0) intervals L . The set D(k) saves at most one tuple with the corresponding backtracking information for every L or the information that a tuple does not exist. Thus, the space needed for all D(k) and the corresponding backtracking data is in O(κ · ξ0) = O(κ · (κ2κ)) = ε)· (log( 1 O(log( 1 ε) 1 ε). All other information of the algorithm is only temporarily saved and needs O (1). ε)) = O( 1 ε log2 1 (κ−2) ξ (κ−2) ξ 23 (a) Since (¯p, ¯s, k +1) /∈ F (k+1), there must be an item a such that (¯p, ¯s, k) = (p+p(a), s+s(a), k) for a tuple (p, s, k + 1) ∈ F (k+1). By the induction hypothesis, there must be a tuple (p1, s1, k + 1) ∈ D(k+1) whose profit can be bounded from below. (b) The tuple (p1 + p(a), s1 + s(a), k) is constructed during the execution of the dynamic program. (c) As in the first case, there must be a tuple (p, s, k) ∈ D(k) whose profit can be bounded as desired. Here, (p2, s2, k) is not dominated, i.e. (p, s, k) = (p2, s2, k). Figure 5: The second case of the proof for Theorem 24: we have (¯p, ¯s, k) ∈ F (k), but (¯p, ¯s, k + 1) /∈ F (k+1). We set Q := (1 − ε 4 1 log2( 2 ε )+1). 24 sp(¯p,¯s,k)=(p+p(a),s+s(a),k)(p,s,k+1)+s(a)+p(a)p(p1,s1,k+1)p1s1s≤p1≥(1−Q)κ−(k+1)+1psp(¯p,¯s,k)=(p+p(a),s+s(a),k)s+s(a)(p1,s1,k+1)+s(a)+p(a)(p1+p(a),s1+s(a),k)s1+s(a)≤L(κ−2)ξ1s(¯p,¯s,k)=(p+p(a),s+s(a),k)s+s(a)s1+s(a)≤(p2,s2,k)=(p,s,k)s≤s2≤¯ppp≥p2≥(1−Q)κ−k+1¯pL(κ−2)ξ1 The loops dominate the running time. Apart from removing the dominated tuples, they need in total (cid:16) κ ·(cid:16) ξ0 + ξ0 · G(k) + G(k)(cid:17)(cid:17) Thm. 20= O O (cid:18)1 (cid:19) ε (cid:18) (cid:18)1 (cid:19)(cid:18)1 (cid:18) 1 (cid:19) log ε2 log3 1 ε ε ε log . (cid:18)1 (cid:19)(cid:19)(cid:19) · 1 ε log ε = O As stated in [21] and [11, Lemma 5], non-dominated tuples (p, s, k) can be removed in linear time in the number of tuples if the tuples are different and sorted by profit. This is the case because every tuple in D(k) is stored in an array sorted according to the corresponding ξ. The total time to remove the dominated tuples from all D(k) is therefore in O(κ · ξ0) = O( 1 ε), which is dominated by the overall running time. ε log2 1 6 The Algorithm We can now put together the entire approximation algorithm. Algorithm 4: The complete algorithm Input: Item set I Output: Profit P, solution set J Determine P0 and define T, K; Partition the items into IL and IS and find aeff; if Item a with p(a) = 2P0 found during the partitioning then return 2P0, {a}; Reduce IL to IL,red with Algorithm 1; Construct G with Algorithm 2 and the item aeff−c; if p(a 0 ) ≤ c (κ) (κ) 0 ) = P0 and s(a 2 then (κ) Recursively undo the gluing of a 0 two copies of every item in J0; return 2P0, J ; to get the item set J0. Let J be the set consisting of Construct with Algorithm 3 the tuple sets D(κ+1), . . . , D(0); Find (p, s, 0) ∈ D(0) such that P := p + OPT ({aeff}, c − s) = max(p0,s0,0)∈D(0) p0 + OPT ({aeff}, c − s0); Backtrack the tuple (p, s, 0) to find the corresponding structured solution with a lower bound J0 ⊂ G ∪ {aeff−c}; Recursively undo the gluing of all a ∈ J0 and add these items to the solution set J; Add the items of OPT({aeff}, c − s) to J; return P, J ; Theorem 28. Algorithm 4 finds a solution of value at least (1 − ε)OPT(I). Proof. The algorithm returns a feasible solution: (p, s, 0) represents an item set of size s. If items a ∈ G derived from gluing are part of the solution, their ungluing does not change the total size nor the total profit (see Remark 12). 25 We prove the solution quality. First, the algorithm considers the two special cases listed at the beginning of Section 5. Each of them returns a solution of profit 2P0 so that OPT(I) = 2P0 (see Theorem 5 and Lemma 15). If the special cases do not yield a solution, we are in the third case. Let v be the volume from Theorem 19. Corollary 26 guarantees the existence of one (p, s, 0) ∈ D(0) with s ≤ v such that 1 − ε 4 p ≥ 1 log2( 2 ε) + 1 !κ+1 OPTSt (G ∪ {aeff−c} , v) . Moreover, we have OPT({aeff}, c− s) ≥ OPT({aeff}, c− v) because c− s ≥ c− v. Thus, the following inequality holds for this (p, s, 0): p + OPT ({aeff}, c − s) ≥ ≥ Thm. 19≥ ≥ (1)≥ 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 1 log2( 2 ε) + 1 !κ+1 1 − ε !κ+1 4 1 − ε !2κ+2 4 1 − ε !2κ+2 4 1 − ε ! 4 1 − ε ε) + 1(cid:17) 4 · 2 ·(cid:16)log2( 2 1 − ε 4 ε) + 1 log2( 2 2κ + 2 ≥ log2( 2 = (1 − ε) OPT(I) . ε) + 1 OPTSt (G ∪ {aeff−c} , v) + OPT ({aeff}, c − v) (OPTSt (G ∪ {aeff−c} , v) + OPT ({aeff}, c − v)) !κ+1 T 1 − ε 4 1 log2( 2 ε) + 1 OPT(I) − OPT(I) − T OPT(I) − 1 2 εP0  OPT(I) − 1 2 εOPT(I) 1 log2( 2 Taking the maximum over all (p, s, 0) ∈ D(0) therefore yields the desired solution. Note that we have used (1 − δ)k ≥ (1 − k · δ) for δ < 1. Remark 29. The total bound on the approximation ratio is mainly due to the exponent 2κ + 2, i.e. that we make the multiplicative error of (1 − ε ε )+1) only 2κ + 2 times. Such an error occurs 4 when I is replaced by IL,red at the beginning (Lemma 8), in each of the κ iterations in which G is constructed (Theorem 14), and in κ + 1 of the κ + 2 iterations of the dynamic program (Theorem 24 and Corollary 26). The error of the dynamic program can be bounded because the structured solution with a lower bound has at least one item of profit at least 2κ−2T (see the second property of Definition 18 and Remark 25). Theorem 30. The algorithm has a running time in O(n + 1 ε log2 1 1 ε). Proof. Determining P0, constructing IL and IS as well as finding aeff can all be done in time and space O (n) as stated in Theorems 5 and 6. The definition of T and K in time and space O (1) is ε) and needs space in O(n + ε2 log3 1 26 obvious. It is also clear that an item p(a) = 2P0 can directly be found during the construction of IL such that the first if-condition does not influence the asymptotic running time. 9). Algorithm 1 returns the set IL,red in time O(n + 1 ε) (see Theorem ε) as explained The second if-condition can be checked in O (1). The running time for undoing the gluing will in Theorem 20, which clearly dominates the construction of aeff−c in O (1). Algorithm 2 constructs the G(k) and G in time O( 1 ε) and space O( 1 ε) and space O( 1 ε log2 1 ε2 log3 1 ε log2 1 ε log2 1 ε log2 1 ε2 log3 1 ε) and space O( 1 ε) items in G ∪ {aeff−c}, which bounds the storage space needed. be determined at the end of the proof. Algorithm 3 constructs the sets D(k) in time O( 1 ε) (see Theorem 27). For one tuple (p0, s0, 0), the corresponding OPT ({aeff}, c − s0) can be found in O (1) by computing b c−s0 s(aeff)c· p(aeff). Thus, finding the best tuple (p, s, 0) can be done in O(D(0)) = O(ξ0) = O( 1 ε log 1 ε). Since only the currently best tuple (p, s, 0) has to be saved, the space needed is in O (1). The backtracking for the tuple (p, s, 0) needs time in O(κ) = O(log 1 ε): the backtracking information Backtrack(p0, s0, k) for k = 0, . . . , κ + 1 states whether the tuple was formed by adding an item a ∈ G(k) and with which tuple (p00, s00, k + 1) to continue. Hence, the item set J0 also has at most O(log 1 To conclude, the time and space for the ungluing still have to be bounded. Consider one item a ∈ G. The backtracking information Backtrack(a) returns two items (¯a1, ¯a2) (with ¯a1, ¯a2 ∈ IL,red ∪ G) on which the backtracking can be recursively applied. The recursive ungluing of the items can be represented as a binary tree where the root is the original item a and the (two) children of each node are the items (¯a0, ¯a00) returned by the backtracking information. The leaves of the tree are the original items in IL,red. This binary tree obviously has a height in O(κ) because the children (¯a0, ¯a00) for one ¯a ∈ G(k) are in G(k−1) ∪ IL,red. A binary tree of height O(κ) = O(log 1 ε) has at most O( 1 ε) nodes. The backtracking or ungluing of a can therefore be done in time and space O( 1 ε), which also includes saving the items ¯a ∈ IL,red of which a is composed. Since J0 has O(log 1 ε) items, the ε log 1 original items IL,red of the approximate solution can be found in time and space O( 1 ε). This (κ) should the body of the second if-condition be also dominates the time to undo the gluing of a 0 executed. Similar to above, the number of items aeff for OPT ({aeff}, c − s) can be found in O (1). To sum up, Algorithm 4 has the stated running time and space complexity. 7 Concluding Remarks The most important steps in this algorithm are the creation of the item set G by gluing and the introduction of aeff−c. This guarantees the existence of an approximate structured solution with a lower bound (see Definition 18). Therefore, the approximate dynamic program has to store less tuples (p, s, k) than in the case without the structure. We [20] have extended our algorithm to the Unbounded Knapsack Profit with Inversely Propor- tional Profits (UKPIP) introduced in [11]. Here, several knapsack sizes 0 < c1 < . . . < cM = 1 are given, and the profit of an item counts as pj/cl if packed in cl. The goal is to find the best knapsack size and corresponding solution of maximum profit. UKPIP is used for column generation in our AFPTAS for Variable-Sized Bin Packing [10] where several bin sizes are given and the goal is to minimize the total volume of the bins used. The faster FPTAS for UKPIP yields a faster AFPTAS for Variable-Sized Bin Packing [20]. 27 There are interesting open questions. As stated in Subsection 1.2, the space complexity is a more serious bottleneck than the running time. Recently, Lokshtanov and Nederlof [22] showed that the 0-1 Knapsack Problem and the Subset Sum Problem have a pseudo-polynomial time and only polynomial space algorithm. Subset Sum is a special case of the Knapsack Problem where the profit of an item is equal to its size, i.e. pj = sj. Moreover, it was shown that Unary Subset Sum is in Logspace [3, 13]. Gál et al. [4] described an FPTAS for Subset Sum whose space complexity is in O( 1 ε), i.e. which does not depend on the actual input size, and whose running time is in O( 1 ε)). Can any of these results be further extended to improve the space complexity of an UKP FPTAS? Finally, it is open whether the ideas presented in this paper can be extended to the normal 0-1 KP or other KP variants as well as used for column generation of other optimization problems. The currently fastest known algorithm for 0-1 KP is due to Kellerer and Pferschy [16 -- 18]. We mention in closing that by using the same approach similar improved approximation algorithms can be expected for various Packing and Scheduling Problems, e.g. for Bin Covering, Bin Packing with Cardinality Constraints, Scheduling Multiprocessor Tasks and Resource-constrained Scheduling. ε n(n + log n + log 1 References [1] R. E. Bellman. Dynamic Programming. Princeton University Press, 1957. [2] M. Bougeret, P.-F. Dutot, K. Jansen, C. Robenek, and D. Trystram. "Approximation Algo- rithms for Multiple Strip Packing and Scheduling Parallel Jobs in Platforms". In: Discrete Mathematics, Algorithms and Applications 3.4 (2011), pp. 553 -- 586. [3] M. Elberfeld, A. Jakoby, and T. Tantau. Logspace Versions of the Theorems of Bodlaender and Courcelle. Tech. rep. 62. Electronic Colloquium on Computational Complexity (ECCC), 2010. First published in: Proceedings of the 51th Annual Symposium on Foundations of Computer Science (FOCS 2010). IEEE Computer Society, 2010, pp. 143 -- 152. [4] A. Gál, J. Jang, N. Limaye, M. Mahajan, and K. Sreenivasaiah. Space-Efficient Approximations for Subset Sum. Tech. rep. 180. Electronic Colloquium on Computational Complexity (ECCC), 2014. [5] M. R. Garey and D. S. Johnson. Computers and Intractability. A Guide to the Theory of NP-Completeness. W. H. Freeman and Company, 1979. [6] P. C. Gilmore and R. E. Gomory. "A Linear Programming Approach to the Cutting-Stock Problem". In: Operations Research 9.6 (1961), pp. 849 -- 859. [7] M. D. Grigoriadis, L. G. Khachiyan, L. Porkolab, and J. Villavicencio. "Approximate Max-Min Resource Sharing for Structured Concave Optimization". In: SIAM Journal on Optimization 11.4 (2001), pp. 1081 -- 1091. [8] O. H. Ibarra and C. E. Kim. "Fast Approximation Algorithms for the Knapsack and Sum of Subset Problems". In: Journal of the ACM 22.4 (1975), pp. 463 -- 468. [9] K. Jansen. "Approximation Algorithms for Min-Max and Max-Min Resource Sharing Problems, and Applications". In: Efficient approximation and online algorithms. Vol. 3484. LNCS. Springer, 2006, pp. 156 -- 202. 28 [10] K. Jansen and S. Kraft. "An Improved Approximation Scheme for Variable-Sized Bin Packing". In: Proceedings of the 37th International Symposium on Mathematical Foundations of Computer Science, MFCS 2012. Vol. 7464. LNCS. Springer, 2012, pp. 529 -- 541. [11] K. Jansen and S. Kraft. "An Improved Knapsack Solver for Column Generation". In: Proceed- ings of the 8th International Computer Science Symposium in Russia, CSR 2013. Vol. 7913. LNCS. Springer, 2013, pp. 12 -- 23. [12] K. Jansen and S. E. J. Kraft. "A Faster FPTAS for the Unbounded Knapsack Problem". In: Proceedings of the 26th International Workshop on Combinatorial Algorithms, IWOCA 2015. LNCS. Springer, 2015/2016. In press. [13] D. M. Kane. Unary Subset-Sum is in Logspace. 2010. arXiv:1012.1336. [14] N. Karmarkar and R. M. Karp. "An Efficient Approximation Scheme for the One-Dimensional Bin-Packing Problem". In: Proceedings of the 23rd Annual Symposium on Foundations of Computer Science (FOCS 1982). IEEE Computer Society, 1982, pp. 312 -- 320. [15] H. Kellerer, R. Mansini, U. Pferschy, and M. G. Speranza. "An efficient fully polynomial approximation scheme for the Subset-Sum Problem". In: Journal of Computer and System Sciences 66.2 (2003), pp. 349 -- 370. [16] H. Kellerer and U. Pferschy. "A New Fully Polynomial Time Approximation Scheme for the Knapsack Problem". In: Journal of Combinatorial Optimization 3.1 (1999), pp. 59 -- 71. [17] H. Kellerer and U. Pferschy. "Improved Dynamic Programming in Connection with an FTPAS for the Knapsack Problem". In: Journal of Combinatorial Optimization 8.1 (2004), pp. 5 -- 11. [18] H. Kellerer, U. Pferschy, and D. Pisinger. Knapsack Problems. Springer, 2004. [19] C. Kenyon and E. Rémila. "A Near-Optimal Solution to a Two-Dimensional Cutting Stock Problem". In: Mathematics of Operations Research 25.4 (2000), pp. 645 -- 656. First published as "Approximate Strip Packing". In: Proceedings of the 37th Annual Symposium on Foundations of Computer Science (FOCS 1996). IEEE Computer Society, 1996, pp. 31 -- 36. [20] S. E. J. Kraft. "Improved Approximation Algorithms for Packing and Scheduling Problems". PhD thesis. Christian-Albrechts-Universität zu Kiel, 2015. Forthcoming. [21] E. L. Lawler. "Fast Approximation Algorithms for Knapsack Problems". In: Mathematics of Operations Research 4.4 (1979), pp. 339 -- 356. [22] D. Lokshtanov and J. Nederlof. "Saving space by algebraization". In: Proceedings of the 42nd ACM Symposium on Theory of Computing, STOC 2010. ACM, 2010, pp. 321 -- 330. [23] M. J. Magazine and O. Oguz. "A fully polynomial approximation algorithm for the 0-1 knapsack problem". In: European Journal of Operational Research 8.3 (Nov. 1981), pp. 270 -- 273. [24] S. A. Plotkin, D. B. Shmoys, and É. Tardos. "Fast Approximation Algorithms for Fractional Packing and Covering Problems". In: Mathematics of Operations Research 20.2 (1995), pp. 257 -- 301. First published in: Proceedings of the 32nd Annual Symposium on Foundations of Computer Science (FOCS 1991). IEEE Computer Society, 1991, pp. 495 -- 504. 29 [25] H. Shachnai and O. Yehezkely. "Fast Asymptotic FPTAS for Packing Fragmentable Items with Costs". In: Proceedings of the 16th International Symposium on Fundamentals of Computation Theory, FCT 2007. Vol. 4639. LNCS. Springer, 2007, pp. 482 -- 493. [26] M. Sviridenko. "A note on the Kenyon-Remila strip-packing algorithm". In: Information Processing Letters 112.1 -- 2 (2012), pp. 10 -- 12. This bibliography contains information from the DBLP database (www.dblp.org), which is made available under the ODC Attribution License. 30
1711.04506
1
1711
2017-11-13T10:37:36
Constraint Solving via Fractional Edge Covers
[ "cs.DS" ]
Many important combinatorial problems can be modeled as constraint satisfaction problems. Hence identifying polynomial-time solvable classes of constraint satisfaction problems has received a lot of attention. In this paper, we are interested in structural properties that can make the problem tractable. So far, the largest structural class that is known to be polynomial-time solvable is the class of bounded hypertree width instances introduced by Gottlob et al. Here we identify a new class of polynomial-time solvable instances: those having bounded fractional edge cover number. Combining hypertree width and fractional edge cover number, we then introduce the notion of fractional hypertree width. We prove that constraint satisfaction problems with bounded fractional hypertree width can be solved in polynomial time (provided that a the tree decomposition is given in the input). Together with a recent approximation algorithm for finding such decompositions by Marx, it follows that bounded fractional hypertree width is now the most general known structural property that guarantees polynomial-time solvability.
cs.DS
cs
Constraint Solving via Fractional Edge Covers1 Martin Grohe, RWTH Aachen University, Lehrstuhl fur Informatik 7, Aachen, Germany, [email protected] D´aniel Marx, Computer and Automation Research Institute, Hungarian Academy of Sciences (MTA SZTAKI), Budapest, Hungary, [email protected]. 2 0 Many important combinatorial problems can be modeled as constraint satisfaction problems. Hence iden- tifying polynomial-time solvable classes of constraint satisfaction problems has received a lot of attention. In this paper, we are interested in structural properties that can make the problem tractable. So far, the largest structural class that is known to be polynomial-time solvable is the class of bounded hypertree width instances introduced by Gottlob et al. [2002]. Here we identify a new class of polynomial-time solvable in- stances: those having bounded fractional edge cover number. Combining hypertree width and fractional edge cover number, we then introduce the notion of fractional hypertree width. We prove that constraint satisfaction problems with bounded fractional hypertree width can be solved in polynomial time (provided that a the tree decomposition is given in the input). Together with a recent approximation algorithm for finding such decompositions [Marx 2010a], it follows that bounded fractional hypertree width is now the most general known structural property that guarantees polynomial- time solvability. Categories and Subject Descriptors: F.2 [Theory of Computing]: Analysis of Algorithms and Problem Complexity; G.2.2 [Mathematics of Computing]: Discrete Mathematics-Graph Theory General Terms: Algorithms Additional Key Words and Phrases: constraint satisfaction, hypergraphs, hypertree width, fractional edge covers 1. INTRODUCTION Constraint satisfaction problems form a large class of combinatorial problems that contains many important "real-world" problems. An instance of a constraint satisfaction problem consists of a set V of variables, a domain D, and a set C of constraints. For example, the domain may be {0, 1}, and the constraints may be the clauses of a 3-CNF-formula. The objective is to assign values in D to the variables in such a way that all constraints are satisfied. In general, constraint satisfaction problems are NP-hard; considerable efforts, both practical and theoretical, have been made to identify tractable classes of constraint satisfaction problems. On the theoretical side, there are two main directions towards identifying polynomial- time solvable classes of constraint satisfaction problems. One is to restrict the constraint language, that is, the type of constraints that are allowed (see, for example, [Bulatov 2006; Bulatov 2011; Bulatov et al. 2001; Feder and Vardi 1998; Jeavons et al. 1997; Schaefer 1978]). Formally, the constraint language can be described as a set of relations on the domain. The other direction is to restrict the structure induced by the constraints on the variables (see, for example, [Cohen et al. 2008; Dalmau et al. 2002; Dechter and Pearl 1989; Freuder 1990; Kolaitis and Vardi 1998; Grohe et al. 2001; Grohe 2007]). The present work goes into this direction; our main contribution is the identification of a natural new class of structurally tractable constraint satisfaction problems. The hypergraph of an instance (V, D, C) has V as its vertex set and for every constraint in C a hyperedge that consists of all variables occurring in the constraint. For a class H of 1An extended abstract of the paper appeared in the Proceedings of the seventeenth annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2006). 2Research supported by the European Research Council (ERC) grant "PARAMTIGHT: Parameterized complexity and the search for tight complexity results," reference 280152. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:2 M. Grohe, D. Marx hypergraphs, we let Csp(H) be the class of all instances whose hypergraph is contained in H. The central question is for which classes H of hypergraphs the problem Csp(H) is tractable. Most recently, this question has been studied in [Chen and Dalmau 2005; Cohen et al. 2008; Marx 2011; Marx 2010b; Gottlob et al. 2005]. It is worth pointing out that the corresponding question for the graphs (instead of hypergraphs) of instances, in which two variables are incident if they appear together in a constraint, has been completely answered in [Grohe 2007; Grohe et al. 2001] (under the complexity theoretic assumption FPT (cid:54)= W[1]): For a class G of graphs, the corresponding problem Csp(G) is in polynomial time if and only if G has bounded tree width. This can be generalized to Csp(H) for classes H of hypergraphs of bounded hyperedge size (that is, classes H for which max{e ∃ H = (V, E) ∈ H : e ∈ E} exists). It follows easily from the results of [Grohe 2007; Grohe et al. 2001] that for all classes H of bounded hyperedge size, Csp(H) ∈ PTIME ⇐⇒ H has bounded tree width (1) (under the assumption FPT (cid:54)= W[1]). It is known that (1) does not generalize to arbitrary classes H of hypergraphs (we will give a very simple counterexample in Section 2). The largest known family of classes of hypergraphs for which Csp(H) is in PTIME consists of all classes of bounded hypertree width [Gottlob et al. 2002; Gottlob et al. 2003; Gottlob et al. 2000]. Hypertree width is a hypergraph invariant that generalizes acyclicity [Berge 1976; Fagin 1983; Yannakakis 1981]. It is a very robust invariant; up to a constant factor it coincides with a number of other natural invariants that measure the global connectivity of a hypergraph [Adler et al. 2007]. On classes of bounded hyperedge size, bounded hypertree width coincides with bounded tree width, but in general it does not. It has been asked in [Chen and Dalmau 2005; Cohen et al. 2008; Gottlob et al. 2005; Grohe 2007] whether there are classes H of unbounded hypertree width such that Csp(H) ∈ PTIME. We give an affirmative answer to this question. Our key result states that Csp(H) ∈ PTIME for all classes H of bounded fractional edge cover number. A fractional edge cover of a hypergraph H = (V, E) is a mapping e∈E x(e) is the weight of x. The fractional edge cover number ρ∗(H) of H is the minimum of the weights of all fractional edge covers of H. It follows from standard linear programming results that this minimum exists and is rational. Furthermore, it is easy to construct classes H of hypergraphs that have bounded fractional edge cover number and unbounded hypertree width (see Example 4.2). e∈E,v∈e x(e) ≥ 1 for all v ∈ V . The number(cid:80) x : E → [0,∞) such that(cid:80) We then start a more systematic investigation of the interaction between fractional covers and hypertree width. We propose a new hypergraph invariant, the fractional hypertree width, which generalizes both the hypertree width and fractional edge cover number in a natural way. Fractional hypertree width is an interesting hybrid of the "continuous" fractional edge cover number and the "discrete" hypertree width. We show that it has properties that are similar to the nice properties of hypertree width. In particular, we give an approximative game characterization of fractional hypertree width similar to the characterization of tree width by the "cops and robber" game [Seymour and Thomas 1993]. Furthermore, we prove that for classes H of bounded fractional hypertree width, the problem Csp(H) can be solved in polynomial time provided that a fractional hypertree decomposition of the underlying hypergraph is given together with the input instance. We do not know if for every fixed k there is a polynomial-time algorithm for finding a fractional hypertree decomposition of width k. However, a recent result [Marx 2010a] shows that we can find an approximate decomposition whose width is bounded by a (cubic) function of the fractional hypertree width. This is sufficient to show that Csp(H) is polynomial-time solvable for classes H of bounded fractional hypertree width, even if no decomposition is given in the input. There- fore, bounded fractional hypertree width is the so far most general hypergraph property that ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:3 Fig. 1. Hypergraph properties that make CSP polynomial-time solvable. makes Csp(H) polynomial-time solvable. Note that this property is strictly more general than bounded hypertree width and bounded fractional edge cover number (see Figure 1). For classes H of hypergraphs of bounded fractional hypertree width, we also show that all solutions of an instance of Csp(H) can be computed by a polynomial delay algorithm. Closely related to the problem of computing all solutions of a Csp-instance is the problem of evaluating a conjunctive query against a relational database. We show that conjunctive queries whose underlying hypergraph is in H can be evaluated by a polynomial delay algo- rithm as well. Finally, we look at the homomorphism problem and the embedding problem for relational structures. The homomorphism problem is known to be equivalent to the CSP [Feder and Vardi 1998] and hence can be solved in polynomial time if the left-hand side structure has an underlying hypergraph in a class H of bounded fractional hypertree width. This implies that the corresponding embedding problem, parameterized by the size of the universe of the left-hand side structure, is fixed-parameter tractable. Recall that a problem is fixed-parameter tractable (FPT) by some parameter k if the problem can be solved in time f (k) · nO(1) for a computable function f depending only on k. In particular, if a problem is polynomial-time solvable, then it is fixed-parameter tractable (with any parameter k). Follow up work. Let us briefly discuss how the ideas presented in the conference version of this paper [Grohe and Marx 2006] influenced later work. The conference version of this paper posed as an open question whether for every fixed k there is a polynomial-time algorithm that, given a hypergraph with fractional hypertree width k, finds a fractional hypertree decomposition having width k or, at least, having width bounded by a function of k. This question has been partially resolved by the algorithm of [Marx 2010a] that finds a fractional hypertree decomposition of width O(k3) if a decomposition of width k exists. This algorithm makes the results of the present paper stronger, as the polynomial-time algorithms for CSPs with bounded fractional hypertree width no longer need to assume that a decomposition is given in the input (see Section 4.3). The problem of finding a decomposition of width exactly k, if such a decomposition exists, is still open. In the special case of hypergraphs whose incidence graphs are planar, a constant-factor approximation of fractional hypertree width can be found by exploiting the fact that for such graphs fractional hypertree width and the tree width of the incidence graph can differ only by at most a constant factor [Fomin et al. 2009]. A core combinatorial idea of the present paper is that Shearer's Lemma gives an up- per bound on the number of solutions of a CSP instance and we use this bound for the subproblems corresponding to the bags of a fractional hypertree decomposition. This up- per bound has been subsequently used by Atserias et al. [2008] in the context of database ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. treewidthBoundededgecovernumberBoundedfractionalhypertreewidthBoundedBounded fractional hypertree width 0:4 M. Grohe, D. Marx queries, where it is additionally shown that a linear programming duality argument implies the tightness of this bound. We repeat this argument here as Theorem 3.7. An optimal query evaluation algorithm matching this tight bound was given by Ngo et al. [2012]. The bound was generalized to the context of conjunctive queries with functional dependencies by Gottlob et al. [2012]. We show that if H is a class of hypergraphs with bounded fractional hypertree width, then Csp(H) is fixed-parameter tractable parameterized by the number of variables and, in fact, polynomial-time solvable (using the algorithm of [Marx 2010a] for finding decompositions). It is a natural question if there are more general fixed-parameter tractable or polynomial- time solvable classes of hypergraphs. Very recently, Marx [2010b] gave a strictly more general such class by introducing the notion of submodular width and showing that Csp(H) is fixed- parameter tractable for classes H with bounded submodular width. Furthermore, it was shown in [Marx 2010b] that there are no classes H with unbounded submodular width that make Csp(H) fixed-parameter tractable (the proof uses a complexity-theoretic assumption called Exponential Time Hypothesis [Impagliazzo et al. 2001]). However, with respect to polynomial-time solvability, bounded fractional hypertree width is still the most general known tractability condition and it is an open question whether there are classes H with unbounded fractional hypertree width such that Csp(H) is polynomial-time solvable. 2. PRELIMINARIES 2.1. Hypergraphs A hypergraph is a pair H = (V (H), E(H)), consisting of a set V (H) of vertices and a set E(H) of nonempty subsets of V (H), the hyperedges of H. We always assume that hypergraphs have no isolated vertices, that is, for every v ∈ V (H) there exists at least one e ∈ E(H) such that v ∈ e. For a hypergraph H and a set X ⊆ V (H), the subhypergraph of H induced by X is the hypergraph H[X] = (X,{e∩ X e ∈ E(H) with e∩ X (cid:54)= ∅}). We let H \ X = H[V (H)\ X]. The primal graph of a hypergraph H is the graph H = (V (H),{{v, w} v (cid:54)= w, there exists an e ∈ E(H) such that {v, w} ⊆ e}). A hypergraph H is connected if H is connected. A set C ⊆ V (H) is connected (in H) if the induced subhypergraph H[C] is connected, and a connected component of H is a maximal connected subset of V (H). A sequence of vertices of H is a path of H if it is a path of H. A tree decomposition of a hypergraph H is a tuple (T, (Bt)t∈V (T )), where T is a tree and (Bt)t∈V (T ) a family of subsets of V (H) such that for each e ∈ E(H) there is a node t ∈ V (T ) such that e ⊆ Bt, and for each v ∈ V (H) the set {t ∈ V (T ) v ∈ Bt} is connected in T . The sets Bt are called the bags of the decomposition. The width of a tree-decomposition (T, (Bt)t∈V (T )) is max(cid:8)Bt(cid:12)(cid:12) t ∈ V (t)} − 1. The tree width tw(H) of a hypergraph H is the minimum of the widths of all tree-decompositions of H. It is easy to see that tw(H) = tw(H) for all H. It will be convenient for us to view the trees in tree-decompositions as being rooted and directed from the root to the leaves. For a node t in a (rooted) tree T = (V (T ), E(T )), we let Tt be the subtree rooted at t, that is, the induced subtree of T whose vertex set is the set of all vertices reachable from t. We say that a class H of hypergraphs is of bounded tree width if there is a k such that tw(H) ≤ k for all H ∈ H. We use a similar terminology for other hypergraph invariants. 2.2. Constraint satisfaction problems A CSP instance is a triple I = (V, D, C), where V is a set of variables, D is a set called the domain, and C is a set of constraints of the form (cid:104)(v1, . . . , vk), R(cid:105), where k ≥ 1 and R is a ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:5 k-ary relation on D. A solution to the instance I is an assignment α : V → D such that for all constraints (cid:104)(v1, . . . , vk), R(cid:105) in C we have (α(v1), . . . , α(vk)) ∈ R. instance I = (V, D, C) is the number (cid:107)I(cid:107) = V + D +(cid:80) Constraints are specified by explicitly enumerating all possible combinations of values for the variables, that is, all tuples in the relation R. Consequently, we define the size of a constraint c = (cid:104)(v1, . . . , vk), R(cid:105) ∈ C to be the number (cid:107)c(cid:107) = k + k · R. The size of an c∈C (cid:107)c(cid:107). Of course, there is no need to store a constraint relation repeatedly if it occurs in several constraints, but this only changes the size by a polynomial factor. Let us make a few remarks about this explicit representation of the constraints. There are important special cases of constraint satisfaction problems where the constraints are stored implicitly, which may make the representation exponentially more succinct. Examples are Boolean satisfiability, where the constraint relations are given implicitly by the clauses of a formula in conjunctive normal form, or systems of arithmetic (in)equalities, where the constraints are given implicitly by the (in)equalities. However, our representation is the standard "generic" representation of constraint satisfaction problems in artificial intelli- gence (see, for example, [Dechter 2003]). An important application where the constraints are always given in explicit form is the conjunctive query containment problem, which plays a crucial role in database query optimization. Kolaitis and Vardi [Kolaitis and Vardi 1998] observed that it can be represented as a constraint satisfaction problem, and the constraint relations are given explicitly as part of one of the input queries. A related problem from database systems is the problem of evaluating conjunctive queries (cf. Theorem 4.14). Here the constraint relations represent the tables of a relational database, and again they are given in explicit form. The problem of characterizing the tractable structural restrictions of CSP has also been studied for other representations of the instances: one can consider more succinct representations such as disjunctive formulas or decision diagrams [Chen and Grohe 2010] or less succinct representations such as truth tables [Marx 2011]. As the choice of rep- resentation influences the size of the input and the running time is expressed as a function of the input size, the choice of representation influences the complexity of the problem and the exact tractability criterion. Observe that there is a polynomial-time algorithm deciding whether a given assignment for an instance is a solution. The hypergraph of the CSP instance I = (V, D, C) is the hypergraph HI with vertex set V and a hyperedge {v1, . . . , vk} for all constraints (cid:104)(v1, . . . , vk), R(cid:105) in C. For every class H, we consider the following decision problem: Csp(H) Instance: A CSP instance I with HI ∈ H. Problem: Decide if I has a solution. If the class H is not polynomial-time decidable, we view this as a promise problem, that is, we assume that we are only given instances I with HI ∈ H, and we are only interested in algorithms that work correctly and efficiently on such instances. width such that Csp(H) is tractable. We close this section with a simple example of a class of hypergraphs of unbounded tree Example 2.1. Let H be that class of all hypergraphs H that have a hyperedge that contains all vertices, that is, V (H) ∈ E(H). Clearly, H has unbounded tree width, because the hypergraph (V,{V }) has tree width V − 1. We claim that Csp(H) ∈ PTIME. To see this, let I = (V, D, C) be an instance of Csp(H). Let (cid:104)(v1, . . . , vk), R(cid:105) be a con- straint in C with {v1, . . . , vk} = V . Such a constraint exists because HI ∈ H. Each tuple ¯d = (d1, . . . , dk) ∈ R completely specifies an assignment α ¯d defined by α ¯d(vi) = di for 1 ≤ i ≤ k. If for some i, j we have vi = vj, but di (cid:54)= dj, we leave α ¯d undefined. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:6 M. Grohe, D. Marx Observe that I is satisfiable if and only if there is a tuple ¯d ∈ R such that α ¯d is (well- defined and) a solution for I. As R ≤ (cid:107)I(cid:107), this can be checked in polynomial time. 3. A POLYNOMIAL-TIME ALGORITHM FOR CSPS WITH BOUNDED FRACTIONAL COVER NUMBER In this section we prove that if the hypergraph HI of a CSP instance I has fractional edge cover number ρ∗(HI ), then it can be decided in (cid:107)I(cid:107)ρ∗(HI )+O(1) time whether I has a solution. Thus if H is a class of hypergraphs with bounded fractional edge cover number (that is, there is a constant r such that ρ∗(H) ≤ r for every H ∈ H), then Csp(H) ∈ PTIME. Actually, we prove a stronger result: A CSP instance I has at most (cid:107)I(cid:107)ρ∗(HI ) solutions and all the solutions can be enumerated in time (cid:107)I(cid:107)ρ∗(HI )+O(1). The proof relies on a combinatorial lemma known as Shearer's Lemma. We use Shearer's Lemma to bound the number of solutions of a CSP instance; our argument resembles an argument that Friedgut and Kahn [Friedgut and Kahn 1998] used to bound the number of subhypergraphs of a certain isomorphism type in a hypergraph. The second author applied similar ideas in a completely different algorithmic context [Marx 2008]. The entropy of a random variable X with range U is h[X] := −(cid:88) x∈U Pr(X = x)log Pr(X = x) Shearer's lemma gives an upper bound of a distribution on a product space in terms of its marginal distributions. Lemma 3.1 (Shearer's Lemma [Chung et al. 1986]). Let X = (Xi i ∈ I) be a random variable, and let Aj, for j ∈ [m], be (not necessarily distinct) subsets of the index set I such that each i ∈ I appears in at least q of the sets Aj. For every B ⊆ I, let XB = (Xi i ∈ B). Then m(cid:88) h[XAj ] ≥ q · h[X]. Lemma 3.1 is easy to see in the special case when q = 1 and {A1, . . . , Ap} is a partition of V . The proof of the general case in [Chung et al. 1986] is based on the submodularity of entropy. See also [Rhadakrishnan ] for a simple proof. j=1 Lemma 3.2. If I = (V, D, C) is a CSP instance where every constraint relation contains at most N tuples, then I has at most N ρ∗(HI ) ≤ (cid:107)I(cid:107)ρ∗(HI ) solutions. Proof. Let x be a fractional edge cover of HI with(cid:80) Let pe and q be nonnegative integers such that x(e) = pe/q. Let m =(cid:80) e∈E(HI ) x(e) = ρ∗(HI ); it follows from the standard results of linear programming that such an x exists with rational values. e∈E(HI ) pe, and let A1, . . . , Am be a sequence of subsets of V that contains precisely pe copies of the set e, for all e ∈ E(HI ). Then every variable v ∈ V is contained in at least x(e) ≥ q pe = q · (cid:88) (cid:88) e∈E(HI ):v∈e e∈E(HI ):v∈e of the sets Ai (as x is a fractional edge cover). Let X = (Xv v ∈ V ) be uniformly distributed on the solutions of I, which we assume to be non-empty as otherwise the claim is obvious. That is, if we denote by S the number of solutions of I, then we have Pr(X = α) = 1/S for every solution α of I. Then h[X] = log S. We apply Shearer's Lemma to the random variable X and the sequence A1, . . . , Am of subsets of V . Assume that Ai corresponds to some constraint (cid:104)(v(cid:48) k) is 0 k), R(cid:105). Then the marginal distribution of X on (v(cid:48) 1, . . . , v(cid:48) 1, . . . , v(cid:48) ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:7 on all tuples not in R. Hence the entropy of XAi is is bounded by the entropy of the uniform distribution on the tuples in R, that is, h[XAi ] ≤ log N . Thus by Shearer's Lemma, we have (cid:88) pe · log N ≥ (cid:88) m(cid:88) i=1 pe · h[Xe] = h[XAi] ≥ q · h[X] = q · log S. e∈E(HI ) It follows that e∈E(HI ) (cid:80) e∈E(HI )(pe/q)·log N = 2ρ∗(HI )·log N = N ρ∗(HI ). S ≤ 2 We would like to turn the upper bound of Lemma 3.2 into an algorithm enumerating all the solutions, but the proof of Shearer's Lemma is not algorithmic. However, a very simple algorithm can enumerate the solutions, and Lemma 3.2 can be used to bound the running time of this algorithm. Starting with a trivial subproblem consisting only of a single variable, the algorithm enumerates all the solutions for larger and larger subproblems by adding one variable at a time. To define these subproblems, we need the following definitions: Definition 3.3. Let R be an r-ary relation over a set D. For 1 ≤ i1 < ··· < i(cid:96) ≤ r, the projection of R onto the components i1, . . . , i(cid:96) is the relation Ri1,...,i(cid:96) which contains an (cid:96)-tuple (d(cid:48) j = dij for 1 ≤ j ≤ (cid:96). Intuitively, a tuple is in Ri1,...,i(cid:96) if it can be extended into a tuple in R. (cid:96)) ∈ D(cid:96) if and only if there is a k-tuple (d1, . . . , dk) ∈ R such that d(cid:48) 1, . . . , d(cid:48) Definition 3.4. Let I = (V, D, C) be a CSP instance and let V (cid:48) ⊆ V be a nonempty subset of variables. The CSP instance I[V (cid:48)] induced by V (cid:48) is I(cid:48) = (V (cid:48), D, C(cid:48)), where C(cid:48) is defined in the following way: for each constraint c = (cid:104)(v1, . . . , vk), R(cid:105) having at least one variable in V (cid:48), there is a corresponding constraint c(cid:48) in C(cid:48). Suppose that vi1, . . . , vi(cid:96) are the variables among v1, . . . , vk that are in V (cid:48). Then the constraint c(cid:48) is defined as (cid:104)(vi1 , . . . , vi(cid:96)), Ri1,...,i(cid:96)(cid:105), that is, the relation is the projection of R onto the components i1, . . . , i(cid:96). Thus an assignment α on V (cid:48) satisfies I[V (cid:48)] if for each constraint c of I, there is an assignment extending α that satisfies c (however, it is not necessarily true that there is an assignment extending α that satisfies every constraint of I simultaneously). Note that that the hypergraph of the induced instance I[V (cid:48)] is exactly the induced subhypergraph HI [V (cid:48)]. Theorem 3.5. The solutions of a CSP instance I can be enumerated in time (cid:107)I(cid:107)ρ∗(HI )+O(1). Proof. Let V = {v1, . . . , vn} be an arbitrary ordering of the variables of I and let Vi be the subset {v1, . . . , vi}. For i = 1, 2, . . . , n, the algorithm creates a list Li containing the solutions of I[Vi]. Since I[Vn] = I, the list Ln is exactly what we want. For i = 1, the instance I[Vi] has at most D solutions, hence the list Li is easy to construct. Notice that a solution of I[Vi+1] induces a solution of I[Vi]. Therefore, the list Li+1 can be constructed by considering the solutions in Li, extending them to the variable vi+1 in all the D possible ways, and checking whether this assignment is a solution of I[Vi+1]. Clearly, this can be done in Li · D · (cid:107)I[Vi+1](cid:107)O(1) = Li · (cid:107)I(cid:107)O(1) time. By repeating this procedure for i = 1, 2, . . . , n − 1, the list Ln can be constructed. i=1 Li · (cid:107)I(cid:107)O(1). Ob- serve that ρ∗(HI[Vi]) ≤ ρ∗(HI ): HI[Vi] is the subhypergraph of HI induced by Vi, thus any fractional cover of the hypergraph of I gives a fractional cover of I[Vi] (for every edge e ∈ E(HI[Vi]), we set the weight of e to be the sum of the weight of the edges e(cid:48) ∈ E(HI ) The total running time of the algorithm can be bounded by (cid:80)n−1 ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:8 M. Grohe, D. Marx with e(cid:48) ∩ Vi = e). Therefore, by Lemma 3.2, Li ≤ (cid:107)I(cid:107)ρ∗(HI ), and it follows that the total running time is (cid:107)I(cid:107)ρ∗(HI )+O(1). We note that the algorithm of Theorem 3.5 does not actually need a fractional edge cover: the fact that the hypergraph has small fractional edge cover number is used only in proving the time bound of the algorithm. By a significantly more complicated algorithm, Ngo et al. [Ngo et al. 2012] improved Theorem 3.5 by removing the O(1) term from the exponent. Corollary 3.6. Let H be a class of hypergraphs of bounded fractional edge cover num- ber. Then Csp(H) is in polynomial time. We conclude this section by pointing out that Lemma 3.2 is tight: there are arbitrarily large instances I where every constraint relation contains at most N tuples and the number of solutions is exactly N ρ∗(HI ). A similar proof appeared first in [Atserias et al. 2008] in the context of database queries, but we restate it here in the language of CSPs for the convenience of the reader. such that (cid:80) Theorem 3.7. Let H be a hypergraph. For every N0 ≥ 1, there is a CSP instance I = (V, D, C) with hypergraph H where every constraint relation contains at most N ≥ N0 tuples and I has at least N ρ∗(H) solutions. v∈e y(v) ≤ 1 for every e ∈ E(H). The weight of y is (cid:80) Proof. A fractional independent set of hypergraph H is an assignment y : V (H) → [0, 1] v∈V (H) y(H). The fractional independent set number α∗(H) is the maximum weight of a fractional independent set of H. It is a well-known consequence of linear-programming duality that α∗(H) = ρ∗(H) for every hypergraph H, since the two values can be expressed by a pair of primal and dual linear programs [Schrijver 2003, Section 30.10]. Let y be a fractional independent set of weight α∗(H). By standard results of linear programming, we can assume that y is rational, that is, there is an integer q ≥ 1 such that for every v ∈ V (H), y(v) = pv/q for some nonnegative integer pv. We define a CSP 0 ] such that for every e ∈ E(H) where instance I = (V, D, C) with V = V (H) and D = [N q e = {v1, . . . , vr}, there is a constraint (cid:104)(v1, . . . , vr), Re(cid:105) with Re = {(a1, . . . , ar) ai ∈ [N pv 0 ] for every 1 ≤ i ≤ r}. 0 . We claim that Re contains at most N tuples. Indeed, the number of tuples in (cid:80) q·(cid:80) (cid:80) N pv 0 = N 0 v∈e pv = N 0 v∈e pv/q = (N q 0 ) v∈e y(v) ≤ N q 0 = N, Let N = N q Re is exactly(cid:89) v∈e since y is a fractional independent set. Observe that α : V (H) → D is a solution if and only if α(v) ∈ [N pv 0 ] for every v ∈ V (H). Hence the number of solutions is exactly N pv 0 )α∗(H) = N α∗(H) = N ρ∗(H), (cid:89) 0 = N 0 q·(cid:80) v∈V (H) pv/q = (N q v∈V (H) pv = N 0 (cid:80) v∈V (H) as required. The significance of this result is that it shows that there is no "better" measure than frac- tional edge cover number that guarantees a polynomial bound on the number of solutions, in the following formal sense. Let w(H) be a width measure that guarantees a polynomial bound: that is, if I is a CSP instance where every relation has at most N tuples, then I has at most N w(H) solutions for some function f . Then by Theorem 3.7, we have ρ∗(H) ≤ w(H). This means the upper bound on the number of solutions given by w(H) already follows from the bound given by Lemma 3.2 and hence ρ∗(H) can be considered a stronger measure. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:9 4. FRACTIONAL HYPERTREE DECOMPOSITIONS Let H be a hypergraph. A generalized hypertree decomposition of H [Gottlob et al. 2002] is a triple (T, (Bt)t∈V (T ), (Ct)t∈V (T )), where (T, (Bt)t∈V (T )) is a tree decomposition of H and (Ct)t∈V (T ) is a family of subsets of E(H) such that for every t ∈ V (T ) we have Bt ⊆(cid:83) Ct. Here (cid:83) Ct denotes the union of the sets (hyperedges) in Ct, that is, the set {v ∈ V (H) ∃e ∈ Ct : v ∈ e}. We call the sets Bt the bags of the decomposition and the sets Ct the guards. The width of (T, (Bt)t∈V (T ), (Ct)t∈V (T )) is max{Ct t ∈ V (T )}. The generalized hypertree width ghw(H) of H is the minimum of the widths of the generalized hypertree decompositions of H. The edge cover number ρ(H) of a hypergraph is the minimum number of edges needed to cover all vertices; it is easy to see that ρ(H) ≥ ρ∗(H). Observe that the size of Ct has to be at least ρ(H[Bt]) and, conversely, for a given Bt there is always a suitable guard Ct of size ρ(H[Bt]). Therefore, ghw(H) ≤ r if there is a tree decomposition where ρ(H[Bt]) ≤ r for every t ∈ V (T ). additional special condition: ((cid:83) Ct) ∩(cid:83) For the sake of completeness, let us mention that a hypertree decomposition of H is a generalized hypertree decomposition (T, (Bt)t∈V (T ), (Ct)t∈V (T )) that satisfies the following u∈V (Tt) Bu ⊆ Bt for all t ∈ V (T ). Recall that Tt denotes the subtree of the T with root t. The hypertree width hw(H) of H is the minimum of the widths of all hypertree decompositions of H. It has been proved in [Adler et al. 2007] that ghw(H) ≤ hw(H) ≤ 3· ghw(H) + 1. This means that for our purposes, hypertree width and generalized hypertree width are equivalent. For simplicity, we will only work with generalized hypertree width. Observe that for every hypergraph H we have ghw(H) ≤ tw(H) + 1. Furthermore, if H is a hypergraph with V (H) ∈ E(H) we have ghw(H) = 1 and tw(H) = V (H) − 1. We now give an approximate characterization of (generalized) hypertree width by a game that is a variant of the cops and robber game [Seymour and Thomas 1993], which character- izes tree width: In the robber and marshals game on H [Gottlob et al. 2003], a robber plays against k marshals. The marshals move on the hyperedges of H, trying to catch the robber. Intuitively, the marshals occupy all vertices of the hyperedges where they are located. In each move, some of the marshals fly in helicopters to new hyperedges. The robber moves on the vertices of H. She sees where the marshals will be landing and quickly tries to escape, running arbitrarily fast along paths of H, not being allowed to run through a vertex that is occupied by a marshal before and after the flight (possibly by two different marshals). The marshals' objective is to land a marshal via helicopter on a hyperedge containing the vertex occupied by the robber. The robber tries to elude capture. The marshal width mw(H) of a hypergraph H is the least number k of marshals that have a winning strategy in the robber and marshals game played on H (see [Adler 2004] or [Gottlob et al. 2003] for a formal definition). It is easy to see that mw(H) ≤ ghw(H) for every hypergraph H. To win the game on a hypertree of generalized hypertree width k, the marshals always occupy guards of a decomposition and eventually capture the robber at a leaf of the tree. Conversely, it can be proved that ghw(H) ≤ 3 · mw(H) + 1 [Adler et al. 2007]. Observe that for every hypergraph H, the generalized hypertree width ghw(H) is less than or equal to the edge cover number ρ(H): hypergraph H has a generalized hypertree decom- position consisting of a single bag containing all vertices and having a guard of size ρ(H). On the other hand, the following two examples show that hypertree width and fractional edge cover number are incomparable. Example 4.1. Consider the class of all graphs that only have disjoint edges. The tree width and hypertree width of this class is 1, whereas the fractional edge cover number is unbounded. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:10 M. Grohe, D. Marx Example 4.2. For n ≥ 1, let Hn be the following hypergraph: Hn has a vertex vS for every subset S of {1, . . . , 2n} of cardinality n. Furthermore, for every i ∈ {1, . . . , 2n} the hypergraph Hn has a hyperedge ei = {vS i ∈ S}. Observe that the fractional edge cover number ρ∗(Hn) is at most 2, because the mapping x that assigns 1/n to every hyperedge ei is a fractional edge cover of weight 2. Actually, it is easy to see that ρ∗(Hn) = 2. We claim that the hypertree width of Hn is n. We show that Hn has a hypertree de- composition of width n. Let S1 = {1, . . . , n} and S2 = {n + 1, . . . , 2n}. We construct a generalized hypertree decomposition for Hn with a tree T having two nodes t1 and t2. For i = 1, 2, we let Bt1 contain a vertex VS if and only if S ∩ Si (cid:54)= ∅. For each edge ej ∈ E(Hn), there is a bag of the decomposition that contains ej: if j ∈ Si, then Bti contains every vertex of ej. We set the guard Cti to contain every ej with j ∈ Si. It is clear that Cti = n and Cti covers Bti: vertex vS is in Bti only if there is a j ∈ S ∩ Si, in which case ej ∈ Cti covers vS. Thus this is indeed a generalized hypertree decomposition of width n for Hn and ghw(Hn) ≤ n follows. To see that ghw(Hn) > n − 1, we argue that the robber has a winning strategy against (n − 1) marshals in the robber and marshals game. Consider a position of the game where the marshals occupy edges ej1, . . . , ejn−1 and the robber occupies a vertex vS for a set S with S ∩{j1, . . . , jn−1} = ∅. Suppose that in the next round of the game the marshals move to the edges ek1, . . . , ekn−1. Let i ∈ S \ {k1, . . . , kn−1}. The robber moves along the edge ei to a vertex vR for a set R ⊆ {1, . . . , 2n} \ {k1, . . . , kn−1} of cardinality n that contains i. If she plays this way, she can never be captured. For a hypergraph H and a mapping γ : E(H) → [0,∞), we let γ(e) ≥ 1}. B(γ) = {v ∈ V (H) (cid:88) weight(γ) =(cid:80) e∈E γ(e). e∈E(H),v∈e We may think of B(γ) as the set of all vertices "blocked" by γ. Furthermore, we let Definition 4.3. Let H be a hypergraph. A fractional hypertree decomposition of H is a triple (T, (Bt)t∈V (T ), (γt)t∈V (T )), where (T, (Bt)t∈V (T )) is a tree decomposition of H and (γt)t∈V (T ) is a family of mappings from E(H) to [0,∞) such that for every t ∈ V (T ) we have Bt ⊆ B(γt). guards. We call the sets Bt the bags of the decomposition and the mappings γt the (fractional) The width of (T, (Bt)t∈V (T ), (γt)t∈V (T )) is max{weight(γt) t ∈ V (T )}. The fractional hypertree width fhw(H) of H is the minimum of the widths of the fractional hypertree de- compositions of H. Equivalently, fhw(H) ≤ r if H has a tree decomposition where ρ∗(Bt) ≤ r for every bag Bt. It is easy to see that the minimum of the widths of all fractional hypertree decompositions of a hypergraph H always exists and is rational. This follows from the fact that, up to an obvious equivalence, there are only finitely many tree decompositions of a hypergraph. Clearly, for every hypergraph H we have fhw(H) ≤ ρ∗(H) and fhw(H) ≤ ghw(H). Examples 4.1 and 4.2 above show that there are families of hypergraphs of bounded frac- tional hypertree width, but unbounded fractional edge cover number and unbounded gen- eralized hypertree width. It is also worth pointing out that for every hypergraph H, fhw(H) = 1 ⇐⇒ ghw(H) = 1. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:11 To see this, note that if γ : E(H) → [0,∞) is a mapping with weight(γ) = 1 and B ⊆ B(γ), then B ⊆ e for all e ∈ E(H) with γ(e) > 0. Thus instead of using γ as a guard in a fractional hypertree decomposition, we may use the integral guard {e} for any e ∈ E(H) with γ(e) > 0. Let us remark that ghw(H) = 1 if and only if H is acyclic [Gottlob et al. 2002]. 4.1. The robber and army game As robbers are getting ever more clever, it takes more and more powerful security forces to capture them. In the robber and army game on a hypergraph H, a robber plays against a general commanding an army of r battalions of soldiers. The general may distribute his soldiers arbitrarily on the hyperedges. However, a vertex of the hypergraph is only blocked if the number of soldiers on all hyperedges that contain this vertex adds up to the strength of at least one battalion. The game is then played like the robber and marshals game. Definition 4.4. Let H be a hypergraph and r a nonnegative real. The robber and army game on H with r battalions (denoted by RA(H, r)) is played by two players, the robber and the general. A position of the game is a pair (γ, v), where v ∈ V (H) and γ : E(H) → [0,∞) with weight(γ) ≤ r. To start a game, the robber picks an arbitrary v0, and the initial position is (0, v0), where 0 denote the constant zero mapping. In each round, the players move from the current position (γ, v) to a new position (γ(cid:48), v(cid:48)) as follows: The general selects γ(cid:48), and then the robber selects v(cid:48) such that there is a path If a position (γ, v) with v ∈ B(γ) is reached, the play ends and the general wins. If the from v to v(cid:48) in the hypergraph H \ (B(γ) ∩ B(γ(cid:48))(cid:1). play continues forever, the robber wins. The army width aw(H) of H is the least r such that the general has winning strategy for the game RA(H, r). Again, it is easy to see that aw(H) is well-defined and rational (observe that two positions (γ1, v) and (γ2, v) are equivalent if B(γ1) = B(γ2) holds). Theorem 4.5. For every hypergraph H, aw(H) ≤ fhw(H) ≤ 3 · aw(H) + 2. The rest of this subsection is devoted to a proof of this theorem. The proof is similar to the proof of the corresponding result for the robber and marshal game and generalized hypertree width in [Adler et al. 2007], which in turn is based on ideas from [Reed 1997; Seymour and Thomas 1993]. Let H be a hypergraph and γ, σ : E(H) → [0,∞). For a set W ⊆ V (H), we let A mapping σ : E(H) → [0,∞) is a balanced separator for γ if for every connected component R of H \ B(σ), weight(γR) ≤ weight(γ) . 2 Lemma 4.6. Let H be a hypergraph with aw(H) ≤ r for some nonnegative real r. Then every γ : E(H) → [0,∞) has a balanced separator of weight r. Proof. Suppose for contradiction that γ : E(H) → [0,∞) has no balanced separator of weight r. We claim that the robber has a winning strategy for the game RA(H, r). The robber simply maintains the invariant that in every position (σ, v) of the game, v is contained in the connected component R of H \ B(σ) with weight(γR) > weight(γ)/2. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. weight(γW ) = γ(e). (cid:88) e∈E(H) e∩W(cid:54)=∅ 0:12 M. Grohe, D. Marx To see that this is possible, let (σ, v) be such a position. Suppose that the general moves from σ to σ(cid:48), and let R(cid:48) be the connected component of H \ B(σ(cid:48)) with weight(γR(cid:48)) > weight(γ)/2. Then there must be some e ∈ E(H) such that e ∩ R (cid:54)= ∅ and e ∩ R(cid:48) (cid:54)= ∅, because otherwise we had weight(γ) = weight(γ)/2 + weight(γ)/2 < weight(γR) + weight(γR(cid:48)) ≤ weight(γ), which is impossible. Thus the robber can move from R to R(cid:48) via the edge e. Let H be a hypergraph and H(cid:48) an induced subhypergraph of H. Then the restriction of a mapping γ : E(H) → [0,∞) to H(cid:48) is the mapping γ(cid:48) : E(H(cid:48)) → [0,∞) defined by (cid:88) γ(cid:48)(e(cid:48)) = γ(e). e∈E(H) e∩V (H(cid:48))=e(cid:48) Note that weight(γ(cid:48)) ≤ weight(γ) and B(γ(cid:48)) = B(γ) ∩ V (H(cid:48)). The inequality may be strict because edges with nonempty weight may have an empty intersection with V (H(cid:48)). Conversely, the canonical extension of a mapping γ(cid:48) : E(H(cid:48)) → [0,∞) to H is the mapping γ : E(H) → [0,∞) defined by γ(e) = {e1 ∈ E(H) e1 ∩ V (H(cid:48)) = e ∩ V (H)} γ(cid:48)(e ∩ V (H(cid:48))) if e∩ V (H(cid:48)) (cid:54)= ∅ and γ(e) = 0 otherwise. Intuitively, for every e(cid:48) ∈ E(H(cid:48)), we distribute the weight of e(cid:48) equally among all the edges e ∈ E(H) whose intersection with V (H(cid:48)) is exactly e(cid:48). Note that weight(γ) = weight(γ(cid:48)) and B(γ(cid:48)) = B(γ) ∩ V (H(cid:48)). Proof (of Theorem 4.5). Let H be a hypergraph. To prove that aw(H) ≤ fhw(H), let (T, (Bt)t∈V (T ), (γt)t∈V (T )) be a fractional hypertree decomposition of H having width fhw(H). We claim that the general has a winning strategy for RA(H, r). Let (0, v0) be the initial position. The general plays in such a way that all subsequent positions are of the form (γt, v) such that v ∈ Bu for some u ∈ V (Tt). Intuitively, this means that the robber is trapped in the subtree below t. Furthermore, in each move the general reduces the height of t. He starts by selecting γt0 for the root t0 of T . Suppose the game is in a position (γt, v) such that v ∈ Bu for some u ∈ V (Tt). If u = t, then the robber has lost the game. So let us assume that u (cid:54)= t. Then there is a child t(cid:48) of t such that u ∈ V (Tt(cid:48)). The general moves to γt(cid:48). Suppose the robber escapes to a v(cid:48) that is not contained in Bu(cid:48) for any u(cid:48) ∈ Tt(cid:48). Then there is a path from v to v(cid:48) in H \ (B(γt) ∩ B(γt(cid:48))) and hence in H \ (Bt ∩ Bt(cid:48)). However, it follows easily from the fact that (T, (Bt)t∈T ) is a tree decomposition of H that every path from a bag in Tt(cid:48) to a bag in T \ Tt(cid:48) must intersect Bt ∩ Bt(cid:48). This proves that aw(H) ≤ fhw(H). For the second inequality, we shall prove the following stronger claim: Claim: Let H be a hypergraph with aw(H) ≤ r for some nonnegative real r. Furthermore, let γ : E(H) → [0,∞) such that weight(γ) ≤ 2r +2. Then there exists a fractional hypertree decomposition of H of width at most 3r + 2 such that B(γ) is contained in the bag of the root of this decomposition. Note that for γ = 0, the claim yields the desired fractional hypertree decomposition of H. Proof of the claim: The proof is by induction on the cardinality of V (H) \ B(γ). By Lemma 4.6, there is a balanced separator of weight at most r for γ in H. Let σ be such a separator, and define χ : E(H) → [0,∞) by χ(e) = γ(e) + σ(e). Then weight(χ) ≤ 3r + 2, and B(γ) ∪ B(σ) ⊆ B(χ). ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:13 If V (H) = B(χ) (this is the induction basis), then the 1-node decomposition with bag V (H) and guard χ is a fractional hypertree decomposition of H of width at most 3r + 2. Otherwise, let R1, . . . , Rm be the connected components of H\B(χ). Note that we cannot exclude the case m = 1 and R1 = V (H) \ B(χ). For 1 ≤ i ≤ m, let ei be an edge of H such that ei ∩ Ri (cid:54)= ∅, and let Si be the unique connected component of H \ B(σ) with Ri ⊆ Si. Note that weight(γSi) ≤ r + 1, because σ is a balanced separator for γ. Let χi : E(H) → [0,∞) be defined by 1 χi(e) = σ(e) + γ(e) σ(e) if e = ei, if e (cid:54)= ei and Si ∩ e (cid:54)= ∅, otherwise. Then weight(χi) ≤ 1 + weight(σ) + weight(γSi) ≤ 2r + 2 and B(χi) \ Ri ⊆ B(χ) (as ei cannot intersect any Rj with i (cid:54)= j). Let Hi = H[Ri ∪ B(χi)] and observe that V (Hi) \ B(χi) ⊆ Ri \ ei ⊂ Ri ⊆ V (H) \ B(γ) (the first inclusion holds because χi(ei) = 1). Thus the induction hypothesis is applica- ble to Hi and the restriction of χi to Hi. It yields a fractional hypertree decomposition (T i, (Bi t)t∈V (T i)) of Hi of weight at most 3r + 2 such that B(χi) is contained in the bag Bi ti 0 t)t∈V (T i), (γi of the root ti 0 of T i. t to H for all t ∈ V (T i). 0 of the T i. Let Bt0 = B(χ) and Bt = Bi the roots ti and let γt be the canonical extension of γi Let T be the disjoint union of T 1, . . . , T m together with a new root t0 that has edges to t for all t ∈ V (T i). Moreover, let γt0 = χ, It remains to prove that (T, (Bt)t∈V (T ), (γt)t∈V (T )) is a fractional hypertree decomposition of H of width at most 3r + 2. Let us first verify that (T, (Bt)t∈V (T )) is a tree decomposition. - Let v ∈ V (H). To see that {v ∈ V (T ) v ∈ Bt} is connected in T , observe that {t ∈ V (T i) v ∈ Bti} is connected (maybe empty) for all i. If v ∈ Ri for some i, then v (cid:54)∈ V (Hj) = Rj ∪ B(χj) for any i (cid:54)= j (as Ri and Rj are disjoint and we have seen that B(χj) \ Rj ⊆ B(χ)) and this this already shows that {t ∈ V (T ) v ∈ Bt} is connected. Otherwise, v ∈ B(χi) \ Ri ⊆ B(χ) = Bt0 for all i such that v ∈ V (Hi). Again this shows that {v ∈ V (T ) v ∈ Bt} is connected. - Let e ∈ E(H). Either e ⊆ B(χ) = Bt0 , or there is exactly one i such that e ⊆ Ri ∪ B(χi). In the latter case, e ⊆ Bt for some t ∈ V (T i). It remains to prove that Bt ⊆ B(γt) for all t ∈ T . For the root, we have Bt0 = B(γt0 ). For t ∈ V (T i), we have Bt ⊆ B(γi t) = B(γt) ∩ V (Hi) ⊆ B(γt). Finally, note that weight(γt) ≤ 3r + 2 for all t ∈ V (T ). This completes the proof of the claim. Remark 4.7. With respect to the difference between hypertree decompositions and gener- alized hypertree decompositions, it is worth observing that the fractional tree decomposition (T, (Bt)t∈V (T ), (γt)t∈V (T )) of width at most 3r + 2 constructed in the proof of the theorem u∈V (Tt) Bu ⊆ Bt for all t ∈ V (T ). This satisfies the following special condition: B(γt) ∩(cid:83) implies that a hypergraph of fractional hypertree width at most r has a fractional hypertree decomposition of width at most 3r + 2 that satisfies the special condition. 4.2. Finding decompositions For the algorithmic applications, it is essential to have algorithms that find fractional hy- pertree decompositions of small width. The question is whether for any fixed r > 1 there is a polynomial-time algorithm that, given a hypergraph H with fhw(H) ≤ r, computes ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:14 M. Grohe, D. Marx a fractional hypertree decomposition of H of width at most r or maybe of width at most f (r) for some function f . Similarly to hypertree width, one way of obtaining such an al- gorithm would be through the army and robber game characterization. The idea would be to inductively compute the set of all positions of the game from which the general wins in 0, 1, . . . rounds. The problem is that, as opposed to the robber and marshals game, there is no polynomial bound on the number of positions. Using a different approach (approximately solving the problem of finding balanced sep- arators with small fractional edge cover number), Marx [2010a] gave an algorithm that approximates fractional hypertree width in the following sense: Theorem 4.8 ([Marx 2010a]). For every r ≥ 1, there is an nO(r3) time algorithm that, given a hypergraph with fractional hypertree width at most r, finds a fractional hypertree decomposition of width O(r3). The main technical challenge in the proof of Theorem 4.8 is finding a separator with bounded fractional edge cover number that separates two sets X, Y of vertices. An approximation algorithm is given in [Marx 2010a] for this problem, which finds a separator of weight O(r3) if a separator of weight r exists. This algorithm is used to find balanced separators, which in turn is used to construct a tree decomposition (by an argument similar to the proof of the second part of Theorem 4.5). It is shown in [Marx 2010a; Fomin et al. 2009] that deciding whether H has fractional hypertree width r is NP-hard if r is part of the input. However, the more relevant question of whether for every fixed r, a fractional hypertree decomposition of width r can be found in polynomial-time (i.e., if the width bound O(r3) in Theorem 4.8 can be improved to r) is still open. Given that it is NP-hard to decide whether a hypergraph has generalized hypertree width at most 3 [Gottlob et al. 2009], it is natural to expect that a similar hardness result holds for fractional hypertree width as well. 4.3. Algorithmic applications In this section, we discuss how problems can be solved by fractional hypertree decompo- sitions of bounded width. First we give a basic result, which formulates why tree decom- positions and width measures are useful in the algorithmic context: CSP can be efficiently solved if we can polynomially bound the number of solutions in the bags. Recall that HI denotes the hypergraph of a CSP instance I. If (T, (Bt)t∈V (T )) is a tree decomposition of HI , then I[Bt] denotes the instance induced by bag Bt, see Definition 3.4. Lemma 4.9. There is an algorithm that, given a CSP instance, a hypertree decompo- sition (T, (Bt)t∈V (T )) of HI , and for every t ∈ V (t) a list Lt of all solutions of I[Bt], decides in time C · (cid:107)I(cid:107)O(1) if I is satisfiable (and computes a solution if it is), where C := maxt∈V (T )Lt. Proof. Define Vt :=(cid:83) t0 is not empty for the root t0 of the tree decomposition. t∈V (Tt) Bt. For each t ∈ V (T ), our algorithm constructs the list t ⊆ Lt of those solutions of I[Bt] that can be extended to a solution of I[Vt]. Clearly, I L(cid:48) has a solution if and only if L(cid:48) The algorithm proceeds in a bottom-up manner: when constructing the list L(cid:48) t, we assume that for every child t(cid:48) of t, the lists L(cid:48) t(cid:48) are already available. If t is a leaf node, then Vt = Bt, and L(cid:48) t = Lt. Assume now that t has children t1, . . . , tk. We claim that a solution α of I[Bt] can be extended to I[Vt] if and only if for each 1 ≤ i ≤ k, there is a solution αi of I[Vti] that is compatible with α (that is, α and αi assign the same values to the variables in Bt ∩ Vti = Bt ∩ Bti). The necessity of this condition is clear: the restriction of a solution of I[Vt] to Vti is clearly a solution of I[Vti ]. For sufficiency, suppose that the solutions αi exist for every child ti. They can be combined to an assignment α(cid:48) on Vt extending α in a well-defined way: every variable v ∈ Vti ∩ Vtj is in Bt, thus αi(v) = αj(v) = α(v) follows for ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:15 Therefore, L(cid:48) such a variable. Now α(cid:48) is a solution of I[Vt]: for each constraint of I[Vt], the variables of the constraint are contained either in Bt or in Vti for some 1 ≤ i ≤ k, thus α or αi satisfies the constraint, implying that α(cid:48) satisfies it as well. t can be determined by first enumerating every solution α ∈ Lt, and then for each i, checking whether L(cid:48) contains an assignment αi compatible with α. This check can be efficiently performed the following way. Recall that solutions α and αi are compatible if their restriction to Bt ∩ Bti is the same assignment. Therefore, after computing L(cid:48) , we restrict every αi ∈ L(cid:48) to Bt ∩ Bti and store these restrictions in a trie data structure for easy membership tests. Then to check if there is an αi ∈ L(cid:48) compatible with α, all we need to do is to check if the restriction of α to Bt ∩ Bti is in the trie corresponding to L(cid:48) t (and the corresponding trie structure) can be computed in time Lt · (cid:107)I(cid:107)O(1). As every other part of the algorithm can be done in time (cid:107)I(cid:107)O(1), it follows that the total running time can be bounded by C · (cid:107)I(cid:107)O(1). Using standard bookkeeping techniques, it is not difficult to extend the algorithm such that it actually returns a solution if one exists. , which can be checked in (cid:107)I(cid:107)O(1). Thus L(cid:48) ti ti ti ti ti Lemma 4.9 tells us that if we have a tree decomposition where we can give a polynomial bound on the number of solutions in the bags for some reason (and we can enumerate all these solutions), then the problem can be solved in polynomial time. Observe that in a fractional hypertree decomposition every bag has bounded fractional edge cover number and hence Theorem 3.5 can be used to enumerate all the solutions. It follows that if a fractional hypertree decomposition of bounded width is given in the input, then the problem can be solved in polynomial time. Moreover, if we know that the hypergraph has fractional hypertree width at most r (but no decomposition is given in the input), then we can use brute force to find a fractional hypertree decomposition of width at most r by trying every possible decomposition and then solve the problem in polynomial time. This way, the running time is polynomial in the input size times an (exponential) function of the number of variables. This immediately shows that if we restrict CSP to a class of hypergraphs whose fractional hypertree width is at most a constant r, then the problem is fixed-parameter tractable parameterized by the number of variables. To get rid of the exponential factor depending on the number of variables and obtain a polynomial-time algorithm, we can replace the brute force search for the decomposition by the approximation algorithm of Theorem 4.8 [Marx 2010a]. Theorem 4.10. Let r ≥ 1. Then there is a polynomial-time algorithm that, given a CSP instance I of fractional hypertree width at most r, decides if I is satisfiable (and computes a solution if it is). Proof. Let I be a CSP instance of fractional hypertree width at most r, and let (T, (Bt)t∈V (T ), (γt)t∈V (T )) be the fractional hypertree decomposition of HI of width O(r3) computed by the algorithm of Theorem 4.8. By the definition, the hypergraph of I[Bt] has fractional edge cover number O(r3) for every bag Bt. Thus by Theorem 3.5, the list Lt of the solutions of I[Bt] has size at most (cid:107)I(cid:107)O(r3) and can be determined in time (cid:107)I(cid:107)O(r3). Therefore, we can find a solution in time (cid:107)I(cid:107)O(r3) using the algorithm of Lemma 4.9. In the remainder of this section, we sketch further algorithmic applications of fractional hypertree decompositions. As these results follow from our main results with fairly standard techniques, we omit a detailed and technical discussion. It is has been observed by Feder and Vardi [1998] that constraint satisfaction problems can be described as homomorphism problems for relational structures (see [Feder and Vardi 1998] or [Grohe 2007] for definitions and details). A homomorphism from a structure A to a structure B is a mapping from the domain of A to the domain of B that preserves membership in all relations. With each structure A we can associate a hypergraph HA whose ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:16 M. Grohe, D. Marx vertices are the elements of the domain of A and whose hyperedges are all sets {a1, . . . , ak} such that (a1, . . . , ak) is a tuple in some relation of A. For every class H of hypergraphs, we let Hom(H) be the problem of deciding whether a structure A with HA ∈ H has a homomorphism to a structure B. As an immediate corollary to Theorem 4.10, we obtain: Corollary 4.11. Let H be a class of hypergraphs of bounded fractional hypertree width. Then Hom(H) is solvable in polynomial time. An embedding is a homomorphism that is one-to-one. Note that there is an embedding from a structure A to a structure B if and only if B has a substructure isomorphic to A. Analogously to Hom(H), we define the problem Emb(H) of deciding whether a structure A with HA ∈ H has an embedding into a structure B. Observe that Emb(H) is NP- complete even if H is the class of paths, which has fractional hypertree width 1, because the Hamiltonian Path problem is a special case. However, we obtain a fixed-parameter tractability result for Emb(H) parameterized by the size A of the input structure A: Theorem 4.12. Let H be a class of hypergraphs of bounded fractional hypertree width. Then Emb(H) parameterized by the size of the input structure A is fixed-parameter tractable. More precisely, there is an algorithm that, given a structure A with HA ∈ H and a structure B, decides if there is an embedding of A into B in time 2AO(1)BO(1). This follows from Corollary 4.11 with Alon, Yuster, and Zwick's [Alon et al. 1995] color coding technique. In some situations it is necessary to not only decide whether a CSP-instance has a solution or to compute one solution, but to enumerate all solutions. As the number of solutions may be exponential in the instance size, we can rarely expect a polynomial-time algorithm for this problem. Instead, we may ask for a polynomial-delay algorithm, which is required to compute the first solution in polynomial time and after returning a solution is required to return the next solution (or determine that no other solution exists) in polynomial time. Polynomial-delay algorithms for CSPs have been studied more systematically in [Bulatov et al. 2012]. Theorem 4.13. Let r ≥ 1. Then there is a polynomial-delay algorithm that, given a CSP instance I of fractional hypertree width at most r, enumerates all solutions of I. Proof (sketch). Given an instance I, the algorithm first computes a fractional hyper- tree decomposition (T, (Bt)t∈V (T ), (γt)t∈V (T )) of HI of width O(r3) using the algorithm of Theorem 4.8. Then it orders the nodes of T by a preorder traversal and then orders the variables of I in such a way that if v ∈ Bt and w ∈ Bu \ Bt and t comes before u in the preorder traversal, v is smaller than w. For every node t of T the algorithm computes a list of all solutions for I[Bt] and sorts it lexicographically. It is easy to modify the algorithm of Lemma 4.9 to compute the lexicographically first solution and, for every given solution, the lexicographically next solution. A problem closely related to the problem of enumerating all solutions to a given CSP- instance is the problem of computing the answer for a conjunctive query in a relational database (see [Kolaitis and Vardi 1998]). To be precise, answering conjunctive queries is equivalent to computing projections of solution sets of CSP-instances to a given subset V (cid:48) of variables. With each conjunctive query, we can associate hypergraph in a similar way as we did for CSP-instances. Then answering queries with hypergraphs in H is equivalent to computing projections of solution sets of Csp(H)-instances. We define the fractional hypertree width of a conjunctive query to be the fractional hypertree width of its hypergraph. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:17 Theorem 4.14. Let r ≥ 1. Then there is a polynomial-delay algorithm that, given a conjunctive query Q of fractional hypertree width at most r and a database instance D, computes the answer Q(D) of Q in D. The proof is a straightforward refinement of the proof of the previous theorem. 5. CONCLUSIONS In this paper we have considered structural properties that can make a constraint satis- faction problem polynomial-time solvable. Previously, bounded hypertree width was the most general such property. Answering an open question raised in [Chen and Dalmau 2005; Cohen et al. 2008; Gottlob et al. 2005; Grohe 2007], we have identified a new class of polynomial-time solvable CSP instances: instances having bounded fractional edge cover number. This result suggests the definition of fractional hypertree width, which is always at most as large as the hypertree width (and in some cases much smaller). It turns out that CSP is polynomial-time solvable for instances having bounded fractional hypertree width, if the hypertree decomposition is given together with the instance. This immediately implies that CSP is fixed-parameter tractable parameterized by the number of variables for hyper- graphs with bounded fractional hypertree width. Furthermore, together with the algorithm of [Marx 2010a] finding approximate fractional hypertree decompositions, it also follows that CSP is polynomial-time solvable for this class. Currently, bounded fractional hyper- tree width is the most general known structural property that makes CSP polynomial-time solvable. The most natural open question we leave open regarding fractional hypertree width is whether for every fixed r there is a polynomial-time algorithm that decides if a hypergraph has fractional hypertree width at most r (and if so, constructs a decomposition). As the analogous problem for generalized hypertree width is NP-hard for r = 3, we expect this to be the case for fractional hypertree width as well. Another open question is whether there are polynomial-time solvable or fixed-parameter tractable families of CSP instances having unbounded fractional hypertree width. Very recently, [Marx 2010b] showed that, under suitable complexity assumptions, bounded sub- modular width (a condition strictly more general that bounded fractional hypertree width) exactly characterizes the fixed-parameter tractability of the problem. However, the exact condition characterizing polynomial-time solvability is still an open problem. In light of the results of [Marx 2010b], one needs to understand the complexity of the problem for classes that have bounded submodular width, but unbounded fractional hypertree width. REFERENCES Adler, I. 2004. Marshals, monotone marshals, and hypertree-width. Journal of Graph Theory 47, 275–296. Adler, I., Gottlob, G., and Grohe, M. 2007. Hypertree width and related hypergraph invariants. Eur. J. Comb. 28, 8, 2167–2181. Alon, N., Yuster, R., and Zwick, U. 1995. Color-coding. Journal of the ACM 42, 844–856. Atserias, A., Grohe, M., and Marx, D. 2008. Size bounds and query plans for relational joins. In 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2008). 739–748. Berge, C. 1976. Graphs and Hypergraphs. North Holland. Bulatov, A. A. 2006. A dichotomy theorem for constraint satisfaction problems on a 3-element set. J. ACM 53, 1, 66–120. Bulatov, A. A. 2011. Complexity of conservative constraint satisfaction problems. ACM Trans. Comput. Log. 12, 4, 24. Bulatov, A. A., Dalmau, V., Grohe, M., and Marx, D. 2012. Enumerating homomorphisms. J. Comput. Syst. Sci. 78, 2, 638–650. Bulatov, A. A., Krokhin, A. A., and Jeavons, P. 2001. The complexity of maximal constraint languages. In Proceedings of the 33rd ACM Symposium on Theory of Computing (STOC 2001). 667–674. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. 0:18 M. Grohe, D. Marx Chen, H. and Dalmau, V. 2005. Beyond hypertree width: Decomposition methods without decompositions. In Principles and Practice of Constraint Programming (CP 2005), P. van Beek, Ed. Lecture Notes in Computer Science Series, vol. 3709. Springer Berlin / Heidelberg, 167–181. Chen, H. and Grohe, M. 2010. Constraint satisfaction with succinctly specified relations. Journal of Computer System Sciences 76, 847–860. Chung, F., Frankl, P., Graham, R., and Shearer, J. 1986. Some intersection theorems for ordered sets and graphs. Journal of Combinatorial Theory, Series A 43, 23–37. Cohen, D. A., Jeavons, P., and Gyssens, M. 2008. A unified theory of structural tractability for constraint satisfaction problems. J. Comput. Syst. Sci. 74, 5, 721–743. Dalmau, V., Kolaitis, P. G., and Vardi, M. Y. 2002. Constraint satisfaction, bounded treewidth, and finite-variable logics. In Proceedings of the 8th International Conference on Principles and Practice of Constraint Programming (CP 2002), P. V. Hentenryck, Ed. Lecture Notes in Computer Science Series, vol. 2470. Springer-Verlag, 310–326. Dechter, R. 2003. Constraint Processing. Morgan Kaufmann. Dechter, R. and Pearl, J. 1989. Tree clustering for constraint networks. Artificial Intelligence 38, 353– 366. Fagin, R. 1983. Degrees of acyclicity for hypergraphs and relational database schemes. Journal of the ACM 30, 3, 514–550. Feder, T. and Vardi, M. 1998. The computational structure of monotone monadic SNP and constraint satisfaction: A study through datalog and group theory. SIAM Journal on Computing 28, 57–104. Fomin, F. V., Golovach, P. A., and Thilikos, D. M. 2009. Approximating acyclicity parameters of sparse hypergraphs. In 26th International Symposium on Theoretical Aspects of Computer Science (STACS 2009), S. Albers and J.-Y. Marion, Eds. Leibniz International Proceedings in Informatics (LIPIcs) Series, vol. 3. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 445–456. Freuder, E. 1990. Complexity of k-tree structured constraint satisfaction problems. In Proceedings of the 8th National Conference on Artificial Intelligence. 4–9. Friedgut, E. and Kahn, J. 1998. On the number of copies of a hypergraph in another. Israel Journal of Mathematics 105, 251–256. Gottlob, G., Grohe, M., Musliu, N., Samer, M., and Scarcello, F. 2005. Hypertree decompositions: Structure, algorithms, and applications. In Graph-Theoretic Concepts in Computer Science (WG 2005), D. Kratsch, Ed. Lecture Notes in Computer Science Series, vol. 3787. Springer Berlin / Heidelberg, 1–15. Gottlob, G., Lee, S. T., Valiant, G., and Valiant, P. 2012. Size and treewidth bounds for conjunctive queries. J. ACM 59, 3, 16:1–16:35. Gottlob, G., Leone, N., and Scarcello, F. 2000. A comparison of structural CSP decomposition meth- ods. Artif. Intell. 124, 2, 243–282. Gottlob, G., Leone, N., and Scarcello, F. 2002. Hypertree decompositions and tractable queries. Jour- nal of Computer and System Sciences 64, 579–627. Gottlob, G., Leone, N., and Scarcello, F. 2003. Robbers, marshals, and guards: Game theoretic and logical characterizations of hypertree width. Journal of Computer and System Sciences 66, 775–808. Gottlob, G., Mikl´os, Z., and Schwentick, T. 2009. Generalized hypertree decompositions: NP-hardness and tractable variants. J. ACM 56, 6. Grohe, M. 2007. The complexity of homomorphism and constraint satisfaction problems seen from the other side. J. ACM 54, 1. Grohe, M. and Marx, D. 2006. Constraint solving via fractional edge covers. In Proceedings of the sev- enteenth annual ACM-SIAM symposium on Discrete algorithm (SODA 2006). ACM Press, New York, NY, USA, 289–298. Grohe, M., Schwentick, T., and Segoufin, L. 2001. When is the evaluation of conjunctive queries tractable? In Proceedings of the 33rd ACM Symposium on Theory of Computing (STOC 2001). 657– 666. Impagliazzo, R., Paturi, R., and Zane, F. 2001. Which problems have strongly exponential complexity? J. Comput. System Sci. 63, 4, 512–530. Jeavons, P., Cohen, D. A., and Gyssens, M. 1997. Closure properties of constraints. Journal of the ACM 44, 4, 527–548. Kolaitis, P. and Vardi, M. 1998. Conjunctive-query containment and constraint satisfaction. In Proceed- ings of the 17th ACM Symposium on Principles of Database Systems (PODS 1998). 205–213. Marx, D. 2008. Closest substring problems with small distances. SIAM Journal on Computing 38, 4, 1382–1410. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0. Constraint Solving via Fractional Edge Covers 0:19 Marx, D. 2010a. Approximating fractional hypertree width. ACM Trans. Algorithms 6, 2, 1–17. Marx, D. 2010b. Tractable hypergraph properties for constraint satisfaction and conjunctive queries. In Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC 2010). 735–744. Marx, D. 2011. Tractable structures for constraint satisfaction with truth tables. Theory of Computing Systems 48, 444–464. Ngo, H. Q., Porat, E., R´e, C., and Rudra, A. 2012. Worst-case optimal join algorithms. In Proceedings of the 31st symposium on Principles of Database Systems (PODS 2012). ACM, New York, NY, USA, 37–48. Reed, B. 1997. Tree width and tangles: A new connectivity measure and some applications. In Surveys in Combinatorics, R. Bailey, Ed. LMS Lecture Note Series Series, vol. 241. Cambridge University Press, 87–162. Rhadakrishnan, J. Entropy and counting. Available at http://www.tcs.tifr.res.in/∼jaikumar/mypage.html. Schaefer, T. 1978. The complexity of satisfiability problems. In Proceedings of the 10th ACM Symposium on Theory of Computing (STOC 1978). 216–226. Schrijver, A. 2003. Combinatorial optimization. Polyhedra and efficiency. Algorithms and Combinatorics Series, vol. 24. Springer, Berlin. Seymour, P. and Thomas, R. 1993. Graph searching and a min-max theorem for tree-width. Journal of Combinatorial Theory, Series B 58, 22–33. Yannakakis, M. 1981. Algorithms for acyclic database schemes. In 7th International Conference on Very Large Data Bases (VLDB 1981). 82–94. ACM Transactions on Algorithms, Vol. 0, No. 0, Article 0, Publication date: 0.
1412.2379
2
1412
2015-05-04T04:49:47
An Algorithm for $L_\infty$ Approximation by Step Functions
[ "cs.DS" ]
An algorithm is given for determining an optimal $b$-step approximation of weighted data, where the error is measured with respect to the $L_\infty$ norm. For data presorted by the independent variable the algorithm takes $\Theta(n + \log n \cdot b(1+\log n/b))$ time and $\Theta(n)$ space. This is $\Theta(n \log n)$ in the worst case and $\Theta(n)$ when $b = O(n/\log n \log\log n)$. A minor change determines an optimal reduced isotonic regression in the same time and space bounds, and the algorithm also solves the $k$-center problem for 1-dimensional weighted data.
cs.DS
cs
An Algorithm for L∞ Approximation by Step Functions Quentin F. Stout Computer Science and Engineering University of Michigan Ann Arbor, MI 48109-2121 [email protected] +1 734.763.1518 Abstract An algorithm is given for determining an optimal b-step approximation of weighted data, where the error is measured with respect to the L∞ norm. For data presorted by the independent variable the algorithm takes Θ(n + log n · b(1 + log n/b)) time and Θ(n) space. This is Θ(n log n) in the worst case and Θ(n) when b = O(n/ log n log log n). A minor change determines an optimal reduced isotonic regression in the same time and space bounds, and the algorithm also solves the k-center problem for 1-dimensional weighted data. Keywords: step function approximation; reduced isotonic regression; variable width histogram; weighted k-center; interval tree of bounded envelopes 1 Introduction Step functions are a fundamental form of approximation, arising in variable width histograms, databases, segmentation, approximating sets of planar points, piecewise constant approximations, etc. Here we are interested in L∞ stepwise approximation of weighted data. By weighted data (y, w) on 1 . . . n we mean values (yi, wi), 1 ≤ i ≤ n, where yi is an arbitrary real number and wi (the weight) is a positive real number. For integers i ≤ j let [i : j] denote i . . . j. A function f on [1 : n] is a b-step function iff there are indices j1 = 1 < j2 < . . . < jb+1 = n + 1 and real values Ck, k ∈ [1 : b], such that fi = Ck for i ∈ [jk : jk+1 − 1]. f is an optimal L∞ b-step approximation of (y, w) iff it minimizes the weighted L∞ error, max{wi · fi − yi : i ∈ [1 : n]}, among all b-step functions. Since a step can be split into smaller ones, we do not differentiate between "b steps" and "no more than b steps". Many algorithms have been developed for L∞ b-step regression [2, 3, 4, 5, 6, 8, 9, 11, 12, 13, 14]. The first Θ(n log n) time deterministic algorithms [6, 11] were decidedly impractical, relying on parametric search. A more feasible Θ(n log n) algorithm appeared in [3]. However, the time of these algorithms does not improve when b is small, which is the typical case of interest. We present a faster algorithm that is Θ(n + log n · b(1 + log n/b)) when the data is presorted by independent coordinate. 2 L∞ b-Step Approximation At a high-level overview, our algorithm shares aspects of those in [2, 5, 9], with important differences: 1. Build an interval tree to determine the regression error of an arbitrary interval if it is a single step. 2. Use "search in a sorted matrix" to find the minimal possible error for a b-step approximation. The search uses a feasibility test which is given ǫ and decides if there is a b-step approximation with error ≤ ǫ. If there is such an approximation then the test produces one. We incorporate important improvements to this approach: feasibility tests are used during tree construction, not just during the search; tests do not determine the minimal regression error of an interval, merely that it is sufficiently small or too large; previous searches, except the randomized version in [13], were not search in a sorted matrix; and we exploit the fact that calculations at one stage of the search are related to those of the previous stage. We will show: 1 e r r o r εhigh new εlow old εlow a b y x c regression value essential segment endpoint new ǫlow makes y and c inessential b−1(new ǫlow) < x−1(new ǫlow), hence any regression value in this range has error < new ǫlow and exact value is not needed Figure 1: Downward and upward bounded envelopes Theorem 1 Given weighted data (y, w), sorted by the independent coordinate, and number of steps b, one can determine an optimal L∞ b-step approximation in Θ(n + log n · b(1 + log n/b)) time and Θ(n) space. Given a set (y, w) of weighted values and k ∈ [1 : n], the 1-dimensional weighted k-center problem is to find a set S = {s1, . . . , sk} of real numbers that minimizes max{d(yi, S) : i ∈ [1 : n]}, where d(·, S) is the weighted distance to S, i.e., d(yi, S) = min{wi · yi − sj : j ∈ [1 : k]}. Note that a set S is an optimal k-center iff it is the step values of an optimal L∞ k-step approximation of the values in sorted order. From now on we generally omit mention of "L∞" and "optimal" since they are implied. 2.1 Interval Tree of Bounded Envelopes For a weighted value (y, w), in the y-z plane the error of using z ≥ y as its regression value is given by the ray in the upper half-plane that starts at (y, 0) with slope w. Given a set of weighted data (y, w), its upward error envelope is the topmost sequence of line segments corresponding to all such rays. For each z, it gives the maximum error of using z as the regression value for all points (yi, wi) where z ≥ yi. The downward error envelope uses rays in the upper half-plane starting at (yi, 0) with slope −wi, representing the error of using a regression value ≤ yi. The intersection of the downward and upward error envelopes gives the regression value minimizing the error over the entire set, i.e., the weighted L∞ mean, and its error. To simplify exposition we assume that n is an integral power of 2. A binary interval tree has a root corresponding to the interval [1 : n], its two children correspond to [1 : n/2] and [n/2 +1 : n], their children represent intervals of length n/4, etc. The leaves are [1 : 1], [2 : 2], . . . [n : n]. The intervals corresponding to nodes will be called binary intervals. Some authors [2, 5, 9] used interval trees where each node contains the upward and downward error envelopes of the data in its interval, but most of the envelopes' segments are unnecessary. Let ǫopt be the (unknown) error of an optimal b-step approximation, and suppose bounds ǫlow < ǫopt ≤ ǫhigh are known. Then ǫopt can be determined using only the segments representing errors in (ǫlow, ǫhigh). These will be called essential segments, and they form bounded envelopes. All others, the inessential segments, are discarded. Figure 1 shows how essential segments can become inessential when a better error bound is determined. Initially ǫlow = 0 and ǫhigh = ∞, and the algorithm continually improves these bounds. In our interval tree each node contains its upward and downward bounded envelopes. Throughout, the essential segments are precisely the segments in the standard, unbounded, envelopes that represent errors in (ǫlow, ǫhigh). Thus correctness depends on properties of the standard envelopes, though timing does not. Bounded envelopes are stored as a doubly-linked list ordered by slope. Whenever a node is visited, by starting at both ends, inessential segments (i.e., those with no errors in (ǫlow, ǫhigh)) are discarded. The time is charged to the segments removed, not the search visiting the node. Only Θ(n) segments are ever created, hence the total time to remove inessential ones is Θ(n). Whenever the number of remaining segments is counted the count is only of the essential segments given the current values of ǫlow and ǫhigh. 2 2.2 Feasibility Tests j=1Ij for some k ≥ 1, where each Ij is a binary interval. Then U (S)−1(ǫ) = mink Given an arbitrary interval let U (S) denote the upward bounded envelope of the data in S, and D(S) the downward bounded envelope. For ǫ ∈ (ǫlow, ǫhigh) the error of making S a single step is <, =, > ǫ iff D(S)−1(ǫ) <, =, > U (S)−1(ǫ) (see Figure 1). Since ǫ ∈ (ǫlow, ǫhigh) this can be calculated as follows: let S = ∪k j=1 U (Ij)−1(ǫ) and D(S)−1(ǫ) = maxk j=1 D(Ij)−1(ǫ). For a binary interval I, to determine U (I)−1(ǫ), and similarly D(I)−1(ǫ), go through the segments of its bounded envelope until the segment r containing ǫ is found. This search alternates back and forth starting at the topmost and bottommost essential segments. This is only performed during a feasibility test, which will result in either the segments above r, or those below r, becoming inessential. Thus the time to find r is at most a constant plus a term linear in the number of segments that become inessential. Here too the linear term is charged to the inessential segments. S (ǫ), and max values used for D−1 Any interval [i : j] can be decomposed into ≤ 2⌊lg(j − i + 1)⌋ + 1 binary intervals where the sizes increase and then decrease, with perhaps two intervals of the same size in the middle. E.g., [2 : 13] = [2 : 2] ∪ [3 : 4] ∪ [5 : 8] ∪ [9 : 12] ∪ [13 : 13]. These can be visited in O(log n) time by a tree traversal starting at the leaf [i : i], moving upward to the least common ancestor of i and j, and then downward to the leaf [j : j]. Suppose, given i and ǫ ∈ (ǫlow, ǫhigh), we want to find the largest j such that the error of making [i : j] a single step is ≤ ǫ. We do this by a traversal to locate j + 1. By incrementally updating the min values to determine U −1 S (ǫ), when moving upward at node p one can determine if j + 1 is in p's subtree (and hence the traversal should start going downward) by using p's envelopes to decide if adding the entire subtree gives an error > ǫ. When moving downward, j + 1 is in p's left subtree iff adding the left subtree gives error > ǫ, otherwise it is in p's right subtree. Not counting the queries of children's envelopes, the nodes visited are the same as those in going from i to j + 1 when j + 1 is known. Given b and ǫ ∈ (ǫlow, ǫhigh), a feasibility test determines if there is a b-step function with regression error ≤ ǫ. This can be accomplished by starting at 1 and determining the largest j1 for which the error of making [1 : j1] a single step is ≤ ǫ, then starting at j1 + 1 and determining the largest j2 for which the error of making [j1 + 1 : j2] a single step is ≤ ǫ, etc. If the bth step is finished before n is reached then ǫ is infeasible, the test stops, and ǫlow = ǫ. Otherwise, ǫ is feasible, the steps have been identified, and ǫhigh = ǫ. To count the number of nodes visited, for each step the traversal visits nodes at a given height at most twice, once moving upward and once moving downward. Thus at any height at most 2b nodes are visited. The top ⌊lg b⌋ levels have a total of Θ(b) nodes. There are ⌈lg n⌉ − ⌊lg b⌋ = Θ(log n/b) lower levels, so in total Θ(b(1 + log n/b)) nodes are visited. Each visit takes Θ(1) time, so this is also the time required. 2.3 Constructing the Tree We reduce the time to construct the interval tree of bounded envelopes by continually shrinking (ǫlow, ǫhigh]. At the end, (ǫlow, ǫhigh] is so small that each bounded envelope is a single segment. See Figure 2. First a feasibility test with ǫ = 0 is performed using only the base level. If it passes then the algorithm is done. Otherwise, set ǫlow = 0, ǫhigh = ∞, and R = ∅. Throughout, R is an unordered multiset containing the errors of all segment endpoints (e.g., the error of the joint endpoint of a and b in Fig. 1) remaining in (ǫlow, ǫhigh). At height 0 each interval is a singleton, with single rays in its upward and downward envelopes for a total of 2n rays. In general, at the end of height h, R < n/2h and the total number of essential segments in the envelopes at height h is < 3n/2h. Moving upward, bounded envelopes from height h are merged to form those at height h + 1, creating < 3n/2h segments and < 2n/2h segment endpoints (the number of segment endpoints is the number of segments minus one per envelope). Add the errors of the segment endpoints to those already in R, resulting in R < 3n/2h. Take the median error in R and do a 3 initialize envelopes of leaf nodes, ǫlow = 0, ǫhigh = ∞, R = ∅ for h=1 to lg n {h is height} for every binary interval I at height h, make I's envelopes by merging children's envelopes, and add any segment endpoint errors in (ǫlow, ǫhigh) to R repeat 3 times {reducing R to < n/2h and total essential segments at height h < 3n/2h} feasibility test using median of remaining essential segment endpoint errors in R do 2 more feasibility tests, reducing R to ∅, i.e., all envelopes are single essential segments Figure 2: Constructing the Tree of Bounded Envelopes, Feasibility Tests Continually Shrink (ǫlow, ǫhigh] feasibility test. Depending on the outcome, one of ǫlow and ǫhigh is adjusted and 1/2 the entries in R can be eliminated. Doing this 3 times results in R < n/2h+1. The number of essential segments is ≤ R+ 1 per envelope (since R included segment endpoints at level h + 1), and hence is < 3n/2h+1. When the top is finished R ≤ 2 and 2 feasibility tests are used to eliminate the remaining endpoint errors, i.e., at every node of the interval tree the upward and downward bounded envelopes have only one segment. Complete the tree construction by removing all inessential segments, taking Θ(n) time. Feasibility tests during tree construction have a slight change from standard traversals in that when height h is being constructed, when the test's traversals reach height h they go sideways, not upwards, from one node to the next since nodes at higher levels haven't yet been constructed. This increases the total number of nodes visited per test by at most n/2h. Since only 3 tests are done per height (see Figure 2), this adds Θ(n) total time over all heights. Thus the total time to construct the tree is Θ(n + log n · b(1 + log n/b)). 2.4 Search for Minimal Feasible Error The L∞ error of a stepwise approximation is the maximum of the L∞ errors of its steps, thus there is an interval [i : j] such that the error of an optimal b-step approximation is the error of using the weighted L∞ mean as the step value on [i : j]. Thus searching through such errors can determine the minimal feasible error. "Parametric search" was used in [6, 11] but this is only of theoretical interest since parametric search is completely impractical, involving very complex data structures and quite large constants. Search in a sorted matrix provides a practical approach [7]. Let E be the n × n matrix where E(i, j) is the error of using the L∞ mean on [i : j] if i ≤ j, and is 0 if i > j. E is not actually created, but serves as a conceptual guide. Few of its entries are ever determined. Its rows are nondecreasing and the columns are nonincreasing, so for any submatrix its largest entry is in the upper right and the smallest is in the lower left. The algorithm has stages 0 . . . lg n − 1, where at the start of stage s there is a collection of disjoint square submatrices of size n/2s. Stage 0 starts with all of E. At each stage, divide each of the matrices into quadrants, and let ǫ1 be a median of the smallest value from each quadrant and ǫ2 a median of their largest values. Values determined to be outside (ǫlow, ǫhigh), as in Figure 1, are not calculated exactly and are set to ǫlow − 1 or ǫhigh + 1, as appropriate. Feasibility tests for ǫ1 and ǫ2 are done, resulting in improvements to ǫlow and/or ǫhigh. Quadrants with smallest value ≥ ǫhigh, or largest value ≤ ǫlow, are eliminated. The remaining quadrants are the matrices that start the next stage. Note that if ǫopt < ǫhigh then any quadrant with an entry of ǫopt is not eliminated, hence at the end of each stage, either ǫopt = ǫhigh or one of the entries in the remaining submatrices is ǫopt. After the last stage the remaining matrices are 1 × 1 and a standard binary search on these values is used to finish the determination of ǫopt. The search uses Θ(log n) feasibility tests, and the less obvious fact, proven in [7], is that only Θ(n) entries of E are evaluated. 4 E(I,J): intervals with one endpoint in I, other in J, gap is K I K J I1 I2 a b quadrant E(I , J )11 J1 2J c d smallest entry in E(I , J ): E(b, c) largest entry in E(I , J ): 1 1 1 1 E(a, d) : one endpoint in I , other in J , gap is K I ∪ 1 1 2 Figure 3: Evaluating smallest, largest entries in E(I1, J1) using gap from E(I, J) 2.5 Evaluating E During The Search For intervals I, J ⊆ [1 : n] let E(I, J) denote the submatrix {E(i, j) : i ∈ I, j ∈ J}, i.e., the submatrix corresponding to intervals starting at some i ∈ I and ending at some j ∈ J. At the start of stage s of the search there is a collection of submatrices of the form E(I, J) for binary intervals I, J of size n/2s. Either I = J, or I is to the left of J and there is a (perhaps empty) gap between them with length an integral multiple of n/2s (K in Figure 3). During stage s, the quadrants of E(I, J) are formed by cutting I and J in half into I1, I2 and J1, J2, respectively, creating quadrants E(I1, J1), E(I1, J2), E(I2, J1), and E(I2, J2). The smallest and largest value in each quadrant needs to be determined, and as Figure 3 shows, one can evaluate the smallest entry in E(I1, J1) (i.e., E(b, c)), by using the envelopes from K and the binary intervals [b : b], I2, and [c : c]. The largest entry in the quadrant, E(a, d), uses envelopes from K and the binary intervals I and J1. Similar results hold for all of the other quadrants of E(I, J). Exact values for entries outside (ǫlow, ǫhigh] are irrelevant and ǫlow − 1 or ǫhigh + 1 is used, as appropriate. The bounded envelopes for gap K are associated with E(I, J), and if, say, E(I1, J1) is kept for stage s+1 then the envelopes for I2∪K are associated with it. Just as for the tree construction, as search in a sorted matrix is proceeding the number of segments in the gap envelopes is reduced by interleaving feasibility tests based on the segment endpoint errors with tests for the basic search. At the end of stage s each gap envelope is copied at most 4 times, and each quadrant passed on to the next level adds ≤ 3 binary intervals which have envelopes that are only single segments. As shown in [7] there are ≤ 2s+3 − 1 such quadrants, so by using 2 additional feasibility tests at each stage the total number of segments in the bounded envelopes at stage s is O(2s). Since the time to evaluate an entry of E is linear in the number of segments involved, the total time to evaluate entries of E over all stages of the algorithm is Θ(n), and the total time of the Θ(log n) feasibility tests is Θ(log n · b(1 + log n/b)) plus the Θ(n) time to remove inessential segments. This completes the proof of Theorem 1. 3 Final Comments We have shown how to find an L∞ b-step approximation of weighted data, presorted by its independent coordinate, in Θ(n + log n · b(1 + log n/b)) time. No previous algorithm [2, 3, 4, 5, 6, 8, 9, 11, 12, 13, 14] was o(n log n) whenever b = o(n), nor Θ(n) whenever b = O(n/ log n log log n). For sorted data the algorithm solves the 1-dimensional weighted k-center problem in the same time. With a small change the algorithm also produces a "reduced isotonic" b-step function. f is an isotonic function iff f (1) ≤ f (2) ≤ . . . ≤ f (n), and is an optimal L∞ b-step reduced isotonic regression of (y, w) iff it minimizes the L∞ error among all isotonic b-step functions. Isotonic regression is an important form of nonparametric regression that allows researchers to replace parametric assumptions with weaker shape 5 constraints [1, 15]. Some researchers were concerned that it can overfit the data and/or be too compli- cated [10, 16, 17] and resorted to reduced isotonic regression. However, they used approximations because previous exact algorithms were too slow. Merely changing the feasibility test to insure increasing steps finds b-step reduced isotonic regression in the same time bounds as b-step approximation. Acknowledgement: Research partially supported by NSF grant CDI-1027192 References [1] Barlow, RE, Bartholomew, DJ, Bremner, JM, and Brunk, HD, Statistical Inference Under Order Re- strictions: The Theory and Application of Isotonic Regression, John Wiley, 1972. [2] Chen, DZ and Wang, H, "Approximating points by a piecewise linear function", Algorithmica 66 (2013), pp. 682 -- 713. [3] Chen, DZ and Wang, H, "A note on searching line arrangements and applications", Info. Proc. Let. 113 (2013), pp. 518 -- 521. [4] D´ıaz-B´annez, JM and Mesa, JA, "Fitting rectilinear polygonal curves to a set of points in the plane", Eur. J. Operational Res. 130 (2001), pp. 214 -- 222. [5] Fournier, H and Vigneron, A, "Fitting a step function to a point set", Algor. 60 (2011), pp. 95 -- 109. [6] Fournier, H and Vigneron, A, "A deterministic algorithm for fitting a step function to a weighted point- set", Info. Proc. Let. 113 (2013), pp. 51 -- 54. [7] Frederickson, G and Johnson, D, "Generalized selection and ranking: Sorted matrices", SIAM J. Comp. 13 (1984), pp. 14 -- 30. [8] Fulop, J and Prill, M, "On the minimax approximation in the class of the univariate piecewise constant functions", Oper. Res. Let. 12 (1992), pp. 307 -- 312. [9] Guha, S and Shim, K, "A note on linear time algorithms for maximum error histograms", IEEE Trans. Knowledge and Data Engin. 19 (2007), pp. 993 -- 997. [10] Haiminen, N, Gionis, A, and Laasonen, K, "Algorithms for unimodal segmentation with applications to unimodality detection", Knowl. Info. Sys. 14 (2008), pp. 39 -- 57. [11] Hardwick, J and Stout, QF, "Optimal reduced isotonic reduction", Proc. Interface 2012. [12] Karras, P, Sacharidis, D., and Mamoulis, N, "Exploiting duality in summarization with deterministic guarantees", Proc. Int'l. Conf. Knowledge Discovery and Data Mining (KDD) (2007), pp. 380 -- 389. [13] Liu, J-Y, "A randomized algorithm for weighted approximation of points by a step function", COCOA 1 (2010), pp. 300 -- 308. [14] Mayster, Y and Lopez, MA, "Approximating a set of points by a step function", J. Vis. Commun. Image R. 17 (2006), pp. 1178 -- 1189. [15] Robertson, T, Wright, FT, and Dykstra, RL, Order Restricted Statistical Inference, Wiley, 1988. [16] Salanti, G and Ulm, K, "A nonparametric changepoint model for stratifying continuous variables under order restrictions and binary outcome", Stat. Methods Med. Res. 12 (2003), pp. 351 -- 367. [17] Schell, MJ and Singh, B, "The reduced monotonic regression method", J. Amer. Stat. Assoc. 92 (1997), pp. 128 -- 135. 6
1009.3502
1
1009
2010-09-17T20:25:56
Simultaneous Interval Graphs
[ "cs.DS" ]
In a recent paper, we introduced the simultaneous representation problem (defined for any graph class C) and studied the problem for chordal, comparability and permutation graphs. For interval graphs, the problem is defined as follows. Two interval graphs G_1 and G_2, sharing some vertices I (and the corresponding induced edges), are said to be `simultaneous interval graphs' if there exist interval representations R_1 and R_2 of G_1 and G_2, such that any vertex of I is mapped to the same interval in both R_1 and R_2. Equivalently, G_1 and G_2 are simultaneous interval graphs if there exist edges E' between G_1-I and G_2-I such that G_1 \cup G_2 \cup E' is an interval graph. Simultaneous representation problems are related to simultaneous planar embeddings, and have applications in any situation where it is desirable to consistently represent two related graphs, for example: interval graphs capturing overlaps of DNA fragments of two similar organisms; or graphs connected in time, where one is an updated version of the other. In this paper we give an O(n^2*logn) time algorithm for recognizing simultaneous interval graphs,where n = |G_1 \cup G_2|. This result complements the polynomial time algorithms for recognizing probe interval graphs and provides an efficient algorithm for the interval graph sandwich problem for the special case where the set of optional edges induce a complete bipartite graph.
cs.DS
cs
Simultaneous Interval graphs Krishnam Raju Jampani ∗ Anna Lubiw † 0 1 0 2 p e S 7 1 ] S D . s c [ 1 v 2 0 5 3 . 9 0 0 1 : v i X r a Abstract In a recent paper, we introduced the simultaneous representation problem (defined for any graph class C) and studied the problem for chordal, comparability and permutation graphs. For interval graphs, the problem is defined as follows. Two interval graphs G1 and G2, sharing some vertices I (and the corresponding induced edges), are said to be "simultaneous interval graphs" if there exist interval representations R1 and R2 of G1 and G2, such that any vertex of I is mapped to the same interval in both R1 and R2. Equivalently, G1 and G2 are simultaneous interval graphs if there exist edges E ′ between G1 − I and G2 − I such that G1 ∪ G2 ∪ E ′ is an interval graph. Simultaneous representation problems are related to simultaneous planar embeddings, and have applications in any situation where it is desirable to consistently represent two related graphs, for example: interval graphs capturing overlaps of DNA fragments of two similar organisms; or graphs connected in time, where one is an updated version of the other. In this paper we give an O(n2log n) time algorithm for recognizing simultaneous interval graphs, where n = G1 ∪ G2. This result complements the polynomial time algorithms for recognizing probe interval graphs and provides an efficient algorithm for the interval graph sandwich problem for the spe- cial case where the set of optional edges induce a complete bipartite graph. Keywords: Simultaneous Graphs, Interval Graphs, Graph Sandwich Problem, Probe Graphs, PQ-trees 1 Introduction Let C be any intersection graph class (such as interval graphs or chordal graphs) and let G1 and G2 be two graphs in C, sharing some vertices I and the edges induced by I. G1 and G2 are said to be simultaneously representable C graphs or simultaneous C graphs if there exist intersection representations R1 and R2 of G1 and G2 such that any vertex of I is represented by the same object in both R1 and R2. The simultaneous representation problem for class C asks whether G1 and G2 are simultaneous C graphs. For example, Figures 1(a) and 1(b) show two simultaneous interval graphs and their interval representations with the property that vertices common to both graphs are assigned to the same interval. Figure 1(c) shows two interval graphs that are not simultaneous interval graphs. Simultaneous representation problems were introduced by us in a recent paper [9] and have application in any situation where two related graphs should be represented consistently. A main instance is for temporal relationships, where an old graph and a new graph share some common parts. Pairs of related graphs also arise in many other situations, e.g: two social networks that share some members; overlap graphs of DNA fragments of two similar organisms, etc. ∗David R. Cheriton School of Computer Science, University of Waterloo, Email:[email protected] †David R. Cheriton School of Computer Science, University of Waterloo, Email:[email protected] 1 e d G1 f G2 a b c (a) e a d c b f (b) e d G1 f G2 a b c (c) Figure 1: Graphs in (a) are simultaneous interval graphs as shown by the representations in (b). Graphs in (c) are not simultaneous interval graphs. Simultaneous representations are related to simultaneous planar embeddings: two graphs that share some vertices and edges (not necessarily induced) have a simultaneous geometric embedding [3] if they have planar straight-line drawings in which the common vertices are represented by common points. Thus edges may cross, but only if they are in different graphs. Deciding if two graphs have a simultaneous geometric embedding is NP-Hard [4]. In [9], we showed that the simultaneous representation problem can be solved efficiently for chordal, comparability and permutation graphs. We also showed that for any intersection class C, the simultaneous representation problem for G1 and G2 is equivalent to the following problem: Do there exist edges E′ between G1 − I and G2 − I so that the augmented graph G1 ∪ G2 ∪ E′ belongs to class C. The graph sandwich problem [7] is a more general augmentation problem defined for any graph class C: given graphs H1 = (V, E1) and H2 = (V, E2), is there a set E of edges with E1 ⊆ E ⊆ E2 so that the graph G = (V, E) belongs to class C. This problem has a wealth of applications but is NP-complete for interval graphs, comparability graphs, and permutation graphs [7]. The simultaneous representation problem (for class C) is the special case of the graph sandwich problem (for C) where E2 − E1 forms a complete bipartite subgraph. A related special case where E2 − E1 forms a clique is the problem of recognizing probe graphs: a graph G with a specified independent set N is a probe graph for class C if there exist edges E′ ⊆ N × N so that the augmented graph G ∪ E′ belongs to class C. Probe graphs have several applications [13, 8] and have received much attention recently. The first polynomial-time algorithm for recognizing probe interval graphs was due to Johnson and Spinrad [10]. They used a variant of PQ-trees and achieved a run-time of O(n2). Techniques from modular decomposition provided more speed up [12], but the most recent algorithm by McConnell and Nussbaum [11] reverts to PQ-trees and achieves linear time. We note that there has also been work [14] on a concept of simultaneous intersection called "polysemy" where two graphs are represented as intersections of sets and their complements. In this paper, we give an O(n2log n) algorithm for solving the simultaneous representation problem for interval graphs. We use PQ-trees, which were developed by Booth and Lueker for the original linear time interval graph recognition algorithm. They used a PQ-tree to capture the orderings of the maximal cliques of the graph (see [6] for an introduction to interval graphs and PQ-trees). In the probe interval recognition problem, there is a single PQ-tree (of the graph induced by the probes) and a set of constraints imposed by the non-probes. However in our situation we have two PQ-trees, one for each graph, that we want to re-order to "match" on the common vertex set I. We begin by "reducing" each PQ-tree to contain only vertices from I. This results in PQ-trees that store non-maximal cliques, and our task is to modify each PQ-tree by inserting non-maximal cliques from the other tree while re-ordering the trees to make them the same. 2 2 Reduction to PQ-trees In this section we transform the simultaneous interval graph problem to a problem about "compatibility" of two PQ-trees arising from the two graphs. Recall that an interval graph is defined to be the intersection graph of intervals on the real line. For any point on the line, the intervals containing that point form a clique in the graph. This leads to the fundamental one-to-one correspondence between the interval representations of an interval graph and its clique orderings, defined as follows: A clique ordering of G is a sequence of (possibly empty) cliques S = Q1, Q2, · · · , Ql that contains all the maximal cliques of G and has the property that for each vertex v, the cliques in S that contain v appear consecutively. Note that we allow cliques to be empty. The standard interval graph recognition algorithm attempts to find a clique order of the maximal cliques of a graph by making the maximal cliques into leaves of a PQ-tree, and imposing PQ-tree constraints to ensure that the cliques containing each vertex v appear consecutively. This structure is called the PQ-tree of the graph. Note that the children of a P-node may be reordered arbitrarily and the children of a Q-node may only be reversed. We consider a node with 2 children to be a Q-node. In the figures, we use a circle to denote a P-node and a rectangle to denote a Q-node. A leaf-order of a PQ-tree is the order in which its leaves are visited in an in-order traversal of the tree, after children of P and Q-nodes are re-ordered as just described. Note that ignoring non-maximal cliques is fine for recognizing interval graphs; for our purposes, however, we want to consider clique orders and PQ-trees that may include non-maximal cliques. We say that a PQ- tree whose leaves correspond to cliques of a graph is valid if for each of its leaf orderings and for each vertex v, the cliques containing v appear consecutively. Let S = Q1, Q2, · · · , Ql be a clique ordering of interval graph G and let the maximal cliques of G be Qi1 , Qi2 , · · · , Qim (appearing in positions i1 < i2 < · · · < im respectively). Note that all the cliques in S between Qij and Qij+1 contain B = Qij ∩ Qij+1. We say that B is the boundary clique or boundary between Qij and Qij+1. Note that B may not necessarily be present in S. The sequence of cliques between Qij and Qij+1 that are subsets of Qij is said to be the right tail of Qij . The left tail of Qij+1 is defined analogously. Observe that the left tail of a clique forms an increasing sequence and the right tail forms a decreasing sequence (w.r.t set inclusion). Also note that all the cliques that precede Qi1 are subsets of Qi1 and this sequence is called the left tail of Qi1 and all the cliques that succeed Qim are subsets of Qim and this sequence is called the right tail of Qim. Thus any clique ordering of G consists of a sequence of maximal cliques, with each maximal clique containing a (possibly empty) left and right tail of subcliques. Let Q0 and Ql+1 be defined to be empty sets. An insertion of clique Q′ between Qi and Qi+1 (for some i ∈ {0, · · · , l}) is said to be a subclique insertion if Q′ ⊇ Qi ∩ Qi+1 and either Q′ ⊆ Qi or Q′ ⊆ Qi+1. It is clear that after a subclique insertion the resulting sequence is still a clique ordering of G. A clique ordering S ′ is an extension of S if S ′ can be obtained from S by subclique insertions. We also say that S extends to S ′. Furthermore, we say that a clique ordering is generated by a PQ-tree, if it can be obtained from a leaf order of the PQ-tree with subclique insertions. The above definitions yield the following Lemma. Lemma 1. A sequence of cliques S is a clique ordering of G if and only if S can be generated from the PQ-tree of G. Let G1 and G2 be two interval graphs sharing a vertex set I (i.e. I = V (G1) ∩ V (G2)) and its induced edges. Note that G1[I] is isomorphic to G2[I]. A clique ordering of G1[I] is said to be an I-ordering. The I-restricted PQ-tree of Gj is defined to be the tree obtained from the PQ-tree of Gj by replacing each clique Q (a leaf of the PQ-tree) with the clique Q ∩ I. Thus there is a one-to-one correspondence between the two PQ-trees, and the leaves of the I-restricted PQ-tree are cliques of G1[I]. 3 Let I = X1, X2, · · · , Xl be an I-ordering. I is said to be Gj-expandable if there exists a clique ordering O = Q1, Q2, · · · , Ql of Gj such that Xi ⊆ Qi for i ∈ {1, · · · , l}. Further, we say that I expands to O. By the definition of clique-ordering it follows that, if I is Gj-expandable then it remains Gj-expandable after a subclique insertion (i.e. any extension of I is also Gj-expandable). We first observe the following. Lemma 2. The set of Gj-expandable I-orderings is same as the set of orderings that can be generated from the I-restricted PQ-tree of Gj. Proof. Let T be the PQ-tree of Gj and T ′ be the I-restricted PQ-tree of Gj. Let I be a Gj-expandable I-ordering of Gj. Then there exists a clique ordering O of Gj such that I expands to O. But by Lemma 1, O can be generated from T (from a leaf order with subclique inser- tions). This in turn implies that I can be generated from T ′ (from the corresponding leaf order with the corresponding subclique insertions). Now for the other direction, let I ′ = X1, · · · , Xl be any leaf order of T ′. Then there exists a corre- sponding leaf order O′ = Q1, · · · , Ql of T such that Xi ⊆ Qi for i ∈ {1, · · · , l}. This implies that I ′ is a Gj-expandable I-ordering. Finally, observe that if I ′′ is generated from I ′ by subclique insertions than I ′′ is also a Gj-expandable I-ordering. Thus the Lemma holds. Two I-orderings I1 and I2 are said to be compatible if both I1 and I2 (separately) extend to a common I- ordering I. For e.g. the ordering {1}, {1, 2}, {1, 2, 3, 4} is compatible with the ordering {1}, {1, 2, 3}, {1, 2, 3, 4}, as they both extend to the common ordering: {1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}. Note that the compatibility relation is not transitive. Two PQ-trees T1 and T2 are said to be compatible if there exist orderings O1 and O2 generated from T1 and T2 (respectively) such that O1 is compatible with O2. The following Lemma is our main tool. Lemma 3. G1 and G2 are simultaneous interval graphs if and only if the I-restricted PQ-tree of G1 is compatible with the I-restricted PQ-tree of G2. Proof. By Lemma 2, it is enough to show that G1 and G2 are simultaneous interval graphs if and only if there exists a G1-expandable I-ordering I1 and a G2-expandable I-ordering I2 such that I1 is compatible with I2. We now show this claim. Let I1 and I2 be as defined in the hypothesis. Since I1 and I2 are compatible, they can be extended to a common I-ordering I. Let I expand to clique orderings O1 and O2 in G1 and G2 respectively. Since each vertex of I appears in the same positions in both O1 and O2, it is possible to obtain interval representations R1 and R2 of G1 and G2 (from O1 and O2 respectively) such that each vertex in I has the same end points in both R1 and R2. This implies that G1 and G2 are simultaneous interval graphs. For the other direction, let G1 and G2 be simultaneous interval graphs. Then there exists an augmenting set of edges A′ ⊆ V1 − I × V2 − I such that G = G1 ∪ G2 ∪ A′ is an interval graph. Let O = Q1, Q2, · · · , Ql be a clique-ordering of G. For each i ∈ {1, · · · , l} and j ∈ {1, 2}, by restricting Qi to Vj (i.e. replacing Qi with Qi ∩ Vj), we obtain a clique ordering Oj of Gj. Now for j ∈ 1, 2, let Ij be the I-ordering obtained from Oj by restricting each clique in Oj to I. It follows that I1 is a G1-expandable I-ordering and I2 is a G2-expandable I-ordering. Further I1 = I2 and hence I1 and I2 are compatible. Our algorithm will decide if the I-restricted PQ-tree of G1 is compatible with the I-restricted PQ-tree of G2. We first show how the I-restricted PQ-trees can be simplified in several ways. Two I-orderings I1 and I2 are said to be equivalent if for any I-ordering I ′, I1 and I ′ are compatible if and only if I2 and I ′ are compatible. Note that this is an equivalence relation. The Lemma below follows directly from the definitions of equivalent orderings and subclique insertions. 4 Lemma 4. Let I = X1, X2, · · · , Xl be an I-ordering in which Xi = Xi+1 for some i ∈ 1, · · · , l − 1. Let I ′ be the I-ordering obtained from I by deleting Xi+1. Then I is equivalent to I ′. Further, because equivalence is transitive, Lemma 4 implies that an I-ordering I is equivalent to the I-ordering I ′ in which all consecutive duplicates are eliminated. This allows us to simplify the I-restricted PQ-tree of Gj. Let T be the I-restricted PQ-tree of Gj. We obtain a PQ-tree T ′ from T as follows. 1. Initialize T ′ = T . 2. As long as there is a non-leaf node n in T ′ such that all the descendants of n are the same, i.e. they are all duplicates of a single clique X, replace n and the subtree rooted at n by a leaf node representing X. 3. As long as there is a (non-leaf) Q-node n in T ′ with two consecutive child nodes na and nb (among others) such that all the descendants of na and nb are the same i.e. they are all duplicates of a single clique X, replace na, nb and the subtrees rooted at these vertices by a single leaf node representing the clique X. Note that the resulting T ′ is unique. We call T ′ the I-reduced PQ-tree of Gj. Lemma 5. G1 and G2 are simultaneous interval graphs if and only if the I-reduced PQ-tree of G1 is compatible with the I-reduced PQ-tree of G2. Proof. For j ∈ {1, 2}, let Tj and T ′ j be the I-restricted and I-reduced PQ-trees of Gj respectively. Let I be any I-ordering. Observe that by Lemma 4, I is compatible with a leaf ordering of Tj if and only if I is compatible with a leaf ordering of T ′ j. Thus the conclusion follows from Lemma 3. 3 Labeling and Further Simplification In section 2, we transformed the simultaneous interval graph problem to a problem of testing compatibility of two I-reduced PQ-trees where I is the common vertex set of the two graphs. These PQ-trees may have nodes that correspond to non-maximal cliques in I. In this section we prove some basic properties of such I-reduced PQ-trees, and use them to further simplify each tree. Let T be the I-reduced PQ-tree of Gj. Recall that each leaf l of T corresponds to a clique X in Gj[I]. If X is maximal in I, then X is said to be a max-clique and l is said to be a max-clique node, otherwise X is said to be a subclique and l is said to be a subclique node. When the association is clear from the context, we will sometimes refer to a leaf l and its corresponding clique X interchangeably, or interchange the terms "max-clique" and "max-clique node" [resp. subclique and subclique node]. A node of T is said to be an essential node if it is a non-leaf node or if it is a leaf node representing a max-clique. Given a node n of T , the descendant cliques of n are the set of cliques that correspond to the leaf- descendants of n. Because our algorithm operates by inserting subcliques from one tree into the other, we must take care to preserve the validity of a PQ-tree. For this we need to re-structure the tree when we do subclique insertions. The required restructuring will be determined based on the label U (n) that we assign to each node n as follows. U (n) or the Universal set of n is defined as the set of vertices v such that v appears in all descendant cliques of n. Note that for a leaf node l representing a clique X, U (l) = X by definition. Also note that along any path up the tree, the universal sets decrease. The following Lemma gives some useful properties of the I-reduced PQ-tree. 5 Lemma 6. Let T be the I-reduced PQ-tree of Gj. Let n be a non-leaf node of T (n is used in properties 2–6). Then we have: 0. Let l1 and l2 be two distinct leaf nodes of T , containing a vertex t ∈ I. Let y be the least common ancestor of l1 and l2. Then: (a) If y is a P-node then all of its descendant cliques contain t. (b) If y is a Q-node then t is contained in all the descendant cliques of all children of y between (and including) the child of y that is the ancestor of l1 and the child that is the ancestor of l2. 1. Each max-clique is represented by a unique node of T . 2. A vertex u is in U (n) if and only if for every child n1 of n, u ∈ U (n1). 3. n contains a max-clique as a descendant. 4. If n is a P-node, then for any two child nodes n1 and n2 of n, we have U (n) = U (n1) ∩ U (n2). 5. If n is a P-node, then any child of n that is a subclique node represents the clique U (n). 6. If n is a Q-node and n1 and n2 are the first and last child nodes of n then U (n) = U (n1) ∩ U (n2). Proof. (0) Observe that in any leaf ordering of T , all the nodes that appear between l1 and l2 must also contain the vertex t, otherwise T would be invalid. Now let l3 be a leaf descendant of y, that doesn't contain t. If y is a P-node, then we can reorder the children of y in such a way that in the leaf-ordering of the resulting tree l3 appears between l1 and l2. But this contradicts the validity of T . This proves (a). Similarly, if y is a Q-node, then l3 cannot be equal to l1 or l2 or any node between them. Thus (b) also holds. (1) Note that by definition of I-reduced PQ-tree of Gj, each max-clique must be present in T . Now assume for the sake of contradiction that a max-clique X is represented by two leaf nodes, say l1 and l2. Let y be the least common ancestor of l1 and l2. Let c1 and c2 be the child nodes of y that contain n1 and n2 (respectively) as descendants. Now by (0), if y is a P-node then all of its descendant cliques must contain all the vertices of X. But as X is maximal, all these cliques must be precisely X. However this is not possible, as we would have replaced y with a leaf node representing X in the construction of T . Similarly, if y is a Q-node then the descendant cliques of c1, c2 and all the nodes between them must represent the max-clique X. But then we would have replaced these nodes with with a leaf node representing X in the construction of T . This proves (1). (2) If u ∈ U (n), then all the descendant cliques of n contain u. This implies that for any child n1 of n, all the descendant cliques of n1 contain u. Hence u ∈ U (n1). On the other hand, if each child n1 of n contains a vertex u in its universal set, then u is present in all the descendant cliques of n and thus u ∈ U (n). (3) Note that if each descendant clique of n contains precisely U (n) (and no other vertex), then we would have replaced the subtree rooted at n with a leaf node corresponding to the clique U (n), when constructing T . Thus there exists a clique Q2 that is a descendant of n, such that Q2 − U (n) is non-empty. If Q2 is a max-clique then we are done. Otherwise let t ∈ Q2 − U (n) and let Q1 be a max-clique containing t. Suppose Q1 is a not a descendant of n1. Applying (0) on Q1 and Q2, we infer that irrespective of whether n is a P-node or a Q-node, all the descendant cliques of n must contain t. But then t ∈ U (n), a contradiction. Thus Q1 is a descendant of n1. (4) By (2) we observe that U (n) ⊆ U (n1)∩U (n2). Thus it is enough to show that U (n1)∩U (n2) ⊆ U (n). Let u ∈ U (n1) ∩ U (n2), then u is present in all the descendant cliques of n1 and n2. By (0), u must be present in all the descendant cliques of n and hence u ∈ U (n). Therefore U (n1) ∩ U (n2) ⊆ U (n). 6 (5) Consider any child n1 of n. Suppose n1 is a leaf-node and is not a max-clique. It is enough to show that n1 represents the clique U (n) i.e. U (n1) = U (n). Suppose not. Then there exists a vertex t ∈ U (n1) − U (n). Let Q1 be a max-clique containing t. Note that the common ancestor of Q1 and n1 is either n or an ancestor of n. Applying (0) on Q1 and n1, we infer that all the descendant cliques of n must contain t. But then t ∈ U (n), a contradiction. (6) This follows from (2) and (0). Let T be the I-reduced PQ-tree of Gj. Recall that an essential node is a non-leaf node or a leaf node representing a maximal clique. Equivalently (by Lemma 6.3), an essential node is a node which contains a max-clique as a descendant. The following Lemma shows that in some situations we can obtain an equivalent tree by deleting subclique child nodes of a P-node n. Recall that by Lemma 6.5, such subclique nodes represent the clique U (n). Lemma 7. Let T be the I-reduced PQ-tree of Gj and n be a P-node in T . Then 1. If n has at least two essential child nodes, then T is equivalent to the tree T ′, obtained from T by deleting all the subclique children of n. 2. If n has at least two subclique child nodes, then T is equivalent to the tree T ′, obtained from T by deleting all except one of the subclique children of n. Proof. We give the proof of (1) below. The proof of (2) is very similar and hence omitted. Let O1 be any I-ordering. It is enough to show that there exists a leaf ordering O of T that is compatible with O1 if and only if there exists a leaf ordering O′ of T ′ that is compatible with O1. Let O be any leaf ordering of T , compatible with O1. Consider the ordering O′ obtained from O by deleting the cliques U (n) that correspond to the child nodes of n in T . Clearly O′ is a leaf ordering of T ′. Further O′ can be extended to O by adding copies of the cliques U (n) at appropriate positions. Thus O′ is compatible with O1. Now for the other direction, let O′ be a leaf order of T ′, compatible with O1 and let O′ and O1 extend to a common ordering OF . From the hypothesis, we can assume that there exist two essential child nodes n1 and n2 of n in T ′ such that the clique descendants of n1, appear immediately before the clique descendants of n2 in O′. Also let S(n1) and S(n2) be the two subsequences of O′ containing the clique descendants of n1 and n2 respectively. Since n1 and n2 are essential nodes, S(n1) and S(n2) each contain at least one max-clique. Let Q1 be the last max-clique in S(n1) and Q2 be the first max-clique in S(n2). By Lemma 6.0, Q1 ∩ Q2 = U (n1) ∩ U (n2) = U (n). Since O′ is compatible with O1, in each of the two orderings O′ and O1, Q2 occurs after Q1 and no other max-clique appears between them. Further the same holds for OF (as it is an extension of O′). Let k be the number of subclique children of n (that represent the clique U (n)). Then obtain a leaf ordering O of T , from O′, by inserting k copies of U (n) between S(n1) and S(n2). Now extend OF to O′ F by inserting k copies of U (n) between Q1 and Q2 (there is a unique way of adding a subclique between two max-cliques). It is clear that O′ F is an extension of both O and O1. Therefore O is compatible with O1. This proves (1). We will simplify T as much as possible by applying Lemma 7 and by converting nodes with two children into Q-nodes. We call the end result a simplified I-reduced PQ-tree, but continue to use the term "I-reduced PQ-tree" to refer to it. Note that the simplification process does not change the universal sets and preserves the validity of the PQ-tree so Lemma 5 and all the properties given in Lemma 6 still hold. Because we consider nodes with 2 children as Q-nodes Lemma 7 implies: Corollory 1. In a [simplified] I-reduced PQ-tree, any P-node has at least 3 children, and all the children are essential nodes. 7 4 Algorithm For k ∈ {1, 2}, let Tk be the [simplified] I-reduced PQ-tree of Gk. By Lemma 5, testing whether G1 and G2 are simultaneous interval graphs is equivalent to testing whether T1 and T2 are compatible. We test this by modifying T1 and T2 (e.g. inserting the sub-clique nodes from one tree into the other) so as to make them identical, without losing their compatibility. The following is a high level overview of our approach for checking whether T1 and T2 are compatible. Our algorithm is iterative and tries to match essential nodes of T1 with essential nodes of T2 in a bottom-up fashion. An essential node n1 of T1 is matched with an essential node n2 of T2 if and only if the subtrees rooted at n1 and n2 are the same i.e. their essential children are matched, their subclique children are the same and furthermore (in the case of Q-nodes) their child nodes appear in the same order. If n1 is matched with n2 then we consider n1 and n2 to be identical and use the same name (say n1) to refer to either of them. Initially, we match each max-clique node of T1 with the corresponding max-clique node of T2. Note that every max-clique node appears uniquely in each tree by Lemma 6.1. A sub-clique node may appear in only one tree in which case we must first insert it into the other tree. This is done when we consider the parent of the subclique node. In each iteration, we either match an unmatched node u of T1 to an unmatched node v of T2 (which may involve inserting subclique child nodes of v as child nodes of u and vice versa) or we reduce either T1 or T2 without losing their compatibility relationship. Reducing a PQ-tree means restricting it to reduce the number of leaf orderings. Finally, at the end of the algorithm either we have modified T1 and T2 to a "common" tree TI that establishes their compatibility or we conclude that T1 is not compatible with T2. The common tree TI is said to be an intersection tree (of T1 and T2) and has the property that any ordering generated by TI can also be generated by T1 and T2. If T1 and T2 are compatible, there may be several intersection trees of T1 and T2, but our algorithm finds only one of them. We need the following additional notation for the rest of this paper. A sequence of subcliques S = X1, X2, · · · , Xl is said to satisfy the subset property if Xi ⊆ Xi+1 for i ∈ {1, · · · , l − 1}. S is said to satisfy the superset property if Xi ⊇ Xi+1 for each i. Note that S satisfies the subset property if and only if ¯S = Xl, · · · , X2, X1 satisfies the superset property. Let d be an essential child node of a Q-node in Tk. We will overload the term "tail" (previously defined for a max clique in a clique ordering) and define the tails of d as follows. The left tail (resp. right tail) of d is defined as the sequence of subcliques that appear as siblings of d, to the immediate left (resp. right) of d, such that each subclique is a subset of U (d). Note that the left tail of d should satisfy the subset property and the right tail of d should satisfy the superset property (otherwise Tk will not be valid). Also note that since the children of a Q-node can be reversed in order, "left" and "right" are relative to the child ordering of the Q-node. We will be careful to use "left tail" and "right tail" in such a way that this ambiguity does not matter. Now suppose d is a matched node. Then in order to match the parent of d in T1 with the parent of d in T2, our algorithm has to "merge" the tails of d. Let L1 and L2 be two subclique sequences that satisfy the subset property. Then L1 is said to be mergable with L2 if the union of subcliques in L1 and L2 can be arranged into an ordering L′ that satisfies the subset property. Analogously, if L1 and L2 satisfy the superset property, then they are said to be mergable if the union of their subcliques can be arranged into an ordering L′ that satisfies the superset property. In both cases, L′ is said to be the merge of L1 and L2 and is denoted by L1 + L2. A maximal matched node is a node that is matched but whose parent is not matched. For an unmatched essential node x, the MM-descendants of x, denoted by M M D(x) are its descendants that are maximal matched nodes. If x is matched then we define M M D(x) to be the singleton set containing x. Note that the MM-descendants of an essential node is non-empty (since every essential node has a max-clique 8 descendant). Our algorithm matches nodes from the leaves up, and starts by matching the leaves that are max- cliques. As the next node n1 that we try to match, we want an unmatched node whose essential children are already matched. To help us choose between T1 and T2, and also to break ties, we prefer a node with larger U set. Then, as a candidate to match n1 to, we want an unmatched node in the other tree that has some matched children in common with n1. With this intuition in mind, our specific rule is as follows. Among all the unmatched essential nodes of T1 union T2 choose n1 with maximal U (n1), minimal M M D(n1), and maximal depth, in that preference order. Assume without loss of generality that n1 ∈ T1. Select an unmatched node n2 from T2 with maximal U (n2), minimal M M D(n2) and maximal depth (in that order) satisfying the property that M M D(n1) ∩ M M D(n2) 6= ∅. The following Lemma captures certain properties of n1 and n2, including why these rules match our intuitive justification. Lemma 8. For n1 and n2 chosen as described above, let M1 = M M D(n1), M2 = M M D(n2) and X = M1 ∩ M2. Also let C1 and C2 be the essential child nodes of n1 and n2 respectively. Then we have: 1. M1 = C1 and X ⊆ C2. Further when T1 is compatible with T2, we have: 2. For every (matched) node l in M1 − X of T1, its corresponding matched node l′ in T2 is present outside the subtree rooted at n2. Analogously, for every (matched) node r′ in M2 − X of T2, its corresponding matched node r in T1 is present outside the subtree rooted at n1. 3. If n1 [resp. n2] is a Q-node, then in its child ordering, no node of C1 − X [resp. C2 − X] can be present between two nodes of X. 4. If n1 and n2 are Q-nodes, then in the child ordering of n1 and n2, nodes of X appear in the same relative order i.e. for any three nodes x1, x2, x3 ∈ X, x1 appears between x2 and x3 in the child ordering of n1 if and only if x1 also appears between x2 and x3 in the child ordering of n2. 5. If C1 − X (resp.C2 − X) is non-empty then U (n1) ⊆ U (n2) (resp. U (n2) ⊆ U (n1)). Further, if C1 − X is non-empty then so is C2 − X and hence U (n1) = U (n2). 6. Let C1 − X be non-empty. If n1 [resp. n2] is a Q-node, then in its child-ordering either all nodes of C1 − X [resp. C2 − X] appear before the nodes of X or they all appear after the nodes of X. Proof. (1) If there exists an unmatched child c of n1, then as U (c) ⊇ U (n1), M M D(c) ⊆ M M D(n1) and c has a greater depth than n1, we would have chosen c over n1. Thus every node in C1 is matched and hence by the definition of MM-descendants C1 = M1. For the second part, suppose there exists a node x ∈ X that is not a child of n2. Let c2 be the child of n2 that contains x as a descendant. c2 must be an unmatched node. (Otherwise M M D(n2) would have contained c2 and not x). But then we would have picked c2 over n2. (2) Let l be a (matched) node in M1 − X (in T1) such that the corresponding matched node l′ in T2 is a descendant of n2. Note that l′ cannot be a child of n2. Otherwise l′ ∈ M2 and thus l = l′ is in X. Let p′ be the parent of l′. Now p′ cannot be a matched node. (Otherwise p′ would have been matched to n1, a contradiction that n1 is unmatched). Also p′ is a descendant of n2 and hence U (p′) ⊇ U (n2), M M D(p′) ⊆ M M D(n2) and p′ has greater depth than n2. Further l = l′ is a common MM-descendant of n1 and p′. This contradicts the choice of n2. Now let r′ be a (matched) node in M2 − X (in T2), such that the corresponding matched node r is a descendant of n1. Note that r is not a child of n1, otherwise r = r′ is a common MM-descendant of n1 and n2 and hence r′ = r ∈ X. Let p be the parent of r in T1. Since p is a proper descendant of n1, p is a matched node. Let p be matched to a node p′ in T2. Now p′ is a parent of r′ and a descendant of n2. But then the MM-descendants of n2 should not have contained r′. 9 (3) Suppose in the child ordering of n1, node y ∈ C1 − X is present between nodes xa ∈ X and xb ∈ X. Let Y, Xa and Xb be any max-cliques that are descendants of y, xa and xb respectively. Then in any ordering of T1, Y appears between Xa and Xb. But by (2), the corresponding matched node y′ of y in T2 appears outside the subtree rooted at n2. Thus in any ordering of T2, Y appears either before or after both Xa and Xb. Thus T1 and T2 are not compatible. This shows the claim for n1. The proof for n2 is similar. (4) This follows from the fact that T1 and T2 are compatible and by observing that each matched node (in particular any node in X) contains a max-clique as a descendant. (5) Let xa ∈ X be a common child of n1 and n2. Let Xa be a max-clique descendant of xa. Suppose C1 − X is non-empty. Then let Ya be any max-clique descendant of a node in C1 − X. Note that by (2), Ya is present outside the subtree rooted at n2. Now by Lemma 6.0 and observing that the least common ancestor of Xa and Ya (in T2) is an ancestor of n2, we get U (n2) ⊇ Xa ∩ Ya ⊇ U (n1). Thus U (n1) ⊆ U (n2). Using an analogous argument we can show that if C2 − X is non-empty then U (n2) ⊆ U (n1). This proves the first part of the property. For the second part we once again assume that C1 − X is non-empty and hence U (n1) ⊆ U (n2). Now if C2 − X is empty then M M D(n2) = X ⊂ M M D(n1). But this contradicts the choice of n1 (we would have selected n2 instead). (6) By (5), C2 − X is non-empty and U (n1) = U (n2). Let xa ∈ X and suppose ya, yb ∈ C1 − X are any two nodes on different sides of X. Let za ∈ C2 − X. Note that by (2), the matched nodes of ya, yb in T2 appear outside the subtree rooted at n2 and the matched node of za in T1 appears outside the subtree rooted at n1. Now let Xa, Ya, Yb and Za be any descendant max-cliques of xa, ya, yb and za respectively. In any leaf-ordering of T1, Xa appears between Ya and Yb, and Za doesn't appear between Ya and Yb. But in any leaf-ordering of T2, either Za and Xa both appear between Ya and Yb or they both appear before or after Ya and Yb. This contradicts that T1 and T2 are compatible. Therefore all nodes of X appear before or after all nodes of C1 − X in the child ordering of n1. Similarly, the claim also holds for the child ordering of n2 in T2. We now describe the main step of the algorithm. Let n1, n2, M1, M2, C1, C2 and X be as defined in the above Lemma. We have four cases depending on whether n1 and n2 are P or Q-nodes. In each of these cases, we make progress by either matching two previously unmatched essential nodes of T1 and T2 or by reducing T1 and/or T2 at n1 or n2 while preserving their compatibility. We show that our algorithm requires at most O(nlog n) iterations and each iteration takes O(n) time. Thus our algorithm runs in O(n2 log n) time. During the course of the algorithm we may also insert subcliques into a Q-node when we are trying to match it to another Q-node. This is potentially dangerous as it may destroy the validity of the PQ-tree. When the Q-nodes have the same universal set, this trouble does not arise. However, in case the two Q-nodes have different universal sets, we need to re-structure the trees. Case 4, when n1 and n2 are both Q-nodes, has subcases to deal with these complications. Case 1: n1 and n2 are both P-nodes. By Corollary 1, the children of n1 and n2 are essential nodes, so C1 and C2 are precisely the children of n1 and n2 respectively. Let X consist of nodes {x1, · · · , xk0}. If C2 − X is empty, then by Lemma 8.5, C1 − X 10 T1 n1 T2 n2 T1 n1 T2 n2 x1 xk0 x1 xk0 r1 rk2 x1 xk0 l1 lk1 x1 xk0 r1 rk2 n2 n1 n2 n1 r1 rk2 ml m m mr x1 xk0 l1 lk1 x1 xk0 x1 xk0 r1 rk2 (a) C1 − X is empty (b) C1 − X is non-empty Figure 2: Reduction templates for Case 1 is also empty and hence n1 and n2 are the same. So we match n1 with n2 and go to the next iteration. Suppose now that C2 − X is non empty. Let C2 − X = {r1, · · · , rk2}. If C1 − X is empty, then we use the reduction template of Figure 2(a) to modify T2, matching the new parent of X in T2 to n1. It is easy to see that T1 is compatible with T2 if and only if T1 is compatible with the modified T2. 1 and T ′ Now let C1 − X = {l1, · · · , lk1} be non-empty. In this case we use the reduction template of Figure 2(b) to modify T1 and T2 to T ′ 2 respectively. Note that it is possible to have ki = 1 for some i's, in which case the template is slightly different because we do not make a node with one child, however, the reduction always makes progress as each ni has at least 3 children. We now claim that T1 is compatible with T2 if and only if T ′ 2 . The reverse direction is trivial. For the forward direction, let O1 and O2 be two compatible leaf orderings of T1 and T2 respectively. Recall that by Lemma 8.2, for every [matched] node of C1 − X in T1, the corresponding matched node in T2 appears outside the subtree rooted at n2. This implies that the descendant nodes of {x1, x2, · · · , xk0} all appear consecutively in O1. Hence the descendant nodes of {x1, x2, · · · , xk0} also appear consecutively in O2. Thus we conclude that T1 and T2 are compatible if and only if the reduced trees T ′ 1 is compatible with T ′ 1 and T ′ 2 are also compatible. Note that both the template reductions take at most O(n) time. Case 2: n1 is a P-node and n2 is a Q-node. If C1 − X = ∅, we reduce T1 by ordering the children of n1 as they appear in the child ordering of n2, and changing n1 into a Q-node (and leading to Case 4). This reduction preserves the compatibility of the two trees. Now suppose C1 − X 6= ∅. Lemma 8.5 implies that, C2 − X 6= ∅ and U (n1) = U (n2). By Lemma 8.6, we can assume that the nodes in X appear before the nodes in C2 − X in the child ordering of n2. Now let X = x1, · · · , xk0, C1 − X = l1, · · · , lk1 and C2 − X = r1, · · · , rk2. For i ∈ 2, · · · , k0, let Si be the sequence of subcliques that appear between xi−1 and xi in the child ordering of n2. Note that Si consists of the right tail of xi−1 followed by the left tail of xi. We let S1 and Sk0+1 denote the left and right tails of x1 and xk0 respectively. We now reduce the subtree rooted at n1 as shown in Figure 3, changing it into a Q-node. Clearly U (n1) is preserved in this operation. The correctness of this operation follows by Lemma 11 T1 n1 T2 n2 x1 x2 xk0 l1 lk1 x1 S1 S2 x2 xk0 r1 rk2 Sk0+1 T ′ 1 n1 m x1 S1 S2 x2 xk0 Sk0+1 l1 lk1 Figure 3: Reduction template for Case 2, when C1 − X 6= ∅ 8.2. It is easy to see that both the template reductions run in O(n) time. Case 3: n1 is a Q-node and n2 is a P-node. If C2 − X is empty, then we reduce T2 by ordering the child nodes of n2 (i.e. X) as they appear in the child ordering of n1, and changing n2 into a Q-node. Now let C2 − X be nonempty. By Lemma 8.5, U (n2) ⊆ U (n1). Let X = {x1, x2, · · · , xk0}, C2 − X = {r1, · · · , rk2} and S1, · · · , Sk0+1 be defined as in the previous case: S1 is the left tail of x1 (in T1), Si is the concatenation of the right tail of xi−1 and the left tail of xi, for i ∈ {2, · · · , k0} and Sk0+1 is the right tail of xk0. Now if C1 − X is empty, then we use the template of Figure 4 to reduce T2, grouping all nodes of X into a new Q-node w, ordering them in the way they appear in T1 and inserting the subclique children of n1 into w. Note that since U (n2) ⊆ U (n1), this operation doesn't change U (n2) and hence it preserves the validity of T2. Further n1 is identical to w and hence we match these nodes. Thus we make progress even when X = 1. If C1 − X is non-empty, we use the template similar to Figure 3 (to reduce T2) in which the roles of n1 and n2 have been switched. Note that the template reductions of this case run in O(n) time. Case 4: n1 and n2 are both Q-nodes Let X = {x1, · · · , xk0} appear in that order in the child ordering of n1 and n2. (They appear in the same order because of Lemma 8.4.) Let p1 and p2 be the parents of n1 and n2 respectively. If n1 and n2 have no other children than X, we match n1 with n2 and proceed to the next iteration. More typically, they have other children. These may be essential nodes to one side or the other of X (by Lemma 8.6) or subclique nodes interspersed in X as tails of the nodes of X. We give a high-level outline of Case 4, beginning with a discussion of subclique nodes. For i ∈ {1, · · · , k0}, let Li and Ri be the left and right tails of xi in T1 and, L′ i be the left and right tails of xi in T2. The only way to deal with the subclique nodes is to do subclique insertions in both trees to merge the tails. This is because in any intersection tree TI obtained from T1 and T2, the tails of xi in TI must contain the merge of the tails of xi in T1 and T2. So long as X ≥ 2, the ordering x1, · · · , xk0 i and R′ 12 T1 n1 x1 S1 S2 x2 xk0 Sk0+1 T2 n2 x1 x2 xk0 r1 rk2 n2 w rk2 r1 x1 S1 S2 x2 xk0 Sk0+1 Figure 4: Reduction template for Case 3, when n1 is a Q-node, n2 is a P-node and C1 − X is empty. completely determines which pairs of tails must merge: Li must merge with L′ R′ i. i and Ri must merge with The case X = 1 is more complicated because the intersection tree may merge L1 with L′ 1 and R1 with 1 or merge L1 with ¯R1 and R1 with ¯L1. This decision problem is referred to as the alignment problem. R′ We prove (at the beginning of Case 4.3) that in case both choices give mergable pairs, then either choice yields an intersection tree, if an intersection tree exists. This completes our high-level discussion of subclique nodes. We continue with a high-level description of the subcase structure for Case 4. We have subcases depending on whether U (n1) = U (n2) and whether n1 and n2 have the same essential children. If both these conditions hold, then we merge the tails of the nodes of X and match n1 with n2. (In other words we replace Li and L′ i, and replace Ri and R′ i). The cost of matching any two nodes x and y is (mx + my)I), where mx and my are the number of subclique children of x and y respectively. Once a node is matched its subclique children will not change. Hence the total amortized cost of matching all the nodes is O(n · I) = O(n2). i with Ri + R′ i with Li + L′ When U (n1) 6= U (n2) or when n1 and n2 do not have the same essential children then we have three subcases. Case 4.1 handles the situation when U (n1) 6⊇ U (n2). In this case we either insert subcliques of one tree into another and match n1 with n2 or we do some subclique insertions that will take us to the case when U (n1) ⊇ U (n2). The remaining cases handle the situation when U (n1) ⊇ U (n2), Case 4.2 when C1 − X is non-empty and Case 4.3 when it is empty. In both cases, we reduce T1 but the details vary. However in both cases our reduction templates depend on whether p1 is a P-node or a Q-node. If p1 is a P-node, we reduce T1 by grouping some of the child nodes of p1 into a single node, deleting them and adding the node as a first or last child of n1. If p1 is a Q-node then there are two ways of reducing: delete n1 and reassign its children as children of p1 or reverse the children of n1, delete n1 and reassign its children as children of p1. We refer to this operation as a collapse. We now give the details of each case. Case 4.1: U(n1) 6⊇ U(n2) Since n1 was chosen so that U (n1) is maximal, we also have U (n2) 6⊇ U (n1). Now using Lemma 8.5, we infer that C1 − X is empty and C2 − X is empty. Thus the difference between U (n1) and U (n2) arises due 13 to the subcliques. Let L be a subclique that is either the first or the last child of n1, with the property that L 6⊆ U (n2). Such a subclique exists since by Lemma 6.6, the intersection of the universal sets of the first and last child nodes of n1 is U (n1). Also let R be a subclique that is either the first or the last child of n2, with the property that R 6⊆ U (n1). Note that even if X = 1, the alignment is unique since L and R cannot appear in the same tail of x1 in any intersection tree. Further, we can assume without loss of generality that L is present in the left tail of x1 in T1 and R is present in the right tail of xk0 in T2. Let X1 be any max-clique descendant of x1. If p1 is a P-node then we claim that U (p1) ⊆ U (n2). To see this, let Z be a max-clique descendant of p1, that is not a descendant of n1. In T2, Z appears outside the subtree rooted at n2. Now by applying Lemma 6.0 on X1 and Z, we conclude that every descendant of n2 must contain the vertex set Z ∩ X1. Thus we have U (p1) ⊆ (Z ∩ X1) ⊆ U (n2). Note that if T1 and T2 are compatible, then in any intersection tree of T1 and T2, the nodes of L1 and L′ 1 appear in the left tail of x1 and the nodes of Rk0 and R′ 1 is non-empty, then we insert k0 the left most subclique of L′ 1 into L1 (at the appropriate location so that the resulting sequence is still a subclique ordering), as a child of n1. Also if R′ is non-empty, then we insert the right most subclique of k0 R′ into Rk0, as a child of n1. These insertions change U (n1) to U (n1) ∩ U (n2) ⊇ U (p1) and we would be k0 in case 4.3 with the roles of n1 and n2 being reversed. (Note that since the universal set of the modified n1 is a superset of the universal set of p1, the resulting reduced tree of T1 is valid). Although this doesn't constitute a progress step since the number of leaf orderings of n1 doesn't change, we will make progress in the Case 4.3. appear in the right tail of xk0. Now if L′ Similarly if p2 is a P-node then we insert the first subclique of L1 (if it exists) into L′ 1 and the last subclique of Rk0 (if it exists) into R′ k0 . After this we would be in Case 4.3. Now if the parents of n1 and n2 are both Q-nodes then we look at the tails of n1 and n2. If all the i and Ri and i. This changes U (n1) and U (n2) to U (n1) ∩ U (n2) and makes n1 identical to n2. Thus we subcliques in these tails are subsets of U (n1) ∩ U (n2), then we replace Li and L′ R′ match n1 with n2 and iterate. i with Ri + R′ i with Li + L′ Otherwise without loss of generality let the subclique S 6⊆ U (n2) be present in the (say left) tail of n1. Observe that in any intersection tree S and R cannot be present in the same tail of xk0 (since neither is a subset of the other). This implies that we can reduce the tree T1 by collapsing n1 i.e. by removing n1, inserting the sequence of child nodes of n1 after S (S and L are now in the left tail of x1), and assigning p1 as their parent. This completes case 4.1. Note that all the steps in this case take O(n) time, except the matching step (recall that all the matching steps take O(n2) amortized time). Case 4.2: U(n1) ⊇ U(n2) and C1 − X is non-empty. By Lemma 8.5, C2 − X is also non-empty and further U (n1) is equal to U (n2). In this case we will reduce T1 depending on whether p1 is a P-node or a Q-node. Further when p1 is a Q-node, our reduction template also depends on whether n1 has sibling essential nodes. Let l1, l2, · · · , lk1 be the essential nodes in C1 − X appearing in that order and appearing (without loss of generality) before the nodes of X in T1. Note that by Lemma 8.2, for each node in C1 − X, the corre- sponding matched node in T2 appears outside the subtree rooted at n2. Thus if T1 and T2 are compatible, then all the nodes of C2 − X must appear after the nodes of X in the child ordering of n2. Let these nodes be r1, r2, · · · , rk2. Case 4.2.1: p1 is a P-node Let Y = {y1, y2, · · · , yk3} be the child nodes of p1 other than n1 . Also, let TI be any intersection tree of T1 and T2. We first observe that for i ∈ {1, · · · , k0} and j ∈ {1, · · · , k2}, M M D(yi) ∩ M M D(rj) 6= ∅, if 14 and only if yi and rj have a max-clique descendant. For any such pair yi and rj, let M M D(yi) ∩ M M D(rj) 6= ∅ and let Y be a common max-clique descendant of yi and rj. Then note that because of the constraints imposed by the child ordering of n2, in any leaf ordering of TI , the descendant cliques of l1 do not appear between the descendant cliques of x1 and Y . Thus yi must appear after xk1, and so we reduce T1, by grouping all nodes yi satisfying M M D(yi)∩M M D(rj) 6= ∅ for some rj into a P-node and adding it as a child node of n1 to the (immediate) right of Rk0 as shown in Figure 5(top). Now if M M D(yi) ∩ M M D(rj) = ∅ for all yi and rj, then the above reduction doesn't apply. But in this case (because of the constraints on n2), for every yi and every leaf ordering of TI , no max-clique descendant of yi appears between the max-clique descendants of n2. Thus we group all the nodes of Y into a P-node and add it as a child of n1 to the left of l1 as shown in Figure 5(bottom). Note that for any two distinct nodes ya, yb ∈ {y1, · · · , yk3} we have: M M D(ya) ∩ M M D(yb) = ∅. Similarly, for any two distinct nodes ra, rb ∈ {r1, · · · , rk2} we have: M M D(ra) ∩ M M D(rb) = ∅. This implies that we can first compute the MM-Descendants of all yi and rj in O(n) time and further we can compute all nodes yi that satisfy M M D(yi) ∩ M M D(rj) 6= ∅ for some rj, in O(n) time. Thus the template reductions of Figure 5 run in O(n) time. Case 4.2.2: p1 is a Q-node and n1 is its only essential child. Since the only essential child of p1 is n1, all of its remaining children are subcliques that are present as tails of n1. Thus each of these subcliques is a subset of U (n1). Now let Z and R be any two max-clique descendants of xk0 and r1 respectively. By Lemma 8.2, R appears outside the subtree rooted at n1 (in T1) and hence outside the subtree rooted at p1. By Lemma 6.0, we conclude that each descendant clique of p1 must contain Z ∩ R. Thus we have U (p1) ⊇ Z ∩ R ⊇ U (n2) = U (n1) ⊇ U (p1). Hence all of these sets must be equal and hence we infer the following: Z ∩ R = U (n1) and hence U (xk0) ∩ U (r1) = U (n1). Further, each subclique child of p1 must precisely be the clique U (n1). Since we have eliminated adjacent duplicates from all Q-nodes, there can be at most one such subclique in each tail of n1. Now if the subclique (U (n1)) appears on both sides of n1, then there is a unique way of collapsing n1 (see Figure 6(top)). Otherwise we collapse n1 in such a way that U (n1) is present in the tail of xk0 as shown in Figure 6(bottom). This is justified (i.e. it preserves compatibility between T1 and T2) because U (n1) can be inserted into the right tail of xk0 in both T1 and T2. In other words, if T1 and T2 are compatible, then there exists an intersection tree in which U (n1) is present in the right tail of xk0. The template reductions of this case, clearly run in O(n) time. Case 4.2.3: p1 is a Q-node and has more than one essential child. Let y be an essential child of p1, such that all the nodes between n1 and y are subcliques. Without loss of generality, we assume that y appears to the right of n1. We collapse n1, depending on whether M M D(y) ∩ M M D(r1) is empty or not, as shown in Figure 7. Thus the template reduction runs in O(n) time. If M M D(y) ∩ M M D(r1) is non-empty, there exists a max-clique Y that is a descendant of both r1 and y. Now if T1 and T2 are compatible, then in the leaf ordering of any intersection tree, the max-clique descendants of xk0 appear in between the max-clique descendants of l1 and Y . Thus we collapse the node n1, by deleting n1, and reassigning p1 as the parent of all the children of n1. (Thus no essential node appears between xk0 and y). On the other hand if M M D(y) ∩ M M D(r1) is empty, we observe the following: In the leaf ordering of any intersection tree TI no max-clique appears in between the max-clique descendants of xk0 and the max-clique descendants of r1. Therefore, in this case we collapse n1, by reversing its children, deleting it, 15 T2 n2 x1 x2 xk0 R′ k0 L′ 1 r1 r2 rk2 p1 n1 yk3 yi+1 T1 p1 y1 yk3 yi yi+1 n1 l1 l2 lk1 x1 x2 xk0 L1 Rk0 l1 l2 lk1 x1 x2 xk0 L1 Rk0 y1 yi T1 p1 yk3 y1 n1 p1 l1 l2 lk1 x1 x2 xk0 L1 Rk0 l1 l2 lk1 x1 x2 xk0 L1 Rk0 y1 yk3 Figure 5: Reduction template of T1 for Case 4.2.1. A node ya has horizontal stripes if M M D(ya) ∩ M M D(rb) 6= ∅ for some rb and no stripes otherwise. 16 T1 p1 U (n1) U (n1) n1 p1 l1 lk1 x1 S1 S2 x2 xk0 S ′ 1 Sk0+1 U (n1) S ′ 1 l1 lk1 x1 S1 S2 x2 xk0 U (n1) Sk0+1 T1 p1 U (n1) n1 p1 l1 lk1 x1 S1 S2 x2 xk0 Sk0+1 S ′ 1 l1 lk1 x1 S1 S2 x2 xk0 S ′ 1 U (n1) Sk0+1 Figure 6: Reduction templates of T1 for Case 4.2.2. and reassigning p1 as the parent of all the children of n1. (Thus no essential node appears between l1 and y). Case 4.3: U(n1) ⊇ U(n2) and C1 − X is empty As before we have three cases depending on whether p1 is a P-node or a Q-node and whether p1 has more than one essential child. In each of these cases, when X = 1, we need to first solve the alignment problem (as a preprocessing step). Also when p1 is a Q-node, unlike in Case 4.2, both ways of collapsing n1 may lead to a valid intersection tree. Alignment Problem Recall that when X = 1 (and C1 − X = ∅), the alignment may not be unique i.e. one of the following might happen in the intersection tree TI. 1. Left and right tails of x1 (in TI) contain L1 + L′ 1 and R1 + R′ 1 respectively. 2. Left and right tails of x1 (in TI) contain ¯R1 + L′ 1 and ¯L1 + R′ 1 respectively. If one of the merges in (1) or (2) is invalid, then there is only a single way of aligning the tails, otherwise we show in the following Lemma that if T1 and T2 are compatible, then choosing either one of the two alignments will work. 1, R′ 1, R1 + R′ Lemma 9. Let U (n1) ⊇ U (n2), X = 1 and C1 − X be empty. Let L1, R1 be the left and right tails of x1 in T1 and L′ 1 be the left and right tails of x1 in T2. If both ways of alignment are mergable i.e. (a) L1 + L′ 1 are valid, then there exists an intersection tree TI 1 and R1 + R′ (of T1 and T2) with L1 + L′ 1 contained in the left and right tails of x1 (respectively) if and I with ¯R1 + L′ only if there exists an intersection tree T ′ 1 contained in the left and right tails of x1 (respectively). 1 are valid and (b) ¯R1 + L′ 1 and ¯L1 + R′ 1, ¯L1 + R′ 17 T1 p1 Ep1 Lp Rp y Ep2 n1 T2 n2 l1 lk1 x1 xk0 Rn Ln x1 xk0 r1 rk2 M M D(y) ∩ M M Dr1) 6= ∅ ? YES NO T ′ 1 p1 T ′ 1 p1 Ep1 Lp l1 lk1 x1 xk0 Rn Ln Rp y Ep2 ¯Ep2 y ¯Rp l1 lk1 x1 xk0 Ln ¯Ep1 ¯Lp Rn Figure 7: Reduction template of T1 for Case 4.2.3 Proof. Let L, R be the left and right tails of x1 in an intersection tree TI . Each subclique S in L or R appears as a subclique in T1 or T2. In particular we observe the following: Property 1: If S is a subclique in L or R then in T1 or T2, S is present in a tail of x1 or in a tail of an ancestor of x1. Note that since n contains at least two children, L and R both cannot be empty. If one of them, say L is empty then the last clique in R must be U (n1). If both L and R are non-empty then the intersection of the first subclique of L1 with the last subclique of R1 is U (n1). In either case we observe that, since L1 + L′ 1 is either a superset of U (n1) or a subset of U (n1). Similarly, since R1 + R′ 1 are both valid (superclique orderings), each subclique in R′ 1 is either a superset of U (n1) or a subset of U (n1). Further for any ancestor na of n2, U (na) ⊆ U (n2) ⊆ U (n1) and hence the tails of any such na would consist of subcliques that are subsets of U (n1). Note that this condition also holds for any ancestor of n1 in T1. 1 are both valid (subclique orderings), each subclique in L′ 1 and ¯R1 + L′ 1 and ¯L1 + R′ By above conditions and (1) we infer that for any subclique S in L or R, S is either a superset of U (n1) 1 or 1 and R contains 1, then replacing L with L − L1 + ¯R1 and R with R − R1 + ¯L1 also results in a valid intersection or a subset of U (n1). Furthermore, if S is a superset of U (n1) then it is present in one of L1, R1, L′ R′ R1 + R′ tree. 1. This implies that if there exists an intersection tree TI in which L contains L1 + L′ Note that the amortized cost of doing the mergability checks (a) and (b) of Lemma 9 (over all iterations of the algorithm) is O(n · I) = O(n2). For the rest of the cases, we can assume that L1 is aligned with L2 18 and R1 is aligned with R2. In other words if T1 and T2 are compatible, then there exists an intersection tree that contains L1 + L2 and R1 + R2 as the tails of x1. Case 4.3.1: p1 is a P-node. If C2 − X = ∅, then using the same argument as before (Lemma 6.0), we get U (p1) ⊆ U (n2). Hence we replace Li and L′ i in T1 and T2 changing U (n1) to U (n1) ∩ U (n2) ⊇ U (p1), and we match n1 with n2. i with Li + L′ Now we look at the case when C2 − X is non-empty. Let L = {l1, l2, · · · , lk1} be the set of essential nodes appearing to the left of X and R = {r1, · · · , rk2} be the set of essential nodes appearing to the right of X in T2. Let Y = {y1, · · · , yk3} be all the remaining child nodes of p1 other than n1. For all i ∈ {1, · · · , k3}, if M M D(yi) ∩ M M D(lj) 6= ∅ for some j ∈ {1, · · · , k1}, then yi and lj both have a common max-clique descendant say Y , and further in any leaf order of a common intersection tree L1 + L′ 1 must appear between Y and the descendants of x1. Thus we group all yi such that M M D(yi) ∩ M M D(lj) 6= ∅ into a new P-node and add it to the (immediate) left of L1 (see Figure 8). Similarly, we group all yi such that M M D(yi) ∩ M M D(rj) 6= ∅, for some j ∈ {1, · · · , k2} into a new P-node and add it to the (immediate) right of Rk0. Note that if for some y ∈ Y , there exists li and rj such that both M M D(y)∩M M D(li) and M M D(y)∩ M M D(rj) 6= ∅, then we can conclude that T1 and T2 are incompatible. Also if L and R are both non-empty and for all y ∈ Y , M M D(y) doesn't intersect with any M M D(li) for i ∈ {1, · · · , k1} and with any M M D(rj) for j ∈ {1, · · · , k2} then once again we conclude that T1 and T2 are incompatible. On the other hand if one of L or R is empty, say L, and M M D(yi) ∩ M M D(rj) is empty for all yi ∈ Y and rj ∈ R, then the above template would not reduce T1. But then note that in any leaf-ordering of any intersection tree, L1 + L′ 1 should appear between the descendants of yi and x1 for all yi ∈ Y (because of the constraints imposed by T1 and T2). Hence in this case we group all the nodes of Y into a P-node and add it a child node of p1 to the (immediate) left of L1 as shown in Figure 9. Note that since the MM-Descendents of any two sibling nodes are disjoint, both of the above templates can be implemented in O(n) time. Case 4.3.2: p1 is a Q-node and n1 is its only essential child. Let Lp and Rp be the left and right tails of p1. Note that in this case all the siblings of n1 are subcliques that are present in its tails. We have three subcases depending on how U (p1) intersects U (n2). Suppose U (p1) properly intersects U (n2). We have U (p1) − U (n2) 6= ∅ and U (n2) − U (p1) 6= ∅. We first claim that C2 − X is empty. Suppose not. Let Z be a max-clique descendant of a node in C2 − X and X1 be a max-clique descendant of x1. By Lemma 6.2, in T1, Z appears outside the subtree rooted at n1, and hence outside the subtree rooted at p1. Thus using Lemma 6.0, we conclude that each descendant of p1 must contain all the vertices in Z ∩ X1 ⊇ U (n2). A contradiction. Hence C2 − X is empty. Now by Lemma 6.6, there exists a subclique S1 6⊇ U (n2) such that S1 is the first clique of Lp or the last clique of Rp. Similarly there exists a subclique S2 6⊇ U (p1) such that S1 is the first clique of L′ 1 or the last clique of R′ . Without loss of generality let S1 be the first clique of Lp and S2 be the last clique of k0 R′ . Observe that S1 ⊇ U (p1) and S2 ⊇ U (n2). This implies that S1 and S2 cannot be in the same tail k0 (of x1 or xk0) in any intersection tree of T1 and T2. Thus we reduce T1 by collapsing n1 i.e. by deleting n1, changing the parent of child nodes of n1 to p1 and arranging the child nodes such that Lp appears to the left of L1 and Rp appears to the right of Rk0. Clearly, this reduction can be done in O(n) time. Now we have to deal with the case when either U (n2) ⊆ U (p1) or U (p1) ⊆ U (n2). Note that in any 1 appear in the left tail of x1 and the cliques of intersection tree TI (of T1 and T2), the cliques of L1 + L′ 19 T1 p1 y1 yi yi+1 yj yj+1 yk3 n1 T2 n2 x1 L1 x2 xk0 Rk0 l1 l2 lk1 x1 x2 xk0 R′ k0 L′ 1 r1 r2 rk2 p1 n1 yk3 yj+1 x1 L1 x2 xk0 Rk0 y1 yi yi+1 yi+1 Figure 8: First reduction template of T1 for Case 4.3.1. A node ya has vertical stripes if M M D(ya) ∩ M M D(lb) 6= ∅ for some lb, horizontal stripes if M M D(ya) ∩ M M D(rb) 6= ∅ for some rb and no stripes otherwise. T1 p1 yk3 y1 n1 T2 n2 x1 L1 x2 xk0 Rk0 x1 x2 xk0 R′ k0 L′ 1 r1 r2 rk2 p1 x1 L1 x2 xk0 Rk0 y1 yk3 Figure 9: Second reduction template of T1 for Case 4.3.1. The stripes on the y nodes are defined as before 20 Rk0 + R′ appear in the right tail of xk0. Further either (a) the cliques of Lp appear in the left tail of x1 k0 and the cliques of Rp appear in the right tail of xk0 or (b) the cliques of Lp appear in the right tail of xk0 and the cliques of Rp appear in the left tail of x1. In the first case L1 + L′ + Rp are + ¯Lp are both valid. If neither of these both valid and in the second case L1 + L′ is valid then we conclude that T1 and T2 are incompatible. If exactly one of the above merges is valid, then there is a unique way of collapsing n1. When both of the above merge pairs are valid, we use the reduction template shown in Figure 10. The justification (given below) depends on whether U (n2) ⊆ U (p1) or U (p1) ⊆ U (n2). 1 + ¯Rp and Rk0 + R′ k0 1 + Lp and Rk0 + R′ k0 Let U (n2) ⊆ U (p1). Note that by Lemma 6.6, the intersection of the universal nodes of the first and + ¯Lp are last child nodes of p1 is U (p1). Hence if L1 + L′ all valid then any subclique in L′ is either a superset or a subset of U (p1). Thus in any intersection tree TI , any subclique S in the left tail of x1 or the right tail of xk0 is either a superset or a subset of U (p1). Further if S ⊇ U (p1), then S must appear in one of {L′ , Lp, Rp, L1, Rk0}. This implies that an intersection tree satisfying condition (a) exists if and only if an intersection tree satisfying condition (b) exists. This justifies the use of our template in Figure 10, for reducing T1. 1 + ¯Rp and Rk0 + R′ k0 1 + Lp, Rk0 + R′ k0 + Rp, L1 + L′ 1 or R′ k0 1, R′ k0 Similarly, if U (p1) ⊆ U (n2), we infer that any clique in Lp or Rp is either a subset of U (n2) or a superset of U (n2). This in turn implies that in TI, any subclique S in the left tail of x1 or the right tail of x1, is either a subset or a superset of U (n2). Further, if S ⊇ U (n2) then it must appear in {L1, Rk0 , L′ , Lp, Rp}. This implies that an intersection tree satisfying condition (a) exists if and only if an intersection tree satisfying (b) exists. This justifies the use of our template in Figure 10, for reducing T1. 1, R′ k0 We now show that the amortized cost of executing the reduction template in Figure 10, over all instances of the algorithm takes O(n2) time. Note that we use the same template for Case 4.3.3 when C2 − X is empty. It is enough to show that the amortized time of all the mergability checks: (whether L′ 1 + Lp and R′ k0 ) be the (consecutive) subsequences of L′ ) contains U (p1) but not U (n1). c(L′ 1 and R′ k0 1) and c(R′ k0 1) and c(R′ k0 (respectively) such that each ) are said to be the core tails + Rp are both valid) take O(n2) time. Let c(L′ 1) and c(R′ k0 subclique in c(L′ of n2. Similarly let c(Lp) and c(Rp) be the (consecutive) subsequences of Lp and Rp (respectively) such that each subclique in c(Lp) and c(Rp) contains U (n2). c(Lp) and c(Rp) are said to be the core tails of p1. Note that the core tails are only defined for p1 and n2, for the current case and Case 4.3.3, when C2 − X is empty. We define the core tails of all other nodes to be empty. Observe that when n1 is collapsed, the (new) core tails of any node in T1 (resp. T2) are disjoint from the core tails of p1 (resp. n2) before the collapse. We observe that checking the validity of L′ Similarly, checking the validity of R′ k0 1 + Lp reduces to checking the validity of c(L′ ) + c(Rp). + Rp reduces to checking the validity of c(R′ k0 1) + c(Lp). Now computing the cores over all executions of this template , takes O(n · I) = O(n2) amortized time. Also, computing the mergability of the cores, over all executions of the template takes Pi(mi + ti)I, where mi, ti are the number of subcliques in the cores of n2 and p1 (respectively), in the ith execution of the template. Since Pi mi = O(n) and Pi ti = O(n), the total running time of template 10 over all executions is O(n2). Case 4.3.3: p1 is a Q-node with more than one essential child. Now let y be an essential child of p1, such that all the nodes between n1 and y are subcliques. Without loss of generality, we assume that y appears to the right of n1. We first consider the subcase when C2 − X is empty. In this case observe that all the max-clique descendants of y appear outside the subtree rooted at n1 in T1. Applying Lemma 6.0 on a max-clique 21 T1 p1 Lp Rp n1 T2 n2 x1 x2 xk0 L1 Rk0 x1 x2 xk0 L′ 1 E2 R′ k0 L′ 1 + Lp and R′ k0 + Rp are valid ? YES NO p1 p1 x1 x2 xk0 Lp L1 Rk0 Rp x1 x2 xk0 ¯Rp L1 Rk0 ¯Lp Figure 10: Reduction template of T1 for Case 4.3.2. Note that E2 denotes the (possibly empty) sequence of children of n2 that appear after R′ k0 . 22 T1 p1 Lp Rp y Ep1 n1 T2 n2 En1 x1 L1 x2 xk0 Rk0 x1 x2 xk0 R′ k0 L′ 1 r1 r2 rk2 M M D(y) ∩ M M D(r1) 6= ∅ ? YES NO p1 p1 Lp En1 x1L1 x2 xk0 Rk0 Rp y Ep1 ¯Ep1 y En1 x1L1 ¯Rp x2 xk0 Rk0 ¯Lp Figure 11: Reduction template of T1 for Case 4.3.3. descendant of y and a max-clique descendant of x1, we infer that each descendant clique of n2 must In other words we get U (p1) ⊆ U (n2). Now the template (and the contain all the vertices in U (p1). argument) in this case is analogous to case 4.3.2, when U (p1) ⊆ U (n2) (Figure 10). Now suppose C2 − X is non empty. Let r1 be the first essential child to the right of xk0 in T2. We use the templates in Figure 11, depending on whether M M D(y) ∩ M M D(r1) is empty or not. If M M D(y) ∩ M M D(r1) is non-empty, then by Lemma 6.2, there exists a max-clique Y that is a descendant of both r1 and y. Now if T1 and T2 are compatible, then in any leaf ordering of an intersection tree TI, the subcliques of Rk0 + R′ appear in between the descendants of xk and Y (because of T2). This justifies the k0 reduction template of T1 in Figure 11. On the other hand, if M M D(r1) ∩ M M D(y) = ∅, then by the constraints of T2, in any leaf ordering of TI, the subcliques of Rk0 + R′ appear between the descendants of xk0 and l1 and further no max-clique k0 appears between them. This justifies the reduction template of T1 in Figure 11. Moreover the template reduction takes O(n) time. Run time of the Algorithm In this Section, we show that the run time of our algorithm is O(n2log n), where n is the total number of vertices in G1 ∪ G2. Observe that reducing T1 [resp. T2] decreases the number of leaf orderings of T1 [resp. T2] by at least half. Moreover the total number of nodes in T1 and T2 is at most n. Thus the number of leaf orderings of T1 and T2 is at most n! and hence the algorithm requires at most nlog n reductions. We begin by showing that selecting the nodes n1 and n2 takes O(n) time in any iteration. We first note that computing the number of MM-Descendants for all the nodes takes O(n) time (they can be computed in a bottom-up fashion). With each node x, we store U (x) and the cardinality of M M D(x). 23 Recall that as we go down the tree the universal sets increase and the MM-Descendants sets decrease. Thus n1 must have maximal depth among all unmatched essential nodes. Hence we can select n1 in O(n) time by looking at the unmatched essential nodes of maximal depth in T1 and T2, and selecting a node with the greatest universal set size and the least number of MM-Descendants in that order. Note that by property 1 of Lemma 8, the MM-descendants of n1 are same as the essential child nodes of n1. Now we can select n2 from the other tree T2 in O(n) time as follows: Let S be the set of [matched] essential children of n1 and S′ be the corresponding set of matched nodes in T2. Let p(S′) be the set of parent nodes of nodes in S′. We select n2 to be a node of maximum depth among p(S′). Also recall that at the high-level our algorithm has 4 cases depending on whether n1, n2 are P-nodes or Q-nodes. We showed that each step in cases 1,2 or 3 takes O(n) time. For case 4, we showed that each of reduction steps, excluding the mergability checks in Cases 4.3.2 and 4.3.3 take O(n) time. We also showed that the mergability checks of Cases 4.3.2 and 4.3.3 take O(n2) amortized time over all steps of the algorithm. Further, in the beginning of Case 4, we showed that the matching steps, which involve inserting the subcliques of one tree into the other take at most O(n2) amortized time. Thus the total time taken by our algorithm is O(n2log n + n2 + n2) = O(n2log n). At each node y of T1 (resp. T2) we explicitly store the set U (y) and the cardinality of M M D(y). Since the number of internal nodes is less than the number of leaf nodes, this additional storage still takes O(n + m). Thus the space complexity of our algorithm is O(n + m). 5 Open Problem Simultaneous graphs can be generalized in a natural way to more than two graphs: when G1 = (V1, E1), G2 = (V2, E2), · · · , Gk = (Vk, Ek) are k graphs in class C, sharing a vertex set I and its induced edges i.e. Vi ∩Vj = I for all i, j ∈ {1, · · · , k}. In this version of the problem the set of optional edges induces a complete k- partite graph and hence this also generalizes probe graphs. This generalized version can be solved in polynomial time for comparability and permutation graphs [9]. We conjecture that it can be solved in polynomial time for interval graphs. References [1] Berry, A., Golumbic, M.C., Lipshteyn, M. Recognizing chordal probe graphs and cycle-bicolorable graphs. SIAM J. Discret. Math., 21(3):573–591, 2007. [2] Booth, K.S and Lueker, G.S. Testing for the consecutive ones property, interval graphs, and graph planarity using PQ-tree algorithms. J. Comput. System Sci., 13:335–379, 1976. [3] Brass, P., Cenek, E., Duncan, C.A., Efrat, A., Erten, C., Ismailescu, D.P., Kobourov, S.G., Lubiw, A., Mitchell J.S.B. On simultaneous planar graph embeddings. Comput. Geom. Theory Appl., 36(2), 117-130 (2007). [4] Estrella-Balderrama, A., Gassner, E., Junger, M., Percan, M., Schaefer, M., Schulz, M., Simultaneous geometric graph embeddings. GD 2007. LNCS, vol. 4875, pp.280-290. [5] Chandler, D.B., Chang, M., Kloks, T., Liu, J., and Peng, S. Partitioned probe comparability graphs. Theor. Comput. Sci., 396(1-3):212–222, 2008. [6] Golumbic, M.C. Algorithmic Graph Theory And Perfect Graphs. Academic Press, New York, 1980. 24 [7] Golumbic, M.C., Kaplan, H., and Shamir, R. Graph sandwich problems. J. Algorithms, 19(3):449–473, 1995. [8] Golumbic M.C, and Lipshteyn, M. Chordal probe graphs. Discrete Appl. Math., 143(1-3):221–237, 2004. [9] Jampani, K.R., Lubiw, A. The simultaneous representation problem for chordal, comparability and permutation graphs. In WADS '09, pages 387–398, 2009. [10] Johnson, J.L., and Spinrad, J.P. A polynomial time recognition algorithm for probe interval graphs. In SODA '01, pages 477–486, Philadelphia, PA, USA, 2001. [11] McConnell, R.M., and Nussbaum, Y. Linear-time recognition of probe interval graphs. In ESA 09, pages 349-360. [12] McConnell, R.M., and Spinrad, J.P. Construction of probe interval models. In SODA '02, pages 866–875, Philadelphia, PA, USA, 2002. [13] McMorris, F. R., Wang, C., Zhang, P. On probe interval graphs. Discrete Appl. Math., 88(1-3):315– 324, 1998. [14] Tanenbaum, Paul J. Simultaneous intersection representation of pairs of graphs. J. Graph Theory., 32(2):171–190, 1999. 25
1210.1890
2
1210
2013-03-04T16:28:24
Local Search is Better than Random Assignment for Bounded Occurrence Ordering k-CSPs
[ "cs.DS" ]
We prove that the Bounded Occurrence Ordering k-CSP Problem is not approximation resistant. We give a very simple local search algorithm that always performs better than the random assignment algorithm. Specifically, the expected value of the solution returned by the algorithm is at least Alg > Avg + a(B,k) (Opt - Avg), where "Opt" is the value of the optimal solution; "Avg" is the expected value of the random solution; and a(B,k)=Omega_k(B^{-(k+O(1))} is a parameter depending only on "k" (the arity of the CSP) and "B" (the maximum number of times each variable is used in constraints). The question whether bounded occurrence ordering k-CSPs are approximation resistant was raised by Guruswami and Zhou (APPROX 2012) who recently showed that bounded occurrence 3-CSPs and "monotone" k-CSPs admit a non-trivial approximation.
cs.DS
cs
Local Search is Better than Random Assignment for Bounded Occurrence Ordering k-CSPs∗ Konstantin Makarychev Microsoft Research, Redmond, WA 98052 Abstract We prove that the Bounded Occurrence Ordering k-CSP Problem is not approximation resistant. We give a very simple local search algorithm that always performs better than the random assignment algorithm (unless, the number of satisfied constraints does not depend on the ordering). Specifically, the expected value of the solution returned by the algorithm is at least Alg ≥ Avg + α(B, k)(Opt − Avg), where Opt is the value of the optimal solution; Avg is the expected value of the random solution; and α(B, k) = Ωk(B−(k+O(1))) is a parameter depending only on k (the arity of the CSP) and B (the maximum number of times each variable is used in constraints). The question whether bounded occurrence ordering k-CSPs are approximation resistant was raised by Guruswami and Zhou (2012), who recently showed that bounded occurrence 3-CSPs and "monotone" k-CSPs admit a non-trivial approximation. 1 Introduction In this work, we give a very simple local search algorithm for ordering constraints Overview. satisfaction problems that works better than the random assignment for those instances of the ordering k-CSP problem, where each variable is used only a bounded number of times. To motivate the study of the problem, we first overview some known results for regular constraint satisfaction problems. An instance of a constraint satisfaction problem consists of a set of variables V = {x1, . . . , xn} taking values in a domain D and a set of constraints C. Each constraint C ∈ C is a function from Dk to R+ applied to k variables from V . Given an instance of a CSP, our goal is to assign values to the variables to maximize the total payoff of all constraints: max x1,...,xn∈DnXC∈C C(x1, . . . , xn). In fact, C may depend on at Note, that we write C(x1, . . . , xn) just to simplify the notation. most k variables. The parameter k is called the arity of the CSP. In specific CSP problems, constraints C come from a specific family of constraints. For example, in Max Cut, the domain is D = {−1, 1}, and all constraints have the form C(x1, . . . , xn) = 1(xi 6= xj); in Max 3LIN-2, the domain D = {0, 1}, and all constraints have the form C(x1, . . . , xn) = 1(xi ⊕ xj ⊕ xl = 0) or C(x1, . . . , xn) = 1(xi ⊕ xj ⊕ xl = 1). ∗The conference version of this paper appeared at STACS 2013. 1 Various approximation algorithms have been designed for CSPs. The most basic among them, the "trivial" probabilistic algorithm simply assigns random values to the variables. It turns out, however, that in some cases this algorithm is essentially optimal. Hastad (1997) showed that for some CSPs e.g., 3LIN-2 and E3-SAT, beating the approximation ratio of the random assignment algorithm (by any positive constant ε) is NP-hard. Such problems are called approximation re- sistant. That is, a constraint satisfaction problem is approximation resistant, if for every positive ε > 0, it is NP-hard to find a (Atrivial + ε) approximation, where Atrivial is the approximation ratio of the random assignment algorithm. If there exists an algorithm with the approximation ratio (Atrivial + ε) for some positive ε, we say that the problem admits a non-trivial approximation. It is still not known which constraint satisfaction problems are approximation resistant and which admit a non-trivial approximation. This is an active research question in approximation algorithms. Suppose now that in our instance of k-CSP, each variable is used by at most B constraints. (For example, for Max Cut, this means that the maximum degree of the graph is bounded by B.) Hastad (2000) proved that such instances (which we call B-bounded occurrence k-CSPs) admit a non-trivial approximation. Let Opt denote the value of the optimal solution; Avg denote the expected value of the random assignment; and Alg denote the expected value returned by the algorithm. Hastad (2000) showed that there exists an approximation algorithm such that1 Alg ≥ Avg + Opt − Avg Ok(B) . Here the hidden constant in Ok(·) may depend on k. Trevisan (2001) showed a hardness of approx- imation lower bound of Avg + (Opt − Avg)/(Ωk(√B)). In this work, we study ordering constraints satisfaction problems. A classical example of an ordering k-CSP is the Maximum Acyclic Subgraph problem. Given a directed graph G = (V, E), the goal is to find an ordering of the vertices π : V → {1, . . . , n} (π is a bijection; n = V ), so as to maximize the number of forward edges. In this case, the edges of the graph are constraints on the ordering π. An edge (u, v) corresponds to the constraint π(u) < π(v). Another example is the Betweenness problem. We are given a set of vertices V and a set of constraints {Cu,v,w}. Each Cu,v,w is defined as follows: Cu,v,w(π) = 1, if u < v < w or w < v < u, and Cu,v,w(π) = 0, otherwise. The goal again is to find an ordering satisfying the maximum number of constraints. More generally, in an ordering k-CSP, each constraint C is a function of the ordering that depends only on the relative order of k vertices. The goal is given a set of vertices V and a set of constraints C, to find an ordering π : V → [n] to maximize the total value of all constraints: max π:V →[n]XC∈C C(π). Here π is a bijection and n = V . If all constraints take values {0, 1}, then the objective is simply to maximize the number of satisfied constraints. Note, that an ordering k-CSP is not a k-CSP. Surprisingly, we know more about ordering CSPs than about regular CSPs. Guruswami, Hastad, Manokaran, Raghavendra, and Charikar (2011) showed that every ordering CSP prob- lem is approximation resistant assuming the Unique Games Conjecture (special cases of this result were obtained by Guruswami et al. (2008) and Charikar et al. (2009)). On the positive side, 1The quantity ("value of the solution" − Avg) is called the advantage over random. The algorithm of Hastad (2000) is Ok(B) approximation algorithm for the advantage over random: Alg − Avg ≥ Opt − Avg Ok(B) . 2 Berger and Shor (1990) showed that bounded degree Maximum Acyclic Subgraph, and thus every bounded occurrence ordering 2CSP, admits a non-trivial approximation. Their result implies that Alg ≥ Avg + (Opt − Avg)/O(√B). Charikar, Makarychev, and Makarychev (2007) showed that a slight advantage over the random assignment algorithm can be also achieved for instances of Maximum Acyclic Subgraph (Alg ≥ Avg + (Opt− Avg)/O(log n)) whose maximum degree is not bounded. Gutin, van Iersel, Mnich, and Yeo (2012) showed that the "advantage over the random assignment" for ordering 3CSPs is fixed -- parameter tractable (we refer the reader to the paper for definitions and more details). Finally, Guruswami and Zhou (2012) proved that all bounded oc- currence ordering 3CSPs admit a non-trivial approximation (Alg ≥ Avg + (Opt − Avg)/Ok(B)). They also proved that there exists an approximation algorithm for monotone k-CSP (i.e., ordering CSPs, where all constraints are of the form π(ui1) < π(ui2) < ··· < π(uik )) with approximation ratio 1/k! + 1/Ok(B). Our results. We show that a very simple randomized local search algorithm finds a solution of expected value: Alg ≥ Avg + Opt − Avg Ok(Bk+2) . (1) This algorithm works for every bounded occurrence ordering k-CSP. Consequently, all bounded occurrence ordering k-CSPs admit a non-trivial approximation. The running time of the algorithm is O(n log n). We do not know whether the dependence on B is optimal. However, the result of Trevisan (2001) implies a hardness of approximation upper bound of Alg+(Opt−Avg)/Ωk(√B)2. Techniques. Our algorithm works as follows: first, it permutes all vertices in a random order. Then, n times, it picks a random vertex and moves it to the optimal position without changing the positions of other vertices. We give an elementary proof that this algorithm performs better than the random assignment. However, the bound we get is exponentially small in B. Then, we improve this bound. Roughly speaking, instead of the original problem we consider the "D-ordering" problem, where the algorithm puts vertices in D ≈ Bk buckets (possibly, in a clever way), then it randomly permutes vertices in each of the buckets, and finally outputs vertices in the first bucket, second bucket, etc. This idea was previously used by Charikar, Makarychev, and Makarychev (2007), Guruswami, Hastad, Manokaran, Raghavendra, and Charikar (2011), Gutin, van Iersel, Mnich, and Yeo (2012) and Guruswami and Zhou (2012). The transition to "D- orderings" allows us to represent the payoff function as a Fourier series with relatively few terms. We prove that the L1 weight of all coefficients of the payoff function is at least Avg+Ωk(Opt−Avg) (Note, that the optimal value of the "D-ordering" problem may be less than Opt). Then we show that (a) for each vertex we can find one "heavy" Fourier coefficient fS; and (b) when the original local search algorithm moves a vertex it increases the value of the solution in expectation by at least Ωk( fS/B). This concludes the proof. Correction. In the preliminary version of the paper that appeared at arXiv, we proved the main result of the paper, Theorem 3.1. We also gave an alternative, more complicated algorithm in the Appendix. We erroneously claimed that the performance guarantee of the alternative algorithm is slightly better than (1). This is not the case. So the best bound known to the author is (1). 2Every k-CSP can be encoded by an ordering 2k-CSP by replacing every boolean variable x with two variables u← x and u→ x , and letting x = 1 if and only if π(u← x ) < π(u→ x ). 3 2 Preliminaries An instance of an ordering k-CSP problem (V,C) consists of a set of vertices V of size n, and a set of constraints C. An ordering of vertices π : V → {1, . . . , n} is a bijection from V to {1, . . . , n}. Each constraint C ∈ C is a function from the set of all ordering SV = {π : V → {1, . . . , n}} to R+ that depends on the relative order of at most k vertices. That is, for every C there exists a set TC ⊂ V of size at most k such that if for two orderings π1 and π2, π1(u) < π1(v) ⇔ π2(u) < π2(v) for all u, v ∈ TC , then C(π1) = C(π2). The value of an ordering π equals value(π,C) = XC∈C C(π). We will sometimes write value((u1, . . . un),C) to denote the value(π,C) for π : ui 7→ i. We denote the optimal value of the problem by Opt(V,C) ≡ maxπ∈SV value(π,C), the average value -- the value returned by the random assignment algorithm -- by Avg(V,C) = 1/n! Pπ∈SV value(π,C). 3 Algorithm We now present the algorithm. Randomized Local Search Algorithm Input: a set of vertices V , and a set of constraints C. Output: an ordering of vertices (v1, . . . , vn). 1. Randomly permute all vertices. 2. Repeat n times: • Pick a random vertex u in V . • Remove u from the ordering and insert it at a new location to maximize the payoff. I.e., if v1, . . . , vn−1 is the current ordering of all vertices but the vertex u, then find a location i that maximizes the value(v1, . . . , vi−1, u, vi+1, . . . vn−1,C), and put u in the i-th position. 3. Return the obtained ordering. Theorem 3.1. Given an instance (V,C) of a B-bounded occurrence ordering k-CSP problem, the Randomized Local Search Algorithm returns a solution πAlg of expected value E value(πAlg,C) ≥ Avg(V,C) + Opt(V,C) − Avg(V,C) Ok(Bk+2) . (2) Remark 3.1. In fact, our proof implies a slightly stronger bound: The second term on the right hand side of the inequality (2) can be replaced with (Opt(V,C) − Worst(V,C))/Ok(Bk+2), where Worst(V,C) is the value of the worst possible solution. 4 Proof. I. We first show using an elementary argument that E value(πAlg,C) ≥ Avg(V,C) + α(B, k)(Opt(V,C) − Avg(V,C)), for some function α(B, k) depending only on B and k. This immediately implies that every bounded occurrence ordering k-CSP admits a non-trivial approximation. Then, using a slightly more involved argument we prove the bound (2). Observe, that the expected value of the solution after step 1 is exactly equal to Avg(V,C). So we need to estimate how much local moves at step 2 improve the solution. Let ∆u be the maximum possible increase in the value of an ordering π, when we move u to another position. In other words, ∆u = maxπ+,π−(value(π+,C) − value(π−,C)), where the orderings π+ and π− differ only in the position of the vertex u. Let π∗ be the optimal ordering, and π∗ be the worst possible ordering. We can transition from π∗ to π∗ by moving every vertex u at most once. Thus, ∆u ≥ value(π∗,C) − value(π∗,C) = Opt(V,C) − Worst(V,C) ≥ Opt(V,C) − Avg(V,C). Xu∈V Now, our goal is to show that when the algorithm moves a vertex u, the value of the solution increases in expectation by at least α(B, k)∆u for some function α depending only on B and k. Fix a vertex u. Let π+ and π− be the orderings that differ only in the position of the vertex u such that ∆u = value(π+,C) − value(π−,C). It may happen that the random permutation chosen by the algorithm at step 1 is π−, and u is chosen first among all vertices in V at step 2. In this case, the algorithm can obtain the permutation π+ by moving u, and thus it can increase the value of the solution by ∆u. However, the probability of such event is negligible. It is 1/n · 1/n!. The main observation is that the increase in the value of the ordering, when we move u, depends only on the order of the neighbors of u i.e., those vertices that share at least one common constraint C ∈ C with u (including u itself). We denote the set of neighbors by N (u). Since each vertex participates in at most B constraints, and every constraint depends on at most k variables, N (u) ≤ kB. Consider an execution of the algorithm. We say that u is fresh if u was chosen at least once in the "repeat" loop of the algorithm, and none of the neighbors were chosen before u was chosen the first time. The probability that a variable u is fresh is at least 1/2N (u)−1. Indeed, the probability that at least one vertex in N (u) is chosen is 1 − (1 − N (u)/n)n > 1 − 1/e; the probability that the first vertex chosen in N (u) is u is 1/N (u) (since all vertices in N (u) have the same probability of being chosen first). If u is fresh, then when it is chosen, its neighbors are located in a random order (since none of them was moved by the algorithm). Thus, with probability 1/N (u)! ≥ 1/(kB)!, the order of neighbors of u is the same as in π−. Then, by moving u we can increase the value of the ordering by ∆u. Therefore, when the algorithm moves the vertex u, the value of the ordering increases in expec- tation by at least Pr(u is fresh) · Pr(N (u) is ordered as π− after step 1) · ∆u = ∆u 2N (u)N (u)! ≥ ∆u kB (kB)! . This finishes the elementary proof that a positive α(B, k) exists. II. We now improve the lower bound on α(B, k). We show that for a fresh variable u, the value of the ordering increases in expectation by at least Ωk(B−(k+1))∆u, and thus (2) holds. Let L = ⌈log2(N (u) + 1)⌉ and D = 2L. Consider D buckets [D] = {1, . . . , D}. For every mapping x of the vertices to the buckets v 7→ xv ∈ [D], we define a distribution Ux on orderings of V . A random 5 ordering from Ux is generated as follows: put each vertex v in the bucket xv; then randomly and uniformly permute vertices in each bucket; and finally output vertices in the first bucket, second bucket, etc (according to their order in those buckets). Let Cu be the set of constraints that depend on the vertex u. Since every variable participates in at most B constraints, Cu ≤ B. Let f (x) be the expected total value of constraints in Cu on a random ordering π sampled from the distribution Ux: f (x) = Eπ∼Uxh XC∈Cu C(π)i. Since the number of buckets D is greater than or equals to N (u)+1, we may put every vertex in N (u) in its own bucket and keep one bucket empty. Let π+ and π− be the orderings as in part I of the proof: π+ and π− differ only in the position of the vertex u, and value(π+,C)− value(π−,C) = ∆u. Consider mappings x+ : V → [D] and x− : V → [D] that put only one vertex from N (u) in every v for every v 6= u, and x+ orders vertices in N (u) according to π+, x− bucket and such that x+ orders vertices in N (u) according to π−. For example, if π+ arranges vertices in the order (a, b, u, c), and π− arranges vertices in the order (a, u, b, c), then x+ = (a 7→ 1,∗, b 7→ 3, u 7→ 4, c 7→ 5) and x− = (a 7→ 1, u 7→ 2, b 7→ 3,∗, c 7→ 5). Since the order of all vertices in N (u) is fixed by x+ and x−, we have f (x+) = value(π+,Cu) and f (x−) = value(π−,Cu). Then v = x− f (x+) − f (x−) = value(π+,Cu) − value(π−,Cu) = value(π+,C) − value(π−,C) = ∆u. We now use Theorem 4.1, which we prove in Section 4. Let Xv (for v ∈ V ) be independent random variables uniformly distributed in [D]. By Theorem 4.1, E[max xu∈D f (xu,{Xv}v6=u) − f (Xu,{Xv}v6=u)] ≥ Ωk(B−1D−k)(f (x+) − f (x−)) = Ωk(B−(k+1))∆u. Here, (xu,{Xv}v6=u) denotes the mapping u 7→ xu and v 7→ Xv for v 6= u; and (Xu,{Xv}v6=u) denotes the mapping v 7→ Xv for all v. Observe, that when we sample random variables Xv, and then sample π according to UX , we get a random uniform ordering π of all vertices in V . Thus, E[f (Xu,{Xv}v6=u)] = Eπ∈SVh XC∈Cu C(π)i = Eπ[value(π,Cu)]. Similarly, when we sample random variables Xv, set xu = argmaxxu∈D f (xu,{Xv}v6=u), and then sample π′ according to U(xu,{Xv}v6=u), we get a random uniform ordering of all vertices except for the vertex u. Denote by LS(π, u) the ordering obtained from the ordering π by moving the vertex u to the optimal position. It is easy to see that if π is a random uniform ordering, then LS(π, u) has the same distribution as LS(π′, u), since the new optimal position of u depends only on the relative order of other vertices v, and not on the old position of u. Hence, E[max xu∈D f (xu,{Xv}v6=u)] ≡ Eπ′[value(π′,Cu)] ≤ Eπ′[value(LS(π′, u),Cu)] = Eπ[value(LS(π, u),Cu)]. Hence, Eπ[value(LS(π, u),C) − value(π, u,C)] = Eπ[value(LS(π, u),Cu) − value(π, u,Cu)] ≥ Ωk(B−(k+1))∆u. 6 4 Theorem 4.1 Theorem 4.1. Let D be a set of size 2L (for some L). Consider a function f : Dn+1 → R that can be represented as a sum of T functions ft : Dn+1 → R: f (x0, x1, . . . , xn) = ft(x0, x1, . . . , xn) T Xt=1 such that each function ft depends on at most k variables xu. Here, x0, . . . , xn ∈ D. Then, the following inequality holds for random variables X0, . . . , Xn uniformly and independently distributed in D: E[max x∈D f (x, X1, . . . , Xn) − f (X0, X1, . . . , Xn)] ≥ Ωk(T −1D−k) max x+,x−,x1,...,xn∈D (f (x+, x1, . . . , xn) − f (x−, x1, . . . , xn)). Remark 4.1. The variable x0 corresponds to xu from the proof of Theorem 3.1. The functions ft(x) are equal to Eπ∼UxCt(π), where Ct is the t-th constraint from Cu. Proof. Without loss of generality we assume that elements of D are vertices of the boolean cube {−1, 1}L. We denote the i-th coordinate of x ∈ D by x(i). We now treat f as a function of (n + 1)L boolean variables xu(i). We write the Fourier series of the function f . The Fourier basis consists of functions χS(x0, . . . , xn) = Y(u,i)∈S xu(i), which are called characters. Each index S ⊂ {0, 1, . . . , n} × {1, . . . , L} corresponds to the set of boolean variables {xu(i) : (u, i) ∈ S}. Note, that χ∅(x0, . . . , xn) = 1. The Fourier coefficients of f equal fS = E[f (X0, . . . , Xn) χS(X0, . . . , Xn)], and the function f equals f (x0, . . . , xn) =XS fS χS(x0, . . . , xn). Remark 4.2. In the proof, we only use the very basic facts about the Fourier transform. The main property we need is that the characters form an orthonormal basis, that is, E[χS1(X0, . . . , Xn)χS2(X0, . . . , Xn)] =(1, 0, if S1 = S2; if S1 6= S2. Particularly, for S 6= ∅, E[χS(X0, . . . , Xn)] = E[χS(X0, . . . , Xn)χ∅(X0, . . . , Xn)] = 0. We will also need the following property: if f does not depend on the variable xu(i), then all Fourier coefficients fS with (u, i) ∈ S are equal to 0. Here is a brief overview of the proof: We will show that the L1 weight of Fourier coefficients of f is at least f (x+, x1, . . . , xn) − f (x−, x1, . . . , xn), and the weight of one of the coefficients fS∗ is at least Ω(T −1D−k(f (x+, x1, . . . , xn) − f (x−, x1, . . . , xn))). Consequently, if we flip a single bit 7 X0(i∗) in X0 to make the term fS∗χS∗(X ′ of f by fS∗. Observe, that since each function ft depends on at most kL boolean variables, it has at most 2kL = Dk nonzero Fourier coefficients. Thus, f has at most T Dk nonzero Fourier coefficients fS. 0, X1, . . . , Xn) positive, we will increase the expected value Pick x+, x−, x∗ 1, . . . , x∗ n that maximize f (x+, x∗ 1, . . . , x∗ 1, . . . , x∗ n). We have n) − f (x−, x∗ 1, . . . , x∗ fS(χS(x+, x∗ n) − χS(x−, x∗ 1, . . . , x∗ n)). f (x+, x∗ 1, . . . , x∗ n) − f (x−, x∗ 1, . . . , x∗ n) =XS If S does not contain pairs (0, i) corresponding to the bits of the variable x0, then the character χS(x0, x1, . . . , xn) does not depend on x0, and χS(x+, x∗ n) = 0, hence 1, . . . , x∗ 1, . . . , x∗ n) − χS(x−, x∗ f (x+, x∗ 1, . . . , x∗ n) − f (x−, x∗ = XS:∃i s.t. (0,i)∈S n) = 1, . . . , x∗ fS · (χS(x+, x∗ 1, . . . , x∗ n) − χS(x−, x∗ 1, . . . , x∗ n)) ≤ 2 XS:∃i s.t. (0,i)∈S fS. Pick a character fS∗ with maximum absolute value and pick one of the elements (0, i∗) ∈ S∗. Since the number of nonzero characters fS is at most T Dk, n) − f (x−, x∗ 2T Dk Let σ = sgn( fS∗). Define a new random variable X ′ 0, fS∗ ≥ 1, . . . , x∗ f (x+, x∗ 1, . . . , x∗ n) . X ′ 0(i) =(X0(i), σ χS∗(X0, . . . , Xn) X0(i), for i 6= i∗; for i = i∗. Consider a character χS. If (0, i∗) /∈ S, then χS does not depend on the bit x0(i∗), hence E[χS(X ′ 0, X1, . . . , Xn)] = E[χS(X0, X1, . . . , Xn)]. On the other hand, if (0, i∗) ∈ S, then 0, X1, . . . , Xn)] = E(cid:2) χS(X0, X1, . . . , Xn)(cid:3) = 0(i∗) X ′ X0(i∗) E[χS(X ′ E[σχS∗(X0, X1, . . . , Xn)χS(X0, X1, . . . , Xn)] =(0, σ, if S 6= S∗; if S = S∗. The last equality holds because characters χS form an orthonormal basis. Therefore, E[f (X ′ 0, X1, . . . , Xn) − f (X0, X1, . . . , Xn)] = σ fS∗ = fS∗. We get E[max x∈D f (x, X1, . . . , Xn) − f (X0, X1, . . . , Xn)] ≥ E[f (X ′ = fS∗ ≥ Ωk(T −1D−k) max x∗,x∗,x1,...,xn∈D 0, X1, . . . , Xn) − f (X0, X1, . . . , Xn)] (f (x+, x1, . . . , xn) − f (x−, x1, . . . , xn)). 8 5 Concluding remarks We can guarantee that the algorithm finds a solution of value (2) with high probability by repeating the algorithm Θk(Bk+2) times (since the maxim possible value of the solution is Opt). We note that our local search algorithm works not only for ordering k-CSPs, but also for (regular) k-CSPs. The algorithm first assigns random values to all variable xi, and then, n times, picks a random i ∈ {1, . . . , n}, and changes the value of the variable xi to the optimal value for fixed other variables. The approximation guarantee of the algorithm is Avg(V,C) + (Opt(V,C) − Avg(V,C))/Ok,D(B), here k is the arity, and D is the domain size of the CSP. The approximation guarantee has the same dependence on B as the approximation guarantee of Hastad's (2000) original algorithm. The analysis relies on Theorem 4.1. References B. Berger and P. Shor (1990). Approximation Algorithms for the Maximum Acyclic Subgraph Problem. SODA 1990. M. Charikar, V. Guruswami, and R. Manokaran (2009). Every Permutation CSP of arity 3 is Approximation Resistant. IEEE Conference on Computational Complexity 2009. M. Charikar, K. Makarychev, and Y. Makarychev. On the Advantage over Random for Maximum Acyclic Subgraph. FOCS 2007. V. Guruswami, J. Hastad, R. Manokaran, P. Raghavendra, and M. Charikar (2011). Beating the Random Ordering Is Hard: Every Ordering CSP Is Approximation Resistant. SIAM J. Com- put. 40(3). V. Guruswami, R. Manokaran, and P. Raghavendra (2008) Beating the Random Ordering is Hard: Inapproximability of Maximum Acyclic Subgraph. FOCS 2008. V. Guruswami and Y. Zhou (2012). Approximating Bounded Occurrence Ordering CSPs. APPROX-RANDOM 2012. G. Gutin, L. van Iersel, M. Mnich and A. Yeo (2012). Every ternary permutation constraint satisfac- tion problem parameterized above average has a kernel with a quadratic number of variables. J. Comput. Syst. Sci., vol 78 (1). J. Hastad (1997). Some optimal inapproximability results. STOC 1997. J. Hastad. On bounded occurrence constraint satisfaction. Inf. Process. Lett. (IPL) 74(1-2):1-6 (2000). J. Hastad (2005). Every 2-CSP allows nontrivial approximation. STOC 2005. A. Newman (2001). The Maximum Acyclic Subgraph Problem and Degree-3 Graphs. RANDOM- APPROX 2001. L. Trevisan (2001). Non-approximability results for optimization problems on bounded degree in- stances. STOC 2001. 9
1905.13492
1
1905
2019-05-31T10:11:29
Majorisation-minimisation algorithms for minimising the difference between lattice submodular functions
[ "cs.DS" ]
We consider the problem of minimising functions represented as a difference of lattice submodular functions. We propose analogues to the SupSub, SubSup and ModMod routines for lattice submodular functions. We show that our majorisation-minimisation algorithms produce iterates that monotonically decrease, and that we converge to a local minimum. We also extend additive hardness results, and show that a broad range of functions can be expressed as the difference of submodular functions.
cs.DS
cs
Majorisation-minimisation algorithms for minimising the difference between lattice submodular functions Conor McMeel Panos Parpas [email protected] [email protected] June 3, 2019 Abstract We consider the problem of minimising functions represented as a difference of lattice sub- modular functions. We propose analogues to the SupSub, SubSup and ModMod routines for lattice submodular functions. We show that our majorisation-minimisation algorithms produce iterates that monotonically decrease, and that we converge to a local minimum. We also extend additive hardness results, and show that a broad range of functions can be expressed as the difference of submodular functions. 1 Introduction In discrete optimisation, many objectives are expressible as submodular minimisation or maximisa- tion problems. This is useful, as submodular functions can be minimised in strongly polynomial time [9], and have strong constant approximation factors under a variety of constraints for maximisation [11] [4]. Applications for these problems have included medical imaging [8], document summarisation [12] and online advertising [1]. We refer to V = {1, . . . , n} as the ground set, and a function f : 2V → R is then called submodular if the following inequality holds for all A, B ⊆ V : f (A) + f (B) ≥ f (A ∪ B) + f (A ∩ B). (1) We note that a subset A can also be represented as a 0 − 1 vector x, where a component takes on the value 1 if the element is present in the subset A. In this way our inequality can be written as f (x) + f (y) ≥ f (min(x, y)) + f (max(x, y)) (2) for all x, y ∈ {0, 1}n. A popular and often-studied application of submodular optimisation which we shall use as our running example is that of sensor placement. Suppose we wish to detect the level of air pollution in a town. We have a finite set of locations that we can install air pollution sensors in, but we are constrained by some budget. Knowing the geography of our town, we wish to select the set of locations such that the information we receive is maximised. As shown in [16], this problem is submodular. In the classic 0 − 1 case, this corresponds to only having one type of sensor. However, we can suppose that we have a number of different types of sensors available, each with a strength level 1 that can be parameterised by an integer variable x ∈ {0, . . . , k}. Lattice submodularity is then determined by satisfying Equation (2), but for all x, y ∈ {0, . . . , k}V . Note that in general, we can allow k to be different for different elements. Submodular functions in the set case also lend themselves to a useful diminishing returns prop- erty, which is often considered as an equivalent definition. Definition 1.1 (Diminishing returns property). A submodular set function can also be defined by the following. For any A ⊂ B ⊂ V and e /∈ A, we have f (A ∪ e) − f (A) ≥ f (B ∪ e) − f (B). (3) However, for lattice functions we unfortunately do not get that for free [17], so we define a proper subclass known as DR-submodular functions as follows: Definition 1.2 (DR-Submodular). Let f be a lattice submodular function on Qi{0, . . . , k}V . Then f is called a DR-submodular function if for all x, y ∈ Qi{0, . . . , k}V with x ≤ y componentwise, c > 0 and basis vector ej, we have f (x + cej) − f (x) ≥ f (y + cej) − f (y). (4) As shown in [2], many typical objectives we come across are in fact DR-submodular, so it makes sense to consider this subclass. The specific problem of optimising DR-submodular functions has been studied before [3] [17]. Across these papers, the problem of maximisation has been studied in monotone and non-monotone settings across a variety of constraints. In this paper, we will carry out our majorisation-minimisation algorithm by discretising the lattice submodular functions, giving us submodular functions on some lattice. In [6], the authors showed that DR-submodular functions on a lattice can be reduced to the set function submodular case, where the ground set will be smaller. Due to this, we do not consider the specific DR subclass here, as it would be more efficient to carry out this reduction and then use the work of [10]. To motivate the problem of considering the difference of submodular functions, we turn back to the sensor information problem. Here, we may wish to also factor in the costs of sensors also. As is typical in real-world applications, we expect to get a bulk discount if we buy many sensors. Additionally, we may expect that for any one sensor, as the sensor gets stronger the unit price increases slower. This leads us to the diminishing returns property for submodularity. Specifically, if we obtain information f (x), and spend c(x) to get that information, for some sensor placement x, we wish to minimise f (x) − λc(x), for some tradeoff parameter λ. This formulation also applies to any other problem of optimising a submodular function with some cost. In the set function case, this problem was considered by [10], who proposed several different majorisation minimisation techniques. Here, we will use the work of [2] to come up with our algorithm, who worked on discretised versions of continuous submodular function, hence lattice submodular functions. We will derive majorisation-minimisation algorithms on the difference v(x) = f (x) − g(x). It can be considered the extension to the lattice case of the SupSub procedure in [10], originally introduced in [14], as well as the SubSup and ModMod procedures. In fact by discretising continuous functions, we can also consider it an extension to the continuous domain much like [2]. We will show that we converge to a local minimum of the function, and consider the class of functions we can represent as the difference of submodular functions. 2 1.1 Outline We begin by discussing some preliminaries Section 2. We consider the theory of continuous and lattice submodular functions, and show how subgradients are obtained. We show modular and tight lower and upper bounds, along with a decomposition that allows us to utilise the theory of DR- submodular functions effectively. Section 3 presents and discusses the three algorithms, along with a discussion of a stopping criterion. In Section 4, we discuss complexity, deriving the functions f, g for the representation v(x) = f (x) − g(x), along with other theoretical issues. We conclude with a brief discussion in Section 5. 2 Preliminaries We are considering the problem of minimising the difference between lattice submodular functions. In particular, we seek to minimise v(x) = f (x) − g(x) (5) where f, g are lattice submodular. For our algorithms, our plan will be to in fact use an extension of the functions f that was defined in [2]. While doing this, we will also give the main ingredient for computing the lower bound. 2.1 An Extension Our extension will be from the set Qi{0, . . . , ki − 1} = Qi Xi to the product of measures of Xi. The motivation for this can be thought of as follows. In the Lovasz extension, the value x ∈ [0, 1] taken on by a component can be thought of as the probability that an element x is included in a set. Similarly, we will extend here to probability mass functions over the domain {0, . . . , ki − 1}. We note that any PMF on this domain can be represented by its reverse cumulative probability density function ρi(xi) = µi(xi) + . . . + µi(ki − 1) = Fµi (xi). We then see that ρi(0) = 1 always, and the only constraint on it is that its elements are non-decreasing, and all belong to [0, 1]. As in [2], we denote this set of vectors as [0, 1]ki−1 . ↓ Next, we think of this set of vectors just defined, and note that if we mark the locations of ρi(xi), we will divide the number line into ki segments. This induces a map θ(ρi, t) from R to 0, . . . , ki − 1 with θ(ρi, t) = ki − 1 if t ≤ ρi(ki − 1), θ(ρi, t) = xi if t ∈ (ρi(xi+1, ρi(xi)] for xi ∈ 1, . . . , ki − 2, and θ(ρi, t) = 0 for t ≥ ρi(1). Our extension is then thus defined, for a submodular function f f↓(ρ) = Z 1 0 f (θ(ρ1, t), . . . , θ(ρn, t))dt. (6) For a more thorough exposition, see [2]. We now detail how the extension is evaluated using a greedy algorithm. 2.2 A lower bound We now give the greedy algorithm from [2]. 3 Theorem 2.1. Consider the extension of f↓(ρ) of a submodular function f . Order all values of ρ in decreasing order, breaking ties arbitrarily but ensuring that all components for a given ρi are in the correct order. Assume the value at position s is equal to t(s) and corresponds to ρi(s)(j(s)). Then we have the following expression for f↓ r f↓(ρ) = f (0) + Xi=1 which we write in the form f↓(ρ) = f (0) +Pn i=1Pki−1 xi=1 wi(xi)ρi(xi), where wi(xi) corresponds to the difference in value between two function evaluations whose arguments differ by a single basis vector. t(s)(f (y(s)) − f (y(s − 1))) (7) In this section, we will first remind ourselves of the different characterisations of the base polyhe- dron, how the greedy algorithm is used to construct extreme points for one of these characterisations, and how subgradients are computed. Using this, we will compute a lower bound that will be used for our algorithm. We remind ourselves first of the characterisation of the base polyhedron as given initially in [2]: Definition 2.1 (Base Polyhedron). Let f (x1, . . . , xn) be a discrete submodular function WLOG with f (0, 0, . . . , 0) = 0, in each argument from 0 to the integer ki − 1 respectively. Then the Rki−1 such that for all (x1, . . . , xn): submodular polyhedron can be defined by arguments wi ∈ Qi n xi Xi=1 Xyi=1 wi(yi) ≤ f (x1, . . . , xn), n Xi=1 ki−1 Xyi=1 wi(yi) = f (k1 − 1, . . . , kn − 1). (8) (9) As mentioned in [2], this polyhedron is in fact not a polyhedron, and is unbounded, if there is any ki > 2. This can be made explicit in the following example. Example 2.1 (Base Polyhedron Unbounded). Let ki = 3 for some i. Then for that i, we can add to wi any ui such that u1(1) = −1, u1(2) = 1, (10) and we see this won't violate any of the equations in the definition. This argument extends straight- forwardly to any ki > 2. Because of this, they instead define the base polyhedron as the convex hull of outputs of a greedy algorithm. The following result shows that the base polyhedron still behaves in the same way: Lemma 2.1. Let f be some submodular function. Then for any ρ ∈ Qi Rki−1 ↓ we have that max w hw, ρi = f↓(ρ) − f (0), (11) where we take the max over either characterisation of the base polyhedron. We see that as long as we take a w compatible with the ordering ρ, we will get a subgradient for the function f↓(ρ). Restricting to the ρ that will give us points in the domain of our original submodular function f , we get an element of the subdifferential of f . 4 Now we can construct a lower bound. First, we construct a set A with r elements, each of which corresponds to an increment of one of the n basis vectors. There are ki − 1 copies of the increment of element i. Note that such a set A corresponds to a chain defined by 0 = p0 < p1 < . . . < pr = (k1 − 1, . . . , kn − 1). (12) Take a permutation of A denoted by σ and form its corresponding chain Cσ. Ensure σ is such that the chain pi contains z, something we define now. Definition 2.2 (Chain containing an element). Let pi be a chain as defined in Equation (12). We say the chain contains x, for some vector x = (x1, . . . , xn), if we have px1+...+xn = x. Note that any chain that contains a vector y is compatible with the ordering of the ρ that corresponds to y. In particular, we'll take the chain Cσ where we increment the first element to y1, then the second to y2 and so on. After it reaches y, we let it have any behaviour. Then we can form w by taking differences of successive elements of the chain. Now we can form the function corresponding to the lower bound by making w as described earlier. This will be denoted by hf,y(i, j) = wi(j). To extend this definition to an entire point x = (x1, x2, . . . , xn) we can do the following: hf,y(x) = n xi Xi=1 Xj=1 hf,y(i, j) = n xi Xi=1 Xj=1 wi(j). Now note that for each pi in the chain, we have that hf,y(pi) = f (pi). In particular, note that as y is contained in this chain, we have that hf,y(y) = f (y). Then due to the fact that this is a subgradient, we have that for all x. This is parameterised by y, σ and is tight at y. hf,y(x) ≤ f (x) 2.3 Upper Bound (13) (14) (15) (16) (17) In [10], an upper bound was derived for a submodular set function. This can be extended, but it does require DR-submodularity. We show now how to get around that as follows if we know one particular quantity: Lemma 2.2. Let f be a lattice submodular function. Then f can be represented as the sum of a modular function g and a DR-submodular function h. Proof. Let λ be the largest second difference of the function f that violates the DR property, or at least an upper bound of it. Because of submodularity, we know the difference will be a second difference entirely within one basis element. Namely, take: 5 λ ≤ max x,i (f (x + 2ei) − 2f (x + ei) + f (x)) . (18) Then let g = λ(x2 1 + . . . + x2 n). This will give us h = f − g DR-submodular as required. Computing the exact tight value of λ is often hard, but there are some cases where it will be easier to derive upper bounds: 1. If the function f is the discretisation of a continuous function, we can compute the largest positive eigenvalue, or an upper bound of it, via a number of eigenvalue algorithms. 2. If the function f is also L♮-convex (or midpoint convex), the function is convex-extensible [13], and so proceed similarly to above. 3. If the function f is a quadratic program, with f (x) = xT Ax + bT x + c, then we have that λ is the maximum positive diagonal element of A (or 0 if none exist). The idea now here is that we will let f = g + h, and then derive a modular and tight upper bound for h, thus giving our modular and tight upper bound for f as g is already modular. The aim for that is to generalise the bounds found in [10], given as f (Y ) ≤ f (X) − Xj∈X\Y f (Y ) ≤ f (X) − Xj∈X\Y f (jX \ j) + Xj∈Y \X f (jV \ j) + Xj∈Y \X f (j∅), f (jX). (19) (20) In this section, we assume that f is a lattice submodular function given on the product of sets {0, . . . , ki − 1}. The extension of these bounds is given in the following lemma: Lemma 2.3. Let f be a DR-submodular function as described. Let m(x) = max(x, 0) with m extending its arguments to vectors componentwise. Let x, y be vectors in Qi{0, . . . , ki}. Let (a1, . . . , an) = m(x − y), (b1, . . . , bn) = m(y − x). Then we have the following: f (y) ≤ f (x) − f (y) ≤ f (x) − n Xi=1 Xi=1 n [f (x) − f (x − aiei)] + n Xi=1 f (biei), [f (kmax) − f (kmax − aiei)] + n Xi=1 f (f (x + biei) − f (x)), where ei are the usual basis vectors. Proof. We first show the following bounds: (21) (22) (23) (24) (25) f (y) ≤ f (x) − f (y) ≤ f (x) − n Xi=1 Xi=1 n [f (x) − f (x − aiei)] + [f (biei + min(x, y)) − f (min(x, y))], Xi=1 n [f (max(x, y)) − f (max(x, y) − aiei)] + n Xi=1 f (f (x + biei) − f (x)). (26) 6 The proof proceeds similarly to the derivation in [10], but with unions and intersections replaced with mins and maxes respectively. We start with the second statement. Take an arbitrary x, y with ai, bi as before. Then note we have f (max(x, y)) − f (x) = = [f (x + i Xj=1 ρbi,ei (x + n Xi=1 n Xi=1 bjej) − f (x + i−1 Xj=1 bjej)] i−1 Xj=1 bjej), (27) (28) where we take a0, e0 = 0. Here ρa,b(c) denotes the marginal return on adding the value a in the basis vector b when the function already has argument c. Using the DR-submodular property, we then see n Xi=1 ρbi,ei(x + i−1 Xj=1 bjej) ≤ n Xi=1 ρbi,ei(x) = n Xi=1 f (x + biei) − f (x). (29) Similarly, we'll now consider the following expression: f (max(x, y)) − f (y) = = [f (y + i Xj=1 ρai,ei (y + n Xi=1 n Xi=1 ajej) − f (y + i−1 Xj=1 ajej)] i Xj=1 ajej − aiei) (30) (31) ≥ ρai,ei(max(x, y) − aiei) = n Xi=1 [f (max(x, y)) − f (max(x, y) − ai)]. (32) Subtracting these two gives us the required result. We now proceed to the first statement. We get the first inequality similarly to just how we proceeded: f (x) − f (min(x, y)) = = [f (x + i Xj=1 ρai,ei (y + n Xi=1 n Xi=1 ajej) − f (x + i−1 Xj=1 ajej)] i Xj=1 ajej − aiei) ≤ ρai,ei(x − aiei) = n Xi=1 [f (x) − f (x − aiei)]. The second also coming easily: f (y) − f (min(x, y)) = = ≤ = Xi=1 Xi=1y−x n [f (y + i Xj=1 ρbi,ei (y + n Xi=1 n Xi=1 n bjej) − f (y + i−1 Xj=1 bjej)] i−1 Xj=1 bjej), ρbi,ei (min(x, y)) [f (biei + min(x, y)) − f (min(x, y))]. 7 (33) (34) (35) (36) (37) (38) (39) And again we subtract to get the first bounds that we wanted. To get to the required result, simply apply DR-submodularity to the final term of the first bound and the second term of the second bound. We note that these bounds are separable. Additionally, we see that these bounds are tight at x, namely equality is achieved with y = x. This result also applies as written for continuous submodular functions, where the vectors x, y instead belong to [0, 1]n WLOG. 3 Three algorithms We describe the integer lattice majorisation-minimisation algorithms here, in Algorithms 1, 2, 3. In Algorithm 1, note that at every step we are minimising a lattice submodular function, which as shown in [2] to get this to arbitrary precision we have complexity O(( 2GBn )), for a continuous submodular function defined on [0, B]n with Lipschitz constant G (note that the author minimises a discretised version of the continuous function). For Algorithm 2, we are instead maximising, for which we have an approximation factor of 1/3 [7] and runs in O(kn) calls. For Algorithm 3, we are at each point minimising a modular function, which can be done easily in O(k′) function evaluations, )3 log( 2GBn ε ε where we have k′ = Pi ki, by evaluating each separated function at every point and taking the n minima. Additionally, we note that Algorithms 2, 3 will require in principle an upper bound on the quantity λ as described in Lemma 2.2. We note that we have quite easily: v(xt+1) = f (xt+1) − hg xt (xt) − hg ≤ mf σ(xt+1) σ(xt) = f (xt) − g(xt) = v(xt), (40) (41) (42) the second to last equality coming from the demonstrated tightness of our bounds. However, we note that the sequence may not strictly decrease, and we seek a convergence condition. For the upper bound, we can simply say try both of them, and if neither strictly decreases the function, we're done. For the lower bound, there are many permutations we can change and we want some sort of a stopping criterion. Algorithm 1: Integer lattice SubSup algorithm. input : Function v(x) = f (x) − g(x), where f and g are both submodular. output: A local minimum of v(x) 1 Discretise the function v(x) in a preferred way; 2 x0 ← (0, . . . , 0); t ← 0; 3 while not converged (xt+1 6= xt) do 4 5 6 7 Form the extension f↓(xt) of f (xt).; Choose a permutation σ such that the induced chain is compatible with xt; xt+1 = arg minx f↓(x) − hg t = t+1; σ(x); 8 Lemma 3.1. If we choose O(n) permutations each with different increments directly before and after xt, and attempt to decrease with both upper bounds and we are not successful, then we have reached a local minimum. Proof. Proof is functionally identical to the set function case as in [10], except instead of saying we consider all g(X ∪ j), g(X \ j), we just consider all g(x + ei), g(x − ei) where ei are basis vectors. Algorithm 2: Integer lattice SupSub algorithm. input : Function v(x) = f (x) − g(x), where f and g are both submodular and have bounded Hessian. output: A local minimum of v(x) 1 Discretise the function v(x) in a preferred way; 2 x0 ← (0, . . . , 0); t ← 0; 3 while not converged (xt+1 6= xt) do 4 5 xt+1 = arg minx mf t = t+1; xt (x) − g(x); Algorithm 3: Integer lattice ModMod algorithm. input : Function v(x) = f (x) − g(x), where f and g are both submodular and have bounded Hessian. output: A local minimum of v(x) 1 Discretise the function v(x) in a preferred way; 2 x0 ← (0, . . . , 0); t ← 0; 3 while not converged (xt+1 6= xt) do 4 5 6 Choose a permutation σ such that the induced chain is compatible with xt; xt+1 = arg minx mf t = t+1; xt (x) − hg σ(x); 4 Theoretical Analysis We note that we don't get any multiplicative approximation guarantees, as the hardness results are inherited from the set function case. However, we would like to extend the additive hardness results of [10]. While following their proof will rely on f being DR-submodular, we recall we can write f = g + h for g modular and h DR-submodular via Lemma 2.2. So now we act just on the DR-submodular function. This requires an extension of the decompo- sition from [5] which we give in a slightly weaker form: Lemma 4.1. Let f be any DR-submodular function with f (0) = 0. It can be decomposed into a modular function g plus a monotone function h with h(0) = 0. 9 Proof. We first construct the modular function g, then show that the function h = f −g is monotone, and takes the value 0 at 0. For any input y we form: g(y) = n yk Xk=1 Xj=1 mj,k j , (43) for 0 < j ≤ yk for each k. We note this decays to the modular function in [5] if we restrict all yk to {0, 1}. This function is clearly modular. Additionally, it is clear that h = f − g has h(0) = 0. To show that it is monotone: f ′(k + ei) = f (k + ei) − n y ′ k Xk=1 Xj=1 mj,k j f ′(k) = f (k) − n yk Xk=1 Xj=1 mj,k j . (44) (45) Note that in the first equation, there will be one extra term subtracted, hand side of the first equation here is greater than the second, as: mi,ki +1 ki+1 . We claim the right f (k + ei) − n y ′ k Xk=1 Xj=1 mj,k j − (f (k) − n yk Xk=1 Xj=1 mj,k j ) = f (k + ei) − f (k) − mi,ki+1 ki + 1 = 1 ki + 1 ((ki + 1)(f (k + ei) − f (k)) − (f (kmax) − f (kmax − eiki + 1))). (46) (47) (48) We then split up the second term to get: f (kmax) − f (kmax − eiki + 1)) = k1 Xj=1 f (kmax − (j − 1)ei) − f (kmax − jei), (49) and use the DR property to bound each individual term by f (k + ei) − f (k), giving us our result. Using this, we now have the following combining the two decompositions: Theorem 4.1. Let f be a lattice submodular function with f (0) = 0. Then f can be represented as the sum of a modular function g and a monotone submodular function h, with h(0) = 0. This will allow us to get additive bounds similar to [10]: Lemma 4.2. Consider the problem of minimising f (x) − g(x). Apply our decomposition to instead have v(x) = f ′(x) − g′(x) + k(x). Here k is modular, and f, g are monotone. Then we have: min v(x) ≥ min x f ′(x) + k(x) − g′(kmax), n Xk=1 (min y y Xi=1 mi,k i ). min v(x) ≥ f ′(0) − g′(kmax) + 10 (50) (51) (52) Proof. We have: min x v(x) = min x f ′(x) − g′(x) + k(x) ≥ min (f ′(x) + k(x)) − max g′(x) x x x = min (f ′(x) + k(x)) − g′(kmax), by monotonicity of g′. Next, we continue from the previous line: ≥ min x f ′(x) + min x k(x) − g′(kmax) = f ′(0) − g′(kmax) + n Xk=1 (min y y Xi=1 mi,k i ). (53) (54) (55) (56) (57) The nested optimisation problem here in the second bound is non-trivial, but for our purposes it doesn't actually need to be solved. All we need to see is that by setting y to zero, we can eliminate this term and thus by the monotonicity of f ′, g′, we will always get that this second bound is less than zero. We also prove some other results that show this algorithm can be broadly applied. The first results shows that we can efficiently minimise many functions using this approach: Lemma 4.3. Let v(x) be any function on the lattice {0, . . . , ki − 1}. Then v can be written as the difference of two submodular functions. Proof. Let g be any strictly submodular function on the same lattice, that is, one with all second differences over pairs i 6= j strictly less than zero. We shall denote by m the minimum absolute value of the second differences over all pairs i 6= j and x, that is: m = min i6=j,x g(x + ei + ej) − g(x + ei) − g(x + ej) + g(x). (58) As all second differences of g are less than zero as its submodular, note for any other difference m′ we have m′ m ≤ −1. We shall additionally define n to be the maximum absolute value of the second difference of v under the same constraint: n = max i6=j,x v(x + ei + ej) − v(x + ei) − v(x + ej) + v(x). We can now form the function f : f (x) = v(x) + n m g(x). (59) (60) We claim that f is submodular, which will give our result, as a submodular function scaled by a constant is submodular. To do this, take any of the second differences over pairs i 6= j of the function f . Denote the second difference as Di,j(f )(x). We find: as required. Di,j(f )(x) = Di,j(v)(x) + n m ≤ Di,j(v)(x) − n Di,j(g)(x) ≤ 0, 11 (61) (62) (63) Of course, n, m is in general hard to find, so another question that may be asked regarding this problem is how difficult it is to find the functions f, g corresponding to some v. That is answered with this result, extending [10]: Lemma 4.4. Suppose that we know n, or a lower bound on n as in the previous lemma. Then given a function v, we can construct submodular functions f, g such that v(x) = f (x) − g(x). Proof. Consider the submodular function on Qi{0, . . . , ki − 1}: p − 4Xi6=j g(x1, . . . , xp) = x2 1 + . . . + x2 xixj (64) We can clearly verify here that g is strictly submodular, and we have m = −4. Thus if we know a lower bound on n we can form f in the manner of Lemma 4.3 as required. Note that the choice of g in the proof above is not special, it simply needs to be submodular and we need to know its m. Thus depending on the particular problem v(x), different choices of g may give nice or meaningful decompositions. To do complexity analysis, we will be working on an ǫ-approximate version of the algorithm, introduced in [15]. This means that we will only proceed to step t+1 if we have v(xt+1) ≤ (1+ǫ)v(xt). The reason we do this comes from [10], as we know this problem for set functions is PLS-complete. We now consider the complexity of this procedure. The complexity in minimising the lattice version can be found from a lemma whose statement and proof can be adapted directly from [10]: Lemma 4.5. The ǫ-approximate version of each algorithm has a worst case complexity of O( log(M/m) where T is the complexity of the iterative step, M = f ′(0) − g′(kmax) and m = v(x1). ǫ T ), We also note that as described earlier, the ModMod procedure has the lowest complexity at each iteration. 4.1 Constrained Optimisation For the SubSup procedure, we are minimising a submodular function with some constraint at every iteration. However, we know that this is hard, and also hard to approximate [18] for the set function case, and so will be for ours also. Therefore this algorithm is not suitable for using constraints. We know that for some simple constraints such as cardinality, knapsack and polymatroid, the submodular maximisation problem has been studied on the integer lattice for monotone functions [17]. So at least for some subclasses, we can use the SupSub procedure to optimise under constraints. While to the best of our knowledge no-one has explicitly written algorithms for modular min- imisation on the integer lattice, we know it is easy and can be done exactly at least for cardinality constraints, where we can just enumerate all marginal gains and take the lowest in each variable. We will then take the B lowest, where our cardinality constraint says x(V ) ≤ B. In the set function case, we can optimise easily and exactly over a variety of other constraints [10]. However, here our separability also gives us linearity, something we lose on our lattice as we separate to arbitrary discrete functions. optimisation problems. It is worth looking into more of these constrained 12 5 Conclusion In [10], the authors studied the problem of minimising the difference between two submodular set functions. We have extended this to the case of general lattice submodular functions, without the DR requirement. Additionally, we note that via discretisation, our method can be applied to continuous functions also. In performing the majorisation-minimisation technique, we extended an earlier bound from [10] for the upper bound, which is valid for DR-submodular functions, and used a decomposition for submodular functions into DR-submodular functions plus a modular function to take advantage of it. For the lower bound, we used the method of computing the subgradient as in [2]. The result of this greedy algorithm gives us our lower bound, and did not require f to be DR-submodular. After that we formally stated our algorithms, performed some complexity analysis, and analysed other theoretical properties of it. One clear extension on this work would be finding an alternative lower bound that can be used on continuous functions, as our upper bound can already be used in this context. 13 References [1] Saeed Alaei, Ali Makhdoumi, and Azarakhsh Malekian. Maximizing sequence-submodular func- tions and its application to online advertising. arXiv preprint arXiv:1009.4153, 2010. [2] Francis Bach. Submodular functions: from discrete to continuous domains. Mathematical Programming, pages 1 -- 41, 2016. [3] An Bian, Kfir Levy, Andreas Krause, and Joachim M Buhmann. Continuous dr-submodular maximization: Structure and algorithms. In Advances in Neural Information Processing Sys- tems, pages 486 -- 496, 2017. [4] Niv Buchbinder, Moran Feldman, Joseph Seffi Naor, and Roy Schwartz. Submodular maxi- In Proceedings of the twenty-fifth annual ACM-SIAM mization with cardinality constraints. symposium on Discrete algorithms, pages 1433 -- 1452. Society for Industrial and Applied Math- ematics, 2014. [5] William H Cunningham. Decomposition of submodular functions. Combinatorica, 3(1):53 -- 68, 1983. [6] Alina Ene and Huy L Nguyen. A reduction for optimizing lattice submodular functions with diminishing returns. arXiv preprint arXiv:1606.08362, 2016. [7] Corinna Gottschalk and Britta Peis. Submodular function maximization on the bounded integer lattice. In International Workshop on Approximation and Online Algorithms, pages 133 -- 144. Springer, 2015. [8] Steven CH Hoi, Rong Jin, Jianke Zhu, and Michael R Lyu. Batch mode active learning and its application to medical image classification. In Proceedings of the 23rd international conference on Machine learning, pages 417 -- 424. ACM, 2006. [9] Satoru Iwata, Lisa Fleischer, and Satoru Fujishige. A combinatorial strongly polynomial al- gorithm for minimizing submodular functions. Journal of the ACM (JACM), 48(4):761 -- 777, 2001. [10] Rishabh Iyer and Jeff Bilmes. Algorithms for approximate minimization of the difference be- tween submodular functions, with applications. arXiv preprint arXiv:1207.0560, 2012. [11] Jon Lee, Vahab S Mirrokni, Viswanath Nagarajan, and Maxim Sviridenko. Non-monotone submodular maximization under matroid and knapsack constraints. In Proceedings of the forty- first annual ACM symposium on Theory of computing, pages 323 -- 332. ACM, 2009. [12] Hui Lin and Jeff A Bilmes. Learning mixtures of submodular shells with application to document summarization. arXiv preprint arXiv:1210.4871, 2012. [13] Satoko Moriguchi and Kazuo Murota. On discrete hessian matrix and convex extensibility. Journal of the Operations Research Society of Japan, 55(1):48 -- 62, 2012. [14] Mukund Narasimhan and Jeff A Bilmes. A submodular-supermodular procedure with applica- tions to discriminative structure learning. arXiv preprint arXiv:1207.1404, 2012. 14 [15] James B Orlin, Abraham P Punnen, and Andreas S Schulz. Approximate local search in combinatorial optimization. SIAM Journal on Computing, 33(5):1201 -- 1214, 2004. [16] Goran Radanovic and Boi Faltings. Incentive schemes for participatory sensing. In Proceedings of the 2015 International Conference on Autonomous Agents and Multiagent Systems, pages 1081 -- 1089. International Foundation for Autonomous Agents and Multiagent Systems, 2015. [17] Tasuku Soma and Yuichi Yoshida. Maximizing monotone submodular functions over the integer lattice. Mathematical Programming, 172(1-2):539 -- 563, 2018. [18] Zoya Svitkina and Lisa Fleischer. Submodular approximation: Sampling-based algorithms and lower bounds. SIAM Journal on Computing, 40(6):1715 -- 1737, 2011. 15
1905.00612
1
1905
2019-05-02T08:20:39
Online Circle Packing
[ "cs.DS", "cs.CG" ]
We consider the online problem of packing circles into a square container. A sequence of circles has to be packed one at a time, without knowledge of the following incoming circles and without moving previously packed circles. We present an algorithm that packs any online sequence of circles with a combined area not larger than 0.350389 0.350389 of the square's area, improving the previous best value of {\pi}/10 \approx 0.31416; even in an offline setting, there is an upper bound of {\pi}/(3 + 2 \sqrt{2}) \approx 0.5390. If only circles with radii of at least 0.026622 are considered, our algorithm achieves the higher value 0.375898. As a byproduct, we give an online algorithm for packing circles into a 1\times b rectangle with b \geq 1. This algorithm is worst case-optimal for b \geq 2.36.
cs.DS
cs
Online Circle Packing Sven von Hoveling2,[0000−0003−3937−2429], and S´andor P. Fekete1[0000−0002−9062−4241], Christian Scheffer1[0000−0002−3471−2706] 1 Department of Computer Science, TU Braunschweig, Germany {s.fekete,c.scheffer}@u-bs.de 2 Department of Computing Science, University of Oldenburg, Germany [email protected] Abstract. We consider the online problem of packing circles into a square container. A sequence of circles has to be packed one at a time, without knowledge of the following incoming circles and without moving previously packed circles. We present an algorithm that packs any online sequence of circles with a combined area not larger than 0.350389 of the square's area, improving the previous best value of π/10 ≈ 0.31416; even √ 2) ≈ 0.5390. If in an offline setting, there is an upper bound of π/(3 + 2 only circles with radii of at least 0.026622 are considered, our algorithm achieves the higher value 0.375898. As a byproduct, we give an online algorithm for packing circles into a 1×b rectangle with b ≥ 1. This algorithm is worst case-optimal for b ≥ 2.36. Keywords: Circle Packing · Online Algorithms · Packing Density. 1 Introduction Packing a set of circles into a given container is a natural geometric optimization problem that has attracted considerable attention, both in theory and practice. Some of the many real-world applications are loading a shipping container with pipes of varying diameter [9], packing paper products like paper rolls into one or several containers [8], machine construction of electric wires [18], designing control panels [2], placing radio towers with a maximal coverage while minimizing interference [19], industrial cutting [19], and the study of macro-molecules or crystals [20]. See the survey paper of Castillo, Kampas, and Pint´er [2] for an overview of other industrial problems. In many of these scenarios, the circles have to be packed online, i.e., one at a time, without the knowledge of further objects, e.g., when punching out a sequence of shapes from the raw material. Even in an offline setting, deciding whether a given set of circles fits into a square container is known to be NP-hard [4], which is also known for packing squares into a square [10]. Furthermore, dealing with circles requires dealing with possibly complicated irrational numbers, incurring very serious additional geometric difficulties. This is underlined by the slow development of provably optimal packings of n identical circles into the smallest possible square. In 1965, 2 S. P. Fekete, C. Scheffer, S. von Hoeveling Fig. 1. Circles are arriving one at a time and have to be packed into the unit square. At this stage, the packed area is about 0.33. What is the largest A ≥ 0 for which any sequence of total area A can be packed? Schaer [16] gave the optimal solution for n = 7 and n = 8 and Schaer and Meir [17] gave the optimal solution for n = 9. A quarter of a century later, Wurtz et al. [3] provided optimal solutions for 10,11,12, and 13 equally sized circles. In 1998, Nurmela and Ostergard [14] provided optimal solutions for n ≤ 27 circles by making use of computer-aided optimality proofs. Mark´ot and Csendes [12] gave optimal solutions for n = 28, 29, 30 also by using computer-assisted proofs within tight tolerance values. Finally, in 2002 optimal solutions were provided for n ≤ 35 by Locatelli and Raber [11]; at this point, this is still the largest n for which optimal packings are known. The extraordinary challenges of finding densest circle packings are also underlined by a long-standing open conjecture by Erdos and Oler from 1961 [15] regarding optimal packings of n unit circles into an equilateral triangle, which has only been proven up to n = 15. These difficulties make it desirable to develop relatively simple criteria for the packability of circles. A natural bound arises from considering the packing density, i.e., the total area of objects compared to the size of the container; the critical packing density δ is the largest value for which any set of objects of total area at most δ can be packed into a unit square; see Fig. 1. √ In an offline setting, two equally sized circles that fit exactly into the unit square show that δ ≤ δ∗ = π/(3 + 2 2) ≈ 0.5390. This is indeed tight: Fekete, Morr and Scheffer [7] gave a worst-case optimal algorithm that packs any in- stance with combined area at most δ∗; see Fig. 2 (left). More recently, Fekete, Keldenich and Scheffer [6] established 0.5 as the critical packing density of circles in a circular container. The difficulties of offline circle packing are compounded in an online setting. This is highlighted by the situation for packing squares into a square, which does not encounter the mentioned issues with irrational coordinates. It was shown in 1967 by Moon and Moser [13] that the critical offline density is 0.5: Refining an approach by Fekete and Hoffmann [5], Brubach [1] established the currently best lower bound for online packing density of 0.4. This yields the previous best bound for the online packing density of circles into a square: Inscribing circles into bounding boxes yields a value of π/10 ≈ 0.3142. ? Online Circle Packing 3 Fig. 2. Examples of algorithmic circle packings. (Left) The worst-case optimal offline algorithm of Fekete et al. [7] for packing circles into the unit square. (Center) The worst-case optimal offline algorithm of Fekete et al. [6] for packing circles into the unit circle. (Right) Our online algorithm for packing circles into the unit square. 1.1 Our Results In this paper, we establish new lower bounds for the online packing density of circles into a square and into a rectangle. Note that in the online setting, a packing algorithm has to stop as soon as it cannot pack a circle. We provide three online circle packing results for which we provide constructive proofs, i.e., corresponding algorithms guaranteeing the claimed packing densities. Theorem 1. Let b ≥ 1. Any online sequence of circles with a total area no larger can be packed into the 1 × b-rectangle R. than min This is worst-case optimal for b ≥ 2.36. 0.528607 · b − 0.457876, π (cid:16) (cid:17) 4 We use the approach of Theorem 1 as a subroutine and obtain the following: Theorem 2. Any online sequence of circles with a total area no larger than 0.350389 can be packed into the unit square. If the incoming circles' radii are lower bounded by 0.026623, the density guaranteed by the algorithm of Theorem 2 improves to 0.375898. Theorem 3. Any online sequence of circles with radii not smaller than 0.026623 and with a total area no larger than 0.375898 can be packed into the unit square. We describe the algorithm of Theorem 1 in Section 2 and the algorithm of the Theorems 2 and 3 in Section 3. 2 Packing into a Rectangle In this section, we describe the algorithm, Double-Sided Structured Lane Pack- ing (DSLP), of Theorem 1. In particular, DSLP uses a packing strategy called Structured Lane Packing (SLP) and an extended version of SLP as subroutines. 4 S. P. Fekete, C. Scheffer, S. von Hoeveling Fig. 3. Comparison of Tight Lane Packing (left) with Structured Lane Packing (right) for the same input. The former has a smaller packing length. 2.1 Preliminaries for the Algorithms A lane L ⊂ R2 is an x- and y-axis-aligned rectangle. The length (cid:96)(L) and the width w(L) of L are the dimensions of L such that w(L) ≤ (cid:96)(L). L is horizontal if the length of L is given via the extension of L w.r.t. the x-axis. Otherwise, L is vertical. The distance between two circles packed into L is the distance between the orthogonal projections of the circles' midpoints onto the longer side of L. A lane is either open or closed. Initially, each lane is open. Packing a circle C into a lane L means placing C inside L such that C does not intersect another circle that is already packed into L or into another lane. A (packing) strategy for a lane L is a set of rules that describe how a circle has to be packed into L. The (packing) orientation of a strategy for a horizontal lane is either rightwards or leftwards and the (packing) orientation of a strategy for a vertical lane is either downwards or updwards. Let w be the width of L. Depending on the radius r of the current circle C, we say: C is medium (Class 1) if w > r ≥ w 4 > r ≥ 0.0841305w (Class 2), C is tiny (Class 3 or 4) if 0.0841305w > r ≥ 0.023832125w, and C is very tiny if 0.023832125w > r (Classes 5,6, . . . ). For a more refined classification of r, we refer to Section 2.3. The general idea is to reach a certain density within a lane by packing only relatively equally sized circles into a lane with SLP. For the rest of Section 2, for 0 < w ≤ b, let L be a horizontal w × b lane. 4 , C is small if w 2.2 Structured Lane Packing (SLP) -- The Standard Version Rightwards Structured Lane Packing (SLP) packs circles into L alternating touching the bottom and the top side of L from left to right, see Fig. 3 (right). In particular, we pack a circle C into L as far as possible to the left while guaranteeing: (1) C does not overlap a vertical lane packed into L, see Section 2.3 for details3. (2) The distance between C and the circle C(cid:48) packed last into L is at least min{r, r(cid:48)} where r, r(cid:48) are the radii of C, C(cid:48), see Fig. 3 (right). Leftwards Structured Lane Packing packs circles by alternatingly touching the bottom and the top side of L from right to left. Correspondingly, upwards and downwards Structured Lane Packing packs circles alternatingly touching the left and the right side of L from bottom to top and from top to bottom. 3 Requiring that C does not overlap a vertical lane placed inside L is only important for the extension of SLP (see Section 2.3), because the standard version of SLP does not place vertical lanes inside L. Online Circle Packing 5 2.3 Extension of SLP -- Filling Gaps by (Very) Tiny Circles Now consider packing medium circles with SLP. We extend SLP for placing tiny and very tiny circles within the packing strategy, see Fig. 4. Note that small circles are not considered for the moment, such that (very) tiny circles are relat- evily small compared to the medium ones. In particular, if the current circle C is medium, we apply the standard version of SLP, as described in Section 2.2. If C is (very) tiny, we pack C into a vertical lane inside L, as described next. Fig. 4. A packing produced by extended SLP: 128 (3 medium, 17 tiny, and 108 very tiny) circles packed into 15 (1 medium, 4 tiny and 10 very tiny) lanes. A possible input order of the circles is 1 medium circle, 23 very tiny circles (filling the sparse block A), 1 medium circle, 13 tiny circles (filling the sparse block B), 24 very tiny circles (filling the vertical lane C), 1 medium circle, 2 tiny circles (filling the sparse block D), 11 very tiny circles (filling the sparse block E), and 2 tiny circles (filling the vertical lane F ). We pack (very) tiny circles into vertical lanes inside L, see Fig. 4. The vertical lanes are placed inside blocks that are the rectangles induced by vertical lines touching medium circles already packed into L, see Fig. 3 (right). Blocks that include two halves of medium circles are called dense blocks, while blocks that include one half of a medium circle are called sparse blocks. The area of L that is neither covered by a dense block or a sparse block is called a free block. Packing a vertical lane L(cid:48) into a sparse block B means placing L(cid:48) inside B as far as possible to the left, such that L(cid:48) does not overlap another vertical lane already packed into B. Packing a vertical lane L(cid:48) into L means placing L(cid:48) inside L as far as possible to the left, such that L(cid:48) does neither overlap another vertical lane packed into L, a dense block of L, or a sparse block of L. densesparseblockBsparseblockAblocksparseblockDsparseblockEverticallaneCverticallaneF7verticallanes2verticallanes1verticallane2verticallanes 6 S. P. Fekete, C. Scheffer, S. von Hoeveling We extend our classification of circles by defining classes i of lane widths wi and relative lower bounds qi for the circles' radii as described in Table 1. This means a circle with radius r belongs to class 1 if 0.5w ≥ r > q1w1 and to class i if qi−1wi−1 ≥ r > qiwi, for i ≥ 2. Only circles of class i are allowed to be packed into lanes of class i. Class i (Relative) lower bound qi Lane width wi q1 := qM := 0.25 q2 := qS := 0.168261 q3 := 0.371446 q4 := 0.190657 q5 := 0.175592 q6 := 0.170699 q7 := 0.169078 q8 := 0.168354 q9 := 0.168293 q10 := 0.168272 q11 := 0.168265 q12 := 0.168263 q13 := 0.168262 . . . qk := 0.168262 1 (Medium) 2 (Small) 3 (Tiny) 4 (Tiny) 5 (Very tiny) 6 (Very tiny) 7 (Very tiny) 8 (Very tiny) 9 (Very tiny) 10 (Very tiny) 11 (Very tiny) 12 (Very tiny) 13 (Very tiny) . . . k (Very tiny) Table 1. Circles are classified into the listed classes. Note that the lower bounds to the circles' radii is relative to the lane width, e.g., the absolute lower bound for circles inside a small lane is qSw2 = 0.168261w2. w1 := w w2 := 2qM w = 0.5 · w w3 := 4qM qSw = 0.168261 · w w4 := 8qM qSq3w ≈ 0.125 · w w5 := 16qM qSq3q4w ≈ 0.047664 · w w6 := 32qM qSq3q4q5w ≈ 0.016739 · w w7 ≈ 0.005715 · w w8 ≈ 0.001932 · w w9 ≈ 0.000651 · w w10 ≈ 0.000219 · w w11 ≈ 0.000074 · w w12 ≈ 0.000025 · w w13 ≈ 0.000008 · w . . . wk := 2k−1qM qSq3q4 · . . . · qk−1w A sparse block is either free, reserved for class 3, reserved for class 4, reserved for all classes i ≥ 5, or closed. Initially, each sparse block is free. We use SLP in order to pack a circle C of class i ≥ 3, into a vertical lane Li ⊂ L of class i and width wi by applying the Steps 1-5 in increasing order as described below. When one of the five steps achieves that C is packed into a vertical lane Li, the approach stops and returns successful. -- Step (1): If there is no open vertical lane Li ⊂ L of class i go to Step 2. Assume there is an open vertical lane Li of class i. If C can be packed into Li, we pack C into Li. Else, we declare Li to be closed. -- Step (2): We close all sparse blocks B that are free or reserved for class i in which a vertical lane of class i cannot be packed into B. -- Step (3): If there is an open sparse block B that is free or reserved for class i and a vertical lane of class i can be packed into B: • (3.1): We pack a vertical lane Li ⊂ L of class i into B. If the circle half that is included in B touches the bottom of L, we apply downwards SLP to Li. Otherwise, we apply upwards SLP to Li. Online Circle Packing 7 and i ≥ 5, we reserve B for all classes i ≥ 5. • (3.2): If B is free and i ∈ {3, 4}, we reserve B for class i. If B is free • (3.3): We pack C into Li. • (4.1): We pack a vertical lane Li of class i into L and apply upwards SLP • (4.2): We pack C into Li -- Step (4): If a vertical lane of class i can be packed into L: to Li. -- Step (5): We declare L to be closed and return failed. 2.4 Double-Sided Structured Lane Packing (DSLP) We use SLP as a subroutine in order to define our packing strategy Double-Sided Structured Lane Packing (DSLP) of Theorem 1. In particular, additionally to L, we consider two small lanes L1, L2 that partition L, see Fig. 5. Fig. 5. A packing produced by DSLP: The medium lane is packed from left to right by medium circles. The two contained small lanes are packed simultaneously in parallel from right to left by small circles. Rightwards Double-Sided Structured Lane Packing (DSLP) applies the ex- tended version of rightwards SLP to L and leftwards SLP to L1, L2. If the cur- rent circle C is medium or (very) tiny, we pack C into L. If C is small, we pack C into that lane of L1, L2, resulting in a smaller packing length. Leftwards DSLP is defined analogously, such that the extended version of leftwards SLP is applied to L and rightwards SLP to L1, L2. Correspondingly, upwards and downwards DSLP are defined for vertical lanes. 3 Packing into the Unit Square We extend our circle classification by the class 0 of large circles and define a relative lower bound q0 := w 2 and the lane width of corresponding large lanes as w0 := 1 − w. We set w to 0.288480 and 0.277927 for Theorem 2 respectively Theorem 3. In order to pack large circles, we use another packing strategy called Tight Lane Packing (TLP) defined as SLP, but without restrictions (1) and (2), see Fig. 3. LL1L2ft(L)fb(L) 8 S. P. Fekete, C. Scheffer, S. von Hoeveling Fig. 6. Left: The unit square is divided into four lanes L1, L2, L3, and L4, into which medium, small, tiny, and very tiny circles are packed. Large circles are packed into a lane L0 that overlaps L1, L2, and L3. Right: An example packing. A medium circle (dotted) does not fit. We cover the unit square by the union of one large lane L0 and four medium lanes L1, . . . , Lk for k = 4, see Fig. 6. We apply TLP to L0 and DSLP to L1, . . . , L4. The applied orientations for L0, L1, L2 are leftwards, rightwards, and downwards. For i = 3, 4, the orientation for Li is chosen such that the first circle packed into Li is placed adjacent to the bottom side of Li. If the current circle to be packed is large, we pack C into the large lane L0 and stop if C does not fit in L0. Otherwise, in increasing order we try to pack C into L1, . . . , L4. 4 Analysis of the Algorithms In this section we sketch the analysis of our approaches and refer to the appendix for full details. First, we analyze the packing density guaranteed by DSLP. Based on that, we prove our main results Theorems 1, 2, and 3. 4.1 Analysis of SLP In this section, we provide a framework for analyzing the packing density guar- anteed by DSLP for a horizontal lane L of width w. It is important to note that this framework and its analysis in this subsection deals with the packing of only one class into a lane. We introduce some definitions. The packing length p(L) is the maximal differ- ence of x-coordinates of points from circles packed into L. The circle-free length f (L) of L is defined as (cid:96)(L)− p(L). We denote the total area of a region R ⊂ R2 by area(R) and the area of an a×b-rectangle by R(a, b). Furthermore, we denote the area of a semicircle for a given radius r by H(r) := π 2 r2. The total area of the circles packed into R is called occupied area denoted by occ(R). Finally, the density den(R) is defined by occ(R)/area(R). In order to apply our analysis for different classes of lanes, i.e., different lower bounds, we consider a general (relative) lower bound q for the radii of circles L2L1L3L4L0w1−wwww allowed to be packed into L with 0 < q ≤ 1/2. The following lemma deduces a lower bound for the density of dense blocks depending on q. Online Circle Packing 9 Lemma 1. Consider a dense block D containing two semicircles of radii r1 and r2 such that 0 < qw ≤ r1, r2 ≤ 1/2w. Then den(D) is lower-bounded by (cid:18) (cid:21) 1 2 δ : 0, → R with q (cid:55)→  ≈ 0.6046 πq √ π 3 3 πq2√ 4q−1 3 √ 0 < q < 1 3 ≤ q ≤ 1 √ 1 3 < q ≤ 1 2 . 3 1 3 3 Fig. 7. (Left): A plot of δ(q) for its complete range. It provides the minimal density of a dense block whose two semicircles have a radius of at least q · w. A lower bound of q = 1/2 leads to a minimal density of π/4 which is the ratio of a circle to its minimal bounding square. (Right): (1): δ(0.15) ≈ 0.47123, (2): δ( 1 ) ≈ 0.6046, and √ (3): δ(0.4) ≈ 0.6489. 3 3 We continue with the analysis of sparse blocks. Sparse blocks have a minimum length qw. Lemma 2 states a lower bound for the occupied area of sparse blocks. This lower bound consists of a constant summand and a summand that is linear with respect to the actual length. Lemma 2. Given a density bound δmin ≤ δ(q) for dense blocks. Let S be a sparse block and z be the lower bound for (cid:96)(S) with (cid:96)(S) ≥ z ≥ qw. Then occ(S) ≥ R((cid:96)(S) − z, w) · δmin + H(z). The occupied area of a sparse block is at least a semicircle of a smallest possible circle plus the remaining length multiplied by the lane width and by the minimal density δmin of dense blocks. This composition is shown in Fig. 8. Next, we combine the results of Lemma 1 and Lemma 2. We define the term (cid:1) := R(p− 2z, w)· δmin + 2·H(z) for some p, w, z, δmin > 0 (cid:0)p, w, z, δmin minSLP and state the following (see also Fig. 8 (4)). Lower Limit qMinimal densityFunctionpqp(33)(pq2)4q-10.00.10.20.30.40.50.00.20.40.60.81.0(1)(2)(3) 10 S. P. Fekete, C. Scheffer, S. von Hoeveling Fig. 8. (1)+(2)+(3) Three sparse blocks S1, S2, S3 in order of ascending length. The grey coloured area (light and dark unified) represents the occupied area. The dashed area shows the lower bound of Lemma 2, which is composed of the smallest possible semicircle plus a linear part. The dark grey parts symbolize the area that exceeds the bound, whereas the red parts symbolize the area missing to the bound. Block S1 has the minimal length p so that the occupied area and the bound are equal. For blocks of larger length, represented by S2 and S3, the dark grey area is larger than the red area. (4) A packing produced by SLP and the lower bound of Lemma 3. Lemma 3. Given a lane L packed by SLP, a lower bound q, and a density bound δmin ≤ δ(q) for dense blocks. Let w be the width of L. The occupied area in L is lower-bounded by minSLP (cid:0)p(L), w, qw, δmin (cid:1). 4.2 Analysis of DSLP Let L be a horizontal lane packed by DSLP. We define pt(L) (pb(L)) as the sum of the packing lengths of the packing inside L and the length of the packing inside the top (bottom) small lane inside L. Furthermore, we define ft(L) := (cid:96)(L) − pt(L) and fb(L) := (cid:96)(L) − pb(L), see Fig. 5. By construction, vertical dense blocks packed into L have a density of at least δ(q2). In fact, the definitions of circle sizes for all classes i ≥ 2 ensure the common density bound δ := δ(q2) for dense blocks. We consider mixed dense blocks, that were defined as sparse blocks of L in which vertical lanes are packed, also as dense blocks and extend the lower bound den(D) ≥ δ to all kinds of dense blocks by the following Lemma. Lemma 4. Let D be a dense block of L. Assume all vertical lanes packed into D to be closed. Then den(D) ≥ δ. As some vertical lanes may not be closed, we upper bound the error O(L) that we make by assuming that all vertical lanes L1, . . . , Ln ⊂ L are closed. Lemma 5. O(L1 ∪ . . . ∪ Ln) < 0.213297 · w2. We lower bound the occupied area inside L by using the following term: minDSLP (pt(L), pb(L), w, z, δmin) := R(cid:0)pt(L) + pb(L) − w − 4z, w2 (cid:1) · δmin +2 · H(cid:0) w (cid:1) + 4H(z), 4 zzS1S2(1)(2)zS3z(3)(4) Online Circle Packing 11 where z denotes the minimal radius for the circles, i.e., z := q2w2. Applying Lemma 4 and Lemma 2 separately to L, L1, and L2, analogous to the combination of Lemma 1 and Lemma 2 in the last subsection, and estimating the error O(L) with Lemma 5, yields lower bounds for the occupied areas of L, L1, and L2. Fig. 9 separately illustrates the lower bounds for the occupied areas of L, L1, and L2 for two example packings and Lemma 6 states the result. Fig. 9. Two example packings and the compositions of our lower bounds (red) for the occupied area implied by Lemma 6. Note that O(L) is not visualized. (cid:0)pt(L), pb(L), w, z, δ(cid:1) − O(L) ≥ occ(L). Lemma 6. minDSLP 4.3 Analysis of Packing Circles into a Rectangle Given a 1 × b rectangle R, we apply DSLP for packing the input circles into R. Theorem 1. Let b ≥ 1. Any online sequence of circles with a total area no larger can be packed into the 1 × b-rectangle R. than min This is worst-case optimal for b ≥ 2.36. 0.528607 · b − 0.457876, π (cid:16) (cid:17) 4 4 − q2)· δ + π The lower bound for the occupied area implied by Lemma 6 is equal to Hence, the online sequence consisting of one circle with a radius of 1 resulting total area of π Fig. 10. This concludes the proof of Theorem 1. 2 (q2)2 − 0.213297. This is lower bounded by π 4 for b ≥ 2.36. 2 +  and 4 +  is a worst case online sequence for b ≥ 2.36, see 16 + π (cid:0)b− 3 Fig. 10. A worst case for packing circles into an 1 × b-rectangle with b ≥ 2.36 consists of one circle with radius 1 2 + . The shown circle with radius 1 2 just fits. 4.4 Analysis of Packing Circles into the Unit Square In this section, we analyze the packing density of our overall approach for online packing circles into the unit square. In order to prove Theorem 3, i.e., a lower bound for the achieved packing density, we show that if there is an overlap or if 12 S. P. Fekete, C. Scheffer, S. von Hoeveling Fig. 11. (Left): Different cases for an overlap. Case 0: A single circle is too large for L0. Case 1: L0 exceeded. Case 2: Overlap in L2. Case 3: Overlap in L3. Case 4: Overlap in L4 with large circle being involved. Case 5: Overlap in L4 with no large circle being involved. (Right): A plot of 24 terms for corresponding 24 (sub-)cases for qS = 0.191578. The point P = (0.277927, 0.375898) is the highest point of the 0-level. Its y-value is the highest guaranteed packing density for circles with minimal radii of 0.191578 · 0.277927/2 < 0.0266223. there is no space in the last lane, then the occupied area must be at least this lower bound. Our analysis distinguishes six different higher-level cases of where and how the overlap can happen, see Fig. 11 left. For each of the six cases and its subcases, we explicitly give a density function, providing the guaranteed packing density depending on the choice of w, see Fig. 11 right. The shown functions are constructed for the case of no (very) tiny circles with an alternative q2 = 0.191578, which was chosen numerically in order to find a high provable density. The w with the highest guaranteed packing density of 0.375898 is w = 0.277927. This concludes the proof of Theorem 3. Theorem 3. Any online sequence of circles with radii not smaller than 0.026623 and with a total area no larger than 0.375898 can be packed into the unit square. With the same idea but with w = 0.288480 and all circles classes, especially with classes i ≥ 2 as defined in Table 1, we prove Theorem 2. Theorem 2. Any online sequence of circles with a total area no larger than 0.350389 can be packed into the unit square. 5 Conclusion We provided online algorithms for packing circles into a square and a rectangle. For the case of a rectangular container, we guarantee a packing density which is worst-case optimal for rectangles with a skew of at least 2.36. For the case of a square container, we provide a packing density of 0.350389 which we improved to 0.375898 if the radii of incoming circles are lower-bounded by 0.026622. (1)(2)(3)(4)(5)(5)(5)(0)Width wMinimal density aCase0123.1.13.1.23.1.33.2.13.2.23.2.43.2.53.3.13.3.23.4.13.4.24.1.14.1.24.2.24.2.34.2.45.15.25.35.4.15.4.20.270.280.290.300.310.320.330.340.360.380.400.420.44P Online Circle Packing 13 References 1. B. Brubach. Improved online square-into-square packing. In Proc. 12th Interna- tional Workshop on Approximation and Online Algorithms (WAOA), pages 47 -- 58, 2014. 2. I. Castillo, F. J. Kampas, and J. D. Pint´er. Solving circle packing problems by global optimization: numerical results and industrial applications. European J. of Operational Research, 191(3):786 -- 802, 2008. 3. C. de Groot, R. Peikert, and D. Wurtz. The optimal packing of ten equal circles in a square. Technical Report 90-12, ETH Zurich, Switzerland, 1990. 4. E. D. Demaine, S. P. Fekete, and R. J. Lang. Circle packing for origami design is hard. In Proceedings 5th International Conference on Origami in Science, Mathe- matics and Education (Origami5), pages 609 -- 626. A. K. Peters/CRC Press, 2010. 5. S. P. Fekete and H. Hoffmann. Online square-into-square packing. Algorithmica, 77(3):867 -- 901, 2017. 6. S. P. Fekete, P. Keldenich, and C. Scheffer. Packing disks into disks with optimal worst-case density. In Proc. 35th Symposium on Computational Geometry (SoCG), 2019. to appear. 7. S. P. Fekete, S. Morr, and C. Scheffer. Split packing: Algorithms for packing circles with optimal worst-case density. Discrete & Computational Geometry, 2018. Online First at https://doi.org/10.1007/s00454-018-0020-2. 8. H. J. Fraser and J. A. George. Integrated container loading software for pulp and paper industry. European J. of Operational Research, 77(3):466 -- 474, 1994. 9. J. A. George, J. M. George, and B. W. Lamar. Packing different-sized circles into a rectangular container. European J. of Operational Research, 84(3):693 -- 712, 1995. 10. J. Y. T. Leung, T. W. Tam, C. S. Wong, G. H. Young, and F. Y. Chin. Packing squares into a square. Journal of Parallel and Distributed Computing, 10(3):271 -- 275, 1990. 11. M. Locatelli and U. Raber. Packing equal circles in a square: a deterministic global optimization approach. Discrete Applied Mathematics, 122(1):139 -- 166, 2002. 12. M. C. Mark´ot and T. Csendes. A new verified optimization technique for the" packing circles in a unit square" problems. SIAM J. on Optimization, 16(1):193 -- 219, 2005. 13. J. W. Moon and L. Moser. Some packing and covering theorems. Colloquium Mathematicae, 17(1):103 -- 110, 1967. 14. J. K. Nurmela and J. P. R. Ostergard. More optimal packings of equal circles in a square. Discrete & Computational Geometry, 22(3):439 -- 457, 1998. 15. N. Oler. A finite packing problem. Canad. Mathematical Bulletin, 4:153 -- 155, 1961. 16. J. Schaer. The densest packing of nine circles in a square. Canad. Mathematical Bulletin, 8:273 -- 277, 1965. 17. J. Schaer and A. Meir. On a geometric extremum problem. Canad. Mathematical Bulletin, 8(1), 1965. 18. K. Sugihara, M. Sawai, H. Sano, D. S. Kim, and D. Kim. Disk packing for the estimation of the size of a wire bundle. Japan Journal of Industrial and Applied Mathematics, 21(3):259 -- 278, 2004. 19. P. G. Szab´o, M. C. Mark´ot, T. Csendes, E. Specht, L. G. Casado, and I. Garc´ıa. New Approaches to Circle Packing in a Square: With Program Codes, volume 6 of Springer Optimization and Its Applications. Springer, 2007. 20. D. Wurtz, M. Monagan, and R. Peikert. The history of packing circles in a square. Maple Technical Newsletter, pages 35 -- 42, 1994.
1708.04862
1
1708
2017-08-16T12:47:19
New Approximations for Coalitional Manipulation in General Scoring Rules
[ "cs.DS" ]
We study the problem of coalitional manipulation---where $k$ manipulators try to manipulate an election on $m$ candidates---under general scoring rules, with a focus on the Borda protocol. We do so both in the weighted and unweighted settings. We focus on minimizing the maximum score obtainable by a non-preferred candidate. In the strongest, most general setting, we provide an algorithm for any scoring rule as described by a vector $\vec{\alpha}=(\alpha_1,\ldots,\alpha_m)$: for some $\beta=O(\sqrt{m\log m})$, it obtains an additive approximation equal to $W\cdot \max_i \lvert \alpha_{i+\beta}-\alpha_i \rvert$, where $W$ is the sum of voter weights. For Borda, both the weighted and unweighted variants are known to be $NP$-hard. For the unweighted case, our simpler algorithm provides a randomized, additive $O(k \sqrt{m \log m} )$ approximation; in other words, if there exists a strategy enabling the preferred candidate to win by an $\Omega(k \sqrt{m \log m} )$ margin, our method, with high probability, will find a strategy enabling her to win (albeit with a possibly smaller margin). It thus provides a somewhat stronger guarantee compared to the previous methods, which implicitly implied a strategy that provides an $\Omega(m)$-additive approximation to the maximum score of a non-preferred candidate. For the weighted case, our generalized algorithm provides an $O(W \sqrt{m \log m} )$-additive approximation, where $W$ is the sum of voter weights. This is a clear advantage over previous methods: some of them do not generalize to the weighted case, while others---which approximate the number of manipulators---pose restrictions on the weights of extra manipulators added. Our methods are based on carefully rounding an exponentially-large configuration linear program that is solved by using the ellipsoid method with an efficient separation oracle.
cs.DS
cs
New Approximations for Coalitional Manipulation in General Scoring Rules Orgad Keller [email protected] Department of Computer Science, Bar-Ilan University, Israel Avinatan Hassidim [email protected] Department of Computer Science, Bar-Ilan University, Israel Noam Hazon [email protected] Department of Computer Science, Ariel University, Israel Abstract We study the problem of coalitional manipulation -- where k manipula- tors try to manipulate an election on m candidates -- under general scoring rules, with a focus on the Borda protocol. We do so both in the weighted and unweighted settings. For these problems, recent approaches to approximation tried to min- imize k, the number of manipulators needed to make the preferred candi- date win (thus assuming that the number of manipulators is not limited in advance), we focus instead on minimizing the maximum score obtainable by a non-preferred candidate. √ In the strongest, most general setting, we provide an algorithm for for some any scoring rule as described by a vector (cid:126)α = (α1, . . . , αm): m log m), it obtains an additive approximation equal to W · β = O( maxiαi+β − αi, where W is the sum of voter weights. In words, this factor is the maximum difference between two scores in (cid:126)α that are β entries away, multiplied by W . The unweighted equivalent is provided as well. √ For Borda, both the weighted and unweighted variants are known to √ be NP-hard. For the unweighted case, our simpler algorithm provides a randomized, additive O(k m log m) approximation; in other words, if there exists a strategy enabling the preferred candidate to win by an m log m) margin, our method, with high probability, will find a strat- Ω(k egy enabling her to win (albeit with a possibly smaller margin). It thus provides a somewhat stronger guarantee compared to the previous meth- ods, which implicitly implied (with respect to the original k) a strategy that provides an Ω(m)-additive approximation to the maximum score of 1 a non-preferred candidate: when k is o((cid:112)m/ log m), our strategy thus provides a stronger approximation. For the weighted case, our generalized algorithm provides an O(W √ m log m)- additive approximation, where W is the sum of voter weights. This is a clear advantage over previous methods: some of them do not general- ize to the weighted case, while others -- which approximate the number of manipulators -- pose restrictions on the weights of extra manipulators added. We note that our algorithms for Borda can also be viewed as a (1 + o(1))-multiplicative approximation since the values we approximate have natural Ω(km) (unweighted) and Ω(W m) (weighted) lower bounds. Our methods are novel and adapt techniques from multiprocessor scheduling by carefully rounding an exponentially-large configuration lin- ear program that is solved by using the ellipsoid method with an efficient separation oracle. We believe that such methods could be beneficial in social choice settings as well. 1 Introduction Elections are one of the pillars of democratic societies, and are an important part of social choice theory. In addition they have played a major role in mul- tiagent systems, where a group of intelligent agents would like to reach a joint decision [9]. In its essence, an election consists of n agents (also called voters) who need to decide on a winning candidate among m candidates. In order to do so, each voter reveals a ranking of the candidates according to his preference and the winner is then decided according to some protocol. Ideally in voting, we would like the voters to be truthful, that is, that their reported ranking of the candidates will be their true one. However, almost all voting rules are prone to manipulation: Gibbard and Satterthwaite [11, 22] show that for any reasonable preference-based voting system with at least 3 candidates, voters might benefit from reporting a ranking different than their true one in order to make sure that the candidate they prefer the most wins. Furthermore, several voters might decide to collude, to form a coalition and then to coordinate their votes in such a way that a specific candidate p (hereafter the preferred candidate) will prevail. Such a setting is reasonable especially when the voters are agents that are operated by one party of interest. For some time, the hope for making voting protocols immune to manipula- tions at least in practice relied on computational assumptions: for several com- mon voting protocols, it was shown that computing a successful voting strategy for the manipulators is NP-hard [3, 6, 25, 10]. However, as it is many times the case, approximation algorithms and heuristics were devised in order to overcome the NP-hardness albeit with some compromises on the quality of the resulting strategy. This paper fits within this scheme. In this paper we focus on general scoring rules R(cid:126)α and in particular on the Borda voting rule. We first study the problem of (constructive) unweighted 2 coalitional manipulation (UCM )1: assume that k additional voters (hereafter the manipulators), all of them preferring a specific candidate p, can be added to the voting system, thus forming a coalition. Also assume that all n original voters (hereafter the non-manipulators) voted first (or equivalently, that the non-manipulators are truthful and that their preferences are known). Find a strategy for the manipulators telling each one of them how to vote so that p wins, if such strategy exists. We call such a strategy a p-winning strategy. In the weighted variant (WCM ), the manipulators are weighted; essentially this means that points awarded by a voter to a candidate are multiplied by the voter's weight. R(cid:126)α-WCM, for all positional scoring rules R(cid:126)α, except plurality-like rules, was shown to be NP-hard when m ≥ 3 [6, 13, 21]. Therefore, Borda-WCM is NP- hard. Borda-UCM eluded researchers for some time; it was first conjectured and finally proven to be NP-hard [7, 4]. As a way of overcoming the hardness, recent research [26] focused on an approximation to the minimum number of manipulators needed to be added to the system in order to guarantee that the preferred candidate p would win. For Borda-UCM, they showed that if there exists a p-winning strategy for k manip- ulators, then they will find a p-winning strategy with at most one additional manipulator -- besides the k given by the problem definition. For Borda-WCM, they showed that if there exists a p-winning strategy using the k given weighted manipulators, they will find a p-winning strategy using additional manipulators, if the sum of weights of the additional manipulators equals the maximum over the weights of the k original manipulators. This kind of approximation might seem a bit problematic: first, the ability to add a manipulator is a strong operation, perhaps too strong; for instance, for Borda-UCM, adding a manipulator adds Ω(m) to the difference between p and its highest-scoring competitor. Second, while in some cases it might be reasonable that the party behind the manipulators can add another manipulator to the system, in many cases we do not expect this to be true. Furthermore, in the weighted case assumptions are needed to be made on the weight of the additional manipulators -- also a problematic aspect. Instead, it is interesting to ask what can we assert -- assuming that the number of manipulators cannot be changed -- on the ability to promote a specific candidate p given the non- manipulator scores of all candidates and the value k (or equivalently, the length- k vector of manipulator weights). We provide a positive result of the following type: Main Result: If there exists a manipulation strategy enabling p to win by a large-enough margin, we efficiently find a successful ma- nipulation strategy making p win. Take the unweighted case as an example: assume that we can provide, for some function f (k, m), an f (k, m)-additive approximation to the maximum difference 1The problem was called CCUM, for "constructive coalitional unweighted manipulation", in [26]. 3 obtainable between p's final score and the final score of the highest-scoring non- preferred candidate. Then, if there exists a p-winning strategy such that this difference is at least f (k, m), we can be rest-assured that the algorithm will find a p-winning strategy. This, in turn, boils down to approximating an upper-bound to the score of the highest-ranked candidate who is not p. Earlier research of this flavor for R(cid:126)α- focused only on cases where the number of candidates is bounded: WCM, Brelsford et al. [5] provide an FPTAS to that upper bound (to be exact, they provide an FPTAS to the same exact value we defined, and then use it to provide another FPTAS to another value, which is their value-of-interest.2) For R(cid:126)α-UCM, if the number of candidates is bounded, the entire problem becomes easy and polynomial-time solvable [6, Proposition 1]. Compared to this line of work, we do not limit ourselves to bounded number of candidates. 1.1 Our Results and Contributions Consider a general positional scoring rules R(cid:126)α, as is usually described by a vector (cid:126)α = (α0, . . . , αm) (see Section 2.1 for full definitions). Now let T ∗ = minS maxc(cid:48)∈C\{p} scoreR(cid:126)α,E,S(c(cid:48)) be the minimum possible score (ranging over all possible manipulation strategies S) of the highest scoring candidate who is not p, where scoreR(cid:126)α,E,S(c(cid:48)) is the final score of a candidate c(cid:48) (w.r.t. voting rule R(cid:126)α, election E, and strategy S) and C is the candidate set. √ Our main technical contribution is a constructive proof to the following m log m for some constant d, and let g((cid:126)α) = two theorems. Let β = d maxi=0,...,m−βαi+β − αi. In words, g((cid:126)α) is the biggest difference between a score in (cid:126)α and another score β entries away from it. Theorem 1. There exists a randomized Monte Carlo algorithm for R(cid:126)α-UCM which provides a k · g((cid:126)α)-additive approximation to T ∗ with an exponentially- small failure probability. Theorem 2. There exists a randomized Monte Carlo algorithm for R(cid:126)α-WCM which provides a W · g((cid:126)α)-additive approximation to T ∗ with an exponentially- small failure probability, where W is the sum of voter weights. These theorems immediately pave the way to the following corollaries: Corollary 3. There exists a randomized Monte Carlo algorithm for Borda- m log m)-additive approximation to T ∗ with an UCM which provides an O(k exponentially-small failure probability. √ Corollary 4. There exists a randomized Monte Carlo algorithm for Borda- m log m)-additive approximation to T ∗ with an WCM which provides an O(W exponentially-small failure probability. √ 2They are interested in the difference between the score of the preferred candidate and the highest-scoring non-preferred candidate when including the manipulator votes, minus the same difference when not including the manipulator votes. Notice that the upper-bound we defined is the only non-trivial value in this computation. 4 Taking Borda-UCM as an example, if there exists a p-winning strategy en- abling p to win by a margin of Ω(k m log m) compared to the score of the highest-scoring non-preferred candidate, our method will find a p-winning strat- egy (albeit with a possibly smaller margin). Similar guarantees apply in the more general settings. √ Notice that for Borda, such approximations can also be seen as a (1 + o(1))- multiplicative approximation on the score of the highest-scoring non-preferred candidate, and thus is superior to an FPTAS; to see that, notice that for Borda- WCM the overall 'voting mass' given by the manipulators is Ω(W m2), and so the highest scoring candidate has score of at least Ω(W m). Therefore O(W m) 3 is a lower order term. This is an advantage over the previous methods: √ • Opposed to the heuristics in [8], we provide provable guarantees. • Also opposed to the heuristics in [8], our algorithm generalizes to the weighted case. • Compared to the reverse algorithm of [26] for Borda-UCM, while adding only a single extra manipulator sounds like a minor operation, it is not; as mentioned, an extra manipulator implies the addition of Ω(m) points to the difference between p and its highest-scoring competitor. • Consider the reverse algorithm of [26], and assume that adding extra manipulators is not allowed. We will show that their method implies no better than an Ω(m)-additive approximation to the score of the highest- scoring non-preferred candidate. Our approximation is thus superior when k is o((cid:112)m/ log m). • Compared to previous methods, are results are linear-programming-based, and not greedy. Thus, they make a decision based on the entire input, as opposed to repeatedly making a decision based on a greedy estimate w.r.t. some subset of the problem. The following claim analyzes reverse according to our metric. It is proven in Section 3. Claim 5. For any m, when the addition of more than k extra manipulators is not allowed, there are families of cases in which the optimal strategy enables p to win by a margin of at least m/3, but reverse fails to find a p-winning strategy. Our techniques are novel: they employ the use of configuration linear pro- grams (C-LP), a method that is also used in the scheduling literature, namely for two well-studied problems, the problem of scheduling on unrelated machines [24], and the so-called Santa Claus problem [2]. See Section 1.2 for a discussion of these problems. It is important to note that the solutions to the two above prob- lems and to ours all differ from one another with respect to how the algorithm proceeds once the C-LP result is computed. 3The O notation suppresses poly-logarithmic factors. 5 C-LPs are used for the generation of an initial, invalid strategy, which is later modified to become valid. They are unique in the sense that they are linear programs that have an exponential number of variables, an issue which we solve by referring to the LP dual and using the ellipsoid method with a polynomially-computable separation oracle [17, 12]. We have also implemented our algorithm: as a result of not finding a library which enables solving an LP this way, we simulated this by an iterative use of a general LP-solving library, each time adding a violated constraint based on running the separation oracle externally. 1.2 Related Work Borda. The Borda voting mechanism was introduced by Jean-Charles de Borda in 1770. It is used, sometimes with some modifications, by parliaments in countries such as Slovenia, and competitions such as the Eurovision song contest, selecting the MVP in major league baseball, Robocup robot soccer competitions and others. The Borda voting mechanism is described as follows: every agent ranks the candidates from 1 to m, and awards the candidate ranked i-th a score of m − i. Notice that this makes the scores given by each single voter a permutation of 0, . . . , m − 1. Finally, the winning candidate is the one with the highest aggregate score. Easiness Results. The computational complexity of coalitional manipulation problems was studied extensively. For general scoring rules R(cid:126)α, most earlier work considered the case where the number of candidates is bounded: Conitzer at al. [6] show that when m is bounded, R(cid:126)α-UCM is solvable in polynomial time. Even when m is unbounded, Plurality-UCM and Veto-UCM are still easy using the greedy algorithm of Zuckerman et al. [26]. This also holds for t- approval-UCM, which generalizes both [19]. NP-Hardness Results. In the weighted case, the situation is different: for all positional scoring rules R(cid:126)α, except plurality-like rules, R(cid:126)α-WCM is NP-hard when m ≥ 3 [6, 13, 21]. In particular, this holds for Borda-WCM. However, the computational hardness of Borda-UCM still remained open for quite some time, until finally shown to be NP-hard as well [7, 4] in 2011, even for the case of n = 3 and adding 2 manipulators. Approximating the number of manipulators. Zuckerman et al. [26] present a greedy algorithm later referred to as reverse4. reverse works as follows: after the non-manipulators had finished voting, we go over the manipulators one by one, and each manipulator will rank the candidates (besides p) by the reversed order of their aggregated score so far (candidate with the highest score so far gets the lowest ranking). As mentioned, for Borda-UCM, reverse can be 4This name was given in [7]. 6 seen as an additive +1 approximation for the objective of finding the minimum number of manipulators needed. For Borda-WCM, their approximation has the following flavor. Let S be the set of the k given weighted manipulators. If there exists a p-winning strategy using S, they will find a p-winning strategy using additional manipulators, if the sum of weights of the additional manipulators equals max(cid:96)∈S w(cid:96), where w(cid:96) is the weight of manipulator (cid:96) ∈ S. Approximating the Maximum Score of a Non-Preferred Candidate. Returning to earlier results, when m is bounded, Brelsford et al. [5, Lemma 3] provide an FPTAS with respect to the maximum score of a non-preferred candidate. As mentioned, this paves the way for an FPTAS on their value-of- interest. Heuristics for Borda. Davies et al. [8] present two additional heuristics: iteratively, assign the largest un-allocated score to the candidate with the largest gap (Largest Fit), or to the candidate with the largest ratio of gap divided by the number of scores yet-to-be-allocated to this candidate (Average Fit). To the best of our knowledge, these algorithms do not have a counterpart for the weighted case. Configuration Linear Programs. As discussed, configuration linear pro- grams were also used in scheduling literature, for example for the following two problems which were extensively studied before: • In the so-called Santa Claus problem [2], Santa Claus has t presents that he wishes to distribute between m kids, and pi,j is the value that kid i has to present j. The goal is to maximize the happiness of the least happy kid: mini pi,j, where Si is the presents allocated to kid i. (cid:80) j∈Si • In the problem of scheduling on unrelated machines [24]. We need to assign t jobs between m machines, and pi,j is the time required for machine i to execute job j. The goal is to minimize the makespan maxi pi,j, where Si is the jobs assigned to machine i. (cid:80) j∈Si Both papers researched a natural and well-researched 'restricted assignment' variant of the two problems where pi,j ∈ {pj, 0}. In [2], they obtained an O(log log m/ log log log m)-multiplicative approximation to the first problem and in [24], they obtained a (33/17 + )-multiplicative approximation to the second. 2 Preliminaries 2.1 Problem Definition Candidate Set. With a slight change of notation, let C = {c0, c1, . . . , cm} be a candidate set consisting of the preferred candidate p = c0 and the other m 7 candidates c1, . . . , cm. Note that we changed the notation so that the overall number of candidates is m + 1; this will help streamline the writing. Election. An election E = (C, V ) is defined by a candidate set C and a set of voters V where each voter submits a ranking of the candidates according to its preference. Formally, we define V = {(cid:31)1, . . . ,(cid:31)n}, where each (cid:31)(cid:96)∈ V is a total order of the candidates. For example, c1 (cid:31)(cid:96) p (cid:31)(cid:96) c2 is one such possible order if C = {p, c1, c2}. Then, some decision rule R is applied in order to decide on the winner(s); formally R(E) ⊆ C is the set of winners of the elections. In the specific case of a positional scoring rule R(cid:126)α, the rule is described by a vector (cid:126)α = (α0, α1, . . . , αm) for which α0 ≤ α1 ≤ ··· ≤ αm, and αm is polynomial in m, used as follows: each voter awards αi to the candidate ranked (m − i)-th5. Finally, the winning candidate is the one with the highest aggregated score. In the specific case of Borda scoring rule, we have that (cid:126)α = (0, 1, . . . , m − 1, m). In the R(cid:126)α-(constructive) weighted coalitional manipula- WCM and UCM. tion (R(cid:126)α-WCM) problem, we are given as input: • A score profile vector (σ0, σ1, . . . , σm) representing the aggregated scores given so far to each candidate in C by the original voters in an election E under the rule R(cid:126)α. Notice that (σ0, σ1, . . . , σm) eliminates the need for obtaining E as input: as we have no control on the truthful voters V , (σ0, σ1, . . . , σm) is thus a sufficient representation for the outcome of non-manipulator votes. • A vector (cid:126)w = (w1, . . . , wk) of positive integers representing the weights of k manipulators who will be added to the election. The weights have the following meaning: each manipulator (cid:96) = 1, . . . , k is replaced by w(cid:96) identical but unweighted copies of himself. It then should be determined if when adding the k manipulators then either (a) no strategy under R(cid:126)α exists in which p wins, or that (b) there exists a voting strategy under R(cid:126)α such that p can win. In this case, the algorithm should find it. R(cid:126)α-(constructive) unweighted coalitional manipulation (R(cid:126)α-UCM) is the specific case where (cid:126)w is the all-ones vector and therefore can be replaced in the input by the integer k. Manipulation Matrices. Note that in case (b), the output is a voting strat- egy S which can be represented as a k × (m + 1) matrix in which the entry S(cid:96),i describes the score given by manipulator (cid:96) to candidate ci, and where each row of S is a permutation of (cid:126)α. Such a representation is also called a manipulation matrix. We can relax the requirement that each row of S is a permutation, and replace it by the requirement that each score-type αj, is repeated exactly k times in S. Such a matrix is called a relaxed manipulation matrix. We can 5Usually (cid:126)α is defined in a descending manner, such that α0 ≥ α1 ≥ · · · ≥ αm, and αi is awarded to the candidate ranked i-th. Our choice helps streamline the presentation. 8 perform this relaxation as Davies et al. [8, Theorem 7] show that each relaxed manipulation matrix can be rearranged to become a valid manipulation matrix while preserving each candidate's final score. High Probability. Throughout the paper, when we use the term 'with high probability', we mean an arbitrarily-chosen polynomially-small failure probabil- ity, i.e., success probability of the form 1 − m−d where d ≥ 1 is a constant that can be chosen without affecting the asymptotic running time. 'Failure' refers to the event that the algorithm does not provide the desired approximation guarantee. In this paper we will use various forms of the Hoeffding inequalities, which are variants of the Chernoff inequalities: Generalized Hoeffding inequality [14, Theorem 2]. Let X1, . . . , Xm be independent random variables where each Xi is bounded by the interval [ai, bi] respectively. Let X =(cid:80)m i=1 Xi and ¯X = X/m. Then 2n2t2 Pr[ ¯X − E[ ¯X] ≥ t] ≤ exp − (cid:80)m i=1(bi − ai)2 By redefining the above inequality in terms of the sum X (instead of the mean ¯X) and defining λ = tm we derive the following equivalent formulation: (cid:18) (cid:18) (cid:19) (cid:19) . . 2λ2 (cid:80)m i=1(bi − ai)2 (cid:19) (cid:18) − 2λ2 m . Specifically, when Xi ∈ {0, 1}, we obtain the following 'classic' Hoeffding in- equality, which is equivalent to [14, Theorem 1]: Pr[X − E[X] ≥ λ] ≤ exp − Pr[X − E[X] ≥ λ] ≤ exp 2.2 Reduction to a Pure Min-Max Problem Since we know what will be the final score of p (non-manipulator votes are known and each manipulator will give p the maximum score possible), we can effectively discard p and treat the problem as a minimization problem on the final scores of c1, . . . , cm only. In other words, we focus on finding minS maxc(cid:48)∈C\{p} s(c(cid:48)) = minS maxi=1,...,m s(ci), where s(c(cid:48)) is c(cid:48)'s final score. Thus the output S is actually a k × m relaxed manipulation matrix. Another thing to note is that we can not assume anything about the values in the initial score profile (σ0, σ1, . . . , σm); this follows from [8, Lemma 1], where it is shown that in the context of Borda, for any given non-negative integer vector (σ0, σ1, . . . , σm), we can define a set of non-manipulators (along with their preferences) and an additional candidate cm+1 that will induce an initial score profile (T (cid:48) + σ1, . . . , T (cid:48) + σm, y) for some values T (cid:48) and y < T (cid:48). Since such an additive translation and the addition of a candidate that will be awarded less 9 than any other candidate have no influence on the winner (and on the difference between each two candidates' final scores), and since our results are concerned with an additive approximation, we should assume no prior limitation on the nature of values in (σ0, σ1, . . . , σm). 3 Lower Bound for REVERSE We start by showing that there are cases in which the reverse algorithm for Borda gives only an Ω(m)-additive approximation to minimum final score of the highest-scoring non-preferred candidate. Proof of Claim 5. We provide an infinite family of cases where the claim holds. Let k = 3 and let m = 3t for some integer t. Consider the case where after the non-manipulators voted, all candidates (but p) have the same score σi = s for all i. Effectively this can be normalized to (σ1, . . . , σm) = (cid:126)0. By the reverse algorithm, the first manipulator can award c1, . . . , cm with 0, . . . , m − 1 respectively, after which the second manipulator will be obliged to award c1, . . . , cm with m − 1, . . . , 0 respectively. Repeat this process with the rest of the manipulators, until the final one. It can be verified that cm will end up with the maximal score of (cid:100)k/2(cid:101)(m − 1) = 2(m − 1). Conversely, as an upper bound for an optimal solution, consider the following strategy: place all scores to be given in a descending sequence, that is the sequence (cid:104)m − 1, m − 1, m − 1, m − 2, m − 2, m − 2, . . . , 0, 0, 0(cid:105). Give the first m scores in the sequence to c1, . . . , cm respectively, the next m to cm, . . . , c1 respectively, and the last m to c1, . . . , cm respectively. Since every score-type has 3 copies, we have just described a relaxed manipulation matrix and therefore by Davies et al. [8, Theorem 7] it can be rearranged to become a valid manipulation matrix without changing the final score of each candidate. Now notice that the score given to any candidate is of the form (m− r) + (m/3 + r− 1) + (m/3− r) = 5m/3 − r − 1 for some r ∈ {1, . . . , m/3}. As this is at most 5m/3 − 2 (when r = 1), the difference is thus m/3 = Ω(m). 4 Linear Programming for UCM We will begin by providing a "natural" way to formulate the min-max version of the problem as an Integer Program (IP). As solving IPs is NP-hard, we will relax it to the equivalent Linear Program (LP). However, such a natural LP will not be useful in our setting, and we will thus introduce a totally different LP formulation, called Configuration Linear Programming (C-LP). The number of variables in the C-LP is exponential in the size of the input. Nevertheless, we show that our C-LP can be solved in polynomial time. Let [m] = {1, . . . , m} and [m]0 = {0, . . . , m − 1}. We define the variables xi,j for (i, j) ∈ [m] × [m]0, and the variable T , with the intent that xi,j will equal the number of times candidate ci received a score of αj, and T will serve 10 as the upper-bound on each candidate final aggregate score. The IP can then be stated as follows: T min (cid:126)x subject to: xi,j = k i=1 m(cid:88) m−1(cid:88) m−1(cid:88) j=0 xi,j = k αjxi,j ≤ T − σi ∀j ∈ [m]0 , ∀i ∈ [m] , ∀i ∈ [m] , (1) (2) (3) (4) j=0 xi,j ∈ {0, . . . , k} ∀i ∈ [m], j ∈ [m]0 , where (1) guarantees that every score was awarded k times, (2) guarantees that every candidate was given k scores, and (3) guarantees that every candidate gets at most T points. It should be noted that when treating the problem as a min-max problem, we need to take T as a variable that we wish to minimize (this is done by the objective function). However, if we consider the original definition in which our aim is to make the preferred candidate p win, T can be set to σ0 + kαm (the final score of the preferred candidate), and the IP will not have an objective function. 4.1 Integrality Gap of the Natural LP While we can relax this IP into an LP by replacing the set in the last constraint to be the continuous interval [0, k], it will not be as helpful. We will shortly show why; however note that as this sub-section relates to the deficiencies of the original LP formulation, it can be safely skipped and is not needed for the full understanding of our algorithms. Consider a "pure" LP rounding algorithm, applied w.l.o.g. to a minimization problem. Such an algorithm works as follows: given an instance of a problem, it solves its associated relaxed LP (the problem's natural IP where integrality constraints are replaced with their continuous counterparts) and then rounds the resulting solution in some way or the other such that a valid (non-necessarily optimal) solution to the original IP is obtained. The approximation analysis of such algorithms is based on reasoning about how worse is the objective value of the rounded solution compared to the fractional one. In other words, what is the increase -- or "damage done" -- to the optimum objective incurred by the rounding process. Since the fractional optimum of a relaxed LP is a lower bound to the integral optimum, i.e., the optimum of the original problem, the same fac- tor also upper-bounds the difference between the objective value of the rounded solution and the one of the integral optimum. Thus this process derives an 11 approximation guarantee. We show that in our case, the increase can be Ω(m), by showing that there are cases in which the difference between the integral and fractional optimum objective values is Ω(m), and thus an algorithm solely based on the rounding procedure cannot hope for an o(m) additive approxima- tion. This kind of reasoning is known as an integrality gap, and is demonstrated by the following: Lemma 6. For Borda-UCM, an algorithm based solely on rounding the relaxed natural LP cannot obtain o(m) additive approximation. Proof. We show a lower bound on the approximation ratio in the form of an additive integrality gap. In other words, we show an infinite family of instances where the integral solution to the LP (and thus, to the original problem) gives Ω(m) worse objective value when compared to the fractional solution. Consider the simple case of m candidates, all having equal initial score (w.l.o.g. σi = 0 for all i = 1, . . . , m) and a single manipulator. When solving the problem, one candidate will be awarded m − 1 and thus will have final score of m− 1. However, in the fractional solution, the optimum is obtained by splitting each score equally, that is, setting xi,j = 1/m for every i ∈ [m] and j ∈ [m]0. j=0 j = (m − 1)/2. Therefore notice that the gap between the objective of the integral and frac- tional solutions is (m − 1)/2 = Ω(m). Now every candidate obtained a final score of 1/m ·(cid:80)m−1 4.2 Introducing Configuration LPs In order to work around this we will have to resort to a totally different approach, in which variables no longer represent score types, and instead represent the set of scores (configuration) that can be awarded to a candidate. Formally, a configuration C for some candidate ci is a vector of dimension m in which Cj represents a number of scores of type αj that i has received, and j=0 Cj = k, that is, the overall number of scores awarded is k. For a candidate ci and a bound T , let Ci(T ) be the set of configurations that do not cause the candidate overall score to surpass T , i.e., the set of configurations C We formulate the configuration LP as follows: for which(cid:80)m−1 for which(cid:80)m−1 j=0 Cjαj ≤ T − σi. (cid:88) (cid:88) xi,C ≤ 1 C∈Ci(T ) Cjxi,C ≥ k i,C C∈Ci(T ) xi,C ≥ 0 ∀i ∈ [m] , ∀j ∈ [m]0 , ∀i ∈ [m], C ∈ Ci(T ) . (5) (6) (7) where we wish that the xi,C's would serve as indicator variables indicating whether or not ci was awarded with configuration C, (5) guarantees that every candidate was given at most 1 configuration and (6) guarantees that every score 12 was awarded at least k times. The choice of inequalities over equalities will be explained soon. Example 1. Consider the case where k = 2, m = 5, (cid:126)α = (0, 1, 2, 3, 4) (i.e., Borda) and (σ1, . . . , σ5) = (5, 6, 6, 6, 7). We are omitting the non-manipulator votes that provided (cid:126)σ, however recall that there is a possible non-manipulator voting yielding any (cid:126)σ up to an additive factor and an addition of a candidate. Now assume T = 10 (this is indeed the optimum). Let us focus on the last candidate c5. C5(T ) should therefore contain all configurations which award c5 at most T − σ5 = 3 points. Those configurations are (2, 0, 0, 0, 0) (0 points), (1, 1, 0, 0, 0) (1 point), (0, 2, 0, 0, 0), (1, 0, 1, 0, 0) (2 points), and (1, 0, 0, 1, 0) (3 points). When solving the C − LP , only two of her configurations will get non-zero value: x5,(1,0,0,1,0) (cid:117) 0.7 and x5,(0,1,1,0,0) (cid:117) 0.3. We omit the variables corre- sponding to the rest of the candidates. After solving the LP, we will execute a rounding procedure that will trans- form the fractional LP solution into a valid solution for the original problem. This procedure can increase the score of some of the candidates, and hence we wish to start with the smallest possible T (so that even after the increase the final score will hopefully be bounded by σ0 + kαm). To find the smallest possible T , we perform a one-sided binary search on the value of T . For this purpose, for each possible value of T that we come across during the binary search, we redefine the LP and then solve the new LP from scratch, and see if it has a valid solution. The reason we do not add T as a variable in an objective function (instead of the binary search) is that the number of summands in Equations (5,6) depends on T . This formulation has the obvious drawback that the number of variables is exponential in k. However, following the approach of [2], if we find a polynomially- computable separation oracle we can solve the LP by referring to the LP dual and using the ellipsoid method. Such an oracle will require a solution to the following seemingly unrelated problem as a subroutine: a variant of the classic Knapsack problem. 4.3 k-Multiset Knapsack Let {1, . . . , m} be a set of distinct items, where each item has an associated value vj and a weight wj. We also obtain a weight upper-bound W and a value lower-bound V . As opposed to ordinary knapsack, we also obtain an integer k. We are required to find a multiset S of exactly k items (i.e., we can repeat items from the item-set), such that S's overall weight is at most W and S's overall value is greater than V (or to return that no such multiset exists). Lemma 7. The k-multiset knapsack can be solved in time polynomial in k, m, and W (which is pseudo-polynomial due to the dependence on W ). Proof. We fill out a table Q[w, (cid:96)], for w = 0, . . . , W and (cid:96) = 0, . . . , k, in which Q[w, (cid:96)] is the highest value obtainable with a size-(cid:96) multiset of items 13 (cid:40) of aggregate-weight at most w. Notice that Q can be filled using the following recursion: Q[w, (cid:96)] = 0 maxj vj + Q(cid:48)(w − wj, (cid:96) − 1) if (cid:96) = 0, otherwise, (8) where Q(cid:48)(w, (cid:96)) = Q[w, (cid:96)] if it is defined, i.e., w ≥ 0 and (cid:96) ≥ 0, and otherwise is −∞. Therefore Q can be filled-out using dynamic programming. Finally, the entry Q[W, k] contains the highest value obtainable with overall weight at most W . Therefore, if Q[W, k] > V , we have found a required multiset; otherwise such does not exists. The resulting multiset itself can be recovered using backtracking on the table Q. Noticed that the amount of work done is O(W km). 4.4 Solving the UCM C-LP We return to our problem. The choice of inequalities over equalities is motivated by our use of the LP dual in Theorem 9. However, they have the same effect as equalities, as shown by the following lemma: Lemma 8. In a solution to the above C-LP, Equations (5,6) will actually be equalities. Proof. Notice that by Equation (6): where (12) holds by plugging (5) into (11). We therefore obtain that which forces both above non-trivial LP inequalities to be equalities. Theorem 9. Given a fixed value T , the UCM C-LP can be solved in polynomial time. 14 Cjxi,C m−1(cid:88) Cj xi,C j=0 xi,C (cid:88) km ≤ m−1(cid:88) m(cid:88) m(cid:88) m(cid:88) (cid:88) (cid:88) C∈Ci(T ) j=0 i=1 i=1 = C∈Ci(T ) = k i=1 ≤ km C∈Ci(T ) m−1(cid:88) m(cid:88) (cid:88) j=0 i=1 C∈Ci(T ) Cjxi,C = km (9) (10) (11) (12) Proof. We need to refer to the LP dual for our C-LP in order to solve it; we briefly repeat some LP duality concepts here, refer to [23] for complete defini- tions and discussion. The dual of a maximization problem is a minimization problem. In order to define it we can treat our primal program as a maximization problem having all coefficients 0 in its objective function. In the dual there is a variable for every constraint of the primal, and a constraint for every variable of the primal. Therefore, we define a variable yi for each candidate ci and a variable zj for each score-type αj (since the primal has a constraint for each candidate ci and for each score-type αj). However, since our primal has an exponential number of variables, the dual will have an exponential number of constraints. We will show how to address this. In short, the non-trivial constraints are then obtained by transposing the constraint-coefficient matrix of the primal, using the primal objective function coefficients as the right-hand side of the dual constraints, and using right-hand side of the primal constraints as the coefficients of the dual objective function. The process yields the following dual: m(cid:88) min (cid:126)y,(cid:126)z m−1(cid:88) yi − k zj i=1 j=0 subject to: m−1(cid:88) j=0 Cjzj ≤ yi yi ≥ 0 zj ≥ 0 ∀i ∈ [m], C ∈ Ci(T ) ∀i = 1, . . . , m ∀j = 0, . . . , m − 1 As mentioned, the dual has an exponential number of constraints. However it is solvable; the ellipsoid method [17] is a method for solving an LP which iteratively tries to find a point inside the feasible region described by the con- straints. However, we do not need to provide all the constraints in advance. Instead, the algorithm can be provided with a subroutine, called a separation oracle, to which it calls with a proposed point, and the subroutine then either confirms that the point is inside the feasible region or that it returns a violated constraint [12]. The ellipsoid method algorithm performs a polynomial number of iterations, therefore if the separation oracle runs in polynomial time as well, the LP is solved in overall polynomial time. Notice that the polynomial num- ber of iterations performed by the ellipsoid method implies that the number of constraints that played a part in finding the optimum (known as active con- straints) was polynomial as well. In other words, we could effectively discard all the constraints but a polynomial number of them. As discussed, a separation oracle for the dual, given a proposed solution ((cid:126)y; (cid:126)z), needs to find in polynomial time a violated constraint, if exists. It remains to show that such a separation oracle is polynomial-time computable. Observe that a violated constraint to this program is a pair i, C for which C ∈ 15 Ci(T ) (and therefore(cid:80)m−1 j=0 Cjαj ≤ T − σi) and at the same time(cid:80)m−1 violated constraint can be seen as finding a k-multiset (since (cid:80)m−1 j=0 Cjzj > yi. Fortunately, for a specified i, finding a configuration C that induces a j=0 Cj = k) given by a solution to our knapsack variant: [m]0 is the item set (over which j ranges), the value for the item j is zj, while its weight is αj. The given value lower bound is yi, and T −σi is the given upper bound on the weight. Effectively, we use the possibly-tighter weight bound min{kαm−1, T −σi} instead, as kαm−1 bounds the overall weight obtainable with a size-k multiset. As now the weight bound is polynomial in m and k, the solution to our knapsack variant becomes polynomial. We repeat this knapsack-solving step for each i until we find a violated constraint, or conclude that no constraint is violated. Once we have solved the dual using the ellipsoid method with the separation oracle, we can discard all variables in the primal that do not correspond to violated constraints of the dual, since the inclusion of those constraints (resp. their corresponding variables) did not have any effect on the dual optimum (resp. the primal optimum).6 The primal now contains only a polynomial number of variables and can be solved directly using the ellipsoid method or any other known polynomial solvers for LP, such as [15]. 5 Algorithm for UCM xi,C, C ∈ Ci(T ). Since(cid:80) Solve the above mentioned configuration-LP formulation as described in Sec- tion 4. As mentioned, while both constraints are inequalities, in any solution they will actually be equalities. For each candidate ci, observe the variables C∈Ci(T ) xi,C = 1, treat the xi,C's as a distribution over the configurations for i and randomly choose one according to that distribution. For the time being, give ci this configuration. i=1 C i such that H[j] =(cid:80)m While every candidate now has a valid configuration (and her score does not exceed T ), it is possible that the number of scores of a certain type is above or below k. Formally, if candidate ci received a configuration C i, let the array H j be the histogram of the scores. It is then possible that H[j] (cid:54)= k. If we would translate the configuration given to each candidate to the list of the scores awarded within it, and would write this list as the column of a matrix, this matrix might not be a relaxed manipulation matrix. In order to solve this, we need to replace some of scores in this matrix with others such that the number of scores of each type will be k. On the other hand, we need to make sure this process does not add much to the score of each candidate. Let t = (i, j) be a tuple representing the event that candidate ci received a score of αj in its configuration. Place all such tuples in a single multiset (if αj is awarded to i more than once, repeat (i, j) as needed). Now sort this multiset 6In other words, the dual of the dual without the discarded constraints is the primal without their corresponding variables. Another way to explain this is that this is exactly the complementary slackness condition of the Karush-Kuhn-Tucker conditions [16, 18], a necessary condition for obtaining the optimum. 16 Algorithm 1: Approximation algorithm. randomly choose C i ∼ q. 1 Solve the C-LP as described in Section 4 2 foreach i do define distribution q s.t. q(C) = xi,C for all C ∈ Ci(T ) and 3 L ← (cid:104)(cid:105) 4 foreach i ∈ [m], j ∈ [m]0 do /* L is the empty list */ j copies of (i, j) to L /* j represents the score type 5 Append C i αj */ 6 Sort L in an ascending order by ScoreIndex(·) 7 Re-index L such that L = (cid:104)t0, . . . , tkm−1(cid:105) 8 for (cid:96) = 0, . . . , km − 1 do t = (i, j) */ /* ScoreIndex(t) = j if 9 10 Observe tuple t(cid:96) = (i, j) /* Assign the score α(cid:98)(cid:96)/k(cid:99) to ci, instead of the previous αj: j ← C i C i C i(cid:98)(cid:96)/k(cid:99) ← C i(cid:98)(cid:96)/k(cid:99) + 1 11 12 return the relaxed manipulation matrix corresponding to C 1, . . . , C m j − 1 */ j ← C i according to the αj value in an non-decreasing manner (break ties between candidates arbitrarily) thus creating the event-sequence t0, . . . , tkm−1, i.e., the tuples are now indexed by their rank in this sequence. We now start the actually fixing of the scores given; for each tuple t(cid:96) = (i, j) having rank (cid:96) in the list, we change the score awarded to ci (as described by the tuple) from αj to α(cid:98)(cid:96)/k(cid:99). To j − 1 followed perform this change in the algorithm, it is enough to set C i by setting C i(cid:98)(cid:96)/k(cid:99) ← C i(cid:98)(cid:96)/k(cid:99) + 1. This is correct as C i j(cid:48), for any j(cid:48), represents the number of αj(cid:48) scores awarded to ci. Notice that now every score is repeated k times (there are only k possible (cid:96) values mapping to the same (cid:98)(cid:96)/k(cid:99) value). Finally, the corrected configura- tions represent the final strategy. This can be easily represented as a relaxed configuration matrix by referring to the matrix [MS(C 1);··· ; MS(C m)], where MS(C i) is a column constructed by taking the configuration C i, represented as an ordered-multiset of scores (each j repeats C i j times), in some arbitrary order. m log m for some constant d. Let g((cid:126)α) = maxi=0,...,m−β αi+β−αi. In words, g((cid:126)α) is the biggest different between a score in (cid:126)α and another score β entries away from it. Lemma 10. Let C ∈ {C 1, . . . , C m} be a configuration obtained for some can- didate by the rounding process, and let C(cid:48) be its corrected version given by the process described above. Then with arbitrary-chosen polynomially-small failure The entire process is summarized as Algorithm 1. Let β = d √ 17 . αjC(cid:48) probability, m−1(cid:88) αjCj + k · g((cid:126)α) . j ≤ m−1(cid:88) let the array G be the array of histogram partial sums, i.e., G[j] =(cid:80)j In a similar manner, define Di[j] =(cid:80)j Proof. Let H be the histogram of the original configurations C 1, . . . , C m, and j(cid:48)=0 H[j(cid:48)]. j(cid:48) to be the partial sums array w.r.t. each candidate ci. We will show that with high probability, G[j] ≤ (j + 1)k + dk j(cid:48)=0 C i √ j=0 j=0 m ln m. Fix a specific j. Notice that j(cid:88) j(cid:88) (cid:88) E[G[j]] = E[H[j(cid:48)]] = Cj(cid:48)xi,C = (j + 1)k according to the LP constraints, and that G[j] =(cid:80)m C∈Ci(T ) j(cid:48)=0 j(cid:48)=0 i,C i=1 Di[j], that is, G[j] is a random variable which is the sum of the independent random variables Di[j] for i = 1, . . . , m. In addition, for every candidate ci, it holds that Di[j] ∈ [0, k], as a configuration contains at most k scores. Therefore, using the generalized Hoeffding inequality [14, Theorem 2]: Pr [G[j] − E[G[j]] ≥ λ] ≤ exp = exp (cid:19) (cid:18) (cid:18) − 2λ2(cid:80)m (cid:19) − 2λ2 mk2 i=1 k2 . √ m ln m] ≤ 1/md(cid:48) √ m ln m, for some arbitrary constant d(cid:48), we get that Pr[G[j] − Setting λ = d(cid:48)k √ E[G[j]] ≥ d(cid:48)k , that is, the probability that we deviate from E[G[j]] by more than O(k m) can be made arbitrarily polynomially small. Using the union bound, the same can be made to hold for all j = 0, . . . , m − 1 simultaneously. Now observe a tuple t(cid:96) = (i, j(cid:48)) before being possibly corrected by the al- gorithm. Since its rank (cid:96) in the sorted sequence is at most the number of scores whose type is at most j(cid:48), which is by definition G[j(cid:48)], we get that (cid:96) ≤ G[j(cid:48)] ≤ (j(cid:48) + 1)k + d(cid:48)k m ln m, where the second inequality holds with high probability. Therefore by the algorithm changing the score αj(cid:48) to α(cid:98)(cid:96)/k(cid:99), the score increases by at most α(cid:98)(cid:96)/k(cid:99) − αj(cid:48) ≤ α(j(cid:48)+1)+d(cid:48)√ Now observe some candidate ci with a given configuration C i corrected to become a configuration C(cid:48) by the algorithm. Since at worst case, all of ci's k scores where affected as such, her overall score has increased by at most kg((cid:126)α). m ln m − αj(cid:48) ≤ g((cid:126)α). √ Corollary 11. The above algorithm provides an additive kg((cid:126)α) approximation with high probability. By repeating the randomized rounding procedure a linear number of times, the failure probability becomes exponentially-small. The overall running time is polynomial. 18 Proof. Let T ∗ be the optimal value for the original problem, and let TCLP be the best bound obtainable via the above C-LP combined with the binary search on T . Notice that TCLP ≤ T ∗, as the optimal solution is also a valid solution for the C-LP. Now observe the highest scoring candidate in the C-LP. When the algorithm terminates, we get that with high-probability her score is TCLP + kg((cid:126)α) ≤ T ∗ + kg((cid:126)α). If we repeat the randomized rounding procedure a linear number of times and pick the iteration yielding the minimum addition to TCLP, the probability of not getting a kg((cid:126)α)-approximation becomes exponentially- small. As the additional score given by the algorithm to any other candidate is also kg((cid:126)α), the bound T ∗ + kg((cid:126)α) holds for all candidates. We conclude that this is indeed an kg((cid:126)α) additive approximation. As discussed, solving the C-LP is done in polynomial time (by the polynomial number of iterations of the ellipsoid method and the polynomial runtime of the k-multiset knapsack separation oracle). The rounding is dominated by going over a polynomial number of non-zero variables of the C-LP and is therefore polynomial as well. It is repeated a linear number fo times in order to provide an exponentially-small failure probability. From here we can directly obtain Corollary 3: √ Proof of Corollary 3. By noticing that for Borda, g((cid:126)α) = O( m log m). 6 Linear Programming for WCM When turning to the WCM problem, the 'natural' LP still suffers from the deficiencies described in Section 4. We again resort to using configurations. However, configurations will now be defined in a different manner, since now, when each voter has an associated weight, voters are not identical anymore and therefore our configurations need to capture the identity of the voters. A configuration C for some candidate ci is now defined as a length-k sequence in which C(cid:96) = j if the voter (cid:96) awarded αj to ci. For a candidate ci and a bound T , Ci(T ) is again the set of configurations that do not cause the candidate overall score to surpass T , which this time is formally(cid:80)k (cid:96)=1 w(cid:96)αC(cid:96) ≤ T − σi. The configuration LP is now formulated as follows: (cid:88) (cid:88) C∈Ci(T ) i,C∈Ci(T ) xi,C ≥ 0 C(cid:96)=j xi,C ≤ 1 ∀i ∈ [m] , xi,C ≥ 1 ∀j ∈ [m]0,∀(cid:96) ∈ [k] , ∀i ∈ [m], C ∈ Ci(T ) . (13) (14) (15) Again, we wish that the xi,C's would serve as indicator variables indicating whether or not ci was awarded with configuration C, (13) guarantees that every candidate was given at most 1 configuration and (14) guarantees that every 19 score was awarded by every voter at least once. The choice of inequalities over equalities will be explained soon. We present another -- much more complex -- Knapsack variant, which will be used later by the separration orcale needed for solcing the C-LP. 6.1 k-Sequence Knapsack Let {1, . . . , m} be a set of distinct items. In the k-sequence knapsack problem we are required to construct a length-k sequence S = s1, . . . , sk of items; we can repeat items from the item-set, however, we are subject to some additional constraints as will be specified immediately. The input to the problem is the following: • A value v(j, (cid:96)), for every j ∈ [m]0, (cid:96) ∈ [k] where v(j, (cid:96)) is the value obtained by placing item j at location (cid:96) in the sequence. • A cost b(j) for each item j, and a penalty p(cid:96) for each location (cid:96) ∈ [k]. Placing an item j at location (cid:96) in the sequence has a penalized-cost p(cid:96)b(j), i.e., it depends on both the item's weight and the penalty for location (cid:96). The resulting sequence S should abide the following constraints: • A value lower-bound V . • A penalized-cost upper-bound B. • S's overall value(cid:80)k • S's overall penalized-cost(cid:80)k (cid:96)=1 v(s(cid:96), (cid:96)) is greater than V . (cid:96)=1 p(cid:96)b(s(cid:96)) is at most B. (cid:40) Q[b(cid:48), (cid:96)] = If such sequence S exists, we should return it; otherwise we return that no such sequence exists. Lemma 12. The k-sequence knapsack can be solved in time polynomial in k,m, and B (which is pseudo-polynomial due to the dependence on B). Proof. Similar to the proof of Lemma 7, we fill out a table Q[b(cid:48), (cid:96)], for b(cid:48) = 0, . . . , B and (cid:96) = 0, . . . , k, in which Q[b(cid:48), (cid:96)] is the highest value obtainable with a length-(cid:96) sequence of items of penalized-cost at most b. This time Q is filled using a different recursion: 0 maxj v(j, (cid:96)) + Q(cid:48)(b(cid:48) − p(cid:96)b(j), (cid:96) − 1) if (cid:96) = 0, otherwise, (16) where Q(cid:48)(b(cid:48), (cid:96)) = Q[b(cid:48), (cid:96)] if it is defined, i.e., b(cid:48) ≥ 0 and (cid:96) ≥ 0, and otherwise is −∞. Therefore Q can be filled-out using dynamic programming. Finally, the en- try Q[B, k] contains the highest value obtainable with overall cost at most B. Therefore, if Q[B, k] > V , we have found a required sequence; otherwise such does not exists. The resulting sequence itself can be recovered using backtrack- ing on the table Q. Noticed that the amount of work done is O(Bkm). 20 6.2 Solving the WCM C-LP We return to our problem. Again, the choice of inequalities over equalities is motivated by our use of the LP dual in Theorem 14. However, they have the same effect as equalities, as shown by the following lemma: Lemma 13. In a solution to the above C-LP, Equations (13,14) will actually be equalities. Proof. Notice that by Equation (14): xi,C xi,C (cid:88) (cid:96),j C(cid:96)=j 1 (cid:88) (cid:88) C∈Ci(T ) C(cid:96)=j j,(cid:96) i=1 km ≤(cid:88) m(cid:88) m(cid:88) m(cid:88) m(cid:88) (cid:88) (cid:88) (cid:88) C∈Ci(T ) C∈Ci(T ) i=1 i=1 = k = = (cid:96),j C(cid:96)=j xi,C xi,C C∈Ci(T ) i=1 ≤ km (cid:88) m(cid:88) (cid:88) j,(cid:96) i=1 C∈Ci(T ) xi,C = km (17) (18) (19) (20) (21) where (21) holds by plugging (13) into (20). We therefore obtain that which forces both above non-trivial LP inequalities to be equalities. Theorem 14. Given a fixed value T , the WCM C-LP can be solved in polyno- mial time. Proof. We again refer to the LP-dual, which this time is: m(cid:88) yi −(cid:88) i=1 j,(cid:96) min (cid:126)y,(cid:126)z subject to:(cid:88) zj,(cid:96) ≤ yi j,(cid:96) C(cid:96)=j yi ≥ 0 zj,(cid:96) ≥ 0 zj,(cid:96) 21 ∀i ∈ [m], C ∈ Ci(T ) ∀i = 1, . . . , m ∀(j, (cid:96)) ∈ [m]0 × [k] zC(cid:96),(cid:96) ≤ yi k(cid:88) (cid:96)=1 w(cid:96)αC(cid:96) ≤ T − σi) and at the same time(cid:80)k (cid:96)=1 ∀i ∈ [m], C ∈ Ci(T ) . Furthermore, the above single non-trivial constraint can be more conveniently re-written as therefore(cid:80)k We again turn to the ellipsoid method with a separation oracle; this time, a violated constraint to this program is a pair i, C for which C ∈ Ci(T ) (and (cid:96)=1 zC(cid:96),(cid:96) > yi. For a specified i, finding a configuration C that induces a violated constraint can be seen as finding a k-sequence given by a solution to our knapsack variant: [m]0 is the item set (over which j ranges), the value for placing item j at location (cid:96) is zj,(cid:96), item j's cost is αj, and the penalty for location (cid:96) is w(cid:96). The given value lower bound is yi, and T − σi is the given upper bound on the penalized cost. Effectively, we use the possibly-tighter weight bound min{W αm−1, T −σi} instead, as W αm−1 bounds the overall cost obtainable with a length-k sequence. As now the weight bound is polynomial in αm−1 and W , the solution to our knapsack variant becomes polynomial. We repeat this knapsack-solving step for each i until we find a violated constraint, or conclude that no constraint is violated. Once we have solved the dual using the ellipsoid method with the separation oracle, we continue in a similar fashion to the proof of Theorem 9. 7 Algorithm for WCM xi,C's as a distribution over the configurations for i since (cid:80) Solve the above mentioned configuration-LP formulation as described in Sec- tion 6. As both constraints will be equalities, for each candidate ci, we treat the C∈Ci(T ) xi,C = 1, and randomly choose one according to that distribution. For the time being, give i this configuration. As for UCM, every candidate now has a valid configuration but constraints may still be violated; it is possible that the number of scores of a certain type αj given by a specific voter (cid:96) is not exactly 1. Formally, fix a specific voter (cid:96); we let the array H such that H[j] = {i C i (cid:96) = j} be histogram of the scores with respect to (cid:96). It is then possible that H[j] (cid:54)= 1. Our goal, as before, is to fix this without introducing too much of an addition to the candidates' overall scores. However, there is now some added complexity due to the necessity to preserve the identity of the voter when fixing a specific score given. Let t = (i, (cid:96), j) be a tuple representing the event that candidate ci received a score of αj from voter (cid:96) in its configuration. Fix a manipulator (cid:96), and place all tuples having (cid:96) as their respective voter in a set A, that is A = {(i, (cid:96), C i (cid:96)) i = 1, . . . , m}. Sort A according to each tuple (i, (cid:96), C i (cid:96), and let L = (cid:104)t1, . . . , tm(cid:105) be the resulting list. Notice that any tuple tj = (i, (cid:96), j(cid:48)) in L (cid:96) ← j. represents the event that currently C i In words, C i (cid:96) gets the rank of its respective tuple in the sorted list L. In effect, the score awarded to ci by (cid:96) changes from αj(cid:48) to αj. (cid:96) = j(cid:48). Now change C i (cid:96))'s score-index C i (cid:96) such that C i 22 Algorithm 2: WCM Approximation algorithm. 1 Solve the C-LP as described in Section 6 2 foreach i do define distribution q s.t. q(C) = xi,C for all C ∈ Ci(T ) and 3 for (cid:96) ← 1 to k do randomly choose C i ∼ q. /* tuple (i, (cid:96), j) represnts the (cid:96)) i = 1, . . . , m} Let A = {(i, (cid:96), C i event the (cid:96) awarded αj to ci */ Sort A in an ascending order by ScoreIndex(·) and let L = (cid:104)t0, . . . , tm−1(cid:105) be the resulting list. t = (i, (cid:96), j) */ for j ← 0 to m − 1 do Observe tuple tj = (i, (cid:96), j(cid:48)). (cid:96) ← j C i the previous αj(cid:48) */ 8 /* this assigns the score αj to ci, instead of 9 return the resulting manipulation matrix [C 1;··· ; C m] /* place C i as /* ScoreIndex(t) = j if 4 5 6 7 the i-th column vector of the resulting matrix */ We repeat the above process for each voter. Notice that now every score is repeated k times, one by each voter. The process is summarized as Algorithm 2. m log m for some constant d and let g((cid:126)α) = maxi=0,...,m−β αi+β− As before, let β = d √ αi. Lemma 15. Let C ∈ {C 1, . . . , C m} be a configuration obtained for some can- didate by the rounding process, and let C(cid:48) be its corrected version given by the process described above. Then with arbitrary-chosen polynomially-small failure probability, m−1(cid:88) j ≤ m−1(cid:88) αjC(cid:48) αjCj + W · g((cid:126)α) . . j=0 j=0 the array G be the array of histogram partial sums, i.e., G[j] =(cid:80)j Proof. Fix a specific voter (cid:96). Let H be the histogram with respect to voter (cid:96) over the original configurations C 1, . . . , C m, i.e. H[j] = {i C i (cid:96) = j}. Let j(cid:48)=0 H[j(cid:48)] = (cid:96) ≤ j}. We also define Di[j] to be a Bernoulli variable which is equal (cid:96) ≤ j, and 0 otherwise. We will show that with high probability, {i C i √ to 1 if C i G[j] ≤ (j + 1) + d m ln m. Fix a specific j. Notice that j(cid:88) j(cid:48)=0 j(cid:88) (cid:88) j(cid:48)=0 E[G[j]] = E[H[j(cid:48)]] = xi,C = j + 1 according to the LP constraints, and that G[j] =(cid:80)m i,C C∈Ci(T ) C(cid:96)=j(cid:48) i=1 Di[j], that is, G[j] is a random variable which is the sum of the independent random variables Di[j] ∈ 23 {0, 1} for i = 1, . . . , m. Therefore, using the 'classic' Hoeffding inequality: Pr [G[j] − E[G[j]] ≥ λ] ≤ e− 2λ2 m . m ln m] ≤ 1/md(cid:48) Setting λ = d(cid:48)√ m ln m, for some arbitrary constant d(cid:48), we get that Pr[G[j] − E[G[j]] ≥ d(cid:48)√ √ , that is, the probability that we deviate from E[G[j]] by more than O( m) can be made arbitrarily polynomially small. Using the union bound, the same can be made to hold for all j = 0, . . . , m − 1 and (cid:96) = 1, . . . , k simultaneously. Now observe a tuple tj = (i, (cid:96), j(cid:48)) before being possibly corrected by the algorithm. Since its rank j in the sorted sequence is at most the number of scores given by (cid:96) whose type is at most j(cid:48), which is by definition G[j(cid:48)], we get that j ≤ G[j(cid:48)] ≤ (j(cid:48) + 1) + d(cid:48)√ m ln m, where the second inequality holds with high probability. Therefore by the algorithm changing the score αj(cid:48) to αj, the score increases by at most αj − αj(cid:48) ≤ α(j(cid:48)+1)+d(cid:48)√ Now observe some candidate ci with a given configuration C i corrected to (cid:80)k become a configuration C(cid:48) by the algorithm. Since at worst case, all of ci's k scores where affected as such, her overall score has increased by at most m ln m − αj(cid:48) ≤ g((cid:126)α). (cid:96)=1(w(cid:96)g((cid:126)α)) = W g((cid:126)α). Corollary 16. The above algorithm provides an additive W g((cid:126)α) approximation with high probability. By repeating the randomized rounding procedure a linear number of times, the failure probability becomes exponentially-small. The overall running time is polynomial. Proof. Identical to the proof of Corollary 11, the only difference being W used instead of k. From here we can directly obtain Corollary 4: √ Proof of Corollary 4. By noticing that for Borda, g((cid:126)α) = O( m log m). 8 Implementation We implemented our algorithm for the case for Borda-UCM and Borda-WCM and uploaded the code to a public repository7. The main subroutine is solving the LP duals that we have defined. However, the dependency on an LP solver using the ellipsoid method with a separation oracle proved difficult as to the best of our knowledge there is no library which enables solving an LP this way. Instead we simulated this by using a general LP-solving library [1, 20] and running the separation oracle externally as described in Algorithm 3. 7https://github.com/okeller/BordaManipulation 24 Algorithm 3: Simulating the ellipsoid method with a separation oracle. Input: A linear program P = (f, S) with an objective function f and a separation oracle S (instead of an explicit list of constraits) /* R will be a list of effective constraints */ /* P (cid:48) is P without any constraints */ 1 Let R ← ∅ 2 Let P (cid:48) ← (f, R) 3 (cid:126)x ← LP-solve(P (cid:48)) 4 while S((cid:126)x) returns a violated constraint r do 5 R ← R ∪ {r} P (cid:48) ← (f, R) (cid:126)x ← LP-solve(P (cid:48)) 6 7 8 return (cid:126)x 8.1 Practical Heuristics We used the following heuristics in our implementation: • We obtained a running-time speedup was modifying the separation oracle to return a set of violated constraints, one for each i (if such exists), instead of a single violated constraint, and adding all of them to the list of constraints. • When sorting by the score index after the rounding part, we broke ties between tuples having the same score in favor of the candidate with the higher current score. This way, candidates with lower score are more likely to have a score index awarded to them increased by the fixing procedure. • Our practical running time is dominated by solving the C-LP. Therefore, we can perform the randomized part of rounding process several times, and pick the best one, while incurring only a negligible overhead to the runtime. 9 Experiments 9.1 Experimental Setting To evaluate our algorithms for both UCM and WCM in a well-studied setting, we have run experiments for Borda-UCM and Borda-WCM on sets of values for n, k and m (choice of values will be explained shortly). For the unweighted case, our algorithm was compared to Average Fit that was shown empirically to outperform reverse [8]. For the weighted case, as we are not aware of a generalization of Average Fit to a weighted setting, we compared against reverse. We have chosen n = 2k, as having one manipulator for every two original voters represents a sweet-spot where manipulators have enough power to change outcomes, but not too much; for each n, k, m combination, we have run 20 25 experiments in which we have drawn the non-manipulator votes from a uniform m or smaller, as our algorithms are suited for low k values: as mentioned, our algorithm for Borda-UCM is theoretically distribution. We have chosen k ≈ √ competitive when k = o((cid:112)m/ log m), and we have wished to verify this also in an empirical setting. Lower k values are also the cases which are more difficult to Average Fit heuristic of [8]. 9.2 Borda-UCM We are comparing our results to those obtained by Average Fit, and to the fractional solution, TCLP. The results are summarized in Figure 1. As can be seen, our algorithm performs well in practice. In the many of the cases, both the C-LP and Average Fit were known to be identical to the optimal solution, as depicted in Figure 1a: these are the instances in which the C-LP solution did not increase when performing the LP rounding. Therefore, in those cases we know what is the real optimal solution, as TCLP (resp. our final algorithm result) provides a lower (resp. an upper) bound for it, and both are equal. Thus our formulation in many times provides a very efficient method for verifying whether our algorithm (or any other algorithm) finds an optimal solution. In cases where the C-LP solution increased when performing the LP round- ing, C-LP tends to be better than Average Fit on small k values, and worse on larger ones. This is depicted in Figures 1b and 1c. For instance, consider our example from before, this time with p: k = 2, m = 5 and (σ0, . . . , σ5) = (0, 5, 6, 6, 6, 7). Obviously both methods will award p with 5 + 5 = 10. However in ours the top score of a candidate who is not p will be 10, and in Average Fit it is 12. Therefore, the choice of algorithm determines if p wins or not by a difference of 2. 9.3 Borda-WCM For the weighted case, as Average Fit has no weighted generalization, our competitor is the weighted variant of reverse. Here the results were much more conclusive: we experimented with the same type of values, choosing the manipulator weights randomly from {1, 2}. The reasoning behind this was to explore the weighted case on one hand, but on the other hand not to give any one manipulator excessive power over others by giving him a large weight. As the similar tables show (Figure 2), our algorithm beats reverse on any instance. 10 Conclusions We have presented additive approximations to the score of the highest-scoring non-preferred candidate in general scoring rules. It enables us to find a winning strategy for p in cases where other methods would not necessarily have found one. Our method employs new techniques based on configuration linear pro- grams. There are several interesting directions for future work, which vary from 26 (a) Number of cases for various value of m and k (out of 20 experiments carried out for each m, k), where our algorithm provided results equal to the fractional solution TCLP (and therefore, to the optimum T ∗). (b) Number of cases for various value of m and k (out of 20 experiments carried out for each m, k), where the C-LP method provided strictly better results compared to Average Fit. (c) Number of cases for various value of m and k (out of 20 experiments carried out for each m, k), where the Average Fit provided strictly better results compared to the C-LP method. Figure 1: Experimental results for Borda-UCM. 27 (a) Number of cases for various value of m and k (out of 20 experiments carried out for each m, k), where our algorithm provided results equal to the fractional solution TCLP (and therefore, to the optimum T ∗). (b) Number of cases for various value of m and k (out of 20 experiments carried out for each m, k), where the C-LP method provided strictly better results compared to reverse. (c) Number of cases for various value of m and k (out of 20 experiments carried out for each m, k), where reverse provided strictly better results compared to the C-LP method. Figure 2: Experimental results for Borda-WCM. 28 the concrete to the general: 1. Understand in which instances different manipulation strategies outper- form others. 2. Find algorithms that can guarantee victory even if the margin is smaller, or prove NP-hardness even if there is a solution with margin O( 3. Apply a C-LP to other voting methods. √ m). 4. Apply a C-LP to other problems in computational social choice, such as fair division of multiple indivisible goods. Acknowledgments We thank Sarit Kraus and Ariel Procaccia for insightful discussions. This work was supported by the Israel Science Foundation, under Grant No. 1488/14 and Grant No. 1394/16. References [1] M. S. Andersen, J. Dahl, and L. Vandenberghe. CVXOPT: A Python package for convex optimization, version 1.1.9. cvxopt.org, 2016. [2] N. Bansal and M. Sviridenko. The Santa Claus problem. In Proceedings of the 38th Annual ACM Symposium on Theory of Computing, pages 31 -- 40, 2006. [3] J. J. Bartholdi III, C. A. Tovey, and M. A. Trick. The computational difficulty of manipulating an election. Social Choice and Welfare, 6(3):227 -- 241, 1989. [4] N. Betzler, R. Niedermeier, and G. J. Woeginger. Unweighted coalitional manipulation under the Borda rule is NP-hard. In IJCAI 2011, Proceedings of the 22nd International Joint Conference on Artificial Intelligence, pages 55 -- 60, 2011. [5] E. Brelsford, P. Faliszewski, E. Hemaspaandra, H. Schnoor, and I. Schnoor. Approximability of manipulating elections. In Proceedings of the Twenty- Third AAAI Conference on Artificial Intelligence, pages 44 -- 49, 2008. [6] V. Conitzer, T. Sandholm, and J. Lang. When are elections with few candidates hard to manipulate? J. ACM, 54(3):14, 2007. [7] J. Davies, G. Katsirelos, N. Narodytska, and T. Walsh. Complexity of and In Proceedings of the Twenty-Fifth algorithms for Borda manipulation. AAAI Conference on Artificial Intelligence, AAAI, 2011. 29 [8] J. Davies, G. Katsirelos, N. Narodytska, T. Walsh, and L. Xia. Complexity of and algorithms for the manipulation of Borda, Nanson's and Baldwin's voting rules. Artificial Intelligence, 217:20 -- 42, 2014. [9] E. Ephrati and J. S. Rosenschein. Multi-agent planning as a dynamic search for social consensus. In Proceedings of the 13th International Joint Conference on Artificial Intelligence, pages 423 -- 431, 1993. [10] P. Faliszewski and A. D. Procaccia. AI's war on manipulation: Are we winning? AI Magazine, 31(4):53 -- 64, 2010. [11] A. Gibbard. Manipulation of voting schemes: a general result. Economet- rica: journal of the Econometric Society, pages 587 -- 601, 1973. [12] M. Grotschel, L. Lov´asz, and A. Schrijver. The ellipsoid method and its consequences in combinatorial optimization. Combinatorica, 1(2):169 -- 197, 1981. [13] E. Hemaspaandra and L. A. Hemaspaandra. Dichotomy for voting systems. J. Comput. Syst. Sci., 73(1):73 -- 83, 2007. [14] W. Hoeffding. Probability inequalities for sums of bounded random vari- ables. Journal of the American statistical association, 58(301):13 -- 30, 1963. [15] N. Karmarkar. A new polynomial-time algorithm for linear programming. Combinatorica, 4(4):373 -- 396, 1984. [16] W. Karush. Minima of functions of several variables with inequalities as side conditions. Master's thesis, University of Chicago, 1939. [17] L. G. Khachiyan. Polynomial algorithms in linear programming. USSR Computational Mathematics and Mathematical Physics, 20(1):53 -- 72, 1980. [18] H. Kuhn and A. Tucker. Nonlinear programming. In Proceedings of 2nd Berkeley Symposium. Berkeley: University of California Press, pages 481 -- 492, 1951. [19] A. P. Lin. Solving hard problems in election systems. PhD thesis, Rochester Institute of Technology, 2012. [20] A. Makhorin. GLPK: GNU linear programming kit, version 4.61. www.gnu.org/software/glpk/glpk.html, 2017. [21] A. D. Procaccia and J. S. Rosenschein. Junta distributions and the average- case complexity of manipulating elections. J. Artif. Intell. Res. (JAIR), 28:157 -- 181, 2007. [22] M. A. Satterthwaite. Strategy-proofness and Arrow's conditions: Existence and correspondence theorems for voting procedures and social welfare func- tions. Journal of economic theory, 10(2):187 -- 217, 1975. 30 [23] A. Schrijver. Theory of linear and integer programming. John Wiley & Sons, 1998. [24] O. Svensson. Santa Claus schedules jobs on unrelated machines. SIAM J. Comput., 41(5):1318 -- 1341, 2012. [25] L. Xia, M. Zuckerman, A. D. Procaccia, V. Conitzer, and J. S. Rosenschein. Complexity of unweighted coalitional manipulation under some common voting rules. In IJCAI 2009, Proceedings of the 21st International Joint Conference on Artificial Intelligence, pages 348 -- 353, 2009. [26] M. Zuckerman, A. D. Procaccia, and J. S. Rosenschein. Algorithms for the coalitional manipulation problem. Artificial Intelligence, 173(2):392 -- 412, 2009. 31
1702.04307
2
1702
2017-10-13T04:38:45
Approximating the Held-Karp Bound for Metric TSP in Nearly Linear Time
[ "cs.DS" ]
We give a nearly linear time randomized approximation scheme for the Held-Karp bound [Held and Karp, 1970] for metric TSP. Formally, given an undirected edge-weighted graph $G$ on $m$ edges and $\epsilon > 0$, the algorithm outputs in $O(m \log^4n /\epsilon^2)$ time, with high probability, a $(1+\epsilon)$-approximation to the Held-Karp bound on the metric TSP instance induced by the shortest path metric on $G$. The algorithm can also be used to output a corresponding solution to the Subtour Elimination LP. We substantially improve upon the $O(m^2 \log^2(m)/\epsilon^2)$ running time achieved previously by Garg and Khandekar. The LP solution can be used to obtain a fast randomized $\big(\frac{3}{2} + \epsilon\big)$-approximation for metric TSP which improves upon the running time of previous implementations of Christofides' algorithm.
cs.DS
cs
Approximating the Held-Karp Bound for Metric TSP in Nearly Linear Time∗ Chandra Chekuri Kent Quanrud October 16, 2017 Abstract We give a nearly linear time randomized approximation scheme for the Held-Karp bound [Held and Karp, 1970] for Metric-TSP. Formally, given an undirected edge-weighted graph G = (V,E) on m edges and  > 0, the algorithm outputs in O(m log4 n/2) time, with high probability, a (1 + )-approximation to the Held-Karp bound on the Metric-TSP instance induced by the shortest path metric on G. The algorithm can also be used to output a corresponding solution to the Subtour Elimination LP. We substantially improve upon the O(m2 log2(m)/2) running time achieved previously by Garg and Khandekar. The LP solution can be used to obtain a 2 + (cid:1)-approximation for Metric-TSP which improves upon the running time fast randomized(cid:0) 3 of previous implementations of Christofides' algorithm. 7 1 0 2 t c O 3 1 ] S D . s c [ 2 v 7 0 3 4 0 . 2 0 7 1 : v i X r a ∗Department of Computer Science, University of Illinois, Urbana, IL 61820. {chekuri,quanrud2}@illinois.edu. Work on this paper partially supported by NSF grant CCF-1526799. 1 Introduction The Traveling Salesman Problem (TSP) is a central problem in discrete and combinatorial opti- mization, and has inspired fundamental advances in optimization, mathematical programming and theoretical computer science. Cook's recent book [2014] gives an introduction to the problem, its history, and general appeal. See also Gutin and Punnen [2006], Applegate, Bixby, Chvatal, and Cook [2011], and Lawler, Lenstra, Rinnooy-Kan, and Shmoys [1985] for book-length treatments of TSP and its variants. Formally, the input to TSP is a graph G = (V,E) equipped with positive edge costs c : E → R>0. In this paper we focus on TSP in The goal is to find a minimum cost Hamiltonian cycle in G. undirected graphs. Checking whether a given graph has a Hamiltonian cycle is a classical NP- Complete decision problem, and hence TSP is not only NP-Hard but also inapproximable. For this theoretical reason, as well as many practical applications, a special case of TSP called Metric-TSP is extensively studied. In Metric-TSP, G is a complete graph Kn and c obeys the triangle inequality cuv ≤ cuw +cwv for all u, v, w ∈ V. An alternative interpretation of Metric-TSP is to find a minimum- cost tour of an edge-weighted graph G; where a tour is a closed walk that visits all the vertices. In other words, Metric-TSP is a relaxation of TSP in which a vertex can be visited more than once. The graph-based view of Metric-TSP allows one to specify the metric on V implicitly and sparsely. Unlike TSP, which is inapproximable, Metric-TSP admits a constant factor approximation. The classical algorithm of Christofides [1976] yields a 3/2-approximation. On the other hand it is known that Metric-TSP is APX-Hard and hence does not admit a PTAS (Lampis [2012] showed that there is no 185 184-approximation unless P = N P ). An outstanding open problem is to improve the bound of 3/2. A well-known conjecture states that the worst-case integrality gap of the Subtour-Elimination LP formulated by Dantzig, Fulkerson, and Johnson [1954] is 4/3 (see [Goemans, 1995]). There has been exciting recent progress on this conjecture and several related problems; we refer the reader to an excellent survey by Vygen [2012]. The Subtour Elimination LP for TSP is described below and models the choice to take an edge e ∈ E with a variable ye ∈ [0, 1]. In the following, let C(U ) (resp. C(v)) denotes the set of edges crossing the set of vertices U ⊆ V (resp. the vertex v ∈ V). SE(G, c) = min (cid:104)c, y(cid:105) s.t. (cid:80) (cid:80) e∈C(v) ye = 2 e∈C(U ) ye ≥ 2 for all ∅ (cid:40) U (cid:40) V, for all v ∈ V, and ye ∈ [0, 1] for all e ∈ E. The first set of constraints require each vertex to be incident to exactly two edges (in the integral setting); these are referred to as degree constraints. The second set of constraints force connectivity, hence the name "subtour elimination". The LP provides a lower bound for TSP, and in order to apply it to an instance of Metric-TSP defined by G, one needs to apply it to the metric completion of G. A problem closely related to Metric-TSP is the 2-edge-connected spanning subgraph problem (2ECSS). In 2ECSS the input is an edge-weighted graph (G = (V,E), c), and the goal is to find a minimum cost subgraph of G that is 2-edge-connected. We focus on the simpler version where an edge is allowed to be used more than once. A natural LP relaxation for 2ECSS is described below on the left. We have a variable ye for each edge e ∈ E, and constraints which ensure that each cut has at least two edges crossing it. We also describe the dual LP on the right which corresponds to a maximum packing of cuts into the edge costs. In the following, let C ⊆ 2E denote the family of all cuts in G. (For technical reasons, we prefer to treat cuts as sets of edges.) 1 2ECSS(G, c) = min(cid:104)c, y(cid:105) s. t. ye ≥ 2 (cid:88) e∈C and ye ≥ 0 ∀C ∈ C ∀e ∈ E (cid:88) C(cid:51)e 2ECSSD(G, c) = max 2(cid:104)1, x(cid:105) s. t. xC ≤ ce and xC ≥ 0 ∀e ∈ E ∀C ∈ C Cunningham (see [Monma, Munson, and Pulleyblank, 1990]) and Goemans and Bertsimas [1993] observed that for any edge-weighted graph (G, c), the optimum value of the Subtour Elimination LP for the metric completion of (G, c) coincides with the optimum value of the 2ECSS LP for (G, c). The advantage of this connection is twofold. First, the 2ECSS relaxation is a pure covering LP, and its dual is a pure packing LP. Second, the 2ECSS formulation works directly with the underlying graph (G, c) instead of the metric completion. On the importance of solving the Subtour-LP: The subtour elimination LP is extensively studied in mathematical programming both for its application to TSP as well as the many techniques its study has spawned. It is a canonical example in many books and courses on linear and integer programming. The seminal paper of Dantzig, Fulkerson and Johnson proposed the cutting plane method based on this LP as a way to solve TSP exactly. Applegate, Bixby, Chvátal, and Cook [2003] demonstrated the power of this methodology by solving TSP on extremely large real world instances; the resulting code named Concorde is well-known [Applegate et al., 2011]. The importance of solving the subtour elimination LP to optimality has been recognized since the early days of computing. The Ellipsoid method can be used to solve the LP in polynomial time since the separation oracle required is the global mincut problem. However, it is not practical. One can also write polynomial-sized extended formulations using flow variables, but the number of variables and constraints is cubic in n and this too leads to an impractical algorithm. Held and Karp [1970] provided an alternative lower bound for TSP via the notion of one-trees. They showed, via Lagrangian duality, that their lower bound coincides with the one given by SE(G, c). The advantage of the Held-Karp bound is that it can be computed via a simple iterative procedure relying on minimum spanning tree computations. In practice, this iterative procedure provides good estimates for the lower bound. However, there is no known polynomial-time implementation with guarantees on the convergence rate to the optimal value. In the rest of the paper we focus on Metric-TSP. For the sake of brevity, we refer to the Held- Karp bound for the metric completion of (G, c) as simply the Held-Karp bound for (G, c). How fast can one compute the Held-Karp bound for a given instance? Is there a strongly polynomial-time or a combinatorial algorithm for this problem? These questions have been raised implicitly and are also explicitly pointed out, for instance, in [Boyd and Pulleyblank, 1990] and [Goemans and Bertsimas, 1993]. A fast algorithm has several applications ranging from approximation algorithms to exact algorithms for TSP. Plotkin, Shmoys, and Tardos [1995], in their influential paper on fast approximation schemes for packing and covering LPs via Lagrangian relaxation methods, showed that a (1 + )-approximation for the Held-Karp bound for Metric-TSP can be computed in O(cid:0)n4 log6 n/2(cid:1) randomized time. They relied on an algorithm for computing the global minimum cut1. Subsequently, Garg and Khandekar obtained a (1 + )-approximation in O(m2 log2 m/2) time and they relied on algorithms for minimum-cost branchings (see [Khandekar, 2004]). 1Their scheme can in fact be implemented in randomized O(m2 log4 m/2) time using subsequent developments in minimum cut algorithms and width reduction techniques. 2 The main result. In this paper we obtain a near-linear running time for a (1 + )-approximation, substantially improving the best previously known running time bound. Theorem 1.1. Let G = (V,E) be an undirected graph with E = m edges and V = n vertices, and positive edge weights c : E → R>0. For any fixed  > 0, there exists a randomized algorithm that computes a (1 + )-approximation to the Held-Karp lower bound for the Metric-TSP instance on (G, c) in O(m log4 n/2) time. The algorithm succeeds with high probability. The algorithm in the preceding theorem can be modified to return a (1+)-approximate solution to the 2ECSS LP within the same asymptotic time bound. For fixed , the running time we achieve is asymptotically faster than the time to compute or even write down the metric completion of (G, c). Our algorithm can be applied low-dimensional geometric point sets to obtain a running-time that is near-linearly in the number of points. In typical approximation algorithms that rely on mathematical programming relaxations, the bottleneck for the running time is solving the relaxation. Surprisingly, for algorithms solving Metric- TSP via the Held-Karp bound, the bottleneck is no longer solving the relaxation (albeit we only find a (1 + )-approximation and do not guarantee a basic feasible solution). We mention that the recent approaches towards the 4/3 conjecture for Metric-TSP are based on variations of the classical Christofides heuristic (see [Vygen, 2012]). The starting point is a near-optimal feasible solution x to the 2ECSS LP on (G, c). Using a well-known fact that a scaled version of x lies in the spanning tree polytope of G, one generates one or more (random) spanning trees T of G. The tree T is then augmented to a tour via a min-cost matching M on its odd degree nodes. Genova and Williamson [2017] recently evaluated some of these Best-of-Many Christofides' algorithms and demonstrated their effectiveness. A key step in this scheme, apart from solving the LP, is to decompose a given point y in the spanning tree polytope of G into a convex combination of spanning trees. Our recent work [Chekuri and Quanrud, 2017b] shows how to achieve a (1 − )-approximation for this task in near-linear time; the algorithm implicitly stores the decomposition in near-linear space. One remaining bottleneck to achieve an overall near-linear running time is to compute an approximate min-cost perfect matching on the odd-degree nodes of a given spanning tree T . In recent work [Chekuri and Quanrud, 2017a], we have been able to overcome this bottleneck in one way. We obtain a randomized algorithm which uses a feasible solution x to 2ECSS LP as input, and outputs a perfect matching M on the odd-degree nodes of T whose expected cost is at most ( 1 2 + ) times the cost of x. Combined with our algorithm in Theorem 1.1, this leads to a(cid:0) 3 2 + (cid:1)-approximation for Metric-TSP in O(m/2 + n1.5/3) time. If the metric space is given explicitly, then the overall run time is O(n2/2) and near-linear in the input size. Previous implementations of Christofides' algorithm required Ω(n2.5 log 1 2 + )-approximation even when the metric space is given explicitly.  ) time to obtain a ( 3 Integrated design of the algorithm 1.1 Our algorithm is based on the multiplicative weight update framework (MWU), and like Plotkin, Shmoys, and Tardos [1995], we approximate the pure packing LP 2ECSSD. Each iteration requires an oracle for computing the global minimum cut in an undirected graph. A single minimum cut computation takes randomized near-linear-time via the algorithm of [Karger, 2000], and the MWU framework requires Ω(m/2) iterations. Suprisingly, the whole algorithm can be implemented to run in roughly the same time as that required to compute one global mincut. While the full algorithm is fairly involved, the high-level design is directed by some ideas devel- oped in recent work by the authors [Chekuri and Quanrud, 2017b] that is inspired by earlier work of Mądry [2010] and Young [2014]. We accelerate MWU-based algorithms for some implicit packing 3 problems with the careful interplay of two data structures. The first data structure maintains a minimum cost object of interest (here the global minimum cut) by (partially) dynamic techniques, rather than recompute the object from scratch in every iteration. The second data structure ap- plies the multiplicative weight update in a lazy fashion that can be amortized efficiently against the weights of the constraints. The two data structures need to be appropriately meshed to obtain faster running times, and this meshing depends very much on the problem specifics as well as the details of the dynamic data structures. While we do inherit some basic ideas and techniques from this framework, the problem here is more sophisticated than those considered in [Chekuri and Quanrud, 2017b]. The first component in this paper is a fast dynamic data structure for maintaining a (1 + )-approximate global minimum cut of a weighted graph whose edge weights are only increasing. We achieve an amortized poly- logarithmic update time by a careful adaptation of the randomized near-linear-time minimum cut algorithm of Karger [2000] that relies on approximate tree packings. This data structure is developed with careful consideration of the MWU framework; for example, we only need to compute an approximate tree packing O(cid:0)1/2(cid:1) times (rather than in every iteration) because of the monotonicity of the weight updates and standard upper bounds on the total growth of the edge weights. The second technical ingredient is a data structure for applying a multiplicative weight update to each edge in the approximately minimum cuts selected in each iteration. The basic difficulty here is that we cannot afford to touch each edge in the cut. While this task suggests a lazy weight update similar to [Chekuri and Quanrud, 2017b], these techniques require a compact representation of the minimum cuts. It appears difficult to develop in isolation a data structure that can apply multiplicative weight updates along any (approximately) minimum cut. However, additional nice properties of the cuts generated by the first dynamic data structure enable a clean interaction with lazy weight updates. We develop an efficient data structure for weight updates that is fundamentally inextricable from the data structure generating the approximately minimum cuts. Remark 1.2. If we extract the data structure for minimum cuts from the MWU framework, then we obtain the following. Given an edge-weighted G graph on m edges there is a dynamic data structure for the weighted incremental maintenance of a (1 + )-approximate global minimum cut that updates and queries in constant time plus O(m polylog(n) log(W1/W0)/) total amortized time, where W0 is the weight of the minimum cut of the initial graph and W1 is the weight of the minimum cut of the final graph (after all updates). Here, updates in the weighted incremental setting consist of an edge e and a positive increment α to its weight. The edges of the approximate minimum cut can be reported in constant time per edge reported. However, a data structure for dynamic maintenance of minimum cuts is not sufficient on its own, as there are several subtleties to be handled both appropriately and efficiently. For instance, Thorup [2007] developed a randomized fully-dynamic data structure for global mincut with a worst-case update time of O(√n). Besides the slower update time, this data structure assumes a model and use case that clashes with the MWU framework at two basic points. First, the data structure does not provide access to the edges of the mincut in an implicit fashion that allows the edge weights to be updated efficiently, and updating each of the edges of the minimum cut individually leads to quadratic running times. Second, the randomization in the data structure assumes an oblivious adversary, which is not suitable for our purposes where the queries of the MWU algorithm to the data structure are adaptive. There are many technical details that the above overview necessarily skips. We develop the overall algorithm in a methodical and modular fashion in the rest of the paper. 4 1.2 Related Work Our main result has connections to several important and recent directions in algorithms research. We point out the high-level aspects and leave a more detailed discussion to a later version of the paper. A reader more interested in the algorithm should feel free to skip this subsection and directly go to the next section. In one direction there has been a surge of interest in faster (approximate) algorithms for classical problems in combinatorial optimization including flows, cuts, matchings and linear programming to name a few. These are motivated by not only theoretical considerations and techniques but also practical applications with very large data sizes. Many of these are based on the interplay between discrete and continuous techniques and there have been several breakthroughs, too many to list here. One prominent recent example of a problem that admits a near-linear-time approximation scheme is maximum flow in undirected graphs [Peng, 2016] building on many previous tools and techniques. Our work adds to the list of basic problems that admit a near-linear-time approximation scheme. In another direction there has been exciting work on approximation algorithms for TSP and its variants including Metric-TSP, Graphic-TSP, Asymmetric-TSP, TSP-Path to name a few. Several new algorithms, techniques, connections and problems have arisen out of this work. Instead of recapping the many results we refer the reader to the survey [Vygen, 2012]. Our result adds to this literature and suggests that one can obtain not only improved approximation but also much faster approximations than what was believed possible. As we already mentioned, some other ingredients in the rounding of a solution such as decomposing a fractional point in a spanning tree polytope into convex combination of spanning trees can also be sped up using some of the ideas in our prior work. In terms of techniques, our work falls within the broad framework of improved implementations of iterative algorithms. Our recent work showed that MWU based algorithms, especially for implicit packing and covering problems, have the potential to be substantially improved by taking advantage of data structures. The key, as we described already, is to combine multiple data structures together while exploiting the flexibility of the MWU framework. Although not a particularly novel idea (see the work of Mądry [2010] for applications to multicommodity flow and the work of Agarwal and Pan [2014] for geometric covering problems), our work demonstrates concrete and interesting problems to highlight the sufficient conditions under which this is possible. Lagrangian-relaxation based approximation schemes for solving special classes of linear programs have been studied for several decades with a systematic investigation started in Plotkin, Shmoys, and Tardos [1995] and Grigoriadis and Khachiyan [1994] following earlier work on multicommodity flows. Since then there have been many ideas, refinements and applications. We refer the reader to [Koufogiannakis and Young, 2014, Young, 2014, Chekuri, Jayram, and Vondrák, 2015] for some recent papers on MWU- based algorithms which supply further pointers, and to the survey [Arora, Hazan, and Kale, 2012] for the broader applicability of MWU in theoretical computer science. Accelerated gradient descent methods have recently resulted in fast randomized near-linear-time algorithms for explicit fractional packing and covering LPs; these algorithms improved the dependence of the running time on  to 1/ from 1/2. See [Allen-Zhu and Orecchia, 2015] and [Wang, Rao, and Mahoney, 2015]. Our work here builds extensively on Karger's randomized nearly linear time mincut algorithm [2000]. As mentioned already, we adapt his algorithm to a partially dynamic setting informed by the MWU framework. [Thorup, 2007] also builds on Karger's tree packing ideas to develop a fully dynamic mincut algorithm. Thorup's algorithm is rather involved and is slower than what we are able to achieve for the partial dynamic setting; he achieves an update time of (cid:101)O(√n) while we achieve polylogarithmic time. There are other obstacles to integrating his ideas and data structure 5 ≥0 and (cid:88) e∈E (cid:41) (cid:88) C(cid:51)e we zC ≤ (cid:104)w, c(cid:105) while t < 1 C∈C w(C) // compute the minimum cut held-karp-1(G = (V,E),c,) x ← 0C, w ← 1/c, t ← 0, η ← / ln m (cid:40) C ← arg min (cid:104)1, z(cid:105) : z ∈ RC y ← (cid:104)w, c(cid:105) w(C) · 1C // y = arg max (cid:88) γ ← min e∈C γ δ ← η x ← x + δy // x is maintained implicitly for all e ∈ C t ← t + δ end while return x // such that δ yC ≤  η ce C(cid:51)e ce for all e ∈ E we ← we exp(δη/ce) = we exp(γ/ce) // increase the weight of edge e Figure 1: An exact (and slow) implementation of the MWU framework applied to packing cuts. to the needs of the MWU framework as we already remarked. For unweighted incremental mincut, Goranci, Henzinger, and Thorup [2016] recently developed a deterministic data structure with a poly-logarithmic amortized update time. Some of the data structures in this paper rely on Euler tour representations of spanning trees. The Euler tour representation imposes a particular linear order on the vertices by which the edges of the underlying graph can be interpreted as intervals. The Euler tour representation was introduced by Tarjan and Vishkin [1985] and has seen applications in other dynamic data structures, such as the work by Henzinger and King [1999] among others. Organization. Our main result is a combination of some high-level ideas and several data struc- tures. The implementation details take up considerable space. Instead of compressing the details we organized the paper in a modular fashion with the understanding that the reader may skip some details here and there. Section 2 gives a high-level overview of a first MWU-based algorithm, highlighting some important properties of the MWU framework that arise in more sophisticated arguments later. Section 3 summarizes the key properties of tree packings that underlie Karger's mincut algorithm, and explains their use in our MWU algorithm via the notion of epochs. Section 4 describes an efficient subroutine, via appropriate data structures, to find all approximate mincuts (in the partial dynamic setting) induced by the spanning trees of a tree packing. Section 5 describes the data structure that implement the weights of the edges in a lazy fashion, building on Euler tours of spanning trees, range trees, and some of our prior work. In Section 6, we outline a formal proof of Theorem 1.1. 2 MWU based Algorithm and Overview Given an edge-weighted graph (G = (V,E), c) our goal is to find a (1 − )-approximation to the optimal value of the LP 2ECSSD. We later describe how to obtain an approximate solution to the primal LP 2ECSS. Note that the LP is a packing LP of the form max(cid:104)1, x(cid:105) : Ax ≤ c with 6 = (cid:80) def guarantees that the output x will have objective value (cid:104)1, x(cid:105) ≥ OPT while satisfying(cid:80) an exponential number of variables corresponding to the cuts, but only m non-trivial constraints corresponding to the edges. The MWU framework can be used to obtain a (1 − )-approximation for fractional packing. Here we pack cuts into the edge capacities c. The MWU framework reduces packing cuts to finding global minimum cuts as follows. The framework starts with an empty solution x = 0C and maintains edge weights w : E → R≥0, initialized to 1/c and non-decreasing over the course of the algorithm. Each iteration, the framework finds the minimum cut C = arg minC(cid:48)∈C w(C(cid:48)) w/r/t w, where w(C(cid:48)) e∈C(cid:48) we denotes the total weight of a cut. The framework adds a fraction of C to the solution x, and updates the weight of every edge in the cut in a multiplicative fashion such that the weight of an edge is exponential in its load x(e)/c(e). The weight updates steer the algorithm away from reusing highly loaded edges. The MWU framework C(cid:51)e xC ≤ (1+O())ce for every edge e. Scaling down x by a (1+O())-factor gives a (1−O())-approximation satisfying all packing constraints. An actual implementation of the above high-level idea needs to specify the step size in each iteration and the precise weight-update. The non-uniform increments idea of Garg and Könemann [2007] gives rise to a width-independent bound on the number of iterations, namely O(m log m/2) in our setting. Our algorithms follow the specific notation and scheme of Chekuri et al. [2015], which tracks the algorithm's progress by a "time" variable t from 0 to 1 increasing in non-uniform steps. A step of size δ in an iteration corresponds to adding δβ1C to the current solution x where 1C is the characteristic vector of the mincut C found in the iteration, and β = (cid:104)w, c(cid:105)/w(C) greedily takes as much of the cut as can fit in the budget (cid:104)w, c(cid:105). The process is controlled by a parameter η, which when set to O(ln m/) guarantees both the width-independent running time bound as well as the (1 − )-approximation. Both the correctness and the number of iterations are derived by a careful analysis of the edge weights w. We review the argument that bounds the number of iterations. At the beginning of the algorithm, when every edge e has weight we = 1/ce, we have (cid:104)w, c(cid:105) = m. The weights monotonically The edge weight increases are carefully calibrated so that at least one edge increases by a (1 + )- multiplicative factor in each iteration. As the upper bound on (cid:104)w, c(cid:105) is an upper bound on wece for any edge e, and the initial weight of an edge e is 1/ce, an edge weight we can increase by a (1 + )-factor at most log(1+) increase, and standard proofs show that this inner product is bounded above by (cid:104)w, c(cid:105) ≤ O(cid:0)mO(1/)(cid:1). (cid:0)mO(1/)(cid:1) = O(cid:0)log(m)/2(cid:1) times. Charging each iteration to an edge weight increased by a (1 + )-factor, the algorithm terminates in O(cid:0)m/2(cid:1) iterations. A direct implementation of the MWU framework, held-karp-1, is given in Figure 1. In addition to the input (G, c, ), there is an additional parameter η > 0 that dampens the step size at each iteration. Standard analysis shows that the appropriate choice of η is about ln(m)/. Each iteration requires the minimum global cut w/r/t the edge weights w, which can be found in O(m) time (with high probability) by the randomized algorithm of Karger [2000]. Calling Karger's algorithm in each iteration gives a quadratic running time of O(cid:0)m2/2(cid:1). Approximation in the framework. The MWU framework is robust to approximation in several ways, especially in the setting of packing and covering where non-negativity is quite helpful. For example, it suffices to find a (1 + O())-multiplicative approximation of the minimum cut, maintain the edge weights to a (1 + O())-multiplicative approximation of their true edge weights, and so forth, while retaining a (1 + O())-multiplicative approximation overall. We exploit this slack in two concrete ways that we describe at a high-level below. Approximate mincuts. First, we only look for cuts that are within a (1+O())-approximate factor of the true minimum cut. To this end, we maintain a target cut value λ > 0, and maintain the invariant that there are no cuts of value strictly less than λ. We then look for cuts of value ≤ (1 + O())λ 7 held-karp-2(G = (V,E),c,) x ← 0C, w ← 1/c, t ← 0, η ← / ln m λ ← size of minimum cut w/r/t edge weights w while t < 1 while (a) t < 1 and (cid:40) (b) there is a cut C ∈ C s.t. w(c) ≤ (1 + )λ (cid:104)1, z(cid:105) : z ∈ RC y ← (cid:104)w, c(cid:105) w(C) · 1C // (cid:104)1, y(cid:105) ≤ (1 + ) max γ ← min e∈C γ δ ← η x ← x + δy for all e ∈ C t ← t + δ end while λ ← (1 + )λ // start new epoch we ← exp(δη/ce) · we = exp(γ/ce) · we ce for all e ∈ E // such that δ (cid:88) C(cid:51)e yC ≤  η ≥0 and (cid:88) e∈E (cid:41) (cid:88) C(cid:51)e we zC ≤ (cid:104)w, c(cid:105) ce end while return x Figure 2: A second implementation of the MWU framework applied to packing cuts that divides the iterations into epochs and seeks only approximately minimum cuts at each iteration. until we are sure that there are no more cuts of value ≤ (1 + )λ. When we have certified that there are no cuts of value ≤ (1 + )λ, we increase λ to (1 + )λ, and repeat. Each stretch of iterations with the same target value λ is called an epoch. Epochs were used by [Fleischer, 2000] for approximating fractional multicommodity flow. We show that all the approximately minimum cuts in a single epoch can be processed in O(m) total time (plus some amortized work bounded by other techniques). If κ is the weight of the initial minimum cut (when w = 1/c), then the minimum cut size increases monotonically from κ to O(cid:0)m1/κ(cid:1). If the first target cut value is λ = κ, then have Ω(m) edges, and updating m edge weights in each of O(cid:0)m/2(cid:1) iterations leads to a O(cid:0)m2/2(cid:1) there are only O(ln m/2) epochs over the course of the entire algorithm. Lazy weight updates. Even if we can concisely identify the approximate minimum cuts quickly, there is still the matter of updating the weights of all the edges in the cut quickly. A cut can running time. Instead of visiting each edge of the cut, we have a subroutine that simulates the weight increase to all the edges in the cut, but only does work for each edge whose (true) weight increases by a full (1 + )-multiplicative power. That is, for each edge e, we do work proportional (up to log factors) to the number of times we increases to the next integer power of (1 + ). By the previous discussion on weights, the number of such large updates is at most O(log m/2) per edge. This amortized efficiency comes at the expense of approximating the (true) weight of each edge to a (1 + O())-multiplicative factor. Happily, an approximate minimum cut on approximate edge weights is still an approximate minimum cut to the true weights, so these approximations are tolerable. In [Chekuri and Quanrud, 2017b] we isolated a specific lazy-weight scheme from Young [2014] into a data structure with a clean interface that we build upon here. Obtaining a primal solution. Our MWU algorithm computes a (1 − )-approximate solution to 8 2ECSSD. Recall that the algorithm maintains a weight w(e) for each edge e. Standard arguments show that one can recover from the evolving weights a (1+)-approximate solution to the LP 2ECSS (which is the dual of 2ECCSD). A sketch is provided in the appendix. 3 Tree packings and epochs Karger [2000] gave a randomized algorithm that finds the global minimum cut in a weighted and undirected graph with high probability in O(m) time. Treating Karger's algorithm as a black box in every iteration leads to a quadratic running time of O(cid:0)m2/2(cid:1), so we open it up and adjust the techniques to our setting. Tree packings. Karger [2000] departs from previous algorithms for minimum cut with an approach based on packing spanning trees. Let G = (V,E) be an undirected graph with positive edge weights w : E → R>0, and let T ⊆ 2E denote the family of spanning trees in G. A tree packing is a total weight of trees containing e is at most ce (i.e.,(cid:80) nonnegatively weighted collection of spanning trees, p : T → R≥0, such that for any edge e, the T(cid:51)e p(T ) ≤ ce). Classical work of Tutte [1961] and Nash-Williams [1961] gives an exact characterization for the value of a maximum tree packing in a graph, which as an easy corollary implies it is at least half of the value of a mincut. If C ∈ C is a minimum cut and p is a maximum packing, then a tree T ∈ T selected randomly in proportion to its weight in the packing will share ≤ 2 edges with C in expectation. By Markov's inequality, T has strictly less than 3 edges in C with constant probability. For a fixed spanning tree T , a one-cut in G induced by an edge e ∈ T is the cut C(X) where X is the vertex set of one of the components of T − e. A two-cut induced by two edges e1, e2 ∈ T is the following. Let X, Y, Z be the vertex sets of the three components of T − {e1, e2} where X is only incident to e1 and Z is only incident to e2 and Y is incident to both e1, e2. Then the two-cut induced by e1, e2 is C(Y ) = C(X ∪ Z). Thus, if T is a spanning tree sampled from a maximum tree packing, and C is a minimum cut, then C is either a one-cut or a two-cut with constant probability. The probabilistic argument extends immediately to approximations. Let ζ ∈ (0, 1) be sufficiently small. If C is an approximately minimum cut with w(C) ≤ (1 + ζ)κ, and p is a tree packing of total weight ≥ (1−ζ)κ/2, then a random tree T sampled from p has 2+O(ζ) edges from C in expectation, and strictly less than three edges in T with constant probability. Sampling O(log(1/δ)) trees from a tree packing amplifies the probability of a tree containing ≤ 2 edges of C from a constant to ≥ 1− δ. For constant ζ > 0, a (1 − ζ)-approximate tree-packing can be computed in O(m) time, either by applying O(κm)-time tree packing algorithms [Gabow, 1995, Plotkin et al., 1995] to a randomly sparsified graph [Karger, 1998], or directly and deterministically in O(m) time by a recent algorithm of Chekuri and Quanrud [2017b]. Another consequence of Karger [2000] is that for ζ < 1/2, the number of (1 + ζ)-approximate minimum cuts is at most n2. By the union bound, if we select O(log n) trees at random from an approximately maximum tree packing, then with high probability every (1 + ζ)-approximate minimum cut is induced by one or two edges in one of the selected trees. In summary, we have the following. Theorem 3.1 (Karger, 2000). Let G = (V,E) be an undirected graph with edge capacities c : E → spanning trees T1, T2, . . . , Th such that with probability ≥ 1− δ, every (1 + )-approximate minimum cut C has C ∩ Ti ≤ 2 for some tree Ti. R>0, let δ ∈ (0, 1), and let  ∈ (0, 1/2). One can generate, in O(cid:0)m + n log3 n(cid:1) time, h = O(log(n/δ)) Karger [2000] finds the minimum cut by checking, for each tree Ti, the minimum cut in G obtained by removing one or two edges from Ti in O(m) time. (The details of this subroutine are 9 reviewed in the following section.) Since there are O(log n) trees, this amounts to a near-linear-time algorithm. Whereas Karger's algorithm finds one minimum cut, we need to find many minimum cuts. Moreover, each time we find one minimum cut, the edge weights on that cut increase and so the underlying graph changes. We are faced with the challenge of outputting O(cid:0)m/2(cid:1) cuts from a dynamically changing graph that in particular adapts to each cut output, all in roughly the same amount of time as a single execution of Karger's algorithm. Epochs. We divide the problem into O(log m/2) epochs. Recall that at the start of an epoch we have a target value λ > 0 and are guaranteed that there are no cuts with value strictly less than λ. Our goal is to repeatedly output cuts with value ≤ (1 + O())λ or certify that there are no cuts of value strictly less than (1 + )λ, in O(m) time. (The reason we output a cut with value ≤ (1 + O())λ is because the edge weights are maintained only approximately.) Each epoch is (conceptually) structured as follows. • At the start of the epoch we invoke Theorem 3.1 to find h = O(log(n/)) trees T1, . . . , Th such that with probability 1 − poly(/n), every (1 + )-approximate mincut of G with respect to the weights at the start of the epoch is a one-cut or two-cut of some tree Ti. • Let C1, C2, . . . , Cr be an arbitrary enumeration of one and two-cuts induced by the trees. • For each such cut Cj in the order, if the current weight of Cj is ≤ (1 + O())λ output it to the MWU algorithm and update weights per the MWU framework (weights only increase). Reuse Cj as long as its current weight is ≤ (1 + O())λ. Since weights of cuts only increase, and we consider every one and two-cut of the trees we obtain the following lemma. Lemma 3.2. Let w : E → R>0 be the weights at the start of the epoch and suppose mincut of G with respect to w is ≥ λ; and suppose the trees T1, . . . , Th have the property that every (1+)-approximate mincut is induced by a one or two-edge cut of one of the trees. Let w(cid:48) : E → R>0 be the weights at the end of an epoch. Then, the mincut with respect to weights w(cid:48) is ≥ (1 + )λ. Within an epoch, we must consider all cuts induced by 1 or 2 edges in O(1) spanning trees. We have complete flexibility in the order we consider them. For an efficient implementation we process the trees one at a time. For each tree T , we need to repeatedly output cuts with value ≤ (1 + O())λ or certify that there are no cuts of value strictly less than (1 + )λ induced by one or two edges of T . Although the underlying graph changes, we do not have to reconsider the same tree again because the cut values are non-decreasing. If each tree can be processed in O(m) time, then an entire epoch can be processed in O(m) time and the entire algorithm will run in O(cid:0)m/2(cid:1) time. In Figure 3, we revise the algorithm to invoke Theorem 3.1 once per epoch and use the trees to look for approximately minimum cuts, while abstracting out the search for approximately minimum cuts in each tree. 4 Cuts induced by a tree Let T ∈ T be a rooted spanning tree of G, and let λ > 0 be a fixed value such that the minimum cut value w/r/t w is ≥ λ. We want to list cuts C ∈ C induced by 1 or 2 edges in T with weight w(C) ≤ (1 + )λ, in any order, but with a twist: each time we select one cut C, we increment the weight of every edge in C, and these increments must be reflected in all subsequent cuts. We are 10 held-karp-3(G = (V,E),c,) x ← 0C, w ← 1/c, t ← 0, η ← / ln m λ ← size of minimum cut w/r/t edge weights w while t < 1 p ← O(log(n/)) spanning trees capturing every (1 + )-apx min cut for each tree T ∈ p let CT ⊆ C be the cuts induced by removing ≤ 2 edges from T while (a) t < 1 and w/ high probability // by Theorem 3.1 ce (b) there is a cut C ∈ CT s.t. w(C) < (1 + )λ y ← (cid:104)w, c(cid:105) w(C) · C γ ← min e∈C γ δ ← η x ← x + δy for all e ∈ C t ← t + δ end while we ← exp(γ/ce) · we end for λ ← (1 + )λ // start new epoch end while return x Figure 3: A third implementation of the MWU framework applied to packing cuts that samples a tree packing once at the beginning of each epoch and searches for approximately minimum cuts induced by one or two edges in the sampled trees. allowed to output cuts of value ≤ (1 + O())λ. When we finish processing T , we must be confident that there are no 1-cuts or 2-cuts C ∈ CT induced by T with weight w(C) ≤ (1 + )λ. The algorithmic challenge here is twofold. First, we need to find a good 1-cut or 2-cut in T quickly. Second, once a good cut is found, we have to increment the weights of all edges in the cut. Either operation, if implemented in time proportional to the number of edges in the cut, can take O(m) time in the worst case. To achieve a nearly linear running time, both operations must be implemented in polylogarithmic amortized time. In this section we focus on finding the cuts, and assume that we can update the edge weights along any 1 or 2-cut efficiently via the lazy-inc-cuts data structure. Since the weights are dynamically changing, we need to describe how the algorithm finding small 1-cuts and 2-cut in T interacts with the lazy-inc-cuts data structure. Interacting with the lazy weight update data structure: The interface for lazy-inc-cuts is given in Figure 4. The primary function of the lazy-inc-cuts data structure is inc-cut, which takes as input one or two edges in T , and simulates a weight update along the corresponding 1-cut or 2-cut. inc-cut returns a list of weight increments (ei, δi), where each ei is an edge and δi > 0 is a positive increment that we actually apply to the underlying graph. The cumulative edge weight increments returned by the subroutine will always underestimate the true increase, but by at most a (1 + O())-multiplicative factor for every edge. That is, if we let we denote the "true weight" of 11 Lazy Incremental Cuts: Interface Description Operations lazy-inc-cuts Given an undirected graph G = (V,E) with capacities c : E → R>0 and edge weights w : E → R>0, and a rooted spanning tree T , initializes the lazy-inc- cuts data structure. Given a 1-cut or 2-cut C ∈ CT induced by T , simulates a weight incre- ment along the cut per the MWU framework. Returns a list of tuples ∆ = {(e1, δ1), (e2, δ2), . . .}, where each ei ∈ E is an edge and each δi > 0 is a positive real value that signals that the weight of the edge ei has increased by an additive factor of δi. Each increment (ei, δi) satisfies δi ≥ Ω(cid:0)we/ log2 n(cid:1). inc-cut Returns a list of tuples ∆ = {(e1, δ1), . . . , (ek, δk)} of all residual weight incre- ments not accounted for in previous calls to inc-cut and flush. flush() Figure 4: The interface for the data structure lazy-inc-cuts, which efficiently simulates weight increments along cuts induced by 1 or 2 edges in a fixed and rooted spanning tree. Implementation details are provided later in Section 5. for e returned by inc-cut, then the lazy-inc-cuts data structure maintains the invariant that A second routine, flush(), returns a list of increments that captures all residual weight in- crements not accounted for in previous calls to inc-cut and flush. The increments returned by ≤ (1 + )λ w/r/t the approximated edge weights retains weight ≤ (1 + O())λ in the true underlying graph. Each increment (e, δ) returned by inc-cut reflects a (1+Ω(/ log2 n))-multiplicative increase an edge e implied by a sequence of weight increments along cuts, and (cid:101)we the sum of δ increments (cid:101)we ≤ we ≤ (1 + ρ)(cid:101)we, where ρ is a fixed constant that we can adjust. In particular, a cut of weight to we. As the weight of an edge is bounded above by O(cid:0)m1/(cid:1), the subroutine returns an increment for a fixed edge e at most O(cid:0)log3 n/2(cid:1) times total over the entire algorithm. flush() may not be very large, but restores (cid:101)we = we for all e. Formally, we will refer to the following. Lemma 4.1. Let G = (V,E) be an undirected graph with positive edge capacities c : E → R>0 and positive edge weights w : E → R>0, and T a rooted spanning tree in G. Consider an instance of we be the "true" weight of edge e if the MWU framework were followed exactly, and let (cid:101)we be the lazy-inc-cuts(G,c,w,T ) over a sequence of calls to inc-cut and flush. For each edge e, let (a) After each call to inc-cut, we have (cid:101)we ≤ we ≤ (1 + O())(cid:101)we for all edges e ∈ E. approximate weight implied by the weight increments returned by calls to inc-cut and flush. (b) After each call to flush, we have (cid:101)we = we. (e) Each increment (e, δ) returned by inc-cut satisfies δ ≥ Ω(cid:0)(/ log2 n)we (c) Each call to inc-cut takes O(log2 n + I), where I is the total number of weight increments (d) Each call to flush takes O(m log2 n) time and returns at most m weight increments. The implementation details and analysis of lazy-inc-cuts are given afterwards in Section 5. An enhanced sketch of the algorithm so far, integrating the lazy-inc-cuts data structure but abstracting out the search for small 1- and 2-cuts, is given in Figure 5. In this section, we assume Lemma 4.1 and prove the following. returned by inc-cut. (cid:1). 12 held-karp-4(G = (V,E),c,) x ← 0C, w ← 1E, t ← 0, η ← / ln m λ ← size of minimum cut w/r/t edge weights w while t < 1 w/r/t weights w w/ high probability // by Theorem 3.1 p ← O(log(n/)) spanning trees capturing all (1 + )-apx min cuts for each tree T ∈ p lic ← lazy-inc-cuts.init(G,c,T ) let CT ⊆ C be the cuts induced by removing ≤ 2 edges from T while (a) t < 1 and until s.t. w(C) < (1 + )λ (b) we have certified there are no cuts C ∈ CT (cid:18) (cid:19) · C (cid:104)w, c(cid:105) w(C) ce find C ∈ CT w/ w(e) < (1 + O())λ y ← γ ← min e∈C γ δ ← η x ← x + δy t ← t + δ ∆ ← lic.inc-cut(C) for (e, δ) ∈ ∆ we ← we + δ end for end while ∆ ← lic.flush() for (e, δ) ∈ ∆ we ← we + δ end for end for end while return x Figure 5: A fourth implementation of the MWU framework applied to the Held-Karp relaxation, that integrates the lazy-inc-cuts data structure into the subroutine that processes each tree. Lemma 4.2. Let T be a rooted spanning tree and λ > 0 a target cut value. One can repeatedly output 1-cuts and 2-cuts C ∈ CT induced by T of weight w(C) ≤ (1 + O())λ and increment the corresponding edge weights (per the MWU framework) until certifying that there are no 1-cuts or 2-cuts C ∈ CT of value w(C) ≤ (1 + )λ in O(cid:0)m log2 n + K log2 n + I log n(cid:1) time, where K is the number of 1-cuts and 2-cuts of value ≤ (1 + O())λ output and I is the total number of weight increments returned by the lazy-inc-cuts data structure. The rest of the section is devoted to the proof of the preceding lemma. We first set up some notation. Fixing a rooted spanning tree T induces a partial order on the vertices V. For two vertices u and v, we write u ≤ v if u is a descendant of v. Two vertices u and v are incomparable, written u (cid:107) v, if neither descends from the other. For each vertex v ∈ V, let Tv be the subtree 13 1-cut Incomparable 2-cut Nested 2-cut Figure 6: 3 types of tree-cuts def def def = w(C(S)) =(cid:80) of T rooted at v. Let D(v) = V(Tv) = {u : u ≤ v} be the down set of all descendants of v in T (including v). We work on a graph with edge weights given by a vector w : E → R>0. For a = {e ∈ E : e ∩ S = 1} be the set of edges cut by S, and let set of vertices S ⊂ V, we let C(S) e∈C(S) we denote the weight of the cut induced by S. For two disjoint sets of C(S) vertices S, T ⊆ V, we let C(S, T ) = {e = (a, b) ∈ E : a ∈ S, b ∈ T} be the edges crossing from S to T , and let C(S, T ) = w(C(S, T )) be their sum weight. Per Karger [2000], we divide the 1-cuts and 2-cuts into three distinct types, drawn in Figure 6. First there are the 1-cuts of T of the form C(D(s)). Then we have 2-cuts C(D(s) ∪ D(t)) where s and t are incomparable (i.e., s (cid:107) t). We call these incomparable 2-cuts. Lastly, we have 2-cuts C(D(t) \ D(s)) where s is a descendant of t (i.e., s < t). We call these nested 2-cuts. For a fixed tree, we process all 1-cuts, incomparable 2-cuts, and then nested 2-cuts, in this order. For each of these three cases we prove a lemma similar to Lemma 4.2 but restricted to the particular type of cut. Throwing in O(m) time to initialize the lazy-inc-cuts data structure at the beginning and O(m) to call flush at the end then gives Lemma 4.2. Standard data structures. Following Karger [2000], we rely on the dynamic tree data structure, link-cut trees, of Sleator and Tarjan [1983]. Link-cut trees store real values at the nodes of a rooted tree T and support aggregate operations along node-to-root paths in logarithmic time. We employ two operations in particular. First, given a node v and a value α ∈ R, we can add α to the value of every node on the v-to-root path (i.e., every node u such that u ≥ v) in O(log n) amortized time. Second, given a node v, we can find the minimum value of any node on the v-to-root path in O(log n) amortized time. We also need to compute least common ancestors (lca) in T for pairs of nodes. Harel and Tarjan [1984] showed how to preprocess T in linear time and answer lca queries in constant time. 1-cuts 4.1 Let e = (t, s) ∈ T be a tree edge with t a parent of s. Then T − e consists of two components: the subtree Ts rooted at s, and the remaining tree T \ Ts. The cut C(D(s)) in the underlying graph G induced by the subtree Ts is a "1-cut" of T . In this section, we want to output a sequence of 1-cuts C ∈ CT in T with w(C) ≤ (1 + O())λ, repeating if necessary, while incrementing weights of each listed cut on the fly, until we've determined that there are no 1-cuts C with weight w(C) ≤ (1 + )λ. Computing and maintaining the 1-cut values. To find the minimum 1-cut induced by a down 14 sstst set D(v), Karger observes that the weight C(D(v)) can be rewritten as (cid:88) C(D(v)) = (cid:88) C(x) − 2 x∈D(v) e∈E[D(v)] we, x∈D(v) The quantities(cid:80) where C(x) is the weighted degree of the vertex x, and E[D(v)] is the set of edges with both endpoints in D(v). C(x) over v ∈ V are just tree sums over the weighted degrees, and Karger [2000] computes them once for all v in O(m) total time by a depth-first traversal. In the dynamic setting, we can compute and maintain the tree sums in O(log n) time per edge update in a link-cut tree. Each time we increment the value of an edge e = (u, v) ∈ E by some δ > 0, we add δ to the value of every node on the paths to the root from u and v. e∈E[D(v)] we over edges with both endpoints in D(v) is just the sum of weights of all edges e = (x, y) for which the least common ancestor lca(x, y) of x and y is in D(v); e:lca(e)∈D(v) we By Harel and Tarjan [1984], we can compute lca(e) for every lca(e)=v we of all weights of edges whose least common ancestor is v. The quantities w(E[(D(v))]) can then be computed as tree-sums by depth-first search, and updated dynamically with link-cut trees, similar to before. The preceding discussion shows that the sums C(D(v)) for each v can be maintained dynamically i.e., w(E[D(v)]) =(cid:80) edge e ∈ E in linear time. We then compute for each vertex v the sum(cid:80) The sum w(E[D(v)]) = (cid:80) def in logarithmic time using link-cut trees. This is summarized in the lemma below. Lemma 4.3. Given edge-weighted graph G = (V,E) and a rooted spanning tree T , there is a data structure to maintain C(D(v)) for all v ∈ V as edge-weights are changed. The initialization cost is O(m), updates and queries take O(log n) amortized time. Processing all 1-cuts. The weight of all 1-cuts can be computed in O(m) time statically and O(log n)-time per edge update. To process all 1-cuts of the tree, we consider all downsets D(v) in any order. For each vertex v, we check if C(D(v)) ≤ (1 + )λ in O(log n) amortized time. If not, then we move on to the next vertex. Since the edge weights are monotonically increasing, C(D(v)) will never be ≤ (1 + )λ again, so we do not revisit v. Otherwise, if C(D(v)) is good, we take the cut in our solution and pass v to inc-cut to signal a weight increment along C(D(v)). In turn, inc- cut returns a list of "official" edge increments {(ei, δi)}. Each update can be incorporated into the link-cut tree in logarithmic time by Lemma 4.3. After processing the edge increments returned by inc-cut, we continue to process D(v) until C(D(v)) is no longer a good cut. The total running time to process all 1-cuts is O(m) plus O(cid:0)log2 n(cid:1) per cut output and O(log n) per edge weight increment returned by inc-cut. Lemma 4.4. Let T be a fixed and rooted spanning tree and λ > 0 a fixed target cut value. Employing the inc-cut routine of the lazy-inc-cuts data structure to approximately increment edge weights, one can repeatedly find 1-cuts C induced by T of value C(C) ≤ (1 + O())λ and increment the corresponding edge weights (per the MWU framework) until certifying that there are no 1-cuts C of value C(C) ≤ (1 + )λ in O(cid:0)m + K log2 n + I log n(cid:1) total running time, where K is the number of 1-cuts of value ≤ (1 + O()) output and I is the total number of weight increments returned by inc- cut. 2-cuts on incomparable vertices 4.2 In this section, we consider incomparable 2-cuts of the form C(D(s) ∪ D(t)), where s (cid:107) t. We first consider the case where s is a fixed leaf, and t ranges over all vertices incomparable to s. We then 15 Fixed leaf Fixed path to a leaf Induction step Figure 7: 3 cases for incomparable 2-cuts extend the leaf case to consider the case where s ranges over a path in the tree down to a leaf, and t ranges over all incomparable vertices to the path. We then apply an induction step that reduces processing the whole tree to a logarithmic number of rounds where in each round we process all the paths to leaves. See Figure 7. Incomparable 2-cuts with a leaf. We first fix s to be a leaf in T , and consider all incomparable 2-cuts with one side fixed to be {s}. Karger observes that the weight of the cut induced by D(t) + s, for t (cid:107) s, can be written as C(D(t) + s) = C(s) + C(D(t)) − 2C(D(t), s) where C(D(t), s) is the weight of edges with one endpoint s and the other in D(t). We only need to consider down sets D(t) for which s and D(t) are connected by some edge, since otherwise either {s} or D(t) induce a smaller cut, and after processing all 1-cuts, neither {s} or D(t) induce small enough cuts. For fixed s and ranging t over all t (cid:107) s, Karger finds the weight of the best incomparable D(t) + s cut statically as follows. As C(s) is fixed, the t's are differentiated only by the values C(D(t))−2C(D(t), s). Karger's algorithm creates a dynamic tree over T with each vertex t initialized with the value C(D(t)). (This initial tree only needs to be constructed once, and immutably reused for other s's). Karger's algorithm immediately adds +∞ to the value of every vertex on the s-to- root path to eliminate all comparable vertices from consideration. For each edge e = (s, v) with endpoint s, Karger's algorithm subtracts 2we from every vertex on the v-to-root path, to incorporate the second term −2C(D(t), s). Then, for each edge e = (s, v) adjacent to s, Karger's algorithm finds the minimum value vertex on the v to root path. The minimum value vertex z over all such queries gives the best s + D(z) cut subject to s (cid:107) z, as desired. The running time to process the leaf s, excluding the construction of the initial tree, is bounded by the time spent subtracting edge weights and taking minimums over the v-to-root path for each edge (s, v) incident to s. With dynamic trees, subtracting and finding the minimum along a vertex-to-root path each take O(log n) amortized time. Thus, up to a logarithmic factor, the time spent processing all incomparable 2-cuts with one side a fixed leaf s is proportional to the number of edges incident to s. In the dynamic setting, we do the following. We first compute the sum C(D(t)) − 2C(D(t), s) for all incomparable t : t (cid:107) s, as above. We then run through the edges (s, v) incident to s in any fixed order, checking for s + D(t) cuts with t ≥ v that have value ≤ (1 + )λ and updating edge weights along good cuts on the fly, as follows. 16 stts1s2...s`1s` Fix an edge e = (s, v) incident to s. We process e until we know that there is no good (D(t)+ s)- cut for any ancestor t of v. We first find the minimum value vertex on the v-to-root path in O(log n) amortized time. If the minimum value is > (1 + )λ − C(D(s)), then we move onto the next edge incident to s. Otherwise, let t be an ancestor of v such that s+D(t) induces a good cut. We pass the cut C(s + D(t)) (in terms of the roots of s and t) to inc-cut, which simulates a weight update along C(s + D(t)) and returns a list of weight increments {(ei, δi)}. For each such edge e = (x, y) whose weight is increased by some δ > 0, we add δ to every vertex on the x-to-root and y-to-root paths. We then subtract 2δ from the lca(x, y)-to-root path. These additions and subtraction account for the first term, C(D(t)). If x = s, then we also subtract 2δ from the y-to-root path for the sake of the second term, −2C(D(t), s). After all official weight increments returned by inc-cut have been incoporated into the dynamic tree, we continue to process the same edge e = (s, v). Once all edges e = (s, v) incident to s have been processed, we have certified that all 2-cuts with one side fixed to the leaf s have weight ≥ (1 + )λ. The total time is O(log n) times the number of edges incident to Leaf-paths. The approach outlined above for processing leaves extends to processing paths. Let a leaf-path be a maximal subtree that is a path. Let p = s1, s2, . . . , s(cid:96) be a leaf path, where s1 is a leaf, s2 is its parent, and so forth. We want to process all 1-cuts of the form D(si) ∪ D(t), where t is incomparable to any and all of the si's on the path. s, plus O(cid:0)log2 n(cid:1) time for every cut output and O(log n) for every increment returned by inc-cut. For each i, we have C(D(si) ∪ D(t)) = C(D(si)) + C(D(t)) − 2C(D(si), D(t)), where C(D(si), D(t)) is the weight of all edges between D(si) and D(t). The values C(D(t)) for t (cid:107) s1, . . . , s(cid:96) and C(D(si)) for each i are easy to compute initially and maintain dynamically, per the earlier discussion about 1-cuts in Section 4.1. For fixed i, the incomparable t are differentiated by the value C(D(t))− 2C(D(si), D(t)). The basic idea here is that C(D(si+1), D(t)) can be written in terms of the preceding cut in the form C(D(si+1), D(t)) = C(D(si), D(t))+ C(si+1, D(t)). That is, after computing C(D(si), D(t)) for all incomparable t, we can keep these values and just incorporate the weights of edges incident to si+1 to get the values C(D(si), D(t)) for all incomparable t. We first review the static case, where we want to find the minimum such cut. Karger's algorithm first processes the leaf s1 as a leaf, as outlined above, and takes note of the minimum s1 + D(t) cut. It then processes s2 in the same fashion, except it continues the aggregate data built when processing s1 rather than starting fresh. By subtracting the weights of all edges incident s2 from the values of the various incomparable downsets, and having already subtracted the weights of edges incident to s1, we will have subtracted the weight of all edges incident to D(s2) = {s1, s2}, and so we have computed C(D(t))− 2C(D(s2), D(t)) for all t (cid:107) s2. In this fashion, Karger's algorithm marches up the path doing essentially the same work for each vertex as for a fixed leaf, except continuing the same link-cut tree from one si to the next. The total work processing the entire leaf-path is, up to a logarithmic factor, proportional to the total number of edges incident to any node si on the path. The analogous adjustments are made in the dynamic setting. That is, we process s1 as a leaf, passing good cuts to inc-cut and incorporating the returned edge increments on the fly. After processing s1, we keep the accumulated aggregate values, and start processing s2 likewise. Marching up the leaf-path one vertex at a time. In this manner, we are able to process 2-cuts of the form D(si) + D(t) over each si along the leaf-path s1, . . . , s(cid:96) (subject to t (cid:107) s1, . . . , s(cid:96)) and at the end certify there are no such cuts of weight < (1 + )λ. The total work in processing the leaf path is O(log n) for each edge incident to s1, . . . , s(cid:96), O(cid:0)log2 n(cid:1) for each good cut output, and O(log n) for each weight increment returned from the subroutine inc-cut. 17 All incomparable 2-cuts. Karger [2000] showed that an efficient subroutine for processing all incomparable 2-cuts on a single leaf-path leads to an efficient algorithm for processing all incom- parable 2-cuts in the entire tree as follows. The overall algorithm processes the 2-cuts of a tree in phases. Each phase processes all the leaf-paths of the current tree, and then contracts the leaf-paths into their parents and recurses on the new tree in a new phase. Each leaf in the contracted graph had at least two children in the previous phase, so the number of nodes has halved. After at most O(log n) phases, we have processed all the incomparable 2-cuts in the tree. Excluding the work for selecting a cut and incrementing edge weights returned by the lazy-inc-cuts data structure, pro- cessing a leaf-path takes time proportional to the number of edges incident to the leaf-path. Each edge is incident to at most 2 leaf-paths. Thus, a single phase takes O(m log n) time, in addition to O(cid:0)log2 n(cid:1) time for every cut output and O(log n) amortized time for every edge weight increment returned by the lazy-inc-cuts data structure. In conclusion, we have shown the following. Lemma 4.5. Let T be a fixed and rooted spanning tree and λ > 0 a fixed target cut value. Employing the inc-cut routine of the lazy-inc-cuts data structure to approximately increment edge weights, one can repeatedly find incomparable 2-cuts C induced by T of value C(C) ≤ (1 + O())λ and increment the corresponding edge weights (per the MWU framework) until certifying that there are no incomparable 2-cuts C of value C(C) ≤ (1 + )λ in O(cid:0)m log2 n + K log2 n + I log n(cid:1) total amortized time, where K is the number of incomparable 2-cuts of value ≤ (1 + O())λ output and I is the total number of weight increments returned by inc-cut. 4.3 Nested 2-cuts The other type of 2-cuts is of the form D(t) \ D(s), where t is an ancestor of s. We call these cuts nested 2-cuts. As in the case of incomparable 2-cuts, we first consider the case where s is fixed to be a leaf, then the case where s is on a leaf-path, and then finally an induction step that processes all leaf-paths in each pass. Nested 2-cuts with a leaf. We take the same approach as with incomparable 2-cuts, and start with the case where s is a fixed leaf. Karger observed that the weight of the cut induced by D(t)− s can be written as (1) C(D(t) − s) = C(D(t)) + 2C(s, D(t)) − C(s), where C(s, D(t)) is the sum weight of the edges between s and D(t). We start with a link-cut tree over T where each node v is initialized with C(D(v)). For each edge e = (s, u) incident to s, we find the least common ancestor t = lca(s, u), and add 2we to every node on the u-to-root path in O(log n) time. We also subtract we from the value of every node on the s-to-root path. The first set of updates along the t-to-root path is for the second term of (1), and the second set along the s-to-root path is for the third term. Karger's algorithm finds the minimum value on the s-to-root path to get the value of the mini- mum (D(t)−s)-cut over all t > s. In the dynamic setting, we repeatedly find the minimum value on the s-to-root path as long as this value is below the threshold (1 + )λ. Each time we find a good cut C(D(t) − s), we send the cut to the routine inc-cut (compactly represented by s and t). For each edge weight increment (e = (x, y), δ) returned by inc-cut we do the following. Let t = lca(x)y be the least common ancestor. First, we add δ to every the value of every vertex on the x-to-root and y-to-root paths and subtract 2δ from every value of every vertex on the t-to-root-path in O(log n) time, to account for the first term C(D(t)) (see Section 4.1). If e is also incident to s, then we add 2δ to the value of every vertex on the t-to-root path (for the second term of (1)), and subtract δ from the value of every vertex on the s-to-root path (for the third term). Thus, incorporating an 18 edge increment (e, δ) consists of a constant number of updates along node-to-root paths and takes O(log n) amortized time. fixed leaf s is O(log n) times the number of edges incident to s, plus O(cid:0)log2 n(cid:1) for every cut output The total amortized running time for processing all nested 2-cuts of the form D(t) − s with a and O(log n) for every edge weight increment returned by the inc-cut subroutine. Nested 2-cuts along a leaf-path. We extend the leaf case to a leaf path s1, . . . , s(cid:96), where s1 is a leaf and each si with i > 1 has exactly one child, and consider all cuts of the form D(t) \ D(si) over all si in the leaf path and all ancestors t of si. For each i, we have (2) When i = 1, this is the same as equation (1) obtained for the leaf case. For i = 1, . . . , (cid:96) − 1, the difference in (2) between consecutive vertices si and si+1 is C(D(t) \ D(si)) = C(D(t)) + 2C(D(si), D(t)) − C(D(si)). C(D(t) \ D(si+1)) − C(D(t) \ D(si)) = 2(cid:2)C(D(si+1), D(t)) − C(D(si), D(t))(cid:3) = 2C(si+1, D(t)) + C(si+1) − 2C(si+1, D(si)). (cid:2)C(cid:0)D(si+1) − C(D(si))(cid:1)(cid:3) − (3) These observations lead to the following bottom-up approach. We first process s1 as though it were a leaf, as described above. For i = 1, . . . , (cid:96) − 1, once we have certified that are no nested D(t) − si cuts of value < (1 + )λ, we begin to process si+1, continuing the aggregate values computed when processing si instead of starting over. For each edge e = (si+1, x) incident to si+1, we update the values along paths up the tree per (3) as follows. For the first term, 2C(si+1, D(t)), we find the least common ancestor t = lca(si+1, x), and add 2we to every vertex on the t-to-root path. For the second term, C(si+1), we add we to every vertex on the si+1-to-root path. For the third term, 2C(si+1, D(Si)), if x = sj for some j < i, then we subtract 2we from every vertex on the si+1-to- root path. After processing the edges incident to si+1, we repeatedly find the minimum value in the si+1-to-root path so long as the minimum value is less than the threshold (1 + )λ. Each time the minimum value is below the threshold, we update weights along the edges of the corresponding cut via inc-cut, and propagate any increments returned by inc-cut (as before) to restore (2) before querying for the next minimum value. To process all the nested 2-cuts along the leaf-path, as with incomparable 2-cuts along leaf-paths, the total amortized running time is O(log n) times the number of edges incident to s1, . . . , s(cid:96), plus O(cid:0)log2 n(cid:1) work for each cut output and O(log n) work for each edge increment returned by inc- cut. All nested 2-cuts. By the same induction step as for incomparable 2-cuts, efficiently processing leaf-paths leads to a procedure for efficiently processing the whole tree. The processing is broken into phases. Each phase processes all the leaf-paths of the current tree, and then contracts the leaf-paths into their parents. Each leaf in the contracted tree had at least two children previously, so the number of nodes has at least halved. After O(log n) phases, we have processed the entire tree. Modulo O(cid:0)log2 n(cid:1) work for each cut output and O(log n) work for each edge increment returned by inc-cut, processing a leaf path takes O(log n) time for each edge incident to any node on the path, and conversely each edge is incident to at most 2 leaf paths. Thus, excluding the time spent outputting cuts and incrementing edge weights along the cuts, each phase takes O(m log n) to complete. Lemma 4.6. Let T be a fixed and rooted spanning tree and λ > 0 a fixed target cut value. Employing the inc-cut routing of the lazy-inc-cuts data structure to manage edge weight increments, one 19 can repeatedly find nested 2-cuts C induced by T of value C(C) ≤ (1 + O())λ and increment the corresponding edge weights (per the MWU framework) until certifying that there are no incomparable 2-cuts C of value C(C) ≤ (1 + )λ, in O(cid:0)m log2 n + K log2 n + I log n(cid:1) total running time, where K is the number of nested 2-cuts of value ≤ (1 + O())λ output and I is the total number of weight increments returned by inc-cut. 5 Applying multiplicative weight updates along cuts We address the remaining issue of implementing the lazy-inc-cuts data structure for a fixed and rooted spanning tree T . An interface for lazy-inc-cuts was given previously in Figure 4 and we target the bounds claimed by Lemma 4.1. Recall that the MWU framework takes a cut C ∈ C, computes the smallest capacity γ = arg mine∈C ce in the cut, and increases the weight of each cut-edge e ∈ C by a multiplicative factor of exp(γ/ce) (see Figure 1). A subtle point is that the techniques of Section 4 identify approximate min-cuts without explicitly listing the edges in the cut. A 1-cut C(D(s)) is simply identified by the root s of the down-set D(s), and likewise 2-cuts of the form C(D(s) ∪ D(t)) (when s (cid:107) t) and C(D(t) \ D(s)) (when s < t) can be described by the two nodes s and t. In particular, an approximately minimum cut C is identified without paying for the number of edges O(C) in C in the running time. When it comes to updating the edge weights, the natural approach of visiting each edge e ∈ C would be too slow, to say nothing of even identifying all the edges in C in time proportional to C. While the general task of incrementing2 weights along a cut appears difficult to execute both quickly and exactly, we have already massaged the setting to be substantially easier. First, we can afford to approximate the edge weights we by a small multiplicative error. This means, for example, that a cut edge e ∈ C with very large capacity ce (cid:29) γ can to some extent be ignored. Second, we are not incrementing weights along any cut, but just the 1-cuts and 2-cuts of a fixed rooted spanning tree T . We have already seen in Section 4 that restricting ourselves to 1-cuts and 2-cuts allows us to (basically) apply dynamic programming to find small cuts, and also allows us to use dynamic trees to efficiently update and scan various values in the aggregate. Here too we will see that 1-cuts and 2-cuts are simple enough to be represented efficiently in standard data structures. In the following, we use the term "cuts" liberally as the set of edges with endpoints in each of two sets of vertices; in particular, the two sets of vertices may not be disjoint. Lemma 5.1. Let T be a fixed rooted spanning tree of an undirected graph G = (V,E) with E = m DT ⊆ 2E such that (i) every edge e ∈ E appears in at most O(log2 n) cuts D ∈ DT , and (ii) every 1-cut or 2-cut C ∈ CT (described succinctly by at most 2 roots of subtrees) can be decomposed into the disjoint union C = D1 (cid:116) ··· (cid:116) D(cid:96) of (cid:96) = O(log2 n) cuts D1, . . . , D(cid:96) ∈ DT in O(log2 n) time. By building the collection D ∈ DT once for a tree T , Lemma 5.1 reduces the problem of incrementing along any 1-cut or 2-cut C ∈ CT to incrementing along a "canonical" cut D ∈ DT known a priori. This is important because multiplicative weight updates can be applied to a static set relatively efficiently by known techniques [Young, 2014, Chekuri and Quanrud, 2017b]. It is edges and V = n vertices. In O(cid:0)m log2 n(cid:1) time, one can construct a collection of nonempty cuts also important that cuts in DT are sparse, in the sense that(cid:80) D∈DT D = O(cid:0)m log2 n(cid:1), as this sum 2In the MWU framework the weights increase in a multiplicative fashion. We use the term "incrementing" in place of "updating" since weights are increasing and also because it is convenient to think in terms of the logarithm of the weights, which do increase additively. 20 Figure 8: An edge cut e by a subtree Ts, and two possible inequalities in the Euler order. ± (see the picture on the right). ≤ u− factors directly into the running time guarantees. We first prove Lemma 5.1 in Section 5.1, and then in Section 5.2 we show how to combine amortized data structures for each D ∈ DT to increment along any 1-cut or 2-cut C ∈ CT . 5.1 Canonical cuts Euler tours and orderings. Let T be a fixed and rooted tree on n vertices V, and fix an Euler tour on a bidirected copy of T that replaces each edge of T with arcs in both directions, starting from the root. For each vertex v, we create two symbols: v− means we enter An Euler tour inducing the or- dering r− < a− < a+ < b− < the subtree Tv rooted at v, and v+ means we leave the subtree v. Let c− < c+ < d− < d+ < b+ < r+. ± = {v−, v+ : v ∈ V(T )} denote the whole collection of these 2n symbols. The Euler tour enters V and leaves each subtree exactly once in a fixed order. Tracing the Euler tree induces a unique total ordering on V This ordering has a couple of interesting properties. For every vertex v ∈ V(T ), we have v− < v+. Letting r denote the root of T , r− is the first element in the ordering and r+ is the last element in the ordering. More generally, for a vertex v and a vertex w ∈ D(v) in the subtree rooted at v, we have v− ≤ w− < w+ ≤ v+, with all inequalities strict if v (cid:54)= w. That is, the ranges {[v−, v+] : v ∈ V(T )} between entering and leaving a subtree form a laminar set. The Euler order on the vertices endows a sort of geometry to the edges. Each edge e = (u, v) ≤ s− (with u− < v−) can be thought of as an interval [u−, v−]. A downset D(s) cuts e iff u− ≤ v− } ∩ [s−, s+] = 1. Alternatively, ≤ s+ or s− D(s) cuts e iff [u−, v−] ∩ {s−, s+} = 1. These observations suggest that this is not a problem about graphs, but about intervals, and perhaps a problem suited for range trees. ± at its leaves. As a Range trees on the Euler order. Let R be a balanced range tree with V balanced tree with 2n leaves, R has O(n) nodes and height O(log n). Each range-node a ∈ V(R) ± at the leaves of the subtree Ra induces an interval Ia on V ± (induced by a), and let I = {Ia : a ∈ V(R)} rooted at a. We call Ia a canonical interval of V denote the collection of all O(n) canonical intervals. ≤ s+ ≤ v− (see Figure 8); that is, iff {u−, v− ±, consisting of all the elements of V Each element in V ± appears in O(log n) canonical intervals because the ± decomposes into height of R is O(log n). Moreover, every interval J on V the disjoint union of O(log n) canonical intervals. The decomposition can be obtained in O(log n) time by tracing the two paths from the root of R to the endpoints of J and taking the canonical intervals corresponding to the O(log n) maximal subtrees between the paths (see the picture on the right). Similarly, the union of a constant number of intervals or the complement of the union of a constant number of intervals decomposes to O(log n) canonical intervals in O(log n) time. 21 usveusvs+usvesus+vrabcdJ The canonical intervals I relate to the 1-cuts and 2-cuts CT induced by T as follows. For any pair of disjoint canonical intervals I1, I2 ∈ I, let C(I1, I2) = {(u, v) ∈ E : u ∈ I1, v ∈ I2} be the set of edges with one endpoint in I1 and the other in I2. We call C(I1, I2) a canonical cut induced by I1 and I2. We claim that any 1-cut or 2-cut C ∈ CT decomposes into the disjoint union of O(log2 n) canonical cuts. For starters, let C = C(D(s)) be the 1-cut induced by the downset of a vertex s. The 1-cut C(D(s)) consists of all edges (u, v) with one (tagged) endpoint u− [s−, s+] decomposes to the disjoint union [s−, s+] =(cid:70) in the interval [s−, s+] and the other endpoint v− outside [s−, s+]. The interval the disjoint union [r−, s−)∪ (s+, r+] =(cid:70) I1∈I1 I1 of O(log n) canon- ical intervals I1 ⊆ I, and the complement [r−, s−)∪ (s+, r+] also decomposes to I2 ⊆ I (see the picture on the right). Together, the disjoint union C(D(s)) =(cid:70) I2∈I2 I2 of O(log n) canonical intervals C(I1, I2) of canonical cuts over the cross product (I1, I2) ∈ I1 × I2 decomposes the 1-cut C(D(s)) into I1 × I2 = O(log2 n) canonical cuts. Moreover, both decompositions I1 and I2 can be obtained in O(log n) time. Any 2-cut decomposes similarly. If s (cid:107) t are incomparable, with (say) s− < s+ < t− < t+, then the incomparable 2-cut C = C(D(s) ∪ D(t)) is the set of edges with one endpoint in [s−, s+]∪[t−, t+] and other endpoint in the complement, [r−, s−)∪(s+, t−)∪(t+, r+]. Both of these sets are the disjoint cross-product of the two decompositions decomposes C(D(s) ∪ D(t)) into O(cid:0)log2 n(cid:1) canonical cuts. union of two or three intervals, and they each decompose into O(log n) canonical intervals. The If s < t are two comparable vertices, then t− < s− < s+ < t+ and the nested 2-cut C(D(t) \ D(s)) is the set of edges with one endpoint in [t−, s−) ∪ (s+, t+] and the other endpoint into O(cid:0)log2 n(cid:1) disjoint canonical cuts. in the complement [r−, t−) ∪ [s−, s+] ∪ [t+, r+] and the cross-product breaks C(D(t) \ D(s)) down Thus, any 1-cut or 2-cut C ∈ CT breaks down into to the disjoint union of O(log2 n) canonical cuts. An edge e = (u, v) appears in a canonical cut C(I1, I2) iff u ∈ I1 and v ∈ I2. As either cuts are easily constructed in O(m log2 n) time by adding each edge to the O(cid:0)log2 n(cid:1) canonical cuts end point u or v appears in O(log n) canonical intervals, e appears in at most O(log2 n) canonical cuts. In turn, there are at most O(m log2 n) nonempty canonical cuts. The nonempty canonical I1∈I1,I2∈I2 containing it. Taking DT to be this set of nonempty canonical cuts gives Lemma 5.1. 5.2 Lazy weight increments Lemma 5.1 identifies a relatively small set of canonical cuts DT such that any 1-cut or 2-cut C ∈ CT is the disjoint union of O(cid:0)log2 n(cid:1) canonical cuts D1, . . . , DO(log2 n) ∈ DT . While we can now at least gather an implicit list of all the edges of C in O(cid:0)log2 n(cid:1) time, it still appears necessary to visit every edge e ∈ C to increment its weight. The challenge is particularly tricky because the multiplicative weight updates are not uniform. However, for a fixed and static set, recent techniques by Young [2014] and Chekuri and Quanrud [2017b] show how to approximately apply a multiplicative weight update to the entire set in polylogarithmic amortized time. In this section, we apply these techniques to each canonical cut D ∈ DT and show how to combine their outputs carefully to meet the claimed bounds of Lemma 4.1. For every canonical cut D ∈ DT , we employ the lazy-inc data structure of Chekuri and Quanrud [2017b]. The lazy-incs data structure gives a clean interface to similar ideas in Young [2014], and we briefly describe a restricted version of the data structure in [Chekuri and Quanrud, 2017b] per the needs of this paper3. The lazy-incs data structure is an amortized data structure 3What we refer to as lazy-incs is most similar to lazy-incs(0) in Chekuri and Quanrud [2017b]. 22 [s,s+][r,s)(s+,r+] that approximates a set of counters increasing concurrently at different rates. For a fixed instance of lazy-incs for a particular canonical cut D ∈ DT , we will have one counter for each edge tracking the "additive part" ve = ln(we)/ for each edge e ∈ D. The rate of each counter e is stored as rate(e), and in this setting is proportional to the inverse of the capacity ce. The primary routine is inc(ρ), which simulates a fractional increase on each counter proportional to a single increment at the rate ρ. That is, each counter ve increases by rate(e)/ρ. The argument ρ will always be taken to be proportional to the inverse of the minimum capacity of any edge in the cut, γ = mine∈C ce. The output of inc(ρ) is a list of increments {(e, δe)} over some of the edges in D. The routine does not return an increment (e, δe) unless δe is substantially large. This allows us to charge off the work required to propagate the increment (e, δe) to the rest of the algorithm to the maximum weight of e. In exchange for reducing the number of increments, the sum of returned increments for a fixed edge e underestimates ve by a small additive factor. An underestimate for ve = ln(we)/ within an additive factor of O(1) translates to an underestimate for we = exp(ve) within a (1 + O())- multiplicative factor, as desired. At a high level, lazy-incs buckets the counters by rounding up each rate to the nearest power of 2. For each power of 2, an auxiliary counter is maintained with rate set to this power (more or less) exactly and efficiently. Counters with rates that are powers of 2 can be maintained in constant amortized time for the same reason that a binary number can be incremented in constant amortized time. When an auxiliary counter increases to the next whole integer, the tracked counters in the corresponding bucket are increased proportionately. Up to accounting details, this lazy scheme tracks the increments of each counter to within a constant additive factor at all times. A more general implementation of lazy-incs and a detailed proof of the following theorem are given in [Chekuri and Quanrud, 2017b]. Lemma 5.2 (Chekuri and Quanrud, 2017b). Let e1, . . . , ek be k counters with rates rate(e1) ≥ rate(e2) ≥ ··· ≥ rate(ek) in sorted order. (a) An instance of lazy-incs can be initialized in O(k) time. (b) Each inc runs in O(1) amortized time plus O(1) for each increment returned. (c) flush runs in O(k) time. (d) For each counter ei, let vi be the true value of the counter and let vi be the sum of increments for counter i in the return values of inc and flush. (i) After each call to inc, we have vi ≤ vi ≤ vi + O(1) for each counter ei. (ii) After each call to flush, we have vi = vi for each counter ei. We note that flush is not implemented in [Chekuri and Quanrud, 2017b], but is easy enough to execute by just reading off all the residual increments in the data structure and resetting these values to 0. The application of lazy-incs to our problem bears some resemblance to its application to packing intervals in [Chekuri and Quanrud, 2017b], where the weights are also structured by range trees. We first invoke Lemma 5.1 to generate the family of canonical cuts DT . For each canonical cut D ∈ DT , by Lemma 5.2, we instantiate an instance of lazy-incs where each edge e ∈ D has rate rate(e) = log2 n/ce. (Lemma 5.2 takes as an input a collection of counters sorted by rate. Rather than sort each canonical cut individually, we can save a log(n)-factor by a slight modification to Lemma 5.1. If the edges are sorted before applying Lemma 5.1, then each canonical cut D ∈ DT will naturally be in sorted order.) We also compute, for each canonical cut D ∈ DT , the minimum When incrementing weights along a cut C ∈ CT , we update the weights as follows. Lemma (cid:48) 5.1 divides C into the union of O(log2 n) disjoint canonical cuts D T ⊆ DT . We find the minimum capacity γ = mine∈C ce by taking the minimum of the precomputed minimum capacities of each capacity γD = mine∈D ce in the cut. These preprocessing steps take O(cid:0)m log2 n(cid:1) time total. 23 (cid:48) T , i.e., γ = minD∈D(cid:48) T γD. For each canonical set D ∈ D (cid:48) canonical cut D ∈ D T , we call inc(log2 n/γ) on the corresponding lazy-incs instance. For every increment (e, δ) returned in lazy-incs, where e ∈ C and δ > 0 represents a increment to ve = ln(we)/, we increase ve by an additive factor of δ/ log2 n, and multiply we by exp(cid:0)δ/ log2 n(cid:1) accordingly. Fix an edge e ∈ E. The edge e is a member of O(cid:0)log2 n(cid:1) canonical cuts in DT , and receives its weight increments from O(log2 n) instances of lazy-incs. The slight errors from each instance of lazy-incs accumulate additively (w/r/t ve = ln(we)/). Although each instance of lazy-incs promises only a constant additive error in Lemma 5.2, we scaled up the rate of e from 1/ce to log2 n/ce and divide the returned weight increments by a factor of log2 n. The scaling reduces the error from each instance of lazy-incs from an additive factor of O(1) to O(1/ log2 n). Consequently, the sum of all O(log2 n) instances of lazy-incs underestimates ve to an O(1) additive error w/r/t ve, and underestimates we by at most a (1 + O())-multiplicative factor, as desired. Increasing the sensitivity of each lazy-incs data structure by a factor of log2 n means every increment (e, δ) returned by inc may increase ve by as little as 1/ log2 n. An additive increase in 1/ log2 n corresponds to a multiplicative increase of exp(cid:0)/ log2 n(cid:1) in we, hence property (e) in Lemma 4.1. Together, the construction of the canonical cuts DT and the O(m log2 n) carefully calibrated instances of lazy-inc, one for each canonical cut D ∈ DT , give Lemma 4.1. 6 Putting it all together: Proof of Theorem 1.1 (cid:48) = O(log n). In this section we combine the ingredients discussed so far and outline the proof of Theorem 1.1. Let (G, c) be an Metric-TSP instance and (cid:48) > 0 be the error parameter. We assume without loss of generality that that (cid:48) is sufficiently small, and in particular that (cid:48) < 1/2. We will also assume that (cid:48) > 1/n2 for otherwise one could use an exact algorithm and achieve the desired time bound. This implies that log 1 Consider the algorithm in Figure 5 which takes  as a parameter. We will choose  = ρ(cid:48) for some sufficiently small ρ. It thus suffices to argue that the algorithm outputs a (1 + O())-approximation with high probability. High-level MWU analysis: At a high-level, our algorithm is a standard width-independent MWU algorithm for pure packing problems with an α-approximate oracle, for α = (1 + O()). Our implementation follows the "time"-based algorithm of Chekuri et al. [2015]. An exact oracle in this setting repeatedly solves the global minimum cut problem w/r/t the edge weights w. To implement an α-approximate oracle, every cut output needs to be an α-approximate minimum cut. To argue that we are indeed implementing an α-approximate minimum cut oracle, let us identify the two points at which we deviate from Karger's minimum cut algorithm [2000], which would otherwise be an exact oracle that succeeds with high probability. In both Karger's algorithm and our partially dynamic extension, we sample enough spanning trees from an approximately maximum tree packing to contain all (1+O())-approximate minimum cuts as a 1-cut or 2-cut with probability 1−poly(1/n) = 1−poly(/n) (see Theorem 3.1). The sampled tree packings are the only randomized component of the algorithm, and we will argue that all the sampled tree packings succeed with high probability later after establishing a basic correctness in the event that all the sampled packings succeed. Karger's algorithm searches all the spanning trees for the minimum 1-cut or 2-cut. We retrace the same search, except we output any approximate minimum 1-cut or 2-cut found in the search. More precisely, we maintain a target value λ with the invariant that there are no cuts of value < λ, and output any 1-cut or 2-cut with weight ≤ (1 + O())λ at that moment (see Lemma 4.2). Since 24 λ is no more than the true minimum cut w/r/t w at any point, any cut with weight ≤ (1 + O())λ is a (1 + O())-approximation to the current minimum cut. The second point of departure is that we do not work with the "true" weights implied by the framework, but a close approximation. By Lemma 4.1, the approximated weights underestimate the true weights by at most a (1 + O())-multiplicative factor. In turn, we may underestimate the value of a cut by at most a (1 + O())-multiplicative factor, but crucially any 1-cut or 2-cut will still have value ≤ (1 + O())λ, for a slightly larger constant hidden in the O(). This firmly establishes that the proposed algorithm in fact implements an α-approximate oracle for α = 1 + O() (with high probability). The MWU framework then guarantees that the final pack- ing of cuts output by the algorithm approximately satisfies all the constraints with approximately optimal value, as desired. Probability of failure. We now consider the probability of the algorithm failing. Randomiza- tion enters the algorithm for two reasons. Initially, we invoke Karger's randomized minimum cut algorithm [2000] to compute the value of the minimum cut w/r/t the initial weights w = 1/c, in order to set the first value of λ. Second, at the beginning of each epoch, we randomly sample a subset of an approximately maximum tree packing hoping that the sampled trees contain every (1 + O())-approximate minimum cut as a 1-cut or 2-cut in one of the sampled trees4. Karger [2000] showed that the minimum cut algorithm fails with probability at most poly(1/n). He also showed (see Theorem 3.1) that each random sample of O(log(n/)) = O(log n) spanning trees of an approximately maximum tree packing (conducted at the beginning of an epoch) fails to capture all (1 + )-approximate minimum cuts with probability at most poly(1/n) = poly(/n). As discussed in Section 3, there are a total of O(cid:0)log n/2(cid:1) epochs over the course of the algorithm. By the union bound, the probability of any random sample of spanning trees failing is O(cid:0)log n/2(cid:1) The algorithm initializes the edge weights in O(m) time, and invokes Karger's minimum cut · poly(/n) = poly(/n). Taking a union bound again with the chance of the initial call to Karger's minimum cut algorithm failing, the probability of any randomized component of the algorithm failing is at most poly(1/n), as desired. It remains to bound the running time of the algorithm. The analysis is not Running time. entirely straightforward, as some operations can be bounded directly, while others are charged against various upper bounds given by the MWU framework. algorithm [2000] once which runs in O(cid:0)m log3 n(cid:1) time. As established in Section 3, the remaining algorithm is divided into O(cid:0)log(n)/2(cid:1) epochs. Each epoch invokes Theorem 3.1 once to sample O(log(n/)) = O(log n) spanning trees from an approximate tree packing in O(cid:0)m log3 n(cid:1) time. We then invoke Lemma 4.2 for each spanning tree in the sample. Over the course of O(cid:0)log(n)/2(cid:1) epochs, each with O(log(n)) spanning trees, we invoke Lemma 4.2 at total of O(cid:0)log2(n)/2(cid:1) times. weight increments. By Lemma 4.2, the total time to process T is O(cid:0)m log2 n + K log2 n + I log n(cid:1). The first term, O(cid:0)m log2 n(cid:1), comes from following the tree-processing subroutine of Karger [2000]. Over a total O(cid:0)log2(n)/2(cid:1) trees, the total time spent mimicking Karger's subroutine is O(cid:0)m log4(n)/2(cid:1). Suppose we process a tree T , outputting K approximately minimum cuts and making I full edge The remaining terms of Lemma 4.2, depending on K and I, are introduced by the MWU framework and can be amortized against standard properties of the MWU framework. The quantity K represents the number of approximate minimum cuts output while processing a single tree T , and the sum of all K across all trees is the total number of approximate minimum cuts output. Each such cut corresponds to a single iteration, and the total number of iterations in the MWU 4Interestingly, the only randomization in Karger's algorithm also stems from randomly sampling an approximately maximum tree packing. 25 framework is O(cid:0)m log(n)/2(cid:1). Thus, the sum of the second term O(cid:0)K log2 n(cid:1) over all invocations of Lemma 4.2 is O(cid:0)m log3(n)/2(cid:1). O(cid:0)log3(n)/2(cid:1) times (see Section 2). It follows that the total number of edge increments, over all edges, returned by lazy-inc-cuts is O(cid:0)m log3(n)/2(cid:1). Thus, the sum of the quantities O(I log n) over all invocations of Lemma 4.2 is O(cid:0)m log4(n)/2(cid:1). All told, the algorithm runs in O(cid:0)m log4(n)/2(cid:1) = O(cid:0)m/2(cid:1) time total. The third term of Lemma 4.2, O(I log n) depends on the number of increments I returned by the inc-cut subroutine of the lazy-inc-cuts data structure. Each increment (e, δ) returned by inc-cut increases we by at least a (1 + Ω(/ log2 n))-multiplicative factor (i.e., δ ≥ Ω(we/ log2 n)). The MWU framework shows that a single edge can increase by a (1 + Ω(/ log n)) factor at most Acknowledgements. We thank Neal Young for suggesting that Metric-TSP may be amenable to the techniques from [Chekuri and Quanrud, 2017b]. References P. K. Agarwal and J. Pan. Near-linear algorithms for geometric hitting sets and set covers. In Proc. 30th Annu. Sympos. Comput. Geom. (SoCG), page 271, 2014. Z. Allen-Zhu and L. Orecchia. Nearly-linear time positive LP solver with faster convergence rate. In Proc. 47th Annu. ACM Sympos. Theory Comput. (STOC), pages 229–236, 2015. D. Applegate, R. Bixby, V. Chvátal, and W. Cook. Implementing the dantzig-fulkerson-johnson algorithm for large traveling salesman problems. Mathematical programming, 97(1):91–153, 2003. D. L. Applegate, R. E. Bixby, V. Chvatal, and W. J. Cook. The traveling salesman problem: a computational study. Princeton University Press, 2011. S. Arora, E. Hazan, and S. Kale. The multiplicative weights update method: a meta-algorithm and applications. Theory of Computing, 8(1):121–164, 2012. S. C. Boyd and W. R. Pulleyblank. Optimizing over the subtour polytope of the travelling salesman problem. Mathematical programming, 49(1-3):163–187, 1990. C. Chekuri and K. Quanrud. Faster approximation for Metric-TSP via linear programming. Manuscript, October 2017a. C. Chekuri and K. Quanrud. Near-linear time approximation schemes for some implicit fractional packing problems. To appear in Proc. 28th ACM-SIAM Sympos. Discrete Algs. (SODA), 2017, 2017b. C. Chekuri, T. Jayram, and J. Vondrák. On multiplicative weight updates for concave and sub- modular function maximization. In Proc. 6th Conf. Innov. Theoret. Comp. Sci. (ITCS), pages 201–210, 2015. N. Christofides. Worst-case analysis of a new heuristic for the traveling salesman problem. Technical Report 388, Graduate School of Industrial Administration, Carnegie Mellon University, 1976. W. J. Cook. In pursuit of the traveling salesman: mathematics at the limits of computation. Prince- ton University Press, 2014. 26 G. B. Dantzig, D. R. Fulkerson, and S. M. Johnson. Solution of a large-scale traveling-salesman problem. Operations Research, 2(4):393–410, 1954. L. K. Fleischer. Approximating fractional multicommodity flow independent of the number of commodities. SIAM J. Discrete Math., 13(4):505–520, 2000. Preliminary version in Proc. 40th Annu. IEEE Sympos. Found. Comput. Sci. (FOCS), 1999. H. N. Gabow. A matroid approach to finding edge connectivity and packing arborescences. J. Comput. Sys. Sci., 50(2):259–273, 1995. Preliminary version in Proc. 23rd Annu. ACM Sympos. Theory Comput. (STOC), 1991. N. Garg and J. Könemann. Faster and simpler algorithms for multicommodity flow and other fractional packing problems. SIAM J. Comput., 37(2):630–652, 2007. Preliminary version in Proc. 39th Annu. IEEE Sympos. Found. Comput. Sci. (FOCS), 1998. K. Genova and D. P. Williamson. An experimental evaluation of the Best-of-Many Christofides' Algorithm for the Traveling Salesman Problem. Algorithmica, pages 1–22, 2017. Preliminary version appeared in Proceedings of ESA 2015. M. X. Goemans. Worst-case comparison of valid inequalities for the TSP. Math. Prog., 69(1-3): 335–349, 1995. M. X. Goemans and D. Bertsimas. Survivable networks, linear programming relaxations and the parsimonious property. Math. Prog., 60(1):145–166, June 1993. G. Goranci, M. Henzinger, and M. Thorup. Incremental exact min-cut in poly-logarithmic amor- tized update time. CoRR, abs/1611.06500, 2016. URL http://arxiv.org/abs/1611.06500. Preliminary version in Proceedings of ESA 2016. M. D. Grigoriadis and L. G. Khachiyan. Fast approximation schemes for convex programs with many blocks and coupling constraints. SIAM J. Optim., 4(1):86–107, 1994. G. Gutin and A. P. Punnen. The traveling salesman problem and its variations, volume 12. Springer Science & Business Media, 2006. D. Harel and R. E. Tarjan. Fast algorithms for finding nearest common ancestors. SIAM J. Comput., 13(2):338–355, 1984. M. Held and R. M. Karp. The traveling-salesman problem and minimum spanning trees. Operations Research, 18(6):1138–1162, 1970. M. R. Henzinger and V. King. Randomized fully dynamic graph algorithms with polylogarithmic time per operation. J. Assoc. Comput. Mach., 46(4):502–516, 1999. Preliminary version in Proc. 27th Annu. ACM Sympos. Theory Comput. (STOC), 1995. D. R. Karger. Random sampling and greedy sparsification for matroid optimization problems. Math. Program., 82:41–81, 1998. Preliminary version in Proc. 34th Annu. IEEE Sympos. Found. Comput. Sci. (FOCS), 1993. D. R. Karger. Minimum cuts in near-linear time. J. Assoc. Comput. Mach., 47(1):46–76, 2000. Preliminary version in Proc. 28rd Annu. ACM Sympos. Theory Comput. (STOC), 1996. R. Khandekar. Lagrangian relaxation based algorithms for convex programming problems. PhD thesis, Indian Institute of Technology Delhi, Mar. 2004. 27 C. Koufogiannakis and N. E. Young. A nearly linear-time PTAS for explicit fractional packing and covering linear programs. Algorithmica, 70(4):648–674, 2014. Preliminary version in Proc. 48th Annu. IEEE Sympos. Found. Comput. Sci. (FOCS), 2007. M. Lampis. Improved inapproximability for TSP. In Approximation, Randomization, and Combi- natorial Optimization. Algorithms and Techniques, pages 243–253. Springer, 2012. E. L. Lawler, J. K. Lenstra, A.-G. Rinnooy-Kan, and D. B. Shmoys. The traveling salesman problem. John Wiley & Sons, Ltd., 1985. C. L. Monma, B. S. Munson, and W. R. Pulleyblank. Minimum-weight two-connected spanning networks. Math. Prog., 46(1):153–171, Jan. 1990. A. Mądry. Faster approximation schemes for fractional multicommodity flow problems via dynamic graph algorithms. In Proc. 42nd Annu. ACM Sympos. Theory Comput. (STOC), pages 121–130, 2010. C. S. J. A. Nash-Williams. Edge-disjoint spanning trees of finite graphs. J. London Math. Soc., 36: 445–450, 1961. R. Peng. Approximate undirected maximum flows in o(mpolylog(n)) time. In Proc. 27th ACM- SIAM Sympos. Discrete Algs. (SODA), pages 1862–1867, 2016. S. A. Plotkin, D. B. Shmoys, and É. Tardos. Fast approximation algorithms for fractional packing and covering problems. Math. of Oper. Res., 20(2):257–301, 1995. D. Sleator and R. E. Tarjan. A data structure for dynamic trees. J. Comput. Syst. Sci., 26:362–391, 1983. R. E. Tarjan and U. Vishkin. An efficient parallel biconnectivity algorithm. SIAM J. Comput., 14 (4):862–874, 1985. M. Thorup. Fully-dynamic min-cut. Combinatorica, 27(1):91–127, 2007. Preliminary version in Proc. 33rd Annu. ACM Sympos. Theory Comput. (STOC), 2001. W. T. Tutte. On the problem of decomposing a graph into n connected components. J. London Math. Soc., 36:221–230, 1961. J. Vygen. New approximation algorithms for the TSP. OPTIMA, 90:1–12, 2012. D. Wang, S. Rao, and M. Mahoney. Unified acceleration method for packing and covering problems via diameter reduction. CoRR, abs/1508.02439, August 2015. To appear in Proc. 43rd Internat. Colloq. Automata Lang. Prog. (ICALP), 2016. N. E. Young. Nearly linear-time approximation schemes for mixed packing/covering and facility- location linear programs. CoRR, abs/1407.3015, 2014. URL http://arxiv.org/abs/1407.3015. 28 A Computing the primal solution Our MWU algorithm computes a (1−)-approximate solution to 2ECSSD. Recall that the algorithm maintains a weight w(e) for each edge e. These weights evolve with time. Using a standard argument we show how we can recover a (1 + )-approximation to the LP 2ECSS. 1 1+ OPT. iteration i is ((cid:80) Let OPT be the optimum solution value of 2ECSSD and 2ECSS. Our algorithm computes an implicit packing in the LP 2ECSSD of value (1 − ) OPT in near-linear time. It does this via the MWU method which works in several iterations. In each iteration i the algorithm computes a global mincut Ci with respects to the edge weights wi(e) where wi(e) is the weight of edge e in iteration i. Each iteration corresponds to solving a relaxation of the original LP by collapsing the constraints into a single constraint via the weights in iteration i. The value of the solution to this relaxation in e wi(e)c(e))/wi(Ci). Since this is a relaxation to the original LP, the value of this solution is at least OPT. Over the entire algorithm we have a time of one unit, and the integral of all solutions we compute is at least OPT. Let z be the averaged solution at the end of the algorithm. Via the MWU analysis z violates each constraint by at most a (1 + )-factor. Thus by scaling down z by (1 + ), we ensure feasibility of constraints and obtain a feasible solution to 2ECSSD of value at least (cid:80) We claim (and this is standard) that there is an iteration i such that the value of the solution more than OPT, a contradiction. Given an iteration i where (cid:80) e wi(e)c(e)/wi(Ci) ≤ (1 + ) OPT. If not, the value of z would be larger than (1 + ) OPT and we would, after scaling down by a factor of (1 + ), obtain a feasible solution to 2ECSSD of value e wi(e)c(e)/wi(Ci) ≤ (1 + ) OPT feasible, consider any cut Cj. The capacity of the cut is (cid:80) we can obtain a feasible solution to 2ECSS as follows. Simply set y(e) = wi(e)/wi(Ci) for each is the cheapest cut with respect to the weights wi(e). The cost of the solution y is(cid:80) e; we claim that this is a feasible solution whose cost is at most (1 + ) OPT. To see that y is (cid:80) e∈Cj ye = wi(Cj)/wi(Ci) ≥ 1 since Ci e y(e)c(e) = e wi(e)c(e)/wi(Ci) ≤ (1 + ) OPT by choice of i. to within a (1 + O()) factor as well as the sum (cid:80) The solution y can be output in nearly linear time. Our algorithm maintains the weights wi(e) implicitly via data structures. However, during iteration i we know the value of the mincut wi(Ci) (cid:80) e wi(e)c(e). In particular, we can keep track of the iteration i∗ that minimizes this ratio; this iteration i∗ will satisfy the desired condition, e wi∗(e)c(e)/wi∗(Ci∗) ≤ (1 + O()) OPT. The actual set of weights wi∗(e) needed to create the solution y(e) can be recovered by either replaying the algorithm (by storing the necessary randomization from the first run) or simply maintaining the weights by persistent data structures and keeping a pointer to the persistent copy of the weights from iteration i∗. 29
1106.6336
1
1106
2011-06-30T18:43:43
External-Memory Network Analysis Algorithms for Naturally Sparse Graphs
[ "cs.DS" ]
In this paper, we present a number of network-analysis algorithms in the external-memory model. We focus on methods for large naturally sparse graphs, that is, n-vertex graphs that have O(n) edges and are structured so that this sparsity property holds for any subgraph of such a graph. We give efficient external-memory algorithms for the following problems for such graphs: - Finding an approximate d-degeneracy ordering; - Finding a cycle of length exactly c; - Enumerating all maximal cliques. Such problems are of interest, for example, in the analysis of social networks, where they are used to study network cohesion.
cs.DS
cs
External-Memory Network Analysis Algorithms for Naturally Sparse Graphs Michael T. Goodrich and Pawe(cid:32)l Pszona Dept. of Computer Science University of California, Irvine Abstract. In this paper, we present a number of network-analysis al- gorithms in the external-memory model. We focus on methods for large naturally sparse graphs, that is, n-vertex graphs that have O(n) edges and are structured so that this sparsity property holds for any subgraph of such a graph. We give efficient external-memory algorithms for the following problems for such graphs: 1. Finding an approximate d-degeneracy ordering. 2. Finding a cycle of length exactly c. 3. Enumerating all maximal cliques. Such problems are of interest, for example, in the analysis of social networks, where they are used to study network cohesion. 1 Introduction Network analysis studies the structure of relationships between various entities, with those entities represented as vertices in a graph and their relationships represented as edges in that graph (e.g., see [11]). For example, such structural analyses include link-analysis for Web graphs, centrality and cohesion measures in social networks, and network motifs in biological networks. In this paper, we are particularly interested in network analysis algorithms for finding various kinds of small subgraphs and graph partitions in large graphs that are likely to occur in practice. Of course, this begs the question of what kinds of graphs are likely to occur in practice. 1.1 Naturally Sparse Graphs A network property addressing the concept of a "real world" graph that is gaining in prominence is the k-core number [25], which is equivalent to a graph's width [16], linkage [19], k-inductivity [18], and k-degeneracy [2,21], and is one less than its Erdos-Hajnal coloring number [14]. A k-core, G(cid:48), in a graph, G, is a maximal connected subgraph of G such that each vertex in G(cid:48) has degree at least k. The k-core number of a graph G is the maximum k such that G has a non-empty k-core. We say that a graph G is naturally sparse if its k-core number is O(1). This terminology is motivated by the fact that almost every n-vertex graph with O(n) edges has a bounded k-core number, since Pittel et al. [23] show that a random graph with n vertices and cn edges (in the Erdos-R´enyi model) has k-core number at most 2c + o(c), with high probability. Riordan [24] and Fernholz and Ramachandran [15] have also studied k-cores in random graphs. In addition, we also have the following: -- Every s-vertex subgraph of a naturally sparse graph is naturally sparse, hence, has O(s) edges. -- Any planar graph has k-core number at most 5, hence, is naturally sparse. -- Any graph with bounded arboricity is naturally sparse (e.g., see [10]). -- Eppstein and Strash [13] verify experimentally that real-world graphs in four different data repositories all have small k-core numbers relative to their sizes; hence, these real-world graphs give an empirical motivation for naturally sparse graphs. -- Any network generated by the Barab´asi-Albert [4] preferential attachment process, with m ∈ O(1), or as in Kleinberg's small-world model [20], is naturally sparse. Of course, one can artificially define an n-vertex graph, G(cid:48), with O(n) edges that is not naturally sparse just by creating a clique of O(n1/2) vertices in an n-vertex graph, G, having O(n) edges. We would argue, however, that such a graph G(cid:48) would not arise "naturally." We are interested in algorithms for large, naturally sparse graphs. 1.2 External-Memory Algorithms One well-recognized way of designing algorithms for processing large data sets is to formulate such algorithms in the external memory model (e.g., see the excellent survey by Vitter [27]). In this model, we have a single CPU with main memory capable of storing M items and that computer is connected to D external disks that are capable of storing a much larger amount of data. Initially, we assume the parallel disks are storing an input of size N . A single I/O between one of the external disks and main memory is defined as either reading a block of B consecutively stored items into memory or writing a block of the same size to a disk. Moreover, we assume that this can be done on all D disks in parallel if need be. Two fundamental primitives of the model are scanning and sorting. Scanning is the operation of streaming N items stored on D disks through main memory, with I/O complexity (cid:18) N (cid:19) DB logM/B , N B (cid:19) , scan(N ) = Θ (cid:18) N DB and sorting N items has I/O complexity sort(N ) = Θ e.g., see Vitter [27]. Since this paper concerns graphs, we assume a problem instance is a graph G = (V, E), with n = V , m = E and N = G = m + n. If G is d-degenerate, that is, has k-core number, d, then m ≤ dn and N = O(dn) = O(n) for d = O(1). We use d to denote the k-core number of an input graph, G, and we use the term "d-degenerate" as a shorthand for "k-core number equal to d." 2 1.3 Previous Related Work Several researchers have studied algorithms for graphs with bounded k-core numbers (e.g., see [1,3,12,17,18]). These methods are often based on the fact that the vertices in a graph with k-core number, d, can be ordered by repeatedly removing a vertex of degree at most d, which gives rise to a numbering of the vertices, called a d-degeneracy ordering or Erdos-Hajnal sequence, such that each vertex has at most d edges to higher-numbered vertices. In the RAM model, this greedy algorithm takes O(n) time (e.g., see [5]). Bauer et al. [6] describe methods for generating such graphs and their d-degeneracy orderings at random. In the internal-memory RAM model, Eppstein et al. [12] show how to find all maximal cliques in a d-degenerate graph in O(d3d/3n) time. Alon et al. [3] show that one can find a cycle of length exactly c, or show that one does not exist, in a d-degenerate graph in time O(d1−1/km2−1/k), if c = 4k − 2, time O(dm2−1/k), if c = 4k − 1 or 4k, and time O(d1+1/km2−1/k), if c = 4k + 1. A closely related concept to a d-degeneracy ordering is a k-core decomposition of a graph, which is a labeling of each vertex v with the largest k such that v belongs to a k-core. Such a labeling can also be produced by the simple linear-time greedy algorithm that removes a vertex of minimum degree with each iteration. Cheng et al. [9] describe recently an external-memory method for constructing a k-core decomposition, but their method is unfortunately fatally flawed1. The challenge in producing a k-core decomposition or d-degeneracy ordering in external memory is that the standard greedy method, which works so well in internal memory, can cause a large number of I/Os when implemented in external memory. Thus, new approaches are needed. 1.4 Our Results In this paper, we present efficient external-memory network analysis algorithms for naturally sparse graphs (i.e., degenerate graphs with small degeneracy). First, we give a simple algorithm for computing a (2 + )d-degeneracy ordering of a d-degenerate graph G = (V, E), without the need to know the value of d in advance. The I/O complexity of our algorithm is O(sort(dn)). Second, we give an algorithm for determining whether a d-degenerate graph G = (V, E) contains a simple cycle of a fixed length c. This algorithm uses I/O complexity, where  is a (cid:16) d1± ·(cid:0)k · sort(m2− 1 O constant depending on c ∈ {4k − 2, . . . , 4k + 1}. k ) + (4k)! · scan(m2− 1 k )(cid:1)(cid:17) Finally, we present an algorithm for listing all maximal cliques of an undi- rected d-degenerate graph G = (V, E), with O(3δ/3sort(dn)) I/O complexity, where δ = (2 + )d. One of the key insights to our second and third results is to show that, for the sake of designing efficient external-memory algorithms, using a (2 + )d- degeneracy ordering is almost as good as a d-degeneracy ordering. In addition to this insight, there are a number of technical details that lead to our results, which we outline in the remainder of this manuscript. 1 We contacted the authors and they confirmed that their method is indeed incorrect. 3 2 Approximating a d-Degeneracy Ordering Our method for constructing a (2 + )d-degeneracy ordering for a d-degenerate graph, G = (V, E), is quite simple and is given below as Algorithm 1. Note that our algorithm does not take into account the value of d, but it assumes we are given a constant  > 0 as part of the input. Also, note that this algorithm destroys G in the process. If one desires to maintain G for other purposes, then one should first create a backup copy of G. 1: L ← ∅ 2: while G is nonempty do 3: 4: 5: 6: end while 7: return L S ← n/(2 + ) vertices of smallest degree in G L ← LS remove S from G // append S to the end of L Algorithm 1: Approximate degeneracy ordering of vertices Lemma 1. If G is a d-degenerate graph, then Algorithm 1 computes a (2 + )d- degeneracy ordering of G. Proof. Observe that any d-degenerate graph with n vertices has at most 2n/c vertices of degree at least cd. Thus, G has at most 2n/(2 + ) vertices of degree at least (2 + )d. This means that the n/(2 + ) vertices of smallest degree in G each have degree at most (2 + )d. Therefore, every element of set S created in line 3 has at most (2+)d neighbors in (the remaining graph) G. When we add S to L in line 4, we keep the property that every element of L has at most (2 + )d neighbors in G that are placed behind it in L. Furthermore, note that, after we remove vertices in S (and their incident edges) from G in line 5, G is still at most d-degenerate (every subgraph of a d-degenerate graph is at most d-degenerate); (cid:117)(cid:116) hence, an inductive argument applies to the remainder of the algorithm. Note that, after (cid:100)log(2+)/2(dn)(cid:101) = O(lg n) iterations, we must have processed all of G and placed all its vertices on L, which is a (2 + )d-degeneracy ordering for G and that this property holds even though the algorithm does not take the value of d into account. The following lemma is proved in the Appendix. Lemma 2. An iteration of the while loop (lines 3-5) of Algorithm 1 can be implemented in O(sort(dn)) I/O's in the external-memory model, where n is the number of vertices in G at the beginning of the iteration. Thus, we have the following. Theorem 1. We can compute a (2 + )d-degeneracy ordering of a d-degenerate graph, G, in O(sort(dn)) I/O's in the external-memory model, without knowing the value of d in advance. 4 Proof. Since the number of vertices of G decreases by a factor of 2/(2+) in each iteration, and each iteration uses O(sort(dn)) I/O's, where n is the number of vertices in G at the beginning of the iteration (by Lemma 2), the total number of I/O's, I(G), is bounded by (cid:18) (cid:16)(cid:0)2/(2 + )(cid:1)dn (cid:17) (cid:17)2 (cid:16) 2 2 + 2 +  2 +  (cid:16)(cid:0)2/(2 + )(cid:1)2 (cid:19)(cid:19) (cid:17) + ···(cid:17) dn + sort + ··· (cid:16) (cid:18) I(G) = O sort(dn) + sort = O sort(dn) 1 + = O(sort(dn)). (cid:117)(cid:116) This theorem hints at the possibility of effectively using a (2+)d-degeneracy ordering in place of a d-degeneracy ordering in external-memory algorithms for naturally sparse graphs. As we show in the remainder of this paper, achieving this goal is indeed possible, albeit with some additional alterations from previous internal-memory algorithms. 3 Short Paths and Cycles In this section, we present external-memory algorithms for finding short cycles in directed or undirected graphs. Our approach is an external-memory adaptation of internal-memory algorithms by Alon et al. [3]. We begin with the definition and an example of a representative due to Monien [22]. A p-set is a set of size p. Definition 1 (representative). Let F be a collection of p-sets. A sub-collection (cid:98)F ⊆ F is a q-representative for F, if for every q-set B, there exists a set A ∈ F such that A ∩ B = ∅ if and only if there exists a set (cid:98)A ∈ (cid:98)F with this property. Every collection of p-sets F has a q-representative (cid:98)F of size at most (cid:0)p+q (cid:1) Monien [22] gives a construction of representatives of size at most O((cid:80)q (from Bollob´as [7]). An optimal representative, however, seems difficult to find. i=1 pi). It uses a p-ary tree of height ≤ q with the following properties. -- Each node is labeled with either a set A ∈ F or a special symbol λ. -- If a node is labeled with a set A and its depth is less than q, it has exactly p children, edges to which are labeled with elements from A (one element per edge, every element of A is used to label exactly one edge). p -- If a node is labeled with λ or has depth q, it has no children. -- Let E(v) denote the set of all edge labels on the way from the vertex v to the root of the tree. Then, for every v: -- if v is labeled with A, then A ∩ E(v) = ∅ -- if v is labeled with λ, then there are no A ∈ F s.t. A ∩ E(v) = ∅. Monien shows that if a tree T fulfills the above conditions, defining (cid:98)F to be {4, 7},{4, 8}}. Fig. 1 presents (cid:98)F, a 3-representative of F in the tree form. the set of all labels of the tree's nodes yields a q-representative for F. As an exam- ple, consider a collection of 2-sets, F = {{2, 4},{1, 5},{1, 6},{1, 7},{3, 6},{3, 8}, 5 {1, 6} 1 6 {3, 8} 8 3 {4, 7} 4 7 {2, 4} {4, 8} {1, 7} {1, 5} 4 {3, 6} 2 {4, 7} 8 {2, 4} 4 λ 7 {1, 5} 1 {3, 8} 1 {2, 4} 5 {3, 8} Fig. 1. Tree representation of (cid:98)F The main benefit of using representatives in the tree form stems from the fact that their sizes are bounded by a function of only p and q (i.e., maximum size of a representative does not depend on F). It gives a way of storing paths of given length between two vertices of a graph in a space-efficient way (see Appendix for details). The algorithm for finding a cycle of given length has two stages. In the first stage, vertices of high degree are processed to determine if any of them belongs to a cycle. This is realized using algorithm cycleThrough from Lemma 5. Since there are not many vertices of high degree, this can be realized efficiently. In the second stage, we remove vertices of high degree from the graph. Then, we group all simple paths that are half the cycle length long by their endpoints and compute representatives for every such set (see Lemma 3). For each pair of vertices (u, v), we determine (using findDisjoint from Lemma 4) if there are two paths: p from u to v and p(cid:48) from v to u, such that p and p(cid:48) do not share any internal vertices. If this is the case, C = p ∪ p(cid:48) is a cycle of required length. The following representatives-related lemmas are proved in the Appendix. Lemma 3. We can compute a q-representative (cid:98)F for a collection of p-sets F, of size (cid:98)F ≤(cid:80)q i=1 pi, in O (cid:16)(cid:0)(cid:80)q+1 i=1 pi(cid:1) · scan(cid:0)F(cid:1)(cid:17) (cid:16)(cid:0)(cid:80)q+3 i=1 pi +(cid:80)p+3 I/O's. Lemma 4. For a collection of p-sets, F, and a collection of q-sets, G, there is an external-memory method, findDisjoint(F,G), that returns a pair of sets (A, B) (A ∈ F, B ∈ G) s.t. A ∩ B = ∅ or returns  if there are no such pairs of sets. findDisjoint uses O i=1 qi(cid:1) · scan(cid:0)F + G(cid:1)(cid:17) I/O's. Lemma 5. Let G = (V, E). A cycle of length exactly k that passes through arbitrary v ∈ V , if it exists, can be found by an external-memory algorithm cycleThrough(G, k, v) in O(cid:0)(k − 1)! · scan(m)(cid:1) I/O's, where m = E, via the use of representatives. 6 Before we present our result for naturally sparse graphs, we first give an external-memory method for general graphs. c ∈ {2k − 1, 2k}, and finds such cycle if it exists, that takes O(cid:0)k · sort(m2− 1 Theorem 2. Let G = (V, E) be a directed or an undirected graph. There is an external-memory algorithm that decides if G contains a cycle of length exactly k ) + (2k − 1)! · scan(m2− 1 k )(cid:1) I/O's. Proof. Algorithm 2 handles the case of general graphs (which are not necessarily naturally sparse), and cycles of length c = 2k (the case of c = 2k−1 is analogous). 1 k C ← cycleThrough(G, 2k, v) if C (cid:54)=  then return C 1: ∆ ← m 2: for all v -- vertex of degree ≥ ∆ do 3: 4: 5: 6: end if 7: end for 8: remove vertices of degree ≥ ∆ from G 9: generate all directed paths of length k in G 10: sort the paths lexicographically, according to their endpoints 11: group all paths u (cid:32) v into collection of (k − 1)-sets Fuv 12: for all pairs (Fuv,Fvu) do 13: 14: 15: 16: end if 17: end for 18: return  P ← findDisjoint(Fuv,Fvu) if P = (A, B) then return C = A ∪ B Algorithm 2: Short cycles in general graphs scan(m2− 1 k vertices of degree at least ∆, and each k )(cid:1) I/O's. Since there are at most m/∆ = m1− 1 call to cycleThrough requires O(cid:0)(2k − 1)! · scan(m)(cid:1) I/O's (by Lemma 5), the first for loop (lines 2-7) takes O(cid:0)m1− 1 k · (2k − 1)! · scan(m)(cid:1) = O(cid:0)(2k − 1)! · Algorithm 1, in O(cid:0)sort(m)(cid:1) I/O's. There are at most m∆k−1 = m2− 1 be generated in line 9. It can be done in O(cid:0)k·sort(m2− 1 k )(cid:1) I/O's (see Appendix). Sorting the paths (line 10) takes O(cid:0)sort(m2− 1 k )(cid:1) I/O's. After that, creating Fuv's (line 11) requires O(cid:0)scan(m2− 1 k )(cid:1) I/O's. Removing vertices of high degree in line 8 is realized just like line 5 of k paths to The groupF procedure groups Fuv and Fvu together. Assume we store Fuv's as tuples (u, v, S), for S ∈ Fuv, in a list F . By u ≺ v we denote that u precedes v in an arbitrary ordering of V . For u ≺ v, tuples (u, v, 1, S) from line 3 mean that S ∈ Fuv, while tuples (u, v, 2, S) from line 5 mean that S ∈ Fvu. The for 7 loop (lines 1-7) clearly takes O(cid:0)scan(m2− 1 O(cid:0)sort(m2− 1 from Fvu, allowing us to execute line 9 in O(cid:0)scan(m2− 1 k )(cid:1) I/O's. After sorting F (line 8) in k )(cid:1) I/O's, tuples for sets from Fuv directly precede those for sets k )(cid:1) I/O's. else if u ≺ v then write (u, v, 1, S) back to F proc groupF 1: for all (u, v, S) in F do 2: 3: 4: 5: end if 6: 7: end for 8: sort F lexicographically 9: scan F to determine pairs (Fuv,Fuv) write (v, u, 2, S) back to F O u,v Based on Lemma 4, the total number of I/O's in calls to findDisjoint in Algorithm 2, line 13 is (cid:16)(cid:80) i=1 (k − 1)i · scan(Fuv + Fvu)(cid:1)(cid:17) (cid:0)(cid:80)k+2 (cid:16)(cid:0)(cid:80)k+2 u,v scan(cid:0)Fuv + Fvu(cid:1)(cid:17) i=1 (k − 1)i(cid:1) ·(cid:80) k )(cid:1) = O(cid:0)(2k − 1)! · scan(m2− 1 i=1 (k − 1)i = O(cid:0)(k − 1)k+3(cid:1) = O(cid:0)(2k − 1)!(cid:1). as we set p = q = k − 1 and(cid:80)k+2 Putting it all together, we get that Algorithm 2 runs in O(cid:0)sort(m2− 1 k )(cid:1) total I/O's. (2k − 1)! · scan(m2− 1 k ) + (cid:117)(cid:116) = O Theorem 3. Let G = (V, E) be a directed or an undirected graph. There is an external-memory algorithm that, given L -- a δ-degeneracy ordering of G (for δ = (2 + )d), finds a cycle of length exactly c, or concludes that it does not exist: k ) + (4k)! · scan(m2− 1 k ) + (4k)! · scan(m2− 1 I/O's if c = 4k − 2 I/O's if c = 4k − 1 or k ) + (4k)! · scan(m2− 1 I/O's if c = 4k + 1 δ1− 1 (cid:16) k ·(cid:0)k · sort(m2− 1 (cid:16) δ ·(cid:0)k · sort(m2− 1 (cid:16) k ·(cid:0)k · sort(m2− 1 δ1+ 1 (i) in O (ii) in O c = 4k (iii) in O k )(cid:1)(cid:17) k )(cid:1)(cid:17) k )(cid:1)(cid:17) Proof. We describe the algorithm for the case of directed G, with c = 4k + 1, as other cases are similar (and a little easier). We assume that δ < m 2k+1 , which is obviously the case for naturally sparse graphs. Otherwise, running Algorithm 2 on G achieves the advertised complexity. 1 Algorithm 3 is remarkably similar to Algorithm 2 and so is its analysis. Differences lie in the value of ∆ and in line 9, when only some paths of length 2k and 2k + 1 are generated. As explained in [3], it suffices to only consider 8 1 k k /δ1+ 1 1: ∆ ← m 2: for all v -- vertex of degree ≥ ∆ do C ← cycleThrough(G, 4k + 1, v) 3: if C (cid:54)=  then 4: 5: return C end if 6: 7: end for 8: remove vertices of degree ≥ ∆ from G 9: generate directed paths of length 2k and 2k + 1 in G 10: sort the paths lexicographically, according to their endpoints 11: group all paths u (cid:32) v of length 2k into collection of (2k − 1)-sets Fuv 12: group all paths u (cid:32) v of length 2k + 1 into collection of (2k)-sets Guv 13: for all pairs (Fuv,Guv) do 14: 15: 16: 17: end if 18: end for 19: return  P ← findDisjoint(Fuv,Gvu) if P = (A, B) then return C = A ∪ B Algorithm 3: Short cycles in degenerate graphs all (2k + 1)-paths that start with two backward-oriented (in L) edges and all 2k-paths that start with a backward-oriented (in L) edge. The number of these paths is O(m2− 1 k ). Since we can generate them in O I/O's (see Appendix), and there are at most O(m1− 1 degree ≥ ∆, the theorem follows. k ) vertices in G of (cid:117)(cid:116) k · sort(m2− 1 k ) k δ1+ 1 k δ1+ 1 (cid:17) (cid:16) kδ1+ 1 4 All Maximal Cliques The Bron-Kerbosch algorithm [8] is often the choice when one needs to list all maximal cliques of an undirected graph G = (V, E). It was initially improved by Tomita et al. [26]. We present this improvement as the BronKerboschPivot procedure (Γ (v) denotes the set of neighbors of vertex v). output R //maximal clique proc BronKerboschPivot(P , R, X) 1: if P ∪ X = ∅ then 2: 3: end if 4: u ← vertex from P ∪ X that maximizes P ∩ Γ (u) 5: for all v ∈ P \ Γ (v) do BronKerboschPivot(P ∩ Γ (v), R ∪ {v}, X ∩ Γ (v)) 6: P ← P \ {v} 7: 8: X ← X ∪ {v} 9: end for 9 The meaning of the arguments to BronKerboschPivot: R is a (possibly non- maximal) clique, P and X are a division of the set of vertices that are neighbors of all vertices in R, s.t. vertices in P are to be considered for adding to R while vertices in X are restricted from the inclusion. Whereas Tomita et al. run the algorithm as BronKerboschPivot(V ,∅,∅), Eppstein et al. [12] improved it even further for the case of a d-degenerate G by utilizing its d-degeneracy ordering L = {v1, v2, . . . , vn} and by performing n independent calls to BronKerboschPivot. Algorithm 4 presents their version. It runs in time O(dn3d/3) in the RAM model. 1: for i ← 1 . . . n do P ← Γ (vi) ∩ {vj : j > i} 2: 3: X ← Γ (vi) ∩ {vj : j < i} BronKerboschPivot(P ,{vi},X) 4: 5: end for Algorithm 4: Maximal cliques in degenerate graph The idea behind Algorithm 4 is to limit the depth of recursive calls to P ≤ d and then apply the analysis of Tomita et al. [26]. We show how to efficiently implement Algorithm 4 in the external memory model using a (2 + )d-degeneracy ordering of G. Following [12], we define subgraphs HP,X of G. Definition 2 (Graphs HP,X ). Subgraph HP,X = (VP,X , EP,X ) of G = (V, E) is defined as follows: VP,X = P ∪ X EP,X = {(u, v) : (u, v) ∈ E ∧ (u ∈ P ∨ v ∈ P )} That is, HP,X contains all edges in G whose endpoints are from P ∪ X, and at least one of them lies in P . To ensure efficiency, HP,X is passed as an additional argument to every call to BronKerboschPivot with P and X. It is used in determining u at line 4 of BronKerboschPivot (we simply choose a vertex of highest degree in HP,X ). The following two lemmas regarding construction of HP,X 's are proved in the Appendix. Lemma 6. Given a δ-degeneracy ordering L of an undirected d-degenerate graph G (δ = (2 + )d), all initial sets P , X, and graphs HP,X that are passed to BronKerboschPivot in line 4 of Algorithm 4 can be generated in O(sort(δ2n)) I/O's. Lemma 7. Given a δ-degeneracy ordering L of an undirected d-degenerate graph G (δ = (2 + )d), in a call to BronKerboschPivot that was given HP,X , with P = p and X = x, all graphs HP∩Γ (v),X∩Γ (v) that have to be passed to recursive calls in line 6, can be formed in O(sort(δp2(p + x))) I/O's. 10 Theorem 4. Given a δ-degeneracy ordering L of an undirected d-degenerate graph G (δ = (2 + )d), we can list all its maximal cliques in O(3δ/3sort(δn)) I/O's. Proof. Consider a call to BronKerboschPivot(Pv, {v}, Xv), with Pv = p and Xv = x. Define (cid:98)D(p, x) to be the maximum number of I/O's in this call. Based on Lemma 7, (cid:98)D(p, x) satisfies the following recurrence relation: (cid:98)D(p, x) ≤ (cid:40) (cid:26) maxk{k(cid:98)D(p − k, x)} + O(cid:0)sort(δp2(p + x))(cid:1) maxk{k(cid:98)D(p − k, x)} + c · δp2(p+x) for constant e greater than zero, which can be rewritten as (cid:98)D(p, x) ≤ if p > 0 if p = 0 logM/B(δ3n) = O(logM/B n) for δ = O(1). Thus, the relation for (cid:98)D(p, x): for a constant c > 0. Since p ≤ δ and p+x ≤ n, we have logM/B(δp2(p+x)) ≤ (cid:98)D(p, x) ≤ maxk{k(cid:98)D(p − k, x)} + δp2(p + x) · c(cid:48) logM/B n logM/B(δp2(p + x)) (cid:40) if p > 0 if p = 0 DB DB e e if p > 0 if p = 0 e where c(cid:48) and e are constants greater than zero. Note that this is the relation for and c2 = e). Since D(p, x) of Eppstein et. al [12] (we set d = δ, c1 = the solution for D(p, x) was D(p, x) = O((d + x)3p/3), the solution for (cid:98)D(p, x) is c(cid:48) logM/B n DB (cid:17) (cid:98)D(p, x) = O (cid:16) (δ + x)3p/3 · c(cid:48) logM/B n DB = O 3p/3 logM/B n (cid:17) (cid:16) δ+x DB (cid:16) δ+Xv The total size of all sets Xv passed to initial calls to BronKerboschPivot is O(δn), and every set P has at most δ vertices. It follows that the total number of I/O's in recursive calls is (cid:88) = O(cid:0)3δ/3sort(δn)(cid:1) Algorithm 4 takes O(cid:0)sort(δ2n) + 3δ/3sort(δn)(cid:1) = O(cid:0)3δ/3sort(δn)(cid:1) I/O's. Combining this with Lemma 6, we get that our external memory version of (cid:117)(cid:116) 3δ/3 logM/B n logM/B n 3δ/3 δn (cid:17) (cid:16) (cid:17) = O DB DB O v References 1. N. Alon and S. Gutner. Linear time algorithms for finding a dominating set of fixed size in degenerated graphs. Algorithmica, 54(4):544 -- 556, 2009. 2. N. Alon, J. Kahn, and P. D. Seymour. Large induced degenerate subgraphs. Graphs and Combinatorics, 3:203 -- 211, 1987. 3. N. Alon, R. Yuster, and U. Zwick. Finding and counting given length cycles. Algorithmica, 17(3):209 -- 223, 1997. 11 4. A.-L. Barab´asi and R. Albert. Emergence of scaling in random networks. Science, 286(5439):509 -- 512, 1999. 5. V. Batagelj and M. Zaversnik. An O(m) algorithm for cores decomposition of networks, 2003. http://arxiv.org/abs/cs.DS/0310049. 6. R. Bauer, M. Krug, and D. Wagner. Enumerating and generating labeled k- degenerate graphs. In 7th Workshop on Analytic Algorithmics and Combinatorics (ANALCO), pages 90 -- 98. SIAM, 2010. 7. B. Bollob´as. On generalized graphs. Acta Mathematica Hungarica, 16:447 -- 452, 1965. 10.1007/BF01904851. 8. C. Bron and J. Kerbosch. Algorithm 457: finding all cliques of an undirected graph. Commun. ACM, 16(9):575 -- 577, 1973. 9. J. Cheng, Y. Ke, S. Chu, and T. Ozsu. Efficient core decomposition in massive networks. In IEEE Int. Conf. on Data Engineering (ICDE), 2011. 10. M. Chrobak and D. Eppstein. Planar orientations with low out-degree and compaction of adjacency matrices. Theor. Comput. Sci., 86(2):243 -- 266, 1991. 11. P. Doreian and K. L. Woodard. Defining and locating cores and boundaries of social networks. Social Networks, 16(4):267 -- 293, 1994. 12. D. Eppstein, M. Loffler, and D. Strash. Listing all maximal cliques in sparse graphs in near-optimal time. In O. Cheong, K.-Y. Chwa, and K. Park, editors, ISAAC 2010, volume 6506 of LNCS, pages 403 -- 414. Springer-Verlag, 2010. 13. D. Eppstein and D. Strash. Listing all maximal cliques in large sparse real-world graphs. arXiv eprint, 1103.0318, 2011. 14. P. Erdos and A. Hajnal. On chromatic number of graphs and set-systems. Acta Mathematica Hungarica, 17(1 -- 2):61 -- 99, 1966. 15. D. Fernholz and V. Ramachandran. The giant k-core of a random graph with a specified degree sequence. manuscript, 2003. 16. E. C. Freuder. A sufficient condition for backtrack-free search. J. ACM, 29:24 -- 32, January 1982. 17. P. A. Golovach and Y. Villanger. Parameterized complexity for domination problems on degenerate graphs. Proc. 34th Int. Worksh. Graph-Theoretic Concepts in Computer Science (WG 2008), 5344:195 -- 205, 2008. 18. S. Irani. Coloring inductive graphs on-line. Algorithmica, 11:53 -- 72, 1994. 19. L. M. Kirousis and D. M. Thilikos. The linkage of a graph. SIAM Journal on Computing, 25(3):626 -- 647, 1996. 20. J. Kleinberg. The small-world phenomenon: an algorithm perspective. In 32nd ACM Symp. on Theory of Computing (STOC), pages 163 -- 170, 2000. 21. D. R. Lick and A. T. White. k-degenerate graphs. Canadian Journal of Mathe- matics, 22:1082 -- 1096, 1970. 22. B. Monien. How to find long paths efficiently. Annals of Discrete Mathematics, 25:239 -- 254, 1985. 23. 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(1):111 -- 151, 1996. 24. O. Riordan. The k-core and branching processes. Probability And Computing, 17:111, 2008. 25. S. B. Seidman. Network structure and minimum degree. Social Networks, 5(3):269 -- 287, 1983. 26. E. Tomita, A. Tanaka, and H. Takahashi. The worst-case time complexity for generating all maximal cliques and computational experiments. Theor. Comput. Sci., 363(1):28 -- 42, 2006. 27. J. S. Vitter. External memory algorithms and data structures: dealing with massive data. ACM Comput. Surv., 33:209 -- 271, June 2001. 12 A Appendix A.1 Proof of Lemma 2 The input is a d-degenerate graph G = (V, E). Let V = (1, . . . , n). We store E as set of edges (u, v). We assume an order on V that we utilize during sorting. Finding vertices of smallest degree (Algorithm 1, line 3) is realized by the smallVertices procedure. d(v) ← degree of v store pair (d(v), v) in F proc smallVertices 1: for all v -- vertex of G do 2: 3: 4: end for 5: sort F lexicographically 6: S ← first n/(2 + ) vertices in F // of smallest degree Computing degrees of vertices in the for loop (lines 1-4) is easily realized in O(sort(dn)) I/O's. First, E is sorted lexicographically in O(sort(dn)) I/O's. After that, edges of E form blocks ordered by their starting vertex, so a simple scan taking O(scan(dn)) I/O's is enough to determine degrees of the vertices. Sorting F (line 5) is done in O(sort(n)) I/O's. After that, S is just n/(2 + ) first items of F and its construction (line 6) takes O(scan(n/(2 + ))) I/O's. Likewise, appending S to L (Algorithm 1, line 4) takes O(scan(n/(2 + ))) I/O's. Finally, removing edges adjacent to S from G (Algorithm 1, line 5) is realized as follows. add tuples (u, v, "-") and (v, u, "-") to E if u ∈ S then 1: sort E lexicographically 2: for all (u, v) -- edge in E do 3: 4: end if 5: 6: end for 7: sort E lexicographically 8: for all p, q -- consecutive tuples in E do 9: 10: 11: 12: 13: 14: end if 15: 16: end for if p = (u, v) and q = (u, v, "-") then do not write p back to E else //p = (u, v, "-") do not write p back to E else if p = (u, v) then write p back to E 13 Sorting E in line 1 takes O(sort(dn)) I/O's. The first for loop (lines 2-6) takes O(scan(dn)) I/O's (vertices in S are stored according to the order on V , in the same relative order as the origins of edges in E, so it is realized by a single synchronized scan going through E and S at the same time). Each edge in E causes at most 2 tuples to be added to E in line 4, so clearly the size of E is O(dn) after line 6. Sorting E (line 7) obviously takes time O(sort(dn)). The last for loop (lines 8-16) is easily realized by a single scan of E, in O(scan(dn)) I/O's. Correctness follows from two facts. First, for each edge (u, v), if u ∈ S, the tuple (u, v, "-") (meaning that (u, v) does not belong to G after this iteration) is added to E in line 4. Second, if (u, v, "-") is in E, its direct predecessor is (u, v) (or another copy of (u, v, "-")) after E was sorted lexicographically in line 7. Therefore, the edges that are no longer in G are rejected in line 10. Also, no tuples (u, v, "-") are further stored in E (line 14). Altogether, lines 3-5 of Algorithm 1 are implemented in O(sort(dn)) I/O's.(cid:117)(cid:116) A.2 Representatives Monien [22] gave a simple algorithm (which we call repQuery) that operates on representatives in the tree form described in Sec. 3. Given (cid:98)F -- a representative for F, repQuery((cid:98)F , B) decides for a q-set B whether there exists a set A ∈ F s.t. A ∩ B = ∅, and returns such A if it exists. The running time of repQuery is O(pq) in the RAM model. We use repQuery in our algorithms "as is", i.e., we allow it to take O(pq) I/O's. i=1 pi (number of nodes in a p-ary tree of height q). We can afford to build the tree one Proof of Lemma 3 The size of the resulting tree is is bounded by (cid:80)q node at a time, spending O(cid:0)scan(pF)(cid:1) I/O's on each node. Procedure repLabel labels vertex v in the representative tree for F in O(cid:0)scan(pF)(cid:1) I/O's. 1: (cid:98)A ← set A in F s.t. A ∩ E(v) = ∅ 2: if (cid:98)A (cid:54)=  then label v with (cid:98)A label edges from v to its children with elements from (cid:98)A proc repLabel(F , v) create children of v 3: 4: 5: 6: else 7: 8: end if label v with λ Set (cid:98)A in line 1 can simply be found by scanning F in O(cid:0)scan(pF)(cid:1) I/O's (pF is the total size of all p-sets in F). Creating children of v (line 4) and labeling their edges (line 5) takes O(p) I/O's. 14 O = O Proof of Lemma 4 The proof is essentially the same as that of Lemma 3.2 Therefore, we compute a q-representative for F in O i=1 pi+1(cid:1) · scan(cid:0)F(cid:1)(cid:17) (cid:16)(cid:0)(cid:80)q (cid:16)(cid:0)(cid:80)q i=1 pi(cid:1)·scan(cid:0)pF(cid:1)(cid:17) i=1 pi(cid:1) · scan(cid:0)F(cid:1)(cid:17) (cid:16)(cid:0)(cid:80)q+1 (cid:16)(cid:0)(cid:80)q+1 (cid:1) · scan(cid:0)F(cid:1)(cid:17) in [3]: first we compute a q-representative (cid:98)F of F, in O (cid:1) · scan(cid:0)G(cid:1)(cid:17) (cid:16)(cid:0)(cid:80)p+1 I/O's, and a p-representative (cid:98)G of G, in O The sizes of (cid:98)F and (cid:98)G are bounded by (cid:80)q i=1 pi and (cid:80)p Assuming p ≥ q (w.l.o.g.), determining whether (cid:98)F and (cid:98)G contain two disjoint i=1 pi(cid:1) i=1 pi+2(cid:1) = O(cid:0)(cid:80)q+3 i=1 pi · pq(cid:1) = O(cid:0)(cid:80)q+1 sets can be easily done in O(cid:0)(cid:80)q+1 I/O's, by querying (cid:98)G (via repQuery) with all sets from (cid:98)F. i=1 qi, respectively. I/O's. i=1 I/O's. i=1 = (cid:117)(cid:116) (cid:117)(cid:116) Proof of Lemma 5 The (very) big picture of the cycleThrough(G, k, v) algorithm is as follows: if there exists simple path p: u (cid:32) v of length exactly k − 1 then proc cycleThrough(G, k, v) 1: for all u s.t. (v, u) ∈ E do 2: 3: end if 4: 5: end for 6: return  return p ∪ (v, u) Let P p Obviously, main difficulty lies in checking the condition in line 2. To show how we answer that query, let us first explain how [22] handles the paths. uv denote the set of all simple paths from u to v of length exactly (p + 1) (so that these paths have p inner vertices). First, all paths from u to v of length (p + 1) that have the exact same set of inner vertices are represented as a single set containing these vertices (the vertices are stored as one of the paths; it provides a representative of the set). Performing this compression on P p uv yields F p uv -- a family of p-sets: F p uv = {S : S is a set of inner vertices on some path from u to v of length p + 1} The condition from line 2 of cycleThrough is therefore equivalent to F k−2 uv being nonempty. We will now focus on how to test if this is the case. uv (for all u ∈ V ) The clou of [22] was that having q-representatives for F p (for all u ∈ V ). enables efficient computation of (q − 1)-representatives for F p+1 The labels for a (q− 1)-representative tree for F p+1 uv are computed node by node. The algorithm is based on the following observation (γ is the node whose label uv 15 we compute, E(γ) is the set of edge labels on the way from γ to root): ∃U ∈ F p+1 uv s.t. U ∩ E(γ) = ∅ ⇐⇒ ∃(cid:98)U ∈ F p ∃w ∈ V \ {u, v} s.t. (u, w) ∈ E ∧ w /∈ E(γ) ∧ wv s.t. (cid:98)U ∩ (E(γ) ∪ {u}) = ∅ wv allows us to find (cid:98)U (or determine that it does Having a q-representative for F p not exist) via the repQuery algorithm. Determining the label for γ is therefore realized as follows: wv, E(γ) ∪ {u}) (cid:98)U ← repQuery(F p if (cid:98)U (cid:54)=  then label γ with (cid:98)U ∪ {w} 1: for all w s.t. (u, w) ∈ E and w /∈ E(γ) do 2: 3: 4: 5: end if 6: 7: end for 8: label γ with λ return = O repQuery (querying a representative tree) takes O(pq) I/O's, so our imple- mentation of labeling γ takes O(cid:0)pq · scan(cid:0)Γ (u)(cid:1)(cid:1) I/O's (where Γ (u) denotes size bounded by (cid:80)q−1 the number of neighbors of u in G). It simply scans neighbors of u and calls repQuery accordingly. Because the (q − 1)-representative tree for F p+1 (cid:16) q(p + 1)q−1 ·(cid:0)pq · scan(cid:0)Γ (u)(cid:1)(cid:1)(cid:17) (cid:16) q2(p + 1)q · scan(cid:0)Γ (u)(cid:1)(cid:17) has i=1 (p + 1)i ≤ q(p + 1)q+1, labeling all its nodes requires I/O's. We are (cid:16) 1)q·scan(cid:0)Γ (u)(cid:1)(cid:1)(cid:17) u scan(cid:0)Γ (u)(cid:1)(cid:17) q2(p+1)q·(cid:80) Our goal is to compute 0-representatives (cid:98)F k−2 by calling repQuery((cid:98)F k−2 (cid:0)q2(p+ = O(cid:0)q2(p+1)q·scan(m)(cid:1) O computing (q−1)-representatives for F p+1 either returns  (if F k−2 u to v of length k − 1. uv's. They are built as trees having only the root vertex, labeled with either ∅ (if (u, v) ∈ E), or λ (otherwise). They can be obviously constructed in O(scan(m)) I/O's, via scanning E. Based on We start with (k−2)-representatives for F 0 (for all u ∈ V ). Then, is nonempty, as it uv , representing a path from uv , ∅), we determine whether F k−2 is empty), or a set A ∈ F k−2 uv 's for all u's, so it takes O the discussion above, computing (cid:98)F k−2 (cid:16)(cid:80) for F k−2 uv I/O's in total. uv u = O uv uv uv uv 's (for all u ∈ V ) takes p=0(k − 2 − p)(p + 1)k−2−p · scan(m)(cid:1) O(cid:0)(cid:80)k−3 p=0(p + 1)k−2−p(cid:1) = O(cid:0)(k − 2) · scan(m) ·(cid:80)k−3 = O(cid:0)(k − 2) · scan(m) · (k − 2)!(cid:1) = O(cid:0)(k − 1)! · scan(m)(cid:1) 16 I/O's, as it can be easily shown by induction that(cid:80)k−3 for k ≥ 6. p=0(p + 1)k−2−p ≤ (k − 2)! A.3 Path Generation General Graphs (Algorithm 2) Recall that for Algorithm 2 we need to generate all directed paths of length k in a graph G = (V, E), where maxi- mum degree of each vertex is bounded by ∆. As shown in [3], there are at most O(m∆k−1) = O(m2− 1 k ) such paths. They are generated by the pathGen procedure. generate sequences es, for all e ∈ E proc pathGen 1: generate all sequences of length k − 1, with elements from {1, . . . , ∆} 2: for all s -- sequence ∈ {1, . . . , ∆}k−1 do 3: 4: end for 5: for all s -- sequence ∈ E × {1, . . . , ∆}k−1 do 6: 7: 8: 9: 10: end if 11: 12: end for decode s into s(cid:48) ∈ Ek if s(cid:48) (cid:54)=  then output s(cid:48) if s(cid:48) is a simple path then end if k )(cid:1) I/O's. k )(cid:1) I/O's. Adding Line 1 is simply realized in O(cid:0)scan(∆k−1)(cid:1) = O(cid:0)scan(m1− 1 O(cid:0)m · scan(∆k−1)(cid:1) = O(cid:0)scan(m2− 1 an edge at the beginning of each sequence in the first for loop (lines 2-4) takes Decoding a sequence s ∈ E × {1, . . . , ∆}k−1 into a path s(cid:48) ∈ Ek (pathGen, line 6) is conceptually straightforward. e is the first edge in the path. Then, each consecutive number i determines next vertex on the path -- ith neighbor of the previously decoded one (if it has less than i neighbors, the path is dropped as invalid). The decodePaths procedure handles decoding of S -- the set of sequences. s[i] is the ith element of tuple s, s[i].from is the origin, and s[i].to is the destination vertex of edge at s[i]. decodes the next vertex of s and again cyclically shifts s by one position. Sorting The first for loop (lines 1-3) decodes the starting edge of the sequence s into two vertices, and then cyclically shifts the resulting tuple by one position. It k )(cid:1) I/O's. Each iteration of the second for loop (lines 4-12) takes O(cid:0)scan(m2− 1 k )(cid:1) I/O's. After that, the inner loop (lines 6-11) S in line 5 takes O(cid:0)sort(m2− 1 k )(cid:1) I/O's (it takes one synchronized scan of S and requires only O(cid:0)scan(m2− 1 outer for loop runs for k − 1 iterations, decodePaths uses O(cid:0)k · sort(m2− 1 k )(cid:1) E). Invalid paths that do not meet the condition at line 8 are dropped. Since the I/O's. 17 write tuple (s[1].to, s[2], s[3], . . . , s[k], s[1].from) to S // S contains tuples V × {1, . . . , ∆}k−i × V i proc decodePaths(S) 1: for all s -- sequence ∈ E × {1, . . . , ∆}k−1 do 2: 3: end for 4: for all i ← 1, . . . , k − 1 do sort S lexicographically 5: for all s -- tuple in S do 6: 7: 8: 9: 10: 11: 12: end for u ← s[2]th neighbor of s[1] in V if u (cid:54)=  then end if end for write tuple (u, s[3], s[4], . . . , s[k+1], s[1]) back to S does not contain repeated vertices. Thus, pathGen takes O(cid:0)sort(m2− 1 Verifying that a path is simple (pathGen, line 8) is done by checking that it k )(cid:1) I/O's. Degenerate Graphs (Algorithm 3) For Algorithm 3, we need to generate all paths of length 2k + 1 that start with two backward-oriented (in L) edges. As shown in [3], there are at most O(cid:0)m(cid:80)k (cid:1)∆iδ2k−i(cid:1) = O(22km∆kδk) paths (cid:0)2k of length 2k + 1 in G. It follows from the fact that for each path p, either p or pR (the reverse of p) has at most k edges with opposite directions than in L. i=0 i The procedure pathGenForward generates paths p that have at most k edges with opposite directions than in L. for all s -- sequence ∈ V 2 × ({"L", "E"} × {1, . . . , ∆})i−1 do proc pathGenForward 1: generate sequences s = uv, for all (u, v) ∈ E 2: for i ← 1 . . . 2k do 3: 4: 5: 6: 7: 8: 9: end for generate all sequences s("L", j), for j ∈ {1, . . . , δ} if s has < k pairs of the type ("E", j) then 10: for all s -- sequence ∈ V 2 ×(cid:0)(cid:8)"L", "E"(cid:9) ×(cid:8)1, . . . , max{δ, ∆}(cid:9)(cid:1)2k generate all sequences s("E", j), for j ∈ {1, . . . , ∆} end if end for decode s into s(cid:48) ∈ E2k+1 if s(cid:48) (cid:54)=  then output s(cid:48) if s(cid:48) is a simple path then 11: 12: 13: 14: 15: end if 16: 17: end for end if do 18 The encoding of the sequences works as follows: it starts with two vertices, u and v, that represent the starting edge of the path. v is followed by 2k pairs of the format ("L", i) (with i ∈ {1, . . . , δ}) or ("E", i) (with i ∈ {1, . . . , ∆}). ("L", i) means that the next vertex is the ith neighbor of the current vertex in degeneracy ordering L, and ("E", i) means that the next vertex is the ith neighbor of the current vertex in E. Any sequence s has at most k pairs of the type ("E", j), and only edges represented by them may have the opposite direction than in L. The number of sequences generated by the first for loop (lines 2-9) is clearly O(cid:0)m(cid:80)k (cid:1)∆iδ2k−i(cid:1) = O(22km∆kδk), and the whole generation process takes O(cid:0)scan(22km∆kδk)(cid:1) I/O's. The sequences are decoded into paths in the second for loop (lines 10-17) in a manner similar to decodePaths, using O(cid:0)(2k+ (cid:0)2k i=0 i 1) · sort(22km∆kδk) I/O's. Paths of length 2k + 1, that have at most k edges in the opposite direction than in L when they are read backwards, can be generated by an analogous procedure pathGenBackward (using ER -- reversed edges instead of E), with the same I/O complexity. Procedure pathGen2 generates all paths of length 2k + 1 that start with two backward-oriented (in L) edges. generate all sequences ijs, for (i, j) ∈ {1, . . . , δ}2 proc pathGen2 1: generate paths of length 2k − 1, via pathGenForward 2: generate paths of length 2k − 1, via pathGenBackward 3: for all s -- generated path of length 2k − 1 do 4: 5: end for 6: for all s -- sequence ∈ {1, . . . , d}2 × E2k−1 do 7: 8: 9: 10: 11: end if 12: 13: end for decode s into s(cid:48) ∈ E2k+1 if s(cid:48) (cid:54)=  then output s(cid:48) if s(cid:48) is a simple path then end if Paths generated in lines 1-2 are the tails of the resulting paths. The two numbers in sequences added to these paths in line 4 denote the edges in L that are to be taken to determine first two vertices on the final path, starting at the tail's first vertex. This assures that these edges are backward-oriented in L. The number of paths generated by pathGen2 is O(δ2 · 22k−2m∆k−1δk−1) = k ), and its I/O complexity is O(cid:0)k · k δ1+ 1 O(22k−2m∆k−1δk+1) = O(22k−2m2− 1 sort(22k−2m2− 1 k δ1+ 1 k )(cid:1). Since generating all paths of length 2k that begin with a backward-oriented (in L) edge is essentially the same as pathGen2, path generation in this case requires O(cid:0)k · sort(22k−2m2− 1 k δ1+ 1 k )(cid:1) I/O's. 19 A.4 Graph Reordering Assume we are given a graph G = (V, E), with V = (1, 2, . . . , n), and d- degeneracy ordering L = (v1, v2, . . . , vn) of V . Our goal is to reorder G according to L, i.e., substitute each edge (vi, vj) ∈ E with an edge (i, j). for all vi -- ith vertex in L do append tuple (vi, "i") to E // precedes p do not write (v, i) back to E end for sort E lexicographically for all p -- tuple in E do if p = (u, v) then q ← tuple (u, "i") write (v, i) back to E proc reorderG(G, L) 1: for all k ← 1, 2 do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: end for end if end for else A single iteration of the outer for loop (lines 1-14) first renames origins of edges in E and then reverts them (thus, after 2 iterations edges have their original directions). First, it adds vertices along with their positions in L to E in lines 2-4. This takes O(scan(n)) I/O's. Then it sorts E (line 5) in O(sort(dn)) I/O's. The next for loop (lines 6-13) scans E, renames origins of edges to their positions in L and outputs their opposite versions. The tuples q obtained in line 8 can clearly be found in the same single scan (tuple (u, "i") directly precedes all edges (u, v) after E was sorted), so this part is done in O(scan(dn)) I/O's. Therefore, reorderG runs in O(sort(dn)) I/O's altogether. A.5 Proof of Lemma 6 First, observe that the total size of all sets P and X passed to initial calls to BronKerboschPivot is O(m) = O(δn). To see this, note that every edge (vi, vj) (with vi preceding vj in L = (v1, v2, . . . , vn)) puts vi into initial X for R = {vj} and vj into initial P for R = {vi}. Since the size of each P is at most δ, the total number of edges in all HP,X 's is O(δ2n). Our approach is to generate and store all P 's, X's and HP,X 's at the very beginning of the algorithm, and then just pass appropriate P , X, and HP,X to each initial call to BronKerboschPivot. Procedure genPX generates all initial P 's and X's in O(sort(δn)) I/O's. We assume that for each vertex v ∈ V we know its position in L (i.e., we know i for v = vi). Also, for each edge (u, v) ∈ E, we know positions in L of its endpoints 20 (i.e., we know both i and j for (u, v) = (vi, vj)). We can easily achieve this in L≺ v, we denote that u precedes v in L. O(sort(δn)) I/O's (see Sec. A.4). By u The for loop (lines 1-5) clearly takes O(scan(δn)) I/O's. proc genPX(G, L) 1: for all (vi, vj) -- edge in E do L≺ vj then if vi 2: 3: end if 4: 5: end for 6: sort F lexicographically 7: scan F to create sets P and X output tuples (vi, "P", vj), and (vj, "X", vi) to set F The meaning of (vi, "P", vj) is "add vj to Pvi", and of (vj, "X", vi): "add vi to Xvj ". The above discussion explains why this information allows to generate all P 's and X's. Therefore, after set F is sorted in O(sort(δn)) I/O's in line 6, generation of P 's and X's in line 7 takes O(scan(δn)) I/O's. Procedure genH generates all initial HP,X 's in O(sort(δ2n)) I/O's. Each ver- tex has at most δ neighbors that succeed it in L, so there are O(δ2n) tuples added to E in the first for loop (lines 1-5). They can be generated in O(scan(δ2n)) I/O's, as the edges in E are sorted lexicographically. L≺ v L≺ w do end for append tuple (v, w, ?u?) to E for all v, w -- neighbors of u s.t. u q ← tuple of form (vi, vj) immediately preceding p in E if q = (v, w) then proc genH(G, L) 1: for all u -- vertex in V do 2: 3: 4: 5: end for 6: sort E lexicographically 7: for all p -- tuple in E do if p = (v, w, ?u?) then 8: 9: 10: 11: 12: 13: 14: 15: end if 16: 17: end for 18: sort H lexicographically 19: scan H to create sets Hv 20: scan edges of Hv's and mark the endpoints that belong to Pv's end if do not write p back to E output tuples (Hv, u, w) and (Hv, w, u) to set H else //p = (v, w) write p back to E 21 To understand the meaning of tuples from line 3, refer to Fig. 2. u v w Fig. 2. v and w are neighbors of u, and u in genH, line 3. If (v, w) ∈ E, the edge (u, w) is in Hv. L≺ v L≺ w, so the tuple (v, w, ?u?) is output After E is sorted in line 6 in O(sort(δ2n)) I/O's, the next for loop (lines 7-17) identifies edges that belong to sets Hv. In E, each edge (v, w) is followed by zero or more tuples of the form (v, w, ?u?). This makes it easy to determine q in line 9, and therefore, the loop takes O(scan(δ2n)) I/O's. As explained in Fig. 2, (v, w) followed by (v, w, ?u?) means that the edge (u, w) has to be added to Hv. It is denoted by the tuples (Hv, u, w) and (Hv, w, u) output in line 11. Sorting H in line 18 takes O(sort(δ2n)) I/O's, and after that, HP,X 's are generated in line 19 in O(scan(δ2n)) I/O's. The marking of endpoints (line 20) also takes O(scan(δ2n)) I/O's. Therefore, total complexity of generating initial P 's, X's, and HP,X 's is (cid:117)(cid:116) O(sort(δ2n)) I/O's. A.6 Proof of Lemma 7 if e = (u, v) or e = (v, w) then unmark v in e for all e -- edge in HP,X do end if end for for all e -- edge in HP,X do proc updateH(v) 1: for all HP,X -- candidate do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: end for write e back to HP,X else end if end for if at least one vertex of e is marked then do not write e back to HP,X 22 Recall that P = p and X = x. Our idea in computing HP,X 's is to first generate candidates for HP,X 's. Candidates are defined as HP,X 's as they would be if there were no lines 7 and 8 in BronKerboschPivot (i.e., as if P and X did not change). We then update the candidates according to lines 7 and 8 of BronKerboschPivot. Generation of the candidates for HP,X 's is almost the same as in genH, only v and w in line 2 are now taken from P , so it uses O(sort(p2(p + x))) I/O's. Updating HP,X 's (moving v from P to X) is realized by the procedure updateH. Both inner for loops (lines 2-6 and 7-13) clearly take O(scan(HP,X)) I/O's. Since the total size of all candidates is O(p2(p + x)), a single call to updateH takes O(scan(p2(p + x))) I/O's. There are at most p such calls, so generating HP,X 's that are passed to recursive calls in line 6 of BronKerboschPivot takes O(sort(p2(p + x)) + p · scan(p2(p + x))) = O(sort(δp2(p + x))) I/O's. (cid:117)(cid:116) 23
1803.09520
3
1803
2018-09-06T08:08:17
Universal Compressed Text Indexing
[ "cs.DS" ]
The rise of repetitive datasets has lately generated a lot of interest in compressed self-indexes based on dictionary compression, a rich and heterogeneous family that exploits text repetitions in different ways. For each such compression scheme, several different indexing solutions have been proposed in the last two decades. To date, the fastest indexes for repetitive texts are based on the run-length compressed Burrows-Wheeler transform and on the Compact Directed Acyclic Word Graph. The most space-efficient indexes, on the other hand, are based on the Lempel-Ziv parsing and on grammar compression. Indexes for more universal schemes such as collage systems and macro schemes have not yet been proposed. Very recently, Kempa and Prezza [STOC 2018] showed that all dictionary compressors can be interpreted as approximation algorithms for the smallest string attractor, that is, a set of text positions capturing all distinct substrings. Starting from this observation, in this paper we develop the first universal compressed self-index, that is, the first indexing data structure based on string attractors, which can therefore be built on top of any dictionary-compressed text representation. Let $\gamma$ be the size of a string attractor for a text of length $n$. Our index takes $O(\gamma\log(n/\gamma))$ words of space and supports locating the $occ$ occurrences of any pattern of length $m$ in $O(m\log n + occ\log^{\epsilon}n)$ time, for any constant $\epsilon>0$. This is, in particular, the first index for general macro schemes and collage systems. Our result shows that the relation between indexing and compression is much deeper than what was previously thought: the simple property standing at the core of all dictionary compressors is sufficient to support fast indexed queries.
cs.DS
cs
Universal Compressed Text Indexing 1 Gonzalo Navarro 2 Center for Biotechnology and Bioengineering (CeBiB), Department of Computer Science, University of Chile. [email protected] Nicola Prezza 3 Department of Computer Science, University of Pisa, Italy. [email protected] Abstract The rise of repetitive datasets has lately generated a lot of interest in compressed self-indexes based on dictionary compression, a rich and heterogeneous family of techniques that exploits text repetitions in different ways. For each such compres- sion scheme, several different indexing solutions have been proposed in the last two decades. To date, the fastest indexes for repetitive texts are based on the run-length compressed Burrows -- Wheeler transform (BWT) and on the Compact Directed Acyclic Word Graph (CDAWG). The most space-efficient indexes, on the other hand, are based on the Lempel -- Ziv parsing and on grammar compression. Indexes for more universal schemes such as collage systems and macro schemes have not yet been proposed. Very recently, Kempa and Prezza [STOC 2018] showed that all dictionary compressors can be interpreted as approximation algorithms for the smallest string attractor, that is, a set of text positions capturing all distinct substrings. Starting from this observation, in this paper we develop the first univer- sal compressed self-index, that is, the first indexing data structure based on string attractors, which can therefore be built on top of any dictionary-compressed text representation. Let γ be the size of a string attractor for a text of length n. From known reductions, γ can be chosen to be asymptotically equal to any repetitiveness measure: number of runs in the BWT, size of the CDAWG, number of Lempel -- Ziv phrases, number of rules in a grammar or collage system, size of a macro scheme. Our index takes O(γ lg(n/γ)) words of space and supports locating the occ occur- rences of any pattern of length m in O(m lg n + occ lg n) time, for any constant  > 0. This is, in particular, the first index for general macro schemes and collage systems. Our result shows that the relation between indexing and compression is much deeper than what was previously thought: the simple property standing at the core of all dictionary compressors is sufficient to support fast indexed queries. Key words: Repetitive sequences; Compressed indexes; String attractors Preprint submitted to Elsevier Preprint 7 September 2018 1 Introduction Efficiently indexing repetitive text collections is becoming of great importance due to the accelerating rate at which repetitive datasets are being produced in domains such as biology (where the number of sequenced individual genomes is increasing at an accelerating pace) and the web (with databases such as Wikipedia and GitHub being updated daily by thousands of users). A self- index on a string S is a data structure that offers direct access to any substring of S (and thus it replaces S), and at the same time supports indexed queries such as counting and locating pattern occurrences in S. Unfortunately, classic self-indexes -- for example, the FM-index [20] -- that work extremely well on standard datasets fail on repetitive collections in the sense that their compres- sion rate does not reflect the input's information content. This phenomenon can be explained in theory with the fact that entropy compression is not able to take advantage of repetitions longer than (roughly) the logarithm of the input's length [22]. For this reason, research in the last two decades focused on self-indexing based on dictionary compressors such as the Lempel -- Ziv 1977 factorization (LZ77) [39], the run-length encoded Burrows -- Wheeler transform (RLBWT) [11] and context-free grammars (CFGs) [37], just to name the most popular ones. The idea underlying these compression techniques is to break the text into phrases coming from a dictionary (hence the name dictionary compressors), and to represent each phrase using limited information (typi- cally, a pointer to other text locations or to an external set of strings). This scheme allows taking full advantage of long repetitions; as a result, dictionary- compressed self-indexes can be orders of magnitude more space-efficient than entropy-compressed ones on repetitive datasets. The landscape of indexes for repetitive collections reflects that of dictionary compression strategies, with specific indexes developed for each compression strategy. Yet, a few main techniques stand at the core of most of the indexes. To date, the fastest indexes are based on the RLBWT and on the Compact Di- rected Acyclic Word Graph (CDAWG) [10,18]. These indexes achieve optimal- time queries (i.e., asymptotically equal to those of suffix trees [50]) at the price of a space consumption higher than that of other compressed indexes. Namely, the former index [26] requires O(r lg(n/r)) words of space, r being the number of equal-letter runs in the BWT of S, while the latter [3] uses O(e) words, e being the size of the CDAWG of S. These two measures (especially e) have 1 This work started during Shonan Meeting 126 "Computation over Compressed Structured Data". 2 Partially funded by Fondecyt Grant 1-170048 and Basal Funds FB0001, Chile. 3 This work was partially done while the author was holding a post-doc position at the Technical University of Denmark (DTU). Partially funded by the project MIUR-SIR CMACBioSeq ("Combinatorial methods for analysis and compression of biological sequences") grant n. RBSI146R5L. 2 been experimentally confirmed to be not as small as others -- such as the size of LZ77 -- on repetitive collections [4]. Better measures of repetitiveness include the size z of the LZ77 factorization of S, the minimum size g of a CFG (i.e., sum of the lengths of the right- hand sides of the rules) generating S, or the minimum size grl of a run-length CFG [44] generating S. Indexes using O(z) or O(g) space do exist, but optimal- time queries have not yet been achieved within this space. Kreft and Navarro [38] introduced a self-index based on LZ77 compression, which proved to be extremely space-efficient on highly repetitive text collections [15]. Their self- index uses O(z) space and finds all the occ occurrences of a pattern of length m in time O((m2h+(m+occ) lg z) lg(n/z)), where h ≤ z is the maximum number of times a symbol is successively copied along the LZ77 parsing. A string of length (cid:96) is extracted in O(h(cid:96)) time. Similarly, self-indexes of size O(g) building on grammar compression [16,17] can locate all occ occurrences of a pattern in O(m2 lg lg n + m lg z + occ lg z) time. Within this space, a string of length (cid:96) can be extracted in time O(lg n + (cid:96)/ lgσ n) [7]. Alternative strategies based on Block Trees (BTs) [5] appeared recently. A BT on S uses O(z lg(n/z)) space, which is also the best asymptotic space obtained with grammar compressors [13,48,29,30,47]. In exchange for using more space than LZ77 compression, the BT offers fast extraction of substrings: O((1 + (cid:96)/ lgσ n) lg(n/z)) time. A self-index based on BTs has recently been described by Navarro [42]. Various indexes based on combinations of LZ77, CFGs, and RLBWTs have also been proposed [23,24,4,43,8,14]. Some of their best results are O(z lg(n/z)+z lg lg z) space with O(m + occ(lg lg n + lg z)) query time [14], and O(z lg(n/z)) space with either O(m lg m + occ lg lg n) [24] or O(m + lg z + occ(lg lg n + lg z)) [14] query time. Gagie et al. [26] give a more detailed survey. The above-discussed compression schemes are the most popular, but not the most space-efficient. More powerful compressors (NP-complete to optimize) include macro schemes [49] and collage systems [36]. Not much work exists in this direction, and no indexes are known for these particular compressors. 1.1 String attractors As seen in the previous paragraphs, the landscape of self-indexes based on dic- tionary compression -- as well as that of dictionary compressors themselves -- is extremely fragmented, with several techniques being developed for each dis- tinct compression strategy. Very recently, Kempa and Prezza [35] gathered all dictionary compression techniques under a common theory: they showed that these algorithms are approximations to the smallest string attractor, that is, a set of text positions "capturing" all distinct substrings of S. 3 Definition 1 (String attractor [35]). A string attractor of a string S[1..n] is a set of γ positions Γ = {j1, . . . , jγ} such that every substring S[i..j] has an occurrence S[i(cid:48)..j(cid:48)] = S[i..j] with jk ∈ [i(cid:48), j(cid:48)], for some jk ∈ Γ. Their main result is a set of reductions from dictionary compressors to string attractors of asymptotically the same size. Theorem 1 ([35]). Let S be a string and let α be any of these measures: (1) the size g of a CFG for S, (2) the size grl of a run-length CFG for S, (3) the size c of a collage system for S, (4) the size z of the LZ77 parse of S, (5) the size b of a macro scheme for S. Then, S has a string attractor of size γ = O(α). In all cases, the correspond- ing attractor can be computed in O(S) time and space from the compressed representation. Importantly, this implies that any data structure based on string attractors is universal : given any dictionary-compressed text representation, we can induce a string attractor and build the data structure on top of it. Indeed, the au- thors exploit this observation and provide the first universal data structure for random access, of size O(γ lg(n/γ)). Their extraction time within this space is O(lg(n/γ) + (cid:96)/ lgσ n). By using slightly more space, O(γ lg(n/γ) lg n) for any constant  > 0, they obtain time O(lg(n/γ)/ lg lg n + (cid:96)/ lgσ n), which is the optimal that can be reached using any space in O(γ polylog n) [35]. This sug- gests that compressed computation can be performed independently from the compression method used while at the same time matching the lower bounds of individual compressors (at least for some queries such as random access). 1.2 Our Contributions In this paper we exploit the above observation and describe the first universal self-index based on string attractors, that is, the first indexing strategy not depending on the underlying compression scheme. Since string attractors stand at the core of the notion of compression, our result shows that the relation between compression and indexing is much deeper than what was previously thought: the simple string attractor property introduced in Definition 1 is sufficient to support indexed pattern searches. Theorem 2. Let a string S[1..n] have an attractor of size γ. Then, for any constant  > 0, there exists a data structure of size O(γ lg(n/γ)) that, given a pattern string P [1..m], outputs all the occ occurrences of P in S in time 4 O(m lg n + occ(lg γ + lg lg(n/γ))) = O(m lg n + occ lg n). It can be built in √ O(n + γ lg(n/γ) lg γ) worst-case time and O(γ lg(n/γ)) space with a Monte Carlo method returning a correct result with high probability. A guaranteed construction, using Las Vegas randomization, takes O(n lg n) expected time (this time also holds w.h.p.) and O(n) space. We remark that no representation offering random access within o(γ lg(n/γ)) space is known. The performance of our index is close to that of the fastest self-indexes built on other repetitiveness masures, and it is the first one that can be built for macro schemes and collage systems. To obtain our results, we adapt the block tree index of Navarro [42], which is designed for block trees on the LZ77 parse, to operate on string attractors. The result is also different from the block-tree-like structure Kempa and Prezza use for extraction [35], because that one is aligned with the attractors and this turns out to be unsuitable for indexing. Instead, we use a block-tree-like structure, which we dub Γ-tree, which partitions the text in a regular form. We moreover introduce recent techniques [24] to remove the quadratic dependency on the pattern length in query times. 1.3 Notation We denote by S[1..n] = S[1]··· S[n] a string of length n over an alphabet of size σ = O(n). Substrings of S are denoted S[i..j] = S[i]··· S[j], and they are called prefixes of S if i = 1 and suffixes of S if j = n. The concatenation of strings S and S(cid:48) is denoted S · S(cid:48). We assume the RAM model of computation with a computer word of ω = Ω(lg n) bits. By lg we denote the logarithm function, to the base 2 when this matters. The term with high probability (w.h.p. abbreviated) indicates with probability at least 1 − n−c for an arbitrarily large constant c, where n is the input size (in our case, the input string length). print φ of a string S = S[1]··· S[n] ∈ [1..σ]n is defined as φ(S) =(cid:80)n−1 In our results, we make use of a modern variant of Karp -- Rabin fingerprinting [33] (more common nowadays than the original version), defined as follows. Let q ≥ σ be a prime number, and r be a uniform number in [1..q− 1]. The finger- i=0 S[n − i] · ri mod q. The extended fingerprint of S is the triple φ(S) = (cid:104) φ(S), rS mod q, r−S mod q(cid:105). We say that S (cid:54)= S(cid:48), with S, S(cid:48) ∈ [1..σ]n, collide through φ (for our purposes, it will be sufficient to consider equal-length strings) if φ(S) = φ(S(cid:48)), that is, φ(S − S(cid:48)) = 0, where S(cid:48)(cid:48) = S − S(cid:48) is the string defined as S(cid:48)(cid:48)[i] = S[i] − S(cid:48)[i] mod q. Since φ(S(cid:48)(cid:48)) is a polynomial (in the variable r) of degree at most n − 1 in the field Zq, it has at most n − 1 roots. As a con- sequence, the probability of having a collision between two strings is bounded 5 by O(n/q) when r is uniformly chosen in [1..q − 1]. By choosing q ∈ Θ(nc+2) for an arbitrarily large constant c, one obtains that such a hash function is collision-free among all equal-length substrings of a given string S of length n w.h.p. To conclude, we will exploit the (easily provable) folklore fact that two extended fingerprints φ(U ) and φ(V ) can be combined in constant time to obtain the extended fingerprint φ(U V ). Similarly, φ(U V ) and φ(U ) (respec- tively, φ(V )) can be combined in constant time to obtain φ(V ) (respectively, φ(U )). From now on, we will by default use the term "fingerprint" to mean extended fingerprint. 2 Γ-Trees Given a string S[1..n] over an alphabet [1..σ] with an attractor Γ of size γ, we define a Γ-tree on S as follows. At the top level, numbered l = 0, we split S into γ substrings (which we call blocks) of length b0 = n/γ. Each block is then recursively split into two so that if bl is the length of the blocks at level l, then it holds that bl+1 = bl/2, until reaching blocks of one symbol after lg(n/γ) levels (that is, bl = n/(γ · 2l)). 4 At each level l, every block that is at distance < bl from a position j ∈ Γ is marked (the distance between j and a block S[i..i(cid:48)] is i− j if i > j, j − i(cid:48) if i(cid:48) < j, and 0 otherwise). Blocks S[i..i(cid:48)] that are not marked are replaced by a pointer (cid:104)ptr1, ptr2, δ(cid:105) to an occurrence S[j(cid:48)..j(cid:48)(cid:48)] of S[i..i(cid:48)] that includes a position j ∈ Γ, j(cid:48) ≤ j ≤ j(cid:48)(cid:48). Such an occurrence exists by Definition 1. Moreover, it must be covered by 1 or 2 consecutive marked blocks of the same level due to our marking mechanism, because all the positions in S[j(cid:48)..j(cid:48)(cid:48)] are at distance < bl from j. Those 1 or 2 nodes of the Γ-tree are ptr1 and ptr2, and δ is the offset of j(cid:48) within ptr1 (δ = 0 if j(cid:48) is the first symbol inside ptr1). In level l + 1 we explicitly store only the children of the blocks that were marked in level l. The blocks stored in the Γ-tree (i.e., all blocks at level 0 and those having a marked parent) are called explicit. In the last level, the marked blocks store their corresponding single symbol from S. See Figure 1 for an example of a Γ-tree. We can regard the Γ-tree as a binary tree (with the first lg γ levels chopped out), where the internal nodes are marked nodes and have two children, whereas the leaves either are marked and represent just one symbol, or are unmarked and represent a pointer to 1 or 2 marked nodes of the same level. If we call w the number of leaves, then there are w − γ (marked) internal nodes. From the leaves, γ of them represent single symbols in the last level, while the other w − γ leaves are unmarked blocks replaced by pointers. Thus, there are in total 2w − γ nodes in the tree, 4 For simplicity of description, we assume that n/γ is a power of 2. 6 Fig. 1. Example of a Γ-tree built on a text of length n = 24 with γ = 3 attractor po- sitions (black letters). Marked blocks are colored in gray. Each non-marked block (in white) is associated with an occurrence (underlined) crossing an attractor position, and therefore overlapping only marked blocks. Only explicit blocks are shown. of which w − γ are internal nodes, w − γ are pointers, and γ store explicit symbols. Alternatively, w nodes are marked (internal nodes plus leaves) and w − γ are unmarked (leaves only). The Γ-tree then uses O(w) space. To obtain a bound in terms of n and γ, note that, at each level, each j ∈ Γ may mark up to 3 blocks; thus there are w ≤ 3γ lg(n/γ) marked blocks in total and the Γ-tree uses O(γ lg(n/γ)) space. We now describe two operations on Γ-trees that are fundamental to support efficient indexed searches. The former is also necessary for a self-index, as it allows us extracting arbitrary substrings of S efficiently. We remind that this procedure is not the same described on the original structure of string attractors [35], because the structures are also different. 2.1 Extraction To extract a single symbol S[i], we first map it to a local offset 1 ≤ i(cid:48) ≤ b0 in its corresponding level-0 block. In general, given the local offset i(cid:48) of a character in the current block at level l, we first see if the current block is marked. If so, we map i(cid:48) to a position in the next level l + 1, where the current block is split into two blocks of half the length: if i(cid:48) ≤ bl+1, then we continue on the left child with the same offset; otherwise, we subtract bl+1 from i(cid:48) and continue on the right child. If, instead, i is not in a marked block, we take the pointer (cid:104)ptr1, ptr2, δ(cid:105) stored for that block and add δ to i(cid:48). If the result is i(cid:48) ≤ bl, then 7 b b a b a b b a b a b b a b b a b a b b a b b aa b b ab a b b a b b ab a b b a b b a b b a b a b b a b a b b a b b a b a b b a b a b b b a b b b b b b a we continue in the node ptr1 with offset i(cid:48); otherwise, we continue in ptr2 with the offset i(cid:48) − bl. In both cases, the new node is marked, so we proceed as on marked blocks in order to move to the next level in constant time. The total time to extract a symbol is then O(lg(n/γ)). A substring of length (cid:96) can thus be extracted in time O((cid:96) lg(n/γ)), which will be sufficient to obtain the search time complexity of Theorem 2. It is possible to augment Γ-trees to match the complexity O(lg(n/γ) + (cid:96)/ lgσ n) obtained by Kempa and Prezza [35] on string attractors as well, though this would have no impact on our results. 2.2 Fingerprinting We now show that the Γ-tree can be augmented to compute the Karp -- Rabin fingerprint of any text substring in logarithmic time. Lemma 1. Let S[1..n] have an attractor of size γ and φ a Karp -- Rabin finger- print function. Then we can store a data structure of size O(γ lg(n/γ)) words supporting the computation of φ on any substring of S in O(lg(n/γ)) time. Proof. We augment our Γ-tree of S as follows. At level 0, we store the Karp -- Rabin fingerprints of all the text prefixes ending at positions i · n/γ, for i = 1, . . . , γ. At levels l > 0, we store the fingerprints of all explicit blocks. We first show that we can reduce the problem to that of computing the fin- gerprints of two prefixes of explicit blocks. Then, we show how to solve the sub-problem of computing fingerprints of prefixes of explicit blocks. Let S[i..j] be the substring of which we wish to compute the fingerprint φ(S[i..j]). Note that φ(S[i..j]) can be computed in constant time from φ(S[1..i− 1]) and φ(S[1..j]) so we can assume, without loss of generality, that i = 1 (i.e., the substring is a prefix of S). Then, at level 0 the substring spans a sequence B1 ··· Bt of blocks followed by a prefix C of block Bt+1 (the sequence of blocks or C could be empty). The fingerprint of B1 ··· Bt is explicitly stored, so the problem reduces to that of computing the fingerprint of C. We now show how to compute the fingerprint of a prefix of an explicit block (at any level) in O(lg(n/γ)) time. We distinguish two cases. (A) We wish to compute the fingerprint of B[1..k], for some k ≤ bl, and B is a marked block at level l. Let Bleft and Bright be the children of B at level l + 1. Then, the problem reduces to either (i) computing the fingerprint of Bleft [1..k] if k ≤ bl+1, or combining the fingerprints of Bleft (which is stored) 8 and Bright [1..k − bl+1]. In both sub-cases, the problem reduces to that of com- puting the fingerprint of the prefix of a block at level l + 1, which is explicit since B is marked. (B) We wish to compute the fingerprint of B[1..k], for some k ≤ bl, but B is an unmarked explicit block. Then, B is linked (through a Γ-tree pointer) to an occurrence in the same level spanning at most two blocks, both of which are marked. If the occurrence of B spans only one marked block B(cid:48) at level l, then B[1..bl] = B(cid:48)[1..bl] and we are back in case (A). Otherwise, the occurrence of B spans two marked blocks B(cid:48) and B(cid:48)(cid:48) at level l: B[1..bl] = B(cid:48)[i..bl]B(cid:48)(cid:48)[1..i − 1], with i ≤ bl. For each pointer of this kind in the Γ-tree, we store the fingerprint of B(cid:48)[i..bl]. We consider two sub-cases. (B.1) If k ≥ bl − i + 1, then B[1..k] = B(cid:48)[i..bl]B(cid:48)(cid:48)[1..k − (bl − i + 1)]. Since we store the fingerprint of B(cid:48)[i..bl], the problem reduces again to that of computing the fingerprint of the prefix B(cid:48)(cid:48)[1..k− (bl − i + 1)] of a marked (explicit) block. (B.2) If k < bl − i + 1, then B[1..k] = B(cid:48)[i..i + k − 1]. Although this is not a prefix nor a suffix of a block, note that B[1..k]B(cid:48)[i + k..bl] = B(cid:48)[i..i + k − 1]B(cid:48)[i + k..bl] = B(cid:48)[i..bl]. It follows that we can retrieve the fingerprint of B[1..k] in constant time using the fingerprints of B(cid:48)[i+k..bl] and B(cid:48)[i..bl]. The latter value is explicitly stored. The former is the fingerprint of the suffix of an explicit (marked) block. In this case, note that the fingerprint of a block's suffix can be retrieved from the fingerprint of the block and the fingerprint of a block's prefix, so we are back to the problem of computing the fingerprint of an explicit block's prefix. To sum up, computing a prefix of an explicit block at level l reduces to the problem of computing a prefix of an explicit block at level l + 1 (plus a con- stant number of arithmetic operations to combine values). In the worst case, we navigate down to the leaves, where fingerprints of single characters can be computed in constant time. Combining this procedure into our main algo- rithm, we obtain the claimed running time of O(lg(n/γ)). 3 A Universal Self-Index Our self-index structure builds on the Γ-tree of S. It is formed by two main components: the first finds all the pattern occurrences that cross explicit block boundaries, whereas the second finds the occurrences that are completely in- side unmarked blocks. Lemma 2. Any substring S[i..j] of length at least 2 either overlaps two con- secutive explicit blocks or is completely inside an unmarked block. Proof. The leaves of the Γ-tree partition S into a sequence of explicit blocks: γ of those are attractor positions and the other w − γ are unmarked blocks. 9 Clearly, if S[i..j] is not completely inside an unmarked block, it must cross a boundary between two explicit blocks. We exploit the lemma in the following way. We will define an occurrence of P as primary if it overlaps two consecutive explicit blocks. The occurrences that are completely contained in an unmarked block are secondary. By the lemma, every occurrence of P is either primary or secondary. We will use a data structure to find the primary occurrences and another one to detect the secondary ones. The primary occurrences are found by exploiting the fact that a prefix of P matches at the end of an explicit block and the remaining suffix of P matches the text that follows. Secondary occurrences, instead, are found by detecting primary or other secondary occurrences within the area where an unmarked block points. We note that this idea is a variant of the classical one [32] used in all in- dexes based on LZ77 and CFGs. Now we show that the principle can indeed be applied on attractors, which is the general concept underlying all those compression methods (and others where no indexes exist yet), and therefore unifies all those particular techniques. 3.1 Primary Occurrences We describe the data structures and algorithms used to find the primary occur- rences. Overall, they require O(w) space and find the occp primary occurrences in time O(m lg(mn/γ) + occp lg w), for any constant  > 0. Data Structures. The leaves of the Γ-tree partition S into explicit blocks. The partition is given by the starting positions 1 = p1 < . . . < pw ≤ n of the leaves. By Lemma 2, every primary occurrence contains some substring S[pi − 1..pi] for 1 < i ≤ w. If we find the occurrences considering only their leftmost covered position of the form pi − 1, we also ensure that each primary occurrence is found once. Thus, we will find primary occurrences as a prefix of P appearing at the end of some S[pi−1..pi − 1] followed by the corresponding suffix of P ap- pearing at the beginning of S[pi..n]. For this sake, we define the set of pairs B = {(cid:104)S[pi..n], S[pi−1..pi − 1]rev(cid:105), 1 < i ≤ w}, where S[pi−1..pi − 1]rev means S[pi−1..pi − 1] read backwards, and form multisets X and Y with the left and right components of B, respectively. We then lexicographically sort X and Y, to obtain the strings X1, X2, . . . and Y1, Y2, . . .. All the occurrences ending with a certain prefix of P will form a 10 contiguous range in the sorted multiset Y, whereas all those starting with a certain suffix of P will form a contiguous range in the sorted multiset X . Each primary occurrence of P will then correspond to a pair (cid:104)Xx, Yy(cid:105) ∈ B where both Xx and Yy belong to their range. Our structure to find the primary occurrences is a two-dimensional discrete grid G storing one point (x, y) for each pair (cid:104)Xx, Yy(cid:105) ∈ B. The grid G is of size (w − 1) × (w − 1). We represent G using a two-dimensional range search data structure requiring O(w) space [12] that reports the t points lying inside any rectangle of the grid in time O((t + 1) lg w), for any constant  > 0. We also store an array T [1..w− 1] that, for each point (x, y) in G, where Xx = S[pi..n], stores T [y] = pi, that is, where Xx starts in S. Queries. To search for a pattern P [1..m], we first find its primary oc- currences using G as follows. For each partition P< = P [1..k] and P> = < and X for P>. For each P [k + 1..m], for 1 ≤ k < m, we search Y for P rev identified range [x1, x2] × [y1, y2], we extract all the t corresponding primary occurrences (x, y) in time O((t + 1) lg w) with our range search data struc- ture. Then we report a primary occurrence starting at T [y] − k for each such point (x, y). Over the m intervals, this adds up to O((m + occp) lg w) = O((m + occp) lg(γ lg(n/γ)). We obtain the m− 1 ranges in the multiset X in overall time O(m lg(mn/γ)), by using the fingerprint-based technique of Gagie et al. [24] applied to the z- fast trie of Belazzougui et al. [2] (we use a lemma from Gagie et al. [26] where the overall result is stated in cleaner form). We use an analogous structure to obtain the ranges in Y of the suffixes of the reversed pattern. Lemma 3 (adapted from [26, Lem. 5.2]). Let S[1..n] be a string on alphabet [1..σ], X be a sorted set of suffixes of S, and φ a Karp -- Rabin fingerprint function. If one can extract a substring of length (cid:96) from S in time fe((cid:96)) and compute φ on it in time fh((cid:96)), then one can build a data structure of size O(X) that obtains the lexicographic ranges in X of the m − 1 suffixes of a given pattern P in worst-case time O(m lg(σ)/ω+m(fh(m)+lg m)+fe(m)) -- provided that φ is collision-free among substrings of S whose lengths are powers of two. In Sections 2.1 and 2.2 we show how to extract in time fe((cid:96)) = O((cid:96) lg(n/γ)) and how to compute a fingerprint in time fh((cid:96)) = O(lg(n/γ)), respectively. In Section 4.2 we show that a Karp -- Rabin function that is collision-free among substrings whose lengths are powers of two can be efficiently found. Together, these results show that we can find all the ranges in X and Y in time O(m lg(σ)/ω + m(lg(n/γ) + lg m) + m lg(n/γ)) = O(m lg(mn/γ)). 11 Patterns P of length m = 1 can be handled as P [1]∗, where ∗ stands for any character. Thus, we take [x1, x2] = [1, w] and carry out the search as a normal pattern of length m = 2. To make this work also for the last position in S, we assume as usual that S is terminated by a special symbol $ that cannot appear in search patterns P . Alternatively, we can store a list of the marked leaves where each alphabet symbol appears, and take those as the primary occurrences. A simple variant of Lemma 2 shows that occurrences of length 1 are either attractor positions or are inside an unmarked block, so the normal mechanism to find secondary occurrences from this set works correctly. Since there are in total γ such leaves, the space for these lists is O(σ + γ) = O(γ). 3.2 Secondary Occurrences We now describe the data structures and algorithms to find the secondary occurrences. They require O(w) space and find the occs secondary occurrences in time O((occp + occs) lg lgω(n/γ)). Data structures. To track the secondary occurrences, let us call target and source the text areas S[i..i(cid:48)] and S[j(cid:48)..j(cid:48)(cid:48)], respectively, of an unmarked block and its pointer, so that there is some j ∈ Γ contained in S[j(cid:48)..j(cid:48)(cid:48)] (if the blocks are at level l, then i(cid:48) = i+bl−1 and j(cid:48)(cid:48) = j(cid:48) +bl−1). Let S[pos..pos+m−1] be an occurrence we have already found (using the grid G, initially). Our aim is to find all the sources that contain S[pos..pos + m− 1], since their corresponding targets then contain other occurrences of P . To this aim, we store the sources of all levels in an array R[1..w − γ], with fields j(cid:48) and j(cid:48)(cid:48), ordered by starting positions R[k].j(cid:48). We build a predecessor search structure on the fields R[k].j(cid:48), and a range maximum query (RMQ) data structure on the fields R[k].j(cid:48)(cid:48), able to find the maximum endpoint j(cid:48)(cid:48) in any given range of R. While a predecessor search using O(w) space requires O(lg lgω(n/w)) time on an ω-bit-word machine [45, Sec. 1.3.2], the RMQ struc- ture operates in constant time using just O(w) bits [21]. Queries. Let S[pos..pos+m−1] be a primary occurrence found. A predeces- sor search for pos gives us the rightmost position r where the sources start at R[r].j(cid:48) ≤ pos. An RMQ on R[1..r] then finds the position k of the source with the rightmost endpoint R[k].j(cid:48)(cid:48) in R[1..r]. If even R[k].j(cid:48)(cid:48) < pos+m−1, then no source covers the occurrence and we finish. If, instead, R[k].j(cid:48)(cid:48) ≥ pos + m − 1, then the source R[k] covers the occurrence and we process its correspond- ing target as a secondary occurrence; in this case we also recurse on the ranges R[1..k − 1] and R[k + 1..r] that are nonempty. It is easy to see that 12 each valid secondary occurrence is identified in O(1) time (see Muthukrish- nan [41] for an analogous process). In addition, such secondary occurrences, S[pos(cid:48)..pos(cid:48)+m−1], must be recursively processed for further secondary occur- rences. A similar procedure is described for tracking the secondary occurrences in the LZ77-index [38]. The cost per secondary occurrence reported then amortizes to a predecessor search, O(lg lgω(n/γ)) time. This cost is also paid for each primary occurrence, which might not yield any secondary occurrence to amortize it. We now prove that this process is sufficient to find all the secondary occurrences. Lemma 4. The described algorithm reports every secondary occurrence exactly once. Proof. We use induction on the level l of the unmarked block that contains the secondary occurrence. All the secondary occurrences of the last level are correctly reported once, since there are none. Now consider an occurrence S[pos..pos + m − 1] inside an unmarked block S[i..i(cid:48)] of level l. This block is the target of a source S[j(cid:48)..j(cid:48)(cid:48)] that spans 1 or 2 consecutive marked blocks of level l. Then there is another occurrence S[pos(cid:48)..pos(cid:48) + m − 1], with pos(cid:48) = pos − i + j(cid:48). Note that the algorithm can report S[pos..pos + m − 1] only as a copy of S[pos(cid:48)..pos(cid:48) + m − 1]. If S[pos(cid:48)..pos(cid:48) + m − 1] is primary, then S[pos..pos + m − 1] will be reported right after S[pos(cid:48)..pos(cid:48) + m − 1], because [pos(cid:48)..pos(cid:48) + m − 1] ⊆ [j(cid:48)..j(cid:48)(cid:48)], and the algorithm will map [j(cid:48)..j(cid:48)(cid:48)] to [i..i(cid:48)] to discover S[pos..pos + m − 1]. Otherwise, S[pos(cid:48)..pos(cid:48) + m − 1] is secondary, and thus it is within one of the marked blocks at level l that overlap the source. Moreover, it is within one of the blocks of level l + 1 into which those marked blocks are split. Thus, S[pos(cid:48)..pos(cid:48) + m − 1] is within an unmarked block of level > l, which by the inductive hypothesis will be reported exactly once. When S[pos(cid:48)..pos(cid:48) + m− 1] is reported, the algorithm will also note that [pos(cid:48)..pos(cid:48) + m − 1] ⊆ [j(cid:48)..j(cid:48)(cid:48)] and will find S[pos..pos + m − 1] once as well. If we handle patterns of length m = 1 by taking the corresponding attractor positions as the primary occurrences, then there may be secondary occurrences in the last level, but those point directly to primary occurrences (i.e., attractor positions), and therefore the base case of the induction holds too. The total search cost with occ primary and secondary occurrences is there- fore O(m(lg(γ lg(n/γ)) + lg(mn/γ)) + occ(lg(γ lg(n/γ)) + lg lgω(n/γ))) = O(m lg n + occ(lg γ + lg lg(n/γ))) = O(m lg n + occ lg n), for any constant  > 0 defined at indexing time (the choice of  affects the constant that ac- companies the size O(γ lg(n/γ)) of the structure G). 13 4 Construction If we allow the index construction to be correct with high probability only, then we can build it in O(n + w lg(n/γ) + w lg w) time and O(w) space (plus read-only access to S), using a Monte Carlo method. Since w = O(γ lg(n/γ)) is the number of leaves in the Γ-tree and γ(lg(n/γ))O(1) ⊆ O(n), the time can be written as O(n + w lg γ). In order to ensure a correct index, a Las Vegas method requires O(n lg n) time in expectation (and w.h.p.) and O(n) space. √ √ 4.1 Building the Γ-tree Given the attractor Γ, we can build the index data structure as follows. At each level l, we create an Aho -- Corasick automaton [1] on the unmarked blocks at this level (i.e., those at distance ≥ bl from any attractor), and use it to scan the areas S[j − bl + 1..j + bl − 1] around all the attractor elements j ∈ Γ in order to find a proper pointer for each of those unmarked blocks. This takes O(n) time per level. Since the areas around each of the γ attractor positions are scanned at each level but they have exponentially decreasing lengths, the scanning time adds up to O(γ n 4γ + ··· ) = O(n). 2γ + γ n γ + γ n As for preprocessing time, each unmarked block is preprocessed only once, and they add up to O(n) symbols. The preprocessing can thus be done in time O(n) [19]. To be able to scan in linear time, we can build deterministic dictionaries on the edges outgoing from each node, in time O(n(lg lg σ)2) [46]. In total, we can build the Γ-tree in O(n(lg lg σ)2) deterministic time and O(n) space. To reduce the space to O(w), instead of inserting the unmarked blocks into an Aho -- Corasick automaton, we compute their Karp -- Rabin fingerprints, store them in a hash table, and scan the areas S[j−bl +1..j +bl−1] around attractor elements j. This finds the correct sources for all the unmarked blocks w.h.p. Indeed, if we verify the potential collisions, the result is always correct within O(n) expected time (further, this time holds w.h.p.). 4.2 Building the Fingerprints Building the structures for Lemma 1 requires (i) computing the fingerprint of every text prefix ending at block boundaries (O(n) time and O(w) space in addition to S), (ii) computing the fingerprint of every explicit block (O(w) time and O(w) space starting from the leaves and combining results up to the 14 root), (iii) for each unmarked explicit block B, computing the fingerprint of a string of length at most B (i.e., the fingerprint of B(cid:48)[i..bl]; see case (B) of Lemma 1). Since unmarked blocks do not have children, each text character is seen at most once while computing these fingerprints, which implies that these values can also be computed in O(n) time and O(w) space in addition to S. This process, however, does not include finding a collision-free Karp -- Rabin hash function. As a result, the fingerprinting is correct w.h.p. only. We can use the de-randomization procedure of Bille et al. [9], which guarantees to find -- in O(n lg n) expected time 5 and O(n) words of space -- a Karp -- Rabin hash function that is collision-free among substrings of S whose lengths are powers of two. This is sufficient to deterministically check the equality of substrings 6 in the z-fast trie used in the technique [26, Lem. 5.2] that we use to quickly find ranges of pattern suffixes/prefixes (in our Section 3.1). 4.3 Building the Multisets X and Y To build the multisets X and Y for the primary occurrences, we can build the suffix arrays [40] of S and its reverse, Srev. This requires O(n) deterministic time and space [31]. Then we can scan those suffix arrays to enumerate X and Y in the lexicographic order. To sort X and Y within O(w) space, we can build instead a sparse suffix tree on the w positions of X or Y in S. This can be done in expected time (and √ lg w) and O(w) space [27]. If we aim to build the suffix array w.h.p.) O(n correctly w.h.p. only, then the time drops to O(n). We must then build the z-fast trie [2, Thm. 5] on the sets X and Y. Since we can use any space in O(w), we opt for a simpler variant described by Kempa and Kosolobov [34, Lem. 5], which is easier to build. Theirs is a compact trie that stores, for each node v representing the string v.str and with parent node v.par: (i) the length v.str, (ii) a dictionary mapping each character c to the child node v(cid:48) of v such that v(cid:48).str[v.str + 1] = c (if such a child exists), and (iii) the (non-extended) fingerprint of v.str[1..kv], where kv is the two-fattest number in the range [v.par.str + 1..v.str], that is, the number in that range whose binary representation has the largest number of trailing zeros. The trie also requires a global "navigating" hash table that maps the O(w) pairs (kv, φ(v.str[1..kv])) to their corresponding node v. 5 The time is also O(n lg n) w.h.p., not only in expectation. 6 If the length (cid:96) of the two substrings is not a power of two, then we compare their prefixes and suffixes whose length is the largest power of two smaller than (cid:96). 15 If p prefixes some string in X (resp. Y) and the fingerprint function φ is collision-free among equal-length text substrings, then their so-called fat bi- nary search procedure finds -- in time O(lg p) -- the highest node v such that v.str is prefixed by a search pattern p (assuming constant-time compu- tation of the fingerprint of any substring of p, which can be achieved after a linear-time preprocessing of the pattern). The range of strings of X (resp. Y) is then associated with the node v. Their search procedure, however, has an anomaly [34, Lem. 5]: in some cases it might return a child of v instead of v. We can fix this problem (and always re- turn the correct v) by also storing, for every internal trie node v, the fingerprint of v.str and the exit character v.str[v.par.str + 1]. Then, we know that the procedure returned v if and only if v.par.str < p, the fingerprint of v.par.str matches that of p[1..v.par.str] and v.str[v.par.str + 1] = p[v.par.str + 1]. If these conditions do not hold, we know that the procedure returned a child of v and we fix the answer by moving to the parent of the returned node. 7 If p does not prefix any string in X (resp. Y), or if φ is not collision-free, the search (with our without our fix) returns an arbitrary range. We recall that, to cope with the first condition (which gives the z-fast trie search the name weak prefix search), Lemma 3 adds a deterministic check that allows discarding the incorrect ranges returned by the procedure. The second condition, on the other hand, w.h.p. does not fail. Still, we recall that we can ensure that our function is collision-free by checking, at construction time, for collisions among substrings whose lengths are powers of two, as described in Section 4.2. The construction of this z-fast trie starts from the sparse suffix tree of X (or Y), since the topology is the same. The dictionaries giving constant-time access to the nodes' children can be built correctly w.h.p. in time O(w), or be made perfect in expected time (and w.h.p.) O(w) [51]. Alternatively, one can use deterministic dictionaries, which can be built in worst-case time O(w(lg lg σ)2) [46]. In all cases, the construction space is O(w). Similarly, the navigating hash can be built correctly w.h.p. in time O(w), or be made perfect in expected time (and w.h.p.) O(w). We could also represent the navigating hash using deterministic dictionaries built in worst-case time O(w(lg lg w)2) [46] and space O(w). The O(w) fingerprints φ(v.str) and the hashes of the pairs (kv, φ(v.str[1..kv])) can be computed in total time O(w lg(n/γ)) by using Lemma 1 to compute the Karp -- Rabin fingerprints. 7 This fix works in general. In their particular procedure, we do not need to check that v.str[v.par.str + 1] = p[v.par.str + 1] (nor to store the exit character). Alter- natively, we could directly fix their procedure by similarly storing the fingerprint of v.str (hash(v.str), in their article) and changing line 6 of their extended version [34] to "if v.len < pat and hash(v.str) = hash(pat[1..v.len]) and v.map(pat[v.len + 1]) (cid:54)= nil then v ← v.map(pat[v.len + 1]);". 16 4.4 Structures to Track Occurrences √ A variant of the grid data structure G [6], with the same space and time performance, can be built in O(w lg w) deterministic time, and O(w) space. The arrays T and R can be built in O(w) space and O(w lg lg w) deterministic time [28]. The RMQ structure on R requires O(w) deterministic construction time and O(w) bits [21]. The predecessor data structure [45], however, requires perfect hashing. This can be built in O(w) space and O(w(lg lg w)2) deterministic time [46], or in O(w) expected time (also holding w.h.p.). 5 Conclusions We have introduced the first universal self-index for repetitive text collections. The index is based on a recent result [35] that unifies a large number of dictionary compression methods into the single concept of string attractor. For each compression method based on Lempel -- Ziv, grammars, run-compressed BWT, collage systems, macro schemes, etc., it is easy to identify an attractor set of the same asymptotic size obtained by the compression method, say γ. Thus, our construction automatically yields a self-index for each of those compression methods, within O(γ lg(n/γ)) space. No structure is known of size o(γ lg(n/γ)) able to efficiently extract a substring from the compressed text (say, within O(polylog n) time per symbol), and thus O(γ lg(n/γ)) is the minimum space we could hope for an efficient self-index with the current state of the art. Indeed, no self-index of size o(γ lg(n/γ)) is known: the smallest ones use O(z) [38] and O(r) [26] space, respectively, yet there are text families where z, r = Ω(b∗ lg n) = Ω(γ∗ lg n) [25] (where b∗ and γ∗ denote the smallest macro scheme and attractor sizes, respectively). The most time-efficient self-indexes use Θ(r lg(n/r)) and Ω(z lg(n/z)) space, which is asymptotically equal or larger than ours. The search time of our index, O(m lg n + occ lg n) for any constant  > 0, is close to that of the fastest of those self-indexes, which were developed for a specific compression format (see [26, Table 1]). Moreover, our construction provides a self-index for compression methods for which no such structure existed before, such as collage systems and macro schemes. Those can provide smaller attractor sets than the ones derived from the more popular compression methods. We can improve the search time of our index by using slightly more space. Our current bottleneck in the per-occurrence query time is the grid data struc- 17 ture G, which uses O(w) space and returns each occurrence in time O(lg w). Instead, a grid structure [12] using O(w lg lg w) = O(γ lg(n/γ) lg lg n) space obtains the occp primary occurrences in time O((occp +1) lg lg w). This slightly larger version of our index can then search in time O(m lg n + occ lg lg n). This complexity is close to that of some larger indexes in the literature for repetitive string collections (see [26, Table 1]). A number of avenues for future work are open, including supporting more complex pattern matching, handling dynamic collections of texts, supporting document retrieval, and implementing a practical version of the index. Any advance in this direction will then translate into all of the existing indexes for repetitive text collections. Acknowledgements We thank the reviewers for their outstanding job in improving our presentation (and even our bounds). References [1] A. V. Aho and M. J. Corasick. Efficient string matching: an aid to bibliographic search. Communications of the ACM, 18(6):333 -- 340, 1975. [2] D. Belazzougui, P. Boldi, R. Pagh, and S. Vigna. Fast prefix search in little space, with applications. In Proc. 18th Annual European Symposium on Algorithms (ESA), pages 427 -- 438, 2010. [3] D. Belazzougui and F. Cunial. Fast label extraction in the CDAWG. In Proc. 24th International Symposium on String Processing and Information Retrieval (SPIRE), LNCS 10508, pages 161 -- 175, 2017. [4] D. Belazzougui, F. Cunial, T. Gagie, N. Prezza, and M. Raffinot. Composite In Proc. 26th Annual Symposium on repetition-aware data structures. Combinatorial Pattern Matching (CPM), LNCS 9133, pages 26 -- 39, 2015. [5] D. Belazzougui, T. Gagie, P. Gawrychowski, J. Karkkainen, A. Ord´onez, S. J. Puglisi, and Y. Tabei. Queries on LZ-bounded encodings. In Proc. 25th Data Compression Conference (DCC), pages 83 -- 92, 2015. [6] D. Belazzougui and S. J. Puglisi. Range predecessor and Lempel-Ziv parsing. In Proc. 27th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2053 -- 2071, 2016. 18 [7] D. Belazzougui, S. J. Puglisi, and Y. Tabei. Access, rank, select in grammar- compressed strings. In Proc. 23rd Annual European Symposium on Algorithms (ESA), LNCS 9294, pages 142 -- 154, 2015. [8] P. Bille, M. B. Ettienne, I. L. Gørtz, and H. W. Vildhøj. Time-space trade-offs for Lempel-Ziv compressed indexing. Theoretical Computer Science, 713:66 -- 77, 2018. [9] P. Bille, I. L. Gørtz, M. B. T. Knudsen, M. Lewenstein, and H. W. Vildhøj. Longest common extensions in sublinear space. In Proc. 26th Annual Symposium on Combinatorial Pattern Matching (CPM), LNCS 9133, pages 65 -- 76, 2015. [10] A. Blumer, J. Blumer, D. Haussler, R. McConnell, and A. Ehrenfeucht. Complete inverted files for efficient text retrieval and analysis. Journal of the ACM, 34(3):578 -- 595, 1987. [11] M. Burrows and D. Wheeler. A block sorting lossless data compression algorithm. Technical Report 124, Digital Equipment Corporation, 1994. [12] T. M. Chan, K. G. Larsen, and M. Patra¸scu. Orthogonal range searching on the RAM, revisited. In Proc. 27th ACM Symposium on Computational Geometry (SoCG), pages 1 -- 10, 2011. [13] M. Charikar, E. Lehman, D. Liu, R. Panigrahy, M. Prabhakaran, A. Sahai, and A. Shelat. The smallest grammar problem. IEEE Transactions on Information Theory, 51(7):2554 -- 2576, 2005. [14] A. R. Christiansen and M. B. Ettienne. Compressed indexing with signature grammars. In Proc. 13th Latin American Symposium on Theoretical Informatics (LATIN), LNCS 10807, pages 331 -- 345, 2018. [15] F. Claude, A. Farina, M. Mart´ınez-Prieto, and G. Navarro. Universal indexes for highly repetitive document collections. Information Systems, 61:1 -- 23, 2016. [16] F. Claude and G. Navarro. Self-indexed grammar-based compression. Fundamenta Informaticae, 111(3):313 -- 337, 2010. [17] F. Claude and G. Navarro. Improved grammar-based compressed indexes. In Proc. 19th International Symposium on String Processing and Information Retrieval (SPIRE), LNCS 7608, pages 180 -- 192, 2012. [18] M. Crochemore and R. V´erin. Direct construction of compact directed acyclic In Proc. 8th Annual Symposium on Combinatorial Pattern word graphs. Matching (CPM), LNCS 1264, pages 116 -- 129. Springer, 1997. [19] S. Dori and G. M. Landau. Construction of Aho Corasick automaton in linear time for integer alphabets. Information Processing Letters, 98(2):66 -- 72, 2006. [20] P. Ferragina and G. Manzini. Indexing compressed texts. Journal of the ACM, 52(4):552 -- 581, 2005. 19 [21] J. Fischer and V. Heun. Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM Journal on Computing, 40(2):465 -- 492, 2011. [22] T. Gagie. Large alphabets and incompressibility. Information Processing Letters, 99(6):246 -- 251, 2006. [23] T. Gagie, P. Gawrychowski, J. Karkkainen, Y. Nekrich, and S. J. Puglisi. A In Proc. 6th International Conference on faster grammar-based self-index. Language and Automata Theory and Applications (LATA), LNCS 7183, pages 240 -- 251, 2012. [24] T. Gagie, P. Gawrychowski, J. Karkkainen, Y. Nekrich, and S. J. Puglisi. LZ77- based self-indexing with faster pattern matching. In Proc. 11th Latin American Symposium on Theoretical Informatics (LATIN), LNCS 8392, pages 731 -- 742, 2014. [25] T. Gagie, G. Navarro, and N. Prezza. On the approximation ratio of Lempel-Ziv parsing. In Proc. 13th Latin American Symposium on Theoretical Informatics (LATIN), LNCS 10807, pages 490 -- 503, 2018. [26] T. Gagie, G. Navarro, and N. Prezza. Optimal-time text indexing in BWT- runs bounded space. In Proc. 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1459 -- 1477, 2018. [27] P. Gawrychowski and T. Kociumaka. Sparse suffix tree construction in optimal In Proc. 28th Annual ACM-SIAM Symposium on Discrete time and space. Algorithms (SODA), pages 425 -- 439, 2017. [28] Y. Han. Deterministic sorting in O(n lg lg n) time and linear space. Journal of Algorithms, 50(1):96 -- 105, 2004. [29] A. Jez. Approximation of grammar-based compression via recompression. Theoretical Computer Science, 592:115 -- 134, 2015. [30] A. Jez. A really simple approximation of smallest grammar. Theoretical Computer Science, 616:141 -- 150, 2016. [31] J. Karkkainen, P. Sanders, and S. Burkhardt. Linear work suffix array construction. Journal of the ACM, 53(6):918 -- 936, 2006. [32] J. Karkkainen and E. Ukkonen. Lempel-Ziv parsing and sublinear-size index In Proc. 3rd South American Workshop on structures for string matching. String Processing (WSP), pages 141 -- 155, 1996. [33] R. M. Karp and M. O. Rabin. Efficient randomized pattern-matching algorithms. IBM Journal of Research and Development, 31(2):249 -- 260, 1987. [34] D. Kempa and D. Kosolobov. LZ-End parsing in compressed space. In Proc. 27th Data Compression Conference (DCC), pages 350 -- 359, 2017. Extended version in https://arxiv.org/pdf/1611.01769.pdf. 20 [35] D. Kempa and N. Prezza. At the roots of dictionary compression: String In Proc. 50th Annual ACM SIGACT Symposium on Theory of attractors. Computing (STOC), pages 827 -- 840, 2018. [36] T. Kida, T. Matsumoto, Y. Shibata, M. Takeda, A. Shinohara, and S. Arikawa. Collage system: A unifying framework for compressed pattern matching. Theoretical Computer Science, 298(1):253 -- 272, 2003. [37] J. C. Kieffer and E. Yang. Grammar-based codes: A new class of universal lossless source codes. IEEE Transactions on Information Theory, 46(3):737 -- 754, 2000. [38] S. Kreft and G. Navarro. On compressing and indexing repetitive sequences. Theoretical Computer Science, 483:115 -- 133, 2013. [39] A. Lempel and J. Ziv. On the complexity of finite sequences. IEEE Transactions on Information Theory, 22(1):75 -- 81, 1976. [40] U. Manber and G. Myers. Suffix arrays: a new method for on-line string searches. SIAM Journal on Computing, 22(5):935 -- 948, 1993. [41] S. Muthukrishnan. Efficient algorithms for document retrieval problems. In Proc. 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 657 -- 666, 2002. [42] G. Navarro. A self-index on Block Trees. In Proc. 24th International Symposium on String Processing and Information Retrieval (SPIRE), LNCS 10508, pages 278 -- 289, 2017. [43] T. Nishimoto, T. I, S. Inenaga, H. Bannai, and M. Takeda. Dynamic index and LZ factorization in compressed space. In Proc. Prague Stringology Conference (PSC), pages 158 -- 170, 2016. [44] T. Nishimoto, T. I, S. Inenaga, H. Bannai, and M. Takeda. Fully dynamic data structure for LCE queries in compressed space. In Proc. 41st International Symposium on Mathematical Foundations of Computer Science (MFCS), pages 72:1 -- 72:15, 2016. [45] M. Patra¸scu and M. Thorup. Time-space trade-offs for predecessor search. In Proc. 38th Annual ACM Symposium on Theory of Computing (STOC), pages 232 -- 240, 2006. [46] M. Ruzi´c. Constructing efficient dictionaries in close to sorting time. In Proc. 35th International Colloquium on Automata, Languages and Programming (ICALP), pages 84 -- 95, 2008. [47] W. Rytter. Application of Lempel-Ziv factorization to the approximation of grammar-based compression. Theoretical Computer Science, 302(1-3):211 -- 222, 2003. [48] H. Sakamoto. A fully linear-time approximation algorithm for grammar-based compression. Journal of Discrete Algorithms, 3(24):416 -- 430, 2005. 21 [49] J. A. Storer and T. G. Szymanski. Data compression via textual substitution. Journal of the ACM, 29(4):928 -- 951, 1982. [50] P. Weiner. Linear pattern matching algorithms. In Proc. 14th Annual Symposium on Switching and Automata Theory, pages 1 -- 11, 1973. [51] D. E. Willard. Examining computational geometry, van Emde Boas trees, and hashing from the perspective of the fusion tree. SIAM Journal on Computing, 29(3):1030 -- 1049, 2000. 22
1512.09002
1
1512
2015-12-30T16:36:17
The Bounded Edge Coloring Problem and Offline Crossbar Scheduling
[ "cs.DS" ]
This paper introduces a variant of the classical edge coloring problem in graphs that can be applied to an offline scheduling problem for crossbar switches. We show that the problem is NP-complete, develop three lower bounds bounds on the optimal solution value and evaluate the performance of several approximation algorithms, both analytically and experimentally. We show how to approximate an optimal solution with a worst-case performance ratio of $3/2$ and our experimental results demonstrate that the best algorithms produce results that very closely track a lower bound.
cs.DS
cs
The Bounded Edge Coloring Problem and Offline Crossbar Scheduling Jonathan Turner WUCSE-2015-07 Abstract This paper introduces a variant of the classical edge coloring prob- lem in graphs that can be applied to an offline scheduling problem for crossbar switches. We show that the problem is NP-complete, develop three lower bounds bounds on the optimal solution value and evaluate the performance of several approximation algorithms, both analytically and experimentally. We show how to approximate an optimal solution with a worst-case performance ratio of 3/2 and our experimental results demonstrate that the best algorithms produce results that very closely track a lower bound. 1 v 2 0 0 9 0 . 2 1 5 1 : v i X r a 1 Introduction An instance of the bounded edge coloring problem is an undirected graph G = (V, E) with a positive integer bound b(e) for each edge e. A bounded edge coloring is a function c, from the edges to the positive integers, with c(e) ≥ b(e) for all edges e and c(e1) (cid:54)= c(e2) for all edge pairs e1 and e2 that have an endpoint in common. The objective of the problem is to find a coloring in which the largest color is as small as possible. An example is shown in Figure 1; the first number labelling each edge is its bound, while the second is a valid color. In this paper, we focus on a restricted version of the problem in which the graph is bipartite, with the vertices divided between inputs and outputs. 1 Figure 1: Example of bounded edge coloring We also are usually interested in graphs where the bounds on the edges incident to each input are unique; we refer to this as the unique input bounds condition. An example of a graph that satisfies the unique input bounds condition is shown in Figure 2. The right side of the figure shows a tabular representation of the graph, where each row corresponds to an input, each column corresponds to an output and each integer denotes an edge and its bound. Note that this graph requires colors [1 . . . 5]. The bounded edge coloring problem is an abstraction of an offline version of the crossbar scheduling problem. In this application, the graph's vertices represent the inputs and outputs of a crossbar switch, while the edges rep- resent packets to be transferred from inputs to outputs. The edge bounds represent the arrival times of the packets and the colors represent the times at which packets are transferred from inputs to outputs. Since an input can only receive one packet at each time step, the inputs naturally satisfy the unique input bounds condition. The objective of the problem is to transfer all packets across the crossbar in the smallest possible amount of time. The crossbar scheduling problem has been studied extensively in the on- line context, using several distinct performance criteria. For so-called input queued switches, the focus has been on ensuring bounded waiting times in systems subjected to random input traffic. Many scheduling algorithms have been shown to meet this objective [6, 7, 8]. More compelling, worst-case re- sults have been shown for combined input and output queued switches, in which the crossbar is capable of transferring packets somewhat faster than 2 a c e b d 2,3 2,2 1,1 1,2 2,4 1,1 3,3 Figure 2: Bipartite instance that satisfies the unique input bounds condition they can arrive at the inputs, or be transmitted from the outputs. Some scheduling algorithms can match the performance of an idealized output- queued switch when the crossbar is twice as fast as the inputs and out- puts [1, 4, 5]. In section 2, we show that the bounded edge coloring problem is NP- complete. In section 3 we derive several lower bounds on the number of colors required, and introduce a class of graphs which require substantially more colors than implied by the weaker of our lower bounds. In section 4, we describe several algorithms and establish worst-case performance ratios for some. Experimental performance results appear in section 5. 2 Complexity of Bounded Edge Group Coloring For the ordinary edge coloring problem, we can color any bipartite graph with colors [1 . . . ∆], where ∆ is the maximum vertex degree [2]. Unfortunately, the bounded edge coloring problem is NP-complete. We can show this, using a reduction from the partial edge coloring completion problem for bipartite graphs. In this problem, we are given a bipartite graph with some of its edges colored, and are asked to complete the coloring using no color larger than a given integer k. This is a generalization of the partial latin squares completion problem shown to be NP-complete in [3]. 3 w x y z a 1 3 4 b 3 2 c 4 3 2 1 d 1 2 a c w b d 1 3 4 1 x y z 3 4 1 2 2 2 3 Figure 3: Reduction from edge coloring completion to bounded edge coloring Let G = (V, E) be a bipartite graph, with partial coloring c, using colors 1, . . . , k. We construct a second bipartite graph H = (W, F ) where W in- cludes all vertices in V , plus some additional vertices to be specified shortly. Each uncolored edge in E is included in F and is assigned a lower bound of 1. Each edge in E that is colored k is included in F and assigned a lower bound of k. For each edge in E that is colored k − 1, we include a chain of three edges, with the inner edge assigned a lower bound of k, while the outer two edges are assigned lower bounds of k − 1. For each edge in E that is colored k − i, for i > 1, we include a similar component with two additional vertices, two "outer" edges and i parallel edges joining the two added vertices. The outer edges are assigned lower bounds of k− i, while the inner edges are assigned lower bounds of k− i + 1, . . . , k. The construction of the chains guarantees that in any valid k-coloring of H, the outer edges are assigned the same color that the corresponding edge was assigned in G. The uncolored edges in G are free to use any color in 1, . . . , k. This construction is illustrated in Figure 3 for the case of k = 3. It's straightforward to show that the partial coloring of G can be completed using colors 1, . . . , k if and only if H can be colored using colors 1, . . . , k. Unfortunately, while this reduction does show that bounded edge color- ing is NP-complete, the graph H does not satisfy the unique input bounds condition. To show that instances that satisfy this condition are also hard to solve, we need to use a more elaborate reduction. The new reduction 4 a c x b 1 y 3 z 2 a c x b 1 y 3 z 2 2 3 1 3 2 1 1 1 1 starts with the graph H constructed above, and then adds 2k to the lower bounds specified earlier for the components constructed to handle the pre- colored edges in the original partial edge coloring instance. For edges that are uncolored in G and incident to an input u, the corresponding edges in H are assigned distinct lower bounds in the range k + 1, . . . , 2k. We then attach an additional component to u that has the effect of forcing these edges to have colors larger than 2k. This construction is illustrated in Figure 4. This component has two groups of parallel edges joining a pair of vertices Figure 4: Additional component for each input to the original input u; these edge groups are each assigned lower bounds of 1, . . . , k. There are two other groups joining additional leaf vertices to the first two vertices. One group of "leaf edges" has lower bounds of k +1, . . . , 3k and must be assigned colors equal to their bounds in any valid coloring with a maximum color of 3k. The other has bounds 2k + 1, . . . , 3k and must also be assigned colors equal to their bounds in any valid coloring with a maxi- mum color of 3k. This means that the k parallel edges incident to u must be assigned colors k + 1, . . . , 2k and this is in turn forces the edges that were uncolored in G to have colors larger than 2k in the modified version of H. Figure 5 shows the final version of H, for the example in Figure 3. Observe that all input vertices in the final version of H do in fact have unique lower bounds. It's straightforward to show that the final version of H can be col- ored using colors 1, . . . , 3k if and only if G's coloring can be completed using colors 1, . . . , k. 5 3k u k+1 1 k 2k+1...3k k+1 ... ... 1 k ... k+i ... u 1 1 ... i unconstrained edges Figure 5: Extension of example in Figure 3 3 Lower Bounds In this section, we present several methods to compute lower bounds on the maximum edge color used by an instance of the bounded edge-coloring problem. The first is referred to as the degree bound. Before describing it, we need a few definitions. For any vertex u in a graph G, let δG(u) denote the number of edges incident to u (the vertex degree) and let ∆G = maxu δG(u). If G is an instance of the bounded edge coloring problem, we let Gk be the subgraph of G containing edges with bounds ≥ k and we let Gk be the subgraph containing edges with bounds ≤ k. Observe that if a vertex u has d edges with bounds ≥ c, then some edge incident to u must be assigned a color ≥ c + d − 1. Consequently, for any k, the number of colors needed to color Gk is at least k + ∆Gk − 1. The degree bound for G is denoted D(G) and defined by D(G) = maxk k + ∆Gk − 1. For the graph in Figure 2, D = 5 and this graph can be colored using colors 1, . . . , 5. Some graphs require more than D colors. Figure 6 shows a graph 6 a c x b 7 y 9 z 8 8 9 7 8 4 5 4 4 9 1 3 2 1 3 2 4 6 5 7 9 8 7 9 8 1 3 2 1 3 2 4 6 5 7 9 8 7 9 8 1 3 2 1 3 2 4 6 5 7 9 8 7 9 8 Figure 6: D colors are not always enough (top table shows edge bounds, bottom shows colors in an optimum coloring) (in the tablular format) with D = 4 that requires five colors (an optimal coloring is shown in the second table). The graph in Figure 6 is actually a special case of a class of graphs that require substantially more than D colors. The graph Bn has inputs u1, . . . , un and outputs v1, . . . , v2n−1. For 1 ≤ i ≤ n, 1 ≤ j ≤ i, there is an edge (ui, vj) with bound j, and for each 1 ≤ i < n, i < j ≤ n, there is an edge (ui, vn+i) with bound j. Figure 7 shows the case of B7, along with a coloring using nine colors. Note that in general, DBn = n. Our second lower bound is obtained by computing a sequence of match- ings. Observe that for any integer k, the edges of G that are colored k must form a matching in Gk. If we let mk be the number of edges in a maximum size matching of Gk, then m1 + m2 + ··· + mk is an upper bound on the number of edges that can be assigned colors in 1, . . . , k. If this sum is less than the number of edges in G, then G requires more than k colors. So, 7 e f g h i j k a 1 2,3,4 b 1 2 3,4 c 1 2 3 4 d 1 2 3 4 e f g h i j k a 5 2,3,4 b 1 5 3,4 c 2 3 5 4 d 4 2 3 5 Figure 7: Graph B7 and a valid edge coloring using colors 1, . . . , 9 if we let M (G) be the smallest integer k for which m1 + m2 + ··· + mk is greater than or equal to the number of edges in G, then M (G) is a lower bound on the number of colors required to color G. We refer to M as the matching bound. For the graph B4 in Figure 6, the sequence of matching sizes is 1, 3, 4, 4, 4 and consequently, M = 5. For the graph B7 in Figure 7, the sequence of matching sizes is 1, 3, 5, 7, 7, 7, 7, 7, 7 and M = 9. It's not difficult to show that in general, the matching bound for Bn is (cid:100)5n/4(cid:101). Now, we turn to our third lower bound. Let G = (V, E) be a bipartite graph with edge bounds b(e) and let c be a valid coloring of G using colors 1, . . . , C. Let Hk be the subgraph of G that is colored using colors 1, . . . , k 8 A B C D E F G H I J K L M a 1 2-7 b 1 2 3-7 c 1 2 3 4-7 d 1 2 3 4 5-7 e 1 2 3 4 5 6-7 f 1 2 3 4 5 6 7 g 1 2 3 4 5 6 7 A B C D E F G H I J K L M a 9 2-7 b 8 9 3-7 c 2 8 9 4-7 d 1 2 8 9 5-7 e 3 4 5 8 9 6-7 f 6 3 4 5 8 9 7 g 7 6 3 4 5 8 9 and let Jk be the subgraph of G that is colored using colors k + 1, . . . , C. Note that Hk is a subgraph of Gk, DHk ≤ k and ∆Jk ≤ C − k. So, for any k, it is possible to split G into two subgraphs that have these properties. Now, let C(cid:48) be an integer smaller than C and note that if there is some k, for which we cannot split G into subgraphs Hk and Jk with Hk a subgraph of Gk, DHk ≤ k and ∆Jk ≤ C(cid:48) − k, then G cannot be colored using only colors 1, . . . , C(cid:48). This leads to a lower bound on the number of colors needed to color a given graph. To make this bound useful, we need an efficient way to partition G into subgraphs Hk and Jk for given integers k and C. This can be done by solving a network flow problem. Let Fk,C be a flow graph that includes a source vertex s, a sink vertex t and a chain of vertices for each vertex in Gk. Specifically, for each input u in Gk, Fk,C contains a chain consisting of vertices ui for each i ∈ {1, . . . , k} and edges (ui, ui+1) with capacity k − i. There is also an edge from s to u1 with capacity k. For each output v in Gk, Fk,C contains a chain consisting of vertices vi for each i ∈ {1, . . . , k} and edges (vi+1, vi) with capacity k − i. There is also an edge from v1 to t with capacity k. For each edge (u, v) in Gk with bound i, F contains an edge (ui, vi) of capacity 1. We refer to this last set of edges as the core edges of Fk,C. Observe that the subset of the core edges that have positive capacity in any integer flow on Fk,C correspond to a subgraph of Gk that has a degree bound D that is no larger than k. To complete the construction of Fk,C, we specify minimum flow requirements for the edges incident to s and t. In particular, for input u of G, the edge (s, u1) is assigned a minimum flow of min{0, δG(u) − (C − k)}. Similarly, for output v of G, the edge (v1, t) is assigned a minimum flow of min{0, δG(v) − (C − k)}. Given an integer flow on Fk that satisfies the minimum flow requirements, we define Hk to consist of those edges in G that correspond to core edges that have positive flow. We define Jk to include the remaining edges in G. It is straightforward to show that Hk is a subgraph of Gk, DHk ≤ k and ∆Jk ≤ C − k. If there is no integer flow on Fk that satisfies the minimum flow requirements, then G cannot be colored using only colors 1, . . . , C. Figure 8 shows the graph B4 and the corresponding flow graph F2,5. There is an integer flow for F2,5 that uses the edges that are emphasized in 9 Figure 8: Graph B4 and corresponding flow graph F2,5 "bold" and satisfies all the minimum flow requirements. The edges of B4 that correspond to the bold core edges are also emphasized in bold. These edges define the graph H2, while the remaining edges define J2. Note that DH2 = 2 and ∆J2 = 3. The flow bound for G is denoted by PG and is defined as the smallest value of C for which Fk,C has a flow that satisfies the minimum flow requirements, for all values of k ∈ [1, bmax], where bmax is the largest edge bound in G. The flow bound for B8 is 11, while the matching bound is 10. This gap increases for larger graphs. For example, B64 has a matching bound of 80 and a flow bound of 83, while B256 has a matching bound of 320 and a flow bound of 331. We close this section by describing a general method for coloring graphs Bn using colors 1, . . . , n + (cid:100)(n − 1)/3(cid:101). For B64 the largest color is 85, for B256 the largest color is 341. Figure 9 illustrates the method for coloring Bn. The top part of the figure shows the coloring given earlier for B7, with several regions of the table highlighted. Note that each of the four highlighted regions uses a distinct set of colors and each color used is repeated along a 10 c A b d 1 3 B C D 2 4 1 E F G 1 1 2 2 3 3 2 4 a a1 c1 A1 b1 d1 B1 1,0 E1 1,0 1,0 1,0 a2 c2 A2 b2 d2 B2 E2 s t 1,0 2,1 2,1 2,1 2,1 2,1 2,0 2,0 1,0 1,0 1,0 1,0 1,0 1,0 1,0 1,0 1,0 1,0 capacity, min flow 4 3 4 Figure 9: General method for coloring Bn diagonal within the region. The edges incident to the outputs H, . . . , M are assigned colors equal to their bounds. The bottom part of the figure shows how the colors of the edges incident to the first n outputs are assigned in the general case, using a parameter x = (cid:100)(n − 1)/3(cid:101). Again, we divide the table definining the edges into four regions and assign disjoint sets of colors to those regions. Within each region, colors are used repeatedly along diagonals. The edges incident to the last n − 1 outputs are assigned colors equal to their bounds. The choice of x ensures that the assignment of colors to edges yields a legal coloring of the graph that respects all the edge bounds. 11 n+1,n+x 1,x x+1,2x+1 2x+2,n A B C D E F G H I J K L M a 9 2-7 b 8 9 3-7 c 2 8 9 4-7 d 1 2 8 9 5-7 e 3 4 5 8 9 6-7 f 6 3 4 5 8 9 7 g 7 6 3 4 5 8 9 4 Approximate algorithms In this section, we describe several approximate algorithms for the bounded edge coloring problem and analyze their worst-case performance. Let G = (V, E) be a graph with edge bounds b(e) and let C∗(G) be the largest color value used by an optimal solution. We start with a very simple method that produces solutions with a max- imum color ≤ 2C∗. Let bmax be the largest color bound used by an instance of the bounded edge coloring problem and let ∆ be the maximum vertex de- gree. Using any method for the ordinary edge coloring problem, we can color the edges using colors bmax, . . . , bmax+∆−1 and since C∗ ≥ max{bmax, ∆}, the largest color used by this solution is < 2C∗. We can get a better approximation by first spliting G into two subgraphs and coloring each of the subgraphs separately. Consider an optimal coloring of G and let Hk be the subgraph defined by the edges with colors ≤ k. Note that Hk is a subgraph of Gk and that ∆Hk ≤ k. If we let Jk be the subgraph of G defined by the edges with colors > k, then ∆Jk ≤ C∗ − k. So an optimal coloring must be divisible into a pair of subgraphs that satisfy these inequalities. Note that we can color Hk using colors k, . . . , 2k− 1 using any algorithm for the ordinary edge coloring problem. We can also color Jk using colors bmax, . . . , bmax + C∗ − (k + 1). So long as 2k − 1 < bmax, these two sets of colors do not overlap meaning that we can color the entire graph using colors k, . . . , bmax + C∗ − (k + 1). If we let k = (cid:98)bmax/2(cid:99), the largest color is ≤ (bmax/2) + C∗ ≤ (3/2)C∗. In order to construct an approximation algorithm based on this obser- vation, we need a way to split G into subgraphs Hk and Jk. This can be done by solving the same flow problem that was used in the flow lower bound computation. Alternatively, we can simplify the flow problem by collapsing each of the input-side chains u1, . . . , uk into a single vertex u and each of the output-side chains v1, . . . , vk into a single vertex v. Thus, we can efficiently color any graph G using colors ≤ (3/2)C∗. We'll refer to this as the splitting method. Our next algorithm is a simple greedy algorithm that repeats the follow- ing step until all edges are colored. 12 Select an edge e = (u, v) and let c be the smallest color that is at least as large as b(e) and is not yet in use at both u and v. We select edges that are incident to a vertex of maximum degree in the uncolored subgraph. While we have no worst-case-performance bound for this algorithm, in pactice it out-performs the splitting method, as we will see in the next section. Now, we consider an algorithm based on the classical augmenting path algorithm for the ordinary edge coloring problem. For the bounded edge coloring problem, a path p is an ij-augmenting path if its edges alternate in color between i and j, it cannot be extended any further at either of its endpoints and every edge in the path has a bound that is ≤ min{i, j}. The augmenting path algorithm for the bounded edge coloring problem colors the edges by repeatingly selecting an edge e = (u, v) and then applying the first case from the following list that applies. • If there is some eligible color that is unused at both endpoints, color e with one such color. • If there are eligible colors i and j, where i is available at u and j is available at v, and there is an ij-augmenting path starting at v, then reverse the colors of the edges on the path and and let c(e) = i. • If there are eligible colors i and j, where i is available at u and j is available at v, and there is a ji-augmenting path starting at u, then reverse the colors of the edges on the path and let c(e) = j. • Allocate a new eligible color and use it to color e. Initially, colors 1, . . . , bmax are eligible. New colors are allocated sequentially, as needed. We select edges that are incident to a vertex of maximum degree in the uncolored subgraph. When selecting colors, we give preference to colors with smaller values. In the first case, we select the smallest eligible color that is unused at both endpoints. In the second and third cases, we select color pairs i and j that minimize max{i, j}. Since the augmenting path algorithm for the ordinary edge-coloring prob- lem uses ∆ colors, this version colors uses no color larger than bmax + ∆− 1. 13 We can also use it to color the subgraphs in the splitting method to obtain an algorithm that uses no color larger (bmax/2) + C∗. Next, we consider algorithms based on constructing a series of match- ings. The first such algorithm starts by initializing k = 1 then repeating the following step so long as there are uncolored edges. Find a maximum size matching on the uncolored edges in Gk, assign color k to all edges in the matching, then increment k. We refer to this as the maximum size matching algorithm. We can improve it by selecting matchings that maximize the number of matched vertices that have maximum degree in the uncolored subgraph. This can be done using an algorithm described in [10]. This version of the matching algorithm is called the maximum degree matching algorithm. Reference [10] also shows how to find maximum size matchings that maximize a general priority score based on arbitrary integer priorities assigned to the vertices. Our third matching algorithm uses this method. Priorities are assigned in decreasing order of vertex degree in the uncolored subgraph. So, vertices of maximum degree are assigned priority 1, those with the next largest degree are assigned priority 2 and so forth. We refer to this version of the matching algorithm as the priority matching algorithm. The last two of the matching algorithms use no color larger bmax + ∆ − 1. Also, like the augmenting path algorithm, they can be used with the splitting method to obtain an algorithm that uses no color larger (bmax/2) + C∗. 5 Experimental Evaluation In this section, we evaluate the performance of the algorithms introduced in the last section, experimentally. We start, by evaluating the performance using random graphs that are generated using the following procedure. • Generate a random regular bipartite graph, with n inputs, n outputs and all vertices having degree ∆. • At each input, assign the incident edges a unique random color in 1, . . . , bmax, where bmax ≥ ∆ 14 Figure 10: Performance results for random instances This produces a random problem instance that satisfies the unique input bounds condition. Figure 10 shows results for graphs on 100 vertices where the vertex degree is varied from 5 to 50 and bmax = ∆+3. The y-axis displays the difference between the maximum color used and the vertex degree. Each data point shows the average from ten random problem instances. Error bars have been omitted for clarity, but the relative error was generally less than 2%. The lowest curve shows the results for the flow lower bound and the priority matching algorithm (for these graphs, the priority matching algo- rithm always produced results equal to the bound). The maximum degree matching algorithm was almost identical to the priority matching algorithm, but did occasionally exhibit small differences. The maximum size matching algorithm was not quite as good as the other two. The greedy and augment- ing path algorithms also produced perfectly respectable results, generally exceeding the largest color used by the priority matching algorithm by less than 5%. Figure 11 shows performance results for the graphs Bn. Here the max degree and priority match algorithms generally use just 2 or 3 more colors than the number given by the flow lower bound. The maximum size match- 15 split priority match and flow lower bound max degree match max size match greedy augmenting path random n=100 Figure 11: Performance results for Bn ing algorithm performs less well in this case, actually under-performing the augmenting path algorithm. The algorithms described here are all available as part of an open-source library of graph algorithms and data structures [9]. 6 Closing Remarks The bounded edge-coloring problem is a natural generalization of the ordi- nary edge-coloring problem and interesting in its own right, independent of its application to the crossbar scheduling problem. There is a considerable gap between the best worst-case performance ratio achieved by our algo- rithms and the experimental performance measurements. Closing that gap is the main open problem to be addressed. It's worth noting that most of our algorithms can be applied to general graphs, as well as bipartite graphs. It would be interesting to understand how they perform in this context. Unfortunately, the flow lower bound cannot be applied to general graphs, although the degree bound and matching bound can be. While our results do not apply directly to the online version of the cross- 16 split flow lower bound max degree match and priority match max size match greedy augmenting path bad case bar scheduling problem, there is potential for extending them to make them more applicable. For example, one can model systems in which the crossbars operate at faster speeds than the inputs and outputs by restricting the values allowed as edge bounds. This can be used to derive a lower bound on the "speedup ratio" needed to match the performance of an ideal output-queued switch. References [1] Attiya, H., D. Hay and I. Keslassy. "Packet-Mode Emulation of Output- Queued Switches," Proc. of ACM SPAA, 2006. [2] Bondy, J. A. and U. S. R. Murty. Graph Theory and Applications, Elsevier North Holland, 1976. [3] Colburn, Charles. "The complexity of completing partial latin squares," Discrete Applied Mathematics 8 (1984), pp. 25-30. [4] Chuang, S.-T. A. Goel, N. McKeown, B. Prabhakar "Matching output queueing with a combined input output queued switch," IEEE J. on Selected Areas in Communications, 12/1999. [5] Krishna, P., N. Patel, A. Charny and R. Simcoe. "On the speedup required for work-conserving crossbar switches," IEEE J. Selected Areas of Communications, 6/1999. [6] Leonardi, E., M. Mellia, F. Neri, and M.A. Marsan, "On the stability of input-queued switches with speed-up," IEEE/ACM Transactions on Networking, Vol. 9, No. 1, pp. 104 -- 118, 2/2001. [7] McKeown, N. "iSLIP: a scheduling algorithm for input-queued switches," IEEE Trans. on Networking, 4/1999. [8] McKeown, N., A. Mekkittikul, V. Anantharam, and J. Walrand. "Achieving 100% Throughput in an Input-Queued Switch," IEEE Trans. on Communications, Vol. 47, No. 8, 8/1999. 17 [9] Turner, Jonathan. "Grafalgo - a library of graph algorithms and sup- porting data structures," Washington University Department of Com- puter Science and Engineering, wucse-2015-01, 1/2015. [10] Turner, Jonathan. "Maximum priority matchings," Washington Univer- sity Department of Computer Science and Engineering, wucse-2015- 06, 11/2015. 18
1711.00599
1
1711
2017-11-02T02:46:56
Optimal Parametric Search for Path and Tree Partitioning
[ "cs.DS" ]
We present linear-time algorithms for partitioning a path or a tree with weights on the vertices by removing $k$ edges to maximize the minimum-weight component. We also use the same framework to partition a path with weight on the vertices, removing $k$ edges to minimize the maximum-weight component. The algorithms use the parametric search paradigm, testing candidate values until an optimum is found while simultaneously reducing the running time needed for each test. For path-partitioning, the algorithm employs a synthetic weighting scheme that results in a constant fraction reduction in running time after each test. For tree-partitioning, our dual-pronged strategy makes progress no matter what the specific structure of our tree is.
cs.DS
cs
Optimal Parametric Search for Path and Tree Partitioning Greg N. Frederickson∗ Samson Zhou† November 3, 2017 Abstract. We present linear-time algorithms for partitioning a path or a tree with weights on the vertices by removing k edges to maximize the minimum-weight component. We also use the same framework to partition a path with weight on the vertices, removing k edges to minimize the maximum-weight component. The algorithms use the parametric search paradigm, testing candidate values until an optimum is found while simultaneously reducing the running time needed for each test. For path-partitioning, the algorithm employs a syn- thetic weighting scheme that results in a constant fraction reduction in running time after each test. For tree-partitioning, our dual-pronged strategy makes progress no matter what the specific structure of our tree is. Key words and phrases. Adaptive algorithms, data structures, max-min, min-max, para- metric search, partial order, path partitioning, prune-and-search, sorted matrices, tree par- titioning. 7 1 0 2 v o N 2 ] S D . s c [ 1 v 9 9 5 0 0 . 1 1 7 1 : v i X r a ∗Supported in part by the National Science Foundation under grants CCR-86202271 and CCR-9001241, †Research supported by NSF CCF-1649515. Email: [email protected] and by the Office of Naval Research under contract N00014-86-K-0689. 1 1 Introduction Parametric search is a powerful technique for solving various optimization problems [1, 4, 5, 6, 9, 10, 11, 13, 15, 16, 17]. To solve a given problem by parametric search, one must find a threshold value, namely a largest (or smallest) value that passes a certain feasibility test. In general, we must identify explicitly or implicitly a set of candidate values, and search the set, choosing one value at a time upon which to test feasibility. As a result of the test, we discard from further consideration various values in the set. Eventually, the search will converge on the optimal value. In [13], Megiddo emphasized the role that parallel algorithms can play in the implemen- tation of such a technique. In [5], Cole improved the time bounds for a number of problems addressed in [13], abstracting two techniques upon which parametric search can be based: sorting and performing independent binary searches. Despite the clever ideas elaborated in these papers, none of the algorithms presented in [13, 5] is known to be optimal. In fact, rarely have algorithms for parametric search problems been shown to be optimal. (For one that is optimal, see [6].) In at least some cases, the time required for feasibility testing matches known lower bounds for the parametric search problem. But in the worst case, Ω(log n) values must be tested for feasibility, where n is the size of the input. Is this extra factor of at least log n necessary? For several parametric search problems on paths and trees, we show that a polylogarithmic penalty in the running time can be avoided, and give linear-time (and hence optimal) algorithms for these problems. We consider the max-min tree k-partitioning problem [14]. Let T be a tree with n vertices and a nonnegative weight associated with each vertex. Let k < n be a given positive integer. The problem is to delete k edges in the tree so as to maximize the weight of the lightest of the resulting subtrees. Perl and Schach introduced an algorithm that runs in O(k2rd(T ) + kn) time, where rd(T ) is the radius of the tree [14]. Megiddo and Cole first 1 considered the special case in which the tree is a path, and gave O(n(log n)2)-time and O(n log n)-time algorithms, resp., for this case.1 (Megiddo noted that an O(n log n)-time algorithm is possible, using ideas from [9].) For the problem on a tree, Megiddo presented an O(n(log n)3)-time algorithm [13], and Cole presented an O(n(log n)2)-time algorithm [5]. The algorithm we present here runs in O(n) time, which is clearly optimal. A closely related problem is the min-max path k-partitioning problem [2], for which we must delete k edges in the path so as to minimize the weight of the heaviest of the resulting subpaths. Our techniques yield linear-time algorithms for both versions of path-partitioning and for max-min tree k-partitioning problem. Our approach is less convoluted than that in [7, 8], and thus its analysis should be more amenable to independent confirmation and publication. We believe that this paper provides for the full acknowledgement of linear time algorithms for these particular problems. Our results are a contribution to parametric search in several ways beyond merely pro- ducing optimal algorithms for path and tree partitioning. In contrast to [8], we introduce synthetic weights on candidate values or groups of candidate values from a certain implicit matrix. We use weighted selection to resolve the values representing many shorter paths before the values for longer paths, enabling future feasibility tests to run faster. We also use unweighted selection to reduce the size of the set of candidate values so that the time for selecting test values does not become an obstacle to achieving linear time. Our parametric search on trees reduces feasibility test time across subpaths, while simul- taneously also pruning paths that have no paths that branch off of them. To demonstrate progress, we identify an effective measure of current problem size. Surprisingly, the num- ber of vertices remaining in the tree seems not to be so helpful, as is also the case for the number of candidate values. Instead, we show that the time to perform a feasibility test actually is effective. Our analysis for tree partitioning captures the total progress from the 1All logarithms are to the base 2. 2 beginning of the algorithm, not necessarily between consecutive rounds, as was the case for the path-partitioning problem. Thus it seems necessary to have a dual-pronged strategy to simultaneously compress the search structure of paths and also prune paths that end with a leaf. We organize our paper as follows. In Section 2 we discuss features of parametric search, and lay the foundation for the optimal algorithms that we describe in subsequent sections. In Section 3 we present our approach for solving both the min-max and the max-min par- titioning problem on a path. In Section 4 we build on the results in Section 3 and present our approach for optimally solving the max-min partitioning problem on a tree. 2 Paradigms for parametric search In this section we discuss features of parametric search, and lay the foundation for the optimal algorithms that we give in subsequent sections. We first review straightforward feasibility tests to test the feasibility of a search value in a tree. We then review how to represent all possible search values of a path within a "sorted matrix". We next present a general approach for search that uses values from a collection of sorted matrices. Finally, we describe straightforward approaches for the path and the tree that are as good as any algorithms in [13, 5]. We first describe straightforward feasibility tests for cutting edges in a tree so as to max- imize the minimum weight of any resulting component (max-min problem). The feasibility test takes a test value λ, and determines if at least k cuts can be placed in the tree such that no component has weight less than λ. We take λ∗ to be the largest value that passes the test. A straightforward test for the max-min problem in a tree is given in [13], and the feasibility test for the min-max problem is similar [12]. We focus first on max-min, using an algorithm 3 FTEST0, which starts by rooting the tree at a vertex of degree 1 and initializing the number of cuts, numcut, to 0. It next calls explore(root) to explore the tree starting at the root. When the exploration is complete, if numcut > k, then λ is a lower bound on λ∗, and otherwise λ is an upper bound on λ∗. The procedure explore is: proc explore (vertex v) accum wgt(v) ← weight of v for each child w of v do explore(w ) endfor Adjust accum wgt(v) and numcut. For the max-min problem, we adjust accum wgt(v) and numcut by: for each child w of v do Add accum wgt(w) to accum wgt(v). endfor if accum wgt(v) ≥ λ then numcut ← numcut + 1 accum wgt(v) ← 0 endif In all but one case, we cut an edge in the tree whenever we increment numcut by 1. For the max-min problem, we generally cut the edge from the current vertex v to its parent except for the last increment of numcut in FTEST0. This is because either v will be the root and thus does not have a parent, or the fragment of the tree above v will have total weight less than λ. By not adjusting numcut to reflect the actual number of cuts in this case, we are able to state the threshold test for both versions of FTEST0 in precisely the same form. The feasibility test takes constant time per vertex, and thus uses O(n) time. In a parametric search problem, the search can be restricted to considering values from a finite set of values. The desired value is the largest (in the case of a max-min problem) or the smallest (in the case of a min-max problem) that passes the feasibility test. Let each value in the finite set be called a candidate value. We next discuss a data structure that contains all candidate values for problems on just a path. This structure is based on ideas in [9] and [10]. Let a matrix be called a sorted matrix if for every row the values are in nondecreasing 4 order, and for every column the values are in nonincreasing order. (Note that for notational convenience, this definition varies slightly from the definition in [9].) Let the vertices on the path P be indexed from 1 to n. The set of values that we need to search is the set of sums of weights of vertices from i to j, for all pairs i ≤ j. We succinctly maintain this set of values, plus others, in a data structure, the succinct description. For i = 0, 1,··· , n, let Ai be the sum of the weights of vertices 1 to i. Note that for any pair i, j with i ≤ j, the sum of the weights from vertex i to j is Aj − Ai−1. Let X1 be the sequence of sums A1, A2,··· , An, and let X2 be the sequence of sums A0, A1,··· , An−1. Then sorted matrix M (P ) is the n× n Cartesian matrix X1 − X2, where the ij-th entry is Aj − Ai−1. In determining the above, we can use proper subtraction, in which, a − b gives max{a − b, 0}. Clearly, the values in any row of M (P ) are in nondecreasing order, and the values in any column of M (P ) are in nonincreasing order. Representing M (P ) explicitly would require Θ(n2) time and space. Thus, our data structure succinctly represents M (P ) (and hence, P ) in O(n) space by the two vectors X1 and X2. In general, our algorithm also needs to inspect specific subpaths of P . However, repeat- edly copying subvectors of X1 and X2 can take more than linear time in total. On the other hand, for a subpath Q of P , the corresponding matrix M (Q) is a submatrix of M (P ), which we can recover from the succinct representation of P . Thus, our algorithm succinctly represents M (Q) by the start and end indices of M (Q) within M (P ). In this way, we can generate the values of M (Q) from the vectors X1 and X2 of M (P ), as well as the location of the submatrix as given by the succinct representation of Q. Therefore, our algorithm avoids needlessly recopying vectors and instead generates in O(n) total time the succinct representations of all subpaths that it may inspect. As an example, we show a vertex-weighted path P in Fig. 1, and its associated matrix M (P ). We list the sequence X1 horizontally above M (P ), and the sequence X2 vertically to the left of M (P ), in such a way that the ij-th element of M (P ) is beneath the j-th element 5 of X1 and to the right of the i-th element of X2. We next describe the general form PARAM SEARCH of all of our searching algorithms. It is related to, and uses some of the ideas in, algorithms found in [5], [9], [10], and [13]. By specifying the specific subroutines INIT MAT, TEST VAL, UPDATE MAT, we will be able to give four versions of PARAM SEARCH, namely PATH0, TREE0, PATH1, and TREE1. In all four versions, PARAM SEARCH takes as its arguments an integer k and either a vertex-weighted path or a tree. It initializes searching bounds λ1 and λ2, where λ1 < λ2. The algorithm progressively narrows these bounds until they satisfy the following conditions by the end of the algorithm. For a max-min problem, λ1 is the largest value that is feasible, and λ2 is the smallest value that is not feasible. (For a min-max problem, λ1 is the largest value that is not feasible, and λ2 is the smallest value that is feasible.) PARAM SEARCH will use INIT MAT to initialize M, a collection of succinctly rep- resented square sorted matrices, the union of whose values is the set of values that we consider. PARAM SEARCH then performs a series of iterations. On each iteration, it will use TEST VAL to identify and test a small number of values λ drawn from matrices in M. Each value λ will be either the largest or the smallest element in some matrix in M. As a result of the feasibility tests, UPDATE MAT updates M by deleting certain matrices from M, dividing certain matrices into 4 submatrices, and inserting certain matrices into M. Note that in initializing λ2 to ∞, we take ∞ to be any value greater than the total weight of all vertices in the path or the tree. Algorithm PARAM SEARCH λ1 ← 0 λ2 ← ∞ INIT MAT while M is not empty do TEST VAL UPDATE MAT endwhile 6 Output λ1 and λ2. /* For max-min, λ∗ will be the final λ1 and for min-max, λ∗ will be the final λ2. */ In the remainder of this section we describe simple algorithms PATH0 and TREE0 for partitioning a path and a tree, resp. These algorithms match the time of the algorithms in [5], and set the stage for the improved algorithms that we present in the next two sections, in which we introduce data structures that enable faster feasibility tests and strategies that prune the tree quickly. We first describe a simple approach to the max-min problem on a path P . Below are the three routines PATH0 init mat, PATH0 test val, and PATH0 update mat. For a max-min problem, if λ > λ1 and λ is feasible, then we reset λ1 to λ. Otherwise, if λ < λ2 and λ is not feasible, then we reset λ2 to λ. Thus at termination, λ∗ = λ1. (For the min-max problem, we reset λ2 to λ if λ is feasible, and λ1 to λ if λ is not feasible. Thus, at termination, λ∗ = λ2.) On every iteration we split matrices of size greater than 1 × 1 into four smaller submatrices. We assume that the dimension of each sorted matrix is a power of 2. If this is not the case, then we pad out the matrix logically with zeroes. In the following, the notation (λ1, λ2) denotes the open interval of values between λ1 and λ2. We also use R(P ) to denote the representatives whose values are within the interval (λ1, λ2). PATH0 init mat: Implicitly split sorted matrix M (P ) for the path P into four square submatrices. Initialize M to be the set containing these four square submatrices. PATH0 test val: if each submatrix in M contains just 1 element then Let R be the multiset of values in the submatrices. else Let R be the multiset consisting of the smallest and the largest element from each matrix in M. endif for two times do: Let R(cid:48) be the subset of R that contains only values in the interval (λ1, λ2). if R(cid:48) is not empty then Select the median element λ in R(cid:48). if FTEST0(P, k, λ) = "lower(cid:48)(cid:48) (i.e., k < numcuts) then λ1 ← λ 7 else λ2 ← λ endif endif endfor PATH0 update mat: Discard from M any matrix with no values in (λ1, λ2). if each submatrix in M contains more than 1 element then Split each submatrix M in M into four square submatrices, discarding any resulting submatrix with no values in (λ1, λ2). endif The following lemma is similar in spirit to Lemma 5 in [9] and Theorem 2 in [10]. Lemma 2.1 Let P be a path of n > 2 vertices. The number of iterations needed by PATH0 is O(log n), and the total time of PATH0 exclusive of feasibility tests is O(n). Proof We call the multiset of smallest and largest values from each submatrix in M the representatives of M, and we call the subset of representatives that are in (λ1, λ2) the unresolved representatives of M. For iteration i = 1, 2, . . . , log n − 1, let S(i) be the number of submatrices in M, and U (i) be the number of unresolved representatives of M. We first show that S(i) ≤ 7 ∗ 2i+1 − 4i − 8, and U (i) ≤ 3 ∗ 2i+3 − 8i − 14. We prove this by induction on i. The basis is for i = 1. At the beginning of iteration 1, there are 4 submatrices in M and 8 unresolved representatives of M. The first feasibility test resolves at least 4 of these representatives, and the second feasibility test leaves at most 2 unresolved. At most all 4 submatrices remain after discarding. Splitting the submatrices at the end of iteration 1 gives at most 16 submatrices, Note that for i = 1, S(i) ≤ 16 = 7 ∗ 21+1 − 4 − 8 and 32 representatives, at most 32−6 = 26 of which are unresolved. and U (i) ≤ 26 = 3∗16−8−14. Thus the basis is proved. For the induction step, i > 1. By the induction hypothesis S(i − 1) ≤ 7 ∗ 2i − 4i − 4 and U (i−1) ≤ 3∗2i+2−8i−6. Let R(i−1) be the set of representatives of M at the end of iteration 8 i−1. Note that these elements fall on at most 2i+1−1 diagonals of M (P ), since each iteration can only split the existing submatrices into at most four smaller submatrices. The feasibility tests on iteration i will leave u ≤ (cid:98)U (i − 1)/4(cid:99) ≤ 3 ∗ 2i − 2i − 2 representatives unresolved. Let dj be the number of elements of R(i−1) on the j-th diagonal that are unresolved, so that (cid:80) dj = u. Except for possibly the submatrices with the largest and smallest representatives, all other submatrices on the j-th diagonal have two representatives, each in the range (λ1, λ2). Thus, there will be at most (cid:98)(dj + 2)/2(cid:99) submatrices whose representatives are on the j-th 2i+1−1 diagonals of M (P ), there are S(i)/4 ≤(cid:80) diagonal and are not both at most λ1 and not both at least λ2. Then summing over at most j(cid:98)(dj + 2)/2(cid:99) ≤ (u+2i+2−2)/2 submatrices that cannot be discarded at the end of iteration i. There will be 2S(i)/4 − u ≤ 2i+2 − 2 representatives of these submatrices that are resolved. After quartering, there are S(i) ≤ 4∗(u+2i+2−2)/2 ≤ 3∗2i+1−4i−4+2i+3−4 submatrices at the end of iteration i. Simplifying, we have S(i) ≤ 7∗ 2i+1 − 4i− 8. After quartering the submatrices, the number of unresolved representatives of submatrices in M will be U (i) = 2S(i) − (2S(i)/4 − u) = (3/2)S(i) + u ≤ (3/2) ∗ (7 ∗ 2i+1 − 4i − 8) + 3 ∗ 2i − 2i − 2. Simplifying, we have U (i) ≤ 3 ∗ 2i+3 − 8i − 14. This concludes the proof by induction. There will be at most log n − 1 iterations until all submatrices consist of single values. At that point we will have S(log n− 1) ≤ 7∗ 2log n − 4 log n− 8. On each remaining iteration, the number of elements in M will be at least quartered. Thus the total number of iterations is O(log n). The work on iteration i, for i = 1, 2, . . . , log n − 1, will be O(S(i)) = O(2i). Thus the total time on these iterations, exclusive of feasibility testing, will be O((cid:80)log n−1 2i) = O(n). The total time on the remaining iterations will be O(2(7 ∗ 2log n − 4 log n − 8)) i=1 = O(n). We illustrate PATH0 using path P as in Fig. 2, with k = 3. First we set λ1 to 0 and λ2 to ∞. We initialize the set M to the set consisting of the four 4 × 4 submatrices of the matrix M (P ). On the first iteration of the while-loop, R = {59, 3, 28, 0, 31, 0, 0, 0} and 9 R(cid:48) = {59, 3, 28, 31}. The median of this set is (28 + 31)/2 = 29.5. For λ = 29.5, no cuts are required, so we reset λ2 to 29.5. Then we recompute R(cid:48) to be {3, 28}, whose median is (3 + 28)/2 = 15.5. For λ = 15.5, 1 cut is required, so we reset λ2 to 15.5. We discard the submatrix with all values less than or equal to λ1, leaving three submatrices. We quarter these submatrices into 12 submatrices as shown in Fig. 2. Of these 12 submatrices, five have all values too large, and two have all values too small. We discard them, leaving the five submatrices pictured in Fig. 3. On iteration 2, R = {17, 0, 27, 3, 11, 0, 16, 0, 15, 0}, and R(cid:48) = {3, 11, 15}. The median of this set is 11. For λ = 11, 3 cuts are required, so we reset λ1 to 11. Then we recompute R(cid:48) to be {15}, whose median is 15. For λ = 15, 2 cuts are required, so we reset λ2 to 15. There are no submatrices with all values at least 15.5, and one submatrix with all values at most 11, and we discard the latter. We quarter the remaining four submatrices, giving 16 submatrices of dimension 1 × 1, of which all but the one containing 12 are either too large or too small. On iteration 3, R = {12}, R(cid:48) = {12}, and the median is 12. For λ = 12, 3 cuts are required, so we reset λ1 to 12. At this point, all values are discarded, so that the revised R(cid:48) is empty, and a second selection is not performed on iteration 3. All submatrices will be discarded from M, and PATH0 will terminate with λ1 = 12 and λ2 = 15, and output λ∗ = 12. Theorem 2.2 Algorithm PATH0 finds a max-min partition of a path of n weighted vertices in O(n log n) time. Proof Correctness follows from the correctness of FTEST0, from the fact that all possible candidates for λ∗ are included in M (P ), and from the fact that each value discarded is either at most λ1 or at least λ2. By Lemma 2.1, PATH0 will take O(n) total time, exclusive of the feasibility tests, and will produce a sequence of O(log n) values to be tested. It follows that the total time for all 10 feasibility tests is O(n log n). The time for PATH0 corresponds to the times achieved by Megiddo and Cole for the path problem. We show how to do better in Section 3. We next describe a simple approach TREE0 to the max-min problem on a tree. We first define an edge-path-partition of a tree rooted at a vertex of degree 1. Partition the edges of the tree into paths, where a vertex is an endpoint of a path if and only if it is of degree not equal to 2 with respect to the tree. Call any path in an edge-path-partition that contains a leaf in the tree a leaf-path. As an example, consider the vertex-weighted tree in Fig. 4(a). Fig. 4(b) shows the edge-path-partition for T . There are 7 paths in the partition, as shown. Four of these paths are leaf-paths. We now proceed with the approach for the tree. Below are the three routines TREE0 init mat, TREE0 test val, and TREE0 update mat. The basic idea is to perform the search first on the leaf-paths, and thus determine which edges in the leaf-paths should be cut. When no search value on a leaf-path is contained in the open interval (λ1, λ2), we prune the tree and repeat the process. We use the straightforward feasibility test described earlier. The determination of cuts and pruning of the tree proceeds as follows. If T contains more than one leaf, do the following. For each leaf-path Pj, infer the cuts in Pj such that each component in turn going up in Pj, except the highest component on Pj, has total weight as small as possible but greater than λ1. Delete all vertices beneath the top vertex of each leaf-path Pj, and add to the weight of the top vertex in Pj the weight of the other vertices in the highest component of Pj. This leaves a smaller tree in which all leaf-paths in the original tree have been deleted. The smaller tree has at most half of the number of leaves of T . Reset T to be the smaller tree, and k to be the number of cuts remaining to be made in this tree. TREE0 init mat: Initialize T to be the tree rooted at a vertex of degree 1. 11 Concatenate the leaf-paths of T together, yielding path P (cid:48). Split sorted matrix M (P (cid:48)) for the path P (cid:48) into 4 square submatrices. Let M be the set containing these four square submatrices. TREE0 test val: (Identical to PATH0 ident val, except that FTEST0 is called with argument T rather than P ). TREE0 update mat: Call PATH0 update mat on M. if M is empty and T is not a path then for each leaf-path of T do Determine cuts on the leaf-path, and decrease k accordingly. Add to the weight of the top vertex the total weight of the other vertices in the highest component of the leaf-path. Delete from T all vertices in the leaf-path except the top vertex. endfor Concatenate the leaf-paths of T together, yielding new path P (cid:48). Split sorted matrix M (P (cid:48)) for path P (cid:48) into 4 square submatrices. Let M be the set containing these four square submatrices. endif As an example we consider the max-min problem on the tree shown in Fig. 4(a), with k = 3. In the initialization, four leaf-paths are identified and concatenated together, giving the path P (cid:48) = 4, 5, 4, 5, 15, 6, 2, 1, 1, 3, 2. Once all search values associated with P (cid:48) are resolved, λ1 = 10 and λ2 = 13. We place one cut between the vertices of weight 15 and 6, and reset k to 2. We add the weights of the two leaves of weight 4 to the weight of their parent, giving it weight 13. We add the weights of all descendants of the vertex with weight 2, except the weight of 15, to the vertex of weight 2, giving it a weight also of 13. Then we delete all edges in the leaf-paths. Fig. 5(a) shows the edge-path-partition of the resulting tree. There are two leaf-paths in this partition, with vertex weights 13, 4, and 3 on one, and 13 and 3 on the other. We form the path P (cid:48) = 13, 4, 3, 13, 3. Once we have resolved all search values associated with P (cid:48), we still have λ1 = 10 and λ2 = 13. We can then place two cuts, above each of the vertices of weight 13, and reset k to 0. We add the weight of the vertex 12 of weight 4 to its parent, giving it weight 7. Then we delete all edges in the leaf-paths. The edge-path-partition of the resulting tree is shown in Fig. 5(b). There is just one leaf-path in this partition, with vertex weights 5 and 7. Once all search values associated with P (cid:48) are resolved, we have λ1 = 12 and λ2 = 13. Since the tree consists of a single path, the algorithm then terminates with λ∗ = 12. Theorem 2.3 Algorithm TREE0 finds a max-min partition of a tree of n weighted vertices in O(n(log n)2) time. Proof For correctness of the tree algorithm, note that λ1 always corresponds to a feasible value, that all possible values resulting from leaf paths are represented in M (P (cid:48)), and that the cuts are inferred on leaf-paths assuming (correctly) that any subsequent value λ to be tested will have λ > λ1. We analyze the time as follows. By Lemma 2.1, resolving the path P (cid:48) will use O(log n) feasibility tests, and time exclusive of feasibility tests of O(n). Since each feasibility test takes O(n) time, the feasibility tests will use O(n log n) time. Since resolving the path P (cid:48) will at least halve the number of leaves in the tree, the number of such paths until the final version of P (cid:48) is O(log n). Thus the total time to partition the tree by this method is O(n(log n)2). The time for TREE0 beats the time of O(n(log n)3) for Megiddo's algorithm, and matches the time of O(n(log n)2) for Cole's algorithm. We show how to do better for the max-min problem in Section 4. 3 Partitioning a Path In this section we present an optimal algorithm to perform parametric search on a graph that is a path of n vertices. The algorithm follows the paradigm of parametric search by 13 repeatedly performing feasibility tests over potential optimal values, as it gathers information so that subsequent feasibility tests can be performed increasingly faster. The improvement in speed of the subsequent feasibility tests is enough so that the entire running time is linear. Our discussion focuses on the max-min problem; at the end of the section we identify the changes necessary for the min-max problem. Throughout this section we assume that the vertices of any path or subpath are indexed in increasing order from the start to the end of the path. We first consider the running time of PATH0, to determine how the approach might be accelerated. All activities except for feasibility testing use a total of O(n) time. Feasibility testing can use a total of Θ(n log n) time in the worst case, since there will be Θ(log n) values to be tested in the worst case, and each feasibility test takes Θ(n) time. It seems unlikely that one can reduce the number of tests that need to be made, so then to design a linear-time algorithm, it seems necessary to design a feasibility test that will quickly begin to take o(n) time. We show how to realize such an approach. We shall represent the path by a partition into subpaths, each of which can be searched in time proportional to the logarithm of its length. Each such subpath will possess a property that makes feasibility testing easier. Either the subpath will be singular or resolved. A subpath P (cid:48) is singular if it consists of one vertex, and it is resolved if no value in M (P (cid:48)) falls in the interval (λ1, λ2). If a subpath is resolved, then the position of any one cut determines the positions of all other cuts in the subpath, irrespective of what value of λ we choose from within (λ1, λ2). If we have arranged suitable data structures when the subpath becomes resolved, then we do not need a linear scan of it. To make the representation simple, we restrict the subpaths in the partition to have lengths that are powers of 2. Each subpath will consist of vertices whose indices are (j − 1)2i + 1, . . . , j 2i for integers j > 0 and i ≥ 0. Initially the partition will consist of n singular subpaths. Each nonsingular subpath will have i > 0. When introduced into the 14 partition, each such subpath will replace its two constituent subpaths, the first with indices (2j − 2)2i−1 + 1, . . . , (2j − 1)2i−1, and the second with indices (2j − 1)2i−1 + 1, . . . , (2j)2i−1. We represent the partition of path P into the subpaths with three arrays last[1..n], ncut[1..n] and next[1..n]. Consider any subpath in the partition, with first vertex vf and last vertex vt. Let vl be an arbitrary vertex in the subpath. The array last identifies the end of a subpath, given the first vertex of a subpath. Thus last(l) = t if l = f and is arbitrary otherwise. Given a cut on the subpath, the array next identifies, in constant time, a cut further on in that subpath. The array ncut identifies the number of cuts skipped in moving to that further cut. Let w(l, t) be the sum of the weights of vertices vl through vt. If w(l, t) < λ2, then next(l) = null and ncut(l) = 0. Otherwise, next(l) ≥ l is the index of the last vertex before a cut, given that l = 1 or vl is the first vertex after a cut. Then ncut(l) is the number of cuts after vl up to and including the one following vnext(l). We assume that the last cut on a subpath will leave a (possibly empty) subset of vertices of total weight less than λ2. (Note that the last cut on the path as a whole must then be ignored.) Given the partition into subpaths, we describe feasibility test FTEST1. Let λ be the value to be tested, with λ1 < λ < λ2. For each subpath, we use binary search to find the first cut, and then, follow next pointers and add ncut values to identify the number of cuts on the subpath. When we follow a path of next pointers, we will compress this path. This turns out to be a key operation as we consider subpath merging and its effect on feasibility testing. (Note that the path compression makes FTEST1 a function with side effects.) func FTEST1 (path P , integer k, real λ) f ← 1 numcut ← −1; remainder ← 0 while f ≤ n do /* search the next subpath: */ t ← last(f ) if remainder + w(f, t) < λ then remainder ← remainder + w(f, t) else 15 numcut ← numcut + 1 Binary search for a smallest r so that w(f, r) + remainder ≥ λ. if r < t then (s, sumcut) ← search next path (r, t) numcut ← numcut + sumcut compress next path (r, s, t, sumcut) endif remainder ← w(s + 1, t) endif f ← t + 1 endwhile if numcut ≥ k then return("lower") else return("upper") endif endfunc search next path (vertex index l, t) sumcut ← 0 while l < t and next(l + 1) (cid:54)= null sumcut ← sumcut + ncut(l + 1) l ← next(l + 1) endwhile return(l, sumcut) compress next path (vertex index l, s, t, integer sumcut) while l < t and next(l + 1) (cid:54)= null sumcut ← sumcut − ncut(l + 1) ncut(l + 1) ← ncut(l + 1) + sumcut temp ← next(l + 1) next(l + 1) ← s l ← temp endwhile Use of this feasibility test by itself is not enough to guarantee a quick reduction in the time for feasibility testing. This is because there is no assurance that the interval (λ1, λ2) will be narrowed in a manner that allows longer subpaths to quickly replace shorter subpaths in the partition of path P . To achieve this effect, we reorganize the positive values from M (P ) into submatrices that correspond in a natural way to subpaths. Furthermore, we associate synthetic weights with these submatrices and use these weights in selecting the weighted median for testing. The synthetic weights place a premium on resolving first the values from 16 submatrices corresponding to short subpaths. However, using synthetic weights could mean that we consider many values of small weight repeatedly, causing the total time for selection to exceed Θ(n). To offset this effect, we also find the unweighted median, and test this value. This approach guarantees that we discard at least half of the submatrices' representatives on each iteration, so that each submatrix inserted into M need be charged only a constant for its share of the total work in selecting values to test. We now proceed to a broad description of PATH1. The basic structure follows that of PARAM SEARCH, in that there will be the routines PATH1 init mat, PATH1 test val, and PATH1 update mat. However, we will slip the set-up and manipulation of the data structures for the subpaths into the routines PATH1 init mat and PATH1 update mat. Let large(M ) be the largest element in submatrix M , and let small(M ) be the smallest element in M . PATH1 init mat: Initialize M to be empty. Call mats for path(P, 1, n) to insert submatrices of M (P ) into M. for l ← 1 to n do last(l) ← l; next(l) ← 0; ncut(l) ← 0 endfor PATH1 test val: R ← ∅ for each M in M do if large(M ) < λ2 then Insert large(M ) into R with synthetic weight w(M )/4. endif if small(M ) > λ1 then Insert small(M ) into R with synthetic weight w(M )/4. endif endfor Select the (synthetic) weighted median element λ in R. if FTEST1(P, k, λ) = "lower" then λ1 ← λ else λ2 ← λ endif Remove from R any values no longer in (λ1, λ2). if R is not empty then Select the unweighted median element λ(cid:48) in R. if FTEST1(P, k, λ(cid:48)) = "lower" then λ1 ← λ(cid:48) else λ2 ← λ(cid:48) endif endif PATH1 update mat: while there is an M in M such that small(M ) ≥ λ2 or large(M ) ≤ λ1 17 or small(M ) ≤ λ1 ≤ λ2 ≤ large(M ) do if small(M ) ≥ λ2 or large(M ) ≤ λ1 then Delete M from M. if this is the last submatrix remaining for a subpath P (cid:48) then glue paths(P (cid:48)) endif endif if small(M ) ≤ λ1 and large(M ) ≥ λ2 then Split M into four square submatrices, each of synthetic weight w(M )/8. endif endwhile Below is the procedure mats for path, which inserts submatrices of the appropriate previ- ously discussed synthetic weight into M. A call with arguments f and t will generate subma- trices for all required subpaths of a path containing the vertices with indices f, f + 1, . . . , t. (In this section, we assume that f = 1 and t = n, but we state the procedure in this form so that it can be used in the next section too.) The submatrices for the matrix M (P ) in Fig. 1 are shown in Fig. 6. Every subpath P (cid:48) that will appear in some partition of P is initialized with cleaned(P (cid:48)) and glued(P (cid:48)) to false, where cleaned(P (cid:48)) indicates whether or not all values in the submatrix associated with P (cid:48) are outside the interval (λ1, λ2), and glued(P (cid:48)) indicates whether or not all values in M (P (cid:48)) are outside the interval (λ1, λ2). proc mats for path (path P , integer f, t) size ← 1 w ← 4n4 /* synthetic weight for 1 × 1 submatrices */ while f ≤ t do for i ← f to t by size do (i+(cid:100)size/2(cid:101)).. (i+size−1)] for M (P ) into M with synthetic weight w. i, . . . , i + size − 1. Insert the succinct description of submatrix [i .. (i+(cid:100)size/2(cid:101)−1), Let P (cid:48) be the subpath of P whose vertices have indices cleaned(P (cid:48)) ← false; glued(P (cid:48)) ← false endfor size ← size ∗ 2 w ← w/2 /* smaller synthetic weight for increased size of submatrix */ f ← size ∗ (cid:100)(f − 1)/size(cid:101) + 1 18 t ← size ∗ (cid:98)t/size(cid:99) endwhile endproc We next describe the procedure glue paths, which checks to see if two constituent sub- paths can be combined together. Let P (cid:48) be any subpath of weight at least λ2, and let f(cid:48) and t(cid:48) be the indices of the first and last vertices in P (cid:48), resp. Let the λ-prefix of P (cid:48), designated λpref (P (cid:48)), be vertices vf(cid:48),··· , vl in P (cid:48) where l is the largest index such that w(f(cid:48), l) < λ2. Let the λ-suffix of P (cid:48), designated λsuff (P (cid:48)), be vertices vl,··· , vt(cid:48) in P (cid:48) where l is the small- est index such that w(l, t(cid:48)) < λ2. To glue two subpaths P2 and P3 together into a subpath P1, we must have (glued(P2) and glued(P3) and cleaned(P1)). Procedure glue paths sets the next pointers from vertices in λsuff (P2) to vertices in λpref (P3). proc glue paths (path P1) cleaned(P1) ← true if P1 has length 1 then glued(P1) ← true Let l be the index of the vertex in P1. if w(l, l) ≥ λ2 then next(l) ← l; ncut(l) ← 1 endif Reset P1 to be subpath of which P1 is now a constituent subpath. endif Let P2 and P3 be the constituent subpaths of P1. while glued(P2) and glued(P3) and cleaned(P1) and P1 (cid:54)= P do glued(P1) ← true Let f2 and t2 be resp. the indices of the first and last vertices in P2. Let f3 and t3 be resp. the indices of the first and last vertices in P3. last(f2) ← t3 if w(f2, t3) ≥ λ2 then if w(f2, t2) < λ2 then f ← f2 else /* initialize f to the front of λsuff (P2) */ f ← t2 while w(f − 1, t2) < λ2 do f ← f − 1 endwhile endif t ← f3 19 while f ≤ t2 and w(f, t3) ≥ λ2 do /* set next pointers for λsuff (P2) */ while w(f, t) < λ2 do t ← t + 1 endwhile ncut(f ) ← 1 next(f ) ← t f ← f + 1 endwhile endif Reset P1 to be subpath of which P1 is now a constituent subpath. Let P2 and P3 be the constituent subpaths of P1. endwhile endproc It would be nice if procedure glue paths, after setting pointers in λsuff (P2), would perform pointer jumping, so that next pointers for vertices in λpref (P1) would point to vertices in λsuff (P1). Unfortunately, it is not apparent how to incorporate pointer jumping into glue paths without using O(n) time over all calls in the worst case. We thus opt for having glue paths do no pointer jumping, and instead we do pointer jumping under the guise of path compression in FTEST1. We use an argument based on amortization to show that this works well. Lemma 3.1 Let P be a path of n vertices. All calls to glue-paths will take amortized time of O(n), and FTEST1 will search each subpath that is glued in amortized time proportional to the logarithm of its length. Proof Suppose two subpaths P2 and P3 are glued together to give P1, where P1 has weight at least λ2. We consider two cases. First suppose either P2 or P3 has weight at most λ1. Let Pm represent this subpath. The time for glue paths is in worst case proportional to the length of Pm. Also, we leave a glue-credit on each vertex in the λpref (P1) and λsuff (P1), and a jump-credit on each vertex in the λpref (P1). The number of credits will be proportional to the length of Pm. We charge this work and the credits to the vertices of Pm, at a constant charge per vertex. It is clear that any vertex in P is charged at most once, so that the total 20 charge to vertices over all calls to glue paths is O(n). The second case is when both P2 and P3 have weight at least λ2. In this case, the time for glue paths is proportional to the sum of the lengths of λsuff (P2) and λpref (P3), and we use the glue-credits of P2 and P3 to pay for this. The jump-credits are used by FTEST1 rather than by glue-paths, and in fact, would present a problem if one tries to use them in glue-paths, as we discuss below. Suppose both P2 and P3 have weight at least λ2. Then we might have wanted to have glue-paths jump the next pointers so that the next pointer for a vertex in λpref (P2) would be reset to point to λsuff (P3). The time to reset such pointers would be proportional to the length of λpref (P2). The jump-credits of λpref (P3) could pay for this, as long as the length of λpref (P2) is at most some constant (say 2) times the length of the λpref (P3). When the length of the λpref (P2) is at most twice the length of the λpref (P3), we would not want to jump the pointers. In general we could view a subpath as containing a sequence of λ-regions, where each λ-region was once the λ-prefix of some subpath, and the length of a λ-region is less than twice the length of the preceding λ-region. Note that the number of λ-regions in the sequence could be at most the logarithm of the length of the subpath. When gluing two subpaths together, we could concatenate their sequences of λ-regions together, and jump pointers over any λ-region that gets a predecessor whose length is not more than twice its length. Its jump-credits could then be used for this pointer jumping. Searching a subpath in FTEST1 would then take time at most proportional to its length. Of course glue-paths does not jump pointers. However, a lazy form of pointer-jumping is found in the path-compression of FTEST1, and the same sort of analysis can be seen to apply. Suppose that FTEST1 follows a pointer to a vertex that was once in the λ-prefix of some subpath. Consider the situation if glue-paths had jumped pointers. If that pointer would have been present in the sequence of λ-regions, then charge the operation of following that pointer to FTEST1. Otherwise, charge the operation of following that pointer to the 21 jump-credits of the λ-prefix containing the vertex. It follows that the number of pointers followed during a search of a subpath that are not covered by jump-credits is at most the logarithm of the length of the subpath. Also, the binary search to find the position of the first cut on a subpath uses time at most proportional to the logarithm of the length of the subpath. Lemma 3.2 Let P be a path of n vertices. On the i-th iteration of the while-loop of PATH1, the amortized time used by feasibility test FTEST1 will be O(i(5/6)i/5 n). Proof We first consider the synthetic weights assigned to submatrices in M. Correspond- ing to subpaths of lengths 1, 2, 4, . . . , n, procedure mats for path creates n submatrices of size 1× 1, n/2 submatrices of size 1× 1, n/4 submatrices of size 2× 2, and so on, up through one submatrix of size n/2 × n/2. The total synthetic weight of the submatrices corresponding to each path length is 4n5, n5, n5/4, . . . , 4n3, resp. It follows that the total synthetic weight for submatrices of all path lengths is less than (4/3) ∗ 4n5. Let wgt(M ) be the synthetic weight assigned to submatrix M . Define the effective weight, denoted eff wgt(M ), of a submatrix M in M to be wgt(M ) if both its smallest value and largest value are contained in the interval (λ1, λ2) and (3/4)wgt(M ) if only one of its smallest value and largest value is contained in the interval (λ1, λ2). Let eff wgt(M) be the total effective weight of all submatrices in M. When a feasibility test renders a value (the smallest or largest) from M no longer in the interval (λ1, λ2), we argue that eff wgt(M ) is reduced by at least wgt(M )/4 because of that value. If both values were contained in the interval (λ1, λ2), and one no longer is, then clearly our claim is true. If only one value was contained in the interval (λ1, λ2), and it no longer is, then M is replaced by four submatrices of effective weights wgt(M )/8 + wgt(M )/8 + (3/4)wgt(M )/8 + (3/4)wgt(M )/8 < wgt(M )/2, so that there is a reduction in effective weight by greater than wgt(M )/4. If both values were contained in the interval (λ1, λ2), and 22 both are no longer in, then we consider first one and then the other. Thus every element that was in (λ1, λ2) but no longer is causes a decrease in eff wgt(M) by an amount at least equal to its synthetic weight in R. Values with at least half of the total weight in R find themselves no longer in (λ1, λ2). Furthermore, the total weight of R is at least 1/3 of eff wgt(M). This follows since a submatrix M has either two values in R at a total of 2w(M )/4 = (1/2)w(M ) or one value at a weight of w(M )/4 = (1/3)(3w(M )/4). Thus eff wgt(M) decreases by a factor of at least (1/2)(1/3) = 1/6 per iteration. Corresponding to the subpaths of length 2j, there are n/2j submatrices created by mats for path. If such a matrix is quartered repeatedly until 1 × 1 submatrices result, each such submatrix will have weight n4/24j−2. Thus when as little as (n/2j) ∗ (n4/24j−2) syn- thetic weight remains, all subpaths of length 2j can still be unresolved. This can be as late as iteration i, where i satisfies (4/3) ∗ 4n5 ∗ (5/6)i = n5/25j−2, or 25j = (3/4) ∗ (6/5)i. While all subpaths of length 2j can still be unresolved on this iteration, at most (1/2 ∗ 1/24)k = 1/25k of the subpaths of length 2j−k can be unresolved for k = 1, . . . , j. Also, by Lemma 3.1, each subpath can be searched by FTEST1 in amortized time proportional to the logarithm of its length. Thus the time to search path P on iteration i is at worst proportional to (j/2j)n(1 + 1/25 + 1/210 + ··· ), which is O((j/2j)n). From the relationship of i and j, 2j = (3/4)1/5(6/5)i/5, and j = (1/5) log(3/4) + (i/5) log(6/5). The lemma then follows. Lemma 3.3 The total time for handling M and performing selection over all iterations of PATH1 is O(n). Proof Using the algorithm of [3], the time to perform selection in a given iteration is proportional to the size of R. Define the effective count, denoted eff cnt(M ), of a submatrix M in M to be 2 if both its smallest value and largest value are contained in the interval (λ1, λ2) and 1 if only one of its smallest value and largest value is contained in the interval (λ1, λ2). Let eff cnt(M) be the total effective count of all submatrices in M. Then the size 23 of R equals eff cnt(M). On any iteration, the result of the feasibility test of λ(cid:48) is to resolve at least half of the values in R. The time for inserting values into R and performing the selections is O(n). We show this by using an accounting argument, charging 2 credits for each value inserted into R. As R changes, we maintain the invariant that the number of credits is twice the size of R. When R has k elements, a selection takes O(k) time, paid for by k credits, leaving k/2 elements covered by k credits. Since n elements are inserted into R during the whole of PATH1, the time for forming R and performing selections is O(n). It remains to count the number of submatrices inserted into M. Initially 2n − 1 subma- trices are inserted into M. For j = 1, 2, . . . , log n − 1, consider all submatrices of size 2j × 2j that are at some point in M. A matrix that is split must have its smallest value at most λ1 and its largest value at least λ2. However, Mi,j > Mi−k,j+k for k > 0, since the path represented by Mi+k,j−k is a subpath of the path represented by Mi,j. Hence, for any 2j × 2j submatrix that is split, at most one submatrix can be split in each diagonal going from lower left to upper right. There are fewer than 2n diagonals, so there will be fewer than 2(n/2j) submatrices that are split. Thus the number resulting from quartering is less than 8(n/2j). Summing over all j gives O(n) submatrices in M resulting from quartering. We illustrate PATH1 on path P in Fig. 1, with k = 3. (This is the same example that we discussed near the end of the previous section.) The initial submatrices for M are shown in Fig. 6. The submatrix of size 4 × 4 has synthetic weight 211, the two submatrices of size 2× 2 have synthetic weight 212, four submatrices of size 1× 1 have synthetic weight 213, and the remaining eight submatrices of size 1 × 1 have synthetic weight 214. Initially λ1 = 0 and λ2 = ∞. The last, next and ncut arrays are initialized as stated. On the first iteration, R contains two copies each of 6, 11, 9, 2, 1, 15, 7, 8 of synthetic weight 212, two copies each of 17, 11, 16, 15 of synthetic weight 211, 20, 28, 22, 31 of synthetic weight 210, and 3, 59 of synthetic weight 29. The weighted median of R is 11. For λ = 24 11, three cuts are required, so we reset λ1 to 11. The revised version of R will then be {15, 15, 17, 17, 16, 16, 15, 15, 20, 28, 22, 31, 59}. The median of this is 17. For λ(cid:48) = 17, one cut is required, so we reset λ2 to 17. The set M is changed as follows. We discard all submatrices of size 1× 1 except the one of synthetic weight 214 containing 15, and the two of synthetic weight 213 containing 15 in one and 16 in the other. We discard all submatrices of size 2 × 2. We quarter the submatrix of size 4 × 4, giving four submatrices each of synthetic weight 28. We discard three of these submatrices because their values are all too large. We quarter the remaining submatrix (containing 27, 12, 18, 3), giving four submatrices each of synthetic weight 25. We discard all submatrices but the submatrix of size 1 × 1 containing 12. As a result of submatrix discarding, we render a number of subpaths cleaned and glued. We clean and glue every subpath of length 1 except v6, the subpaths v1, v2 and v3, v4, the subpath v1, v2, v3, v4, and we clean but do not glue the subpath v5, v6, v7, v8. When we glue subpath v6, we set next(6) to 6, and ncut(6) to 1. When we glue subpath v1, v2, we set last(1) to 2, next(1) to 2, and ncut(1) to 1. When we glue subpath v3, v4, we set last(3) to 4, but we change no next or ncut values. When we glue subpath v1, v2, v3, v4, we set last(1) to 4, next(2) to 3, and ncut(2) to 1. This completes all activity on the first iteration. On the second iteration, R contains two copies of 15 of synthetic weight 212, two copies each of 16, 15 of synthetic weight 211, and two copies of 12 of synthetic weight 23. The weighted median of R is 15. For λ = 15, 2 cuts are required, so we reset λ2 to 15. The revised version of R will then be {12, 12}. The median of this is 12. For λ(cid:48) = 12, 3 cuts are required, so we reset λ1 to 12. All remaining submatrices are discarded from M. When this happens, we clean and glue all remaining subpaths. When we glue subpath v5, v6, we set last(5) to 6, next(5) to 6, and ncut(5) to 1. When we glue subpath v7, v8, we set last(7) to 8, next(7) to 8, and ncut(7) to 1. When we glue subpath v5, v6, v7, v8, we set last(5) to 8, but we change no next or ncut 25 values. When we glue subpath v1, v2, v3, v4, v5, v6, v7, v8, we set last(1) to 8, next(3) and next(4) to 6, and ncut(3) and ncut(4) to 1. Since M is empty, PATH1 will then terminate with λ1 = 12, λ2 = 15, and output λ∗ = 12. Note that we performed no compression of search paths on the second iteration. Suppose for the sake of example that we performed a subsequent search with λ = 13. The initial cut would come after v2, and next(3) and next(7) would be followed to arrive at v8. Then we would reset ncut(3) to 2, and next(3) to 8. Theorem 3.4 Algorithm PATH1 solves the max-min k-partitioning problem on a path of n vertices in O(n) time. Proof The use of arrays next and ncut, indexed by vertices on the path, is the key difference between PATH0 and PATH1. Feasibility test FTEST1 requires next(a) to point to a further vertex, b, in the subpath, such that ncut(a) is the number of cuts between a and b. Enforcing this requirement, we update arrays next and ncut by two subroutines of PATH1. The first is glue paths. When small(M ) ≥ λ2 or large(M ) ≤ λ1, certain vertices on the subpaths need no longer be inspected, so glue paths combines two adjacent subpaths of equal length by updating the next and ncut values on the subpaths. We repeat the gluing and updating until no longer possible. The second subroutine is compress next path, which we call after search next path(a, b) in FTEST1. Procedure search next path(a, b) determines (v, sumcut), where v is the location of the final cut before b and sumcut is the number of cuts between a and v. We then update the values of next and ncut for vertices between a and v. The correctness of FTEST1 follows, as we increment numcut once for each subpath whose weight exceeds λ∗, or by sumcut for each compressed subpath with the corresponding number of cuts. Correctness of PATH1 follows from the correctness of FTEST1, from the 26 fact that all possible candidates for λ∗ are included in M, and from the fact that each value discarded is either at most λ1 or at least λ2. The time to initialize M is clearly O(n). By Lemma 3.3, the total time to select all values to test for feasibility is O(n). By Lemma 3.2, the amortized time to perform feasibility test on iteration i is O(i(5/6)i/5n). Summed over all iterations, this quantity is O(n). By Lemma 3.3, the total time to handle submatrices in M is O(n). By Lemma 3.1, the time to manipulate data structures for the subpaths is O(n). The time bound then follows. We briefly survey the differences needed to solve the min-max path-partitioning prob- lem. Procedure FTEST1 is similar except that r is the largest index such that w(f, r) + remainder ≤ λ, we subtract 1 from numcut after completion of the while-loop if remainder = 0, and use numcut ≥ k rather than numcut > k. Upon termination, FTEST1 outputs λ∗ = λ2. Procedure glue paths is similar, except that we replace the statement while w(f, t) < λ2 do t ← t + 1 endwhile by the statement while w(f, t + 1) < λ2 do t ← t + 1 endwhile Note that w(l, l) ≤ λ2 always holds for the min-max problem. Theorem 3.5 The min-max k-partitioning problem can be solved on a path of n vertices in O(n) time. Proof The above changes will not affect the asymptotic running time of algorithm PATH1. 27 4 Partitioning for Max-Min on a Tree In this section, we present an optimal algorithm to perform parametric search for the max- min problem on a graph that is a tree. The algorithm differs from that in Section 3 as either long paths or many leaves can overwhelm the running time, so we must simultaneously compress long paths and delete leaves. The situation is further complicated by the challenge of handling problematic vertices, which are vertices of degree greater than two. Thus, we pursue a dual-pronged strategy that identifies both paths to compress and paths to delete. 4.1 Our Tree Algorithm Our algorithm proceeds through rounds, running an increasing number of selection and feasibility tests on each round. As we shall show in Section 4.3, each round halves the feasibility test time, and the overall time for selection is linear. Thus, our algorithm runs in linear time. For the purposes of discussion and analysis, we initially classify paths in the tree as either pending paths or processed paths, based on whether the actual weights associated with the path have already been resolved. Let an internal path be a subpath between the root and a problematic vertex, or between two problematic vertices such that all intermediate vertices are of degree 2. Let a leaf path be a subpath with either the root or a problematic vertex as one endpoint and the other endpoint being a leaf. Furthermore, let a processed path be an internal path that is completely cleaned and glued and let a pending path be a path, either an interval or a leaf path, that contains some value in the interval (λ1, λ2). Moreover, we define and classify paths or subpaths as light paths, middleweight paths, or heavy paths, based on how the actual weights in the path compare to λ1 and λ2. A subpath is light if its total weight is at most λ1, and a subpath is heavy if its total weight is at least λ2. Otherwise, a subpath is middleweight. Note that a middleweight path may consist of a sequence of both light and/or middleweight subpaths. 28 For each round, our algorithm runs an increasing number of selection and feasibility tests, while maintaining three selection sets, H, U, and V, consisting of candidates for the max- min value. The first selection set is for heavy subpaths, the second is for middleweight paths formed as sequences of light or middleweight subpaths after the resolution of a problematic vertex, and the third is for handling problematic vertices whose leaf paths have been resolved. We assign synthetic weights to values inserted into H or U as a function of the lengths of the corresponding paths, as defined in the procedure mats for path in Section 3, assuming that we round up the length to a power of 2. Our algorithm invokes a separate procedure to address each of these sets specifically. Procedure handle middleweight paths inserts the total actual weight of each middleweight path as elements into U. Our algorithm then performs two weighted selections on the elements in U, one using the length of each path as the weight, and the other using the synthetic weight of each path. For each of the weighted selections, our algorithm then tests the selected value for feasibility, and adjusts λ1 and λ2 accordingly. For any middleweight path that becomes heavy, our algorithm succinctly identifies the corresponding submatrix and inserts the representatives (of the submatrix) whose values are within (λ1, λ2) into H. For any path that becomes light, our algorithm cleans and glues the path, so that future feasibility tests require only polylogarithmic time to search the path. The second procedure, handle pending paths, selects the weighted and unweighted medi- ans from H separately, tests each for feasibility, and adjusts λ1 and λ2 accordingly. After the feasibility test, our algorithm cleans and glues adjacent subpaths that it has just resolved. When a leaf path is completely resolved, our algorithm represents the leaf path by a single vertex with the remaining accumulated weight, accum wgt(v), as described in Section 2. Our algorithm defers until the next iteration of the for-loop the insertion into H of the representatives of any subpaths that have become heavy. The third procedure is handle leaves. For any problematic vertex with a resolved leaf 29 path hanging off it, the procedure inserts into V the sum of the weight of that vertex plus the accumulated remaining weight left over from the resolved leaf path. The procedure then selects the median from V, performs the feasibility test, and adjusts λ1 and λ2 accordingly. Since we want to find the max-min, if the number of cuts is at least k, then for each vertex whose weight plus the accumulated remaining weight from the resolved leaf path is at most the median, our algorithm merges the vertex with the accumulated remaining weight from the resolved leaf path. On the other hand, if the number of cuts is less than k, then for each vertex whose weight plus the accumulated remaining weight from the resolved leaf path is at least the median, our algorithm cuts below the parent vertex, because any future feasibility tests would do the same. Furthermore, our algorithm assigns, to any middleweight path created by the resolution of a problematic vertex, a synthetic weight that is a function of the length (rounded up to a power of two) as defined in the procedure mats for path in Section 3. Our algorithm then inserts the weight of that path into U at the beginning of the next invocation, along with the corresponding synthetic weight. Note that we merge middleweight paths only when we know whether they will become light or heavy. For the representative of any subpath that becomes heavy during this procedure, we wait until the next iteration of the for-loop to insert the representative into H. We now give the top level of our algorithm. We defer our discussion of the corresponding data structures until Section 4.2. TREE1: Initialize the data structures for the algorithm and set round r ← 1. while H ∪ U ∪ V (cid:54)= ∅ do while feasibility test time is more than n/2r do Call procedure handle middleweight paths. repeat Call procedure handle pending paths until the feasibility test time on heavy paths has been reduced by 50% and the feasibility test time on leaf paths has been reduced by 25% Call procedure handle leaves. endwhile r ← r + 1 30 endwhile 4.2 Data Structures As our algorithm progresses, it prunes the tree to delete some of the paths in the edge- path-partition and it glues together other paths, while updating the values of λ1 and λ2. In this section, we discuss the necessary data structures so that our algorithm can efficiently perform feasibility testing as these updates occur. Our algorithm represents a path in an edge-path-partition in consecutive locations of an array. To achieve that, our algorithm initially stores the actual weights of the vertices of the tree in an array using the following order. It orders the children of each vertex from left to right by nondecreasing height in the tree. Using this organization of the tree, our algorithm then lists the vertices of the tree in postorder. Our algorithm can find the heights of all vertices in linear time. It can also order pairs containing parent and height lexicographically in linear time. Our algorithm does this process only during the initialization phase. It uses arrays that are parallel to the actual weight array to store pointer values, as well as the accumulated weight (see procedure explore in Section 2), which it then uses to compute the actual weight of specified subpaths, exactly the same as the last, ncut, and next arrays in Section 3. We discuss this additional information in due course. When our algorithm removes paths from the tree, it reorganizes the storage of the tree within the array as follows. Let P be a leaf-path in the edge-path-partition of the current tree, and let t be the top vertex of P . To remove P − t, we proceed as follows: Let P (cid:48) be the path whose bottom vertex is t. If t will have only one child remaining after removal of P − t, and this child was originally not the rightmost child of t, do the following. Let P (cid:48)(cid:48) be the other path whose top vertex is t. Copy the vertices of P (cid:48)(cid:48) − t in order, so that the top vertex of this path is in the location preceding the location of t in the array. Modify the actual weight of t by adding the remainder left from removing P − t. Also, copy pointer 31 values for all copied vertices into the new locations in their arrays. That is, update last, ncut, and next pointers in P (cid:48). In particular, the last pointer for the first vertex in P (cid:48) should now point to the last vertex in P (cid:48)(cid:48). We should also copy and modify the accumulated weight, as we discuss shortly. Note that the bottom vertex of P (cid:48)(cid:48) may have been the parent of several vertices. When P (cid:48)(cid:48) − t is moved, we do not copy the children of its bottom vertex (and subtrees rooted at them). It is simple to store in a location formerly assigned to the bottom vertex of P (cid:48)(cid:48) the current location of this vertex, and to also store a pointer back. If we copy the path containing P (cid:48)(cid:48), then we reset this pointer easily. When only one child of the bottom vertex of P (cid:48)(cid:48) remains, we copy the corresponding path to in front of P (cid:48)(cid:48). We claim that the total time to perform all rearrangements will be O(n): The time to copy each vertex and to copy and adjust its accumulated weight is constant. Because of the way in which the tree is stored in the array, at most one vertex will be copied from any array location. We next discuss the representation of a heavy path. Each heavy path P is represented as a sequence of overlapping subpaths, each of actual weight at least λ2. Each vertex of P is in at most two overlapping subpaths. Each overlapping subpath, except the first, overlaps the previous overlapping subpath on vertices of total actual weight at least λ2, and each overlapping subpath, except the last, overlaps the following overlapping subpath on vertices of total actual weight at least λ2. Thus any sequence of vertices of weight at most λ2 that is contained in the path is contained in one of its overlapping subpaths. For each overlapping subpath, we shall maintain a succinct version of the corresponding sorted matrix M (P ) (as described in Section 2), where P is the overlapping subpath excluding the top vertex of the overlapping subpath. Initially, no path is heavy, since initially λ2 = ∞. Our algorithm recognizes a path P as heavy in one of two ways. 1. Path P was middleweight until a feasibility test reduced the value of λ2. 32 2. Path P results from the concatenation of two or more paths following the resolution of a problematic vertex. If a heavy path P arises in the first way, then represent P by two overlapping subpaths that are both copies of P , arbitrarily designating one as the first overlapping subpath and the other as the second. For each overlapping subpath, create the corresponding succinct description of a sorted matrix. If heavy path P is the concatenation of paths, all of which were light, then do the same thing. Otherwise, path P results from the concatenation of paths, with at least one of them being heavy. Do the following to generate the representation for P . While there is a light or middleweight path P (cid:48) to be concatenated to a heavy path P (cid:48)(cid:48), combine the two as follows. If P (cid:48) precedes P (cid:48)(cid:48), then extend the first overlapping subpath of P (cid:48)(cid:48) to incorporate P (cid:48). If P (cid:48) follows P (cid:48)(cid:48), then extend the last overlapping subpath of P (cid:48)(cid:48). This completes the description of the concatenation of light or middleweight paths with heavy paths. While there is more than one heavy path, concatenate adjacent heavy paths P (cid:48) and P (cid:48)(cid:48) as follows. Assume that P (cid:48) precedes P (cid:48)(cid:48). Combine the last overlapping subpath of P (cid:48) with the first of P (cid:48)(cid:48). Note that any vertex can be changed at most twice before it is in overlapping subpaths that are neither the first nor the last. We now discuss how to perform efficient feasibility testing, given our representation of paths. To efficiently search along paths, we maintain a second representation of paths as red-black balanced search trees. In each tree, there will be a node x for every vertex v in the subpath. Node x contains two fields, wt(x) and ct(x). Field wt(x) contains the sum of the actual weights of all vertices whose nodes are in the subtree rooted at x, and field ct(x) will equal the number of nodes in the subtree rooted at x. With this tree it is easy to search for a vertex v in subpath P such that v is the first vertex in P so that the sum of the actual weights to v is at least a certain value, and to determine at the same time the position of v in P . This search takes time proportional to the logarithm of the length of P . When two 33 paths P (cid:48) and P (cid:48)(cid:48) need to be concatenated together, we merge the corresponding search trees in time proportional to the logarithm of the combined path length. Moreover, a problematic vertex also needs access to the accumulated actual weight of each of its subtrees. Thus, we also maintain a linked list child, which points to all children of a vertex, if they exist. When leaf paths become resolved, remove the pointer from the parent vertex, but since we do not move the locations of the other descending paths until only one remains, we do not need to change the pointers for the other children. Thus, when we delete a leaf path, we update the subpaths and pointers accordingly, so that each subpath in the edge-path-partition remains in a contiguous block of memory. 4.3 Analysis of our Tree Algorithm The analysis of our algorithm is not obvious because techniques in Section 3 force the syn- thetic weight of data structure M to decrease monotonically as our algorithm progresses, but neither U nor H individually have this property. Moreover, neither U nor H alone provides an accurate count of the number of resolved paths. In a feasibility test, our algorithm must explore problematic vertices as well as both processed and pending paths. Specifically, the feasibility test time is the number of vertices our algorithm lands on in pending paths, plus the number of vertices our algorithm lands on in processed paths, plus the number of problematic vertices. Since leaf paths are pending paths, and the number of problematic vertices is less than the number of leaf paths, the feasibility test time is upper bounded by double the number of vertices our algorithm lands on in both pending and processed paths. Thus, we show an upper bound on the time spent by the feasibility test after each round. Finally, we show that our algorithm needs at most 66(r2 + 9) iterations to cut in half the feasibility test time. We remark that cleaning and gluing will be the same as in Section 3 since our algorithm performs cleaning and gluing only along subpaths that were initially created as part of 34 the edge-path-partition or along heavy paths, for which we would have a corresponding submatrix. To analyze the performance of our algorithm, we consider, in an auxiliary data structure P, the representatives of heavy and middleweight subpaths of the tree, along with their corresponding synthetic weights as a function of their lengths (as defined in Section 2). When we resolve a problematic vertex, the handle leaves routine produces a newly formed path that is either a light path, a heavy path, or a middleweight path. Recall that if a newly formed subpath is middleweight, we insert a representative consisting of actual weight of that subpath into U. If a newly formed subpath is heavy, we generate our succinct representation of its corresponding submatrix, and we insert the representatives of the submatrix into H. In each case, we also insert the representative(s) into P with their same synthetic weights, as described earlier. Furthermore, at the beginning of each iteration, P includes exactly H, U, and the representatives of middleweight subpaths of paths represented in U. For convenience in analysis, let n be the smallest power of two greater than the number of vertices in the graph. We now consider P to show results analogous to Lemma 3.2 and Lemma 3.3. Lemma 4.1 At any point in our algorithm, the total synthetic weight of the values in P is less than (4/3) ∗ 4n5. Proof Consider the synthetic weights assigned to the representative values in P. Even if all representatives in P represent heavy paths, procedure mats for path creates at most n submatrices for subpaths of length 1, at most n/2 more submatrices for subpaths of length 1, at most n/4 submatrices for subpaths of length 2, and so on, up to at most one submatrix for a subpath of length n/2, corresponding to subpaths of lengths 1, 2, 4, . . . , n. The total synthetic weight of the representative values corresponding to each heavy path length is at most 4n5, n5, n5/4, . . . , 4n3, resp. If a path is middleweight, no submatrix is generated for the path, but by construction, its representative value in P has the same synthetic weight as 35 it would if the path were heavy. Thus, the total synthetic weight in P is less than (4/3)∗4n5. In Section 4 we defined functions wgt and eff wgt on matrices to analyze the progress of our algorithm. We use a similar analysis in this section, but we do not have submatrices for middleweight paths. To emphasize the parallels, we overload the definitions of wgt and eff wgt, as defined below. Let wgt(P ) be the synthetic weight assigned to subpath P , as a function of its length, as defined in Section 2. Define the effective weight, denoted eff wgt(P ), of a subpath P containing a representative value in P to be wgt(P ) if both its smallest value and largest value are contained in the interval (λ1, λ2) and (3/4)wgt(P ) if only one of its smallest value and largest value is contained in the interval (λ1, λ2). We analyze our algorithm using this notion of eff wgt(P ) without ever the need to explicitly calculate it. Let eff wgt(P) be the total effective weight of all subpaths with representative values in P. Lemma 4.2 A weighted and unweighted selection, first both from U and then both from H, resolves at least 1/24 of eff wgt(P) Proof When a feasibility test renders a value (the smallest or largest) from a heavy subpath P no longer in the interval (λ1, λ2), we argue that eff wgt(P ) is reduced by at least wgt(P )/4 because of that value. If both values were contained in the interval (λ1, λ2), but one no longer is, then clearly eff wgt(P ) is reduced by at least wgt(P )/4. If only one value was contained in the interval (λ1, λ2), and it no longer is, then we consider whether λ1 increased or λ2 decreased. If λ1 increased and P has no value within (λ1, λ2), then any subpath will also have no value within (λ1, λ2). Thus, eff wgt(P ) is clearly reduced by at least wgt(P )/4. On the other hand, if λ2 decreased so that P is now a heavy path, then we generate M (P ). We then replace M (P ) with the succinct description of four submatrices of effective weights wgt(P )/8 + wgt(P )/8 + (3/4)wgt(P )/8+(3/4)wgt(P )/8 < wgt(P )/2, so that there is a reduction in weight by greater 36 than wgt(P )/4. If both values from the submatrix were contained in the interval (λ1, λ2), and both no longer are, then we consider first one and then the other. Thus every representative that was in (λ1, λ2) but no longer is causes a decrease in eff wgt(P) by an amount at least equal to its synthetic weight in P. Representatives with more than half of the total weight in P find themselves no longer in (λ1, λ2). Recall that we include values representing a subpath P in selection set H if and only if P is a heavy subpath, and the corresponding values are contained within (λ1, λ2). Of a subpath P that does have representative values contained in H, then P has either two values in P at a total of 2wgt(P )/4 = (1/2)wgt(P ) or one value at a weight of wgt(P )/4 = (1/3)(3wgt(P )/4). For each selection and feasibility test from H and U, at least half of the weight of P is contained in U or contained in H. Suppose at least 1/2 of P is contained in U. Then following a selection and feasibility test from U, at least (1/2)(1/2) = 1/4 of the weight of P will be removed from U, either determined to be smaller than an updated λ1, or larger than an updated λ2 and inserted into H as a part of a heavy subpath. Then, following a round of selection and feasibility testing from H, the weight of P is reduced by at least (1/2)(1/4) = 1/8. On the other hand, if there is more weight of P in H than in U, then a round of selection and feasibility testing from H decreases the weight of P by at least (1/2)(1/2) = 1/4. Thus, in the worse of the two cases, the weight of P decreases by at least (1/8)(1/3) = 1/24 per iteration. Lemma 4.3 Following i iterations of weighted and unweighted selection and feasibility test- ing for H, where 25j = (3/4) ∗ (24/23)i, at most 1/25k of the subpaths, of length 2j−k, represented by values in H can be pending. (Recall that a pending path is defined to contain some value that is not resolved.) We omit the proof of Lemma 4.3, as it is essentially contained in the proof of Lemma 3.2, 37 with 24/23 replacing 6/5. Lemma 4.4 The total time to generate and maintain the overlapping subpaths and thus, the representatives of the corresponding submatrices for all the heavy subpaths is O(n). Proof Recall that each vertex can be in at most two overlapping subpaths, so the total time for generating the representatives of the corresponding submatrices for all heavy subpaths is at most 2n. Theorem 4.5 The time for inserting, selecting, and deleting representatives of H and U across all iterations is O(n). First, we count the number of representatives inserted into H. Initially, at most Proof 2n − 1 subpaths have representatives in H. For j = 1, 2, . . . , log n − 1, consider all subpaths of length 2j that at some point have representatives in H. A path that can be split must have its smallest value at most λ2 and its largest value at least λ1. Note that light paths are not split further, while heavy paths are represented succinctly by submatrices. However, Mi,j > Mi−k,j+k for k > 0, since the heavy path represented by Mi−k,j+k is a subpath of the path represented by Mi,j. Hence, for any submatrix of size 2j × 2j which is split, at most one submatrix can be split in each diagonal extending upwards from left to right. There are fewer than 2n diagonals, so there will be fewer than 2(n/2j) submatrices that are split. Thus the number of submatrices resulting from quartering is less than 8(n/2j). Summing over all j gives O(n) insertions into H overall. Next, we count the number of representatives inserted into U. There are at most n subpaths of length 1, n/2 subpaths of length 2, and so forth, up to at most 1 path of length n. Since we insert a representative of each subpath at most once into U, the number of representatives inserted into U is O(n). 38 Finally, we show that the total selection time from H and U is linear in n. We give an accounting argument similar to that used in the proof of Lemma 3.3. Charge 2 credits for each value inserted into H or U. As H and U change, we maintain the invariant that the number of credits is twice the size of H or U, respectively. The rest of the proof is analogous to that of Lemma 3.3. Thus, we conclude that the time for performing selection is O(n). We make the following observations: The time spent by the feasibility test on a pending path is at least as much time as spent by the feasibility test as if the pending path were a processed path. Resolving a processed path does not increase the feasibility test time spent on pending paths. Based on these observations, we note that the feasibility test time spent on pending paths cannot increase and once all pending paths are resolved, the time spent on processed paths cannot increase. We analyze our algorithm in each of the following three exhaustive cases: 1. Lemma 4.6: The feasibility test spends more time on heavy paths than middleweight paths and at least as much time on pending paths as on processed paths. 2. Lemma 4.10: The feasibility test spends more time on heavy paths than middleweight paths and more time on processed paths than pending paths. 3. Lemma 4.11: The feasibility test spends at least as much time on middleweight paths as on heavy paths. Lemma 4.6 Suppose at the beginning of round r, that the feasibility test lands on at most n/2r−1 vertices. Suppose further that the feasibility test lands on more vertices in heavy paths than middleweight paths. If the feasibility test also lands on at least as many vertices in pending paths as vertices in processed paths, then following at most 163r + 170 iterations of selection and feasibility testing from H, the number of vertices in pending paths that the feasibility test lands on is either halved or at most n/2r+2. 39 Proof By assumption, the feasibility test lands on at most n/2r−1 vertices and lands on more vertices in heavy paths than middleweight paths, and at least as many vertices in pending paths as vertices in processed paths. If the number of vertices in pending paths that the feasibility test lands on is at most n/2r+2, then the result follows. Thus, we assume the feasibility test lands on more than n/2r+2 vertices in pending paths. By Lemma 4.3, in iteration i, at most 1/25k of the subpaths of length 2j−k can be pending, where 25j = (3/4) ∗ (24/23)i. Then for j = 2r + 2 and k = r, at most 1/25r of the subpaths of length 2(r+2) can be pending, so there are at most n/25r vertices remaining in pending paths. Thus, it takes at most i = (5(2r + 2) − log(3/4))/ log(24/23) < 163r + 170 iterations of selection and feasibility testing from H to reduce the amount of time spent on the pending paths by at least half. Since each iteration of feasibility testing lands on at most n/2r−1 vertices, the total number of vertices checked is at most (n/2r−1) (163r + 170). Before we can show an analogous result for processed paths, we introduce three preliminary lemmas. Lemma 4.7 If a feasible lands on at least t vertices in a processed path P , then P has length √ at least 2 t/2. Proof √ t/2. From the edge-path-partition, P can contain Suppose P has length less than 2 √ t/2−1. However, if P previously contained a prob- disjoint subpaths of lengths 1, 2, 22, . . . , 2 lematic vertex, then it may have two disjoint subpaths of each length. Thus, the feasibility test lands on at most 2(1 + 2 + . . . +(cid:112)t/2 − 1) = ((cid:112)t/2 − 1)(cid:112)t/2 < t vertices in total in P , which is a contradiction. Lemma 4.8 Suppose a feasibility test lands on at most n/2r vertices but more than n/2r+2 vertices. If the feasibility test spends more time on processed paths than pending paths, then the median length of leaf paths is at most max(24r2, 2400). 40 Proof Suppose, by way of contradiction, the median length of a leaf path is more than 24r2 and r > 10. Let x be the mean number of vertices the feasibility test lands on, across all leaf paths, so that 4r2 < x. Let t be the mean number of vertices the feasibility test lands on, across all processed paths. Recall that all leaf paths are pending paths. By assumption, the feasibility test spends more time on processed paths than pending paths. Moreover, the number of leaf paths is more than the number of internal paths, pending or processed, so that t > x. By Lemma 4.7, each processed path in which the feasibility test lands on at t/2. Thus, if x ≤ 2r, then by considering the pending least t vertices has length is at least 2 √ paths, the ratio of the time spent by the feasibility test to the total number of vertices is at x 24r2 < 1 most 2r+2 , which contradicts the assumption that the feasibility test lands on more than n/2r+2 vertices. On the other hand, if x > 2r, then by considering the processed paths, the ratio of the time spent by the feasibility test to the total number of vertices is at most √ t/2 < 2t 2 2r+2 for r ≥ 10, since t > x > 2r. This again contradicts the assumption √ x+t 24r2 +2 that the feasibility test lands on more than n/2r+2 vertices. Thus, the median length of a t/2 < 1 leaf path is at most max(24r2, 2400). For the remainder of the section, we analyze r ≥ 10, noting that for r < 10, the median length of a leaf path is at most 2400 and can be handled in a constant number of feasibility tests. Lemma 4.9 Suppose the feasibility test lands on at most n/2r vertices but more than n/2r+1 vertices. Suppose further that the feasibility test lands on more vertices in heavy paths than middleweight paths. If the feasibility test spends more time on processed paths than pending paths, then the median length of processed paths is at most 2r2+9. Hence, the number of vertices the feasibility test lands on in a median length processed path is at most 2(r2 + 9)2. Proof Suppose, by way of contradiction, the median length of processed paths is more than 2r2+9. Then by Lemma 4.7, the number of vertices in processed paths that the feasibility 41 test lands on is at most (cid:16) 2(r2 + 9)2/2r2+9(cid:17) n. By assumption, the feasibility test spends more time on heavy paths than middleweight paths, and more time on processed paths than pending paths, so the number of vertices in processed paths that the feasibility test lands on is at least n/2r+2. But for all positive integers i, it holds that 1/2i+2 > 2(i2 + 9)/2i2+9. (cid:16) 2(r2 + 9)2/2r2+9(cid:17) Thus, n/2r+2 > n, which contradicts the assumption that the feasibility test lands on more than n/2r+1 vertices. Hence, the median length of a processed path is at most 2r2+9. We are now ready to show the reduction in processed paths from repeated instances of feasibility testing. Lemma 4.10 Suppose at the beginning of round r, that the feasibility test lands on at most n/2r−1 vertices. Suppose further that the feasibility test lands on more vertices in heavy paths than middleweight paths. If the feasibility test lands on more vertices in processed paths than vertices in pending paths, then following at most 6(r2 + 9)(408r2 + 815r + 415) iterations of selection and feasibility testing from H, which takes O(nr4/2r) time, the number of vertices in processed paths that the feasibility test lands on is either halved or at most n/2r+2. Proof By assumption, the feasibility test lands on at most n/2r−1 vertices and lands on more vertices in heavy paths than middleweight paths, and more vertices in processed paths than vertices in pending paths. If the number of vertices in processed paths that the feasibility test lands on is at most n/2r+2, then the lemma immediately follows. Thus, we assume the feasibility test lands on more than n/2r+2 vertices in processed paths. By Lemma 4.8, the median length of a leaf path is at most 24(r−1)2. By Lemma 4.3, in iteration i, at most 1/25k of the subpaths of length 2j−k can be pending, where 25j = (3/4)(24/23)i. Then for j = 5(r + 1)2 and k = (r + 1)2, at most 1/25(r+1)2 of the subpaths of length 24(r+1)2 > 24(r−1)2 can be pending, so at least half of the leaf paths are resolved. It takes at most i = (25(r + 1)2 − log(3/4))/ log(24/23) < 408r2 + 815r + 414 iterations to 42 resolve half of the leaf paths, so that the appropriate values can be inserted into V. One more iteration of feasibility testing is run using the selected median from V. Thus, running at most 408r2 + 815r + 414 iterations of handle pending paths, followed by an iteration of handle processed paths (for a total of at most 408r2 + 815r + 415 iterations) reduces the number of leaf paths by a factor of 1/4, or equivalently, reduces the total number of paths by a factor of 1/8. Since (7/8)6 < 1/2, then by repeating at most 6(r2 + 9) times, the total number of paths is reduced by a factor of at least 1/2r2+9. If the average length of the remaining processed paths is more than 2r2+9, then by Lemma 4.9, the feasibility test lands on at most n/2r+1 vertices, which is a reduction of 1/2 > 1/4 in the number of vertices checked by the feasibility test. Otherwise, if the average length of the remaining processed paths is less than 2r2+9, then by reducing the total number of paths by factor of at least 1/2r2+9, the time spent by the feasibility test on vertices in processed paths is at least halved. We require at most 6(r2 + 9) cycles, each with 408r2 + 815r + 415 iterations of feasibility testing. Thus, at most 6(r2 + 9)(408r2 + 815r + 415) = O(r4) iterations are needed to reduce the feasibility test by at least half, each checking at most n/2r vertices, for a total of O(nr4/2r) time. Lemma 4.11 For each round, the feasibility test time is reduced by at least 1/2. Thus at the beginning of round r, the feasibility test lands on at most n/2r−1 vertices. Proof We note that prior to the first round, the feasibility test lands on exactly n vertices, and we proceed via induction. Suppose at the beginning of round r, the feasibility test lands on at most n/2r−1 vertices. If the feasibility test in fact lands on at most n/2r vertices, then the induction already holds. Recall that we have three cases, as we claimed just before Lemma 4.6. The feasibility test can spend at least as much time on middleweight paths as on heavy paths. Otherwise, the feasibility test spends more time on heavy paths than middleweight paths, but can spend more time on either pending paths or processed paths. 43 If the feasibility test spends at least as much time on pending paths as on processed paths, then by Lemma 4.6, no more than 163r + 170, which is certainly less than 408r2 + 815r + 415, iterations of selection and feasibility from H are needed to reduce the portion spent by the feasibility test on pending paths by at least half. Hence, the overall feasibility test time is reduced by at least 1/8. Otherwise, if the feasibility test spends more time on processed paths than pending paths, then by Lemma 4.10, at most (6r2 + 9)(408r2 + 815r + 415) iterations of selection and feasibility from H are needed to reduce the portion spent by the feasibility test on processed paths by at least half. Hence, the overall feasibility test time is reduced by at least 1/8. If the feasibility test spends at least as much time on middleweight paths as on heavy paths, then following a selection in U that is weighted by path length, and then a feasibility test, at least half the vertices in middleweight paths will be determined to be either in light paths or in heavy paths. If the vertices are determined to be in light paths, then the portion spent by the feasibility test on these paths is reduced by at least half, since newly formed light paths are cleaned and glued in handle middleweight paths, without increasing the time spent by the feasibility test on heavy paths. Hence, if λ1 is increased by a feasibility test from U, the overall feasibility test time is reduced by at least 1/8. However, if the vertices are determined to be in heavy paths, our algorithm will insert the representatives of the corresponding submatrices into H. Our algorithm thus reduces the portion spent by the feasibility test on heavy paths by at least 1/8. Hence, taking the reductions of both types into account, the overall feasibility test time is reduced by at least 1/16. Thus, we can reduce the overall number of vertices that the feasibility test lands on by 1/16 in O(nr4/2r) time, for each r. Since (15/16)11 < 1/2, then at most eleven repetitions suffice to halve the overall number of vertices checked by the feasibility test. Indeed, each round requires at most 11[6(r2 + 9)] = 66(r2 + 9) repetitions, and so at the beginning of round r + 1, the runtime is at most n/2r. 44 Corollary 4.12 Round r has O(r4) calls to the feasibility test. Proof Since round r requires at most 66(r2 +9) repetitions of the inner loop, and the inner loop uses at most (408r2 + 815r + 415) feasibility tests, then the total number of feasibility tests in round r is O(r4). Now, we claim the main result of paper. Theorem 4.13 The runtime of our algorithm is O(n). Proof By Lemma 4.11, the feasibility test lands on at most n/2r−1 vertices at the beginning O(n/2r−1) time each. Hence, there are at most log n rounds. Note that (cid:80)log n of round r. By Corollary 4.12, round r has O(r4) calls to the feasibility test, which take r=0 nr4/2r−1 is O(n). By Theorem 4.5, the total time for handling H and U and performing selection over all iterations is O(n), while the same result clearly holds for V. Therefore, the total time required by our algorithm is O(n). 5 Conclusion Our algorithms solve the max-min and min-max path k-partition problems, as well as the max-min tree k-partition problem in asymptotically optimal time. Consequently, they use the paradigm of parametric search without incurring any log factors. We avoid these log factors by searching within collections of candidate values that are implicitly encoded as matrices or as single values. We assign synthetic weights for these values based on their corresponding path lengths so that weighted selections favor the early resolution of shorter paths, which will speed up subsequent feasibility tests. In fact, our analysis relies on demon- strating a constant fraction reduction in the feasibility test time as the algorithm progresses. Simultaneously, unweighted selections quickly reduce the overall size of the set of candidate values so that selecting test values is also achieved in linear time. 45 Furthermore, we have successfully addressed the challenge of developing a meaningful quantity to track progress as the algorithm proceeds. We have proved that the time to perform a feasibility test describes in a natural way the overall progress from the beginning of the algorithm. Unfortunately, even these observations alone are not enough to overcome the challenges of tree partitioning. In particular, without both compressing long paths and pruning leaf paths quickly, the feasibility test time might improve too slowly for the overall algorithm to take linear time. Our dual-pronged strategy addresses both issues simultane- ously, demonstrating that parallel algorithms are not essential or even helpful in designing optimal algorithms for certain parametric search problems. References [1] E. M. Arkin and C. H. Papadimitriou. On the complexity of circulations. J. Algorithms, 7:134–145, 1986. [2] R. I. Becker, Y. Perl, and S. R. Schach. A shifting algorithm for min-max tree parti- tioning. J. ACM, 29:58–67, 1982. [3] M. Blum, R. W. Floyd, V. R. Pratt, R. L. Rivest, and R. E. Tarjan. Time bounds for selection. J. Comput. Syst. Sci., 7:448–461, 1972. [4] R. Cole. Partitioning point sets in arbitrary dimensions. Theor. Comput. Sci., 49:239– 265, 1987. [5] R. Cole. Slowing down sorting networks to obtain faster sorting algorithms. J. ACM, 34:200–208, 1987. [6] R. Cole, J. S. Salowe, W. L. Steiger, and E. Szemeredi. An optimal-time algorithm for slope selection. SIAM J. Comput., 18:792–810, 1989. [7] G. N. Frederickson. Optimal algorithms for partitioning trees and locating p centers in trees. Technical Report CSD-TR-1029, Purdue University, 1990. [8] G. N. Frederickson. Optimal algorithms for tree partitioning. In Proc. 2nd ACM-SIAM Symp. on Discrete Algorithms, pages 168–177, San Francisco, January 1991. 46 [9] G. N. Frederickson and D. B. Johnson. Finding kth paths and p-centers by generating and searching good data structures. J. Algorithms, 4:61–80, 1983. [10] G. N. Frederickson and D. B. Johnson. Generalized selection and ranking: sorted matrices. SIAM J. on Computing, 13:14–30, 1984. [11] D. Gusfield. Parametric combinatorial computing and a problem of program module distribution. J.ACM, 30:551–563, 1983. [12] S. Kundu and J. Misra. A linear tree partitioning algorithm. SIAM J. on Computing, 6:151–154, 1977. [13] N. Megiddo. Applying parallel computation algorithms in the design of serial algorithms. J. ACM, 30:852–865, 1983. [14] Y. Perl and S. R. Schach. Max-min tree partitioning. J. ACM, 28:5–15, 1981. [15] M. Reichling. On the detection of a common intersection of k-convex polyhedra. Lect. Notes Comput. Sci., 333:180–187, 1988. [16] J. S. Salowe. L-infinity interdistance selection by parametric search. Inf. Proc. Lett., 30:9–14, 1989. [17] E. Zemel. A linear time randomizing algorithm for searching ranking functions. Algo- rithmica, 2:81–90, 1987. 47 Figure 1: Path P , vectors X1 and X2, and explicit illustration of matrix M (P ) 48 Figure 2: Explicit illustration of submatrices, just after quartering on the first iteration of PATH0 49 Figure 3: Explicit illustration of submatrices at the end of the first iteration PATH0 50 Figure 4: An edge-path-partition for T 51 Figure 5: The edge-path-partition of the resulting tree after all leaf-paths are deleted 52 Figure 6: Explicit representation of initial submatrices for M (P ) in PATH1 53